pax_global_header00006660000000000000000000000064144651747020014524gustar00rootroot0000000000000052 comment=662bb1b5592d9363fc3b17309862b422862e0b0a rott-20230810/000077500000000000000000000000001446517470200127555ustar00rootroot00000000000000rott-20230810/.github/000077500000000000000000000000001446517470200143155ustar00rootroot00000000000000rott-20230810/.github/workflows/000077500000000000000000000000001446517470200163525ustar00rootroot00000000000000rott-20230810/.github/workflows/main.yml000066400000000000000000000050411446517470200200210ustar00rootroot00000000000000name: Continuous Integration on: push: branches: [ "main" ] tags-ignore: ['*'] paths-ignore: ['**.md'] pull_request: branches: [ "main" ] paths-ignore: ['**.md'] jobs: build: name: ${{ matrix.config.name }} runs-on: ${{ matrix.config.os }} defaults: run: shell: ${{ matrix.config.shell }} strategy: fail-fast: false matrix: config: - { name: Linux GCC, os: ubuntu-latest, compiler: gcc, shell: bash, } - { name: macOS Clang, os: macos-latest, compiler: clang, shell: bash, } - { name: MSYS2 UCRT64, os: windows-latest, compiler: gcc, shell: 'msys2 {0}', msystem: ucrt64, msys-env: mingw-w64-ucrt-x86_64, } steps: - name: Install dependencies (Linux) if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install \ automake \ libsdl2-dev \ libsdl2-mixer-dev - name: Install dependencies (macOS) if: runner.os == 'macOS' env: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 run: | brew update || true brew install \ automake \ sdl2 \ sdl2_mixer - name: Install dependencies (MSYS2) if: matrix.config.shell == 'msys2 {0}' uses: msys2/setup-msys2@v2 with: msystem: ${{ matrix.config.msystem }} update: false install: >- ${{ matrix.config.msys-env }}-gcc ${{ matrix.config.msys-env }}-autotools ${{ matrix.config.msys-env }}-SDL2 ${{ matrix.config.msys-env }}-SDL2_mixer - uses: actions/checkout@v3 - name: Configure env: CC: ${{ matrix.config.compiler }} CFLAGS: -Wall run: | autoreconf -fiv ./configure --enable-werror - name: Build run: make cppcheck: name: Cppcheck runs-on: ubuntu-latest steps: - name: Install dependencies run: | sudo apt-get update sudo apt-get install cppcheck - uses: actions/checkout@v3 - name: Run cppcheck shell: bash run: | cppcheck --version cppcheck --error-exitcode=1 -j4 -q --force -U_WIN32 -U__APPLE__ -Irott -Irott/audiolib rott rott/audiolib rott-20230810/.gitignore000066400000000000000000000003661446517470200147520ustar00rootroot00000000000000Makefile Makefile.in aclocal.m4 autom4te.cache/ compile config.guess config.log config.status config.sub configure depcomp install-sh missing */Makefile */Makefile.in */rott* */*.o */*/Makefile */*/Makefile.in */*/*.a */*/*.o */*/.deps/ */.deps/ rott-20230810/COPYING000066400000000000000000000431331446517470200140140ustar00rootroot00000000000000 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) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 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. rott-20230810/Makefile.am000066400000000000000000000000171446517470200150070ustar00rootroot00000000000000SUBDIRS = rott rott-20230810/README000066400000000000000000000103161446517470200136360ustar00rootroot00000000000000================ ROTT Port README ================ This is a port of Apogee's 3D action title Rise of the Triad, originally released in 1994. This port duplicates the functionality of the original game on modern operating systems, including Linux, Win32, and Mac OS X. This port makes use of the Simple Direct Media Layer, or SDL, and an additional library named SDL_mixer. If you do not have these libraries installed, check the links section below. This software is distributed in source code format and is licensed under the terms of the GNU General Public License. A copy of this license is included with the software in the file COPYING. This software is not supported by 3D Realms, Apogee, or the porters. For reference, the primary contributors to this port are: Steven Fuller Ryan C. Gordon John Hall Dan Olson ------------------------- Notes for the 1.1 Release ------------------------- Thanks to the effort of the contributors listed below (and probably many more), lots of bug fixes, portability improvements and new features have found their way into the 1.1 release. Many changes have been ported over from the WinRott port (not WinRottGL but plain WinRott) with the high resolution software rendering support being the main feature of all these changes. Portability fixes include support for 64-bit and big-endian systems. Birger N. Andreasen (author of the WinRott port , initial work by Jonathan Bailey) Hans de Goede (porting of the WinRott high resolution renderer, lots of bug and portability fixes for the Fedora package) Alexander Thomas aka Dr. Lex (author of the OS X port , thanks Filippo Giunchedi for creating the appropriate patch for the Debian package) Michael Karcher (lots of bug and portability fixes for the Debian package) Fabian Greffrath (some minor improvements) ---------------------------- Notes for the 1.1.x Releases ---------------------------- Version 1.1.1 is merely a bugfix release that contains all the patches that have accumulated in Fedora and Debian during the previous year. Version 1.1.2 is another bugfix release that contains the Debian patches from the previous two and a half years; among them enabling the playback of demo files. Furthermore the build system has undergone a complete overhaul. Enabling the use of UNICODE (instead of keyboard scancodes) for the cheat codes and names in the highscore table is considered the release goal for the next point release. Getting network play working is considered the release goal for the 2.0 version. Work on both of these projects has not yet begun, though... In this context: Please send bug reports, questions, suggestions and comments to the Fedora or Debian maintainers of the respective rott packages in these distributions. Patches are always welcome. ;-) ------------- General Hints ------------- The following prerequisites are required to compile the source code: autoconf automake pkg-config SDL 1.2 SDL_mixer 1.2 To compile the source code, type the following: autoreconf -fiv ./configure make The resulting binaries can be found in the rott/ directory. The build system is setup to build the commercial variant of ROTT. This variant supports the Registered Version, the "Super ROTT" CD Version and the "Site License" CD Version of the game by automatically detecting and loading their corresponding multiplayer map files. If you want to build the shareware version of ROTT, configure with: ./configure --enable-shareware Additionally, you may pass the "--enable-suffix=" parameter to ./configure in order to append a suffix to the executable file name, e.g. to tell the commercial and the shareware variants apart. You may also want to pass the "--enable-datadir=" parameter to point the executables to the location of your game data files. ------------ Known Issues ------------ - Demos go out of sync. - No netplay support. ------------- Helpful Links ------------- ROTT Port site: http://icculus.org/rott/ The Simple Direct Media Layer: http://www.libsdl.org/ SDL_mixer: http://www.libsdl.org/projects/SDL_mixer 3D Realms official forum on ROTT source code: http://forums.3drealms.com/ubb/ultimatebb.php?ubb=forum;f=24 rott-20230810/configure.ac000066400000000000000000000043731446517470200152520ustar00rootroot00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) AC_INIT([rott], [1.1.2]) AM_INIT_AUTOMAKE([foreign no-define]) AC_CONFIG_SRCDIR([rott/version.h]) #AC_CONFIG_HEADERS([config.h]) # Checks for programs. AC_PROG_CC AC_PROG_RANLIB # Checks for libraries. PKG_CHECK_MODULES([SDL], [sdl2]) PKG_CHECK_MODULES([SDL_mixer], [SDL2_mixer]) # Checks for header files. AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h stdint.h]) # Checks for typedefs, structures, and compiler characteristics. AC_CHECK_HEADER_STDBOOL AC_C_INLINE AC_TYPE_INT16_T AC_TYPE_INT32_T AC_TYPE_INT64_T AC_TYPE_INT8_T AC_TYPE_SIZE_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT64_T # Checks for library functions. AC_FUNC_ALLOCA AC_FUNC_MALLOC AC_FUNC_REALLOC AC_CHECK_FUNCS([memmove memset mkdir pow strcasecmp strerror strrchr strstr strtol strchr strdup]) # Set to build the shareware version AC_ARG_ENABLE([shareware], [AS_HELP_STRING([--enable-shareware], [set to build the shareware version])], [AC_DEFINE([SHAREWARE])], []) # Set executable file name suffix AC_ARG_ENABLE([suffix], [AS_HELP_STRING([--enable-suffix], [set executable file name suffix])], [suffix="$enableval"], [suffix=no]) case "$suffix" in no|yes) suffix= ;; *) # Add leading dash suffix=-${suffix} ;; esac SUFFIX=${suffix} AC_SUBST([SUFFIX]) # Set data file directory AC_ARG_ENABLE([datadir], [AS_HELP_STRING([--enable-datadir], [set data file directory])], [datadir="$enableval"], [datadir=no]) # Remove duplicate and trailing slashes datadir=`echo ${datadir} | tr -s '/' | sed 's|/*$||'` case "$datadir" in no|yes) ;; *) AC_DEFINE_UNQUOTED([DATADIR], ["$datadir/"]) ;; esac AC_ARG_ENABLE([werror], [AS_HELP_STRING([--enable-werror], [Treat warnings as errors])]) AS_IF([test "x$enable_werror" = "xyes"], [CFLAGS="$CFLAGS -Werror"]) AC_CONFIG_FILES([Makefile rott/Makefile rott/audiolib/Makefile]) AC_OUTPUT rott-20230810/doc/000077500000000000000000000000001446517470200135225ustar00rootroot00000000000000rott-20230810/doc/13todo.txt000066400000000000000000000032071446517470200153760ustar00rootroot00000000000000( ) NME does not always exit level upon killing him ( ) Game locks when firing Darkstaff or Dog Mode at El Oscuro ( ) Network server locks up when exiting net game ( ) Stand( )alone server doesn't work consistently ( ) Break out with error message if ROTT is run with no sound.rot ( ) Quickload question should have (Y/N) on end ( ) Phone number length needs to be lengthed. ( ) Network packets need checksum word added to their packets ( ) VR gear new mouse sub functions ( ) Dog mode still locks up as well as some bat blast stuff ( ) Fix Live Remote Ridicule ( ) Wall can push you into platform so you fall down inside of it and be stuck. ( ) Hanging at menu after a few network/modem games ( ) Hanging at warp menu prompt ( ) Warp Menu: chose level, screen went black, some how still in level select ( ) Unexpect Interrupt ( ) Generat random levels and battle levels. Choose alternate both. New game End Game New Game Kaboom ( ) Make snake heads hurt to touch (fixes snake trapping you) ( ) Fix missiles not hitting enemy when standing face to face ( ) lockup on snake with one head left ( ) gamepad enabled before joystick enabled ( ) bark blast under dog walls and stuff ( ) config files saved in alternat RTS directory ( ) people complaining about reconfiging joystick each time ( ) Panic mapping over modem glass in 8 megs not in 4 megs ( ) Voice credit for OverPatrol (CHuck) Lightning guard (william) MAP Stuff ( ) level 1( )3 in random powerup crossroads room, two different wall types ( ) Krist, if led outside of room, goes up disks, but can't go down them. So he winds up running around sky. Fix map to lock door so Krist cannot come out... rott-20230810/doc/cheats.txt000066400000000000000000000111101446517470200155240ustar00rootroot00000000000000 DISPSTICK // enable cheats \ECC // enable cheats SLACKER // three keys, more health \BUM // three keys, more health CHOJIN // normal god mode \WWW // normal god mode GOTO // warp \GTL // warp SIXTOYS // all keys, armor, 100% health \GAI // all keys, armor, 100% health TOOSAD // god mode powerup \GOD // god mode powerup // Register only WOOF // dog mode powerup \DOG // dog mode powerup // end FLYBOY // mercury mode powerup \MER // mercury mode powerup BADTRIP // shrooms mode powerup \SHR // shrooms mode powerup BOING // elasto mode powerup \ELA // elasto mode powerup GOOBERS // warp to level 1, start with pistol \GOO // warp to level 1, start with pistol WHACK // hurt player 10% \OOF // hurt player 10% SPEED // run fast all the time \RFA // run fast all the time PANIC // back to normal \PAN // back to normal DIMON // light diminishing on \DON // light diminishing on DIMOFF // light diminishing off \DOF // light diminishing off LONDON // fog on (0x00 - 0x80 minmax) \FON // fog on (0x00 - 0x80 minmax) NODNOL // fog off (0x80 - 0xFF minmax) \FOF // fog off (0x80 - 0xFF minmax) GOGATES // blow out of game \L8R // blow out of game GOARCH // end the current level \ECL // end the current level GOTA386 // floor and ceiling off \CON // floor and ceiling off GOTA486 // floor and ceiling on \COF // floor and ceiling on SHOOTME // bullet proof armor \BAR // bullet proof armor BURNME // fire proof armor \FAR // fire proof armor LUNGDUNG // gas mask \GAR // gas mask HUNTPACK // all keys, armor, 100% health, MP40, \OFP // all keys, armor, 100% health, MP40, 86ME // kill player \DIE // kill player NEER // re-enter level \REL // re-enter level JOHNWOO // give double pistol \GW2 // give double pistol PLUGME // give mp40 \GW3 // give mp40 VANILLA // give bazooka \GW4 // give bazooka HOTTIMES // give heatseeker \GW5 // give heatseeker BOOZE // give drunk missile \GW6 // give drunk missile FIREBOMB // give firebomb \GW7 // give firebomb BONES // give firewall \GW8 // give firewall SEEYA // give god hand \GW9 // give god hand // Register Only SPLIT // give split missile \GWA // give split missile KESOFDEATH // give kes \GWB // give kes HOMERUN // give bat \GWC // give bat CUJO // give dog weapon \GWD // give dog weapon // end RIDE // give MISSILE CAM \CAM // give Missile Cam WHERE // turn where am i on/off \HUD // give hud \FUN // Rotation fun RECORD // Demo RECORD STOP // Demo stop recording PLAY // Demo Playback \EKG // Engine Killing Gibs MAESTRO // JukeBox \LEE // JukeBox CARTIER // Map Cheat \MAP // Map Cheat \YOU // Secret Message HAVE // Secret Message \NO // Secret Message LIFE // Secret Message rott-20230810/doc/cmdline.txt000066400000000000000000000052171446517470200157030ustar00rootroot00000000000000 ROTT.EXE ======== NOWAIT go to menu, skip intro NOSOUND no music no sound NOW go immediately into game default difficulty default level 1 DOPEFISH Scott Head intro, random sounds in credits, burping while caching, silly strings, eluder/deluder as scott's head, silly death cam, silly menu sounds MAPSTATS Print out map statistics to MAPDEBUG.TXT TILESTATS Print out tile statistics to MAPDEBUG.TXT VER Rott version number PAUSE Pause after printing startup info SOUNDSETUP Launch sound Setup WARP [level] Launch to any level (1 based) LEVELSIZE compute memory needed for level SLOWDEATH slow down death rotation QUIET get rid of all start up text except for errors FILE FILE1 add external wads for graphic replacement FILE2 NOJOYS disable joystick test NOMOUSE disable mouse test NOECHO turn off reverb effect DEMOEXIT exit the game when demo is interrupted TIMELIMIT play for a certain amount of time in seconds once time is gone game ends (unlimited lives) get more time by killing guards and picking up ankhs must use MAXTIMELIMIT as well MAXTIMELIMIT the max time to count down from so if you keep killing guards you cannot get an infinite amount of time must use TIMELIMIT as well ENABLEVR enable Virtual Reality support for HMD's (Head mounted disp) WARP warp to a specific level 1 based level 1 is 1 NET Used by ROTTSER and ROTTIPX IS8250 Used by ROTTSER whether you have an 8250 or not TEDLEVEL Ted stuff (DEV ONLY) MONO enable mono-monitor support (Development only) (DEV ONLY) TRANSPORT Warp to any x,y,angle in level (Development only) (DEV ONLY) SCREENSHOTS get rid of screen title stuff (Development only) ROTTSER.EXE ======== VECTOR interrupt vector with which to communicate with ROTT ANSWER answer mode DIAL dial mode PAUSE pause before launching STATS print out run time stats after ROTT returns PLAYER 0 - makes you the master 1 - makes you not the master must be used on both systems with different values, to work properly ROTTIPX.EXE ======== VECTOR interrupt vector with which to communicate with ROTT PAUSE pause before launching NODES number of players in game SOCKET network socket to use SERVER specify this computer to be a server STANDALONE specify this server to be standalone else client on top of server MASTER used by client to make yourself the master REMOTERIDICULE turn on remote ridicule support rott-20230810/doc/hacker.txt000066400000000000000000000347251446517470200155330ustar00rootroot00000000000000 Rise of the Triad Version 1.1 Hacker Info RTL & RTC File format: ---------------------- Rise of the Triad (ROTT) uses two file extensions for levels data, RTL and RTC. RTC indicates that the file is for Comm-bat (multiplayer) play only and does not contain any enemies or exits. RTL indicates the file can can be used for both Comm-bat and standard game levels. In Comm-bat, the enemies in RTL maps in standard play are not present during Comm-bat games and the exit and entrance arches behave like teleporters. Other than these differences, the two files are alike. The RTL/RTC file format changed with the release of ROTT version 1.1. Since the shareware version of ROTT cannot use alternate levels, this should not be a problem for map designers. The new format is much more formal. If any changes are made in the format in the future, the first 8 bytes of the file will inform you if it is compatible with your editor/viewer. The RTL/RTC file is broken into three sections: Version info, Header block, and Data block. RTL/RTC version info This 8 byte block of data indicates what type of file it is and which version of the RTL/RTC file format it is. Offset Size Description ------------------------------------------------------------- 0 4 Format signature 4 4 Version number Format signature : This is used to indicate what type of levels are contained within the file. This is a null-terminated string containing either "RTL" or "RTC". Version number : 0101h for version 1.1. If this value is higher, it indicates that the file format has changed. This is NOT the ROTT version. RTL/RTC Header block The header block contains an array of 100 structures with the following format: Offset Size Explanation ------------------------------------------------------------- 0 4 Used flag 4 4 CRC 8 4 RLEWtag 12 4 MapSpecials 12 4 Offset in file of Wall plane 16 4 Offset in file of Sprite plane 20 4 Offset in file of Info plane 24 4 Length of Wall plane 28 4 Length of Sprite plane 32 4 Length of Info plane 36 24 Name of level Used flag : This is non-zero if a map exists at this position. CRC : This value is used to determine if all the players in a multiplayer game are using the same maps. You can use any method you like to calculate this value. RLEWtag : This is the run-length encoding tag used for compressing and decompressing the map data. The use of this will be described below. MapSpecials : This is used for flags that describe special conditions for the level. Currently only one flag is used. If Bit 0 is set, then all the pushwalls will be activated in Comm-bat mode. This is done in case there are player start locations within hidden areas and the player would be trapped until a pushwall was activated. Offsets : The Wall, Sprite, and Info plane offsets are each absolute offsets of the data from the beginning of the file. Lengths : The Wall, Sprite, and Info plane lengths are each lengths of the uncompressed data. Name of level : This is a null-terminated string containing the name of the level. Although there is 24 bytes available, level names should be at most 22 bytes long. RTL/RTC Data block When expanded, ROTT maps contain 3 planes of 128 by 128 word sized data. They are stored in the RTL/RTC files as 3 blocks of run-length encoded data. The procedure for decompressing them is as follows: 1) Allocate 128 * 128 words of memory (32768 bytes) 2) Read one word from compressed block 3) If word is equal to RLEWTag, then the next two words are a compressed run of data. The first word is the number of words to write. The second word is the value to write map. If word was not equal to RLEWTag, then simply write that word to the map. 4) Go back to 2 until all data is written. Here's an example of the procedure in C. /*--------------------------------------------------------------------- Function: RLEW_Expand Run-length encoded word decompression. ---------------------------------------------------------------------*/ void RLEW_Expand ( unsigned short *source, unsigned short *dest, long length, unsigned short rlewtag ) { unsigned short value; unsigned short count; unsigned short *end; end = dest + length; while( dest < end ); { value = *source; source++; if ( value != rlewtag ) { // // uncompressed data // *dest = value; dest++; } else { // // compressed string // count = *source; source++; value = *source; source++; // // expand the data // while( count > 0 ) { *dest = value; dest++; count--; } } } } Here is sample code for loading a ROTT map. #include #include #include #include /*--------------------------------------------------------------------- Map constants ---------------------------------------------------------------------*/ #define MAXLEVELNAMELENGTH 23 #define ALLOCATEDLEVELNAMELENGTH 24 #define NUMPLANES 3 #define NUMHEADEROFFSETS 100 #define MAPWIDTH 128 #define MAPHEIGHT 128 #define MAP_SPECIAL_TOGGLE_PUSHWALLS 0x0001 #define WALL_PLANE 0 #define SPRITE_PLANE 1 #define INFO_PLANE 2 /*--------------------------------------------------------------------- Type definitions ---------------------------------------------------------------------*/ typedef struct { unsigned long used; unsigned long CRC; unsigned long RLEWtag; unsigned long MapSpecials; unsigned long planestart[ NUMPLANES ]; unsigned long planelength[ NUMPLANES ]; char Name[ ALLOCATEDLEVELNAMELENGTH ]; } RTLMAP; /*--------------------------------------------------------------------- Global variables ---------------------------------------------------------------------*/ unsigned short *mapplanes[ NUMPLANES ]; /*--------------------------------------------------------------------- Macros ---------------------------------------------------------------------*/ #define MAPSPOT( x, y, plane ) \ ( mapplanes[ plane ][ MAPWIDTH * ( y ) + ( x ) ] ) #define WALL_AT( x, y ) ( MAPSPOT( ( x ), ( y ), WALL_PLANE ) ) #define SPRITE_AT( x, y ) ( MAPSPOT( ( x ), ( y ), SPRITE_PLANE ) ) #define INFO_AT( x, y ) ( MAPSPOT( ( x ), ( y ), INFO_PLANE ) ) /*--------------------------------------------------------------------- Function: ReadROTTMap Read a map from a RTL/RTC file. ---------------------------------------------------------------------*/ void ReadROTTMap ( char *filename, int mapnum ) { char RTLSignature[ 4 ]; unsigned long RTLVersion; RTLMAP RTLMap; int filehandle; long pos; long compressed; long expanded; int plane; unsigned short *buffer; filehandle = open( filename, O_RDONLY | O_BINARY ); // // Load RTL signature // read( filehandle, RTLSignature, sizeof( RTLSignature ) ); // // Read the version number // read( filehandle, &RTLVersion, sizeof( RTLVersion ) ); // // Load map header // lseek( filehandle, mapnum * sizeof( RTLMap ), SEEK_CUR ); read( filehandle, &RTLMap, sizeof( RTLMap ) ); if ( !RTLMap.used ) { // // Exit on error // printf( "ReadROTTMap: Tried to load a non existent map!" ); exit( 1 ); } // // load the planes in // expanded = MAPWIDTH * MAPHEIGHT * 2; for( plane = 0; plane <= 2; plane++ ) { pos = RTLMap.planestart[ plane ]; compressed = RTLMap.planelength[ plane ]; buffer = malloc( compressed ); lseek( filehandle, pos, SEEK_SET ); read( filehandle, buffer, compressed ); mapplanes[ plane ] = malloc( expanded ); RLEW_Expand( buffer, mapplanes[ plane ], expanded >> 1, RTLMap.RLEWtag ); free( buffer ); } close( filehandle ); } MAP WEIRDNESS ------------- You can pretty much figure out most of the map data easily, but there are a few things in the map which are a little oddly set up. Here's a few helpful items. THE UPPER CORNER The first row of a map contains vital information to setting up a map. In the first plane (WALLS) are these values: 0,0 FLOOR # (0xB4 through 0xC3, though we might cut some) 1,0 CEILING # (0xC6 through 0xD5, or skies: 0xEA to 0xEE) 2,0 BRIGHTNESS LEVEL (0xD8 to 0xDF, from dark to light) 3,0 RATE AT WHICH LIGHT FADES OUT WITH DISTANCE (0xFC to 0x010B, fast to slow) In the second plane (SPRITES) are these: 0,0 Height of level (1-8 ranges from 0x5A to 0x61, 9-16 is from 0x01C2 to 0x01C9) 1,0 Height that sky is at relative to level (with same 1-16 arrangement) (not needed for level with a ceiling) 2,0 Icon for NO FOG (0x68) or FOG (0x69) 3,0 Light sourcing icon (0x8B: if present, lights illuminate walls) Optional items in the upper corner are: Second Plane Lightning icon (0x0179) Timer icon (0x79: third plane points 0xXXYY to X,Y location of timed thing--time in minutes/seconds there is MMSS in decimal digits, so 0130 is 1 minute thirty seconds--and to one side of that timed thing is the end time in the same format. This, for instance, would say when to shut the door that opened at the start time) Third Plane (INFO) Song number: 0xBAnn, where nn is song number. If not present, the game will choose song 0. If greater than the number of level songs (18 in shareware), the game will blow out. DISKS Gravitational Anomaly Disks (GADS) are set up with a GAD icon in the second plane and a height in the third plane. The actual graphic has a disk in the top quarter, so to put one on the floor, you sort of have to put the object IN the floor, so the disk will be at the right height. Heights for objects start with 0xB0 and have that last byte as a tiles-off-the-floor nybble and sixteenths-of-a-tile fraction. So 0xB000 is, for normal sprites, resting on the floor. For disks, that would be a disk you could stand on to be one story (eight feet) in the air. The heights of disks usually go by sixes (that's the maximum they can be apart and you can still climb them like stairs) or fours (for a more gradual ascension). Here are three sets of height values. The values of 0xB0F1-$B0FE are into the floor, and $B0F6 is right about floor height. by 6 by 4 by 2 B0F6 B0F6 B0F6 B0FC B0FA B0F8 B002 B0FE B0FA B008 B002 B0FC B00E B006 B0FE B014 B00A B010 B01A B00E B012 B020 B012 B014 B026 B016 ... B02C B01A B032 B01E B038 B022 B03E B026 B044 B02A B04A B02E B050 B032 B056 B036 B05C B03A B062 B03E B068 B042 B06E B046 B074 B04A B07A B04E If you need higher ones, calculate them yourself, man. SWITCHES AND TOUCHPLATES Everything activated by a switch or touchplates points to the switch or touchplate that activates it, with the standard 0xXXYY format. This way tons of things can be activated by one switch. To make a door open with multiple switches/touchplates, make it a few tiles wide and have different parts of the door point to the different switches. LOCKED DOORS Locked doors are normal doors with a key sprite icon placed on them. ============================================================================ The ROTT WAD Format ------------------- Most of you out there are probably very familiar with the WAD file format developed by Id Software. We borrowed the format with their consent and use it for all the data in Rise of the Triad. The WAD structure itself is identical to that of other WAD's, where the WAD header is as follows: typedef struct { char identification[4]; long numlumps; long infotableofs; } wadinfo_t; and the WAD directory is made up of [numlumps] of: typedef struct { long filepos; long size; char name[8]; } lumpinfo_t; ROTT Specific Data ------------------ WALLS - Walls are stored in the WAD between the two labels "WALLSTRT" and "WALLSTOP". The format of each wall is a 4,096 block of data with no header. The bitmaps are grabbed in vertical posts so that drawing in modex is more straight format. All walls must be 64 x 64. The walls must be the first few lumps in the WAD. MASKED OBJECTS - Masked objects in the wad comprise all actors and sprites. They can be found as weapons, objects, actors etc. They use the following headers and structures: typedef struct { short origsize; // the orig size of "grabbed" gfx short width; // bounding box size short height; short leftoffset; // pixels to the left of origin short topoffset; // pixels above the origin unsigned short collumnofs[320]; // only [width] used, the [0] is &collumnofs[width] } patch_t; These are extremely similar to the patches used in another game, except for the addition of the origsize parameter. typedef struct { short origsize; // the orig size of "grabbed" gfx short width; // bounding box size short height; short leftoffset; // pixels to the left of origin short topoffset; // pixels above the origin short translevel; short collumnofs[320]; // only [width] used, the [0] is &collumnofs[width] } transpatch_t; Certain objects in the game like masked walls and touch plates will use the second type of patch which acts like a translucent patch. SKYS, FLOORS and CEILINGS - Skys are larger than the screen and are made up of two 256X200 grabs in posts similar to the walls. The first grab represents the bottom part of the sky and the second part the top of the sky. The skys are denoted by the labels SKYSTRT and SKYSTOP. Floors and ceilings use the following structure: typedef struct { short width,height; short orgx,orgy; byte data; } lpic_t; They can be found between the labels UPDNSTRT and UPDNSTOP. Okay, enough hints! Have fun figuring stuff out. --THE DEVELOPERS OF INCREDIBLE POWER rott-20230810/doc/readme.txt000066400000000000000000000226141446517470200155250ustar00rootroot00000000000000Rise of the Triad (v1.3 CD Version) Source Code Release - December 20, 2002. (If you can't read this right in your editor, turn on word wrap) Please note that this is being released without any kind of support from Apogee Software, Ltd / 3D Realms Entertainment. We cannot and will not help in getting this running. We do not guarantee that you will be able to get it to work, nor do we guarantee that it won't blow up your computer if you do try and use it. Caveat Emptor - Use at your own risk. Having said that, this source code release was compiled on December 7, 2002 using the materials in this archive. Here's a note from one of the original ROTT programmers (Jim Dose) as to what will be needed to get this compiled: ------ You will need Watcom C v10.0b, which is what was used to compile the game originally. This source code release was tested with that version. Other versions are not guaranteed to work. Later versions such as v11.0 are known to most likely not work because of changes in the way data types are handled. You also need Borland's Turbo Assembler (TASM), but it is not required to build the full game if you use the .obj files that are already included. To do a full rebuild of the C code without having TASM, delete all the .obj files except for the following files: F_SCALE.OBJ RT_DR_A.OBJ RT_FC_A.OBJ RT_SC_A.OBJ RT_VH_A.OBJ To compile ROTT, type "wmake all". To compile the audio library, run "wmake.bat". (You'll also need a registered CD version of Rise of the Triad, too.) ----- Please note that while we are releasing the source code to Rise of the Triad, the game itself has not been released in the same manner (in other words, Rise of the Triad is still commercial software). You can still buy the game from us by visiting http://www.3drealms.com. Thanks to all the fans who have hung in there and waited for us to do something like this, we hope you enjoy it. If you produce something cool with this source code, drop us a line at rott@3drealms.com. In honor of the source code release, we contacted Tom Hall to reminicse a bit about the game, and we have some history from Scott Miller, President of Apogee. Their thoughts are below. Furthermore, the release of the Rise of the Triad source code is dedicated to our late friend and cohort, William Scarboro. William was one of the original Rise of the Triad programmers, and he unfortunately died of an asthma attack on August 9, 2002. William was born March 2, 1971 in El Paso, TX. He was a graduate of Texas A&M with a degree in Computer Science. He came to work here back in 1993, and was the first programmer we hired back then when we started doing in house development. He was mainly known for his work on Rise of the Triad where he worked on actor code, weapon stuff, and the gibs. In fact, William was directly responsible for the /EKG gib cheat in ROTT. Joe Siegler Apogee Software / 3D Realms Dec 20, 2002 ============================================================================================== RISE OF THE TRIAD: The Source Code Release A Note from Tom Hall It was 1992. I had just worked through half of DOOM, a creative guy in a technologically-oriented company. We parted ways and I left to start up "In-House Development" at Apogee (later 3D Realms). We started accruing a programmer here, and artist there. Soon we had a team. I came in with a memo about something (like bonus dough for library functions or something), and at the end I said something like, "And once we complete all these, we will be... THE DEVELOPERS OF INCREDIBLE POWER!" The guys laughed and liked this a lot. And thus we became the DIPs. :) With a game called ROTT, and a bunch of DIPs, you're heading for some derision. :) We had a fairly inexperienced crew: me, inexperienced at management; the rest of the guys, fairly new to the industry. It started as WOLFENSTEIN 3D, Part 2 -- a "transition project" my heart wasn't in, really. It wasn't my idea to do it, but it was something to do. Once we parted ways with that idea and id's involvement, things got rewritten, changed, and we came up with s-Quake functionality crammed into a Wolfenstein Plus/sub-DOOM engine. It was an example of pushing a technology to do what it really can't do well. We had a fun engine, but one that looked ugly, especially in the masked platforms -- they were paper thin! You could have had a fun game without doing what it couldn't do... but we were trying to beat the Joneses. And once we split ways with the id thing, I made three bad decisions: a) to keep the art we had already, b) to not redesign a new game and c) not to move over to the Build engine, where we could have had a Duke/DOOM level game going decently quickly. Ah well. Hindsight's 20/20. I am too nice, I guess. Yet, ROTT, for all its tortured technology, all its semi-justified graphics, did have some stuff that there was to be proud of. It was the first game with Rocket Jumping, the first game with Jumppads, the first game with parental password and Violence level adjustment, the first game with Capture the Flag... Plus, I believe, the record for the most cheat codes ever in a game! And a Random Level creator! And what about all those cool Deathmatch options! And speaking of Deathmatch, I recall William's wonderful Corpseyard deathmatch map, and his "totally heinous" insane Drunk Missiles! Mr. Scarboro, you, and your tuna, egg, salsa, and Omega 3 fatty acid bowls of goo will be missed. Wah-bgsht! To Mark, Jim, Nolan, Steve, Tim, Chuck, Susan, JoeSke, Big Joe, Marianna, Lee, Bobby, Robert and all, thanks for sharing a strange time with me, and so many crazy memories! "Uh, guys... um...." The Disturbathon. "50 kills!" "Ooooooooooh... Mmmmmmm..." Going to that crazy Bazaar to digitize old weapons. "Check out what I got the boulders to do now." "Ass!" "Use the fish." "Bowooooooooo!" "I'm lookin' for some hot buns..." And on and on... And thanks to Scott and George, for providing a place for us to be crazy together, and sticking with it even though it wasn't blockbuster stuff. I do owe you a debt in what was an odd, disorienting time for me. In the end, a couple hundred thousand folks seem to have enjoyed it, so there was something there that they liked. "See, Charlie Brown? It wasn't such a bad tree after all." ====== A little history... by Scott Miller ROTT, as it quickly became known, marked a turning point for Apogee. It was our first in-house game since I started the company in 1987 with my home grown Kroz games, the games that started the shareware revolution that resulted in the launch of three of the most successful independent PC developers, Epic, Id, and us -- all three still kicking after 12+ years (as of Dec. '02). It's hard to believe we're among the oldest of all surviving independent PC developers in the world now. Before ROTT, Apogee, as we were then known, solely worked with outside development teams, often funding and helping organize these teams, and helping guide their game designs using our experience. But around 1993 it was evident that this method wasn't going to work out much longer because as games got larger and more complicated to make, team sizes had to grow, too. So, in 1994 we started hiring developers to form our own internal team, with the first of those hires including William Scarboro, Nolan Martin, Mark Dochtermann, Jim Dosé, and the ever creative Tom Hall to run the show. As Tom notes above, ROTT was originally an Id-approved sequel to Wolfenstein 3-D, using the original Wolf engine. The game was going to be called, Wolfenstein: Rise of the Triad, and explore what happened after Hitler's demise. About 4-5 months into development, though, a surprise call from John Romero ended the project, and we were left with a lot of content specific to the Wolfenstein premise, which had to be rolled into a new game concept so that we didn't waste all that we'd done. The result was a bit of a mish-mash, and as Tom says above, the project probably should've been restarted using our new Build engine, which our second internal team down the hall was using, making Duke Nukem 3D. ROTT ended up selling several hundred thousand copies and making enough money to keep Duke 3D funded. But it was at this time that we knew we had to make a radical company change to shift with the times, and so we created the 3D Realms label, and began phasing out Apogee, which we were leaving behind with the glory days of shareware, and the arcade-style games Apogee was best known for. We get a lot of requests to release the source code to many of the older Apogee games, but the problem is that Apogee does not own these games that were developed by external teams. This source release is a long time coming, and hopefully it's not the last time we're able to do this. Scott Miller, CEO / Founder ====== /* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ rott-20230810/doc/rott.6000066400000000000000000000035141446517470200146040ustar00rootroot00000000000000.TH ROTT 6 "2008-04-23" "1.0" "Rise of the Triad" .SH NAME rott \- Rise of the Triad .SH SYNOPSIS .B rott .RI [ options ] .SH DESCRIPTION .B ROTT is a port of Apogee's 3D action title Rise of the Triad, originally released in 1994. This port duplicates the functionality of the original game on modern operating systems, including Linux, Win32, and Mac OS X. .SH OPTIONS .TP .BR aim Give aim crosshair. .TP .BR fullscreen Start in fullscreen mode. .TP .BR window Start in windowed mode. .TP .BR resolution\ \fIwidth\fPx\fIheight\fP Specify the screen resolution to use (next parameter is widthxheight). Valid resolutions are 320x200 and 640x480. .TP .BR nojoys Disable check for joystick. .TP .BR nomouse Disable check for mouse. .TP .BR nosound Disable sound. .TP .BR ver Version number. .TP .BR mapstats Dump Map statistics to ERROR. .TP .BR tilestats Dump Tile statistics to ERROR. .TP .BR mono Enable mono-monitor support. .TP .BR screenshots Clean screen capture for shots. .TP .BR pause Pauses startup screen information. .TP .BR enablevr Enable VR helmet input devices. .TP .BR noecho Turn off sound reverb. .TP .BR demoexit Exit program when demo is terminated. .TP .BR warp\ \fIlevel\fP Warp to specific ROTT level (next parameter is level to start on). .TP .BR timelimit\ \fItime\fP Play ROTT in time limit mode (next parameter is time in seconds). .TP .BR maxtimelimit\ \fItime\fP Maximum time to count down from (next parameter is time in seconds). .TP .BR dopefish ? .SH AUTHORS ROTT was created and published as shareware by Apogee Software, Ltd. and was published commercially by FormGen, Inc. .PP The primary contributors to the icculus.org port are: Steven Fuller, Ryan C. Gordon, John Hall and Dan Olson. .PP This manual page was written by Fabian Greffrath for the Debian project (but may be used by others). rott-20230810/doc/wad.txt000066400000000000000000000051021446517470200150340ustar00rootroot00000000000000The ROTT WAD Format ------------------- Most of you out there are probably very familiar with the WAD file format developed by Id Software. We borrowed the format with their consent and use it for all the data in Rise of the Triad. The WAD structure itself is identical to that of other WAD's, where the WAD header is as follows: typedef struct { char identification[4]; long numlumps; long infotableofs; } wadinfo_t; and the WAD directory is made up of [numlumps] of: typedef struct { long filepos; long size; char name[8]; } lumpinfo_t; ROTT Specific Data ------------------ WALLS - Walls are stored in the WAD between the two labels "WALLSTRT" and "WALLSTOP". The format of each wall is a 4,096 block of data with no header. The bitmaps are grabbed in vertical posts so that drawing in modex is more straight format. All walls must be 64 x 64. The walls must be the first few lumps in the WAD. MASKED OBJECTS - Masked objects in the wad comprise all actors and sprites. They can be found as weapons, objects, actors etc. They use the following headers and structures: typedef struct { short origsize; // the orig size of "grabbed" gfx short width; // bounding box size short height; short leftoffset; // pixels to the left of origin short topoffset; // pixels above the origin unsigned short collumnofs[320]; // only [width] used, the [0] is &collumnofs[width] } patch_t; These are extremely similar to the patches used in another game, except for the addition of the origsize parameter. typedef struct { short origsize; // the orig size of "grabbed" gfx short width; // bounding box size short height; short leftoffset; // pixels to the left of origin short topoffset; // pixels above the origin short translevel; short collumnofs[320]; // only [width] used, the [0] is &collumnofs[width] } transpatch_t; Certain objects in the game like masked walls and touch plates will use the second type of patch which acts like a translucent patch. SKYS, FLOORS and CEILINGS - Skys are larger than the screen and are made up of two 256X200 grabs in posts similar to the walls. The first grab represents the bottom part of the sky and the second part the top of the sky. The skys are denoted by the labels SKYSTRT and SKYSTOP. Floors and ceilings use the following structure: typedef struct { short width,height; short orgx,orgy; byte data; } lpic_t; They can be found between the labels UPDNSTRT and UPDNSTOP. rott-20230810/misc/000077500000000000000000000000001446517470200137105ustar00rootroot00000000000000rott-20230810/misc/icons.mk000066400000000000000000000001231446517470200153500ustar00rootroot00000000000000rott.xpm: rott.png convert $^ $@ rott.png: rott.svg inkscape --export-png=$@ $^ rott-20230810/misc/rott.desktop000066400000000000000000000003571446517470200163000ustar00rootroot00000000000000[Desktop Entry] Type=Application Name=Rise of the Triad Comment=A high quality, fast scrolling first-person perspective 3D action game Icon=rott TryExec=rott Exec=rott Categories=Game;ActionGame; Keywords=first;person;shooter;fps;3d;rott; rott-20230810/misc/rott.png000066400000000000000000000034341446517470200154120ustar00rootroot00000000000000‰PNG  IHDR szzôsBIT|dˆ pHYs × ×B(›xtEXtSoftwarewww.inkscape.org›î<tEXtTitlerott icon8jÿtEXtAuthorFabian Greffrath8kËtEXtCreation Time7 Sep 2013€È8 7IDATX…½—[lYÇ3gÆãØqâØ‰ã$žÜÜ\꥗4)Q)Ù…E(×ñzM–6Ò\ˆ´žy-Ô$àÀýåžãÑB‚æ–ëär ¼ù*äs‹‚C<ž_'ÖÓ~f 5 Ð…ï7ÃêR2ƒÇÓ€&,®ÝÝeà® ±šÜâ‚Ru¡ÖLáTûîï^ꉓsU÷ÙÝE†Œ6¾æË-ãoºÊ£¹ub=m†„»µR8U€.ÄxŸñt—ÀíRÌÏ2¿…ãX4ú/19³N¬'\3… 8p¿‘ÙA>Üîù|3 Ð;¢ÝA>¿†ËÕËf&K¯ÙR…ºï5gã‚#HéPÈ-pµ½‚ƒÊf5†*”ö–‘RâóŪzÆS…¸OîìbK¯· )%…Ü2ƒ ’ʔ֪k‘ìâHéàv·`;:éJ*T’PNTcrJAÓ½ÿŽÄí‘ÝUØÎíÑk6‹ù•Ô8pìñÜe¤(JHêÂWF<ï|8ƒáÂçë>p@ÂqŽÚÇõ q9ËÍkFàÈý°çÝÉyWŒ††(¥Ò6«+¤bU±»4pûk¨ªŽeí±±þg*Ve߀†?p!ê(V1ôF¯tð§‡Kácª¹‹B©ÄV¶ˆÏ׃ãX¤’åë_²ùíà×?€›ƒ6¹ÝÇHéÏNs£Ãæçß„_}¾vÛ¦ÿ7RÚ¸Ýa¶wKì•*t›c) 8Ú÷íÆÄÌMM—Èlý‡ }nCâé£ ޸尛GJÉnv‘Û£z n½)é¿Xdoï RJ £“ÇO“ ô¶»#Tsß*Š‹Íí, Qòù5Jå¾ûC O ôhàeWso;þFu Õƒ„ïÿÔ%N©”Æå “Ê(W,ºÍ¦ç(¨ÏºÿT´Ã˜œMà÷¿„mWH§þηïZE(LAvÞý üø.]Çq\šÎOh¼÷äÒ`¥AOÁýû6åòcÇB×;˜žIÑm~Ž‚v”û°,›Dj‡Î®/Ú|Ègú+˜*¼óücBçÉ‚ƒ§.€Ð;in !¥$Ðüyù ~÷ö ¿y°M—ÊØˆÅÕ»dñÏÿN£ëýl¤V©XAºÌ&±´’9<ª_º o|nÈóÁ“8»ÅVTÕM*õ>Ñ€Æâ¶ÄSD3ºp»Ã(Šzâ6tœ Åâ&8 Êå]º sIÃÝ‹#Ë´óÄ›yûos‡;B=ȽíH–×·hh RLàó¶’QF·¿Ncà³x<‘N^­\®ºq™:ï(«¹(nW#гª†H¬g‘tš‡kAÑ„šþâh,0O“Êðû/ŸzÈœ¯ÏÁ²â´‡ËD">Þ{eË²ì ªªÞoö×gƒþF |âÑØè‘M~wVUÕûRJ@Ñ5ñ¯+‘«ý!Q=%Gõq­³õ=‘,-gìé'é ˲¯Ëg~¹¢ªªdÿöç‰Ìý?ÁF¢æº¹ÝIEND®B`‚rott-20230810/misc/rott.svg000066400000000000000000000205201446517470200154200ustar00rootroot00000000000000 rott icon image/svg+xml rott icon Fabian Greffrath 7 Sep 2013 rott-20230810/misc/rott.xpm000066400000000000000000000100501446517470200154220ustar00rootroot00000000000000/* XPM */ static char *rott[] = { /* columns rows colors chars-per-pixel */ "32 32 116 2 ", " c #030202", ". c #0B0B05", "X c #060609", "o c #09070A", "O c #0C0A0B", "+ c #100E05", "@ c #180D00", "# c #110E0E", "$ c #13110D", "% c #0B0712", "& c #0C0A12", "* c #060618", "= c #0D0C1B", "- c #110D16", "; c #100F1C", ": c #141113", "> c #1A1513", ", c #1C1A11", "< c #251604", "1 c #2A1B04", "2 c #3E1F02", "3 c #201C14", "4 c #251E18", "5 c #291F1A", "6 c #272206", "7 c #2D2504", "8 c #313204", "9 c #242014", "0 c #2D2B16", "q c #272018", "w c #2A201A", "e c #342B1F", "r c #3C3A1F", "t c #0A0A24", "y c #0D0D2B", "u c #110F22", "i c #131224", "p c #14132B", "a c #18152A", "s c #0C0C34", "d c #0F0F39", "f c #141434", "g c #181837", "h c #12123C", "j c #19193C", "k c #312521", "l c #352921", "z c #3A2D24", "x c #3D3324", "c c #422D02", "v c #542A01", "b c #433502", "n c #553301", "m c #7C3F00", "M c #433C25", "N c #433329", "B c #4A3A2D", "V c #4E3D30", "C c #533E34", "Z c #444103", "A c #5A4901", "S c #644F01", "D c #6F4F00", "F c #615201", "G c #695600", "H c #695800", "J c #6C6300", "K c #746500", "L c #7A7000", "P c #7E7F00", "I c #474225", "U c #494327", "Y c #4C4927", "T c #4D422B", "R c #4E4929", "E c #50422F", "W c #52492D", "Q c #554134", "! c #564931", "~ c #594934", "^ c #63493F", "/ c #151543", "( c #1C1C44", ") c #1B1B4C", "_ c #1F1F51", "` c #20204D", "' c #222254", "] c #25255B", "[ c #28285B", "{ c #292963", "} c #2E2E69", "| c #895600", " . c #845E00", ".. c #965A00", "X. c #996200", "o. c #9B6E00", "O. c #947400", "+. c #9C7300", "@. c #9C7A00", "#. c #7B8300", "$. c #9D8B00", "%. c #A08200", "&. c #A28A00", "*. c #A49300", "=. c #A79C00", "-. c #A2A200", ";. c #A9A300", ":. c #AAAA00", ">. c #A3B200", ",. c #ADB400", "<. c #ACBA00", "1. c #A7C500", "2. c #AFC000", "3. c #B0C300", "4. c #B6DB00", "5. c None", /* pixels */ "5.5.5.5.5.5.5.5.5.5.5.5.5.5. 5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.", "5.5.5.5.5.5.5.5.5.5.5.5.5.X 5 ^ 5 5.5.5.5.5.5.5.5.5.5.5.5.5.5.", "5.5.5.5.5.5.5.5.5.5.5.5.5. C > C 5.5.5.5.5.5.5.5.5.5.5.5.5.5.", "5.5.5.5.5.5.5.5.5.5.5.5. 5 k X k w 5.5.5.5.5.5.5.5.5.5.5.5.5.", "5.5.5.5.5.5.5.5.5.5.5.5. C [ X C 5.5.5.5.5.5.5.5.5.5.5.5.5.", "5.5.5.5.5.5.5.5.5.5.5. 5 k a i a k 5 5.5.5.5.5.5.5.5.5.5.5.5.", "5.5.5.5.5.5.5.5.5.5.5. C O ( j X C 5.5.5.5.5.5.5.5.5.5.5.5.", "5.5.5.5.5.5.5.5.5.5.X 5 l i a @ a i l q 5.5.5.5.5.5.5.5.5.5.5.", "5.5.5.5.5.5.5.5.5.5. Q . [ o D . ' o E 5.5.5.5.5.5.5.5.5.5.5.", "5.5.5.5.5.5.5.5.5.X 5 z u [ + &.+ [ ; l w 5.5.5.5.5.5.5.5.5.5.", "5.5.5.5.5.5.5.5.5. Q O [ j b ;.Z g ' X Q 5.5.5.5.5.5.5.5.5.5.", "5.5.5.5.5.5.5.5.X 5 z ; } - K ,.#.: ] - x q 5.5.5.5.5.5.5.5.5.", "5.5.5.5.5.5.5.5. Q O ' { &.3.<.X ] ( O E 5.5.5.5.5.5.5.5.5.", "5.5.5.5.5.5.5. 5 N - } ` < *.,.,.6 j [ & x q 5.5.5.5.5.5.5.5.", "5.5.5.5.5.5.5. Q # ` { a n %.=.;.A i ' j o E 5.5.5.5.5.5.5.5.", "5.5.5.5.5.5. w N - { { o m o.&.&. .o ' ' O N w 5.5.5.5.5.5.5.", "5.5.5.5.5.5. Q # ) { { & v ..o.o.n & ' _ h O E 5.5.5.5.5.5.5.", "5.5.5.5.5. w N & { { { ' ) _ _ _ o x q 5.5.5.5.5.5.", "5.5.5.5.5.X Q : ( { { ] { ] ] ' ' _ _ _ ) ) f $ E 5.5.5.5.5.5.", "5.5.5.5. w B o { [ ] { ] ' ' ' ' _ _ _ ) ) ) o r q 5.5.5.5.5.", "5.5.5.5. Q > j [ ' _ ' ) h ) y $ T 5.5.5.5.5.", "5.5.5.X 5 V X { ] & S &.@.c i _ u 2 X.o.S O / / o M 9 5.5.5.5.", "5.5.5. Q > j [ p 8 ,.:.*.O. _ | @.*.;.8 u / y , U 5.5.5.5.", "5.5. w V . ] ( . >.4.<.;.&. _ X.%.=.<.1.. y h I 9 5.5.5.", "5.5. Q 3 a ' O L :.,.;.J 7 X ) 1 S $.;.,.P . d t , U 5.5.5.", "5. q C X ] ; c O.G 7 X & f / ) ) y & 6 H @.b & s I 9 5.5.", "5. Q 4 f g < - f ) _ ) ) ) ) / / / y O < t * , U 5.5.", "X w E X ] ; - f _ _ _ ) ) ) / ) / / / / / h d t O % s I 9 5.", " B 5 p ' ' ' ' _ _ ) ) ) ) / / / / / / h d d d s s s * , r 5.", "5.$ # $ $ 5.5.", "5. e ~ ~ ! ! ~ ! ! ! ! W ! W W W W T W T R R R U R Y Y 0 5.5.", "5.5. 5.5.5." }; rott-20230810/misc/runrott.sh000077500000000000000000000010311446517470200157570ustar00rootroot00000000000000#!/bin/sh # quick hack rott.rot generation in sh v0.1 by Steven Fuller # inspired by Delphi Dude's RUNROTT: # http://www.delphidude.com/personal/utilities/games/ CONFIG=$HOME/.rott/darkwar/rott.rot EXE=rott if [ $# != 1 ]; then echo "usage: "$0" " exit 1 fi if [ ! -r $1 ]; then echo "error: "$1" does not exist" exit 1 fi cat > $CONFIG <0 ? 1 : -1) #endif rott-20230810/rott/_isr.h000066400000000000000000000020201446517470200150440ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //*************************************************************************** // // ISR Constants // //*************************************************************************** #ifndef _isr_private #define _isr_private #define TIMERINT 0x08 #define KEYBOARDINT 0x09 #endif rott-20230810/rott/_rt_acto.h000066400000000000000000000255031446517470200157150ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_actor_private #define _rt_actor_private #define MAXGIBS 600 #define HAAPT 24 #define VAAPT 24 #define GODHAPT 1024 #define GODVAPT 1024 #define MAXDELTAYZSHOOT (((5*FINEANGLES)/360)) #define MAXDELTAYZSEE (((15*FINEANGLES)/360)) #define MAXSHOOTOFFSET (((15*FINEANGLES)/360)) #define MAXSHOOTSHIFT (1) #define MAXDAMAGE (64) #define MAXYZANGLE (((30*FINEANGLES)/360)) #define SMOKEWALLOFFSET (0x800) #define MZADJUST 0x30000; #define MAXSTEPHEIGHT 24 #define SIGN(x) ((x)>=0)?(1):(-1) #define MAXRAIN 128 #define SG_PSTAT 0x4000 #define SG_PSTATE 0x2000 #define EXPLOSION_DAMAGE 50 #define LOWFALLCLIPZ (maxheight - 96) #define HIGHFALLCLIPZ -5 #define LOWRISECLIPZ (nominalheight) #define HIGHRISECLIPZ 64 #define NORMALGIBSPEED 0x2f00 #define FL_PLEADING 0x400 #define FL_EYEBALL 0x400 #define FL_UNDEAD 0x8000 #define NME_DRUNKTYPE 0x01 #define NME_HEATSEEKINGTYPE 0x02 #define NUMSTATES 11 enum { STAND, PATH, COLLIDE1, COLLIDE2, CHASE, USE, AIM, DIE, FIRE, WAIT, CRUSH }; #define SHOTMOM 0x200l #define NEXT 1 #define PREV 0 #define ANGLEMOVE 0x2b000l #define PAINTIME 5l #define LOOKAHEAD (20 << 16) #define DRAINTIME 70l #define EXPLOSION_IMPULSE 0x2600l #define ZEROMOM ob->momentumx = ob->momentumy = 0 #define NOMOM ((!ob->momentumx) && (!ob->momentumy)) #define WHICHACTOR (ob->obclass-lowguardobj) #define SPDPATROL 0x600l //#define ENEMYRUNSPEED (3*SPDPATROL) #define ENEMYRUNSPEED (0xc00) #define ENEMYFASTRUNSPEED (5*SPDPATROL) #define ENEMYINSANESPEED (7*SPDPATROL) #define MAXMOVE 0x2000l #define PROJECTILESIZE 0x6000l #define DEADFRICTION 0x6000l #define ROLLMOMENTUM 0x920l #define PROJSIZE 0x4000l #define PILLARMOM 0x800l #define HALFGLOBAL1 (TILEGLOBAL/2) #define TOUCHDIST 0xb000l #define STANDDIST 0x5000l #define SNAKERAD 0x4000l #define MINSIGHT 0x18000l #define HBM -2 #define SNEAKY -3 #define GIBVALUE -3 #define DISKMOMZ 4 //=========================== macros ============================= #define M_ISWALL(x) ((x->which == WALL) || (x->which == PWALL) || (x->which == MWALL)) #define M_DISTOK(p1,p2,d) (abs((p1)-(p2)) <= d) #define M_NONS(x) ((x->obclass == wallfireobj) || (x->obclass == pillarobj)) #define M_CHOOSETIME(x) ((int)(TILEGLOBAL/((x->speed)))) #define M_DIST(x1,x2,y1,y2) (((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2))) #define M_S(x) (UPDATE_STATES[x][ob->obclass-lowguardobj]) #define Fix(a) (a &= (FINEANGLES - 1)) #define STOPACTOR(ob) \ { \ ob->momentumx = ob->momentumy = 0; \ ob->dirchoosetime = 0; \ } #define M_CHECKDIR(ob,tdir) \ { \ ob->dir = tdir; \ ParseMomentum(ob,dirangle8[tdir]); \ ActorMovement(ob); \ if (ob->momentumx || ob->momentumy) \ return; \ } \ #define M_CHECKTURN(x,ndir) \ { \ if (ndir == olddir) \ ZEROMOM; \ ParseMomentum(x,dirangle8[ndir]); \ ActorMovement(x); \ if (!NOMOM) \ { \ if (ndir != olddir) \ { \ next = dirorder[olddir][NEXT]; \ prev = dirorder[olddir][PREV]; \ x->temp1 = ndir; \ if (dirdiff[ndir][next] < dirdiff[ndir][prev]) \ NewState(x,&s_kristleft); \ else \ NewState(x,&s_kristright); \ } \ return; \ } \ } \ #define M_CheckDoor(ob) \ { \ door = ob->door_to_open; \ if (door != -1) \ { \ if ((ob->obclass > shurikenobj) && \ (ob->obclass != collectorobj) \ ) \ Error("you got it !!!"); \ LinkedOpenDoor(door); \ if (doorobjlist[door]->action != dr_open) \ return; \ ob->door_to_open = -1; \ } \ } \ #define M_CheckBossSounds(ob) \ { \ if ((ob->obclass >= b_darianobj) && \ (ob->obclass <= b_darksnakeobj) && \ (ob->flags & FL_ATTACKMODE) && \ (ob->obclass != b_robobossobj) && \ (!(ob->flags & FL_DYING)) \ ) \ { \ if (MISCVARS->SOUNDTIME) \ MISCVARS->SOUNDTIME --; \ else \ { \ MISCVARS->SOUNDTIME = 5*VBLCOUNTER; \ if (GameRandomNumber("boss sound check",0)<160) \ { \ int rand,sound; \ \ rand = GameRandomNumber("boss sounds",0); \ sound = BAS[ob->obclass].operate; \ if (rand < 160) \ sound ++; \ if (rand < 80) \ sound ++; \ \ SD_PlaySoundRTP(sound,ob->x,ob->y); \ } \ } \ if (MISCVARS->REDTIME) \ { \ MISCVARS->REDTIME --; \ MISCVARS->redindex = ((MISCVARS->REDTIME >> 1) & 15);\ } \ } \ } #define SET_DEATH_SHAPEOFFSET(ob) \ { \ ob->flags |= FL_ALTERNATE; \ ob->shapeoffset += deathshapeoffset[ob->obclass]; \ } #define RESET_DEATH_SHAPEOFFSET(ob) \ { \ ob->flags &= ~FL_ALTERNATE; \ ob->shapeoffset -= deathshapeoffset[ob->obclass]; \ } #define LOW_VIOLENCE_DEATH_SHOULD_BE_SET(ob) \ ((gamestate.violence < vl_high) && \ (ob->obclass >= lowguardobj) && \ (ob->obclass <= triadenforcerobj) && \ (!(ob->flags & FL_ALTERNATE)) \ ) \ #define LOW_VIOLENCE_DEATH_IS_SET(ob) (ob->flags & FL_ALTERNATE) #define LOW_VIOLENCE_PAIN_SHOULD_BE_SET LOW_VIOLENCE_DEATH_SHOULD_BE_SET #define LOW_VIOLENCE_PAIN_IS_SET LOW_VIOLENCE_DEATH_IS_SET #define SET_PAIN_SHAPEOFFSET SET_DEATH_SHAPEOFFSET #define RESET_PAIN_SHAPEOFFSET RESET_DEATH_SHAPEOFFSET // default = actor typedef struct sat { int x,y,z; unsigned flags; int hitpoints; int targetx,targety; int angle; int yzangle; int speed; int momentumx,momentumy,momentumz; int temp1,temp2,temp3; int whateverindex,targetindex; short ticcount; short shapeoffset; short stateindex; short dirchoosetime; byte areanumber; byte obclass; signed char door_to_open; signed char dir; }saved_actor_type; typedef struct {thingtype which; byte tilex,tiley; fixed x,y,z; }tpoint; //========================== Function Prototypes ============================== void MissileMovement(objtype*); boolean MissileTryMove(objtype*,int,int,int); void T_DarkSnakeChase(objtype*); void HeatSeek(objtype*); boolean CheckDoor(objtype *ob,doorobj_t*,int,int); boolean NextToDoor(objtype*ob); void MissileHit (objtype *ob,void*); int Near(objtype*,void*,int); void FirstSighting(objtype*); void SelectOrobotChaseDir(objtype*); void SelectPathDir(objtype*); void SelectChaseDir(objtype*); void SelectRoboChaseDir(objtype*); void SelectDodgeDir(objtype*); void SelectRollDir (objtype*); void SelectTouchDir(objtype*); void SelectMineDir(objtype*); boolean WallCheck(int,int); boolean NMEspincheck(objtype*); void TurnActorIntoSprite(objtype*ob); void ActivateEnemy(objtype*); #endif rott-20230810/rott/_rt_buil.h000066400000000000000000000024651446517470200157240ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_build_private #define _rt_build_private #define MAX(x,y) ((x>y) ? (x) : (y)) #define MAXPLANES 10 // Should be 10 with titles #define MENUOFFY (10) #define MENUBACKNAME ("plane") #define MENUTITLEY 10 #define TEXTUREW (288) #define TEXTUREWIDTH ((TEXTUREW*1024)-1) #define TEXTUREHEIGHT (158) #define NORMALVIEW (0x40400L) #define NORMALHEIGHTDIVISOR (156000000) #define NORMALWIDTHMULTIPLIER (241) #define FLIPTIME 20//60 typedef struct { int x1, y1; int x2, y2; int texturewidth; int texture; int origheight; } plane_t; #endif rott-20230810/rott/_rt_com.h000066400000000000000000000023271446517470200155440ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_com_private #define _rt_com_private #define SYNCPACKETSIZE 32 #define SYNC_PHASE0 6 #define SYNC_PHASE1 0 #define SYNC_PHASE2 1 #define SYNC_PHASE3 2 #define SYNC_PHASE4 3 #define SYNC_PHASE5 4 #define SYNC_MEMO 99 #define NUMSYNCPHASES 5 #define SYNCTIME 15 typedef struct { byte type; int phase; int clocktime; int delta; byte data[SYNCPACKETSIZE]; } syncpackettype; typedef struct { int sendtime; int deltatime; syncpackettype pkt; } synctype; #endif rott-20230810/rott/_rt_dman.h000066400000000000000000000016351446517470200157060ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_dmand_private #define _rt_dmand_private #define RECORDINGSAMPLERATE 7000 #define RECORDINGBUFFERSIZE 16384 #define PLAYBACKBUFFERSIZE 16384 #define PLAYBACKDELTASIZE 256 #endif rott-20230810/rott/_rt_door.h000066400000000000000000000022711446517470200157270ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_door_private #define _rt_door_private #define OPENTICS 165 typedef struct tp { signed char actionindex; signed char swapactionindex; int whichobj; byte tictime; byte ticcount; byte triggered; byte complete; byte done; } saved_touch_type; #define NUMTOUCHPLATEACTIONS 8 #define FL_TACT 0x4000 #define FL_TSTAT 0x8000 #define PUSHWALLSPEED 10 #define AMW_NUMFRAMES 9 #define AMW_TICCOUNT 3 #endif rott-20230810/rott/_rt_draw.h000066400000000000000000000034021446517470200157160ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_draw_private #define _rt_draw_private #include "develop.h" #define MINZ 0x2700 #define MAXBOB 0x9000 #define GOLOWER 0x38000 #define GOHIGHER 0x20000 #define MAXVISIBLEDOORS 30 #define DHEIGHTFRACTION 8 #define MINZ 0x2700 #define MAXDRAWNTICS 40 #define W_CHANGE (WEAPONUPTICS || WEAPONDOWNTICS) #if (SHAREWARE == 0) #define NUMWEAPGRAPHICS 16 #else #define NUMWEAPGRAPHICS 9 #endif #define HFRACTION (6+HEIGHTFRACTION) #define FIXEDTRANSLEVEL (30) typedef struct { int x; int y; int angle; int scale; int dx; int dy; int dangle; int dscale; int phase; int time; int pausetime; int pausex; int pausey; } screensaver_t; void DrawPlayerWeapon(void); boolean TransformPlane (int x1, int y1, int x2, int y2, visobj_t * plane); int CalcRotate (objtype *ob); void DrawScaleds (void); void FixOfs (void); void SetSpriteLightLevel (int x, int y, visobj_t * sprite, int dir, int fullbright); #endif rott-20230810/rott/_rt_floo.h000066400000000000000000000016171446517470200157260ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_floor_private #define _rt_floor_private //#define MAXVIEWHEIGHT MAXSCREENHEIGHT #define MAXSKYSEGS 2048 #define MAXSKYDATA 8 #define MINSKYHEIGHT 148 #endif rott-20230810/rott/_rt_game.h000066400000000000000000000076221446517470200157020ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_game_private #define _rt_game_private //****************************************************************************** // // Private header for RT_GAME.C // //****************************************************************************** //****************************************************************************** // // TYPEDEFS // //****************************************************************************** typedef struct { char str[10]; int length; } STR; //****************************************************************************** // // DEFINES // //****************************************************************************** #define MENUSHADELEVEL 105 #define KILLS_X 0 #define KILLS_Y 176 #define KILLS_WIDTH 32 #define KILLS_HEIGHT 24 #define KILLS_OFFSET 14 #define KILLS_NAME_Y ( KILLS_Y + 16 ) #define MAXKILLBOXES 10 #define PLAYERS_Y ( 107 + ( gamestate.teamplay ? 0 : 4 ) ) #define PLAYERS_NAME_Y ( PLAYERS_Y + 16 ) #define PLAYERS_TEAM_Y ( PLAYERS_Y + 24 ) #define LEADER_X 0 #define LEADER_Y 0 #define LEADER_NUM_X 61 #define LEADER_NUM_Y ( LEADER_Y ) #define LEADER_NAME_X ( LEADER_X + 3 ) #define LEADER_NAME_Y ( LEADER_Y + 2 ) #define LEADER_WIDTH 88 #define LEADER_HEIGHT 16 /* bna++ #define HEALTH_X 20 #define HEALTH_Y 185 #define AMMO_X 300 #define AMMO_Y 184 */ //-------------------- #define HEALTH_X 20*2 #define HEALTH_Y (185*2)+16 #define AMMO_X 300*2 #define AMMO_Y (184*2)+16 //-------------------- #define SCORE_X 4 #define SCORE_Y 0 /* #define KEY1_X 152 #define KEY2_X 160 #define KEY3_X 168 #define KEY4_X 176 #define KEY_Y 0 #define POWER_X 184 #define POWER_Y 0 #define ARMOR_X 200 #define ARMOR_Y 0 #define MEN_X 216 #define MEN_Y 0 */ //-------------------- #define KEY1_X 152 #define KEY2_X 160 #define KEY3_X 168 #define KEY4_X 176 #define KEY_Y 0 #define POWER_X (184) #define POWER_Y 0 #define ARMOR_X 200 #define ARMOR_Y 0 #define MEN_X 216 #define MEN_Y 0 //-------------------- #define HOUR_X 7 #define MIN_X 26 #define SEC_X 45 #define TIME_Y 0 #define GAMETIME_X 88 #define GAMETIME_Y 0 #define TALLYTIME_X 130 #define TALLYTIME_Y 8 #define LIVES_X 288 #define LIVES_Y 0 #define TRIAD_X 308 #define TRIAD_Y 6 #define POWERUP1X 184 #define POWERUP2X 200 #define POWERUPY 0 #define EXTRAPOINTS 50000 #define ADRENALINEBONUS 5 #define STR_SAVECHT1 "Your Save Game file is," #define STR_SAVECHT2 "shall we say, \"corrupted\"." #define STR_SAVECHT3 "But I'll let you go on and" #define STR_SAVECHT4 "play anyway...." #define MAXSAVEDGAMESIZE 120000 #if (SHAREWARE == 0) #define WEAPON_IS_MAGICAL(x) (((x) == wp_dog) || ((x) == wp_godhand)) #else #define WEAPON_IS_MAGICAL(x) ((x) == wp_godhand) #endif //****************************************************************************** // // PROTOTYPES // //****************************************************************************** void DrawMPPic (int xpos, int ypos, int width, int height, int heightmod, byte *src, boolean bufferofsonly); void DrawHighScores (void); void GM_MemToScreen (byte *source, int width, int height, int x, int y); #endif rott-20230810/rott/_rt_in.h000066400000000000000000000031051446517470200153670ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //**************************************************************************** // // Private header for RT_IN.C // //**************************************************************************** #ifndef _rt_in_private #define _rt_in_private //**************************************************************************** // // TYPEDEFS // //**************************************************************************** //**************************************************************************** // // DEFINES // //**************************************************************************** #define KeyInt 9 // The keyboard ISR number #define MReset 0 #define MButtons 3 #define MDelta 11 #define MouseInt 0x33 #define JoyScaleMax 32768 #define JoyScaleShift 8 #define MaxJoyValue 5000 void Mouse (int x); #endif rott-20230810/rott/_rt_main.h000066400000000000000000000017631446517470200157150ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_main_private #define _rt_main_private #include "develop.h" void GameLoop (void); void PlayLoop (void); void PollKeyboard(void); void FixColorMap( void ); #define QUITTIMEINTERVAL ((35*6)-5) boolean CheckForQuickLoad ( void ); void DrawRottTitle ( void ); #endif rott-20230810/rott/_rt_map.h000066400000000000000000000023271446517470200155430ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_map_private #define _rt_map_private #if defined(__WATCOM__) #pragma aux FastFill = \ "rep stosb" \ parm [edi] [eax] [ecx] \ modify exact [ecx] #endif void FastFill(byte * buf, int color, int count); #define MAP_PLAYERCOLOR 4 #define MAP_MWALLCOLOR 13 #define MAP_PWALLCOLOR 8 #define MAP_AWALLCOLOR 9 #define MAP_WALLCOLOR 7 #define MAP_DOORCOLOR 3 #define MAP_SPRITECOLOR 2 #define MAP_ACTORCOLOR 15 #define MAP_SKYCOLOR 11 #define FULLMAP_SCALE 5 #endif rott-20230810/rott/_rt_menu.h000066400000000000000000000224341446517470200157330ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_menu_private #define _rt_menu_private //****************************************************************************** // // Private Header for RT_MENU.C // //****************************************************************************** #include "rt_in.h" // // Specific Menu defines // #define BORDCOLOR 0x29 #define BORD2COLOR 0x23 #define DEACTIVE 0x2b #define BKGDCOLOR 0x2d #define STRIPE 0x2c #define SENSITIVE 60 #define CENTER SENSITIVE*2 #define MENU_X 32 #define MENU_Y 16 #define MENU_W 235 #define MENU_H 14*9+4 #define LSM_X 180 //32 #define LSM_Y 16 #define LSM_W 80 //176 #define LSM_H 10*14+8 #define LSA_X 96 #define LSA_Y 80 #define LSA_W 130 #define LSA_H 42 #define SM_X 32 #define SM_Y 52 #define SM_W 252 #define SM_H 35 #define SM_Y1 20 #define SM_H1 4*14-9 #define SM_Y2 SM_Y1+5*14 #define SM_H2 4*14-9 #define SM_Y3 SM_Y2+5*14 #define SM_H3 3*14-9 #define CTL_X 19 #define CTL_Y 32 #define CTL_W 284 #define CTL_H 105 #define CST_X 20 #define CST_Y 43 #define CST_START 60 #define CST_SPC 60 #define TUF_X 0 #define TUF_Y 32 #define HLP_X 34 #define HLP_Y 63 #define HLP_W 264 #define HLP_H 51 #define MU_X 32 #define MU_Y 22 #define MU_W 252 #define MU_H 118 #define FX_X 32 #define FX_Y 16 #define FX_W 252 #define FX_H 130 #define MP_X 55//32 #define MP_Y 60 #define MP_W 252 #define MP_H 35 #define X1_X 55 #define X1_Y 25 #define X1_W 252 #define X2_X 55 #define X2_Y 65 #define X2_W 252 #define X2_H 35 #define X3_X 55 #define X3_Y 65 #define X3_W 252 #define X3_H 35 #define LEVSEL_X 32 #define LEVSEL_Y 22 #define LEVSEL_W 252 #define LEVSEL_H 118 #define MAXCUSTOM 12 #define STARTITEM newgame // // General defines // #define CP_SemiActive 4 #define CP_Highlight 5 #define OUTOFRANGE 100 #define ESCPRESSED -1 #define PAGEUP -2 #define PAGEDOWN -3 #define NOTAVAILABLECOLOR 7 #define NEXTPAGECOLOR 16 #define NORMALCOLOR 21 #define DIMMEDCOLOR 24 #define ACTIVECOLOR 241 #define HIGHLIGHTCOLOR 1 #define MouseInt 0x33 #define GAMESVD "There's already a game\n" \ "saved at this position.\n"\ "Overwrite?" #define COLOR 235 #define CUSTOMX 76 #define NUMSAVEGAMES 14 #define PWORDX 58 #define PWORDY 46 //#define PBOXX 68 #define PBOXX ( ( 288 - PBOXW ) / 2 ) #define PBOXY 71 #define PBOXW 115 #define PSTRW 110 #define PBOXH 12 #define QUICKSAVEBACKUP ("rottgamf.rot") //****************************************************************************** // // ENUMS // //****************************************************************************** typedef struct { int allowed[4]; } CustomCtrls; // FOR INPUT TYPES enum {MOUSE, JOYSTICK, KEYBOARDBTNS, KEYBOARDMOVE, SPECIAL1, SPECIAL2}; //****************************************************************************** // // GLOBALS // //****************************************************************************** static char *ScanNames[] = // Scan code names with single chars { "?","?","1","2","3","4","5","6","7","8","9","0","-","+","?","?", "Q","W","E","R","T","Y","U","I","O","P","[","]","|","?","A","S", "D","F","G","H","J","K","L",";","\"","?","?","?","Z","X","C","V", "B","N","M",",",".","/","?","?","?","?","?","?","?","?","?","?", "?","?","?","?","?","?","?","?","\xf","?","-","\x15","5","\x11","+","?", "\x13","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?", "?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?", "?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?" }; static byte ExtScanCodes[] = // Scan codes with >1 char names { 1, 0xe, 0xf, 0x1d, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x57, 0x58, 0x46, 0x1c, 0x36, 0x37, 0x38, 0x47, 0x49, 0x4f, 0x51, 0x52, 0x53, 0x45, 0x48, 0x50, 0x4b, 0x4d, 0x00 }; static char *ExtScanNames[] = // Names corresponding to ExtScanCodes { "Esc","BkSp","Tab","Ctrl","Space","CapLk","F1","F2","F3","F4", "F5","F6","F7","F8","F9","F10","F11","F12","SclLk","Enter","Shift", "PrtSc","Alt","Home","PgUp","End","PgDn","Ins","Del","NumLk","Up", "Down","Left","Right","" }; //****************************************************************************** // // PROTOTYPES // //****************************************************************************** void MouseSensitivity (void); void DoThreshold (void); char * IN_GetScanName (ScanCode scan); void DisplayInfo (int which); void PrintLSEntry (int w); void DrawHalfStep (int x, int y); void DrawCtlScreen (void); void DrawCtlButtons (void); void DrawSoundMenu (void); void DrawCustomScreen (void); void DrawLoadSaveScreen (int loadsave); void DrawLoadSaveScreenAlt (int loadsave); void DrawMusicMenu (void); void DrawNewGame (void); void DrawNewGameDiff (int w); void DrawNewPlayerDiff (int w); void DrawFXMenu (void); void DrawFXButtons (void); void DrawCustomJoystick (void); void DrawCustomMouse (void); void DrawCustomSpecial (void); void DrawCustomMenu (void); void DrawPlayerMenu (void); void DoMainMenu (void); boolean CP_DisplayMsg (char *s, int number); void CP_EndGame (void); int CP_SaveGame (void); void CP_Control (void); void CP_Sound (void); void CP_ChangeView (void); void CP_DoubleClickSpeed( void ); void CP_ErrorMsg( char *title, char *error, int font ); void CP_Quit (int which); void CP_NewGame (void); void CP_Music (void); void CP_FX (void); void CP_MCports (void); void CP_FXMenu (void); void CP_Custom (void); void CP_Keyboard (void); void CP_Mouse (void); void CP_Joystick (void); void CP_Special (void); void CP_OrderInfo( void ); void DefineMouseBtns1 (void); void DefineMouseBtns2 (void); void DefineKeyBtns1 (void); void DefineKeyBtns2 (void); void DefineKeyMove1 (void); void DefineKeyMove2 (void); void DefineJoyBtns1 (void); void DefineJoyBtns2 (void); void DefineSpecialBtns1 (void); void DefineSpecialBtns2 (void); void DrawSTMenuBuf (int x, int y, int w, int h, boolean up); void MusicVolume (void); void FXVolume (void); void DefineKey( void ); void DefineJoyBtn( void ); void DefineMouseBtn( void ); void DrawControlMenu (void); void CP_ControlMenu (void); void DrawOptionsMenu (void); void DrawExtOptionsMenu (void); void CP_ExtOptionsMenu (void); void CP_OptionsMenu (void); void DrawOptionsButtons (void); void DrawExtOptionsButtons (void); void MenuFlipSpeed (void); void DrawDetailMenu (void); void CP_DetailMenu (void); void DrawBattleMenu (void); void CP_BattleMenu (void); void MCERROR (void); void DrawKeyboardMenu (void); void CP_KeyboardMenu (void); boolean SliderMenu( int *number, int upperbound, int lowerbound, int erasex, int erasey, int erasew, int numadjust, char *blockname, void (*routine) (int w), char *title, char *left, char *right ); void DrawF1Help (void); void CP_F1Help (void); void CP_ScreenSize( void ); void CP_ViolenceMenu (void); void DrawViolenceLevelMenu (void); void DrawViolenceLevelPWord (void); void DrawViolenceLevel (void); void CP_ViolenceLevel (void); void DrawPWMenu (void); void CP_PWMenu (void); void DrawBattleModes (void); void CP_BattleModes (void); void DrawBattleOptions (void); void CP_BattleOptions (void); void DrawGravityMenu (void); void CP_GravityOptions (void); void DrawSpeedMenu (void); void CP_SpeedOptions (void); void DrawAmmoPerWeaponMenu (void); void CP_AmmoPerWeaponOptions (void); void DrawHitPointsMenu (void); void CP_HitPointsOptions (void); void DrawSpawnControlMenu (void); void DrawSpawnControlButtons (void); void CP_SpawnControlOptions (void); void DrawLightLevelMenu (void); void CP_LightLevelOptions (void); void DrawPointGoalMenu (void); void CP_PointGoalOptions (void); void DrawDangerMenu (void); void CP_DangerOptions (void); void DrawTimeLimitMenu (void); void CP_TimeLimitOptions (void); void PrintBattleOption( boolean inmenu, int x, int y, char *text ); void CP_OnePlayerWarningMessage( void ); void DrawMultiPageCustomMenu( char *title, void ( *redrawfunc )( void ) ); #endif rott-20230810/rott/_rt_msg.h000066400000000000000000000014601446517470200155510ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_msg_private #define _rt_msg_private #define MESSAGETIME (35*6) #endif rott-20230810/rott/_rt_net.h000066400000000000000000000066561446517470200155650ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_net_private #define _rt_net_private #define DEMOBUFFSIZE 50000 #define FASTSPEED (0xB000) #define SETUPTIME 15 #define PlayerCommand(player,command) \ (PlayerCmds[(player)]->Commands[(command)]) #define ClientCommand(player,command) \ (ClientCmds[(player)]->Commands[(command)]) #define LocalCommand(command) \ (LocalCmds->Commands[(command)]) #define ServerCommand(command) \ (ServerCmds->Commands[(command)]) #define CommandAddress(time) \ (((time)-controlupdatestartedtime) & (MAXCMDS-1)) #define NextLocalCommand() \ (LocalCommand(CommandAddress(controlupdatetime))) #define NextServerCommand() \ (ServerCommand(CommandAddress(serverupdatetime))) #define ClientTimeCommand(which,whichtime) \ (ClientCmds[(which)]->Commands[(CommandAddress((whichtime)))]) #define ServerCommandStatus(whichtime) \ (CommandState[0]->CommandStates[(CommandAddress((whichtime)))]) #define ServerCommandNumberStatus(command) \ (CommandState[0]->CommandStates[(command)]) #define ClientCommandStatus(which, whichtime) \ (CommandState[(which+1)]->CommandStates[(CommandAddress((whichtime)))]) #define ClientCommandNumberStatus(which, command) \ (CommandState[(which+1)]->CommandStates[(command)]) /* #define PacketAddress(time) \ ((time) & (MAXCMDS-1)) */ #define PacketAddress(time) \ (time) #define NETWORKTIMEOUT (VBLCOUNTER/3) #define MODEMTIMEOUT (VBLCOUNTER/2) #define SERVERTIMEOUT (VBLCOUNTER<<3) #define MAXPOLLTICS 3 typedef enum { scfp_nodata, scfp_gameready, scfp_data, scfp_done } setupcheckforpacketstate; typedef enum { cs_ready, cs_notarrived, cs_fixing } en_CommandStatus; typedef enum { player_ingame, player_quitgame, player_leftgame } en_playerstatus; void PreparePacket (MoveType * pkt); int GetPacketSize (void * pkt); void SendPacket (void * pkt, int dest); void GetRemotePacket (int from, int delay); void ResendLocalPackets (int time, int dest, int numpackets); void ResendServerPackets (int time, int dest, int numpackets); void ResendPacket (void * pkt, int dest); void AddClientDelta (void * pkt, int src); void FixupPacket (void * pkt, int src); void ProcessPacket (void * pkt, int src); void AddServerPacket(void * pkt, int src); void AddClientPacket (void * pkt, int src); void AddPacket (void * pkt, int src); void RequestPacket (int time, int dest, int numpackets); boolean AllPlayersReady ( void ); boolean AreClientsReady ( void ); boolean IsServerCommandReady ( int time ); void UpdatePlayerObj ( int player ); void AddServerSubPacket(COM_ServerHeaderType * serverpkt); void AddSubPacket (void * pkt, int src); #endif rott-20230810/rott/_rt_play.h000066400000000000000000000076601446517470200157400ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_playr_private #define _rt_playr_private #include "watcom.h" //double dTopYZANGLELIMIT; in winrott.c #define TopYZANGLELIMIT (44*FINEANGLES/360)//bna added #define YZANGLELIMIT (80*FINEANGLES/360)//bna--(30*FINEANGLES/360) /* //bna++ had to limit this or the sky would fuck up #define TopYZANGLELIMIT (6*FINEANGLES/360)//bna added #define YZANGLELIMIT (40*FINEANGLES/360)//bna--(30*FINEANGLES/360) //partly fixed you can now se up but not down very much see rt_playr.c TopYZANGLELIMIT */ #define YZTILTSPEED 20*4//*2 = bna added #define SNAPBACKSPEED 10*15//*2 = bna added #define YZHORIZONSPEED 4*5//*2 = bna added #define HORIZONYZOFFSET (FINEANGLES/4) #define SetPlayerHorizon(ps,hlevel) \ { \ if ((hlevel)>YZANGLELIMIT) \ (ps)->horizon=HORIZONYZOFFSET+YZANGLELIMIT;\ else if ((hlevel)<-YZANGLELIMIT) \ (ps)->horizon=HORIZONYZOFFSET-YZANGLELIMIT;\ else \ (ps)->horizon=HORIZONYZOFFSET+(hlevel);\ } #define StartWeaponChange \ {\ SD_PlaySoundRTP(SD_SELECTWPNSND,ob->x,ob->y);\ pstate->weapondowntics = WEAPONS[pstate->weapon].screenheight/GMOVE;\ if ((ob==player) && SHOW_BOTTOM_STATUS_BAR() )\ DrawBarAmmo (false); \ } #define BULLETHOLEOFFSET 0x700 #define M_DIST(x1,x2,y1,y2) (((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2))) #define W_CHANGE(x) ((x->weapondowntics) || (x->weaponuptics)) #define NOMOM ((!ob->momentumx) && (!ob->momentumy)) #define DISTOK(p1,p2,d) (abs((p1)-(p2)) <= d) #define Fix(a) (a &= (FINEANGLES-1)) #define REMOTEPKTSIZE (sizeof(MoveType)) #define BJRUNSPEED 2048 #define BJJUMPSPEED 680 #define PROJECTILESIZE 0xc000l #define MOVESCALE 150l #define BACKMOVESCALE 100l #define EXTRAPOINTS 40000 #define JETPACKTHRUST (64) #define RUNMOVE 0xa00 #define BASEMOVE 0x600 #define ANGLEMOVE 0x100000 #define SGN(x) (x>0 ? 1 : -1) #define NETMOM (BASEMOVE+0x10000) #define DISTANCE(x1,x2,y1,y2) (FixedMulShift((x1-x2),(x1-x2),16)+FixedMulShift((y1-y2),(y1-y2),16)) #define TILTLIMIT 95 #define PLAYERSTEPTIME 0xf000 #define HITWALLSPEED 0x2800 #define GODVIEWANGLE FINEANGLES/150 #define GODOFFSET 10 #define DOGOFFSET 46 #define KESTICS 70 #define BBTIME 105 #define KEYBOARDNORMALTURNAMOUNT (0x160000) //#define KEYBOARDPREAMBLETURNAMOUNT (0xe0000) #define KEYBOARDPREAMBLETURNAMOUNT (0xa0000) #define TURBOTURNTIME (5) #define TURBOTURNAMOUNT (0x1e000) #define TURNAROUNDSPEED ((ANG180<<16)/15) #define VR_INPUT_SERVICE (0x30) #define VR_FEEDBACK_SERVICE (0x31) #define VR_RUNBUTTON (0) #define VR_STRAFELEFTBUTTON (1) #define VR_STRAFERIGHTBUTTON (2) #define VR_ATTACKBUTTON (3) #define VR_LOOKUPBUTTON (4) #define VR_LOOKDOWNBUTTON (5) #define VR_SWAPWEAPONBUTTON (6) #define VR_USEBUTTON (7) #define VR_HORIZONUPBUTTON (8) #define VR_HORIZONDOWNBUTTON (9) #define VR_MAPBUTTON (10) #define VR_PISTOLBUTTON (11) #define VR_DUALPISTOLBUTTON (12) #define VR_MP40BUTTON (13) #define VR_MISSILEWEAPONBUTTON (14) #define VR_RECORDBUTTON (15) #define STEPADJUST 3 void BatAttack(objtype*ob); void T_DogLick (objtype *ob); #endif rott-20230810/rott/_rt_rand.h000066400000000000000000000331141446517470200157100ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_rand_private #define _rt_rand_private //**************************************************************************** // // Private header for RT_RAND.C // //**************************************************************************** #define SIZE_OF_RANDOM_TABLE 2048 static const unsigned char RandomTable[ SIZE_OF_RANDOM_TABLE ] = { 107, 65, 179, 81, 212, 1, 34, 230, 167, 142, 82, 27, 62, 88, 140, 119, 222, 252, 254, 160, 26, 33, 30, 234, 162, 216, 126, 42, 20, 108, 245, 150, 167, 145, 215, 226, 153, 184, 251, 141, 116, 225, 201, 114, 111, 92, 223, 185, 199, 160, 244, 190, 113, 77, 217, 239, 15, 239, 129, 243, 21, 242, 202, 183, 49, 151, 38, 38, 147, 179, 234, 130, 138, 110, 228, 118, 93, 81, 253, 98, 246, 44, 75, 161, 189, 86, 85, 204, 169, 95, 199, 178, 186, 123, 200, 250, 118, 242, 86, 48, 7, 205, 71, 132, 185, 214, 192, 68, 191, 236, 175, 197, 199, 177, 163, 57, 220, 139, 133, 182, 91, 196, 246, 29, 177, 82, 184, 226, 209, 151, 206, 250, 195, 119, 193, 235, 144, 146, 58, 61, 245, 83, 204, 214, 249, 164, 212, 172, 90, 199, 242, 182, 228, 159, 127, 37, 209, 165, 89, 122, 87, 254, 222, 43, 148, 205, 155, 230, 74, 127, 238, 181, 154, 170, 232, 47, 105, 31, 96, 166, 208, 5, 201, 73, 244, 67, 55, 168, 84, 221, 251, 85, 44, 198, 8, 35, 229, 122, 229, 80, 137, 28, 202, 135, 211, 69, 100, 250, 224, 156, 75, 128, 176, 53, 207, 157, 241, 216, 210, 124, 163, 248, 223, 174, 241, 235, 97, 120, 25, 3, 218, 102, 143, 187, 202, 116, 209, 253, 227, 151, 203, 254, 223, 65, 146, 255, 231, 237, 162, 187, 194, 90, 198, 81, 219, 94, 70, 158, 106, 175, 81, 239, 181, 79, 62, 184, 21, 30, 98, 245, 233, 8, 57, 54, 133, 95, 43, 125, 161, 109, 167, 130, 32, 46, 72, 3, 42, 34, 147, 139, 19, 122, 49, 23, 253, 192, 231, 116, 165, 8, 15, 16, 223, 140, 29, 136, 2, 114, 248, 219, 214, 168, 36, 241, 210, 63, 230, 42, 197, 100, 134, 159, 179, 149, 17, 96, 152, 45, 93, 151, 26, 202, 35, 58, 189, 220, 74, 173, 250, 76, 57, 52, 55, 14, 205, 80, 213, 190, 14, 108, 60, 89, 236, 41, 53, 59, 249, 237, 88, 217, 129, 252, 169, 123, 87, 23, 91, 79, 36, 164, 89, 24, 102, 111, 104, 115, 116, 221, 212, 82, 166, 16, 244, 18, 68, 73, 64, 194, 82, 115, 121, 216, 133, 47, 85, 124, 242, 144, 1, 65, 0, 75, 91, 83, 137, 183, 132, 15, 66, 227, 67, 98, 186, 100, 208, 150, 74, 61, 69, 130, 120, 56, 39, 21, 44, 166, 180, 145, 97, 101, 68, 19, 243, 162, 222, 228, 9, 160, 185, 10, 168, 64, 109, 198, 113, 75, 48, 52, 119, 163, 176, 201, 12, 246, 20, 92, 31, 175, 33, 4, 70, 169, 218, 86, 240, 127, 7, 38, 102, 94, 112, 90, 114, 63, 139, 119, 45, 5, 183, 224, 155, 13, 141, 90, 93, 177, 118, 67, 211, 117, 58, 158, 135, 83, 236, 194, 72, 59, 131, 40, 196, 232, 247, 132, 18, 73, 37, 207, 50, 187, 32, 174, 13, 34, 135, 39, 46, 192, 51, 203, 216, 3, 188, 99, 245, 112, 61, 206, 127, 118, 136, 186, 153, 148, 140, 106, 55, 201, 19, 9, 27, 97, 84, 24, 48, 227, 108, 202, 5, 190, 6, 235, 160, 146, 123, 222, 212, 147, 27, 28, 50, 226, 200, 221, 180, 244, 34, 146, 41, 104, 37, 217, 10, 238, 52, 198, 4, 29, 126, 16, 45, 124, 64, 25, 40, 20, 138, 225, 71, 247, 128, 62, 62, 178, 31, 251, 197, 215, 226, 193, 28, 25, 82, 15, 21, 43, 30, 86, 50, 99, 199, 191, 80, 171, 250, 4, 149, 61, 163, 128, 143, 95, 76, 56, 14, 109, 54, 84, 137, 43, 77, 255, 204, 151, 129, 8, 20, 26, 193, 38, 205, 125, 203, 22, 78, 47, 101, 37, 121, 113, 141, 36, 33, 23, 131, 55, 78, 96, 123, 228, 69, 213, 51, 147, 195, 195, 85, 54, 225, 65, 143, 13, 152, 60, 110, 29, 146, 179, 164, 17, 96, 67, 156, 7, 3, 92, 26, 104, 157, 220, 211, 154, 103, 2, 174, 136, 83, 229, 18, 116, 66, 87, 0, 74, 98, 58, 75, 162, 254, 177, 89, 173, 169, 107, 12, 90, 71, 193, 53, 255, 138, 2, 233, 163, 11, 138, 183, 209, 119, 210, 249, 112, 113, 30, 185, 180, 11, 171, 164, 77, 5, 99, 35, 218, 11, 159, 221, 148, 170, 137, 129, 188, 231, 172, 191, 135, 176, 33, 189, 68, 190, 152, 7, 220, 246, 203, 181, 63, 199, 91, 251, 208, 217, 39, 170, 111, 182, 209, 216, 247, 240, 165, 153, 118, 238, 233, 204, 12, 126, 105, 168, 234, 38, 184, 132, 110, 145, 227, 165, 92, 241, 24, 251, 231, 213, 126, 240, 214, 31, 11, 223, 46, 0, 35, 218, 242, 211, 191, 48, 110, 253, 94, 161, 139, 42, 148, 198, 246, 239, 107, 57, 5, 117, 252, 9, 12, 73, 77, 58, 167, 6, 142, 32, 34, 72, 31, 243, 170, 0, 93, 182, 56, 254, 158, 250, 23, 77, 81, 45, 69, 142, 237, 225, 44, 232, 142, 209, 115, 61, 38, 224, 70, 53, 82, 10, 229, 214, 224, 101, 42, 100, 121, 133, 85, 67, 150, 116, 91, 79, 79, 235, 22, 1, 244, 16, 101, 88, 25, 43, 242, 53, 106, 128, 40, 18, 2, 196, 22, 47, 96, 130, 249, 49, 117, 178, 171, 132, 189, 95, 66, 153, 200, 71, 71, 215, 113, 102, 131, 172, 235, 192, 204, 107, 127, 60, 52, 254, 84, 20, 27, 107, 44, 72, 149, 230, 87, 64, 144, 140, 186, 154, 49, 76, 156, 162, 219, 9, 146, 41, 80, 59, 142, 147, 184, 115, 158, 103, 140, 8, 234, 157, 17, 112, 22, 163, 187, 47, 178, 207, 63, 125, 202, 156, 30, 97, 193, 171, 173, 204, 28, 4, 195, 109, 211, 105, 103, 179, 221, 203, 138, 139, 172, 14, 44, 119, 150, 185, 180, 205, 255, 152, 94, 205, 173, 40, 134, 13, 65, 194, 196, 68, 124, 26, 134, 85, 228, 50, 216, 159, 254, 237, 206, 103, 69, 90, 187, 182, 183, 2, 114, 3, 201, 1, 129, 212, 232, 81, 33, 56, 182, 133, 176, 19, 6, 144, 84, 145, 24, 243, 234, 35, 25, 89, 150, 54, 143, 207, 104, 248, 102, 41, 253, 46, 44, 197, 208, 200, 52, 219, 238, 223, 241, 60, 230, 196, 42, 88, 51, 170, 25, 40, 114, 39, 45, 57, 29, 186, 54, 36, 167, 51, 249, 194, 108, 250, 199, 67, 212, 123, 151, 92, 32, 46, 12, 248, 165, 223, 24, 143, 189, 120, 57, 38, 222, 169, 17, 188, 27, 209, 176, 215, 108, 177, 96, 50, 154, 41, 15, 32, 181, 99, 120, 73, 225, 49, 200, 43, 177, 72, 202, 97, 92, 240, 110, 252, 21, 28, 192, 70, 128, 85, 60, 127, 63, 235, 100, 155, 65, 241, 119, 34, 80, 75, 117, 148, 102, 15, 90, 121, 206, 104, 164, 132, 98, 36, 108, 214, 0, 84, 94, 107, 154, 14, 26, 23, 93, 195, 224, 162, 171, 245, 76, 125, 158, 120, 66, 80, 130, 183, 120, 179, 118, 31, 176, 106, 184, 164, 111, 59, 253, 118, 62, 114, 215, 156, 161, 127, 210, 112, 122, 204, 86, 29, 69, 187, 218, 233, 47, 188, 91, 105, 153, 236, 116, 135, 19, 83, 175, 88, 166, 156, 238, 245, 227, 248, 161, 10, 180, 22, 230, 157, 205, 6, 37, 3, 234, 155, 49, 239, 229, 122, 223, 234, 206, 82, 135, 190, 77, 130, 197, 144, 226, 123, 181, 143, 208, 169, 8, 1, 174, 97, 177, 232, 201, 210, 193, 192, 62, 211, 28, 252, 19, 189, 229, 191, 246, 7, 202, 35, 20, 28, 30, 70, 221, 55, 159, 237, 10, 15, 134, 124, 103, 73, 172, 26, 201, 13, 117, 35, 131, 136, 66, 33, 245, 159, 207, 225, 147, 18, 248, 126, 131, 33, 153, 101, 60, 186, 216, 250, 11, 30, 50, 57, 58, 151, 178, 181, 227, 128, 253, 10, 5, 224, 48, 160, 34, 7, 111, 124, 27, 160, 75, 137, 17, 53, 39, 243, 236, 39, 81, 217, 122, 79, 32, 13, 115, 191, 167, 137, 87, 228, 91, 86, 78, 18, 22, 40, 76, 94, 129, 119, 87, 63, 197, 203, 21, 218, 185, 166, 49, 161, 213, 38, 111, 209, 154, 43, 152, 134, 132, 4, 133, 108, 83, 145, 41, 97, 74, 251, 173, 42, 213, 46, 118, 73, 68, 21, 244, 106, 158, 11, 90, 252, 140, 44, 157, 194, 66, 229, 58, 215, 251, 144, 125, 146, 172, 165, 136, 105, 102, 173, 95, 150, 169, 78, 230, 111, 160, 196, 112, 120, 231, 168, 152, 149, 174, 128, 232, 194, 122, 3, 74, 231, 105, 12, 239, 180, 239, 89, 235, 95, 157, 149, 187, 6, 203, 188, 71, 110, 8, 126, 242, 188, 249, 71, 123, 162, 93, 59, 65, 16, 222, 192, 24, 27, 142, 168, 114, 89, 220, 226, 182, 207, 94, 195, 207, 174, 228, 142, 130, 115, 175, 154, 106, 206, 48, 185, 147, 155, 224, 239, 64, 88, 83, 54, 247, 113, 248, 137, 96, 5, 110, 240, 51, 1, 208, 166, 200, 233, 167, 230, 14, 20, 198, 36, 13, 0, 220, 165, 104, 85, 122, 1, 255, 212, 161, 190, 37, 86, 226, 195, 105, 78, 244, 236, 168, 48, 211, 121, 216, 25, 144, 16, 237, 7, 75, 12, 99, 56, 109, 218, 87, 35, 204, 155, 61, 191, 41, 61, 57, 121, 236, 62, 22, 187, 95, 92, 69, 210, 163, 205, 214, 34, 84, 73, 184, 109, 124, 231, 103, 217, 241, 77, 175, 183, 232, 198, 164, 14, 125, 103, 197, 249, 241, 176, 59, 48, 50, 25, 222, 134, 199, 252, 196, 23, 19, 78, 0, 59, 120, 91, 121, 117, 228, 52, 68, 113, 127, 141, 67, 65, 130, 132, 243, 160, 138, 138, 116, 10, 98, 170, 70, 246, 206, 219, 28, 94, 226, 29, 58, 255, 31, 141, 82, 134, 152, 251, 84, 52, 23, 154, 139, 74, 55, 47, 198, 167, 162, 4, 16, 220, 53, 37, 158, 135, 136, 190, 86, 151, 178, 238, 161, 88, 171, 148, 169, 137, 212, 181, 146, 189, 70, 49, 79, 142, 131, 195, 126, 149, 156, 93, 55, 164, 174, 87, 243, 66, 92, 207, 9, 126, 123, 40, 51, 133, 143, 9, 55, 193, 173, 56, 64, 210, 159, 6, 178, 145, 153, 115, 215, 185, 238, 101, 210, 98, 157, 95, 171, 235, 217, 240, 232, 107, 53, 54, 211, 111, 236, 100, 37, 147, 64, 60, 215, 174, 136, 128, 98, 79, 234, 145, 76, 197, 165, 191, 141, 114, 109, 148, 214, 93, 12, 163, 125, 222, 96, 71, 220, 8, 225, 200, 14, 139, 166, 155, 9, 237, 9, 172, 6, 229, 179, 247, 76, 24, 213, 26, 248, 56, 247, 106, 221, 63, 20, 206, 231, 168, 196, 208, 36, 31, 175, 178, 255, 124, 156, 129, 186, 45, 201, 7, 112, 189, 68, 225, 64, 150, 74, 2, 218, 62, 159, 4, 11, 213, 40, 23, 15, 67, 52, 182, 203, 246, 194, 72, 33, 89, 104, 16, 131, 60, 150, 243, 21, 59, 175, 219, 149, 56, 224, 32, 105, 153, 99, 80, 148, 107, 99, 108, 43, 106, 41, 32, 244, 4, 186, 253, 27, 233, 104, 245, 5, 2, 252, 170, 2, 101, 39, 17, 166, 221, 11, 227, 129, 103, 45, 144, 79, 17, 139, 70, 237, 176, 6, 76, 134, 54, 30, 69, 13, 100, 149, 141, 227, 255, 22, 179, 61, 88, 97, 121, 29, 24, 77, 170, 190, 242, 109, 152, 47, 81, 140, 45, 46, 249, 78, 180, 143, 102, 19, 208, 177, 72, 72, 247, 51, 115, 3, 141, 117, 39, 188, 180, 171, 83, 1, 0, 51, 100, 112, 172, 18, 219, 136, 155, 125, 200, 131, 157, 217, 78, 63, 213, 238, 193, 173, 145, 46, 101, 158, 42, 140, 110, 66, 183, 181, 233, 188, 10, 133, 36, 135, 17, 254, 138, 233, 117, 240, 184, 80, 113, 18, 99, 219, 240, 50, 192, 247 }; #endif rott-20230810/rott/_rt_scal.h000066400000000000000000000015041446517470200157040ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_scale_private #define _rt_scale_private #define PLAYERHEIGHT (260<>SD_RANDOMSHIFT) #define SoundOffset(x) (sounds[x].snds[soundtype]) #define GUSMIDIINIFILE ("gusmidi.ini") typedef enum { loop_yes, loop_no } looptypes; typedef struct { byte loopflag; byte songtype; char lumpname[9]; char songname[40]; } song_t; int SD_PlayIt ( int sndnum, int angle, int distance, int pitch ); boolean SD_SoundOkay ( int sndnum ); #endif rott-20230810/rott/_rt_stat.h000066400000000000000000000031001446517470200157270ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_stat_private #define _rt_stat_private void AddStatic(statobj_t*); void AddAnimStatic(statobj_t*); void PreCacheStaticSounds(int); #define SOLIDCOLORTICTIME 1 #define SOLIDCOLORINCREMENT 1 #define MAXFIRECOLOR 248 #define INITIALFIRECOLOR 246 #define IsLight(x,y) ( (x>=0) && (x<=127) && (y>=0) && (y<=127) && \ (sprites[x][y]) && (sprites[x][y]->flags & FL_LIGHT) ) typedef struct { int tictime, numanims; char firstlump[9]; } awallinfo_t; typedef struct sas { int x,y,z; int flags; signed char ticcount; int hitpoints; short int shapenum; signed char ammo; signed char count; signed char itemnumber; short int areanumber; short int whichstat; byte numanims; int linked_to; }saved_stat_type; #endif rott-20230810/rott/_rt_str.h000066400000000000000000000031511446517470200155720ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //****************************************************************************** // // Private header for RT_STR.C // //****************************************************************************** #ifndef _rt_str_private #define _rt_str_private //****************************************************************************** // // PROTOTYPES // //****************************************************************************** void VWB_DrawPropString (const char *string); void VW_MeasurePropString (const char *string, int *width, int *height ); //void (*USL_MeasureString)(const char *, int *, int *, font_t *) = VW_MeasurePropString, // (*USL_DrawString)(const char *) = VWB_DrawPropString; void (*USL_MeasureString)(const char *, int *, int *, font_t *) = (void (*)(const char *, int *, int *, font_t *))VW_MeasurePropString, (*USL_DrawString)(const char *) = VWB_DrawPropString; #endif rott-20230810/rott/_rt_ted.h000066400000000000000000000044011446517470200155350ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_ted_private #define _rt_ted_private #define MAXPRECACHE 3500 #include "rt_actor.h" #include "develop.h" #define SHAREWARE_TAG 0x4d4b #define REGISTERED_TAG 0x4344 #define RTL_VERSION ( 0x0101 ) #define COMMBAT_SIGNATURE ( "RTC" ) #define NORMAL_SIGNATURE ( "RTL" ) #define RTL_HEADER_OFFSET 8 typedef struct { int lump; int cachelevel; int type; // To make precaching possible on big endian machines } cachetype; //======================================== typedef struct { short RLEWtag; int headeroffsets[100]; byte tileinfo[1]; } mapfiletype; typedef struct { int planestart[3]; word planelength[3]; word width,height; char name[16]; } maptype; #define ActorIsPushWall(xx,yy) ((actorat[xx][yy])&&(((objtype *)actorat[xx][yy])->which==PWALL) ) #define ActorIsWall(xx,yy) ((actorat[xx][yy])&&(((objtype *)actorat[xx][yy])->which==WALL) ) #define ActorIsSpring(xx,yy) ((actorat[xx][yy])&&(((objtype *)actorat[xx][yy])->obclass==springobj) ) #define StaticUndefined(xx,yy) ((sprites[xx][yy])&&(((statobj_t *)sprites[xx][yy])->z<-64) ) #define PRECACHEASTRINGX 141 #define PRECACHEASTRINGY 8 #define PRECACHEESTRINGX 16 #define PRECACHEESTRINGY 8 #define PRECACHESTRINGX 16 #define PRECACHESTRINGY 144 #define PRECACHEBARX 28 #define PRECACHEBARY 178 #define PRECACHELED1X 9 #define PRECACHELED1Y 8 #define PRECACHELED2X 9 #define PRECACHELED2Y 12 #define MAXLEDS 57 #define MAXSILLYSTRINGS 32 #endif rott-20230810/rott/_rt_util.h000066400000000000000000000022331446517470200157370ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_util_private #define _rt_util_private #define ERRORROW 2 #define ERRORCOL 11 #define ERRORFILE ("rotterr.txt") #define SOFTERRORFILE ("error.txt") #define DEBUGFILE ("rott.dbg") #define MAPDEBUGFILE ("mapinfo.txt") #define SGN(x) ((x>0) ? (1) : ((x==0) ? (0) : (-1))) #define SLASHES ('\\') #define MAXCHARS 8 #define WeightR 3 #define WeightG 5 #define WeightB 2 #endif rott-20230810/rott/_rt_vid.h000066400000000000000000000026161446517470200155510ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_vid_private #define _rt_vid_private //****************************************************************************** // // Private header for RT_VID.C // //****************************************************************************** //****************************************************************************** // // DEFINES // //****************************************************************************** #define PIXTOBLOCK 4 #define VW_Hlin(x,z,y,c) VL_Hlin(x,y,(z)-(x)+1,c) #define VW_Vlin(y,z,x,c) VL_Vlin(x,y,(z)-(y)+1,c) #define VW_THlin(x,z,y,up) VL_THlin(x,y,(z)-(x)+1, up) #define VW_TVlin(y,z,x,up) VL_TVlin(x,y,(z)-(y)+1, up) #endif rott-20230810/rott/_w_wad.h000066400000000000000000000030101446517470200153500ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _w_wad_private #define _w_wad_private #include "develop.h" #define CHECKPERIOD 20 #if ( SHAREWARE == 1 ) #if ( DELUXE == 1) #define WADCHECKSUM (54748) #elif ( LOWCOST == 1) #define WADCHECKSUM (12185) #else #define WADCHECKSUM (20567) #endif #else #define WADCHECKSUM (24222) #endif //=============== // TYPES //=============== typedef struct { char name[8]; int handle,position,size; int byteswapped; } lumpinfo_t; typedef struct { char identification[4]; // should be IWAD int numlumps; int infotableofs; } wadinfo_t; typedef struct { int filepos; int size; char name[8]; } filelump_t; #endif rott-20230810/rott/audiolib/000077500000000000000000000000001446517470200155355ustar00rootroot00000000000000rott-20230810/rott/audiolib/Makefile.am000066400000000000000000000003251446517470200175710ustar00rootroot00000000000000noinst_LIBRARIES = libaudiolib.a libaudiolib_a_SOURCES = \ dsl.c \ fx_man.c \ ll_man.c \ multivoc.c \ mv_mix.c \ mvreverb.c \ nodpmi.c \ pitch.c \ user.c \ usrhooks.c libaudiolib_a_CFLAGS = @SDL_CFLAGS@ rott-20230810/rott/audiolib/_multivc.h000066400000000000000000000131301446517470200175260ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** file: _MULTIVC.H author: James R. Dose date: December 20, 1993 Private header for MULTIVOC.C (c) Copyright 1993 James R. Dose. All Rights Reserved. **********************************************************************/ #ifndef ___MULTIVC_H #define ___MULTIVC_H #define TRUE ( 1 == 1 ) #define FALSE ( !TRUE ) #define VOC_8BIT 0x0 #define VOC_CT4_ADPCM 0x1 #define VOC_CT3_ADPCM 0x2 #define VOC_CT2_ADPCM 0x3 #define VOC_16BIT 0x4 #define VOC_ALAW 0x6 #define VOC_MULAW 0x7 #define VOC_CREATIVE_ADPCM 0x200 #define T_SIXTEENBIT_STEREO 0 #define T_8BITS 1 #define T_MONO 2 #define T_16BITSOURCE 4 #define T_LEFTQUIET 8 #define T_RIGHTQUIET 16 #define T_DEFAULT T_SIXTEENBIT_STEREO #define MV_MaxPanPosition 31 #define MV_NumPanPositions ( MV_MaxPanPosition + 1 ) #define MV_MaxTotalVolume 255 //#define MV_MaxVolume 63 #define MV_NumVoices 8 #define MIX_VOLUME( volume ) \ ( ( max( 0, min( ( volume ), 255 ) ) * ( MV_MaxVolume + 1 ) ) >> 8 ) // ( ( max( 0, min( ( volume ), 255 ) ) ) >> 2 ) //#define SILENCE_16BIT 0x80008000 #define SILENCE_16BIT 0 #define SILENCE_8BIT 0x80808080 //#define SILENCE_16BIT_PAS 0 #define MixBufferSize 256 #define NumberOfBuffers 16 #define TotalBufferSize ( MixBufferSize * NumberOfBuffers ) #define PI 3.1415926536 typedef enum { Raw, VOC, DemandFeed, WAV } wavedata; typedef enum { NoMoreData, KeepPlaying } playbackstatus; typedef struct VoiceNode { struct VoiceNode *next; struct VoiceNode *prev; wavedata wavetype; char bits; playbackstatus ( *GetSound )( struct VoiceNode *voice ); void ( *mix )( unsigned long position, unsigned long rate, const char *start, unsigned long length ); char *NextBlock; char *LoopStart; char *LoopEnd; unsigned LoopCount; unsigned long LoopSize; unsigned long BlockLength; unsigned long PitchScale; unsigned long FixedPointBufferSize; char *sound; unsigned long length; unsigned long SamplingRate; unsigned long RateScale; unsigned long position; int Playing; int handle; int priority; void ( *DemandFeed )( char **ptr, unsigned long *length ); short *LeftVolume; short *RightVolume; unsigned long callbackval; } VoiceNode; typedef struct { VoiceNode *start; VoiceNode *end; } VList; typedef struct { unsigned char left; unsigned char right; } Pan; typedef signed short MONO16; typedef signed char MONO8; typedef struct { MONO16 left; MONO16 right; // unsigned short left; // unsigned short right; } STEREO16; typedef struct { MONO16 left; MONO16 right; } SIGNEDSTEREO16; typedef struct { // MONO8 left; // MONO8 right; char left; char right; } STEREO8; typedef struct { char RIFF[ 4 ]; unsigned long file_size; char WAVE[ 4 ]; char fmt[ 4 ]; unsigned long format_size; } riff_header; typedef struct { unsigned short wFormatTag; unsigned short nChannels; unsigned long nSamplesPerSec; unsigned long nAvgBytesPerSec; unsigned short nBlockAlign; unsigned short nBitsPerSample; } format_header; typedef struct { char DATA[ 4 ]; unsigned long size; } data_header; typedef MONO8 VOLUME8[ 256 ]; typedef MONO16 VOLUME16[ 256 ]; typedef char HARSH_CLIP_TABLE_8[ MV_NumVoices * 256 ]; void ClearBuffer_DW( void *ptr, unsigned data, int length ); void MV_Mix8BitMono( unsigned long position, unsigned long rate, const char *start, unsigned long length ); void MV_Mix8BitStereo( unsigned long position, unsigned long rate, const char *start, unsigned long length ); void MV_Mix16BitMono( unsigned long position, unsigned long rate, const char *start, unsigned long length ); void MV_Mix16BitStereo( unsigned long position, unsigned long rate, const char *start, unsigned long length ); void MV_Mix16BitMono16( unsigned long position, unsigned long rate, const char *start, unsigned long length ); void MV_Mix8BitMono16( unsigned long position, unsigned long rate, const char *start, unsigned long length ); void MV_Mix8BitStereo16( unsigned long position, unsigned long rate, const char *start, unsigned long length ); void MV_Mix16BitStereo16( unsigned long position, unsigned long rate, const char *start, unsigned long length ); void MV_16BitReverb( const char *src, char *dest, const VOLUME16 *volume, int count ); void MV_8BitReverb( const char *src, char *dest, const VOLUME16 *volume, int count ); void MV_16BitReverbFast( const char *src, char *dest, int count, int shift ); void MV_8BitReverbFast( const char *src, char *dest, int count, int shift ); #endif rott-20230810/rott/audiolib/debugio.h000066400000000000000000000017511446517470200173300ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 __DEBUGIO_H #define __DEBUGIO_H void DB_SetXY( int x, int y ); void DB_PutChar( char ch ); int DB_PrintString( char *string ); int DB_PrintNum( int number ); int DB_PrintUnsigned( unsigned long number, int radix ); int DB_printf( char *fmt, ... ); #endif rott-20230810/rott/audiolib/dma.h000066400000000000000000000031741446517470200164540ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** file: DMA.H author: James R. Dose date: February 4, 1994 Public header file for DMA.C (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #ifndef __DMA_H #define __DMA_H enum DMA_ERRORS { DMA_Error = -1, DMA_Ok = 0, DMA_ChannelOutOfRange, DMA_InvalidChannel }; enum DMA_Modes { DMA_SingleShotRead, DMA_SingleShotWrite, DMA_AutoInitRead, DMA_AutoInitWrite }; char *DMA_ErrorString ( int ErrorNumber ); int DMA_VerifyChannel ( int channel ); int DMA_SetupTransfer ( int channel, char *address, int length, int mode ); int DMA_EndTransfer ( int channel ); char *DMA_GetCurrentPos ( int channel ); int DMA_GetTransferCount ( int channel ); #endif rott-20230810/rott/audiolib/dpmi.h000066400000000000000000000044721446517470200166460ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: DPMI.H author: James R. Dose date: March 31, 1994 Inline functions for performing DPMI calls. (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #ifndef __DPMI_H #define __DPMI_H #include enum DPMI_Errors { DPMI_Warning = -2, DPMI_Error = -1, DPMI_Ok = 0 }; typedef struct { unsigned long EDI; unsigned long ESI; unsigned long EBP; unsigned long Reserved; unsigned long EBX; unsigned long EDX; unsigned long ECX; unsigned long EAX; unsigned short Flags; unsigned short ES; unsigned short DS; unsigned short FS; unsigned short GS; unsigned short IP; unsigned short CS; unsigned short SP; unsigned short SS; } dpmi_regs; unsigned long DPMI_GetRealModeVector( int num ); void DPMI_SetRealModeVector( int num, unsigned long vector ); int DPMI_CallRealModeFunction( dpmi_regs *callregs ); int DPMI_GetDOSMemory( void **ptr, intptr_t *descriptor, unsigned length ); int DPMI_FreeDOSMemory( intptr_t descriptor ); int DPMI_LockMemory( void *address, unsigned length ); int DPMI_LockMemoryRegion( void *start, void *end ); int DPMI_UnlockMemory( void *address, unsigned length ); int DPMI_UnlockMemoryRegion( void *start, void *end ); #define DPMI_Lock( variable ) \ ( DPMI_LockMemory( (void *) &( variable ), sizeof( variable ) ) ) #define DPMI_Unlock( variable ) \ ( DPMI_UnlockMemory( (void *) &( variable ), sizeof( variable ) ) ) #endif rott-20230810/rott/audiolib/dsl.c000066400000000000000000000100431446517470200164610ustar00rootroot00000000000000#include #include #include "dsl.h" #include "util.h" #include "SDL.h" #include "SDL_mixer.h" extern volatile int MV_MixPage; static int DSL_ErrorCode = DSL_Ok; static int mixer_initialized; static void ( *_CallBackFunc )( void ); static volatile char *_BufferStart; static int _BufferSize; static int _NumDivisions; static int _SampleRate; static int _remainder; static Mix_Chunk *blank; static unsigned char *blank_buf; /* possible todo ideas: cache sdl/sdl mixer error messages. */ char *DSL_ErrorString( int ErrorNumber ) { char *ErrorString; switch (ErrorNumber) { case DSL_Warning: case DSL_Error: ErrorString = DSL_ErrorString(DSL_ErrorCode); break; case DSL_Ok: ErrorString = "SDL Driver ok."; break; case DSL_SDLInitFailure: ErrorString = "SDL Audio initialization failed."; break; case DSL_MixerActive: ErrorString = "SDL Mixer already initialized."; break; case DSL_MixerInitFailure: ErrorString = "SDL Mixer initialization failed."; break; default: ErrorString = "Unknown SDL Driver error."; break; } return ErrorString; } static void DSL_SetErrorCode(int ErrorCode) { DSL_ErrorCode = ErrorCode; } int DSL_Init( void ) { DSL_SetErrorCode(DSL_Ok); if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { DSL_SetErrorCode(DSL_SDLInitFailure); return DSL_Error; } return DSL_Ok; } void DSL_Shutdown( void ) { DSL_StopPlayback(); } static void mixer_callback(int chan, void *stream, int len, void *udata) { Uint8 *stptr; Uint8 *fxptr; int copysize; /* len should equal _BufferSize, else this is screwed up */ stptr = (Uint8 *)stream; if (_remainder > 0) { copysize = min(len, _remainder); fxptr = (Uint8 *)(&_BufferStart[MV_MixPage * _BufferSize]); memcpy(stptr, fxptr+(_BufferSize-_remainder), copysize); len -= copysize; _remainder -= copysize; stptr += copysize; } while (len > 0) { /* new buffer */ _CallBackFunc(); fxptr = (Uint8 *)(&_BufferStart[MV_MixPage * _BufferSize]); copysize = min(len, _BufferSize); memcpy(stptr, fxptr, copysize); len -= copysize; stptr += copysize; } _remainder = len; } int DSL_BeginBufferedPlayback( char *BufferStart, int BufferSize, int NumDivisions, unsigned SampleRate, int MixMode, void ( *CallBackFunc )( void ) ) { Uint16 format; int channels; int chunksize; if (mixer_initialized) { DSL_SetErrorCode(DSL_MixerActive); return DSL_Error; } _CallBackFunc = CallBackFunc; _BufferStart = BufferStart; _BufferSize = (BufferSize / NumDivisions); _NumDivisions = NumDivisions; _SampleRate = SampleRate; _remainder = 0; format = (MixMode & SIXTEEN_BIT) ? AUDIO_S16SYS : AUDIO_U8; channels = (MixMode & STEREO) ? 2 : 1; /* 23ms is typically ideal (11025,22050,44100) 46ms isn't bad */ chunksize = 512; if (SampleRate >= 16000) chunksize *= 2; if (SampleRate >= 32000) chunksize *= 2; /* // SDL mixer does this already if (MixMode & SIXTEEN_BIT) chunksize *= 2; if (MixMode & STEREO) chunksize *= 2; */ if (Mix_OpenAudio(SampleRate, format, channels, chunksize) < 0) { DSL_SetErrorCode(DSL_MixerInitFailure); return DSL_Error; } /* Mix_SetPostMix(mixer_callback, NULL); */ /* have to use a channel because postmix will overwrite the music... */ Mix_RegisterEffect(0, mixer_callback, NULL, NULL); /* create a dummy sample just to allocate that channel */ blank_buf = (Uint8 *)malloc(4096); memset(blank_buf, 0, 4096); blank = Mix_QuickLoad_RAW(blank_buf, 4096); Mix_PlayChannel(0, blank, -1); mixer_initialized = 1; return DSL_Ok; } void DSL_StopPlayback( void ) { if (mixer_initialized) { Mix_HaltChannel(0); } if (blank != NULL) { Mix_FreeChunk(blank); } blank = NULL; if (blank_buf != NULL) { free(blank_buf); } blank_buf = NULL; if (mixer_initialized) { Mix_CloseAudio(); } mixer_initialized = 0; } unsigned DSL_GetPlaybackRate( void ) { return _SampleRate; } unsigned long DisableInterrupts( void ) { return 0; } void RestoreInterrupts( unsigned long flags ) { } rott-20230810/rott/audiolib/dsl.h000066400000000000000000000012131446517470200164650ustar00rootroot00000000000000#ifndef AUDIOLIB__DSL_H #define AUDIOLIB__DSL_H #define MONO_8BIT 0 #define STEREO 1 #define SIXTEEN_BIT 2 #define STEREO_16BIT ( STEREO | SIXTEEN_BIT ) enum DSL_ERRORS { DSL_Warning = -2, DSL_Error = -1, DSL_Ok = 0, DSL_SDLInitFailure, DSL_MixerActive, DSL_MixerInitFailure }; char *DSL_ErrorString( int ErrorNumber ); int DSL_Init( void ); void DSL_StopPlayback( void ); unsigned DSL_GetPlaybackRate( void ); int DSL_BeginBufferedPlayback( char *BufferStart, int BufferSize, int NumDivisions, unsigned SampleRate, int MixMode, void ( *CallBackFunc )( void ) ); void DSL_Shutdown( void ); #endif rott-20230810/rott/audiolib/fx_man.c000066400000000000000000000524461446517470200171640ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: FX_MAN.C author: James R. Dose date: March 17, 1994 Device independant sound effect routines. (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #include #include #include "sndcards.h" #include "multivoc.h" #include "dsl.h" #include "ll_man.h" #include "user.h" #include "fx_man.h" #define TRUE ( 1 == 1 ) #define FALSE ( !TRUE ) static unsigned FX_MixRate; int FX_SoundDevice = -1; int FX_ErrorCode = FX_Ok; int FX_Installed = FALSE; #define FX_SetErrorCode( status ) \ FX_ErrorCode = ( status ); /*--------------------------------------------------------------------- Function: FX_ErrorString Returns a pointer to the error message associated with an error number. A -1 returns a pointer the current error. ---------------------------------------------------------------------*/ char *FX_ErrorString ( int ErrorNumber ) { char *ErrorString; switch( ErrorNumber ) { case FX_Warning : case FX_Error : ErrorString = FX_ErrorString( FX_ErrorCode ); break; case FX_Ok : ErrorString = "Fx ok."; break; case FX_ASSVersion : ErrorString = "Apogee Sound System Version " ASS_VERSION_STRING " " "Programmed by Jim Dose\n" "(c) Copyright 1995 James R. Dose. All Rights Reserved.\n"; break; case FX_SoundCardError : ErrorString = DSL_ErrorString( DSL_Error ); break; case FX_InvalidCard : ErrorString = "Invalid Sound Fx device."; break; case FX_MultiVocError : ErrorString = MV_ErrorString( MV_Error ); break; case FX_DPMI_Error : ErrorString = "DPMI Error in FX_MAN."; break; default : ErrorString = "Unknown Fx error code."; break; } return( ErrorString ); } /*--------------------------------------------------------------------- Function: FX_SetupCard Sets the configuration of a sound device. ---------------------------------------------------------------------*/ int FX_SetupCard ( int SoundCard, fx_device *device ) { int status; int DeviceStatus; if ( USER_CheckParameter( "ASSVER" ) ) { FX_SetErrorCode( FX_ASSVersion ); return( FX_Error ); } FX_SoundDevice = SoundCard; status = FX_Ok; FX_SetErrorCode( FX_Ok ); DeviceStatus = DSL_Init(); if ( DeviceStatus != DSL_Ok ) { FX_SetErrorCode( FX_SoundCardError ); status = FX_Error; } else { device->MaxVoices = 32; device->MaxSampleBits = 0; device->MaxChannels = 0; } return( status ); } /*--------------------------------------------------------------------- Function: FX_GetBlasterSettings Returns the current BLASTER environment variable settings. ---------------------------------------------------------------------*/ int FX_GetBlasterSettings ( fx_blaster_config *blaster ) { return( FX_Ok ); } /*--------------------------------------------------------------------- Function: FX_SetupSoundBlaster Handles manual setup of the Sound Blaster information. ---------------------------------------------------------------------*/ int FX_SetupSoundBlaster ( fx_blaster_config blaster, int *MaxVoices, int *MaxSampleBits, int *MaxChannels ) { return( FX_Ok ); } /*--------------------------------------------------------------------- Function: FX_Init Selects which sound device to use. ---------------------------------------------------------------------*/ int FX_Init ( int SoundCard, int numvoices, int numchannels, int samplebits, unsigned mixrate ) { int status; int devicestatus; if ( FX_Installed ) { FX_Shutdown(); } if ( USER_CheckParameter( "ASSVER" ) ) { FX_SetErrorCode( FX_ASSVersion ); return( FX_Error ); } status = LL_LockMemory(); if ( status != LL_Ok ) { FX_SetErrorCode( FX_DPMI_Error ); return( FX_Error ); } FX_MixRate = mixrate; status = FX_Ok; FX_SoundDevice = SoundCard; switch( SoundCard ) { case SoundBlaster : case Awe32 : case ProAudioSpectrum : case SoundMan16 : case SoundScape : case SoundSource : case TandySoundSource : case UltraSound : devicestatus = MV_Init( SoundCard, FX_MixRate, numvoices, numchannels, samplebits ); if ( devicestatus != MV_Ok ) { FX_SetErrorCode( FX_MultiVocError ); status = FX_Error; } break; default : FX_SetErrorCode( FX_InvalidCard ); status = FX_Error; } if ( status != FX_Ok ) { LL_UnlockMemory(); } else { FX_Installed = TRUE; } return( status ); } /*--------------------------------------------------------------------- Function: FX_Shutdown Terminates use of sound device. ---------------------------------------------------------------------*/ int FX_Shutdown ( void ) { int status; if ( !FX_Installed ) { return( FX_Ok ); } status = FX_Ok; switch( FX_SoundDevice ) { case SoundBlaster : case Awe32 : case ProAudioSpectrum : case SoundMan16 : case SoundScape : case SoundSource : case TandySoundSource : case UltraSound : status = MV_Shutdown(); if ( status != MV_Ok ) { FX_SetErrorCode( FX_MultiVocError ); status = FX_Error; } break; default : FX_SetErrorCode( FX_InvalidCard ); status = FX_Error; } FX_Installed = FALSE; LL_UnlockMemory(); return( status ); } /*--------------------------------------------------------------------- Function: FX_SetCallback Sets the function to call when a voice is done. ---------------------------------------------------------------------*/ int FX_SetCallBack ( void ( *function )( unsigned long ) ) { int status; status = FX_Ok; switch( FX_SoundDevice ) { case SoundBlaster : case Awe32 : case ProAudioSpectrum : case SoundMan16 : case SoundScape : case SoundSource : case TandySoundSource : case UltraSound : MV_SetCallBack( function ); break; default : FX_SetErrorCode( FX_InvalidCard ); status = FX_Error; } return( status ); } /*--------------------------------------------------------------------- Function: FX_SetVolume Sets the volume of the current sound device. ---------------------------------------------------------------------*/ void FX_SetVolume ( int volume ) { MV_SetVolume( volume ); } /*--------------------------------------------------------------------- Function: FX_GetVolume Returns the volume of the current sound device. ---------------------------------------------------------------------*/ int FX_GetVolume ( void ) { int volume; volume = MV_GetVolume(); return( volume ); } /*--------------------------------------------------------------------- Function: FX_SetReverseStereo Set the orientation of the left and right channels. ---------------------------------------------------------------------*/ void FX_SetReverseStereo ( int setting ) { MV_SetReverseStereo( setting ); } /*--------------------------------------------------------------------- Function: FX_GetReverseStereo Returns the orientation of the left and right channels. ---------------------------------------------------------------------*/ int FX_GetReverseStereo ( void ) { return MV_GetReverseStereo(); } /*--------------------------------------------------------------------- Function: FX_SetReverb Sets the reverb level. ---------------------------------------------------------------------*/ void FX_SetReverb ( int reverb ) { MV_SetReverb( reverb ); } /*--------------------------------------------------------------------- Function: FX_SetFastReverb Sets the reverb level. ---------------------------------------------------------------------*/ void FX_SetFastReverb ( int reverb ) { MV_SetFastReverb( reverb ); } /*--------------------------------------------------------------------- Function: FX_GetMaxReverbDelay Returns the maximum delay time for reverb. ---------------------------------------------------------------------*/ int FX_GetMaxReverbDelay ( void ) { return MV_GetMaxReverbDelay(); } /*--------------------------------------------------------------------- Function: FX_GetReverbDelay Returns the current delay time for reverb. ---------------------------------------------------------------------*/ int FX_GetReverbDelay ( void ) { return MV_GetReverbDelay(); } /*--------------------------------------------------------------------- Function: FX_SetReverbDelay Sets the delay level of reverb to add to mix. ---------------------------------------------------------------------*/ void FX_SetReverbDelay ( int delay ) { MV_SetReverbDelay( delay ); } /*--------------------------------------------------------------------- Function: FX_VoiceAvailable Checks if a voice can be play at the specified priority. ---------------------------------------------------------------------*/ int FX_VoiceAvailable ( int priority ) { return MV_VoiceAvailable( priority ); } /*--------------------------------------------------------------------- Function: FX_EndLooping Stops the voice associated with the specified handle from looping without stoping the sound. ---------------------------------------------------------------------*/ int FX_EndLooping ( int handle ) { int status; status = MV_EndLooping( handle ); if ( status == MV_Error ) { FX_SetErrorCode( FX_MultiVocError ); status = FX_Warning; } return( status ); } /*--------------------------------------------------------------------- Function: FX_SetPan Sets the stereo and mono volume level of the voice associated with the specified handle. ---------------------------------------------------------------------*/ int FX_SetPan ( int handle, int vol, int left, int right ) { int status; status = MV_SetPan( handle, vol, left, right ); if ( status == MV_Error ) { FX_SetErrorCode( FX_MultiVocError ); status = FX_Warning; } return( status ); } /*--------------------------------------------------------------------- Function: FX_SetPitch Sets the pitch of the voice associated with the specified handle. ---------------------------------------------------------------------*/ int FX_SetPitch ( int handle, int pitchoffset ) { int status; status = MV_SetPitch( handle, pitchoffset ); if ( status == MV_Error ) { FX_SetErrorCode( FX_MultiVocError ); status = FX_Warning; } return( status ); } /*--------------------------------------------------------------------- Function: FX_SetFrequency Sets the frequency of the voice associated with the specified handle. ---------------------------------------------------------------------*/ int FX_SetFrequency ( int handle, int frequency ) { int status; status = MV_SetFrequency( handle, frequency ); if ( status == MV_Error ) { FX_SetErrorCode( FX_MultiVocError ); status = FX_Warning; } return( status ); } /*--------------------------------------------------------------------- Function: FX_PlayVOC Begin playback of sound data with the given volume and priority. ---------------------------------------------------------------------*/ int FX_PlayVOC ( char *ptr, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ) { int handle; handle = MV_PlayVOC( ptr, pitchoffset, vol, left, right, priority, callbackval ); if ( handle < MV_Ok ) { FX_SetErrorCode( FX_MultiVocError ); handle = FX_Warning; } return( handle ); } /*--------------------------------------------------------------------- Function: FX_PlayLoopedVOC Begin playback of sound data with the given volume and priority. ---------------------------------------------------------------------*/ int FX_PlayLoopedVOC ( char *ptr, long loopstart, long loopend, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ) { int handle; handle = MV_PlayLoopedVOC( ptr, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval ); if ( handle < MV_Ok ) { FX_SetErrorCode( FX_MultiVocError ); handle = FX_Warning; } return( handle ); } /*--------------------------------------------------------------------- Function: FX_PlayWAV Begin playback of sound data with the given volume and priority. ---------------------------------------------------------------------*/ int FX_PlayWAV ( char *ptr, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ) { int handle; handle = MV_PlayWAV( ptr, pitchoffset, vol, left, right, priority, callbackval ); if ( handle < MV_Ok ) { FX_SetErrorCode( FX_MultiVocError ); handle = FX_Warning; } return( handle ); } /*--------------------------------------------------------------------- Function: FX_PlayWAV Begin playback of sound data with the given volume and priority. ---------------------------------------------------------------------*/ int FX_PlayLoopedWAV ( char *ptr, long loopstart, long loopend, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ) { int handle; handle = MV_PlayLoopedWAV( ptr, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval ); if ( handle < MV_Ok ) { FX_SetErrorCode( FX_MultiVocError ); handle = FX_Warning; } return( handle ); } /*--------------------------------------------------------------------- Function: FX_PlayVOC3D Begin playback of sound data at specified angle and distance from listener. ---------------------------------------------------------------------*/ int FX_PlayVOC3D ( char *ptr, int pitchoffset, int angle, int distance, int priority, unsigned long callbackval ) { int handle; handle = MV_PlayVOC3D( ptr, pitchoffset, angle, distance, priority, callbackval ); if ( handle < MV_Ok ) { FX_SetErrorCode( FX_MultiVocError ); handle = FX_Warning; } return( handle ); } /*--------------------------------------------------------------------- Function: FX_PlayWAV3D Begin playback of sound data at specified angle and distance from listener. ---------------------------------------------------------------------*/ int FX_PlayWAV3D ( char *ptr, int pitchoffset, int angle, int distance, int priority, unsigned long callbackval ) { int handle; handle = MV_PlayWAV3D( ptr, pitchoffset, angle, distance, priority, callbackval ); if ( handle < MV_Ok ) { FX_SetErrorCode( FX_MultiVocError ); handle = FX_Warning; } return( handle ); } /*--------------------------------------------------------------------- Function: FX_PlayRaw Begin playback of raw sound data with the given volume and priority. ---------------------------------------------------------------------*/ int FX_PlayRaw ( char *ptr, unsigned long length, unsigned rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ) { int handle; handle = MV_PlayRaw( ptr, length, rate, pitchoffset, vol, left, right, priority, callbackval ); if ( handle < MV_Ok ) { FX_SetErrorCode( FX_MultiVocError ); handle = FX_Warning; } return( handle ); } /*--------------------------------------------------------------------- Function: FX_PlayLoopedRaw Begin playback of raw sound data with the given volume and priority. ---------------------------------------------------------------------*/ int FX_PlayLoopedRaw ( char *ptr, unsigned long length, char *loopstart, char *loopend, unsigned rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ) { int handle; handle = MV_PlayLoopedRaw( ptr, length, loopstart, loopend, rate, pitchoffset, vol, left, right, priority, callbackval ); if ( handle < MV_Ok ) { FX_SetErrorCode( FX_MultiVocError ); handle = FX_Warning; } return( handle ); } /*--------------------------------------------------------------------- Function: FX_Pan3D Set the angle and distance from the listener of the voice associated with the specified handle. ---------------------------------------------------------------------*/ int FX_Pan3D ( int handle, int angle, int distance ) { int status; status = MV_Pan3D( handle, angle, distance ); if ( status != MV_Ok ) { FX_SetErrorCode( FX_MultiVocError ); status = FX_Warning; } return( status ); } /*--------------------------------------------------------------------- Function: FX_SoundActive Tests if the specified sound is currently playing. ---------------------------------------------------------------------*/ int FX_SoundActive ( int handle ) { return( MV_VoicePlaying( handle ) ); } /*--------------------------------------------------------------------- Function: FX_SoundsPlaying Reports the number of voices playing. ---------------------------------------------------------------------*/ int FX_SoundsPlaying ( void ) { return( MV_VoicesPlaying() ); } /*--------------------------------------------------------------------- Function: FX_StopSound Halts playback of a specific voice ---------------------------------------------------------------------*/ int FX_StopSound ( int handle ) { int status; status = MV_Kill( handle ); if ( status != MV_Ok ) { FX_SetErrorCode( FX_MultiVocError ); return( FX_Warning ); } return( FX_Ok ); } /*--------------------------------------------------------------------- Function: FX_StopAllSounds Halts playback of all sounds. ---------------------------------------------------------------------*/ int FX_StopAllSounds ( void ) { int status; status = MV_KillAllVoices(); if ( status != MV_Ok ) { FX_SetErrorCode( FX_MultiVocError ); return( FX_Warning ); } return( FX_Ok ); } /*--------------------------------------------------------------------- Function: FX_StartDemandFeedPlayback Plays a digitized sound from a user controlled buffering system. ---------------------------------------------------------------------*/ int FX_StartDemandFeedPlayback ( void ( *function )( char **ptr, unsigned long *length ), int rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ) { int handle; handle = MV_StartDemandFeedPlayback( function, rate, pitchoffset, vol, left, right, priority, callbackval ); if ( handle < MV_Ok ) { FX_SetErrorCode( FX_MultiVocError ); handle = FX_Warning; } return( handle ); } /*--------------------------------------------------------------------- Function: FX_StartRecording Starts the sound recording engine. ---------------------------------------------------------------------*/ int FX_StartRecording ( int MixRate, void ( *function )( char *ptr, int length ) ) { int status; FX_SetErrorCode( FX_InvalidCard ); status = FX_Warning; return( status ); } /*--------------------------------------------------------------------- Function: FX_StopRecord Stops the sound record engine. ---------------------------------------------------------------------*/ void FX_StopRecord ( void ) { } rott-20230810/rott/audiolib/fx_man.h000066400000000000000000000105731446517470200171640ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: FX_MAN.H author: James R. Dose date: March 17, 1994 Public header for FX_MAN.C (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #ifndef __FX_MAN_H #define __FX_MAN_H #include "sndcards.h" typedef struct { int MaxVoices; int MaxSampleBits; int MaxChannels; } fx_device; #define MonoFx 1 #define StereoFx 2 typedef struct { unsigned long Address; unsigned long Type; unsigned long Interrupt; unsigned long Dma8; unsigned long Dma16; unsigned long Midi; unsigned long Emu; } fx_blaster_config; enum FX_ERRORS { FX_Warning = -2, FX_Error = -1, FX_Ok = 0, FX_ASSVersion, FX_BlasterError, FX_SoundCardError, FX_InvalidCard, FX_MultiVocError, FX_DPMI_Error }; enum fx_BLASTER_Types { fx_SB = 1, fx_SBPro = 2, fx_SB20 = 3, fx_SBPro2 = 4, fx_SB16 = 6 }; char *FX_ErrorString( int ErrorNumber ); int FX_SetupCard( int SoundCard, fx_device *device ); int FX_GetBlasterSettings( fx_blaster_config *blaster ); int FX_SetupSoundBlaster( fx_blaster_config blaster, int *MaxVoices, int *MaxSampleBits, int *MaxChannels ); int FX_Init( int SoundCard, int numvoices, int numchannels, int samplebits, unsigned mixrate ); int FX_Shutdown( void ); int FX_SetCallBack( void ( *function )( unsigned long ) ); void FX_SetVolume( int volume ); int FX_GetVolume( void ); void FX_SetReverseStereo( int setting ); int FX_GetReverseStereo( void ); void FX_SetReverb( int reverb ); void FX_SetFastReverb( int reverb ); int FX_GetMaxReverbDelay( void ); int FX_GetReverbDelay( void ); void FX_SetReverbDelay( int delay ); int FX_VoiceAvailable( int priority ); int FX_EndLooping( int handle ); int FX_SetPan( int handle, int vol, int left, int right ); int FX_SetPitch( int handle, int pitchoffset ); int FX_SetFrequency( int handle, int frequency ); int FX_PlayVOC( char *ptr, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int FX_PlayLoopedVOC( char *ptr, long loopstart, long loopend, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int FX_PlayWAV( char *ptr, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int FX_PlayLoopedWAV( char *ptr, long loopstart, long loopend, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int FX_PlayVOC3D( char *ptr, int pitchoffset, int angle, int distance, int priority, unsigned long callbackval ); int FX_PlayWAV3D( char *ptr, int pitchoffset, int angle, int distance, int priority, unsigned long callbackval ); int FX_PlayRaw( char *ptr, unsigned long length, unsigned rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int FX_PlayLoopedRaw( char *ptr, unsigned long length, char *loopstart, char *loopend, unsigned rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int FX_Pan3D( int handle, int angle, int distance ); int FX_SoundActive( int handle ); int FX_SoundsPlaying( void ); int FX_StopSound( int handle ); int FX_StopAllSounds( void ); int FX_StartDemandFeedPlayback( void ( *function )( char **ptr, unsigned long *length ), int rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int FX_StartRecording( int MixRate, void ( *function )( char *ptr, int length ) ); void FX_StopRecord( void ); #endif rott-20230810/rott/audiolib/interrup.h000066400000000000000000000023161446517470200175600ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: INTERRUP.H author: James R. Dose date: March 31, 1994 Inline functions for disabling and restoring the interrupt flag. (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #ifndef __INTERRUPT_H #define __INTERRUPT_H unsigned long DisableInterrupts( void ); void RestoreInterrupts( unsigned long flags ); #endif rott-20230810/rott/audiolib/linklist.h000066400000000000000000000105111446517470200175350ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 __linklist_h #define __linklist_h #ifdef __cplusplus extern "C" { #endif #define NewNode(type) ((type*)SafeMalloc(sizeof(type))) #define LL_CreateNewLinkedList(rootnode,type,next,prev) \ { \ (rootnode) = NewNode(type); \ (rootnode)->prev = (rootnode); \ (rootnode)->next = (rootnode); \ } #define LL_AddNode(rootnode, newnode, next, prev) \ { \ (newnode)->next = (rootnode); \ (newnode)->prev = (rootnode)->prev; \ (rootnode)->prev->next = (newnode); \ (rootnode)->prev = (newnode); \ } #define LL_TransferList(oldroot,newroot,next,prev) \ { \ if ((oldroot)->prev != (oldroot)) \ { \ (oldroot)->prev->next = (newroot); \ (oldroot)->next->prev = (newroot)->prev; \ (newroot)->prev->next = (oldroot)->next; \ (newroot)->prev = (oldroot)->prev; \ (oldroot)->next = (oldroot); \ (oldroot)->prev = (oldroot); \ } \ } #define LL_ReverseList(root,type,next,prev) \ { \ type *newend,*trav,*tprev; \ \ newend = (root)->next; \ for(trav = (root)->prev; trav != newend; trav = tprev) \ { \ tprev = trav->prev; \ LL_MoveNode(trav,newend,next,prev); \ } \ } #define LL_RemoveNode(node,next,prev) \ { \ (node)->prev->next = (node)->next; \ (node)->next->prev = (node)->prev; \ (node)->next = (node); \ (node)->prev = (node); \ } #define LL_SortedInsertion(rootnode,insertnode,next,prev,type,sortparm) \ { \ type *hoya; \ \ hoya = (rootnode)->next; \ while((hoya != (rootnode)) && ((insertnode)->sortparm > hoya->sortparm)) \ { \ hoya = hoya->next; \ } \ LL_AddNode(hoya,(insertnode),next,prev); \ } #define LL_MoveNode(node,newroot,next,prev) \ { \ LL_RemoveNode((node),next,prev); \ LL_AddNode((newroot),(node),next,prev); \ } #define LL_ListEmpty(list,next,prev) \ ( \ ((list)->next == (list)) && \ ((list)->prev == (list)) \ ) #define LL_Free(list) SafeFree(list) #define LL_Reset(list,next,prev) (list)->next = (list)->prev = (list) #define LL_New LL_CreateNewLinkedList #define LL_Remove LL_RemoveNode #define LL_Add LL_AddNode #define LL_Empty LL_ListEmpty #define LL_Move LL_MoveNode #ifdef __cplusplus }; #endif #endif rott-20230810/rott/audiolib/ll_man.c000066400000000000000000000064711446517470200171530ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: LL_MAN.C author: James R. Dose date: January 1, 1994 Linked list management routines. (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #define LOCKMEMORY #include #include "ll_man.h" #ifdef LOCKMEMORY #include "dpmi.h" #endif #define OFFSET( structure, offset ) \ ( *( ( char ** )&( structure )[ offset ] ) ) /********************************************************************** Memory locked functions: **********************************************************************/ #define LL_LockStart LL_AddNode void LL_AddNode ( char *item, char **head, char **tail, int next, int prev ) { OFFSET( item, prev ) = NULL; OFFSET( item, next ) = *head; if ( *head ) { OFFSET( *head, prev ) = item; } else { *tail = item; } *head = item; } void LL_RemoveNode ( char *item, char **head, char **tail, int next, int prev ) { if ( OFFSET( item, prev ) == NULL ) { *head = OFFSET( item, next ); } else { OFFSET( OFFSET( item, prev ), next ) = OFFSET( item, next ); } if ( OFFSET( item, next ) == NULL ) { *tail = OFFSET( item, prev ); } else { OFFSET( OFFSET( item, next ), prev ) = OFFSET( item, prev ); } OFFSET( item, next ) = NULL; OFFSET( item, prev ) = NULL; } /*--------------------------------------------------------------------- Function: LL_LockEnd Used for determining the length of the functions to lock in memory. ---------------------------------------------------------------------*/ static void LL_LockEnd ( void ) { } /*--------------------------------------------------------------------- Function: LL_UnlockMemory Unlocks all neccessary data. ---------------------------------------------------------------------*/ void LL_UnlockMemory ( void ) { #ifdef LOCKMEMORY DPMI_UnlockMemoryRegion( LL_LockStart, LL_LockEnd ); #endif } /*--------------------------------------------------------------------- Function: LL_LockMemory Locks all neccessary data. ---------------------------------------------------------------------*/ int LL_LockMemory ( void ) { #ifdef LOCKMEMORY int status; status = DPMI_LockMemoryRegion( LL_LockStart, LL_LockEnd ); if ( status != DPMI_Ok ) { return( LL_Error ); } #endif return( LL_Ok ); } rott-20230810/rott/audiolib/ll_man.h000066400000000000000000000050331446517470200171510ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: LL_MAN.H author: James R. Dose date: February 4, 1994 Public header for LL_MAN.C. Linked list management routines. (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #ifndef __LL_MAN_H #define __LL_MAN_H enum LL_Errors { LL_Warning = -2, LL_Error = -1, LL_Ok = 0 }; typedef struct list { void *start; void *end; } list; void LL_AddNode( char *node, char **head, char **tail, int next, int prev ); void LL_RemoveNode( char *node, char **head, char **tail, int next, int prev ); void LL_UnlockMemory( void ); int LL_LockMemory( void ); #define LL_AddToHead( type, listhead, node ) \ LL_AddNode( ( char * )( node ), \ ( char ** )&( ( listhead )->start ), \ ( char ** )&( ( listhead )->end ), \ ( int )&( ( type * ) 0 )->next, \ ( int )&( ( type * ) 0 )->prev ) #define LL_AddToTail( type, listhead, node ) \ LL_AddNode( ( char * )( node ), \ ( char ** )&( ( listhead )->end ), \ ( char ** )&( ( listhead )->start ), \ ( int )&( ( type * ) 0 )->prev, \ ( int )&( ( type * ) 0 )->next ) #define LL_Remove( type, listhead, node ) \ LL_RemoveNode( ( char * )( node ), \ ( char ** )&( ( listhead )->start ), \ ( char ** )&( ( listhead )->end ), \ ( int )&( ( type * ) 0 )->next, \ ( int )&( ( type * ) 0 )->prev ) #define LL_NextNode( node ) ( ( node )->next ) #define LL_PreviousNode( node ) ( ( node )->prev ) #endif rott-20230810/rott/audiolib/multivoc.c000066400000000000000000002131371446517470200175520ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: MULTIVOC.C author: James R. Dose date: December 20, 1993 Routines to provide multichannel digitized sound playback for Sound Blaster compatible sound cards. (c) Copyright 1993 James R. Dose. All Rights Reserved. **********************************************************************/ #include #include #include #include #include "util.h" #include "dpmi.h" #include "usrhooks.h" #include "interrup.h" #include "dma.h" #include "linklist.h" #include "sndcards.h" #include "dsl.h" #include "pitch.h" #include "multivoc.h" #include "_multivc.h" #include "debugio.h" #define RoundFixed( fixedval, bits ) \ ( \ ( \ (fixedval) + ( 1 << ( (bits) - 1 ) )\ ) >> (bits) \ ) #define IS_QUIET( ptr ) ( ( void * )( ptr ) == ( void * )&MV_VolumeTable[ 0 ] ) static int MV_ReverbLevel; static int MV_ReverbDelay; static VOLUME16 *MV_ReverbTable = NULL; //static signed short MV_VolumeTable[ MV_MaxVolume + 1 ][ 256 ]; static signed short MV_VolumeTable[ 63 + 1 ][ 256 ]; //static Pan MV_PanTable[ MV_NumPanPositions ][ MV_MaxVolume + 1 ]; static Pan MV_PanTable[ MV_NumPanPositions ][ 63 + 1 ]; static int MV_Installed = FALSE; static int MV_SoundCard = SoundBlaster; static int MV_TotalVolume = MV_MaxTotalVolume; static int MV_MaxVoices = 1; static int MV_Recording; static int MV_BufferSize = MixBufferSize; static int MV_BufferLength; static int MV_NumberOfBuffers = NumberOfBuffers; static int MV_MixMode = MONO_8BIT; static int MV_Channels = 1; static int MV_Bits = 8; static int MV_Silence = SILENCE_8BIT; static int MV_SwapLeftRight = FALSE; static int MV_RequestedMixRate; static int MV_MixRate; static int MV_DMAChannel = -1; static int MV_BuffShift; static int MV_TotalMemory; static intptr_t MV_BufferDescriptor; static int MV_BufferEmpty[ NumberOfBuffers ]; char *MV_MixBuffer[ NumberOfBuffers + 1 ]; static VoiceNode *MV_Voices = NULL; static volatile VoiceNode VoiceList; static volatile VoiceNode VoicePool; /*static*/ int MV_MixPage = 0; static int MV_VoiceHandle = MV_MinVoiceHandle; static void ( *MV_CallBackFunc )( unsigned long ) = NULL; static void ( *MV_RecordFunc )( char *ptr, int length ) = NULL; static void ( *MV_MixFunction )( VoiceNode *voice, int buffer ); static int MV_MaxVolume = 63; unsigned char *MV_HarshClipTable; char *MV_MixDestination; short *MV_LeftVolume; short *MV_RightVolume; int MV_SampleSize = 1; int MV_RightChannelOffset; unsigned long MV_MixPosition; int MV_ErrorCode = MV_Ok; #define MV_SetErrorCode( status ) \ MV_ErrorCode = ( status ); /*--------------------------------------------------------------------- Function: MV_ErrorString Returns a pointer to the error message associated with an error number. A -1 returns a pointer the current error. ---------------------------------------------------------------------*/ char *MV_ErrorString ( int ErrorNumber ) { char *ErrorString; switch( ErrorNumber ) { case MV_Warning : case MV_Error : ErrorString = MV_ErrorString( MV_ErrorCode ); break; case MV_Ok : ErrorString = "Multivoc ok."; break; case MV_UnsupportedCard : ErrorString = "Selected sound card is not supported by Multivoc."; break; case MV_NotInstalled : ErrorString = "Multivoc not installed."; break; case MV_NoVoices : ErrorString = "No free voices available to Multivoc."; break; case MV_NoMem : ErrorString = "Out of memory in Multivoc."; break; case MV_VoiceNotFound : ErrorString = "No voice with matching handle found."; break; case MV_DPMI_Error : ErrorString = "DPMI Error in Multivoc."; break; case MV_InvalidVOCFile : ErrorString = "Invalid VOC file passed in to Multivoc."; break; case MV_InvalidWAVFile : ErrorString = "Invalid WAV file passed in to Multivoc."; break; case MV_InvalidMixMode : ErrorString = "Invalid mix mode request in Multivoc."; break; case MV_SoundSourceFailure : ErrorString = "Sound Source playback failed."; break; case MV_IrqFailure : ErrorString = "Playback failed, possibly due to an invalid or conflicting IRQ."; break; case MV_DMAFailure : ErrorString = "Playback failed, possibly due to an invalid or conflicting DMA channel."; break; case MV_DMA16Failure : ErrorString = "Playback failed, possibly due to an invalid or conflicting DMA channel. \n" "Make sure the 16-bit DMA channel is correct."; break; case MV_NullRecordFunction : ErrorString = "Null record function passed to MV_StartRecording."; break; default : ErrorString = "Unknown Multivoc error code."; break; } return( ErrorString ); } /********************************************************************** Memory locked functions: **********************************************************************/ #define MV_LockStart MV_Mix /*--------------------------------------------------------------------- Function: MV_Mix Mixes the sound into the buffer. ---------------------------------------------------------------------*/ static void MV_Mix ( VoiceNode *voice, int buffer ) { char *start; int length; long voclength; unsigned long position; unsigned long rate; unsigned long FixedPointBufferSize; if (voice == NULL || voice->GetSound == NULL) return; if ( ( voice->length == 0 ) && ( voice->GetSound( voice ) != KeepPlaying ) ) { return; } length = MixBufferSize; FixedPointBufferSize = voice->FixedPointBufferSize; MV_MixDestination = MV_MixBuffer[ buffer ]; MV_LeftVolume = voice->LeftVolume; MV_RightVolume = voice->RightVolume; if ( ( MV_Channels == 2 ) && ( IS_QUIET( MV_LeftVolume ) ) ) { MV_LeftVolume = MV_RightVolume; MV_MixDestination += MV_RightChannelOffset; } // Add this voice to the mix while( length > 0 ) { start = voice->sound; rate = voice->RateScale; position = voice->position; // Check if the last sample in this buffer would be // beyond the length of the sample block if ( ( position + FixedPointBufferSize ) >= voice->length ) { if ( position < voice->length ) { voclength = ( voice->length - position + rate - 1 ) / rate; } else { voice->GetSound( voice ); return; } } else { voclength = length; } voice->mix( position, rate, start, voclength ); if ( voclength & 1 ) { MV_MixPosition += rate; voclength -= 1; } voice->position = MV_MixPosition; length -= voclength; if ( voice->position >= voice->length ) { // Get the next block of sound if ( voice->GetSound( voice ) != KeepPlaying ) { return; } if ( length > 0 ) { // Get the position of the last sample in the buffer FixedPointBufferSize = voice->RateScale * ( length - 1 ); } } } } /*--------------------------------------------------------------------- Function: MV_PlayVoice Adds a voice to the play list. ---------------------------------------------------------------------*/ void MV_PlayVoice ( VoiceNode *voice ) { unsigned flags; flags = DisableInterrupts(); LL_SortedInsertion( &VoiceList, voice, prev, next, VoiceNode, priority ); RestoreInterrupts( flags ); } /*--------------------------------------------------------------------- Function: MV_StopVoice Removes the voice from the play list and adds it to the free list. ---------------------------------------------------------------------*/ void MV_StopVoice ( VoiceNode *voice ) { unsigned flags; flags = DisableInterrupts(); // move the voice from the play list to the free list LL_Remove( voice, next, prev ); LL_Add( (VoiceNode *)&VoicePool, voice, next, prev ); RestoreInterrupts( flags ); } /*--------------------------------------------------------------------- Function: MV_ServiceVoc Starts playback of the waiting buffer and mixes the next one. ---------------------------------------------------------------------*/ // static int backcolor = 1; void MV_ServiceVoc ( void ) { VoiceNode *voice; VoiceNode *next; // Toggle which buffer we'll mix next MV_MixPage++; if ( MV_MixPage >= MV_NumberOfBuffers ) { MV_MixPage -= MV_NumberOfBuffers; } if ( MV_ReverbLevel == 0 ) { // Initialize buffer //Commented out so that the buffer is always cleared. //This is so the guys at Echo Speech can mix into the //buffer even when no sounds are playing. //if ( !MV_BufferEmpty[ MV_MixPage ] ) { ClearBuffer_DW( MV_MixBuffer[ MV_MixPage ], MV_Silence, MV_BufferSize >> 2 ); if ( ( MV_SoundCard == UltraSound ) && ( MV_Channels == 2 ) ) { ClearBuffer_DW( MV_MixBuffer[ MV_MixPage ] + MV_RightChannelOffset, MV_Silence, MV_BufferSize >> 2 ); } MV_BufferEmpty[ MV_MixPage ] = TRUE; } } else { char *end; char *source; char *dest; int count; int length; end = MV_MixBuffer[ 0 ] + MV_BufferLength;; dest = MV_MixBuffer[ MV_MixPage ]; source = MV_MixBuffer[ MV_MixPage ] - MV_ReverbDelay; if ( source < MV_MixBuffer[ 0 ] ) { source += MV_BufferLength; } length = MV_BufferSize; while( length > 0 ) { count = length; if ( source + count > end ) { count = end - source; } if ( MV_Bits == 16 ) { if ( MV_ReverbTable != NULL ) { MV_16BitReverb( source, dest, (const VOLUME16 *)MV_ReverbTable, count / 2 ); if ( ( MV_SoundCard == UltraSound ) && ( MV_Channels == 2 ) ) { MV_16BitReverb( source + MV_RightChannelOffset, dest + MV_RightChannelOffset, (const VOLUME16 *)MV_ReverbTable, count / 2 ); } } else { MV_16BitReverbFast( source, dest, count / 2, MV_ReverbLevel ); if ( ( MV_SoundCard == UltraSound ) && ( MV_Channels == 2 ) ) { MV_16BitReverbFast( source + MV_RightChannelOffset, dest + MV_RightChannelOffset, count / 2, MV_ReverbLevel ); } } } else { if ( MV_ReverbTable != NULL ) { MV_8BitReverb( source, dest, (const VOLUME16 *)MV_ReverbTable, count ); if ( ( MV_SoundCard == UltraSound ) && ( MV_Channels == 2 ) ) { MV_8BitReverb( source + MV_RightChannelOffset, dest + MV_RightChannelOffset, (const VOLUME16 *)MV_ReverbTable, count ); } } else { MV_8BitReverbFast( source, dest, count, MV_ReverbLevel ); if ( ( MV_SoundCard == UltraSound ) && ( MV_Channels == 2 ) ) { MV_8BitReverbFast( source + MV_RightChannelOffset, dest + MV_RightChannelOffset, count, MV_ReverbLevel ); } } } // if we go through the loop again, it means that we've wrapped around the buffer source = MV_MixBuffer[ 0 ]; dest += count; length -= count; } } // Play any waiting voices for( voice = VoiceList.next; voice != &VoiceList; voice = next ) { // if ( ( voice < &MV_Voices[ 0 ] ) || ( voice > &MV_Voices[ 8 ] ) ) // { // SetBorderColor(backcolor++); // break; // } MV_BufferEmpty[ MV_MixPage ] = FALSE; MV_MixFunction( voice, MV_MixPage ); next = voice->next; // Is this voice done? if ( !voice->Playing ) { MV_StopVoice( voice ); if ( MV_CallBackFunc ) { MV_CallBackFunc( voice->callbackval ); } } } } int leftpage = -1; int rightpage = -1; void MV_ServiceGus( char **ptr, unsigned long *length ) { if ( leftpage == MV_MixPage ) { MV_ServiceVoc(); } leftpage = MV_MixPage; *ptr = MV_MixBuffer[ MV_MixPage ]; *length = MV_BufferSize; } void MV_ServiceRightGus( char **ptr, unsigned long *length ) { if ( rightpage == MV_MixPage ) { MV_ServiceVoc(); } rightpage = MV_MixPage; *ptr = MV_MixBuffer[ MV_MixPage ] + MV_RightChannelOffset; *length = MV_BufferSize; } /*--------------------------------------------------------------------- Function: MV_GetNextVOCBlock Interperate the information of a VOC format sound file. ---------------------------------------------------------------------*/ static __inline unsigned int get_le32(void *p0) { unsigned int val = *((unsigned int *) p0); return(BUILDSWAP_INTEL32(val)); } static __inline unsigned int get_le16(void *p0) { unsigned short val = *((unsigned short *) p0); return( (unsigned int) (BUILDSWAP_INTEL16(val)) ); } static void MV_SetVoiceMixMode (VoiceNode *voice); playbackstatus MV_GetNextVOCBlock ( VoiceNode *voice ) { unsigned char *ptr; int blocktype=0; int lastblocktype=0; uintptr_t blocklength=0l; unsigned long samplespeed=0l; unsigned int tc=0; int packtype=0; int voicemode=0; int done=0; unsigned BitsPerSample; unsigned Channels; unsigned Format; if ( voice->BlockLength > 0 ) { voice->position -= voice->length; voice->sound += voice->length >> 16; if ( voice->bits == 16 ) { voice->sound += voice->length >> 16; } voice->length = min( voice->BlockLength, 0x8000 ); voice->BlockLength -= voice->length; voice->length <<= 16; return( KeepPlaying ); } if ( ( voice->length > 0 ) && ( voice->LoopEnd != NULL ) && ( voice->LoopStart != NULL ) ) { voice->BlockLength = voice->LoopSize; voice->sound = voice->LoopStart; voice->position = 0; voice->length = min( voice->BlockLength, 0x8000 ); voice->BlockLength -= voice->length; voice->length <<= 16; return( KeepPlaying ); } ptr = ( unsigned char * )voice->NextBlock; voice->Playing = TRUE; voicemode = 0; lastblocktype = 0; packtype = 0; done = FALSE; while( !done ) { // Stop playing if we get a NULL pointer if ( ptr == NULL ) { voice->Playing = FALSE; done = TRUE; break; } { unsigned tmp = get_le32(ptr); blocktype = tmp&255; blocklength = tmp>>8; } ptr += 4; switch( blocktype ) { case 0 : // End of data if ( ( voice->LoopStart == NULL ) || ( (unsigned char *)voice->LoopStart >= ( ptr - 4 ) ) ) { voice->Playing = FALSE; done = TRUE; } else { voice->BlockLength = ( ptr - 4 ) - (unsigned char *)voice->LoopStart; voice->sound = voice->LoopStart; voice->position = 0; voice->length = min( voice->BlockLength, 0x8000 ); voice->BlockLength -= voice->length; voice->length <<= 16; return( KeepPlaying ); } break; case 1 : // Sound data block voice->bits = 8; if ( lastblocktype != 8 ) { tc = ( unsigned int )*ptr << 8; packtype = *( ptr + 1 ); } ptr += 2; blocklength -= 2; samplespeed = 256000000L / ( 65536 - tc ); // Skip packed or stereo data if ( ( packtype != 0 ) || ( voicemode != 0 ) ) { ptr += blocklength; } else { done = TRUE; } voicemode = 0; break; case 2 : // Sound continuation block samplespeed = voice->SamplingRate; done = TRUE; break; case 3 : // Silence // Not implimented. ptr += blocklength; break; case 4 : // Marker // Not implimented. ptr += blocklength; break; case 5 : // ASCII string // Not implimented. ptr += blocklength; break; case 6 : // Repeat begin if ( voice->LoopEnd == NULL ) { voice->LoopCount = get_le16(ptr); voice->LoopStart = (char *)ptr + blocklength; } ptr += blocklength; break; case 7 : // Repeat end ptr += blocklength; if ( lastblocktype == 6 ) { voice->LoopCount = 0; } else { if ( ( voice->LoopCount > 0 ) && ( voice->LoopStart != NULL ) ) { ptr = (unsigned char *)voice->LoopStart; if ( voice->LoopCount < 0xffff ) { voice->LoopCount--; if ( voice->LoopCount == 0 ) { voice->LoopStart = NULL; } } } } break; case 8 : // Extended block voice->bits = 8; tc = get_le16(ptr); packtype = *( ptr + 2 ); voicemode = *( ptr + 3 ); ptr += blocklength; break; case 9 : // New sound data block samplespeed = get_le32(ptr); BitsPerSample = ptr[4]; Channels = ptr[5]; Format = get_le16(ptr+6); if ( ( BitsPerSample == 8 ) && ( Channels == 1 ) && ( Format == VOC_8BIT ) ) { ptr += 12; blocklength -= 12; voice->bits = 8; done = TRUE; } else if ( ( BitsPerSample == 16 ) && ( Channels == 1 ) && ( Format == VOC_16BIT ) ) { ptr += 12; blocklength -= 12; voice->bits = 16; done = TRUE; } else { ptr += blocklength; } break; default : // Unknown data. Probably not a VOC file. voice->Playing = FALSE; done = TRUE; break; } lastblocktype = blocktype; } if ( voice->Playing ) { voice->NextBlock = (char *)ptr + blocklength; voice->sound = (char *)ptr; voice->SamplingRate = samplespeed; voice->RateScale = ( voice->SamplingRate * voice->PitchScale ) / MV_MixRate; // Multiply by MixBufferSize - 1 voice->FixedPointBufferSize = ( voice->RateScale * MixBufferSize ) - voice->RateScale; if ( voice->LoopEnd != NULL ) { if ( blocklength > (uintptr_t)voice->LoopEnd ) { blocklength = (uintptr_t)voice->LoopEnd; } else { voice->LoopEnd = (char *)blocklength; } voice->LoopStart = voice->sound + (uintptr_t)voice->LoopStart; voice->LoopEnd = voice->sound + (uintptr_t)voice->LoopEnd; voice->LoopSize = voice->LoopEnd - voice->LoopStart; } if ( voice->bits == 16 ) { blocklength /= 2; } voice->position = 0; voice->length = min( blocklength, 0x8000 ); voice->BlockLength = blocklength - voice->length; voice->length <<= 16; MV_SetVoiceMixMode( voice ); return( KeepPlaying ); } return( NoMoreData ); } /*--------------------------------------------------------------------- Function: MV_GetNextDemandFeedBlock Controls playback of demand fed data. ---------------------------------------------------------------------*/ playbackstatus MV_GetNextDemandFeedBlock ( VoiceNode *voice ) { if ( voice->BlockLength > 0 ) { voice->position -= voice->length; voice->sound += voice->length >> 16; voice->length = min( voice->BlockLength, 0x8000 ); voice->BlockLength -= voice->length; voice->length <<= 16; return( KeepPlaying ); } if ( voice->DemandFeed == NULL ) { return( NoMoreData ); } voice->position = 0; ( voice->DemandFeed )( &voice->sound, &voice->BlockLength ); voice->length = min( voice->BlockLength, 0x8000 ); voice->BlockLength -= voice->length; voice->length <<= 16; if ( ( voice->length > 0 ) && ( voice->sound != NULL ) ) { return( KeepPlaying ); } return( NoMoreData ); } /*--------------------------------------------------------------------- Function: MV_GetNextRawBlock Controls playback of demand fed data. ---------------------------------------------------------------------*/ playbackstatus MV_GetNextRawBlock ( VoiceNode *voice ) { if ( voice->BlockLength <= 0 ) { if ( voice->LoopStart == NULL ) { voice->Playing = FALSE; return( NoMoreData ); } voice->BlockLength = voice->LoopSize; voice->NextBlock = voice->LoopStart; voice->length = 0; voice->position = 0; } voice->sound = voice->NextBlock; voice->position -= voice->length; voice->length = min( voice->BlockLength, 0x8000 ); voice->NextBlock += voice->length; if ( voice->bits == 16 ) { voice->NextBlock += voice->length; } voice->BlockLength -= voice->length; voice->length <<= 16; return( KeepPlaying ); } /*--------------------------------------------------------------------- Function: MV_GetNextWAVBlock Controls playback of demand fed data. ---------------------------------------------------------------------*/ playbackstatus MV_GetNextWAVBlock ( VoiceNode *voice ) { if ( voice->BlockLength <= 0 ) { if ( voice->LoopStart == NULL ) { voice->Playing = FALSE; return( NoMoreData ); } voice->BlockLength = voice->LoopSize; voice->NextBlock = voice->LoopStart; voice->length = 0; voice->position = 0; } voice->sound = voice->NextBlock; voice->position -= voice->length; voice->length = min( voice->BlockLength, 0x8000 ); voice->NextBlock += voice->length; if ( voice->bits == 16 ) { voice->NextBlock += voice->length; } voice->BlockLength -= voice->length; voice->length <<= 16; return( KeepPlaying ); } /*--------------------------------------------------------------------- Function: MV_GetVoice Locates the voice with the specified handle. ---------------------------------------------------------------------*/ VoiceNode *MV_GetVoice ( int handle ) { VoiceNode *voice; unsigned flags; flags = DisableInterrupts(); for( voice = VoiceList.next; voice != &VoiceList; voice = voice->next ) { if ( handle == voice->handle ) { break; } } RestoreInterrupts( flags ); if ( voice == &VoiceList ) { MV_SetErrorCode( MV_VoiceNotFound ); // SBF - should this return null? return NULL; } return( voice ); } /*--------------------------------------------------------------------- Function: MV_VoicePlaying Checks if the voice associated with the specified handle is playing. ---------------------------------------------------------------------*/ int MV_VoicePlaying ( int handle ) { VoiceNode *voice; if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return( FALSE ); } voice = MV_GetVoice( handle ); if ( voice == NULL ) { return( FALSE ); } return( TRUE ); } /*--------------------------------------------------------------------- Function: MV_KillAllVoices Stops output of all currently active voices. ---------------------------------------------------------------------*/ int MV_KillAllVoices ( void ) { if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return( MV_Error ); } // Remove all the voices from the list while( VoiceList.next != &VoiceList ) { MV_Kill( VoiceList.next->handle ); } return( MV_Ok ); } /*--------------------------------------------------------------------- Function: MV_Kill Stops output of the voice associated with the specified handle. ---------------------------------------------------------------------*/ int MV_Kill ( int handle ) { VoiceNode *voice; unsigned flags; unsigned long callbackval; if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return( MV_Error ); } flags = DisableInterrupts(); voice = MV_GetVoice( handle ); if ( voice == NULL ) { RestoreInterrupts( flags ); MV_SetErrorCode( MV_VoiceNotFound ); return( MV_Error ); } callbackval = voice->callbackval; MV_StopVoice( voice ); RestoreInterrupts( flags ); if ( MV_CallBackFunc ) { MV_CallBackFunc( callbackval ); } return( MV_Ok ); } /*--------------------------------------------------------------------- Function: MV_VoicesPlaying Determines the number of currently active voices. ---------------------------------------------------------------------*/ int MV_VoicesPlaying ( void ) { VoiceNode *voice; int NumVoices = 0; unsigned flags; if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return( 0 ); } flags = DisableInterrupts(); for( voice = VoiceList.next; voice != &VoiceList; voice = voice->next ) { NumVoices++; } RestoreInterrupts( flags ); return( NumVoices ); } /*--------------------------------------------------------------------- Function: MV_AllocVoice Retrieve an inactive or lower priority voice for output. ---------------------------------------------------------------------*/ VoiceNode *MV_AllocVoice ( int priority ) { VoiceNode *voice; VoiceNode *node; unsigned flags; //return( NULL ); if ( MV_Recording ) { return( NULL ); } flags = DisableInterrupts(); // Check if we have any free voices if ( LL_Empty( &VoicePool, next, prev ) ) { // check if we have a higher priority than a voice that is playing. voice = VoiceList.next; for( node = voice->next; node != &VoiceList; node = node->next ) { if ( node->priority < voice->priority ) { voice = node; } } if ( priority >= voice->priority ) { MV_Kill( voice->handle ); } } // Check if any voices are in the voice pool if ( LL_Empty( &VoicePool, next, prev ) ) { // No free voices RestoreInterrupts( flags ); return( NULL ); } voice = VoicePool.next; LL_Remove( voice, next, prev ); RestoreInterrupts( flags ); // Find a free voice handle do { MV_VoiceHandle++; if ( MV_VoiceHandle < MV_MinVoiceHandle ) { MV_VoiceHandle = MV_MinVoiceHandle; } } while( MV_VoicePlaying( MV_VoiceHandle ) ); voice->handle = MV_VoiceHandle; return( voice ); } /*--------------------------------------------------------------------- Function: MV_VoiceAvailable Checks if a voice can be play at the specified priority. ---------------------------------------------------------------------*/ int MV_VoiceAvailable ( int priority ) { VoiceNode *voice; VoiceNode *node; unsigned flags; // Check if we have any free voices if ( !LL_Empty( &VoicePool, next, prev ) ) { return( TRUE ); } flags = DisableInterrupts(); // check if we have a higher priority than a voice that is playing. voice = VoiceList.next; for( node = VoiceList.next; node != &VoiceList; node = node->next ) { if ( node->priority < voice->priority ) { voice = node; } } RestoreInterrupts( flags ); if ( ( voice != &VoiceList ) && ( priority >= voice->priority ) ) { return( TRUE ); } return( FALSE ); } /*--------------------------------------------------------------------- Function: MV_SetVoicePitch Sets the pitch for the specified voice. ---------------------------------------------------------------------*/ void MV_SetVoicePitch ( VoiceNode *voice, unsigned long rate, int pitchoffset ) { voice->SamplingRate = rate; voice->PitchScale = PITCH_GetScale( pitchoffset ); voice->RateScale = ( rate * voice->PitchScale ) / MV_MixRate; // Multiply by MixBufferSize - 1 voice->FixedPointBufferSize = ( voice->RateScale * MixBufferSize ) - voice->RateScale; } /*--------------------------------------------------------------------- Function: MV_SetPitch Sets the pitch for the voice associated with the specified handle. ---------------------------------------------------------------------*/ int MV_SetPitch ( int handle, int pitchoffset ) { VoiceNode *voice; if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return( MV_Error ); } voice = MV_GetVoice( handle ); if ( voice == NULL ) { MV_SetErrorCode( MV_VoiceNotFound ); return( MV_Error ); } MV_SetVoicePitch( voice, voice->SamplingRate, pitchoffset ); return( MV_Ok ); } /*--------------------------------------------------------------------- Function: MV_SetFrequency Sets the frequency for the voice associated with the specified handle. ---------------------------------------------------------------------*/ int MV_SetFrequency ( int handle, int frequency ) { VoiceNode *voice; if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return( MV_Error ); } voice = MV_GetVoice( handle ); if ( voice == NULL ) { MV_SetErrorCode( MV_VoiceNotFound ); return( MV_Error ); } MV_SetVoicePitch( voice, frequency, 0 ); return( MV_Ok ); } /*--------------------------------------------------------------------- Function: MV_GetVolumeTable Returns a pointer to the volume table associated with the specified volume. ---------------------------------------------------------------------*/ static short *MV_GetVolumeTable ( int vol ) { int volume; short *table; volume = MIX_VOLUME( vol ); table = (short *)&MV_VolumeTable[ volume ]; return( table ); } /*--------------------------------------------------------------------- Function: MV_SetVoiceMixMode Selects which method should be used to mix the voice. ---------------------------------------------------------------------*/ static void MV_SetVoiceMixMode ( VoiceNode *voice ) { unsigned flags; int test; flags = DisableInterrupts(); test = T_DEFAULT; if ( MV_Bits == 8 ) { test |= T_8BITS; } if ( voice->bits == 16 ) { test |= T_16BITSOURCE; } if ( MV_Channels == 1 ) { test |= T_MONO; } else { if ( IS_QUIET( voice->RightVolume ) ) { test |= T_RIGHTQUIET; } else if ( IS_QUIET( voice->LeftVolume ) ) { test |= T_LEFTQUIET; } } // Default case voice->mix = MV_Mix8BitMono; switch( test ) { case T_8BITS | T_MONO | T_16BITSOURCE : voice->mix = MV_Mix8BitMono16; break; case T_8BITS | T_MONO : voice->mix = MV_Mix8BitMono; break; case T_8BITS | T_16BITSOURCE | T_LEFTQUIET : MV_LeftVolume = MV_RightVolume; voice->mix = MV_Mix8BitMono16; break; case T_8BITS | T_LEFTQUIET : MV_LeftVolume = MV_RightVolume; voice->mix = MV_Mix8BitMono; break; case T_8BITS | T_16BITSOURCE | T_RIGHTQUIET : voice->mix = MV_Mix8BitMono16; break; case T_8BITS | T_RIGHTQUIET : voice->mix = MV_Mix8BitMono; break; case T_8BITS | T_16BITSOURCE : voice->mix = MV_Mix8BitStereo16; break; case T_8BITS : voice->mix = MV_Mix8BitStereo; break; case T_MONO | T_16BITSOURCE : voice->mix = MV_Mix16BitMono16; break; case T_MONO : voice->mix = MV_Mix16BitMono; break; case T_16BITSOURCE | T_LEFTQUIET : MV_LeftVolume = MV_RightVolume; voice->mix = MV_Mix16BitMono16; break; case T_LEFTQUIET : MV_LeftVolume = MV_RightVolume; voice->mix = MV_Mix16BitMono; break; case T_16BITSOURCE | T_RIGHTQUIET : voice->mix = MV_Mix16BitMono16; break; case T_RIGHTQUIET : voice->mix = MV_Mix16BitMono; break; case T_16BITSOURCE : voice->mix = MV_Mix16BitStereo16; break; case T_SIXTEENBIT_STEREO : voice->mix = MV_Mix16BitStereo; break; default : voice->mix = MV_Mix8BitMono; } RestoreInterrupts( flags ); } /*--------------------------------------------------------------------- Function: MV_SetVoiceVolume Sets the stereo and mono volume level of the voice associated with the specified handle. ---------------------------------------------------------------------*/ void MV_SetVoiceVolume ( VoiceNode *voice, int vol, int left, int right ) { if ( MV_Channels == 1 ) { left = vol; right = vol; } if ( MV_SwapLeftRight ) { // SBPro uses reversed panning voice->LeftVolume = MV_GetVolumeTable( right ); voice->RightVolume = MV_GetVolumeTable( left ); } else { voice->LeftVolume = MV_GetVolumeTable( left ); voice->RightVolume = MV_GetVolumeTable( right ); } MV_SetVoiceMixMode( voice ); } /*--------------------------------------------------------------------- Function: MV_EndLooping Stops the voice associated with the specified handle from looping without stoping the sound. ---------------------------------------------------------------------*/ int MV_EndLooping ( int handle ) { VoiceNode *voice; unsigned flags; if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return( MV_Error ); } flags = DisableInterrupts(); voice = MV_GetVoice( handle ); if ( voice == NULL ) { RestoreInterrupts( flags ); MV_SetErrorCode( MV_VoiceNotFound ); return( MV_Warning ); } voice->LoopCount = 0; voice->LoopStart = NULL; voice->LoopEnd = NULL; RestoreInterrupts( flags ); return( MV_Ok ); } /*--------------------------------------------------------------------- Function: MV_SetPan Sets the stereo and mono volume level of the voice associated with the specified handle. ---------------------------------------------------------------------*/ int MV_SetPan ( int handle, int vol, int left, int right ) { VoiceNode *voice; if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return( MV_Error ); } voice = MV_GetVoice( handle ); if ( voice == NULL ) { MV_SetErrorCode( MV_VoiceNotFound ); return( MV_Warning ); } MV_SetVoiceVolume( voice, vol, left, right ); return( MV_Ok ); } /*--------------------------------------------------------------------- Function: MV_Pan3D Set the angle and distance from the listener of the voice associated with the specified handle. ---------------------------------------------------------------------*/ int MV_Pan3D ( int handle, int angle, int distance ) { int left; int right; int mid; int volume; int status; if ( distance < 0 ) { distance = -distance; angle += MV_NumPanPositions / 2; } volume = MIX_VOLUME( distance ); // Ensure angle is within 0 - 31 angle &= MV_MaxPanPosition; left = MV_PanTable[ angle ][ volume ].left; right = MV_PanTable[ angle ][ volume ].right; mid = max( 0, 255 - distance ); status = MV_SetPan( handle, mid, left, right ); return( status ); } /*--------------------------------------------------------------------- Function: MV_SetReverb Sets the level of reverb to add to mix. ---------------------------------------------------------------------*/ void MV_SetReverb ( int reverb ) { MV_ReverbLevel = MIX_VOLUME( reverb ); MV_ReverbTable = &MV_VolumeTable[ MV_ReverbLevel ]; } /*--------------------------------------------------------------------- Function: MV_SetFastReverb Sets the level of reverb to add to mix. ---------------------------------------------------------------------*/ void MV_SetFastReverb ( int reverb ) { MV_ReverbLevel = max( 0, min( 16, reverb ) ); MV_ReverbTable = NULL; } /*--------------------------------------------------------------------- Function: MV_GetMaxReverbDelay Returns the maximum delay time for reverb. ---------------------------------------------------------------------*/ int MV_GetMaxReverbDelay ( void ) { int maxdelay; maxdelay = MixBufferSize * MV_NumberOfBuffers; return maxdelay; } /*--------------------------------------------------------------------- Function: MV_GetReverbDelay Returns the current delay time for reverb. ---------------------------------------------------------------------*/ int MV_GetReverbDelay ( void ) { return MV_ReverbDelay / MV_SampleSize; } /*--------------------------------------------------------------------- Function: MV_SetReverbDelay Sets the delay level of reverb to add to mix. ---------------------------------------------------------------------*/ void MV_SetReverbDelay ( int delay ) { int maxdelay; maxdelay = MV_GetMaxReverbDelay(); MV_ReverbDelay = max( MixBufferSize, min( delay, maxdelay ) ); MV_ReverbDelay *= MV_SampleSize; } /*--------------------------------------------------------------------- Function: MV_SetMixMode Prepares Multivoc to play stereo of mono digitized sounds. ---------------------------------------------------------------------*/ int MV_SetMixMode ( int numchannels, int samplebits ) { int mode; if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return( MV_Error ); } mode = 0; if ( numchannels == 2 ) { mode |= STEREO; } if ( samplebits == 16 ) { mode |= SIXTEEN_BIT; } MV_MixMode = mode; MV_Channels = 1; if ( MV_MixMode & STEREO ) { MV_Channels = 2; } MV_Bits = 8; if ( MV_MixMode & SIXTEEN_BIT ) { MV_Bits = 16; } MV_BuffShift = 7 + MV_Channels; MV_SampleSize = sizeof( MONO8 ) * MV_Channels; if ( MV_Bits == 8 ) { MV_Silence = SILENCE_8BIT; } else { MV_Silence = SILENCE_16BIT; MV_BuffShift += 1; MV_SampleSize *= 2; } MV_BufferSize = MixBufferSize * MV_SampleSize; MV_NumberOfBuffers = TotalBufferSize / MV_BufferSize; MV_BufferLength = TotalBufferSize; MV_RightChannelOffset = MV_SampleSize / 2; if ( ( MV_SoundCard == UltraSound ) && ( MV_Channels == 2 ) ) { MV_SampleSize /= 2; MV_BufferSize /= 2; MV_RightChannelOffset = MV_BufferSize * MV_NumberOfBuffers; MV_BufferLength /= 2; } return( MV_Ok ); } /*--------------------------------------------------------------------- Function: MV_StartPlayback Starts the sound playback engine. ---------------------------------------------------------------------*/ int MV_StartPlayback ( void ) { int status; int buffer; // Initialize the buffers ClearBuffer_DW( MV_MixBuffer[ 0 ], MV_Silence, TotalBufferSize >> 2 ); for( buffer = 0; buffer < MV_NumberOfBuffers; buffer++ ) { MV_BufferEmpty[ buffer ] = TRUE; } // Set the mix buffer variables MV_MixPage = 1; MV_MixFunction = MV_Mix; //JIM // MV_MixRate = MV_RequestedMixRate; // return( MV_Ok ); // Start playback status = DSL_BeginBufferedPlayback( MV_MixBuffer[ 0 ], TotalBufferSize, MV_NumberOfBuffers, MV_RequestedMixRate, MV_MixMode, MV_ServiceVoc ); if ( status != DSL_Ok ) { MV_SetErrorCode( MV_BlasterError ); return( MV_Error ); } MV_MixRate = DSL_GetPlaybackRate(); return( MV_Ok ); } /*--------------------------------------------------------------------- Function: MV_StopPlayback Stops the sound playback engine. ---------------------------------------------------------------------*/ void MV_StopPlayback ( void ) { VoiceNode *voice; VoiceNode *next; unsigned flags; DSL_StopPlayback(); // Make sure all callbacks are done. flags = DisableInterrupts(); for( voice = VoiceList.next; voice != &VoiceList; voice = next ) { next = voice->next; MV_StopVoice( voice ); if ( MV_CallBackFunc ) { MV_CallBackFunc( voice->callbackval ); } } RestoreInterrupts( flags ); } /*--------------------------------------------------------------------- Function: MV_StartRecording Starts the sound recording engine. ---------------------------------------------------------------------*/ int MV_StartRecording ( int MixRate, void ( *function )( char *ptr, int length ) ) { MV_SetErrorCode( MV_UnsupportedCard ); return( MV_Error ); } /*--------------------------------------------------------------------- Function: MV_StopRecord Stops the sound record engine. ---------------------------------------------------------------------*/ void MV_StopRecord ( void ) { } /*--------------------------------------------------------------------- Function: MV_StartDemandFeedPlayback Plays a digitized sound from a user controlled buffering system. ---------------------------------------------------------------------*/ int MV_StartDemandFeedPlayback ( void ( *function )( char **ptr, unsigned long *length ), int rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ) { VoiceNode *voice; if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return( MV_Error ); } // Request a voice from the voice pool voice = MV_AllocVoice( priority ); if ( voice == NULL ) { MV_SetErrorCode( MV_NoVoices ); return( MV_Error ); } voice->wavetype = DemandFeed; voice->bits = 8; voice->GetSound = MV_GetNextDemandFeedBlock; voice->NextBlock = NULL; voice->DemandFeed = function; voice->LoopStart = NULL; voice->LoopCount = 0; voice->BlockLength = 0; voice->position = 0; voice->sound = NULL; voice->length = 0; voice->BlockLength = 0; voice->Playing = TRUE; voice->next = NULL; voice->prev = NULL; voice->priority = priority; voice->callbackval = callbackval; MV_SetVoicePitch( voice, rate, pitchoffset ); MV_SetVoiceVolume( voice, vol, left, right ); MV_PlayVoice( voice ); return( voice->handle ); } /*--------------------------------------------------------------------- Function: MV_PlayRaw Begin playback of sound data with the given sound levels and priority. ---------------------------------------------------------------------*/ int MV_PlayRaw ( char *ptr, unsigned long length, unsigned rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ) { int status; status = MV_PlayLoopedRaw( ptr, length, NULL, NULL, rate, pitchoffset, vol, left, right, priority, callbackval ); return( status ); } /*--------------------------------------------------------------------- Function: MV_PlayLoopedRaw Begin playback of sound data with the given sound levels and priority. ---------------------------------------------------------------------*/ int MV_PlayLoopedRaw ( char *ptr, unsigned long length, char *loopstart, char *loopend, unsigned rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ) { VoiceNode *voice; if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return( MV_Error ); } // Request a voice from the voice pool voice = MV_AllocVoice( priority ); if ( voice == NULL ) { MV_SetErrorCode( MV_NoVoices ); return( MV_Error ); } voice->wavetype = Raw; voice->bits = 8; voice->GetSound = MV_GetNextRawBlock; voice->Playing = TRUE; voice->NextBlock = ptr; voice->position = 0; voice->BlockLength = length; voice->length = 0; voice->next = NULL; voice->prev = NULL; voice->priority = priority; voice->callbackval = callbackval; voice->LoopStart = loopstart; voice->LoopEnd = loopend; voice->LoopSize = ( voice->LoopEnd - voice->LoopStart ) + 1; MV_SetVoicePitch( voice, rate, pitchoffset ); MV_SetVoiceVolume( voice, vol, left, right ); MV_PlayVoice( voice ); return( voice->handle ); } /*--------------------------------------------------------------------- Function: MV_PlayWAV Begin playback of sound data with the given sound levels and priority. ---------------------------------------------------------------------*/ int MV_PlayWAV ( char *ptr, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ) { int status; status = MV_PlayLoopedWAV( ptr, -1, -1, pitchoffset, vol, left, right, priority, callbackval ); return( status ); } /*--------------------------------------------------------------------- Function: MV_PlayWAV3D Begin playback of sound data at specified angle and distance from listener. ---------------------------------------------------------------------*/ int MV_PlayWAV3D ( char *ptr, int pitchoffset, int angle, int distance, int priority, unsigned long callbackval ) { int left; int right; int mid; int volume; int status; if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return( MV_Error ); } if ( distance < 0 ) { distance = -distance; angle += MV_NumPanPositions / 2; } volume = MIX_VOLUME( distance ); // Ensure angle is within 0 - 31 angle &= MV_MaxPanPosition; left = MV_PanTable[ angle ][ volume ].left; right = MV_PanTable[ angle ][ volume ].right; mid = max( 0, 255 - distance ); status = MV_PlayWAV( ptr, pitchoffset, mid, left, right, priority, callbackval ); return( status ); } /*--------------------------------------------------------------------- Function: MV_PlayLoopedWAV Begin playback of sound data with the given sound levels and priority. ---------------------------------------------------------------------*/ int MV_PlayLoopedWAV ( char *ptr, long loopstart, long loopend, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ) { riff_header *riff; format_header *format; data_header *data; VoiceNode *voice; int length; int absloopend; int absloopstart; if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return( MV_Error ); } riff = ( riff_header * )ptr; if ( ( strncmp( riff->RIFF, "RIFF", 4 ) != 0 ) || ( strncmp( riff->WAVE, "WAVE", 4 ) != 0 ) || ( strncmp( riff->fmt, "fmt ", 4) != 0 ) ) { MV_SetErrorCode( MV_InvalidWAVFile ); return( MV_Error ); } format = ( format_header * )( riff + 1 ); data = ( data_header * )( ( ( char * )format ) + riff->format_size ); // Check if it's PCM data. if ( format->wFormatTag != 1 ) { MV_SetErrorCode( MV_InvalidWAVFile ); return( MV_Error ); } if ( format->nChannels != 1 ) { MV_SetErrorCode( MV_InvalidWAVFile ); return( MV_Error ); } if ( ( format->nBitsPerSample != 8 ) && ( format->nBitsPerSample != 16 ) ) { MV_SetErrorCode( MV_InvalidWAVFile ); return( MV_Error ); } if ( strncmp( data->DATA, "data", 4 ) != 0 ) { MV_SetErrorCode( MV_InvalidWAVFile ); return( MV_Error ); } // Request a voice from the voice pool voice = MV_AllocVoice( priority ); if ( voice == NULL ) { MV_SetErrorCode( MV_NoVoices ); return( MV_Error ); } voice->wavetype = WAV; voice->bits = format->nBitsPerSample; voice->GetSound = MV_GetNextWAVBlock; length = data->size; absloopstart = loopstart; absloopend = loopend; if ( voice->bits == 16 ) { loopstart *= 2; data->size &= ~1; loopend *= 2; length /= 2; } loopend = min( loopend, (long)data->size ); absloopend = min( absloopend, length ); voice->Playing = TRUE; voice->DemandFeed = NULL; voice->LoopStart = NULL; voice->LoopCount = 0; voice->position = 0; voice->length = 0; voice->BlockLength = absloopend; voice->NextBlock = ( char * )( data + 1 ); voice->next = NULL; voice->prev = NULL; voice->priority = priority; voice->callbackval = callbackval; voice->LoopStart = voice->NextBlock + loopstart; voice->LoopEnd = voice->NextBlock + loopend; voice->LoopSize = absloopend - absloopstart; if ( ( loopstart >= (long)data->size ) || ( loopstart < 0 ) ) { voice->LoopStart = NULL; voice->LoopEnd = NULL; voice->BlockLength = length; } MV_SetVoicePitch( voice, format->nSamplesPerSec, pitchoffset ); MV_SetVoiceVolume( voice, vol, left, right ); MV_PlayVoice( voice ); return( voice->handle ); } /*--------------------------------------------------------------------- Function: MV_PlayVOC3D Begin playback of sound data at specified angle and distance from listener. ---------------------------------------------------------------------*/ int MV_PlayVOC3D ( char *ptr, int pitchoffset, int angle, int distance, int priority, unsigned long callbackval ) { int left; int right; int mid; int volume; int status; if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return( MV_Error ); } if ( distance < 0 ) { distance = -distance; angle += MV_NumPanPositions / 2; } volume = MIX_VOLUME( distance ); // Ensure angle is within 0 - 31 angle &= MV_MaxPanPosition; left = MV_PanTable[ angle ][ volume ].left; right = MV_PanTable[ angle ][ volume ].right; mid = max( 0, 255 - distance ); status = MV_PlayVOC( ptr, pitchoffset, mid, left, right, priority, callbackval ); return( status ); } /*--------------------------------------------------------------------- Function: MV_PlayVOC Begin playback of sound data with the given sound levels and priority. ---------------------------------------------------------------------*/ int MV_PlayVOC ( char *ptr, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ) { int status; status = MV_PlayLoopedVOC( ptr, -1, -1, pitchoffset, vol, left, right, priority, callbackval ); return( status ); } /*--------------------------------------------------------------------- Function: MV_PlayLoopedVOC Begin playback of sound data with the given sound levels and priority. ---------------------------------------------------------------------*/ int MV_PlayLoopedVOC ( char *ptr, intptr_t loopstart, intptr_t loopend, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ) { VoiceNode *voice; int status; unsigned short nextpos; if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return( MV_Error ); } // Make sure it's a valid VOC file. status = strncmp( ptr, "Creative Voice File", 19 ); if ( status != 0 ) { MV_SetErrorCode( MV_InvalidVOCFile ); return( MV_Error ); } // Request a voice from the voice pool voice = MV_AllocVoice( priority ); if ( voice == NULL ) { MV_SetErrorCode( MV_NoVoices ); return( MV_Error ); } voice->wavetype = VOC; voice->bits = 8; voice->GetSound = MV_GetNextVOCBlock; nextpos = *( unsigned short * )( ptr + 0x14 ); voice->NextBlock = ptr + BUILDSWAP_INTEL16(nextpos); voice->DemandFeed = NULL; voice->LoopStart = NULL; voice->LoopCount = 0; voice->BlockLength = 0; voice->PitchScale = PITCH_GetScale( pitchoffset ); voice->length = 0; voice->next = NULL; voice->prev = NULL; voice->priority = priority; voice->callbackval = callbackval; voice->LoopStart = ( char * )loopstart; voice->LoopEnd = ( char * )loopend; voice->LoopSize = loopend - loopstart + 1; if ( loopstart < 0 ) { voice->LoopStart = NULL; voice->LoopEnd = NULL; } MV_SetVoiceVolume( voice, vol, left, right ); MV_PlayVoice( voice ); return( voice->handle ); } /*--------------------------------------------------------------------- Function: MV_LockEnd Used for determining the length of the functions to lock in memory. ---------------------------------------------------------------------*/ static void MV_LockEnd ( void ) { } /*--------------------------------------------------------------------- Function: MV_CreateVolumeTable Create the table used to convert sound data to a specific volume level. ---------------------------------------------------------------------*/ void MV_CreateVolumeTable ( int index, int volume, int MaxVolume ) { int val; int level; int i; level = ( volume * MaxVolume ) / MV_MaxTotalVolume; if ( MV_Bits == 16 ) { for( i = 0; i < 65536; i += 256 ) { val = i - 0x8000; val *= level; val /= MV_MaxVolume; MV_VolumeTable[ index ][ i / 256 ] = val; } } else { for( i = 0; i < 256; i++ ) { val = i - 0x80; val *= level; val /= MV_MaxVolume; MV_VolumeTable[ volume ][ i ] = val; } } } /*--------------------------------------------------------------------- Function: MV_CalcVolume Create the table used to convert sound data to a specific volume level. ---------------------------------------------------------------------*/ void MV_CalcVolume ( int MaxVolume ) { int volume; for( volume = 0; volume < 128; volume++ ) { MV_HarshClipTable[ volume ] = 0; MV_HarshClipTable[ volume + 384 ] = 255; } for( volume = 0; volume < 256; volume++ ) { MV_HarshClipTable[ volume + 128 ] = volume; } // For each volume level, create a translation table with the // appropriate volume calculated. for( volume = 0; volume <= MV_MaxVolume; volume++ ) { MV_CreateVolumeTable( volume, volume, MaxVolume ); } } /*--------------------------------------------------------------------- Function: MV_CalcPanTable Create the table used to determine the stereo volume level of a sound located at a specific angle and distance from the listener. ---------------------------------------------------------------------*/ void MV_CalcPanTable ( void ) { int level; int angle; int distance; int HalfAngle; int ramp; HalfAngle = ( MV_NumPanPositions / 2 ); for( distance = 0; distance <= MV_MaxVolume; distance++ ) { level = ( 255 * ( MV_MaxVolume - distance ) ) / MV_MaxVolume; for( angle = 0; angle <= HalfAngle / 2; angle++ ) { ramp = level - ( ( level * angle ) / ( MV_NumPanPositions / 4 ) ); MV_PanTable[ angle ][ distance ].left = ramp; MV_PanTable[ HalfAngle - angle ][ distance ].left = ramp; MV_PanTable[ HalfAngle + angle ][ distance ].left = level; MV_PanTable[ MV_MaxPanPosition - angle ][ distance ].left = level; MV_PanTable[ angle ][ distance ].right = level; MV_PanTable[ HalfAngle - angle ][ distance ].right = level; MV_PanTable[ HalfAngle + angle ][ distance ].right = ramp; MV_PanTable[ MV_MaxPanPosition - angle ][ distance ].right = ramp; } } } /*--------------------------------------------------------------------- Function: MV_SetVolume Sets the volume of digitized sound playback. ---------------------------------------------------------------------*/ void MV_SetVolume ( int volume ) { volume = max( 0, volume ); volume = min( volume, MV_MaxTotalVolume ); MV_TotalVolume = volume; // Calculate volume table MV_CalcVolume( volume ); } /*--------------------------------------------------------------------- Function: MV_GetVolume Returns the volume of digitized sound playback. ---------------------------------------------------------------------*/ int MV_GetVolume ( void ) { return( MV_TotalVolume ); } /*--------------------------------------------------------------------- Function: MV_SetCallBack Set the function to call when a voice stops. ---------------------------------------------------------------------*/ void MV_SetCallBack ( void ( *function )( unsigned long ) ) { MV_CallBackFunc = function; } /*--------------------------------------------------------------------- Function: MV_SetReverseStereo Set the orientation of the left and right channels. ---------------------------------------------------------------------*/ void MV_SetReverseStereo ( int setting ) { MV_SwapLeftRight = setting; } /*--------------------------------------------------------------------- Function: MV_GetReverseStereo Returns the orientation of the left and right channels. ---------------------------------------------------------------------*/ int MV_GetReverseStereo ( void ) { return( MV_SwapLeftRight ); } /*--------------------------------------------------------------------- Function: MV_TestPlayback Checks if playback has started. ---------------------------------------------------------------------*/ int MV_TestPlayback ( void ) { return MV_Ok; } /*--------------------------------------------------------------------- Function: MV_Init Perform the initialization of variables and memory used by Multivoc. ---------------------------------------------------------------------*/ int MV_Init ( int soundcard, int MixRate, int Voices, int numchannels, int samplebits ) { char *ptr; int status; int buffer; int index; if ( MV_Installed ) { MV_Shutdown(); } MV_SetErrorCode( MV_Ok ); status = MV_LockMemory(); if ( status != MV_Ok ) { return( status ); } MV_TotalMemory = Voices * sizeof( VoiceNode ) + sizeof( HARSH_CLIP_TABLE_8 ); status = USRHOOKS_GetMem( ( void ** )&ptr, MV_TotalMemory ); if ( status != USRHOOKS_Ok ) { MV_UnlockMemory(); MV_SetErrorCode( MV_NoMem ); return( MV_Error ); } status = DPMI_LockMemory( ptr, MV_TotalMemory ); if ( status != DPMI_Ok ) { USRHOOKS_FreeMem( ptr ); MV_UnlockMemory(); MV_SetErrorCode( MV_DPMI_Error ); return( MV_Error ); } MV_Voices = ( VoiceNode * )ptr; MV_HarshClipTable = (unsigned char *) ptr + ( MV_TotalMemory - sizeof( HARSH_CLIP_TABLE_8 ) ); // Set number of voices before calculating volume table MV_MaxVoices = Voices; LL_Reset( (VoiceNode *)&VoiceList, next, prev ); LL_Reset( (VoiceNode *)&VoicePool, next, prev ); for( index = 0; index < Voices; index++ ) { LL_Add( (VoiceNode *)&VoicePool, &MV_Voices[ index ], next, prev ); } // Allocate mix buffer within 1st megabyte status = DPMI_GetDOSMemory( ( void ** )&ptr, &MV_BufferDescriptor, 2 * TotalBufferSize ); if ( status ) { DPMI_UnlockMemory( MV_Voices, MV_TotalMemory ); USRHOOKS_FreeMem( MV_Voices ); MV_Voices = NULL; MV_TotalMemory = 0; MV_UnlockMemory(); MV_SetErrorCode( MV_NoMem ); return( MV_Error ); } MV_SetReverseStereo( FALSE ); // Initialize the sound card status = DSL_Init(); if ( status != DSL_Ok ) { MV_SetErrorCode( MV_BlasterError ); } if ( MV_ErrorCode != MV_Ok ) { status = MV_ErrorCode; DPMI_UnlockMemory( MV_Voices, MV_TotalMemory ); USRHOOKS_FreeMem( MV_Voices ); MV_Voices = NULL; MV_TotalMemory = 0; DPMI_FreeDOSMemory( MV_BufferDescriptor ); MV_UnlockMemory(); MV_SetErrorCode( status ); return( MV_Error ); } MV_SoundCard = soundcard; MV_Installed = TRUE; MV_CallBackFunc = NULL; MV_RecordFunc = NULL; MV_Recording = FALSE; MV_ReverbLevel = 0; MV_ReverbTable = NULL; // Set the sampling rate MV_RequestedMixRate = MixRate; // Set Mixer to play stereo digitized sound MV_SetMixMode( numchannels, samplebits ); MV_ReverbDelay = MV_BufferSize * 3; MV_MixBuffer[ MV_NumberOfBuffers ] = ptr; for( buffer = 0; buffer < MV_NumberOfBuffers; buffer++ ) { MV_MixBuffer[ buffer ] = ptr; ptr += MV_BufferSize; } // Calculate pan table MV_CalcPanTable(); MV_SetVolume( MV_MaxTotalVolume ); // Start the playback engine status = MV_StartPlayback(); if ( status != MV_Ok ) { // Preserve error code while we shutdown. status = MV_ErrorCode; MV_Shutdown(); MV_SetErrorCode( status ); return( MV_Error ); } if ( MV_TestPlayback() != MV_Ok ) { status = MV_ErrorCode; MV_Shutdown(); MV_SetErrorCode( status ); return( MV_Error ); } return( MV_Ok ); } /*--------------------------------------------------------------------- Function: MV_Shutdown Restore any resources allocated by Multivoc back to the system. ---------------------------------------------------------------------*/ int MV_Shutdown ( void ) { int buffer; unsigned flags; if ( !MV_Installed ) { return( MV_Ok ); } flags = DisableInterrupts(); MV_KillAllVoices(); MV_Installed = FALSE; // Stop the sound recording engine if ( MV_Recording ) { MV_StopRecord(); } // Stop the sound playback engine MV_StopPlayback(); // Shutdown the sound card DSL_Shutdown(); RestoreInterrupts( flags ); // Free any voices we allocated DPMI_UnlockMemory( MV_Voices, MV_TotalMemory ); USRHOOKS_FreeMem( MV_Voices ); MV_Voices = NULL; MV_TotalMemory = 0; LL_Reset( (VoiceNode *)&VoiceList, next, prev ); LL_Reset( (VoiceNode *)&VoicePool, next, prev ); MV_MaxVoices = 1; // Release the descriptor from our mix buffer DPMI_FreeDOSMemory( MV_BufferDescriptor ); for( buffer = 0; buffer < NumberOfBuffers; buffer++ ) { MV_MixBuffer[ buffer ] = NULL; } return( MV_Ok ); } /*--------------------------------------------------------------------- Function: MV_UnlockMemory Unlocks all neccessary data. ---------------------------------------------------------------------*/ void MV_UnlockMemory ( void ) { PITCH_UnlockMemory(); DPMI_UnlockMemoryRegion( MV_LockStart, MV_LockEnd ); DPMI_Unlock( MV_VolumeTable ); DPMI_Unlock( MV_PanTable ); DPMI_Unlock( MV_Installed ); DPMI_Unlock( MV_SoundCard ); DPMI_Unlock( MV_TotalVolume ); DPMI_Unlock( MV_MaxVoices ); DPMI_Unlock( MV_BufferSize ); DPMI_Unlock( MV_BufferLength ); DPMI_Unlock( MV_SampleSize ); DPMI_Unlock( MV_NumberOfBuffers ); DPMI_Unlock( MV_MixMode ); DPMI_Unlock( MV_Channels ); DPMI_Unlock( MV_Bits ); DPMI_Unlock( MV_Silence ); DPMI_Unlock( MV_SwapLeftRight ); DPMI_Unlock( MV_RequestedMixRate ); DPMI_Unlock( MV_MixRate ); DPMI_Unlock( MV_BufferDescriptor ); DPMI_Unlock( MV_MixBuffer ); DPMI_Unlock( MV_BufferEmpty ); DPMI_Unlock( MV_Voices ); DPMI_Unlock( VoiceList ); DPMI_Unlock( VoicePool ); DPMI_Unlock( MV_MixPage ); DPMI_Unlock( MV_VoiceHandle ); DPMI_Unlock( MV_CallBackFunc ); DPMI_Unlock( MV_RecordFunc ); DPMI_Unlock( MV_Recording ); DPMI_Unlock( MV_MixFunction ); DPMI_Unlock( MV_HarshClipTable ); DPMI_Unlock( MV_MixDestination ); DPMI_Unlock( MV_LeftVolume ); DPMI_Unlock( MV_RightVolume ); DPMI_Unlock( MV_MixPosition ); DPMI_Unlock( MV_ErrorCode ); DPMI_Unlock( MV_DMAChannel ); DPMI_Unlock( MV_BuffShift ); DPMI_Unlock( MV_ReverbLevel ); DPMI_Unlock( MV_ReverbDelay ); DPMI_Unlock( MV_ReverbTable ); } /*--------------------------------------------------------------------- Function: MV_LockMemory Locks all neccessary data. ---------------------------------------------------------------------*/ int MV_LockMemory ( void ) { int status; int pitchstatus; status = DPMI_LockMemoryRegion( MV_LockStart, MV_LockEnd ); status |= DPMI_Lock( MV_VolumeTable ); status |= DPMI_Lock( MV_PanTable ); status |= DPMI_Lock( MV_Installed ); status |= DPMI_Lock( MV_SoundCard ); status |= DPMI_Lock( MV_TotalVolume ); status |= DPMI_Lock( MV_MaxVoices ); status |= DPMI_Lock( MV_BufferSize ); status |= DPMI_Lock( MV_BufferLength ); status |= DPMI_Lock( MV_SampleSize ); status |= DPMI_Lock( MV_NumberOfBuffers ); status |= DPMI_Lock( MV_MixMode ); status |= DPMI_Lock( MV_Channels ); status |= DPMI_Lock( MV_Bits ); status |= DPMI_Lock( MV_Silence ); status |= DPMI_Lock( MV_SwapLeftRight ); status |= DPMI_Lock( MV_RequestedMixRate ); status |= DPMI_Lock( MV_MixRate ); status |= DPMI_Lock( MV_BufferDescriptor ); status |= DPMI_Lock( MV_MixBuffer ); status |= DPMI_Lock( MV_BufferEmpty ); status |= DPMI_Lock( MV_Voices ); status |= DPMI_Lock( VoiceList ); status |= DPMI_Lock( VoicePool ); status |= DPMI_Lock( MV_MixPage ); status |= DPMI_Lock( MV_VoiceHandle ); status |= DPMI_Lock( MV_CallBackFunc ); status |= DPMI_Lock( MV_RecordFunc ); status |= DPMI_Lock( MV_Recording ); status |= DPMI_Lock( MV_MixFunction ); status |= DPMI_Lock( MV_HarshClipTable ); status |= DPMI_Lock( MV_MixDestination ); status |= DPMI_Lock( MV_LeftVolume ); status |= DPMI_Lock( MV_RightVolume ); status |= DPMI_Lock( MV_MixPosition ); status |= DPMI_Lock( MV_ErrorCode ); status |= DPMI_Lock( MV_DMAChannel ); status |= DPMI_Lock( MV_BuffShift ); status |= DPMI_Lock( MV_ReverbLevel ); status |= DPMI_Lock( MV_ReverbDelay ); status |= DPMI_Lock( MV_ReverbTable ); pitchstatus = PITCH_LockMemory(); if ( ( pitchstatus != PITCH_Ok ) || ( status != DPMI_Ok ) ) { MV_UnlockMemory(); MV_SetErrorCode( MV_DPMI_Error ); return( MV_Error ); } return( MV_Ok ); } void ClearBuffer_DW( void *ptr, unsigned data, int length ) { unsigned *d = (unsigned *)ptr; while (length--) { *d = data; d++; } } rott-20230810/rott/audiolib/multivoc.h000066400000000000000000000106301446517470200175500ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** file: MULTIVOC.H author: James R. Dose date: December 20, 1993 Public header for MULTIVOC.C (c) Copyright 1993 James R. Dose. All Rights Reserved. **********************************************************************/ #ifndef __MULTIVOC_H #define __MULTIVOC_H // platform.h is in buildengine, but I need the byteswapping macros... --ryan. #include "platform.h" #define MV_MinVoiceHandle 1 extern int MV_ErrorCode; enum MV_Errors { MV_Warning = -2, MV_Error = -1, MV_Ok = 0, MV_UnsupportedCard, MV_NotInstalled, MV_NoVoices, MV_NoMem, MV_VoiceNotFound, MV_BlasterError, MV_PasError, MV_SoundScapeError, MV_SoundSourceError, MV_DPMI_Error, MV_InvalidVOCFile, MV_InvalidWAVFile, MV_InvalidMixMode, MV_SoundSourceFailure, MV_IrqFailure, MV_DMAFailure, MV_DMA16Failure, MV_NullRecordFunction }; char *MV_ErrorString( int ErrorNumber ); int MV_VoicePlaying( int handle ); int MV_KillAllVoices( void ); int MV_Kill( int handle ); int MV_VoicesPlaying( void ); int MV_VoiceAvailable( int priority ); int MV_SetPitch( int handle, int pitchoffset ); int MV_SetFrequency( int handle, int frequency ); int MV_EndLooping( int handle ); int MV_SetPan( int handle, int vol, int left, int right ); int MV_Pan3D( int handle, int angle, int distance ); void MV_SetReverb( int reverb ); void MV_SetFastReverb( int reverb ); int MV_GetMaxReverbDelay( void ); int MV_GetReverbDelay( void ); void MV_SetReverbDelay( int delay ); int MV_SetMixMode( int numchannels, int samplebits ); int MV_StartPlayback( void ); void MV_StopPlayback( void ); int MV_StartRecording( int MixRate, void ( *function )( char *ptr, int length ) ); void MV_StopRecord( void ); int MV_StartDemandFeedPlayback( void ( *function )( char **ptr, unsigned long *length ), int rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int MV_PlayRaw( char *ptr, unsigned long length, unsigned rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int MV_PlayLoopedRaw( char *ptr, unsigned long length, char *loopstart, char *loopend, unsigned rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int MV_PlayWAV( char *ptr, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int MV_PlayWAV3D( char *ptr, int pitchoffset, int angle, int distance, int priority, unsigned long callbackval ); int MV_PlayLoopedWAV( char *ptr, long loopstart, long loopend, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int MV_PlayVOC3D( char *ptr, int pitchoffset, int angle, int distance, int priority, unsigned long callbackval ); int MV_PlayVOC( char *ptr, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int MV_PlayLoopedVOC( char *ptr, intptr_t loopstart, intptr_t loopend, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); void MV_CreateVolumeTable( int index, int volume, int MaxVolume ); void MV_SetVolume( int volume ); int MV_GetVolume( void ); void MV_SetCallBack( void ( *function )( unsigned long ) ); void MV_SetReverseStereo( int setting ); int MV_GetReverseStereo( void ); int MV_Init( int soundcard, int MixRate, int Voices, int numchannels, int samplebits ); int MV_Shutdown( void ); void MV_UnlockMemory( void ); int MV_LockMemory( void ); #endif rott-20230810/rott/audiolib/mv_mix.c000066400000000000000000000142571446517470200172110ustar00rootroot00000000000000#include "multivoc.h" extern char *MV_MixDestination; extern unsigned long MV_MixPosition; extern char *MV_LeftVolume; extern char *MV_RightVolume; extern unsigned char *MV_HarshClipTable; extern int MV_RightChannelOffset; extern int MV_SampleSize; void MV_Mix8BitMono( unsigned long position, unsigned long rate, const char *start, unsigned long length ) { const unsigned char *src; unsigned char *dest; unsigned int i; src = (const unsigned char *)start; dest = (unsigned char *)MV_MixDestination; for (i = 0; i < length; i++) { int s = src[position >> 16]; int d = *dest; s = MV_LeftVolume[s * 2]; s += d; s = MV_HarshClipTable[s + 0x80]; *dest = (s & 0xff); position += rate; dest += MV_SampleSize; } MV_MixPosition = position; MV_MixDestination = (char *)dest; } void MV_Mix8BitStereo( unsigned long position, unsigned long rate, const char *start, unsigned long length ) { const unsigned char *src; unsigned char *dest; unsigned int i; src = (const unsigned char *)start; dest = (unsigned char *)MV_MixDestination; for (i = 0; i < length; i++) { int s = src[(position >> 16)]; int dl = dest[0]; int dr = dest[MV_RightChannelOffset]; dl += MV_LeftVolume[s * 2]; dr += MV_RightVolume[s * 2]; dl = MV_HarshClipTable[dl + 0x80]; dr = MV_HarshClipTable[dr + 0x80]; dest[0] = (dl & 0xff); dest[MV_RightChannelOffset] = (dr & 0xff); position += rate; dest += MV_SampleSize; } MV_MixPosition = position; MV_MixDestination = (char *)dest; } void MV_Mix16BitMono( unsigned long position, unsigned long rate, const char *start, unsigned long length ) { const short *MV_LeftVolumeS; const unsigned char *src; short *dest; unsigned int i; src = (const unsigned char *)start; dest = (short *)MV_MixDestination; MV_LeftVolumeS = (const short *)MV_LeftVolume; for (i = 0; i < length; i++) { int s = src[position >> 16]; int d = dest[0]; s = MV_LeftVolumeS[s]; s += d; if (s < -32768) s = -32768; if (s > 32767) s = 32767; *dest = (short) s; position += rate; dest += MV_SampleSize/2; } MV_MixPosition = position; MV_MixDestination = (char *)dest; } void MV_Mix16BitStereo( unsigned long position, unsigned long rate, const char *start, unsigned long length ) { const short *MV_LeftVolumeS; const short *MV_RightVolumeS; const unsigned char *src; short *dest; unsigned int i; src = (unsigned char *)start; dest = (short *)MV_MixDestination; MV_LeftVolumeS = (const short *)MV_LeftVolume; MV_RightVolumeS = (const short *)MV_RightVolume; for (i = 0; i < length; i++) { int s = src[position >> 16]; int dl = dest[0]; int dr = dest[MV_RightChannelOffset/2]; dl += MV_LeftVolumeS[s]; dr += MV_RightVolumeS[s]; if (dl < -32768) dl = -32768; if (dl > 32767) dl = 32767; if (dr < -32768) dr = -32768; if (dr > 32767) dr = 32767; dest[0] = (short) dl; dest[MV_RightChannelOffset/2] = (short) dr; position += rate; dest += MV_SampleSize/2; } MV_MixPosition = position; MV_MixDestination = (char *)dest; } void MV_Mix8BitMono16( unsigned long position, unsigned long rate, const char *start, unsigned long length ) { const char *src; unsigned char *dest; unsigned int i; src = (const char *)start + 1; dest = (unsigned char *)MV_MixDestination; for (i = 0; i < length; i++) { int s = (int)src[(position >> 16) * 2] + 0x80; int d = *dest; s = MV_LeftVolume[s * 2]; s += d; s = MV_HarshClipTable[s + 0x80]; *dest = (s & 0xff); position += rate; dest += MV_SampleSize; } MV_MixPosition = position; MV_MixDestination = (char *)dest; } void MV_Mix8BitStereo16( unsigned long position, unsigned long rate, const char *start, unsigned long length ) { const char *src; unsigned char *dest; unsigned int i; src = (const char *)start + 1; dest = (unsigned char *)MV_MixDestination; for (i = 0; i < length; i++) { int s = src[(position >> 16) * 2] + 0x80; int dl = dest[0]; int dr = dest[MV_RightChannelOffset]; dl += MV_LeftVolume[s * 2]; dr += MV_RightVolume[s * 2]; dl = MV_HarshClipTable[dl + 0x80]; dr = MV_HarshClipTable[dr + 0x80]; dest[0] = (dl & 0xff); dest[MV_RightChannelOffset] = (dr & 0xff); position += rate; dest += MV_SampleSize; } MV_MixPosition = position; MV_MixDestination = (char *)dest; } void MV_Mix16BitMono16( unsigned long position, unsigned long rate, const char *start, unsigned long length ) { const short *MV_LeftVolumeS; const unsigned char *src; short *dest; unsigned int i; src = (const unsigned char *)start; dest = (short *)MV_MixDestination; MV_LeftVolumeS = (const short *)MV_LeftVolume; for (i = 0; i < length; i++) { int sl = src[(position >> 16) * 2 + 0]; int sh = src[(position >> 16) * 2 + 1] ^ 0x80; int d = *dest; sl = MV_LeftVolume[sl * 2 + 1]; sh = MV_LeftVolumeS[sh]; d = sl + sh + 0x80 + d; if (d < -32768) d = -32768; if (d > 32767) d = 32767; *dest = (short) d; position += rate; dest += MV_SampleSize/2; } MV_MixPosition = position; MV_MixDestination = (char *)dest; } void MV_Mix16BitStereo16( unsigned long position, unsigned long rate, const char *start, unsigned long length ) { const short *MV_LeftVolumeS; const short *MV_RightVolumeS; const unsigned char *src; short *dest; unsigned int i; src = (const unsigned char *)start; dest = (short *)MV_MixDestination; MV_LeftVolumeS = (const short *)MV_LeftVolume; MV_RightVolumeS = (const short *)MV_RightVolume; for (i = 0; i < length; i++) { int sl = src[(position >> 16) * 2 + 0]; int sh = src[(position >> 16) * 2 + 1] ^ 0x80; int dl = dest[0]; int dr = dest[MV_RightChannelOffset/2]; int sll = MV_LeftVolume[sl * 2 + 1]; int slh = MV_LeftVolumeS[sh]; int srl = MV_RightVolume[sl * 2 + 1]; int srh = MV_RightVolumeS[sh]; dl = sll + slh + 0x80 + dl; dr = srl + srh + 0x80 + dr; if (dl < -32768) dl = -32768; if (dl > 32767) dl = 32767; if (dr < -32768) dr = -32768; if (dr > 32767) dr = 32767; dest[0] = (short) dl; dest[MV_RightChannelOffset/2] = (short) dr; position += rate; dest += MV_SampleSize/2; } MV_MixPosition = position; MV_MixDestination = (char *)dest; } rott-20230810/rott/audiolib/mvreverb.c000066400000000000000000000022031446517470200175260ustar00rootroot00000000000000#include "multivoc.h" #include "_multivc.h" void MV_16BitReverb( const char *src, char *dest, const VOLUME16 *volume, int count ) { int i; short *pdest = (short *)dest; for (i = 0; i < count; i++) { int sl = src[i*2+0]; int sh = src[i*2+1] ^ 0x80; sl = (*volume)[sl] >> 8; sh = (*volume)[sh]; pdest[i] = (short)(sl + sh + 0x80); } } void MV_8BitReverb( const char *src, char *dest, const VOLUME16 *volume, int count ) { int i; for (i = 0; i < count; i++) { unsigned char s = (unsigned char) src[i]; s = (*volume)[s] & 0xff; dest[i] = (char)(s + 0x80); } } void MV_16BitReverbFast( const char *src, char *dest, int count, int shift ) { int i; short *pdest = (short *)dest; const short *psrc = (const short *)src; for (i = 0; i < count; i++) { pdest[i] = psrc[i] >> shift; } } void MV_8BitReverbFast( const char *src, char *dest, int count, int shift ) { int i; unsigned char sh = 0x80 - (0x80 >> shift); for (i = 0; i < count; i++) { unsigned char a = ((unsigned char) src[i]) >> shift; unsigned char c = (((unsigned char) src[i]) ^ 0x80) >> 7; dest[i] = (signed char) (a + sh + c); } } rott-20230810/rott/audiolib/nodpmi.c000066400000000000000000000077361446517470200172040ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: DPMI.C author: James R. Dose date: April 8, 1994 Functions for performing DPMI calls. (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #include #include #include "dpmi.h" #define TRUE ( 1 == 1 ) #define FALSE ( !TRUE ) /*--------------------------------------------------------------------- Function: DPMI_GetRealModeVector Returns the vector of a real mode interrupt. ---------------------------------------------------------------------*/ unsigned long DPMI_GetRealModeVector ( int num ) { return 0; } /*--------------------------------------------------------------------- Function: DPMI_SetRealModeVector Sets the vector of a real mode interrupt. ---------------------------------------------------------------------*/ void DPMI_SetRealModeVector ( int num, unsigned long vector ) { } /*--------------------------------------------------------------------- Function: DPMI_CallRealModeFunction Performs a call to a real mode function. ---------------------------------------------------------------------*/ int DPMI_CallRealModeFunction ( dpmi_regs *callregs ) { return( DPMI_Ok ); } /*--------------------------------------------------------------------- Function: DPMI_LockMemory Locks a region of memory to keep the virtual memory manager from paging the region out. ---------------------------------------------------------------------*/ int DPMI_LockMemory ( void *address, unsigned length ) { return ( DPMI_Ok ); } /*--------------------------------------------------------------------- Function: DPMI_LockMemoryRegion Locks a region of memory to keep the virtual memory manager from paging the region out. ---------------------------------------------------------------------*/ int DPMI_LockMemoryRegion ( void *start, void *end ) { int status; status = DPMI_LockMemory( start, ( char * )end - ( char * )start ); return( status ); } /*--------------------------------------------------------------------- Function: DPMI_UnlockMemory Unlocks a region of memory that was previously locked. ---------------------------------------------------------------------*/ int DPMI_UnlockMemory ( void *address, unsigned length ) { return ( DPMI_Ok ); } /*--------------------------------------------------------------------- Function: DPMI_UnlockMemoryRegion Unlocks a region of memory that was previously locked. ---------------------------------------------------------------------*/ int DPMI_UnlockMemoryRegion ( void *start, void *end ) { int status; status = DPMI_UnlockMemory( start, ( char * )end - ( char * )start ); return( status ); } int DPMI_GetDOSMemory( void **ptr, intptr_t *descriptor, unsigned length ) { /* Lovely... */ *ptr = (void *)malloc(length); *descriptor = (intptr_t) *ptr; return (descriptor == 0) ? DPMI_Error : DPMI_Ok; } int DPMI_FreeDOSMemory( intptr_t descriptor ) { free((void *)descriptor); return (descriptor == 0) ? DPMI_Error : DPMI_Ok; } rott-20230810/rott/audiolib/pitch.c000066400000000000000000000166131446517470200170170ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: PITCH.C author: James R. Dose date: June 14, 1993 Routines for pitch scaling. (c) Copyright 1993 James R. Dose. All Rights Reserved. **********************************************************************/ #include //#include #include "dpmi.h" #include "standard.h" #include "pitch.h" #define MAXDETUNE 25 static unsigned long PitchTable[ 12 ][ MAXDETUNE ] = { { 0x10000, 0x10097, 0x1012f, 0x101c7, 0x10260, 0x102f9, 0x10392, 0x1042c, 0x104c6, 0x10561, 0x105fb, 0x10696, 0x10732, 0x107ce, 0x1086a, 0x10907, 0x109a4, 0x10a41, 0x10adf, 0x10b7d, 0x10c1b, 0x10cba, 0x10d59, 0x10df8, 0x10e98 }, { 0x10f38, 0x10fd9, 0x1107a, 0x1111b, 0x111bd, 0x1125f, 0x11302, 0x113a5, 0x11448, 0x114eb, 0x1158f, 0x11634, 0x116d8, 0x1177e, 0x11823, 0x118c9, 0x1196f, 0x11a16, 0x11abd, 0x11b64, 0x11c0c, 0x11cb4, 0x11d5d, 0x11e06, 0x11eaf }, { 0x11f59, 0x12003, 0x120ae, 0x12159, 0x12204, 0x122b0, 0x1235c, 0x12409, 0x124b6, 0x12563, 0x12611, 0x126bf, 0x1276d, 0x1281c, 0x128cc, 0x1297b, 0x12a2b, 0x12adc, 0x12b8d, 0x12c3e, 0x12cf0, 0x12da2, 0x12e55, 0x12f08, 0x12fbc }, { 0x1306f, 0x13124, 0x131d8, 0x1328d, 0x13343, 0x133f9, 0x134af, 0x13566, 0x1361d, 0x136d5, 0x1378d, 0x13846, 0x138fe, 0x139b8, 0x13a72, 0x13b2c, 0x13be6, 0x13ca1, 0x13d5d, 0x13e19, 0x13ed5, 0x13f92, 0x1404f, 0x1410d, 0x141cb }, { 0x1428a, 0x14349, 0x14408, 0x144c8, 0x14588, 0x14649, 0x1470a, 0x147cc, 0x1488e, 0x14951, 0x14a14, 0x14ad7, 0x14b9b, 0x14c5f, 0x14d24, 0x14dea, 0x14eaf, 0x14f75, 0x1503c, 0x15103, 0x151cb, 0x15293, 0x1535b, 0x15424, 0x154ee }, { 0x155b8, 0x15682, 0x1574d, 0x15818, 0x158e4, 0x159b0, 0x15a7d, 0x15b4a, 0x15c18, 0x15ce6, 0x15db4, 0x15e83, 0x15f53, 0x16023, 0x160f4, 0x161c5, 0x16296, 0x16368, 0x1643a, 0x1650d, 0x165e1, 0x166b5, 0x16789, 0x1685e, 0x16934 }, { 0x16a09, 0x16ae0, 0x16bb7, 0x16c8e, 0x16d66, 0x16e3e, 0x16f17, 0x16ff1, 0x170ca, 0x171a5, 0x17280, 0x1735b, 0x17437, 0x17513, 0x175f0, 0x176ce, 0x177ac, 0x1788a, 0x17969, 0x17a49, 0x17b29, 0x17c09, 0x17cea, 0x17dcc, 0x17eae }, { 0x17f91, 0x18074, 0x18157, 0x1823c, 0x18320, 0x18406, 0x184eb, 0x185d2, 0x186b8, 0x187a0, 0x18888, 0x18970, 0x18a59, 0x18b43, 0x18c2d, 0x18d17, 0x18e02, 0x18eee, 0x18fda, 0x190c7, 0x191b5, 0x192a2, 0x19391, 0x19480, 0x1956f }, { 0x1965f, 0x19750, 0x19841, 0x19933, 0x19a25, 0x19b18, 0x19c0c, 0x19d00, 0x19df4, 0x19ee9, 0x19fdf, 0x1a0d5, 0x1a1cc, 0x1a2c4, 0x1a3bc, 0x1a4b4, 0x1a5ad, 0x1a6a7, 0x1a7a1, 0x1a89c, 0x1a998, 0x1aa94, 0x1ab90, 0x1ac8d, 0x1ad8b }, { 0x1ae89, 0x1af88, 0x1b088, 0x1b188, 0x1b289, 0x1b38a, 0x1b48c, 0x1b58f, 0x1b692, 0x1b795, 0x1b89a, 0x1b99f, 0x1baa4, 0x1bbaa, 0x1bcb1, 0x1bdb8, 0x1bec0, 0x1bfc9, 0x1c0d2, 0x1c1dc, 0x1c2e6, 0x1c3f1, 0x1c4fd, 0x1c609, 0x1c716 }, { 0x1c823, 0x1c931, 0x1ca40, 0x1cb50, 0x1cc60, 0x1cd70, 0x1ce81, 0x1cf93, 0x1d0a6, 0x1d1b9, 0x1d2cd, 0x1d3e1, 0x1d4f6, 0x1d60c, 0x1d722, 0x1d839, 0x1d951, 0x1da69, 0x1db82, 0x1dc9c, 0x1ddb6, 0x1ded1, 0x1dfec, 0x1e109, 0x1e225 }, { 0x1e343, 0x1e461, 0x1e580, 0x1e6a0, 0x1e7c0, 0x1e8e0, 0x1ea02, 0x1eb24, 0x1ec47, 0x1ed6b, 0x1ee8f, 0x1efb4, 0x1f0d9, 0x1f1ff, 0x1f326, 0x1f44e, 0x1f576, 0x1f69f, 0x1f7c9, 0x1f8f3, 0x1fa1e, 0x1fb4a, 0x1fc76, 0x1fda3, 0x1fed1 } }; //static int PITCH_Installed = FALSE; /*--------------------------------------------------------------------- Function: PITCH_Init Initializes pitch table. ---------------------------------------------------------------------*/ /* void PITCH_Init ( void ) { int note; int detune; if ( !PITCH_Installed ) { for( note = 0; note < 12; note++ ) { for( detune = 0; detune < MAXDETUNE; detune++ ) { PitchTable[ note ][ detune ] = 0x10000 * pow( 2, ( note * MAXDETUNE + detune ) / ( 12.0 * MAXDETUNE ) ); } } PITCH_Installed = TRUE; } } */ /********************************************************************** Memory locked functions: **********************************************************************/ #define PITCH_LockStart PITCH_GetScale /*--------------------------------------------------------------------- Function: PITCH_GetScale Returns a fixed-point value to scale number the specified amount. ---------------------------------------------------------------------*/ unsigned long PITCH_GetScale ( int pitchoffset ) { unsigned long scale; int octaveshift; int noteshift; int note; int detune; // if ( !PITCH_Installed ) // { // PITCH_Init(); // } if ( pitchoffset == 0 ) { return( PitchTable[ 0 ][ 0 ] ); } noteshift = pitchoffset % 1200; if ( noteshift < 0 ) { noteshift += 1200; } note = noteshift / 100; detune = ( noteshift % 100 ) / ( 100 / MAXDETUNE ); octaveshift = ( pitchoffset - noteshift ) / 1200; if ( detune < 0 ) { detune += ( 100 / MAXDETUNE ); note--; if ( note < 0 ) { note += 12; octaveshift--; } } scale = PitchTable[ note ][ detune ]; if ( octaveshift < 0 ) { scale >>= -octaveshift; } else { scale <<= octaveshift; } return( scale ); } /*--------------------------------------------------------------------- Function: PITCH_LockEnd Used for determining the length of the functions to lock in memory. ---------------------------------------------------------------------*/ static void PITCH_LockEnd ( void ) { } /*--------------------------------------------------------------------- Function: PITCH_UnlockMemory Unlocks all neccessary data. ---------------------------------------------------------------------*/ void PITCH_UnlockMemory ( void ) { DPMI_UnlockMemoryRegion( PITCH_LockStart, PITCH_LockEnd ); DPMI_Unlock( PitchTable ); // DPMI_Unlock( PITCH_Installed ); } /*--------------------------------------------------------------------- Function: PITCH_LockMemory Unlocks all neccessary data. ---------------------------------------------------------------------*/ int PITCH_LockMemory ( void ) { int status; status = DPMI_LockMemoryRegion( PITCH_LockStart, PITCH_LockEnd ); status |= DPMI_Lock( PitchTable ); // status |= DPMI_Lock( PITCH_Installed ); if ( status != DPMI_Ok ) { PITCH_UnlockMemory(); return( PITCH_Error ); } return( PITCH_Ok ); } rott-20230810/rott/audiolib/pitch.h000066400000000000000000000024731446517470200170230ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: PITCH.H author: James R. Dose date: June 14, 1994 Public header for PITCH.C (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #ifndef __PITCH_H #define __PITCH_H enum PITCH_ERRORS { PITCH_Warning = -2, PITCH_Error = -1, PITCH_Ok = 0, }; //void PITCH_Init( void ); unsigned long PITCH_GetScale( int pitchoffset ); void PITCH_UnlockMemory( void ); int PITCH_LockMemory( void ); #endif rott-20230810/rott/audiolib/platform.h000066400000000000000000000011751446517470200175360ustar00rootroot00000000000000#ifndef _INCLUDE_PLATFORM_H_ #define _INCLUDE_PLATFORM_H_ #include static __inline unsigned short _swap16(unsigned short D) { return((D<<8)|(D>>8)); } static __inline unsigned int _swap32(unsigned int D) { return((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000FF00)|(D>>24)); } #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) #define PLATFORM_BIGENDIAN 1 #define BUILDSWAP_INTEL16(x) _swap16(x) #define BUILDSWAP_INTEL32(x) _swap32(x) #else #define PLATFORM_LITTLEENDIAN 1 #define BUILDSWAP_INTEL16(x) (x) #define BUILDSWAP_INTEL32(x) (x) #endif #endif /* !defined _INCLUDE_PLATFORM_H_ */ /* end of platform.h ... */ rott-20230810/rott/audiolib/sndcards.h000066400000000000000000000026141446517470200175120ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: SNDCARDS.H author: James R. Dose date: March 31, 1994 Contains enumerated type definitions for sound cards. (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #ifndef __SNDCARDS_H #define __SNDCARDS_H #define ASS_VERSION_STRING "1.12" typedef enum { // ASS_NoSound, SoundBlaster, ProAudioSpectrum, SoundMan16, Adlib, GenMidi, SoundCanvas, Awe32, WaveBlaster, SoundScape, UltraSound, SoundSource, TandySoundSource, PC, NumSoundCards } soundcardnames; #endif rott-20230810/rott/audiolib/standard.h000066400000000000000000000033311446517470200175060ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: STANDARD.H author: James R. Dose date: May 25, 1994 Header containing standard definitions. (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #ifndef __STANDARD_H #define __STANDARD_H typedef int boolean; typedef int errorcode; #ifndef TRUE #define TRUE ( 1 == 1 ) #define FALSE ( !TRUE ) #endif enum STANDARD_ERRORS { Warning = -2, FatalError = -1, Success = 0 }; #define BITSET( data, bit ) \ ( ( ( data ) & ( bit ) ) == ( bit ) ) #define ARRAY_LENGTH( array ) \ ( sizeof( array ) / sizeof( ( array )[ 0 ] ) ) #define WITHIN_BOUNDS( array, index ) \ ( ( 0 <= ( index ) ) && ( ( index ) < ARRAY_LENGTH( array ) ) ) #define FOREVER for( ; ; ) #ifdef NDEBUG #define DEBUGGING 0 #else #define DEBUGGING 1 #endif #define DEBUG_CODE \ if ( DEBUGGING == 0 ) \ { \ } \ else #endif rott-20230810/rott/audiolib/user.c000066400000000000000000000034631446517470200166650ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: USER.C author: James R. Dose date: April 26, 1994 Routines to parse command line options. (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #include #include "user.h" #define TRUE ( 1 == 1 ) #define FALSE ( !TRUE ) /*--------------------------------------------------------------------- Function: USER_CheckParameter Checks if the specified string is present in the command line. ---------------------------------------------------------------------*/ int USER_CheckParameter ( const char *parameter ) { return FALSE; } /*--------------------------------------------------------------------- Function: USER_GetText Checks if the specified string is present in the command line and returns a pointer to the text following it. ---------------------------------------------------------------------*/ char *USER_GetText ( const char *parameter ) { return NULL; } rott-20230810/rott/audiolib/user.h000066400000000000000000000022731446517470200166700ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: USER.H author: James R. Dose phone: (214)-271-1365 Ext #221 date: April 26, 1994 Public header for USER.C (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #ifndef __USER_H #define __USER_H int USER_CheckParameter( const char *parameter ); char *USER_GetText( const char *parameter ); #endif rott-20230810/rott/audiolib/usrhooks.c000066400000000000000000000041601446517470200175570ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: USRHOOKS.C author: James R. Dose date: July 26, 1994 This module contains cover functions for operations the library needs that may be restricted by the calling program. This code is left public for you to modify. **********************************************************************/ #include #include "usrhooks.h" /*--------------------------------------------------------------------- Function: USRHOOKS_GetMem Allocates the requested amount of memory and returns a pointer to its location, or NULL if an error occurs. NOTE: pointer is assumed to be dword aligned. ---------------------------------------------------------------------*/ int USRHOOKS_GetMem ( void **ptr, unsigned long size ) { void *memory; memory = malloc( size ); if ( memory == NULL ) { return( USRHOOKS_Error ); } *ptr = memory; return( USRHOOKS_Ok ); } /*--------------------------------------------------------------------- Function: USRHOOKS_FreeMem Deallocates the memory associated with the specified pointer. ---------------------------------------------------------------------*/ int USRHOOKS_FreeMem ( void *ptr ) { if ( ptr == NULL ) { return( USRHOOKS_Error ); } free( ptr ); return( USRHOOKS_Ok ); } rott-20230810/rott/audiolib/usrhooks.h000066400000000000000000000033451446517470200175700ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: USRHOOKS.H author: James R. Dose date: July 26, 1994 Public header file for USRHOOKS.C. This module contains cover functions for operations the library needs that may be restricted by the calling program. The function prototypes in this header should not be modified. **********************************************************************/ #ifndef __USRHOOKS_H #define __USRHOOKS_H /*--------------------------------------------------------------------- Error definitions ---------------------------------------------------------------------*/ enum USRHOOKS_Errors { USRHOOKS_Warning = -2, USRHOOKS_Error = -1, USRHOOKS_Ok = 0 }; /*--------------------------------------------------------------------- Function Prototypes ---------------------------------------------------------------------*/ int USRHOOKS_GetMem( void **ptr, unsigned long size ); int USRHOOKS_FreeMem( void *ptr ); #endif rott-20230810/rott/audiolib/util.h000066400000000000000000000002711446517470200166630ustar00rootroot00000000000000#ifndef AUDIOLIB__UTIL_H #define AUDIOLIB__UTIL_H #ifndef min #define min(a, b) ((a) < (b) ? (a) : (b)) #endif #ifndef max #define max(a, b) ((a) > (b) ? (a) : (b)) #endif #endif rott-20230810/rott/byteordr.c000066400000000000000000000042771446517470200157550ustar00rootroot00000000000000/* Copyright (C) 2002 John R. Hall 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. */ //*************************************************************************** // // byteordr.c - Byte order conversion routines. // //*************************************************************************** #include "rt_def.h" #include "rt_util.h" #include "byteordr.h" #include "lumpy.h" #define DEFINE_CONVERTER(type) \ void Cvt_##type(void *lmp, int num) \ { \ int i; \ type *recs = (type *)lmp; \ for (i = 0; i < num; i++, recs++) { \ CONVERT_ENDIAN_##type(recs); \ } \ } DEFINE_CONVERTER(pic_t); DEFINE_CONVERTER(lpic_t); DEFINE_CONVERTER(font_t); DEFINE_CONVERTER(lbm_t); DEFINE_CONVERTER(patch_t); DEFINE_CONVERTER(transpatch_t); DEFINE_CONVERTER(cfont_t); void CvtNull(void *lmp, int num) { Debug("No-op endian converter on %p.\n", lmp); } // Returns converter for the designated type converter_t CvtForType(int type) { switch(type) { case cache_pic_t: return Cvt_pic_t; break; case cache_lpic_t: return Cvt_lpic_t; break; case cache_font_t: return Cvt_font_t; break; case cache_lbm_t: return Cvt_lbm_t; break; case cache_patch_t: return Cvt_patch_t; break; case cache_transpatch_t: return Cvt_transpatch_t; break; case cache_cfont_t: return Cvt_cfont_t; break; default: return CvtNull; break; } } rott-20230810/rott/byteordr.h000066400000000000000000000025151446517470200157530ustar00rootroot00000000000000/* Copyright (C) 2002 John R. Hall 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. */ //*************************************************************************** // // byteordr.c - Byte order conversion routines. // //*************************************************************************** #ifndef BYTEORDER_H #define BYTEORDER_H typedef void (*converter_t)(void *, int); #define DECLARE_CONVERTER(type) void Cvt_##type(void *lmp, int num); DECLARE_CONVERTER(pic_t); DECLARE_CONVERTER(lpic_t); DECLARE_CONVERTER(font_t); DECLARE_CONVERTER(lbm_t); DECLARE_CONVERTER(patch_t); DECLARE_CONVERTER(transpatch_t); DECLARE_CONVERTER(cfont_t); void CvtNull(void *lmp, int num); converter_t CvtForType(int type); #endif rott-20230810/rott/cin_actr.c000066400000000000000000000135331446517470200157000ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "cin_glob.h" #include "cin_def.h" #include "cin_actr.h" #include "cin_efct.h" #include "modexlib.h" actortype * firstcinematicactor; actortype * lastcinematicactor; // LOCALS boolean cinematicactorsystemstarted=false; static int numcinematicactors; /* =============== = = AddCinematicActor = =============== */ void AddCinematicActor ( actortype * actor ) { if (!firstcinematicactor) { firstcinematicactor = actor; } else { actor->prev = lastcinematicactor; lastcinematicactor->next = actor; } lastcinematicactor = actor; } /* =============== = = DeleteCinematicActor = =============== */ void DeleteCinematicActor ( actortype * actor) { if (actor == lastcinematicactor) { lastcinematicactor = actor->prev; } else { actor->next->prev = actor->prev; } if (actor == firstcinematicactor) { firstcinematicactor = actor->next; } else { actor->prev->next = actor->next; } actor->prev = NULL; actor->next = NULL; if (actor->effect != NULL) SafeFree(actor->effect); SafeFree(actor); } /* =============== = = GetNewCinematicActor = =============== */ actortype * GetNewCinematicActor ( void ) { actortype * actor; numcinematicactors++; if ( numcinematicactors > MAXCINEMATICACTORS ) Error ("Too many Cinematic actors\n"); actor = SafeMalloc( sizeof (actortype) ); actor->next=NULL; actor->prev=NULL; AddCinematicActor ( actor ); return actor; } /* =============== = = StartupCinematicActors = =============== */ void StartupCinematicActors ( void ) { if (cinematicactorsystemstarted==true) return; cinematicactorsystemstarted=true; firstcinematicactor = NULL; lastcinematicactor = NULL; numcinematicactors=0; } /* =============== = = ShutdownCinematicActors = =============== */ void ShutdownCinematicActors ( void ) { actortype * actor; if (cinematicactorsystemstarted==false) return; cinematicactorsystemstarted=false; actor=firstcinematicactor; while (actor != NULL) { actortype * nextactor; nextactor=actor->next; DeleteCinematicActor(actor); actor=nextactor; } } /* =============== = = SpawnCinematicActor = =============== */ void SpawnCinematicActor ( enum_eventtype type, void * effect ) { actortype * actor; actor = GetNewCinematicActor (); actor->effecttype=type; actor->effect=effect; } /* =============== = = UpdateCinematicActors = =============== */ void UpdateCinematicActors ( void ) { actortype * actor; for (actor=firstcinematicactor;actor != NULL;) { if (UpdateCinematicEffect ( actor->effecttype, actor->effect ) == false) { actortype * nextactor; nextactor=actor->next; DeleteCinematicActor(actor); actor=nextactor; } else actor=actor->next; } } /* =============== = = DrawCinematicActors = =============== */ typedef enum { screenfunctions, background, backgroundsprites, backdrop, foregroundsprites, palettefunctions, numdrawphases } enum_drawphases; void DrawCinematicActors ( void ) { actortype * actor; actortype * nextactor; boolean draw; enum_drawphases sequence; #if DUMP int numactors=0; #endif boolean flippage=true; for (sequence=screenfunctions;sequenceeffecttype) { case fadeout: case blankscreen: case clearbuffer: case cinematicend: case flic: if (sequence==screenfunctions) draw=true; flippage=false; break; case palette: if (sequence==palettefunctions) draw=true; flippage=false; break; case background_noscrolling: case background_scrolling: case background_multi: if (sequence==background) draw=true; break; case sprite_background: if (sequence==backgroundsprites) draw=true; break; case backdrop_noscrolling: case backdrop_scrolling: if (sequence==backdrop) draw=true; break; case sprite_foreground: if (sequence==foregroundsprites) draw=true; break; } nextactor=actor->next; if (draw==true) { #if DUMP printf("drawing type=%ld\n",actor->effecttype); #endif if (DrawCinematicEffect ( actor->effecttype, actor->effect ) == false) { DeleteCinematicActor(actor); } #if DUMP numactors++; #endif } actor=nextactor; } } if (flippage==true) XFlipPage (); #if DUMP printf("Total actors drawn=%ld\n",numactors); #endif } rott-20230810/rott/cin_actr.h000066400000000000000000000023641446517470200157050ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _cin_actr_public #define _cin_actr_public #include "cin_glob.h" #include "cin_def.h" extern actortype * firstcinematicactor; extern actortype * lastcinematicactor; void AddCinematicActor ( actortype * actor ); void DeleteCinematicActor ( actortype * actor); actortype * GetNewCinematicActor ( void ); void StartupCinematicActors ( void ); void ShutdownCinematicActors ( void ); void SpawnCinematicActor ( enum_eventtype type, void * effect ); void DrawCinematicActors ( void ); void UpdateCinematicActors ( void ); #endif rott-20230810/rott/cin_def.h000066400000000000000000000041041446517470200155040ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _cin_def_public #define _cin_def_public #define MAXCINEMATICEVENTS 100 #define MAXCINEMATICACTORS 30 #define FRACTIONBITS (16) #define FRACTIONUNIT (1< #include "modexlib.h" #include "fli_glob.h" static int cin_sprtopoffset; static int cin_invscale; void DrawFadeout ( void ); void DrawBlankScreen ( void ); void DrawClearBuffer ( void ); /* =============== = = SpawnCinematicFlic = =============== */ flicevent * SpawnCinematicFlic ( char * name, boolean loop, boolean usefile ) { flicevent * flic; flic = SafeMalloc ( sizeof(flicevent) ); // copy name of flic strcpy ( flic->name, name ); flic->loop=loop; flic->usefile=usefile; return flic; } /* =============== = = SpawnCinematicSprite = =============== */ spriteevent * SpawnCinematicSprite ( char * name, int duration, int numframes, int framedelay, int x, int y, int scale, int endx, int endy, int endscale ) { spriteevent * sprite; sprite = SafeMalloc ( sizeof (spriteevent) ); // copy name of sprite strcpy ( sprite->name, name ); // copy rest of sprite information sprite->duration = duration; sprite->numframes = numframes; sprite->framedelay = framedelay; sprite->frame=0; sprite->frametime=framedelay; W_CacheLumpNum( W_GetNumForName(sprite->name), PU_CACHE, Cvt_patch_t, 1); sprite->x=x << FRACTIONBITS; sprite->y=y << FRACTIONBITS; // sprite->y+=(p->width-p->height)<<(FRACTIONBITS-1); sprite->scale=scale << FRACTIONBITS; sprite->dx= ( (endx-x) << FRACTIONBITS ) / duration; sprite->dy= ( (endy-y) << FRACTIONBITS ) / duration; sprite->dscale= ( (endscale-scale) << FRACTIONBITS ) / duration; return sprite; } /* =============== = = SpawnCinematicBack = =============== */ backevent * SpawnCinematicBack ( char * name, int duration, int width, int startx, int endx, int yoffset ) { backevent * back; back = SafeMalloc ( sizeof (backevent) ); // copy name of back strcpy ( back->name, name ); // copy rest of back information back->duration = duration; back->backdropwidth = width; back->dx = ((endx-startx) << FRACTIONBITS)/duration; back->currentoffset = startx << FRACTIONBITS; back->yoffset=yoffset; return back; } /* =============== = = SpawnCinematicMultiBack = =============== */ backevent * SpawnCinematicMultiBack ( char * name, char * name2, int duration, int startx, int endx, int yoffset ) { backevent * back; lpic_t * pic1; lpic_t * pic2; pic1=(lpic_t *)W_CacheLumpName(name,PU_CACHE, Cvt_lpic_t, 1); pic2=(lpic_t *)W_CacheLumpName(name2,PU_CACHE, Cvt_lpic_t, 1); back = SafeMalloc ( sizeof (backevent) ); // copy name of back strcpy ( back->name, name ); // copy rest of back information back->duration = duration; back->dx = ((endx-startx) << FRACTIONBITS)/duration; back->currentoffset = startx << FRACTIONBITS; back->yoffset=yoffset; if (pic1->height != pic2->height) { Error("SpawnCinematicMultiBack: heights are not the same\n" " name1=%s name2=%s\n",name,name2); } back->backdropwidth=pic1->width+pic2->width; back->height=pic1->height; back->data=SafeMalloc (back->backdropwidth*back->height); memcpy( back->data, &(pic1->data), pic1->width*pic1->height); memcpy( back->data+(pic1->width*pic1->height), &(pic2->data), pic2->width*pic2->height ); return back; } /* =============== = = SpawnCinematicPalette = =============== */ paletteevent * SpawnCinematicPalette ( char * name ) { paletteevent * palette; palette = SafeMalloc ( sizeof (paletteevent) ); // copy name of palette strcpy ( palette->name, name ); return palette; } /* ================= = = ScaleFilmPost = ================= */ void ScaleFilmPost (byte * src, byte * buf) { int offset; int length; int topscreen; int bottomscreen; offset=*(src++); for (;offset!=255;) { length=*(src++); topscreen = cin_sprtopoffset + (cin_invscale*offset); bottomscreen = topscreen + (cin_invscale*length); cin_yl = (topscreen+FRACTIONUNIT-1)>>FRACTIONBITS; cin_yh = (bottomscreen-FRACTIONUNIT)>>FRACTIONBITS; if (cin_yh >= iGLOBAL_SCREENHEIGHT) cin_yh = iGLOBAL_SCREENHEIGHT-1; if (cin_yl < 0) cin_yl = 0; if (cin_yl <= cin_yh) { cin_source=src-offset; R_DrawFilmColumn (buf); } src+=length; offset=*(src++); } } /* ================= = = DrawFlic = ================= */ void DrawFlic ( flicevent * flic ) { byte * curpal; char flicname[40]; curpal = SafeMalloc (768); CinematicGetPalette (curpal); DrawFadeout ( ); if (flic->usefile==false) { W_CacheLumpName(flic->name,PU_CACHE, CvtNull, 1); strcpy(flicname,flic->name); } else { strcpy(flicname,flic->name); strcat(flicname,".fli"); } // med // PlayFlic ( flicname, buf, flic->usefile, flic->loop); if (flic->loop==true) ClearCinematicAbort(); DrawFadeout ( ); DrawBlankScreen ( ); CinematicSetPalette (curpal); SafeFree (curpal); GetCinematicTics (); GetCinematicTics (); } /* ================= = = PrecacheFlic = ================= */ void PrecacheFlic (flicevent * flic) { if (flic->usefile==false) { W_CacheLumpName(flic->name,PU_CACHE, CvtNull, 1); } } /* =============== = = DrawCinematicBackground = =============== */ void DrawCinematicBackground ( backevent * back ) { byte * src; byte * buf; lpic_t * pic; int i; int offset; int height; pic=(lpic_t *)W_CacheLumpName(back->name,PU_CACHE, Cvt_lpic_t, 1); height = pic->height; if (height+back->yoffset>iGLOBAL_SCREENHEIGHT) height=iGLOBAL_SCREENHEIGHT-back->yoffset; if (height!=iGLOBAL_SCREENHEIGHT) DrawClearBuffer (); { buf=(byte *)bufferofs+ylookup[back->yoffset]; offset=(back->currentoffset>>FRACTIONBITS); for (i=0;i=back->backdropwidth) src=&(pic->data) + ( (offset - back->backdropwidth) * (pic->height) ); else if (offset<0) src=&(pic->data) + ( (offset + back->backdropwidth) * (pic->height) ); else src=&(pic->data) + ( offset * (pic->height) ); DrawFilmPost(buf,src,height); } } } /* =============== = = DrawCinematicMultiBackground = =============== */ void DrawCinematicMultiBackground ( backevent * back ) { byte * src; byte * buf; int i; int offset; int height; height = back->height; if (height+back->yoffset>iGLOBAL_SCREENHEIGHT) height=iGLOBAL_SCREENHEIGHT-back->yoffset; if (height!=iGLOBAL_SCREENHEIGHT) DrawClearBuffer (); { buf=(byte *)bufferofs+ylookup[back->yoffset]; offset=(back->currentoffset>>FRACTIONBITS); for (i=0;i=back->backdropwidth) src=back->data + ( (offset - back->backdropwidth) * (back->height) ); else if (offset<0) src=back->data + ( (offset + back->backdropwidth) * (back->height) ); else src=back->data + ( offset * (back->height) ); DrawFilmPost(buf,src,height); } } } /* =============== = = DrawCinematicBackdrop = =============== */ void DrawCinematicBackdrop ( backevent * back ) { byte * src; byte * shape; byte * buf; patch_t * p; int i; int offset; int postoffset; int postlength; int toppost; shape=W_CacheLumpName(back->name,PU_CACHE, Cvt_patch_t, 1); p=(patch_t *)shape; toppost=-p->topoffset+back->yoffset; { buf=(byte *)bufferofs; offset=(back->currentoffset>>FRACTIONBITS); for (i=0;i=back->backdropwidth) src = shape + p->collumnofs[offset - back->backdropwidth]; else if (offset<0) src=shape + p->collumnofs[offset + back->backdropwidth]; else src = shape + p->collumnofs[offset]; postoffset=*(src++); for (;postoffset!=255;) { postlength=*(src++); DrawFilmPost(buf + ylookup[toppost+postoffset],src,postlength); src+=postlength; postoffset=*(src++); } } } } /* ================= = = PrecacheBack = ================= */ void PrecacheBack ( backevent * back ) { W_CacheLumpName( back->name, PU_CACHE, CvtNull, 1); } /* ================= = = DrawCinematicSprite = ================= */ void DrawCinematicSprite ( spriteevent * sprite ) { byte *shape; int frac; patch_t *p; int x1,x2; int tx; int xcent; byte * buf; int height; height = sprite->scale >> FRACTIONBITS; if (height<2) return; shape=W_CacheLumpNum( W_GetNumForName(sprite->name)+sprite->frame, PU_CACHE, Cvt_patch_t, 1); p=(patch_t *)shape; cin_ycenter=sprite->y >> FRACTIONBITS; cin_invscale = (height<origsize; buf=(byte *)bufferofs; tx=-p->leftoffset; xcent=(sprite->x & 0xffff0000)-(height<<(FRACTIONBITS-1))+(FRACTIONUNIT>>1); // // calculate edges of the shape // x1 = (xcent+(tx*cin_invscale))>>FRACTIONBITS; if (x1 >= iGLOBAL_SCREENWIDTH) return; // off the right side tx+=p->width; x2 = ((xcent+(tx*cin_invscale)) >>FRACTIONBITS) - 1 ; if (x2 < 0) return; // off the left side cin_iscale=(p->origsize<= iGLOBAL_SCREENWIDTH ? (iGLOBAL_SCREENWIDTH-1) : x2; cin_texturemid = (((p->origsize>>1)+p->topoffset)<>1); cin_sprtopoffset = (cin_ycenter<<16) - FixedMul(cin_texturemid,cin_invscale); for (; x1<=x2 ; x1++, frac += cin_iscale) { ScaleFilmPost(((p->collumnofs[frac>>FRACTIONBITS])+shape),buf+x1); } } /* ================= = = PrecacheCinematicSprite = ================= */ void PrecacheCinematicSprite ( spriteevent * sprite ) { int i; for (i=0;inumframes;i++) { W_CacheLumpNum( W_GetNumForName(sprite->name)+i, PU_CACHE, Cvt_patch_t, 1); } } /* ================= = = DrawPalette = ================= */ void DrawPalette (paletteevent * event) { byte * pal; pal=W_CacheLumpName(event->name,PU_CACHE, CvtNull, 1); XFlipPage (); CinematicSetPalette (pal); } /* ================= = = PrecachePalette = ================= */ void PrecachePalette (paletteevent * event) { W_CacheLumpName(event->name,PU_CACHE, CvtNull, 1); } /* ================= = = DrawFadeout = ================= */ #define FADEOUTTIME 20 void DrawFadeout ( void ) { byte origpal[768]; byte newpal[768]; int i,j; CinematicGetPalette (&origpal[0]); for (j = 0; j < FADEOUTTIME; j++) { for (i = 0; i < 768; i++) { newpal[i] = ( origpal[i] * (FADEOUTTIME - j - 1) ) / FADEOUTTIME; } WaitVBL(); CinematicSetPalette (&newpal[0]); CinematicDelay(); } VL_ClearVideo (0); GetCinematicTics (); GetCinematicTics (); } /* ================= = = DrawBlankScreen = ================= */ void DrawBlankScreen ( void ) { VL_ClearVideo (0); } /* ================= = = DrawClearBuffer = ================= */ void DrawClearBuffer ( void ) { memset((byte *)bufferofs,0,iGLOBAL_SCREENWIDTH*iGLOBAL_SCREENHEIGHT); } /* =============== = = UpdateCinematicBack = =============== */ boolean UpdateCinematicBack ( backevent * back ) { back->duration--; if (back->duration<0) return false; back->currentoffset += back->dx; return true; } /* ================= = = UpdateCinematicSprite = ================= */ boolean UpdateCinematicSprite ( spriteevent * sprite ) { sprite->duration--; if (sprite->duration<0) return false; sprite->framedelay--; if (sprite->framedelay==0) { sprite->frame++; if (sprite->frame==sprite->numframes) sprite->frame=0; sprite->framedelay=sprite->frametime; } sprite->x+=sprite->dx; sprite->y+=sprite->dy; sprite->scale+=sprite->dscale; return true; } /* ================= = = UpdateCinematicEffect = ================= */ boolean UpdateCinematicEffect ( enum_eventtype type, void * effect ) { switch (type) { case background_noscrolling: case background_scrolling: case backdrop_scrolling: case backdrop_noscrolling: case background_multi: return UpdateCinematicBack ( (backevent *) effect ); break; case sprite_background: case sprite_foreground: return UpdateCinematicSprite ( (spriteevent *) effect ); break; case flic: return true; break; case palette: case fadeout: case blankscreen: case clearbuffer: return true; break; case cinematicend: cinematicdone=true; return true; break; } return true; } /* ================= = = DrawCinematicEffect = ================= */ boolean DrawCinematicEffect ( enum_eventtype type, void * effect ) { switch (type) { case background_noscrolling: case background_scrolling: DrawCinematicBackground ( (backevent *) effect ); return true; break; case background_multi: DrawCinematicMultiBackground ( (backevent *) effect ); return true; break; case backdrop_scrolling: case backdrop_noscrolling: DrawCinematicBackdrop ( (backevent *) effect ); return true; break; case sprite_background: case sprite_foreground: DrawCinematicSprite ( (spriteevent *) effect ); return true; break; case flic: DrawFlic ( (flicevent *) effect ); return false; break; case palette: DrawPalette ( (paletteevent *) effect ); return false; break; case fadeout: DrawFadeout (); return false; break; case blankscreen: DrawBlankScreen (); return false; break; case clearbuffer: DrawClearBuffer (); return false; break; case cinematicend: return true; break; } return true; } /* ================= = = PrecacheCinematicEffect = ================= */ void PrecacheCinematicEffect ( enum_eventtype type, void * effect ) { switch (type) { case background_noscrolling: case background_scrolling: case backdrop_scrolling: case backdrop_noscrolling: PrecacheBack ( (backevent *) effect ); break; case sprite_background: case sprite_foreground: PrecacheCinematicSprite ( (spriteevent *) effect ); break; case palette: PrecachePalette ( (paletteevent *) effect ); break; case flic: PrecacheFlic ( (flicevent *) effect ); break; default: ; } } /* =============== = = ProfileDisplay = =============== */ void ProfileDisplay ( void ) { byte * buf; int i; byte src[200]; int width = StretchScreen? 320:iGLOBAL_SCREENWIDTH; DrawClearBuffer (); { buf=(byte *)bufferofs; for (i=0;iheight; { buf=(byte *)bufferofs; src=&(pic->data); for (i=0;iheight,buf++) { DrawFilmPost(buf,src,height); } } } rott-20230810/rott/cin_efct.h000066400000000000000000000053671446517470200157030ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _cin_efct_public #define _cin_efct_public #include "cin_glob.h" #include "cin_def.h" flicevent * SpawnCinematicFlic ( char * name, boolean loop, boolean usefile ); spriteevent * SpawnCinematicSprite ( char * name, int duration, int numframes, int framedelay, int x, int y, int scale, int endx, int endy, int endscale ); backevent * SpawnCinematicBack ( char * name, int duration, int width, int startx, int endx, int yoffset ); backevent * SpawnCinematicMultiBack ( char * name, char * name2, int duration, int startx, int endx, int yoffset ); paletteevent * SpawnCinematicPalette ( char * name ); void DrawFlic ( flicevent * flic ); void DrawCinematicBackdrop ( backevent * back ); void DrawCinematicBackground ( backevent * back ); void DrawPalette (paletteevent * event); void DrawCinematicSprite ( spriteevent * sprite ); void DrawClearBuffer ( void ); void DrawBlankScreen ( void ); boolean DrawCinematicEffect ( enum_eventtype type, void * effect ); boolean UpdateCinematicBack ( backevent * back ); boolean UpdateCinematicSprite ( spriteevent * sprite ); boolean UpdateCinematicEffect ( enum_eventtype type, void * effect ); void PrecacheCinematicEffect ( enum_eventtype type, void * effect ); void ProfileDisplay ( void ); void DrawPostPic ( int lumpnum ); #endif rott-20230810/rott/cin_evnt.c000066400000000000000000000225541446517470200157260ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "cin_glob.h" #include "cin_evnt.h" #include "cin_efct.h" #include "cin_actr.h" #include "cin_def.h" #include "scriplib.h" #include "lumpy.h" #include "w_wad.h" #include "z_zone.h" #include eventtype * firstevent; eventtype * lastevent; // LOCALS static int numevents=0; static boolean eventsystemstarted=false; /* =============== = = AddEvent = =============== */ void AddEvent (eventtype * event) { if (!firstevent) firstevent = event; else { event->prev = lastevent; lastevent->next = event; } lastevent = event; } /* =============== = = DeleteEvent = =============== */ void DeleteEvent(eventtype * event) { if (event == lastevent) lastevent = event->prev; else event->next->prev = event->prev; if (event == firstevent) firstevent = event->next; else event->prev->next = event->next; event->prev = NULL; event->next = NULL; SafeFree ( event ); } /* =============== = = GetNewEvent = =============== */ eventtype * GetNewEvent ( void ) { eventtype * event; numevents++; if ( numevents > MAXCINEMATICEVENTS ) Error ("Too many Cinematic events\n"); event = SafeMalloc( sizeof (eventtype) ); event->next=NULL; event->prev=NULL; return event; } /* =============== = = StartupEvents = =============== */ void StartupEvents ( void ) { if (eventsystemstarted==true) return; eventsystemstarted=true; firstevent = NULL; lastevent = NULL; numevents=0; } /* =============== = = ShutdownEvents = =============== */ void ShutdownEvents ( void ) { eventtype * event; if (eventsystemstarted==false) return; eventsystemstarted=false; event=firstevent; while (event != NULL) { eventtype * nextevent; nextevent=event->next; DeleteEvent(event); event=nextevent; } } /* =============== = = CreateEvent = =============== */ eventtype * CreateEvent ( int time, int type ) { eventtype * event; event = GetNewEvent (); event->time = time; event->effecttype = type; event->effect = NULL; AddEvent (event); return event; } /* =============== = = GetEventType = = Gets event type from token = =============== */ enum_eventtype GetEventType ( void ) { // Get Event Token GetToken (false); if (!strcmpi (token,"BACKGROUND")) { GetToken (false); if (!strcmpi (token,"SCROLL")) { return background_scrolling; } else if (!strcmpi (token,"NOSCROLL")) { return background_noscrolling; } else if (!strcmpi (token,"MULTISCROLL")) { return background_multi; } else { Error("Illegal Background Scrolling token\n"); } } else if (!strcmpi (token,"BACKDROP")) { GetToken (false); if (!strcmpi (token,"SCROLL")) { return backdrop_scrolling; } else if (!strcmpi (token,"NOSCROLL")) { return backdrop_noscrolling; } else { Error("Illegal Backdrop Scrolling token\n"); } } else if (!strcmpi (token,"BACKGROUNDSPRITE")) { return sprite_background; } else if (!strcmpi (token,"FOREGROUNDSPRITE")) { return sprite_foreground; } else if (!strcmpi (token,"PALETTE")) { return palette; } else if (!strcmpi (token,"FADEOUT")) { return fadeout; } else if (!strcmpi (token,"FLIC")) { return flic; } else if (!strcmpi (token,"MOVIEEND")) { return cinematicend; } else if (!strcmpi (token,"BLANKSCREEN")) { return blankscreen; } else if (!strcmpi (token,"CLEARBUFFER")) { return clearbuffer; } else { Error("GetEventType: Illegal Token %s\n",token); } return -1; } /* =============== = = ParseBack = =============== */ void ParseBack ( eventtype * event ) { char name[10] = {0}; char name2[10] = {0}; int width = 0; GetToken (false); strcpy(&(name[0]),token); if (event->effecttype==background_multi) { GetToken (false); strcpy(&(name2[0]),token); } GetToken (false); int duration=ParseNum(token); GetToken (false); int yoffset=ParseNum(token); if ( (event->effecttype==background_noscrolling) || (event->effecttype==background_scrolling) ) { lpic_t * lpic; lpic = (lpic_t *)W_CacheLumpName(name,PU_CACHE, Cvt_lpic_t, 1); width = lpic->width; } else if (event->effecttype!=background_multi) { patch_t * patch; patch = (patch_t *)W_CacheLumpName(name,PU_CACHE, Cvt_lpic_t, 1); width = patch->width; } int startx=0; int endx=0; if ( (event->effecttype==backdrop_scrolling) || (event->effecttype==background_scrolling) || (event->effecttype==background_multi) ) { GetToken (false); startx=ParseNum(token); GetToken (false); endx=ParseNum(token); } if (event->effecttype==background_multi) event->effect = SpawnCinematicMultiBack ( name, name2, duration, startx, endx, yoffset); else event->effect = SpawnCinematicBack ( name, duration, width, startx, endx, yoffset); } /* =============== = = ParseSprite = =============== */ void ParseSprite ( eventtype * event ) { char name[10]; int duration; int numframes; int framedelay; int x,y,scale; int endx,endy,endscale; GetToken (false); strcpy(&(name[0]),token); GetToken (false); duration=ParseNum(token); GetToken (false); numframes=ParseNum(token); GetToken (false); framedelay=ParseNum(token); GetToken (false); x=ParseNum(token); GetToken (false); y=ParseNum(token); GetToken (false); scale=ParseNum(token); GetToken (false); endx=ParseNum(token); GetToken (false); endy=ParseNum(token); GetToken (false); endscale=ParseNum(token); event->effect = SpawnCinematicSprite ( name, duration, numframes, framedelay, x, y, scale, endx, endy, endscale ); } /* =============== = = ParseFlic = =============== */ void ParseFlic ( eventtype * event ) { char name[10]; boolean loop; boolean usefile; GetToken (false); strcpy(&(name[0]),token); GetToken (false); if (!strcmpi (token,"LOOP")) { loop = true; } else if (!strcmpi (token,"NOLOOP")) { loop = false; } else Error("ParseFlic: Illegal or missing flic loop token %s\n",token); GetToken (false); if (!strcmpi (token,"FILE")) { usefile=true; } else if (!strcmpi (token,"LUMP")) { usefile=false; } else Error("ParseFlic: Illegal or missing flic use token %s\n",token); event->effect = SpawnCinematicFlic ( name, loop, usefile ); } /* =============== = = ParsePalette = =============== */ void ParsePalette ( eventtype * event ) { char name[10]; GetToken (false); strcpy(&(name[0]),token); event->effect = SpawnCinematicPalette ( name ); } /* =============== = = ParseEvent = =============== */ void ParseEvent ( int time ) { eventtype * event; event = CreateEvent ( time, GetEventType() ); switch (event->effecttype) { case background_noscrolling: case background_scrolling: case background_multi: case backdrop_scrolling: case backdrop_noscrolling: ParseBack(event); break; case sprite_background: case sprite_foreground: ParseSprite(event); break; case palette: ParsePalette(event); break; case flic: ParseFlic(event); break; case fadeout: case blankscreen: case clearbuffer: case cinematicend: break; } } /* =============== = = UpdateCinematicEvents = =============== */ void UpdateCinematicEvents ( int time ) { eventtype * event; for (event=firstevent;event != NULL;) { if (event->time==time) { eventtype * nextevent; nextevent=event->next; SpawnCinematicActor ( event->effecttype, event->effect ); DeleteEvent(event); event=nextevent; } else if (event->time>time) break; else event=event->next; } } /* =============== = = PrecacheCinematic = =============== */ void PrecacheCinematic ( void ) { eventtype * event; for (event=firstevent;event != NULL;) { PrecacheCinematicEffect ( event->effecttype, event->effect ); event=event->next; } } rott-20230810/rott/cin_evnt.h000066400000000000000000000023001446517470200157160ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _cin_evnt_public #define _cin_evnt_public #include "cin_glob.h" #include "cin_def.h" extern eventtype * firstevent; extern eventtype * lastevent; void AddEvent (eventtype * event); void DeleteEvent(eventtype * event); eventtype * GetNewEvent ( void ); void StartupEvents ( void ); void ShutdownEvents ( void ); eventtype * CreateEvent ( int time, int type ); void ParseEvent ( int time ); void UpdateCinematicEvents ( int time ); void PrecacheCinematic ( void ); #endif rott-20230810/rott/cin_glob.c000066400000000000000000000020021446517470200156570ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "cin_glob.h" #include "rt_in.h" #include "rt_draw.h" void CinematicDelay ( void ) { CalcTics(); } int GetCinematicTime ( void ) { return GetTicCount (); } boolean CinematicAbort( void ) { return (IN_CheckAck ()); } void ClearCinematicAbort( void ) { IN_StartAck (); } rott-20230810/rott/cin_glob.h000066400000000000000000000020061446517470200156700ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "rt_util.h" #include "isr.h" #include #ifndef CIN_GLOB_H #define CIN_GLOB_H #define DUMP 0 #define CLOCKSPEED (VBLCOUNTER) void CinematicDelay( void ); int GetCinematicTime( void ); boolean CinematicAbort( void ); void ClearCinematicAbort( void ); #endif rott-20230810/rott/cin_main.c000066400000000000000000000110371446517470200156700ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "cin_glob.h" #include "scriplib.h" #include "watcom.h" #include "z_zone.h" #include "w_wad.h" #include "cin_main.h" #include "modexlib.h" #include "lumpy.h" #include "cin_actr.h" #include "cin_evnt.h" #include "cin_efct.h" boolean cinematicdone; static int cinematictime; static int cinematictics; static int cinematictictime; static int profiletics=-1; /* ================ = = ProfileMachine = ================ */ void ProfileMachine ( void ) { int i; int time; int endtime; if (profiletics>0) return; time=GetCinematicTime(); for (i=0;i<4;i++) { ProfileDisplay(); } endtime=GetCinematicTime(); profiletics = (endtime-time)>>2; if (profiletics<1) profiletics=1; } /* ================ = = StartupCinematic = ================ */ void StartupCinematic ( void ) { StartupEvents (); StartupCinematicActors (); cinematicdone=false; cinematictime=0; GetCinematicTics (); ClearCinematicAbort(); ProfileMachine(); } /* ================ = = ShutdownCinematic = ================ */ void ShutdownCinematic ( void ) { ShutdownEvents (); ShutdownCinematicActors (); } /* ================ = = ParseCinematicScript = ================ */ void ParseCinematicScript (void) { int time; time=0; do { // // get next command time // GetToken (true); if (endofscript) break; time+=ParseNum(token); ParseEvent ( time ); } while (script_p < scriptend_p); } /* ============== = = CacheScriptFile = ============== */ void CacheScriptFile (char *filename) { long size; int lump; lump=W_GetNumForName(filename); scriptbuffer=W_CacheLumpNum(lump,PU_CACHE, CvtNull, 1); size = W_LumpLength(lump); script_p = scriptbuffer; scriptend_p = script_p + size; scriptline = 1; endofscript = false; tokenready = false; } /* ================= = = GrabCinematicScript = ================= */ void GrabCinematicScript (char const *basename, boolean uselumpy) { char script[256]; // // read in the script file // strcpy (script, basename); strcat (script,".ms"); if (uselumpy==false) LoadScriptFile (script); else CacheScriptFile ((char *)basename); ParseCinematicScript (); } /* ============== = = GetCinematicTics = ============== */ void GetCinematicTics ( void ) { int time; time=GetCinematicTime(); while (time==cinematictictime) { time=GetCinematicTime(); } cinematictics=(time-cinematictictime); cinematictictime=time; cinematictics=profiletics; } void PlayMovie ( char * name, boolean uselumpy ) { int i; StartupCinematic ( ); GrabCinematicScript (name, uselumpy); PrecacheCinematic ( ); GetCinematicTics(); while (cinematicdone==false) { cinematicdone=CinematicAbort(); #if DUMP printf("time=%ld\n",cinematictime); #endif for (i=0;i>SFRACBITS)]; dest += iGLOBAL_SCREENWIDTH; frac += fracstep; } } void DrawFilmPost (byte * buf, byte * src, int height) { while (height--) { *buf = *src; src++; buf += linewidth; } } rott-20230810/rott/cin_main.h000066400000000000000000000022141446517470200156720ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _cin_main_public #define _cin_main_public //*************************************************************************** // // CIN_MAIN.H // //*************************************************************************** #include "cin_glob.h" void GrabMovieScript (char const *basename, boolean uselumpy); void PlayMovie (char * name, boolean uselumpy); void GetCinematicTics ( void ); extern boolean cinematicdone; #endif rott-20230810/rott/cin_util.c000066400000000000000000000020411446517470200157140ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "cin_glob.h" #include "modexlib.h" /* ============== = = CinematicGetPalette = = Return an 8 bit / color palette = ============== */ void CinematicGetPalette (byte *pal) { } /* ============== = = CinematicSetPalette = = Sets an 8 bit / color palette = ============== */ void CinematicSetPalette (byte *pal) { } rott-20230810/rott/cin_util.h000066400000000000000000000015451446517470200157310ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _cin_util_public #define _cin_util_public void CinematicGetPalette (byte *pal); void CinematicSetPalette (byte *pal); #endif rott-20230810/rott/develop.h000066400000000000000000000030341446517470200155540ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _develop_public #define _develop_public #define WEAPONCHEAT 1 #define BATTLECHECK 0 // This should be turned off for release, on for beta #define BATTLEINFO 0 // This should be turned off for release #define DELUXE 0 #define LOWCOST 0 #define BNACRASHPREVENT 1 //bna added // Flavor selection (shareware, registered, cd version, site license) has moved to the Makefile #ifndef SHAREWARE #define SHAREWARE 0 #endif // cute little dopefish thing, only works with special patch? #define DOPEFISH 0 // okay? #define TEDLAUNCH 0 #define SOFTERROR 0 #define WHEREAMI 0 #if (WHEREAMI==1) #define wami(val) \ { \ programlocation=val;\ } #define waminot() /* { \ programlocation=-1;\ } */ #else #define wami(val) #define waminot() #endif #endif rott-20230810/rott/dosutil.c000066400000000000000000000056751446517470200156110ustar00rootroot00000000000000#include #include #include #include #include #ifndef _WIN32 #include #include #include #endif #include #include "rt_def.h" #include "SDL.h" /* Copied over from Wolf3D Linux: http://www.icculus.org/wolf3d/ Modified for ROTT. */ int _argc; char **_argv; long filelength(int handle) { struct stat buf; if (fstat(handle, &buf) == -1) { perror("filelength"); exit(EXIT_FAILURE); } return buf.st_size; } char *strlwr(char *s) { char *p = s; while (*p) { *p = tolower(*p); p++; } return s; } char *strupr(char *s) { char *p = s; while (*p) { *p = toupper(*p); p++; } return s; } char *itoa(int value, char *string, int radix) { switch (radix) { case 10: sprintf(string, "%d", value); break; case 16: sprintf(string, "%x", value); break; default: STUB_FUNCTION; break; } return string; } char *ltoa(long value, char *string, int radix) { switch (radix) { case 10: sprintf(string, "%ld", value); break; case 16: sprintf(string, "%lx", value); break; default: STUB_FUNCTION; break; } return string; } char *ultoa(unsigned long value, char *string, int radix) { switch (radix) { case 10: sprintf(string, "%lu", value); break; case 16: sprintf(string, "%lux", value); break; default: STUB_FUNCTION; break; } return string; } char getch(void) { getchar(); return 0; } /* from Dan Olson */ void put_dos2ansi(byte attrib) { int lookup[] = {30,34,32,36,31,35,33,37}; byte fore,back,blink=0,intens=0; fore = attrib&15; /* bits 0-3 */ back = attrib&112; /* bits 4-6 */ blink = attrib&128; /* bit 7 */ /* Fix background, blink is either on or off. */ back = back>>4; /* Fix foreground */ if (fore > 7) { intens = 1; fore-=8; } /* Convert fore/back */ fore = lookup[fore]; back = lookup[back]+10; // 'Render" if (blink) printf ("\033[%d;5;%dm\033[%dm", intens, fore, back); else printf ("\033[%d;25;%dm\033[%dm", intens, fore, back); } void DisplayTextSplash(byte *text, int l) { int i; int bound = 80*l*2; for (i=0;i void print_stack (int level) { void *array[64]; char **syms; int size, i; printf ("Stack dump:\n"); printf ("{\n"); size = backtrace (array, (sizeof (array))/(sizeof (array[0]))); syms = backtrace_symbols (array, size); for (i=level+1; i #include #include #include #include #define cdecl #include "SDL.h" #include "SDL_mixer.h" #include "rt_def.h" // ROTT music hack #include "rt_cfg.h" // ROTT music hack #include "rt_util.h" // ROTT music hack #include "music.h" #define __FX_TRUE (1 == 1) #define __FX_FALSE (!__FX_TRUE) #define DUKESND_DEBUG "DUKESND_DEBUG" #ifndef min #define min(a, b) (((a) < (b)) ? (a) : (b)) #endif #ifndef max #define max(a, b) (((a) > (b)) ? (a) : (b)) #endif int MUSIC_ErrorCode = MUSIC_Ok; static char warningMessage[80]; static char errorMessage[80]; static FILE *debug_file = NULL; static int initialized_debugging = 0; // This gets called all over the place for information and debugging messages. // If the user set the DUKESND_DEBUG environment variable, the messages // go to the file that is specified in that variable. Otherwise, they // are ignored for the expense of the function call. If DUKESND_DEBUG is // set to "-" (without the quotes), then the output goes to stdout. static void musdebug(const char *fmt, ...) { va_list ap; if (debug_file) { fprintf(debug_file, "DUKEMUS: "); va_start(ap, fmt); vfprintf(debug_file, fmt, ap); va_end(ap); fprintf(debug_file, "\n"); fflush(debug_file); } // if } // musdebug static void init_debugging(void) { const char *envr; if (initialized_debugging) return; envr = getenv(DUKESND_DEBUG); if (envr != NULL) { if (strcmp(envr, "-") == 0) debug_file = stdout; else debug_file = fopen(envr, "w"); if (debug_file == NULL) fprintf(stderr, "DUKESND: -WARNING- Could not open debug file!\n"); else setbuf(debug_file, NULL); } // if initialized_debugging = 1; } // init_debugging static void setErrorMessage(const char *msg) { strncpy(errorMessage, msg, sizeof (errorMessage)); // strncpy() doesn't add the null char if there isn't room... errorMessage[sizeof (errorMessage) - 1] = '\0'; musdebug("Error message set to [%s].", errorMessage); } // setErrorMessage // The music functions... char *MUSIC_ErrorString(int ErrorNumber) { switch (ErrorNumber) { case MUSIC_Warning: return(warningMessage); case MUSIC_Error: return(errorMessage); case MUSIC_Ok: return("OK; no error."); case MUSIC_ASSVersion: return("Incorrect sound library version."); case MUSIC_SoundCardError: return("General sound card error."); case MUSIC_InvalidCard: return("Invalid sound card."); case MUSIC_MidiError: return("MIDI error."); case MUSIC_MPU401Error: return("MPU401 error."); case MUSIC_TaskManError: return("Task Manager error."); case MUSIC_FMNotDetected: return("FM not detected error."); case MUSIC_DPMI_Error: return("DPMI error."); default: return("Unknown error."); } // switch assert(0); // shouldn't hit this point. return(NULL); } // MUSIC_ErrorString static int music_initialized = 0; static int music_context = 0; static int music_loopflag = MUSIC_PlayOnce; static unsigned char *music_songdata = NULL; static Mix_Music *music_musicchunk = NULL; int MUSIC_Init(int SoundCard, int Address) { init_debugging(); musdebug("INIT! card=>%d, address=>%d...", SoundCard, Address); if (music_initialized) { setErrorMessage("Music system is already initialized."); return(MUSIC_Error); } // if if (SoundCard != SoundScape) // We pretend there's a SoundScape installed. { setErrorMessage("Card not found."); musdebug("We pretend to be an Ensoniq SoundScape only."); return(MUSIC_Error); } // if music_initialized = 1; return(MUSIC_Ok); } // MUSIC_Init int MUSIC_Shutdown(void) { musdebug("shutting down sound subsystem."); if (!music_initialized) { setErrorMessage("Music system is not currently initialized."); return(MUSIC_Error); } // if MUSIC_StopSong(); music_context = 0; music_initialized = 0; music_loopflag = MUSIC_PlayOnce; return(MUSIC_Ok); } // MUSIC_Shutdown void MUSIC_SetMaxFMMidiChannel(int channel) { musdebug("STUB ... MUSIC_SetMaxFMMidiChannel(%d).\n", channel); } // MUSIC_SetMaxFMMidiChannel void MUSIC_SetVolume(int volume) { Mix_VolumeMusic(volume >> 1); // convert 0-255 to 0-128. } // MUSIC_SetVolume void MUSIC_SetMidiChannelVolume(int channel, int volume) { musdebug("STUB ... MUSIC_SetMidiChannelVolume(%d, %d).\n", channel, volume); } // MUSIC_SetMidiChannelVolume void MUSIC_ResetMidiChannelVolumes(void) { musdebug("STUB ... MUSIC_ResetMidiChannelVolumes().\n"); } // MUSIC_ResetMidiChannelVolumes int MUSIC_GetVolume(void) { return(Mix_VolumeMusic(-1) << 1); // convert 0-128 to 0-255. } // MUSIC_GetVolume void MUSIC_SetLoopFlag(int loopflag) { music_loopflag = loopflag; } // MUSIC_SetLoopFlag int MUSIC_SongPlaying(void) { return((Mix_PlayingMusic()) ? __FX_TRUE : __FX_FALSE); } // MUSIC_SongPlaying void MUSIC_Continue(void) { if (Mix_PausedMusic()) Mix_ResumeMusic(); else if (music_songdata) MUSIC_PlaySong(music_songdata, MUSIC_PlayOnce); } // MUSIC_Continue void MUSIC_Pause(void) { Mix_PauseMusic(); } // MUSIC_Pause int MUSIC_StopSong(void) { if (!Mix_QuerySpec(NULL, NULL, NULL)) { setErrorMessage("Need FX system initialized, too. Sorry."); return(MUSIC_Error); } // if if ( (Mix_PlayingMusic()) || (Mix_PausedMusic()) ) Mix_HaltMusic(); if (music_musicchunk) Mix_FreeMusic(music_musicchunk); music_songdata = NULL; music_musicchunk = NULL; return(MUSIC_Ok); } // MUSIC_StopSong int MUSIC_PlaySong(unsigned char *song, int loopflag) { //SDL_RWops *rw; MUSIC_StopSong(); music_songdata = song; // !!! FIXME: This could be a problem...SDL/SDL_mixer wants a RWops, which // !!! FIXME: is an i/o abstraction. Since we already have the MIDI data // !!! FIXME: in memory, we fake it with a memory-based RWops. None of // !!! FIXME: this is a problem, except the RWops wants to know how big // !!! FIXME: its memory block is (so it can do things like seek on an // !!! FIXME: offset from the end of the block), and since we don't have // !!! FIXME: this information, we have to give it SOMETHING. /* !!! ARGH! There's no LoadMUS_RW ?! rw = SDL_RWFromMem((void *) song, (10 * 1024) * 1024); // yikes. music_musicchunk = Mix_LoadMUS_RW(rw); Mix_PlayMusic(music_musicchunk, (loopflag == MUSIC_PlayOnce) ? 0 : -1); */ musdebug("Need to use PlaySongROTT. :("); return(MUSIC_Ok); } // MUSIC_PlaySong // ROTT Special - SBF int MUSIC_PlaySongROTT(unsigned char *song, int size, int loopflag) { char *filename; int handle; MUSIC_StopSong(); // save the file somewhere, so SDL_mixer can load it filename = M_StringJoin(ApogeePath, PATH_SEP_STR, "tmpsong.mid", NULL); handle = SafeOpenWrite(filename); SafeWrite(handle, song, size); close(handle); music_songdata = song; // finally, we can load it with SDL_mixer music_musicchunk = Mix_LoadMUS(filename); free(filename); if (music_musicchunk == NULL) { return MUSIC_Error; } Mix_PlayMusic(music_musicchunk, (loopflag == MUSIC_PlayOnce) ? 0 : -1); return(MUSIC_Ok); } // MUSIC_PlaySongROTT void MUSIC_SetContext(int context) { musdebug("STUB ... MUSIC_SetContext().\n"); music_context = context; } // MUSIC_SetContext int MUSIC_GetContext(void) { return(music_context); } // MUSIC_GetContext void MUSIC_SetSongTick(unsigned long PositionInTicks) { musdebug("STUB ... MUSIC_SetSongTick().\n"); } // MUSIC_SetSongTick void MUSIC_SetSongTime(unsigned long milliseconds) { musdebug("STUB ... MUSIC_SetSongTime().\n"); }// MUSIC_SetSongTime void MUSIC_SetSongPosition(int measure, int beat, int tick) { musdebug("STUB ... MUSIC_SetSongPosition().\n"); } // MUSIC_SetSongPosition void MUSIC_GetSongPosition(songposition *pos) { musdebug("STUB ... MUSIC_GetSongPosition().\n"); } // MUSIC_GetSongPosition void MUSIC_GetSongLength(songposition *pos) { musdebug("STUB ... MUSIC_GetSongLength().\n"); } // MUSIC_GetSongLength int MUSIC_FadeVolume(int tovolume, int milliseconds) { Mix_FadeOutMusic(milliseconds); return(MUSIC_Ok); } // MUSIC_FadeVolume int MUSIC_FadeActive(void) { return((Mix_FadingMusic() == MIX_FADING_OUT) ? __FX_TRUE : __FX_FALSE); } // MUSIC_FadeActive void MUSIC_StopFade(void) { musdebug("STUB ... MUSIC_StopFade().\n"); } // MUSIC_StopFade void MUSIC_RerouteMidiChannel(int channel, int cdecl (*function)( int event, int c1, int c2 )) { musdebug("STUB ... MUSIC_RerouteMidiChannel().\n"); } // MUSIC_RerouteMidiChannel void MUSIC_RegisterTimbreBank(unsigned char *timbres) { musdebug("STUB ... MUSIC_RegisterTimbreBank().\n"); } // MUSIC_RegisterTimbreBank // end of fx_man.c ... rott-20230810/rott/engine.c000066400000000000000000000250771446517470200153710ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "watcom.h" #include "engine.h" #include "_engine.h" #include "rt_draw.h" #include "rt_door.h" #include "rt_stat.h" #include "rt_ted.h" #include "rt_view.h" #include /* ============================================================================= Global Variables GLOBAL VARIABLES ============================================================================= */ //wallcast_t posts[642];//bna++ wallcast_t posts[800+2];//bna++ //wallcast_t posts[321]; int lasttilex; int lasttiley; /* ============================================================================= Local Variables GLOBAL VARIABLES ============================================================================= */ static int xtilestep,ytilestep; static int c_vx,c_vy; void InitialCast ( void ); void Cast ( int curx ); void Interpolate (int x1, int x2) { int i; int dtexture; int frac; int dheight; int hfrac; int dx; dx=x2-x1; dtexture=(((posts[x2].texture-posts[x1].texture)<<12)+0x800)/dx; dheight=(((posts[x2].wallheight-posts[x1].wallheight)<<8)+0x80)/dx; frac=dtexture+(posts[x1].texture<<12); hfrac=dheight+(posts[x1].wallheight<<8); for (i=x1+1;i<=x2-1;i++,frac+=dtexture,hfrac+=dheight) { posts[i].lump=posts[x1].lump; posts[i].posttype=posts[x1].posttype; posts[i].offset=posts[x1].offset; posts[i].alttile=posts[x1].alttile; posts[i].texture=(frac>>12); posts[i].wallheight=hfrac>>8; } } void Refresh ( void ) { int x; // Cast Initial comb filter InitialCast(); for (x=0;x<=viewwidth-4;x+=4) { if NOTSAMETILE(x,x+4) { Cast(x+2); if NOTSAMETILE(x,x+2) { Cast(x+1); } else Interpolate (x,x+2); if NOTSAMETILE(x+2,x+4) { Cast(x+3); } else Interpolate (x+2,x+4); } else Interpolate(x,x+4); } } void HitWall(int curx, int vertical, int xtile, int ytile) { int num; posts[curx].offset=(xtile<<7)+ytile; posts[curx].lump = tilemap[xtile][ytile]; posts[curx].alttile=0; posts[curx].posttype=0; if (vertical<0) { xintercept=xtile<<16; if (xtilestep<0) xintercept+=0xffff; yintercept=FixedScale(xintercept-viewx,c_vy,c_vx)+viewy; if (posts[curx].lump & 0x4000) { if (tilemap[xtile-(xtilestep>>7)][ytile]&0x8000) { num=tilemap[xtile-(xtilestep>>7)][ytile]; if (num&0x4000) { if (maskobjlist[num&0x3ff]->sidepic) posts[curx].lump = maskobjlist[num&0x3ff]->sidepic; else posts[curx].lump &= 0x3ff; } else posts[curx].lump = doorobjlist[num&0x3ff]->sidepic; } else { if (posts[curx].lump&0x1000) posts[curx].lump=animwalls[posts[curx].lump&0x3ff].texture; else posts[curx].lump &= 0x3ff; } } else if (posts[curx].lump & 0x2000) { if (IsWindow(xtile,ytile)) posts[curx].alttile=-1; else posts[curx].alttile=(MAPSPOT(xtile,ytile,2))+1; posts[curx].lump &= 0x3ff; } else if (posts[curx].lump & 0x1000) posts[curx].lump=animwalls[posts[curx].lump&0x3ff].texture; else if (posts[curx].lump & 0x800) { posts[curx].lump &= 0x3ff; posts[curx].posttype=2; } posts[curx].texture=yintercept-(ytile<<16); // posts[curx].texture&=0xffff; if (posts[curx].texture<0) posts[curx].texture=0; if (posts[curx].texture>65535) posts[curx].texture=65535; if (xtilestep<0) posts[curx].texture^=0xffff; posts[curx].posttype+=1; // posts[curx].texture=(posts[curx].texture+firstcoloffset)&65535; } else { yintercept=ytile<<16; if (ytilestep<0) yintercept+=0xffff; xintercept=FixedScale(yintercept-viewy,c_vx,c_vy)+viewx; if (posts[curx].lump & 0x4000) { // check for adjacent doors if (tilemap[xtile][ytile-ytilestep]&0x8000) { num=tilemap[xtile][ytile-ytilestep]; if (num&0x4000) { if (maskobjlist[num&0x3ff]->sidepic) posts[curx].lump = maskobjlist[num&0x3ff]->sidepic; else posts[curx].lump &= 0x3ff; } else posts[curx].lump = doorobjlist[num&0x3ff]->sidepic; } else { if (posts[curx].lump&0x1000) posts[curx].lump=animwalls[posts[curx].lump&0x3ff].texture; else posts[curx].lump &= 0x3ff; } } else if (posts[curx].lump & 0x2000) { if (IsWindow(xtile,ytile)) posts[curx].alttile=-1; else posts[curx].alttile=(MAPSPOT(xtile,ytile,2))+1; posts[curx].lump &= 0x3ff; } else if (posts[curx].lump & 0x1000) posts[curx].lump=animwalls[posts[curx].lump&0x3ff].texture; else if (posts[curx].lump & 0x800) { posts[curx].lump &= 0x3ff; posts[curx].posttype=2; } posts[curx].texture=xintercept-(xtile<<16); // posts[curx].texture&=0xffff; if (posts[curx].texture<0) posts[curx].texture=0; if (posts[curx].texture>65535) posts[curx].texture=65535; if (ytilestep>0) posts[curx].texture^=0xffff; // posts[curx].posttype+=0; // posts[curx].texture=(posts[curx].texture+firstcoloffset)&65535; } posts[curx].wallheight=CalcHeight(); } void InitialCast ( void ) { int snx,sny; int incr[2]; int thedir[2]; int cnt; int grid[2]; int index; int curx; c_vx=c_startx; c_vy=c_starty; for (curx=0;curx<=viewwidth;curx+=4) { snx=viewx&0xffff; sny=viewy&0xffff; if (c_vx>0) { thedir[0]=1; xtilestep=0x80; snx^=0xffff; incr[1]=-c_vx; } else { thedir[0]=-1; xtilestep=-0x80; incr[1]=c_vx; } if (c_vy>0) { thedir[1]=1; ytilestep=1; sny^=0xffff; incr[0]=c_vy; } else { thedir[1]=-1; ytilestep=-1; incr[0]=-c_vy; } cnt=FixedMul(snx,incr[0])+FixedMul(sny,incr[1]); grid[0]=viewx>>16; grid[1]=viewy>>16; do { int tile; index=(cnt>=0); cnt+=incr[index]; spotvis[grid[0]][grid[1]]=1; grid[index]+=thedir[index]; if ((tile=tilemap[grid[0]][grid[1]])!=0) { if (tile&0x8000) { if ( (!(tile&0x4000)) && (doorobjlist[tile&0x3ff]->action==dr_closed)) { spotvis[grid[0]][grid[1]]=1; if (doorobjlist[tile&0x3ff]->flags&DF_MULTI) MakeWideDoorVisible(tile&0x3ff); do { index=(cnt>=0); cnt+=incr[index]; grid[index]+=thedir[index]; if ((tilemap[grid[0]][grid[1]]!=0) && (!(tilemap[grid[0]][grid[1]]&0x8000)) ) break; } while (1); break; } else continue; } else { mapseen[grid[0]][grid[1]]=1; break; } } } while (1); HitWall(curx, cnt-incr[index], grid[0], grid[1]); c_vx+=viewsin<<2; c_vy+=viewcos<<2; } } void Cast ( int curx ) { int snx,sny; int incr[2]; int thedir[2]; int cnt; int grid[2]; int index; c_vx=c_startx+(curx*viewsin); c_vy=c_starty+(curx*viewcos); snx=viewx&0xffff; sny=viewy&0xffff; if (c_vx>0) { thedir[0]=1; xtilestep=0x80; snx^=0xffff; incr[1]=-c_vx; } else { thedir[0]=-1; xtilestep=-0x80; incr[1]=c_vx; } if (c_vy>0) { thedir[1]=1; ytilestep=1; sny^=0xffff; incr[0]=c_vy; } else { thedir[1]=-1; ytilestep=-1; incr[0]=-c_vy; } cnt=FixedMul(snx,incr[0])+FixedMul(sny,incr[1]); grid[0]=viewx>>16; grid[1]=viewy>>16; do { int tile; index=(cnt>=0); cnt+=incr[index]; spotvis[grid[0]][grid[1]]=1; grid[index]+=thedir[index]; if ((tile=tilemap[grid[0]][grid[1]])!=0) { if (tile&0x8000) { if ( (!(tile&0x4000)) && (doorobjlist[tile&0x3ff]->action==dr_closed)) { spotvis[grid[0]][grid[1]]=1; if (doorobjlist[tile&0x3ff]->flags&DF_MULTI) MakeWideDoorVisible(tile&0x3ff); do { index=(cnt>=0); cnt+=incr[index]; grid[index]+=thedir[index]; if ((tilemap[grid[0]][grid[1]]!=0) && (!(tilemap[grid[0]][grid[1]]&0x8000)) ) break; } while (1); break; } else continue; } else { mapseen[grid[0]][grid[1]]=1; break; } } } while (1); HitWall(curx, cnt-incr[index], grid[0], grid[1]); } rott-20230810/rott/engine.h000066400000000000000000000026331446517470200153670ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _engine_public #define _engine_public #include "modexlib.h" //*************************************************************************** // // ENGINE.C // //*************************************************************************** typedef struct { int offset; int wallheight; int ceilingclip; int floorclip; int texture; int lump; int posttype; int alttile; } wallcast_t; extern wallcast_t posts[800+2];//bna++ JUST MAKE IT MAX RES //extern wallcast_t posts[642];//bna++ //extern wallcast_t posts[321]; extern int lasttilex; extern int lasttiley; void Refresh ( void ); #define IsWindow(x,y) (MAPSPOT((x),(y),2)==13) #endif rott-20230810/rott/f_scale.h000066400000000000000000000017741446517470200155230ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _f_scale_public #define _f_scale_public extern int cin_yl; extern int cin_yh; extern int cin_ycenter; extern int cin_iscale; extern int cin_texturemid; extern byte * cin_source; void R_DrawFilmColumn (byte * buf); void DrawFilmPost (byte * buf, byte * src, int height); #endif rott-20230810/rott/fli_glob.h000066400000000000000000000014531446517470200156760ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ void PlayFlic ( char * name, unsigned char * buffer, int usefile, int loop); rott-20230810/rott/fx_man.h000066400000000000000000000102711446517470200153670ustar00rootroot00000000000000 /* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: FX_MAN.H author: James R. Dose date: March 17, 1994 Public header for FX_MAN.C (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #ifndef __FX_MAN_H #define __FX_MAN_H #include "sndcards.h" typedef struct { int MaxVoices; int MaxSampleBits; int MaxChannels; } fx_device; #define MonoFx 1 #define StereoFx 2 enum FX_ERRORS { FX_Warning = -2, FX_Error = -1, FX_Ok = 0, FX_ASSVersion, FX_BlasterError, FX_SoundCardError, FX_InvalidCard, FX_MultiVocError, FX_DPMI_Error }; char *FX_ErrorString( int ErrorNumber ); int FX_SetupCard( int SoundCard, fx_device *device ); int FX_Init( int SoundCard, int numvoices, int numchannels, int samplebits, unsigned mixrate ); int FX_Shutdown( void ); int FX_SetCallBack( void ( *function )( unsigned long ) ); void FX_SetVolume( int volume ); int FX_GetVolume( void ); void FX_SetReverseStereo( int setting ); int FX_GetReverseStereo( void ); void FX_SetReverb( int reverb ); void FX_SetFastReverb( int reverb ); int FX_GetMaxReverbDelay( void ); int FX_GetReverbDelay( void ); void FX_SetReverbDelay( int delay ); int FX_VoiceAvailable( int priority ); int FX_EndLooping( int handle ); int FX_SetPan( int handle, int vol, int left, int right ); int FX_SetPitch( int handle, int pitchoffset ); int FX_SetFrequency( int handle, int frequency ); int FX_PlayVOC( char *ptr, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int FX_PlayLoopedVOC( char *ptr, long loopstart, long loopend, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int FX_PlayWAV( char *ptr, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int FX_PlayLoopedWAV( char *ptr, long loopstart, long loopend, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int FX_PlayVOC3D( char *ptr, int pitchoffset, int angle, int distance, int priority, unsigned long callbackval ); int FX_PlayWAV3D( char *ptr, int pitchoffset, int angle, int distance, int priority, unsigned long callbackval ); int FX_PlayRaw( char *ptr, unsigned long length, unsigned rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int FX_PlayLoopedRaw( char *ptr, unsigned long length, char *loopstart, char *loopend, unsigned rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int FX_Pan3D( int handle, int angle, int distance ); int FX_SoundActive( int handle ); int FX_SoundsPlaying( void ); int FX_StopSound( int handle ); int FX_StopAllSounds( void ); int FX_StartDemandFeedPlayback( void ( *function )( char **ptr, unsigned long *length ), int rate, int pitchoffset, int vol, int left, int right, int priority, unsigned long callbackval ); int FX_StartRecording( int MixRate, void ( *function )( char *ptr, int length ) ); void FX_StopRecord( void ); // ROTT Special - SBF int FX_PlayVOC3D_ROTT( char *ptr, int size, int pitchoffset, int angle, int distance, int priority, unsigned long callbackval ); int FX_PlayWAV3D_ROTT( char *ptr, int size, int pitchoffset, int angle, int distance, int priority, unsigned long callbackval ); // End ROTT hacks #endif rott-20230810/rott/gmove.h000066400000000000000000000014231446517470200152330ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _gmove #define _gmove #define GMOVE 8 #endif rott-20230810/rott/isr.c000066400000000000000000000100461446517470200147070ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /* ============================================================================ TIMER INTERRUPT ============================================================================ */ #include #include #include "rt_def.h" #include "task_man.h" #include "isr.h" #include "_isr.h" #include "rt_in.h" #include "rt_util.h" #include "profile.h" #include "develop.h" #include "rt_main.h" // Global Variables volatile int Keyboard[MAXKEYBOARDSCAN]; volatile int KeyboardQueue[KEYQMAX]; volatile int Keystate[MAXKEYBOARDSCAN]; volatile int Keyhead; volatile int Keytail; volatile boolean PausePressed = false; volatile boolean PanicPressed = false; int KeyboardStarted=false; const int ASCIINames[] = // Unshifted ASCII for scan codes { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 ,27 ,'1','2','3','4','5','6','7','8','9','0','-','=',8 ,9 , // 0 'q','w','e','r','t','y','u','i','o','p','[',']',13 ,0 ,'a','s', // 1 'd','f','g','h','j','k','l',';',39 ,'`',0 ,92 ,'z','x','c','v', // 2 'b','n','m',',','.','/',0 ,'*',0 ,' ',0 ,0 ,0 ,0 ,0 ,0 , // 3 0 ,0 ,0 ,0 ,0 ,0 ,0 ,'7','8','9','-','4','5','6','+','1', // 4 '2','3','0',127,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 5 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7 }; const int ShiftNames[] = // Shifted ASCII for scan codes { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 ,27 ,'!','@','#','$','%','^','&','*','(',')','_','+',8 ,9 , // 0 'Q','W','E','R','T','Y','U','I','O','P','{','}',13 ,0 ,'A','S', // 1 'D','F','G','H','J','K','L',':',34 ,'~',0 ,'|','Z','X','C','V', // 2 'B','N','M','<','>','?',0 ,'*',0 ,' ',0 ,0 ,0 ,0 ,0 ,0 , // 3 0 ,0 ,0 ,0 ,0 ,0 ,0 ,'7','8','9','-','4','5','6','+','1', // 4 '2','3','0',127,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 5 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7 }; #include "SDL.h" static int ticoffset; /* offset for SDL_GetTicks() */ static int ticbase; /* game-supplied base */ int GetTicCount (void) { return ((SDL_GetTicks() - ticoffset) * VBLCOUNTER) / 1000 + ticbase; } void I_Sleep (int ms) { SDL_Delay(ms); } /* ================ = = ISR_SetTime = ================ */ void ISR_SetTime(int settime) { ticoffset = SDL_GetTicks(); ticbase = settime; } /* developer-only */ int GetFastTics (void) { /* STUB_FUNCTION; */ return 0; } void SetFastTics (int settime) { /* STUB_FUNCTION; */ } /* ================ = = I_Delay = ================ */ void I_Delay ( int delay ) { int time; delay=(VBLCOUNTER*delay)/10; IN_ClearKeysDown(); time=GetTicCount(); while (!LastScan && !IN_GetMouseButtons() && GetTicCount() scan code conversion extern const int ShiftNames[]; // Shifted Ascii->scancode conversion extern volatile boolean PausePressed; //Game paused variable extern volatile boolean PanicPressed; //Panic key variable void I_StartupTimer (void); // Start up timer isr void I_SetTimer0(int speed); // Set the timer to a given speed void I_ShutdownTimer (void); // Shutdown timer isr void I_SetKeyboardLEDs( int which, boolean val ); // Turns LED's on or off void I_StartupKeyboard (void); // Startup Keyboard isr void I_ShutdownKeyboard (void); // Shutdown keyboard isr void I_Delay ( int delay ); void ISR_SetTime(int settime); void I_SendKeyboardData ( int val ); #endif rott-20230810/rott/keyb.h000066400000000000000000000050361446517470200150540ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _keyb #define _keyb #define sc_None 0 #define sc_Bad 0xff #define sc_Comma 0x33 #define sc_Period 0x34 #define sc_Return 0x1c #define sc_Enter sc_Return #define sc_Escape 0x01 #define sc_Space 0x39 #define sc_BackSpace 0x0e #define sc_Tab 0x0f #define sc_Alt 0x38 #define sc_Control 0x1d #define sc_CapsLock 0x3a #define sc_LShift 0x2a #define sc_RShift 0x36 #define sc_UpArrow 0x48 #define sc_DownArrow 0x50 #define sc_LeftArrow 0x4b #define sc_RightArrow 0x4d #define sc_Insert 0x52 #define sc_Delete 0x53 #define sc_Home 0x47 #define sc_End 0x4f #define sc_PgUp 0x49 #define sc_PgDn 0x51 #define sc_F1 0x3b #define sc_F2 0x3c #define sc_F3 0x3d #define sc_F4 0x3e #define sc_F5 0x3f #define sc_F6 0x40 #define sc_F7 0x41 #define sc_F8 0x42 #define sc_F9 0x43 #define sc_F10 0x44 #define sc_F11 0x57 #define sc_F12 0x58 #define sc_PrintScreen 0x37 #define sc_OpenBracket 0x1a #define sc_CloseBracket 0x1b #define sc_1 0x02 #define sc_2 0x03 #define sc_3 0x04 #define sc_4 0x05 #define sc_5 0x06 #define sc_6 0x07 #define sc_7 0x08 #define sc_8 0x09 #define sc_9 0x0a #define sc_0 0x0b #define sc_Minus 0x0c #define sc_Equals 0x0d #define sc_Plus 0x0d #define sc_A 0x1e #define sc_B 0x30 #define sc_C 0x2e #define sc_D 0x20 #define sc_E 0x12 #define sc_F 0x21 #define sc_G 0x22 #define sc_H 0x23 #define sc_I 0x17 #define sc_J 0x24 #define sc_K 0x25 #define sc_L 0x26 #define sc_M 0x32 #define sc_N 0x31 #define sc_O 0x18 #define sc_P 0x19 #define sc_Q 0x10 #define sc_R 0x13 #define sc_S 0x1f #define sc_T 0x14 #define sc_U 0x16 #define sc_V 0x2f #define sc_W 0x11 #define sc_X 0x2d #define sc_Y 0x15 #define sc_Z 0x2c #endif rott-20230810/rott/lumpy.h000066400000000000000000000110421446517470200152620ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _lumpy_ #define _lumpy_ //**************************************************************************** // // Public header for LUMPY typedefs // //**************************************************************************** typedef struct { byte width,height; byte data; } pic_t; #define CONVERT_ENDIAN_pic_t(pp) { } typedef struct { short width,height; short orgx,orgy; byte data; } lpic_t; #define CONVERT_ENDIAN_lpic_t(lp) \ { \ SwapIntelShort(&lp->width); \ SwapIntelShort(&lp->height); \ SwapIntelShort(&lp->orgx); \ SwapIntelShort(&lp->orgy); \ } typedef struct { short height; char width[256]; short charofs[256]; byte data; // as much as required } font_t; #define CONVERT_ENDIAN_font_t(fp) \ { \ int i; \ SwapIntelShort(&fp->height); \ for (i = 0; i < 256; i++) { \ SwapIntelShort(&fp->charofs[i]); \ } \ } typedef struct { short width; short height; byte palette[768]; byte data; } lbm_t; #define CONVERT_ENDIAN_lbm_t(lp) \ { \ SwapIntelShort(&lp->width); \ SwapIntelShort(&lp->height); \ } typedef struct { short origsize; // the orig size of "grabbed" gfx short width; // bounding box size short height; short leftoffset; // pixels to the left of origin short topoffset; // pixels above the origin unsigned short collumnofs[320]; // only [width] used, the [0] is &collumnofs[width] } patch_t; #define CONVERT_ENDIAN_patch_t(pp) \ { \ int i; \ SwapIntelShort(&pp->origsize); \ SwapIntelShort(&pp->width); \ SwapIntelShort(&pp->height); \ SwapIntelShort(&pp->leftoffset); \ SwapIntelShort(&pp->topoffset); \ for (i = 0; i < pp->width; i++) { \ SwapIntelShort((short*)&pp->collumnofs[i]); \ } \ } typedef struct { short origsize; // the orig size of "grabbed" gfx short width; // bounding box size short height; short leftoffset; // pixels to the left of origin short topoffset; // pixels above the origin short translevel; short collumnofs[320]; // only [width] used, the [0] is &collumnofs[width] } transpatch_t; #define CONVERT_ENDIAN_transpatch_t(pp) \ { \ int i; \ SwapIntelShort(&pp->origsize); \ SwapIntelShort(&pp->width); \ SwapIntelShort(&pp->height); \ SwapIntelShort(&pp->leftoffset); \ SwapIntelShort(&pp->topoffset); \ SwapIntelShort(&pp->translevel); \ for (i = 0; i < pp->width; i++) { \ SwapIntelShort((short*)&pp->collumnofs[i]); \ } \ } typedef struct { byte color; short height; char width[256]; short charofs[256]; byte pal[0x300]; byte data; // as much as required } cfont_t; #define CONVERT_ENDIAN_cfont_t(pp) \ { \ int i; \ SwapIntelShort(&pp->height); \ for (i = 0; i < 256; i++) { \ SwapIntelShort(&pp->charofs[i]); \ } \ } #endif rott-20230810/rott/m_misc2.c000066400000000000000000000231451446517470200154470ustar00rootroot00000000000000// // Copyright(C) 1993-1996 Id Software, Inc. // Copyright(C) 1993-2008 Raven Software // Copyright(C) 2005-2014 Simon Howard // // 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. // // DESCRIPTION: // [FG] miscellaneous helper functions from Chocolate Doom. // #include #include #include #include #include #include #include "m_misc2.h" // Create a directory void M_MakeDirectory(const char *path) { #ifdef _WIN32 mkdir(path); #else mkdir(path, 0755); #endif } // Check if a file exists boolean M_FileExists(const char *filename) { FILE *fstream; fstream = fopen(filename, "r"); if (fstream != NULL) { fclose(fstream); return true; } else { // If we can't open because the file is a directory, the // "file" exists at least! return errno == EISDIR; } } // Returns the path to a temporary file of the given name, stored // inside the system temporary directory. // // The returned value must be freed with Z_Free after use. char *M_TempFile(const char *s) { const char *tempdir; #ifdef _WIN32 // Check the TEMP environment variable to find the location. tempdir = getenv("TEMP"); if (tempdir == NULL) { tempdir = "."; } #else // In Unix, just use /tmp. tempdir = "/tmp"; #endif return M_StringJoin(tempdir, PATH_SEP_STR, s, NULL); } // Check if a file exists by probing for common case variation of its filename. // Returns a newly allocated string that the caller is responsible for freeing. char *M_FileCaseExists(const char *path) { char *path_dup, *filename, *ext; path_dup = M_StringDuplicate(path); // 0: actual path if (M_FileExists(path_dup)) { return path_dup; } // cast result to (char *), because `path_dup` isn't (const char *) in the first place filename = (char *) M_BaseName(path_dup); // 1: lowercase filename, e.g. doom2.wad M_ForceLowercase(filename); if (M_FileExists(path_dup)) { return path_dup; } // 2: uppercase filename, e.g. DOOM2.WAD M_ForceUppercase(filename); if (M_FileExists(path_dup)) { return path_dup; } // 3. uppercase basename with lowercase extension, e.g. DOOM2.wad ext = strrchr(path_dup, '.'); if (ext != NULL && ext > filename) { M_ForceLowercase(ext + 1); if (M_FileExists(path_dup)) { return path_dup; } } // 4. lowercase filename with uppercase first letter, e.g. Doom2.wad if (strlen(filename) > 1) { M_ForceLowercase(filename + 1); if (M_FileExists(path_dup)) { return path_dup; } } // 5. no luck free(path_dup); return NULL; } boolean M_StrToInt(const char *str, int *result) { return sscanf(str, " 0x%x", (unsigned int *) result) == 1 || sscanf(str, " 0X%x", (unsigned int *) result) == 1 || sscanf(str, " 0%o", (unsigned int *) result) == 1 || sscanf(str, " %d", result) == 1; } // Returns the directory portion of the given path, without the trailing // slash separator character. If no directory is described in the path, // the string "." is returned. In either case, the result is newly allocated // and must be freed by the caller after use. char *M_DirName(const char *path) { char *result; const char *pf, *pb; pf = strrchr(path, '/'); #ifdef _WIN32 pb = strrchr(path, '\\'); #else pb = NULL; #endif if (pf == NULL && pb == NULL) { return M_StringDuplicate("."); } else { const char *p = max(pb, pf); result = M_StringDuplicate(path); result[p - path] = '\0'; return result; } } // Returns the base filename described by the given path (without the // directory name). The result points inside path and nothing new is // allocated. const char *M_BaseName(const char *path) { const char *pf, *pb; pf = strrchr(path, '/'); #ifdef _WIN32 pb = strrchr(path, '\\'); // [FG] allow C:filename if (pf == NULL && pb == NULL) { pb = strrchr(path, ':'); } #else pb = NULL; #endif if (pf == NULL && pb == NULL) { return path; } else { const char *p = max(pb, pf); return p + 1; } } // Change string to uppercase. void M_ForceUppercase(char *text) { char *p; for (p = text; *p != '\0'; ++p) { *p = toupper(*p); } } // Change string to lowercase. void M_ForceLowercase(char *text) { char *p; for (p = text; *p != '\0'; ++p) { *p = tolower(*p); } } // Safe version of strdup() that checks the string was successfully // allocated. char *M_StringDuplicate(const char *orig) { char *result; result = strdup(orig); if (result == NULL) { fprintf(stderr, "Failed to duplicate string (length %ld)\n", (long)strlen(orig)); } return result; } // String replace function. char *M_StringReplace(const char *haystack, const char *needle, const char *replacement) { char *result, *dst; const char *p; size_t needle_len = strlen(needle); size_t result_len, dst_len; // Iterate through occurrences of 'needle' and calculate the size of // the new string. result_len = strlen(haystack) + 1; p = haystack; for (;;) { p = strstr(p, needle); if (p == NULL) { break; } p += needle_len; result_len += strlen(replacement) - needle_len; } // Construct new string. result = malloc(result_len); if (result == NULL) { fprintf(stderr, "M_StringReplace: Failed to allocate new string"); return NULL; } dst = result; dst_len = result_len; p = haystack; while (*p != '\0') { if (!strncmp(p, needle, needle_len)) { M_StringCopy(dst, replacement, dst_len); p += needle_len; dst += strlen(replacement); dst_len -= strlen(replacement); } else { *dst = *p; ++dst; --dst_len; ++p; } } *dst = '\0'; return result; } // Safe string copy function that works like OpenBSD's strlcpy(). // Returns true if the string was not truncated. boolean M_StringCopy(char *dest, const char *src, size_t dest_size) { size_t len; if (dest_size >= 1) { dest[dest_size - 1] = '\0'; strncpy(dest, src, dest_size - 1); } else { return false; } len = strlen(dest); return src[len] == '\0'; } // Safe string concat function that works like OpenBSD's strlcat(). // Returns true if string not truncated. boolean M_StringConcat(char *dest, const char *src, size_t dest_size) { size_t offset; offset = strlen(dest); if (offset > dest_size) { offset = dest_size; } return M_StringCopy(dest + offset, src, dest_size - offset); } // Returns true if 's' ends with the specified suffix. boolean M_StringEndsWith(const char *s, const char *suffix) { return strlen(s) >= strlen(suffix) && strcmp(s + strlen(s) - strlen(suffix), suffix) == 0; } boolean M_StringCaseEndsWith(const char *s, const char *suffix) { return strlen(s) >= strlen(suffix) && strcasecmp(s + strlen(s) - strlen(suffix), suffix) == 0; } // Return a newly-malloced string with all the strings given as arguments // concatenated together. char *M_StringJoin(const char *s, ...) { char *result; const char *v; va_list args; size_t result_len; result_len = strlen(s) + 1; va_start(args, s); for (;;) { v = va_arg(args, const char *); if (v == NULL) { break; } result_len += strlen(v); } va_end(args); result = malloc(result_len); if (result == NULL) { fprintf(stderr, "M_StringJoin: Failed to allocate new string."); return NULL; } M_StringCopy(result, s, result_len); va_start(args, s); for (;;) { v = va_arg(args, const char *); if (v == NULL) { break; } M_StringConcat(result, v, result_len); } va_end(args); return result; } // Safe, portable vsnprintf(). static int PRINTF_ATTR(3, 0) M_vsnprintf(char *buf, size_t buf_len, const char *s, va_list args) { int result; if (buf_len < 1) { return 0; } // Windows (and other OSes?) has a vsnprintf() that doesn't always // append a trailing \0. So we must do it, and write into a buffer // that is one byte shorter; otherwise this function is unsafe. result = vsnprintf(buf, buf_len, s, args); // If truncated, change the final char in the buffer to a \0. // A negative result indicates a truncated buffer on Windows. if (result < 0 || result >= buf_len) { buf[buf_len - 1] = '\0'; result = buf_len - 1; } return result; } // Safe, portable snprintf(). int M_snprintf(char *buf, size_t buf_len, const char *s, ...) { va_list args; int result; va_start(args, s); result = M_vsnprintf(buf, buf_len, s, args); va_end(args); return result; } rott-20230810/rott/m_misc2.h000066400000000000000000000031771446517470200154570ustar00rootroot00000000000000// // Copyright(C) 1993-1996 Id Software, Inc. // Copyright(C) 2005-2014 Simon Howard // // 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. // // DESCRIPTION: // [FG] miscellaneous helper functions from Chocolate Doom. // #ifndef __M_MISC2__ #define __M_MISC2__ #include #include "rt_def.h" void M_MakeDirectory(const char *path); boolean M_FileExists(const char *file); char *M_TempFile(const char *s); char *M_FileCaseExists(const char *file); boolean M_StrToInt(const char *str, int *result); char *M_DirName(const char *path); const char *M_BaseName(const char *path); void M_ForceUppercase(char *text); void M_ForceLowercase(char *text); char *M_StringDuplicate(const char *orig); boolean M_StringCopy(char *dest, const char *src, size_t dest_size); boolean M_StringConcat(char *dest, const char *src, size_t dest_size); char *M_StringReplace(const char *haystack, const char *needle, const char *replacement); char *M_StringJoin(const char *s, ...); boolean M_StringEndsWith(const char *s, const char *suffix); boolean M_StringCaseEndsWith(const char *s, const char *suffix); int M_snprintf(char *buf, size_t buf_len, const char *s, ...) PRINTF_ATTR(3, 4); #endif rott-20230810/rott/modexlib.c000066400000000000000000000256331446517470200157250ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 #include #include #include #include "modexlib.h" #include "rt_util.h" #include "rt_net.h" // for GamePaused #include "myprint.h" static void StretchMemPicture (); // GLOBAL VARIABLES boolean StretchScreen=0;//bná++ extern boolean iG_aimCross; extern boolean sdl_fullscreen; extern int iG_X_center; extern int iG_Y_center; byte *iG_buf_center; int linewidth; //int ylookup[MAXSCREENHEIGHT]; int ylookup[600];//just set to max res byte *page1start; byte *page2start; byte *page3start; int screensize; byte *bufferofs; byte *displayofs; boolean graphicsmode=false; byte *bufofsTopLimit; byte *bufofsBottomLimit; void DrawCenterAim (); #include "SDL.h" /* rt_def.h isn't included, so I just put this here... */ #ifndef STUB_FUNCTION #define STUB_FUNCTION fprintf(stderr,"STUB: %s at " __FILE__ ", line %d, thread %d\n",__FUNCTION__,__LINE__,getpid()) #endif /* ==================== = = GraphicsMode = ==================== */ static SDL_Surface *sdl_surface = NULL; static SDL_Surface *unstretch_sdl_surface = NULL; static SDL_Window *screen; static SDL_Renderer *renderer; static SDL_Surface *argbbuffer; static SDL_Texture *texture; static SDL_Rect blit_rect = {0}; SDL_Surface *VL_GetVideoSurface (void) { return sdl_surface; } int VL_SaveBMP (const char *file) { return SDL_SaveBMP(sdl_surface, file); } void SetShowCursor(int show) { SDL_SetRelativeMouseMode(!show); SDL_GetRelativeMouseState(NULL, NULL); } void GraphicsMode ( void ) { uint32_t flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI; uint32_t pixel_format; unsigned int rmask, gmask, bmask, amask; int bpp; if (SDL_InitSubSystem (SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) { Error ("Could not initialize SDL\n"); } if (sdl_fullscreen) { flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; } screen = SDL_CreateWindow(NULL, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, flags); SDL_SetWindowMinimumSize(screen, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT); SDL_SetWindowTitle(screen, PACKAGE_STRING); renderer = SDL_CreateRenderer(screen, -1, SDL_RENDERER_PRESENTVSYNC); if (!renderer) { renderer = SDL_CreateRenderer(screen, -1, SDL_RENDERER_SOFTWARE); } SDL_RenderSetLogicalSize(renderer, 640, 480); SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); SDL_RenderClear(renderer); SDL_RenderPresent(renderer); sdl_surface = SDL_CreateRGBSurface(0, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, 8, 0, 0, 0, 0); SDL_FillRect(sdl_surface, NULL, 0); pixel_format = SDL_GetWindowPixelFormat(screen); SDL_PixelFormatEnumToMasks(pixel_format, &bpp, &rmask, &gmask, &bmask, &amask); argbbuffer = SDL_CreateRGBSurface(0, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, bpp, rmask, gmask, bmask, amask); SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest"); texture = SDL_CreateTexture(renderer, pixel_format, SDL_TEXTUREACCESS_STREAMING, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT); blit_rect.w = iGLOBAL_SCREENWIDTH; blit_rect.h = iGLOBAL_SCREENHEIGHT; SetShowCursor(!sdl_fullscreen); } void ToggleFullScreen (void) { unsigned int flags = 0; sdl_fullscreen = !sdl_fullscreen; if (sdl_fullscreen) { flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; } SDL_SetWindowFullscreen(screen, flags); SetShowCursor(!sdl_fullscreen); } /* ==================== = = SetTextMode = ==================== */ void SetTextMode ( void ) { if (SDL_WasInit(SDL_INIT_VIDEO) == SDL_INIT_VIDEO) { if (sdl_surface != NULL) { SDL_FreeSurface(sdl_surface); sdl_surface = NULL; } SDL_QuitSubSystem (SDL_INIT_VIDEO); } } /* ==================== = = TurnOffTextCursor = ==================== */ void TurnOffTextCursor ( void ) { } /* ==================== = = WaitVBL = ==================== */ void WaitVBL( void ) { SDL_Delay (16667/1000); } /* ======================= = = VL_SetVGAPlaneMode = ======================= */ void VL_SetVGAPlaneMode ( void ) { int i,offset; GraphicsMode(); // // set up lookup tables // //bna-- linewidth = 320; linewidth = iGLOBAL_SCREENWIDTH; offset = 0; for (i=0;ipixels; page2start=sdl_surface->pixels; page3start=sdl_surface->pixels; displayofs = page1start; bufferofs = page2start; iG_X_center = iGLOBAL_SCREENWIDTH / 2; iG_Y_center = (iGLOBAL_SCREENHEIGHT / 2)+10 ;//+10 = move aim down a bit iG_buf_center = bufferofs + (screensize/2);//(iG_Y_center*iGLOBAL_SCREENWIDTH);//+iG_X_center; bufofsTopLimit = bufferofs + screensize - iGLOBAL_SCREENWIDTH; bufofsBottomLimit = bufferofs + iGLOBAL_SCREENWIDTH; // start stretched EnableScreenStretch(); XFlipPage (); } /* ======================= = = VL_CopyPlanarPage = ======================= */ void VL_CopyPlanarPage ( byte * src, byte * dest ) { memcpy(dest,src,screensize); } /* ======================= = = VL_CopyPlanarPageToMemory = ======================= */ void VL_CopyPlanarPageToMemory ( byte * src, byte * dest ) { memcpy(dest,src,screensize); } /* ======================= = = VL_CopyBufferToAll = ======================= */ void VL_CopyBufferToAll ( byte *buffer ) { } /* ======================= = = VL_CopyDisplayToHidden = ======================= */ void VL_CopyDisplayToHidden ( void ) { VL_CopyBufferToAll ( displayofs ); } /* ================= = = VL_ClearBuffer = = Fill the entire video buffer with a given color = ================= */ void VL_ClearBuffer (byte *buf, byte color) { memset((byte *)buf,color,screensize); } /* ================= = = VL_ClearVideo = = Fill the entire video buffer with a given color = ================= */ void VL_ClearVideo (byte color) { memset (sdl_surface->pixels, color, iGLOBAL_SCREENWIDTH*iGLOBAL_SCREENHEIGHT); } /* ================= = = VL_DePlaneVGA = ================= */ void VL_DePlaneVGA (void) { } /* C version of rt_vh_a.asm */ void VH_UpdateScreen (void) { if (StretchScreen){//bna++ StretchMemPicture (); }else{ DrawCenterAim (); } SDL_LowerBlit(VL_GetVideoSurface(), &blit_rect, argbbuffer, &blit_rect); SDL_UpdateTexture(texture, NULL, argbbuffer->pixels, argbbuffer->pitch); SDL_RenderClear(renderer); SDL_RenderCopy(renderer, texture, NULL, NULL); SDL_RenderPresent(renderer); } /* ================= = = XFlipPage = ================= */ void XFlipPage ( void ) { if (StretchScreen){//bna++ StretchMemPicture (); }else{ DrawCenterAim (); } SDL_LowerBlit(sdl_surface, &blit_rect, argbbuffer, &blit_rect); SDL_UpdateTexture(texture, NULL, argbbuffer->pixels, argbbuffer->pitch); SDL_RenderClear(renderer); SDL_RenderCopy(renderer, texture, NULL, NULL); SDL_RenderPresent(renderer); } void EnableScreenStretch(void) { if (iGLOBAL_SCREENWIDTH <= 320 || StretchScreen) return; if (unstretch_sdl_surface == NULL) { /* should really be just 320x200, but there is code all over the places which crashes then */ unstretch_sdl_surface = SDL_CreateRGBSurface(0, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, 8, 0, 0, 0, 0); } displayofs = unstretch_sdl_surface->pixels + (displayofs - (byte *)sdl_surface->pixels); bufferofs = unstretch_sdl_surface->pixels; page1start = unstretch_sdl_surface->pixels; page2start = unstretch_sdl_surface->pixels; page3start = unstretch_sdl_surface->pixels; StretchScreen = 1; } void DisableScreenStretch(void) { if (iGLOBAL_SCREENWIDTH <= 320 || !StretchScreen) return; displayofs = sdl_surface->pixels + (displayofs - (byte *)unstretch_sdl_surface->pixels); bufferofs = sdl_surface->pixels; page1start = sdl_surface->pixels; page2start = sdl_surface->pixels; page3start = sdl_surface->pixels; StretchScreen = 0; } // bna section ------------------------------------------- static void StretchMemPicture () { SDL_Rect src; SDL_Rect dest; src.x = 0; src.y = 0; src.w = 320; src.h = 200; dest.x = 0; dest.y = 0; dest.w = iGLOBAL_SCREENWIDTH; dest.h = iGLOBAL_SCREENHEIGHT; SDL_SoftStretch(unstretch_sdl_surface, &src, sdl_surface, &dest); } // bna function added start extern boolean ingame; int iG_playerTilt; void DrawCenterAim () { int x; int percenthealth = (locplayerstate->health * 10) / MaxHitpointsForCharacter(locplayerstate); int color = percenthealth < 3 ? egacolor[RED] : percenthealth < 4 ? egacolor[YELLOW] : egacolor[GREEN]; if (iG_aimCross && !GamePaused){ if (( ingame == true )&&(iGLOBAL_SCREENWIDTH>320)){ if ((iG_playerTilt <0 )||(iG_playerTilt >iGLOBAL_SCREENHEIGHT/2)){ iG_playerTilt = -(2048 - iG_playerTilt); } if (iGLOBAL_SCREENWIDTH == 640){ x = iG_playerTilt;iG_playerTilt=x/2; } iG_buf_center = bufferofs + ((iG_Y_center-iG_playerTilt)*iGLOBAL_SCREENWIDTH);//+iG_X_center; for (x=iG_X_center-10;x<=iG_X_center-4;x++){ if ((iG_buf_center+x < bufofsTopLimit)&&(iG_buf_center+x > bufofsBottomLimit)){ *(iG_buf_center+x) = color; } } for (x=iG_X_center+4;x<=iG_X_center+10;x++){ if ((iG_buf_center+x < bufofsTopLimit)&&(iG_buf_center+x > bufofsBottomLimit)){ *(iG_buf_center+x) = color; } } for (x=10;x>=4;x--){ if (((iG_buf_center-(x*iGLOBAL_SCREENWIDTH)+iG_X_center) < bufofsTopLimit)&&((iG_buf_center-(x*iGLOBAL_SCREENWIDTH)+iG_X_center) > bufofsBottomLimit)){ *(iG_buf_center-(x*iGLOBAL_SCREENWIDTH)+iG_X_center) = color; } } for (x=4;x<=10;x++){ if (((iG_buf_center+(x*iGLOBAL_SCREENWIDTH)+iG_X_center) < bufofsTopLimit)&&((iG_buf_center+(x*iGLOBAL_SCREENWIDTH)+iG_X_center) > bufofsBottomLimit)){ *(iG_buf_center+(x*iGLOBAL_SCREENWIDTH)+iG_X_center) = color; } } } } } // bna function added end // bna section ------------------------------------------- rott-20230810/rott/modexlib.h000066400000000000000000000043201446517470200157200ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //*************************************************************************** // // MODEXLIB.C - various utils palette funcs and modex stuff // //*************************************************************************** #ifndef _modexlib_public #define _modexlib_public #include "WinRott.h" #include "rt_def.h" //*************************************************************************** // // Video (ModeX) Constants // //*************************************************************************** extern boolean StretchScreen; //extern int ylookup[MAXSCREENHEIGHT]; // Table of row offsets extern int ylookup[600]; // just set to max res extern int linewidth; extern byte *page1start; extern byte *page2start; extern byte *page3start; extern int screensize; extern byte *bufferofs; extern byte *displayofs; extern boolean graphicsmode; void GraphicsMode ( void ); void SetTextMode ( void ); void VL_SetVGAPlaneMode ( void ); void VL_ClearBuffer (byte *buf, byte color); void VL_ClearVideo (byte color); void VL_DePlaneVGA (void); void VL_CopyDisplayToHidden ( void ); void VL_CopyBufferToAll ( byte *buffer ); void VL_CopyPlanarPage ( byte * src, byte * dest ); void VL_CopyPlanarPageToMemory ( byte * src, byte * dest ); void XFlipPage ( void ); void WaitVBL( void ); void TurnOffTextCursor ( void ); void ToggleFullScreen (void); void SetShowCursor (int); #define VGAMAPMASK(a) #define VGAREADMAP(a) #define VGAWRITEMAP(a) #endif rott-20230810/rott/music.h000066400000000000000000000056021446517470200152410ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: MUSIC.H author: James R. Dose date: March 25, 1994 Public header for MUSIC.C (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #ifndef __MUSIC_H #define __MUSIC_H #include "sndcards.h" extern int MUSIC_ErrorCode; enum MUSIC_ERRORS { MUSIC_Warning = -2, MUSIC_Error = -1, MUSIC_Ok = 0, MUSIC_ASSVersion, MUSIC_SoundCardError, MUSIC_MPU401Error, MUSIC_InvalidCard, MUSIC_MidiError, MUSIC_TaskManError, MUSIC_FMNotDetected, MUSIC_DPMI_Error }; typedef struct { unsigned long tickposition; unsigned long milliseconds; unsigned int measure; unsigned int beat; unsigned int tick; } songposition; #define MUSIC_LoopSong ( 1 == 1 ) #define MUSIC_PlayOnce ( !MUSIC_LoopSong ) char *MUSIC_ErrorString( int ErrorNumber ); int MUSIC_Init( int SoundCard, int Address ); int MUSIC_Shutdown( void ); void MUSIC_SetMaxFMMidiChannel( int channel ); void MUSIC_SetVolume( int volume ); void MUSIC_SetMidiChannelVolume( int channel, int volume ); void MUSIC_ResetMidiChannelVolumes( void ); int MUSIC_GetVolume( void ); void MUSIC_SetLoopFlag( int loopflag ); int MUSIC_SongPlaying( void ); void MUSIC_Continue( void ); void MUSIC_Pause( void ); int MUSIC_StopSong( void ); int MUSIC_PlaySong( unsigned char *song, int loopflag ); // ROTT Special - SBF int MUSIC_PlaySongROTT(unsigned char *song, int size, int loopflag); void MUSIC_SetContext( int context ); int MUSIC_GetContext( void ); void MUSIC_SetSongTick( unsigned long PositionInTicks ); void MUSIC_SetSongTime( unsigned long milliseconds ); void MUSIC_SetSongPosition( int measure, int beat, int tick ); void MUSIC_GetSongPosition( songposition *pos ); void MUSIC_GetSongLength( songposition *pos ); int MUSIC_FadeVolume( int tovolume, int milliseconds ); int MUSIC_FadeActive( void ); void MUSIC_StopFade( void ); void MUSIC_RerouteMidiChannel( int channel, int cdecl ( *function )( int event, int c1, int c2 ) ); void MUSIC_RegisterTimbreBank( unsigned char *timbres ); #endif rott-20230810/rott/myprint.h000066400000000000000000000017771446517470200156340ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 __MYPRINT_H #define __MYPRINT_H enum COLORS { BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LIGHTGRAY, DARKGRAY, LIGHTBLUE, LIGHTGREEN, LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE }; #define NONE -1 #define SINGLE_FRAME -1 #define DOUBLE_FRAME -2 #endif rott-20230810/rott/profile.h000066400000000000000000000014571446517470200155650ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _profile #define _profile #define PROFILE 0 #define PROFILETICS 2 #endif rott-20230810/rott/rottnet.h000066400000000000000000000040101446517470200156100ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ // rottnet.h #ifndef rottnet_public #define rottnet_public #include "develop.h" #define MAXNETNODES 14 // max computers in a game #if ( SHAREWARE == 1 ) #define MAXPLAYERS 5 // 5 players max + drones #else #define MAXPLAYERS 11 // 11 players max + drones #endif #define CMD_SEND 1 #define CMD_GET 2 #define CMD_OUTQUEBUFFERSIZE 3 #define CMD_INQUEBUFFERSIZE 4 #define ROTTCOM_ID 0x12345678l #define MAXPACKETSIZE 2048 #define MAXCOMBUFFERSIZE 2048 typedef struct { short intnum; // ROTT executes an int to send commands // communication between ROTT and the driver short command; // CMD_SEND or CMD_GET short remotenode; // dest for send, set by get (-1 = no packet) short datalength; // bytes in rottdata to be sent / bytes read // info specific to this node short consoleplayer; // 0-3 = player number short numplayers; // 1-4 short client; // 0 = server 1 = client short gametype; // 0 = modem 1 = network short ticstep; // 1 for every tic 2 for every other tic ... short remoteridicule; // 0 = remote ridicule is off 1= rr is on // packet data to be sent char data[MAXPACKETSIZE]; } rottcom_t; #define MODEM_GAME 0 #define NETWORK_GAME 1 #define ROTTLAUNCHER ("ROTT.EXE") extern rottcom_t * rottcom; #endif rott-20230810/rott/rt_actor.c000066400000000000000000011511551446517470200157370ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "rt_sound.h" #include "rt_door.h" #include "rt_ted.h" #include "rt_draw.h" #include "watcom.h" #include "z_zone.h" #include "w_wad.h" #include "lumpy.h" #include "gmove.h" #include "states.h" #include "rt_sqrt.h" #include "rt_stat.h" #include "sprites.h" #include "rt_actor.h" #include "rt_game.h" #include "rt_main.h" #include "rt_playr.h" #include "rt_util.h" #include "rt_rand.h" #include "rt_menu.h" #include "_rt_acto.h" #include "rt_cfg.h" #include "rt_floor.h" #include "engine.h" #include "develop.h" #include "rt_view.h" #include "isr.h" #include "rt_com.h" #include "rt_scale.h" #include "modexlib.h" #include "rt_net.h" #include "rt_msg.h" #include "fx_man.h" #define SGN(x) (((x) > 0)?(1):(-1)) #define WILEYBLITZCHANCE 20 #define GIBSOUND SD_GIBSPLASHSND #define ACTORTHUDSND SD_BODYLANDSND #define ACTORLANDSND SD_PLAYERLANDSND //========================== Global Variables =================================================== #define SHP(difficulty,ob) (starthitpoints[difficulty][ob->obclass]) #define CAP_OSCUROS_HITPOINTS(ob) \ { \ if (ob->hitpoints > (SHP(gamestate.difficulty,ob)<<1)) \ ob->hitpoints = (SHP(gamestate.difficulty,ob)<<1); \ } boolean ludicrousgibs=false; short colheight[15]; byte deathshapeoffset[8] = {0,7,7,8,8,9,8,7}; unsigned long MAXFUNCTION,MINFUNCTION,MAXSTATE,MINSTATE; objtype *PLAYER0MISSILE; objtype *SCREENEYE; objtype *FIRSTACTOR,*LASTACTOR; objtype *FIRSTFREE,*LASTFREE; objtype *lastactive,*firstactive,**objlist; objtype *firstareaactor[NUMAREAS+1],*lastareaactor[NUMAREAS+1]; int objcount; byte RANDOMACTORTYPE[10]; #if (SHAREWARE == 0) _2Dpoint SNAKEPATH[512]; #endif misc_stuff mstruct,*MISCVARS = &mstruct; int angletodir[ANGLES]; objtype *new; void *actorat[MAPSIZE][MAPSIZE]; exit_t playstate; void T_SlideDownScreen(objtype*); basic_actor_sounds BAS[NUMCLASSES+3] = {{0,0,0,0,0}, {0,0,0,0,0}, {0,SD_LOWGUARD1SEESND,SD_LOWGUARDFIRESND,SD_LOWGUARDOUCHSND,SD_LOWGUARD1DIESND}, {0,SD_HIGHGUARD1SEESND,SD_HIGHGUARDFIRESND,SD_HIGHGUARDOUCHSND,SD_HIGHGUARDDIESND}, {0,SD_OVERP1SEESND,SD_OVERPFIRESND,SD_OVERPOUCHSND,SD_OVERPDIESND}, {0,SD_STRIKE1SEESND,SD_STRIKEFIRESND,SD_STRIKEOUCHSND,SD_STRIKEDIESND}, {0,SD_BLITZ1SEESND,SD_BLITZFIRESND,SD_BLITZOUCHSND,SD_BLITZDIESND}, {0,SD_ENFORCERSEESND,SD_ENFORCERFIRESND,SD_ENFORCEROUCHSND,SD_ENFORCERDIESND} , {0,SD_MONKSEESND,SD_MONKGRABSND,SD_MONKOUCHSND,SD_MONKDIESND}, {0,SD_FIREMONKSEESND,SD_FIREMONKFIRESND,SD_FIREMONKOUCHSND,SD_FIREMONKDIESND}, {0,SD_ROBOTSEESND,SD_ROBOTFIRESND,0,SD_ROBOTDIESND}, //bosses {SD_DARIANSAY1,SD_DARIANSEESND,SD_DARIANFIRESND,0,SD_DARIANDIESND}, {SD_KRISTSAY1,SD_KRISTSEESND,SD_KRISTFIRESND,0,SD_KRISTDIESND}, {0,SD_NMESEESND,SD_NMEFIRE1SND,0,SD_NMEDIESND}, {SD_DARKMONKSAY1,SD_DARKMONKSEESND,SD_DARKMONKFIRE1SND,0,SD_DARKMONKDIESND}, {SD_SNAKESAY1,SD_SNAKESEESND,SD_SNAKESPITSND,0,SD_SNAKEDIESND}, //specials {0,SD_EMPLACEMENTSEESND,SD_EMPLACEMENTFIRESND,0,0}, {0,SD_ROBOTSEESND,SD_ROBOTFIRESND,0,SD_ROBOTDIESND}, //wallop {0,0,0,0,0}, //pillar {SD_FIREJETSND,0,0,0,0}, //firejet {SD_BLADESPINSND,0,0,0,0}, //blade {SD_CYLINDERMOVESND,0,0,0,0}, //crushcol {SD_BOULDERROLLSND,0,0,SD_BOULDERHITSND,0}, //boulder {SD_SPEARSTABSND,0,0,0,0}, //spear {0,0,0,0,0}, //gasgrate {SD_SPRINGBOARDSND,0,0,0,0}, //spring {0,0,0,0,0}, //shuriken {SD_FIREBALLSND,0,0,SD_FIREBALLHITSND,0}, //wallfire {0,0,0,0,0}, //net {SD_KRISTMINEBEEPSND,0,0,0,0}, //h_mine {0,0,0,0,0}, //grenade {0,0,0,0,0}, //fireball {0,0,0,0,0}, //dmfball {0,0,0,0,0}, //bigshuriken {0,0,0,0,0}, //missile {0,0,0,0,0}, //NMEsaucer {0,0,0,0,0}, //dm_weapon {0,0,0,0,0}, //dm_heatseek {0,0,0,0,0}, //dm_spit {SD_MISSILEFLYSND,0,SD_BAZOOKAFIRESND,SD_MISSILEHITSND,0}, {SD_MISSILEFLYSND,0,SD_FIREBOMBFIRESND,SD_MISSILEHITSND,0}, {SD_MISSILEFLYSND,0,SD_HEATSEEKFIRESND,SD_MISSILEHITSND,0}, {SD_MISSILEFLYSND,0,SD_DRUNKFIRESND,SD_MISSILEHITSND,0}, {SD_FLAMEWALLSND,0,SD_FLAMEWALLFIRESND,SD_FIREHITSND,0}, {SD_MISSILEFLYSND,0,SD_SPLITFIRESND,SD_MISSILEHITSND,0}, {SD_GRAVSND,0,SD_GRAVFIRESND,SD_GRAVHITSND,0}, {SD_GRAVSND,0,SD_GODMODEFIRESND,SD_GRAVHITSND,0} }; //========================== Local Variables ================================================== extern boolean dopefish; boolean Masterdisk; static objtype *SNAKEHEAD,*SNAKEEND,*PARTICLE_GENERATOR,*EXPLOSIONS; #if (SHAREWARE == 0) static int OLDTILEX,OLDTILEY; #endif static char *debugstr[] = { "inerttype", "player", "lowguard", "highguard", "overpatrol", "strikeguard", "blitzguard", "triadenforcer", "deathmonk", "dfiremonk", "roboguard", "b_darian", "b_heinrich", "b_darkmonk", "b_roboboss", "b_darksnake", "patrolgun", "wallop", "pillar", "firejet", "blade", "crushcol", "boulder", "spear", "gasgrate", "spring", "shuriken", "wallfire", "net", "h_mine", "grenade", "fireball", "dmfball", "bigshuriken", "missile", "NMEsaucer", "dm_weapon", "dm_heatseek", "dm_spit", "p_bazooka", "p_firebomb", "p_heatseek", "p_drunkmissile", "p_firewall", "p_splitmissile", "p_kes", "p_godball", "collectorobj" }; static int starthitpoints[4][NUMENEMIES+2] = {{0,0,30,35,50,40,45,425,200,200,100,1500,2500,3000,3000,-1,200,2}, {0,0,40,50,55,50,50,475,250,250,125,2300,3400,4500,3600,-1,250,2}, {0,0,50,65,60,60,60,525,275,300,150,2400,3600,5000,4500,-1,300,2}, {0,0,60,80,70,70,75,525,300,350,175,2800,3800,5900,4800,-1,350,2}}; static statobj_t *touchsprite = NULL; static const byte dirdiff[8][8] = {{0,1,2,3,4,3,2,1},{1,0,1,2,3,4,3,2}, {2,1,0,1,2,3,4,3},{3,2,1,0,1,2,3,4}, {4,3,2,1,0,1,2,3},{3,4,3,2,1,0,1,2}, {2,3,4,3,2,1,0,1},{1,2,3,4,3,2,1,0}}; static const byte dirorder[8][2] = {{southeast,northeast},{east,north}, {northeast,northwest},{north,west}, {northwest,southwest},{west,south}, {southwest,southeast},{south,east}}; #if (SHAREWARE == 0) static const byte dirdiff16[16][16] = { {0,1,2,3,4,5,6,7,8,7,6,5,4,3,2,1}, {1,0,1,2,3,4,5,6,7,8,7,6,5,4,3,2}, {2,1,0,1,2,3,4,5,6,7,8,7,6,5,4,3}, {3,2,1,0,1,2,3,4,5,6,7,8,7,6,5,4}, {4,3,2,1,0,1,2,3,4,5,6,7,8,7,6,5}, {5,4,3,2,1,0,1,2,3,4,5,6,7,8,7,6}, {6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,7}, {7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8}, {8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7}, {7,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6}, {6,7,8,7,6,5,4,3,2,1,0,1,2,3,4,5}, {5,6,7,8,7,6,5,4,3,2,1,0,1,2,3,4}, {4,5,6,7,8,7,6,5,4,3,2,1,0,1,2,3}, {3,4,5,6,7,8,7,6,5,4,3,2,1,0,1,2}, {2,3,4,5,6,7,8,7,6,5,4,3,2,1,0,1}, {1,2,3,4,5,6,7,8,7,6,5,4,3,2,1,0}}; #endif static const byte dirorder16[16][2] = { {15,1} , {0,2}, {1,3}, {2,4}, {3,5} , {4,6}, {5,7}, {6,8}, {7,9} , {8,10}, {9,11}, {10,12}, {11,13}, {12,14}, {13,15}, {14,0}}; //static byte opposite16[16] = {8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7}; #if (SHAREWARE == 0) static statetype * UPDATE_STATES[NUMSTATES][NUMENEMIES] = { {&s_lowgrdstand,&s_highgrdstand,&s_opstand,&s_strikestand, &s_blitzstand,&s_enforcerstand,&s_dmonkstand,&s_firemonkstand, &s_robogrdstand,&s_darianstand,&s_heinrichstand,NULL, &s_darkmonkstand,NULL,&s_gunstand,&s_wallstand}, {&s_lowgrdpath1,&s_highgrdpath1,&s_oppath1,&s_strikepath1, &s_blitzpath1,&s_enforcerpath1,&s_dmonkpath1,&s_firemonkpath1, &s_robogrdpath1,NULL,NULL,NULL, NULL,NULL,NULL,&s_wallpath}, {&s_lowgrdcollide,&s_highgrdcollide,&s_opcollide,&s_strikecollide, &s_blitzcollide,&s_enforcercollide,&s_dmonkcollide,&s_firemonkcollide, &s_robogrdcollide,&s_dariancollide,NULL,NULL, NULL,NULL,NULL,&s_wallcollide}, {&s_lowgrdcollide2,&s_highgrdcollide2,&s_opcollide2,&s_strikecollide2, &s_blitzcollide2,&s_enforcercollide2,&s_dmonkcollide2,&s_firemonkcollide2, &s_robogrdcollide2,&s_dariancollide2,NULL,NULL, NULL,NULL,NULL,&s_wallcollide}, {&s_lowgrdchase1,&s_highgrdchase1,&s_opchase1,&s_strikechase1, &s_blitzchase1,&s_enforcerchase1,&s_dmonkchase1,&s_firemonkchase1, NULL/*se1*/,&s_darianchase1,&s_heinrichchase,&s_NMEchase, &s_darkmonkchase1,NULL,&s_gunstand,&s_wallpath}, /* {&s_lowgrduse1,&s_highgrduse1,&s_opuse1,&s_strikeuse1, &s_blitzuse,&s_enforceruse1,NULL,NULL, NULL,&s_darianuse1,NULL,NULL, NULL,NULL,NULL,NULL},*/ {0}, {&s_lowgrdshoot1,&s_highgrdshoot1,&s_opshoot1,&s_strikeshoot1, &s_blitzshoot1,&s_enforcershoot1,NULL,&s_firemonkcast1, &s_robogrdshoot1,&s_darianshoot1,&s_heinrichshoot1,NULL, NULL,NULL,&s_gunfire1,&s_wallshoot}, {&s_lowgrddie1,&s_highgrddie1,&s_opdie1,&s_strikedie1, &s_blitzdie1,&s_enforcerdie1,&s_dmonkdie1,&s_firemonkdie1, &s_robogrddie1,&s_dariandie1,&s_heinrichdie1,&s_NMEdie, &s_darkmonkdie1,NULL,&s_gundie1,NULL}, {0}, {NULL,NULL,NULL,&s_strikewait, &s_blitzstand,&s_enforcerdie1,&s_dmonkdie1,&s_firemonkdie1, &s_robogrddie1,&s_dariandie1,&s_heinrichdie1,NULL, &s_darkmonkdie1,NULL,NULL,NULL}, {&s_lowgrdcrushed1,&s_highgrdcrushed1,&s_opcrushed1,&s_strikecrushed1, &s_blitzcrushed1,&s_enforcercrushed1,&s_dmonkcrushed1,&s_firemonkcrushed1, &s_robogrddie1,NULL,NULL,NULL, NULL,NULL,NULL,NULL} }; #else static statetype * UPDATE_STATES[NUMSTATES][NUMENEMIES] = { {&s_lowgrdstand,&s_highgrdstand,NULL,&s_strikestand, &s_blitzstand,&s_enforcerstand,NULL,NULL, &s_robogrdstand,NULL,NULL,NULL, NULL,NULL,NULL,NULL}, {&s_lowgrdpath1,&s_highgrdpath1,NULL,&s_strikepath1, &s_blitzpath1,&s_enforcerpath1,NULL,NULL, &s_robogrdpath1,NULL,NULL,NULL, NULL,NULL,NULL,NULL}, {&s_lowgrdcollide,&s_highgrdcollide,NULL,&s_strikecollide, &s_blitzcollide,&s_enforcercollide,NULL,NULL, NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL}, {&s_lowgrdcollide2,&s_highgrdcollide2,NULL,&s_strikecollide2, &s_blitzcollide2,&s_enforcercollide2,NULL,NULL, &s_robogrdcollide2,NULL,NULL,NULL, NULL,NULL,NULL,NULL}, {&s_lowgrdchase1,&s_highgrdchase1,NULL,&s_strikechase1, &s_blitzchase1,&s_enforcerchase1,NULL,NULL, NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL}, /* {&s_lowgrduse1,&s_highgrduse1,&s_opuse1,&s_strikeuse1, &s_blitzuse,&s_enforceruse1,NULL,NULL, NULL,&s_darianuse1,NULL,NULL, NULL,NULL,NULL,NULL},*/ {0}, {&s_lowgrdshoot1,&s_highgrdshoot1,NULL,&s_strikeshoot1, &s_blitzshoot1,&s_enforcershoot1,NULL,NULL, &s_robogrdshoot1,NULL,NULL,NULL, NULL,NULL,NULL,NULL}, {&s_lowgrddie1,&s_highgrddie1,NULL,&s_strikedie1, &s_blitzdie1,&s_enforcerdie1,NULL,NULL, &s_robogrddie1,NULL,NULL,NULL, NULL,NULL,NULL,NULL}, {0}, {NULL,NULL,NULL,&s_strikewait, &s_blitzstand,&s_enforcerdie1,NULL,NULL, &s_robogrddie1,NULL,NULL,NULL, NULL,NULL,NULL,NULL}, {&s_lowgrdcrushed1,&s_highgrdcrushed1,NULL,&s_strikecrushed1, &s_blitzcrushed1,&s_enforcercrushed1,NULL,NULL, &s_robogrddie1,NULL,NULL,NULL, NULL,NULL,NULL,NULL} }; #endif #define TABLE_ACTOR(ob) ((ob->obclass >= lowguardobj) && (ob->obclass <= wallopobj)) void T_Reset(objtype*ob); void ApplyGravity(objtype *ob); void BeginEnemyHurt(objtype *ob); void T_PlayDead(objtype *ob); void SpawnFirewall(objtype*ob,int which,int newz); void SelectKristChaseDir(objtype*ob); void ExplodeStatic(statobj_t*tempstat); void AvoidPlayerMissile(objtype*ob); int EnvironmentDamage(objtype *ob); static int STOPSPEED = 0x200; static int PLAYERFRICTION = 0xe000; static int ACTORFRICTION = 0xf000; static int DIAGADJUST = 0xb504; static boolean MissileSound = true; boolean FirstExplosionState(statetype *state) { if ((state == &s_explosion1) || (state == &s_grexplosion1) || (state == &s_staticexplosion1) ) return true; else return false; } void SetGibSpeed(int speed) { MISCVARS->gibspeed = speed; } void ResetGibSpeed(void) { MISCVARS->gibspeed = NORMALGIBSPEED; } int ValidAreanumber (int areanumber) { if ((areanumber >=0) && (areanumber <= NUMAREAS)) return 1; return 0; } int GetIndexForState (statetype * state) { int i; if (state == NULL) return -1; for (i=0;ishapenum = %d\n",state->shapenum); return -1; } statetype * GetStateForIndex (int index) { if (index == -1) return NULL; return statetable[index]; } statobj_t* GetStaticForIndex(int index) {statobj_t* temp; for(temp=FIRSTSTAT;temp;temp=temp->statnext) if (index == temp->whichstat) return temp; Error("Cannot find the static in 'GetStaticForIndex', statindex %d\n",index); return NULL; } void SaveActors(byte **buffer,int*size) {objtype*temp,*tact; saved_actor_type dummy; byte*tptr; int actorcount; for(actorcount=0,temp=FIRSTACTOR;temp;temp=temp->next) temp->whichactor = actorcount++; *size = sizeof(int) + sizeof(numplayers) + sizeof(misc_stuff) + objcount*sizeof(saved_actor_type); *buffer = (byte*)SafeMalloc(*size); tptr = *buffer; memcpy(tptr,MISCVARS,sizeof(misc_stuff)); tptr += sizeof(misc_stuff); memcpy(tptr,&numplayers,sizeof(numplayers)); tptr += sizeof(numplayers); memcpy(tptr,&consoleplayer,sizeof(consoleplayer)); tptr += sizeof(consoleplayer); for(temp=FIRSTACTOR;temp;temp=temp->next) {dummy.x = temp->x; dummy.y = temp->y; dummy.z = temp->z; dummy.flags = temp->flags; dummy.areanumber = temp->areanumber; //dummy.whichactor = temp->whichactor; dummy.hitpoints = temp->hitpoints; dummy.ticcount = temp->ticcount; dummy.obclass = (byte)(temp->obclass); dummy.stateindex = GetIndexForState(temp->state); dummy.shapeoffset = temp->shapeoffset; dummy.dirchoosetime = temp->dirchoosetime; dummy.door_to_open = temp->door_to_open; dummy.targetx = temp->targettilex; dummy.targety = temp->targettiley; dummy.dir = (signed char)temp->dir; dummy.angle = temp->angle; dummy.yzangle = temp->yzangle; dummy.speed = temp->speed; dummy.momentumx = temp->momentumx; dummy.momentumy = temp->momentumy; dummy.momentumz = temp->momentumz; dummy.temp1 = temp->temp1; dummy.temp2 = temp->temp2; dummy.temp3 = temp->temp3; if (temp->whatever) {/*if ((temp->flags & FL_USE) && (temp!=player)) {dummy.whateverindex = (GetIndexForState((statetype*)(temp->whatever))|SG_PSTATE); if ((dummy.whateverindex < 0) && (dummy.whateverindex != -1)) Error("Bad actor whatever save value of %d\n",dummy.whateverindex); } else*/ {tact = (objtype*)(temp->whatever); if (tact->which == ACTOR) dummy.whateverindex = tact->whichactor; else {statobj_t *tstat; tstat = (statobj_t*)(temp->whatever); dummy.whateverindex = (tstat->whichstat|SG_PSTAT); } } } else dummy.whateverindex = -1; if (temp->target) {tact = (objtype*)(temp->target); if (tact->which == ACTOR) {dummy.targetindex = tact->whichactor; Debug("\nsave actor %d, type %d has target %d",temp->whichactor,temp->obclass,tact->whichactor); } else if (tact->which == SPRITE) {statobj_t *tstat; tstat = (statobj_t*)(temp->target); dummy.targetindex = (tstat->whichstat|SG_PSTAT); } else // It must be a push wall, and we don't save that dummy.targetindex=-1; } else dummy.targetindex = -1; memcpy(tptr,&(dummy.x),sizeof(saved_actor_type)); tptr += sizeof(saved_actor_type); } } void LoadActors(byte *buffer,int size) { int numactors,i,playerindex; saved_actor_type dummy = {0}; objtype *temp; short *targetindices,*whateverindices; InitActorList(); memcpy(MISCVARS,buffer,sizeof(misc_stuff)); buffer += sizeof(misc_stuff); memcpy(&numplayers,buffer,sizeof(numplayers)); buffer += sizeof(numplayers); memcpy(&playerindex,buffer,sizeof(playerindex)); buffer += sizeof(playerindex); size -= (sizeof(misc_stuff)+sizeof(numplayers)+sizeof(playerindex)); numactors = size/sizeof(saved_actor_type); objlist = (objtype**)SafeMalloc(numactors*sizeof(objtype*)); targetindices = (short*)SafeMalloc(numactors*sizeof(short)); whateverindices = (short*)SafeMalloc(numactors*sizeof(short)); for(i=0;ix = dummy.x; //new->y = dummy.y; SetFinePosition(new,dummy.x,dummy.y); SetVisiblePosition(new,dummy.x,dummy.y); new->z = dummy.z; new->flags = dummy.flags; new->hitpoints = dummy.hitpoints; new->ticcount = dummy.ticcount; new->shapeoffset = dummy.shapeoffset; new->obclass = (classtype)(dummy.obclass); new->state = GetStateForIndex(dummy.stateindex); if (new->state == &s_superparticles) PARTICLE_GENERATOR = new; else if (new->state->think == T_SlideDownScreen) SCREENEYE = new; new->dirchoosetime = dummy.dirchoosetime; new->door_to_open = dummy.door_to_open; new->targettilex = dummy.targetx; new->targettiley = dummy.targety; new->dir = (dirtype)(dummy.dir); new->angle = dummy.angle; new->yzangle = dummy.yzangle; new->speed = dummy.speed; new->momentumx = dummy.momentumx; new->momentumy = dummy.momentumy; new->momentumz = dummy.momentumz; new->temp1 = dummy.temp1; new->temp2 = dummy.temp2; new->temp3 = dummy.temp3; if (dummy.whateverindex == -1) new->whatever = NULL; else if (dummy.whateverindex & SG_PSTAT) new->whatever = GetStaticForIndex(dummy.whateverindex & ~SG_PSTAT); else whateverindices[i] = dummy.whateverindex+1; if (dummy.targetindex == -1) new->target = NULL; else if (dummy.targetindex & SG_PSTAT) new->target = GetStaticForIndex(dummy.targetindex & ~SG_PSTAT); else { targetindices[i] = dummy.targetindex+1; Debug("\nload actor %d, type %d has target %d",i,new->obclass,dummy.targetindex); } new->areanumber = dummy.areanumber; new->shapenum = new->state->shapenum + new->shapeoffset; new->which = ACTOR; if (new->flags & FL_ABP) MakeActive(new); if (new->obclass != inertobj) MakeLastInArea(new); if (!(new->flags & (FL_NEVERMARK|FL_NONMARK))) actorat[new->tilex][new->tiley] = new; PreCacheActor(new->obclass,-1); buffer += sizeof(saved_actor_type); } // find unique links between actors, // searching list AFTER all have been spawned for(i=0;iwhatever = objlist[whateverindices[i]-1]; if (targetindices[i]) temp->target = objlist[targetindices[i]-1]; } for(temp=FIRSTACTOR;temp;temp=temp->next) {if (temp->obclass == b_darksnakeobj) {if (!SNAKEHEAD) SNAKEHEAD = temp; else if (!temp->whatever) SNAKEEND = temp; } } if (SNAKEHEAD) for(temp=FIRSTACTOR;temp;temp=temp->next) {if (temp->state == &s_megaexplosions) EXPLOSIONS = temp; } //SafeFree(objlist); SafeFree(targetindices); SafeFree(whateverindices); } int RandomSign(void) { if (GameRandomNumber("random sign",0) < 128) return -1; return 1; } void AddToFreeList(objtype*ob) { if (!FIRSTFREE) FIRSTFREE = ob; else {ob->prev = LASTFREE; LASTFREE->next = ob; } LASTFREE = ob; } void RemoveFromFreeList(objtype*ob) { if (ob == LASTFREE) LASTFREE = ob->prev; else ob->next->prev = ob->prev; if (ob == FIRSTFREE) FIRSTFREE = ob->next; else ob->prev->next = ob->next; ob->prev = NULL; ob->next = NULL; } void MakeActive(objtype *ob) {if ((ob == firstactive) || (ob->prevactive) || (ob->nextactive)) { SoftError("\ndouble make active try"); //AddEndGameCommand (); return; } if (!firstactive) firstactive = ob; else {ob->prevactive = lastactive; lastactive->nextactive = ob; } lastactive = ob; } void MakeLastInArea(objtype *ob) { if (!ValidAreanumber(ob->areanumber)) Error("\n ob type %s at %d,%d has illegal areanumber of %d", debugstr[ob->obclass],ob->tilex,ob->tiley,ob->areanumber); if ((ob == firstareaactor[ob->areanumber]) || (ob->previnarea) || (ob->nextinarea)) { SoftError("\ndouble make last in area try"); //AddEndGameCommand (); return; } if (!firstareaactor[ob->areanumber]) firstareaactor[ob->areanumber] = ob; else {ob->previnarea = lastareaactor[ob->areanumber]; lastareaactor[ob->areanumber]->nextinarea = ob; } lastareaactor[ob->areanumber] = ob; } void RemoveFromArea(objtype*ob) { if (!((ob == firstareaactor[ob->areanumber]) || (ob->previnarea) || (ob->nextinarea))) { SoftError("\ndouble remove from area try"); //AddEndGameCommand (); return; } if (ob == lastareaactor[ob->areanumber]) // remove from master list lastareaactor[ob->areanumber] = ob->previnarea; else ob->nextinarea->previnarea = ob->previnarea; if (ob == firstareaactor[ob->areanumber]) firstareaactor[ob->areanumber] = ob->nextinarea; else ob->previnarea->nextinarea = ob->nextinarea; ob->previnarea = NULL; ob->nextinarea = NULL; } void MakeInactive(objtype*ob) { if (!ACTIVE(ob)) // if (!((ob == firstactive) || (ob->prevactive) || (ob->nextactive))) { SoftError("\n trying to remove inactive object"); //AddEndGameCommand (); return; } //if (ob->flags & FL_ABP) { if (ob == lastactive) // remove from master list lastactive = ob->prevactive; else ob->nextactive->prevactive = ob->prevactive; if (ob == firstactive) firstactive = ob->nextactive; else ob->prevactive->nextactive = ob->nextactive; ob->prevactive = NULL; ob->nextactive = NULL; } } void A_Steal(objtype*ob) { int dx,dy,dz; ActorMovement(ob); dx = abs(ob->x - PLAYER[0]->x); dy = abs(ob->y - PLAYER[0]->y); dz = abs(ob->z - PLAYER[0]->z); if ((dx > TOUCHDIST) || (dy > TOUCHDIST) || (dz > (TOUCHDIST >> 10))) { NewState(ob,&s_blitzchase1); return; } if (ob->ticcount) return; SD_PlaySoundRTP(SD_BLITZSTEALSND,ob->x,ob->y); if (PLAYER[0]->flags & FL_GASMASK) { PLAYER[0]->flags &= ~FL_GASMASK; PLAYERSTATE[0].protectiontime = 1; ob->temp3 = stat_gasmask; GM_UpdateBonus (PLAYERSTATE[0].poweruptime, true); } else if(PLAYER[0]->flags & FL_BPV) { PLAYER[0]->flags &= ~FL_BPV; PLAYERSTATE[0].protectiontime = 1; ob->temp3 = stat_bulletproof; GM_UpdateBonus (PLAYERSTATE[0].poweruptime, true); } else if(PLAYER[0]->flags & FL_AV) { PLAYER[0]->flags &= ~FL_AV; PLAYERSTATE[0].protectiontime = 1; ob->temp3 = stat_asbesto; GM_UpdateBonus (PLAYERSTATE[0].poweruptime, true); } else if (PLAYERSTATE[0].missileweapon != -1) { NewState(PLAYER[0],&s_player); PLAYERSTATE[0].attackframe = PLAYERSTATE[0].weaponframe = 0; PLAYERSTATE[0].new_weapon = PLAYERSTATE[0].bulletweapon; ob->temp3 = GetItemForWeapon(PLAYERSTATE[0].missileweapon); ob->temp2 = PLAYERSTATE[0].ammo; //ob->temp1 = oldpolltime; PLAYERSTATE[0].ammo = -1; if (PLAYERSTATE[0].weapon == PLAYERSTATE[0].missileweapon) PLAYERSTATE[0].weapondowntics = WEAPONS[PLAYERSTATE[0].weapon].screenheight/GMOVE; PLAYERSTATE[0].missileweapon = -1; if ( SHOW_BOTTOM_STATUS_BAR() ) DrawBarAmmo (false); } } void FindAddresses(void) { int i; uintptr_t tstate,tfunct; MINFUNCTION = -1l; MAXFUNCTION = 0x00000000; MINSTATE = -1l; MAXSTATE = 0x00000000; for(i=0;i MAXSTATE) MAXSTATE = tstate; if (statetable[i]!=NULL) { tfunct = (uintptr_t)(statetable[i]->think); if (tfunct < MINFUNCTION) MINFUNCTION = tfunct; if (tfunct > MAXFUNCTION) MAXFUNCTION = tfunct; } } } void CheckBounds(objtype*ob) { uintptr_t tstate,tfunct; tstate = (uintptr_t)(ob->state); tfunct = (uintptr_t)(ob->state->think); if ((tfunct < MINFUNCTION) || (tfunct > MAXFUNCTION) || (tstate < MINSTATE) || (tstate > MAXSTATE)) { if (tfunct < MINFUNCTION) Error("%s has thinking function less than MINFUNCTION",debugstr[ob->obclass]); else if (tfunct > MAXFUNCTION) Error("%s has thinking function greater than MAXFUNCTION",debugstr[ob->obclass]); if (tstate < MINSTATE) Error("%s has state less than MINSTATE",debugstr[ob->obclass]); else if (tstate > MAXSTATE) Error("%s has state greater than MAXSTATE",debugstr[ob->obclass]); } } /*************************************************************/ /* ===================== = = DoActor = ===================== */ void DoActor (objtype *ob) { void (*think)(objtype *); int door; // for(i=0;istate == 0){return;} #endif ApplyGravity(ob); M_CheckDoor(ob); M_CheckBossSounds(ob); if ((ob->obclass >= b_darianobj) && (ob->obclass < b_darksnakeobj) && MISCVARS->REDTIME ) { MISCVARS->REDTIME --; MISCVARS->redindex = (MISCVARS->REDTIME & 15); } if (ob->obclass == playerobj) ControlPlayerObj(ob); think = ob->state->think; if (think) { //CheckBounds(ob); think (ob); if (!ob->state) { RemoveObj (ob); return; } } if (ob->ticcount) ob->ticcount --; else { if (!(ob->state->next)) { RemoveObj (ob); return; } else NewState(ob,ob->state->next); } if (ob->flags&FL_NEVERMARK) return; if ((ob->flags&FL_NONMARK) && actorat[ob->tilex][ob->tiley]) return; actorat[ob->tilex][ob->tiley] = ob; } void ApplyGravity(objtype *ob) { int oldmomentumz; if (((ob->momentumz) || (ob->z != nominalheight)) && (ob->obclass > playerobj) && ((ob->obclass <= roboguardobj) || (ob->obclass == collectorobj) || (ob->obclass == b_heinrichobj)) && (ob->state->think != T_Stand) ) { ob->z += (ob->momentumz>>16); ob->momentumz += GRAVITY; if (ob->z >= nominalheight) { ob->z = nominalheight; oldmomentumz = ob->momentumz; ob->momentumz = 0; if (oldmomentumz > 2*GRAVITY) { if (ob->flags & FL_DYING) SD_PlaySoundRTP(ACTORTHUDSND,ob->x,ob->y); else { int oldviolence = gamestate.violence; SD_PlaySoundRTP(ACTORLANDSND,ob->x,ob->y); gamestate.violence = vl_low; BeginEnemyHurt(ob); gamestate.violence = oldviolence; } } if (ob->flags&FL_FALLINGOBJECT) { RemoveObj(ob); return; } } } } /* =================== = = NewState = = Changes ob to a new state, setting ticcount to the max for that state = =================== */ void NewState (objtype *ob, statetype *newstate) { #if (BNACRASHPREVENT == 1)//crashed here when oscuro and larves were all killed if (ob == 0){return;} #endif ob->state = newstate; SetVisiblePosition(ob,ob->x,ob->y); #if (BNACRASHPREVENT == 1) if (ob->state == 0){return;} #endif ob->ticcount = (ob->state->tictime>>1); ob->shapenum = ob->state->shapenum + ob->shapeoffset; } /* ========================= = = InitActorList = = Call to clear out the actor object lists returning them all to the free = list. Allocates a special spot for the player. = ========================= */ void InitActorList (void) { //====== NETWORK STUFF ======================================= memset(&DEADPLAYER[0],0,sizeof(DEADPLAYER)); NUMDEAD = 0; //======= NULLIFY GLOBAL POINTERS ============================ LASTACTOR=FIRSTACTOR=NULL; FIRSTFREE = LASTFREE = NULL; firstactive = lastactive = NULL; memset(firstareaactor,0,sizeof(firstareaactor)); memset(lastareaactor,0,sizeof(lastareaactor)); NUMSPAWNLOCATIONS = 0; PARTICLE_GENERATOR = NULL; EXPLOSIONS = NULL; SNAKEEND=SNAKEHEAD=NULL; SCREENEYE = NULL; PLAYER0MISSILE = NULL; //============================================================ objcount = 0; memset(MISCVARS,0,sizeof(misc_stuff)); MISCVARS->gibgravity = -1; MISCVARS->gibspeed = NORMALGIBSPEED; memset(&RANDOMACTORTYPE[0],0,sizeof(RANDOMACTORTYPE)); FindAddresses(); MissileSound = true; Masterdisk = false; } //=========================================================================== /* ========================= = = GetNewActor = = Sets the global variable new to point to a free spot in objlist. = The free spot is inserted at the end of the liked list = = When the object list is full, the caller can either have it bomb out ot = return a dummy object pointer that will never get used = ========================= */ void GetNewActor (void) { objtype *temp; if (!FIRSTFREE) { temp = (objtype*)Z_LevelMalloc(sizeof(objtype),PU_LEVELSTRUCT,NULL); //SoftError("\nMalloc-ing actor"); //if (insetupgame) // SoftError("in setup"); } else { temp = LASTFREE; //SoftError("\nfree actor available"); RemoveFromFreeList(LASTFREE); } if (temp) { new = temp; memset(new,0,sizeof(*new)); if (FIRSTACTOR) { new->prev = LASTACTOR; LASTACTOR->next = new; } else FIRSTACTOR = new; LASTACTOR = new; new->door_to_open = -1; new->soundhandle = -1; objcount ++; } else Error("Z_LevelMalloc failed in GetNewActor"); } //=========================================================================== /* ========================= = = RemoveObj = = Add the given object back into the free list, and unlink it from it's = neighbors = ========================= */ void RemoveObj (objtype *gone) { if (gone == PLAYER[0]) Error ("RemoveObj: Tried to remove the player!"); gone->state=NULL; MakeInactive(gone); if (gone->obclass!=inertobj) { if (ValidAreanumber(gone->areanumber)) RemoveFromArea(gone); else Error("tried to remove an instance of %s with invalid areanumber %d",debugstr[gone->obclass],gone->areanumber); } if (gone == LASTACTOR) LASTACTOR = gone->prev; else gone->next->prev = gone->prev; if (gone == FIRSTACTOR) FIRSTACTOR = gone->next; else gone->prev->next = gone->next; if (gone == EXPLOSIONS) EXPLOSIONS = NULL; gone->next = NULL; gone->prev = NULL; // SoftError("\nremoving instance of %s",debugstr[gone->obclass]); if (actorat[gone->tilex][gone->tiley] == (void*)gone) actorat[gone->tilex][gone->tiley] = NULL; gone->flags |= FL_NEVERMARK; if (gone->flags & FL_TARGET) UnTargetActor(gone); //Add_To_Delete_Array(gone); //Z_Free(gone); AddToFreeList(gone); objcount--; } //============== World Physics Model Functions ========================= void ParseMomentum(objtype *ob,int angle) { ob->momentumx += FixedMul(ob->speed,costable[angle]); ob->momentumy -= FixedMul(ob->speed,sintable[angle]); } void Set_3D_Momenta(objtype *ob, int speed, int theta, int phi) { int _2Ddiag; ob->momentumz = -FixedMul(speed,sintable[phi]); _2Ddiag = FixedMul(speed,costable[phi]); ob->momentumx = FixedMul(_2Ddiag,costable[theta]); ob->momentumy = -FixedMul(_2Ddiag,sintable[theta]); } int AngleBetween(objtype *source,objtype*target) { int dx,dy; dx = target->x - source->x; dy = source->y - target->y; return (atan2_appx(dx,dy)); } void GetMomenta(objtype *target, objtype *source, int *newmomx, int *newmomy, int *newmomz, int magnitude ) { int angle,dx,dy,dz,yzangle,xydist,_2Ddiag; dx = target->x - source->x; dy = source->y - target->y; dz = source->z - target->z; xydist = FindDistance(dx,dy); angle = atan2_appx(dx,dy); yzangle = atan2_appx(xydist,(dz<<10)); _2Ddiag = FixedMul(magnitude,costable[yzangle]); *newmomz = -FixedMul(magnitude,sintable[yzangle]); *newmomx = FixedMul(_2Ddiag,costable[angle]); *newmomy = -FixedMul(_2Ddiag,sintable[angle]); } //======================================================================= void SpawnNewObj (unsigned tilex, unsigned tiley, statetype *state, classtype which) { int newarea; GetNewActor (); new->obclass = which; SetTilePosition(new,tilex,tiley); SetVisiblePosition(new,new->x,new->y); new->dir = nodir; new->which = ACTOR; if (FirstExplosionState(state)) new->flags |= (FL_NEVERMARK|FL_NOFRICTION); if ((which != inertobj) && (which != diskobj)) actorat[tilex][tiley] = new; newarea = AREANUMBER(tilex,tiley); if ((which <= springobj) && (which != inertobj)) { if (ValidAreanumber(newarea)) new->areanumber = newarea; else Error("illegal initial areanumber of %d for actor type %s" "trying to spawn at %d, %d",newarea,debugstr[which],tilex,tiley); } else new->areanumber = newarea; if ((which != inertobj) && (!Masterdisk)) MakeLastInArea(new); NewState(new,state); new->z = nominalheight; if (which==springobj) new->z+=2; } //==================================================================== void ConsiderAlternateActor(objtype *ob,classtype which) { if (((which >= lowguardobj) && (which <= blitzguardobj)) || (which == dfiremonkobj)) {if (GameRandomNumber("SpawnStand",which) < 128) {switch(which) {case lowguardobj: ob->shapeoffset = W_GetNumForName("MARSHOO1") - W_GetNumForName("LWGSHOO1"); break; case highguardobj: ob->shapeoffset = W_GetNumForName("HIGSHOO1") - W_GetNumForName("HG2SHOO1"); break; case overpatrolobj: ob->shapeoffset = W_GetNumForName("PATSHOO1") - W_GetNumForName("OBPSHOO1"); break; case strikeguardobj: ob->shapeoffset = W_GetNumForName("XYGSHOO1") - W_GetNumForName("ANGSHOO1"); break; /*case blitzguardobj: altstartlabel = "WIGSHOO1"; new->shapeoffset = 80; break;*/ case dfiremonkobj: ob->shapeoffset = W_GetNumForName("MRKKSH1") - W_GetNumForName("ALLKSH1"); break; default: ; } } } //if (new->shapeoffset) // {if (W_CheckNumForName(altstartlabel) == -1) // new->shapeoffset = 0; // } } /* =================== = = StandardEnemyInit = =================== */ void StandardEnemyInit(objtype *ob,int dir) { int zoffset; if ((ob->obclass == deathmonkobj) || (ob->obclass == dfiremonkobj)) ob->temp2 = DRAINTIME; else if ((ob->obclass == highguardobj) || (ob->obclass == triadenforcerobj)) ob->flags |= FL_HASAUTO; ob->hitpoints = starthitpoints[gamestate.difficulty][ob->obclass]; ob->dir = dir*2; ob->flags |= (FL_SHOOTABLE|FL_BLOCK); ob->speed = ENEMYRUNSPEED; ob->dirchoosetime = 0; ob->door_to_open = -1; zoffset = MAPSPOT(ob->tilex,ob->tiley,2); if ((zoffset&0xff00)==0xb000) Set_NewZ_to_MapValue(&(ob->z),zoffset,"standard enemy",ob->tilex,ob->tiley); else ob->z = PlatformHeight(ob->tilex,ob->tiley); } void ConsiderOutfittingBlitzguard(objtype *ob) { if ((GameRandomNumber("wiley blitzguard",0) < WILEYBLITZCHANCE) && (gamestate.difficulty >= gd_medium) ) { ob->temp3 = stat_bazooka; ob->temp2 = 3; } } /* =============== = = SpawnStand = =============== */ void SpawnStand (classtype which, int tilex, int tiley, int dir, int ambush) {statetype *temp; #if (SHAREWARE == 1) switch(which) { case overpatrolobj: case wallopobj: case deathmonkobj: case dfiremonkobj: case b_darianobj: case b_heinrichobj: case b_darkmonkobj: Error("\n%s actor at %d,%d not allowed in shareware !",debugstr[which],tilex,tiley); break; default: ; } #endif if ((which == lowguardobj) && (GameRandomNumber("SpawnStand",which) < 128)) which = blitzguardobj; if ((temp = UPDATE_STATES[STAND][which-lowguardobj]) != NULL) { SpawnNewObj(tilex,tiley,temp,which); if (!loadedgame) gamestate.killtotal++; if (ambush) new->flags |= FL_AMBUSH; StandardEnemyInit(new,dir); if (which == b_darkmonkobj) { new->flags |= (FL_NOFRICTION);//|FL_INVULNERABLE); new->speed = ENEMYRUNSPEED*2; } if (which == blitzguardobj) ConsiderOutfittingBlitzguard(new); if ((new->obclass >= lowguardobj) && (new->obclass <= dfiremonkobj)) RANDOMACTORTYPE[new->obclass]++; if (MAPSPOT(tilex,tiley,2) == 0xdead) { new->flags |= FL_KEYACTOR; MISCVARS->KEYACTORSLEFT++; } PreCacheActor(which,0); } //else //Error("NULL initialization error"); } /* =============== = = SpawnPatrol = =============== */ void SpawnPatrol (classtype which, int tilex, int tiley, int dir) {statetype *temp; int path=PATH; #if (SHAREWARE==1) switch(which) { case overpatrolobj: case wallopobj: case deathmonkobj: case dfiremonkobj: case b_darianobj: case b_heinrichobj: case b_darkmonkobj: Error("\n%s actor at %d,%d not allowed in shareware !",debugstr[which],tilex,tiley); break; default: ; } #endif if ((which == lowguardobj) && (GameRandomNumber("SpawnStand",which) < 128)) which = blitzguardobj; if ((temp= UPDATE_STATES[path][(int)(which-lowguardobj)]) != NULL) { SpawnNewObj(tilex,tiley,temp,which); if (!loadedgame) gamestate.killtotal++; StandardEnemyInit(new,dir); if ((which == wallopobj) || (which == roboguardobj)) {new->flags |= FL_NOFRICTION; //new->flags &= ~FL_SHOOTABLE; new->dir <<= 1; ParseMomentum(new,dirangle16[new->dir]); } else ParseMomentum(new,dirangle8[new->dir]); if (which == blitzguardobj) ConsiderOutfittingBlitzguard(new); if (MAPSPOT(tilex,tiley,2) == 0xdead) {new->flags |= FL_KEYACTOR; MISCVARS->KEYACTORSLEFT++; } PreCacheActor(which,0); } } //========================================================================== void SpawnDisk(int tilex, int tiley, int type, boolean master) {int zoffset; if (master == true) { Masterdisk = true; SpawnNewObj(tilex,tiley,&s_diskmaster,diskobj); Masterdisk = false; new->flags |= FL_MASTER; new->momentumz = -(DISKMOMZ << 16); new->flags |= FL_SYNCED; new->flags |= FL_NEVERMARK; new->temp1 = 1; //RemoveFromArea(new); } else { if (!type) { SpawnNewObj(tilex,tiley,&s_elevdisk,diskobj); new->momentumz = -(DISKMOMZ << 16); //new->flags |= FL_SYNCED; zoffset = MAPSPOT(tilex,tiley,2); if ((zoffset&0xff00)==0xb000) Set_NewZ_to_MapValue((fixed*)(&(new->temp2)),zoffset,"elev disk",tilex,tiley); else new->temp2 = 32; new->temp1 = 1; } else { SpawnNewObj(tilex,tiley,&s_pathdisk,diskobj); zoffset = MAPSPOT(tilex,tiley,2); if ((zoffset&0xff00)==0xb000) Set_NewZ_to_MapValue((fixed*)(&(new->z)),zoffset,"path disk",tilex,tiley); new->dir = (type-1) << 1; new->speed = 0x1000; //ParseMomentum(new,dirangle8[new->dir]); } actorat[tilex][tiley] = NULL; new->flags |= FL_BLOCK; new->flags |= (FL_NOFRICTION|FL_ACTIVE|FL_NEVERMARK); } } objtype* DiskAt(int tilex,int tiley) {int area; objtype *temp; statobj_t *tstat; area = AREANUMBER(tilex,tiley); for(temp = firstareaactor[area];temp;temp = temp->nextinarea) {if ((temp->tilex != tilex) || (temp->tiley != tiley) || (temp->obclass != diskobj)) continue; return temp; } for(tstat = firstactivestat;tstat;tstat = tstat->nextactive) { if ((tstat->tilex != tilex) || (tstat->tiley != tiley) || (tstat->itemnumber != stat_disk)) continue; return (objtype*)tstat; } return NULL; } void SetElevatorDiskVariables(objtype *ob,int newz, int newmomentumz, int newtemp1,int newtemp3,int newdirchoose) { ob->z = newz; ob->momentumz = newmomentumz; ob->temp1 = newtemp1; ob->temp3 = newtemp3; ob->dirchoosetime = newdirchoose; } void T_ElevDisk(objtype*ob) { objtype *temp = (objtype*)(actorat[ob->tilex][ob->tiley]); objtype *master; if (ob->flags & FL_MASTER) goto masterlabel; master = (objtype*)(ob->target); if (!master) Error("disk without master !"); //SoftError("\n ob->z:%d %s, master z:%d",ob->z, // (ob->flags & FL_SYNCED)?("SYNCED"):("UNSYNCED"),master->z); if (M_ISACTOR(temp) && (temp != ob) && (!(temp->flags & FL_DYING))) { int dz = abs(ob->z - temp->z), dx = abs(ob->x - temp->x), dy = abs(ob->y - temp->y); if ((dx < 0x7000) && (dy < 0x7000) && (dz < 68) && (temp->z > ob->z)) { ob->flags &= ~FL_SYNCED; return; } } if (master && (!(ob->flags & FL_SYNCED))) { int dz; dz = abs(master->z - ob->z); if ((dz > 0) && (dz < 8)) { SetElevatorDiskVariables(ob,master->z,master->momentumz,master->temp1, master->temp3,master->dirchoosetime); ob->flags |= FL_SYNCED; //return; } return; } masterlabel: if (ob->dirchoosetime) { ob->dirchoosetime --; return; } if (ob->temp1) // moving { ob->z += (ob->momentumz >> 16); if (ob->momentumz > 0) // down { if (ob->z >= nominalheight + 40 + DISKMOMZ) SetElevatorDiskVariables(ob,ob->z - (ob->momentumz>>16),0,0,0,35); } else { if (ob->z < ob->temp2) // temp2 has max height SetElevatorDiskVariables(ob,ob->z - (ob->momentumz>>16),0,0,1,35); } } else { if (ob->temp3) ob->momentumz = (DISKMOMZ << 16); else ob->momentumz = -(DISKMOMZ << 16); ob->temp1 = 1; } } void SpawnInertActor(int newx,int newy, int newz) { GetNewActor (); MakeActive(new); new->obclass = inertobj; new->which = ACTOR; SetFinePosition(new,newx,newy); SetVisiblePosition(new,new->x,new->y); new->z = newz; new->dir = 0; new->speed = 0; new->flags = (FL_NEVERMARK|FL_ABP); } #if (SHAREWARE == 0) void SpawnGroundExplosion(int x, int y, int z) { SpawnInertActor(x,y,z); NewState(new,&s_grexplosion1); new->temp2 = GameRandomNumber("SpawnGroundExplosion",0)>>2; } #endif void SpawnSlowParticles(int which, int numgibs, int x,int y,int z) {objtype *prevlast,*temp; int tilex,tiley; tilex = x>>16; tiley = y>>16; SpawnNewObj(tilex,tiley,&s_gibs1,inertobj); SetFinePosition(new,x,y); SetVisiblePosition(new,x,y); prevlast = new; prevlast->flags |= FL_ABP; MakeActive(prevlast); SpawnParticles(new,which,numgibs); for(temp = prevlast->next;temp;temp=temp->next) {temp->z = z; temp->momentumx >>= 1; temp->momentumy >>= 1; temp->momentumz >>= 1; } RemoveObj(prevlast); } void ResolveDoorSpace(int tilex,int tiley) { statobj_t* tstat,*temp; for(tstat = firstactivestat;tstat;) { temp = tstat->nextactive; if (tstat->flags & FL_DEADBODY) { if ((tstat->tilex == tilex) && (tstat->tiley == tiley)) { if ((tstat->flags & FL_DEADBODY) && (tstat->linked_to != -1)) DEADPLAYER[tstat->linked_to] = NULL; RemoveStatic(tstat); if (tstat->flags & FL_DEADBODY) SpawnSlowParticles(GUTS,8,tstat->x,tstat->y,tstat->z); else SpawnSlowParticles(gt_sparks,8,tstat->x,tstat->y,tstat->z); SD_PlaySoundRTP(SD_ACTORSQUISHSND,tstat->x,tstat->y); } } tstat = temp; } } void SpawnSpear(int tilex,int tiley,int up) { int count,i; statetype *tstate; if (BATTLEMODE && (!gamestate.BattleOptions.SpawnDangers)) return; if (!up) { #if (SHAREWARE == 1) Error("\ndownspear at %d,%d in shareware!",tilex,tiley); #else SpawnNewObj(tilex,tiley,&s_speardown1,spearobj); new->z = 0; #endif } else SpawnNewObj(tilex,tiley,&s_spearup1,spearobj); count = (int)(GameRandomNumber("Spawn Spear",0) % 16); for(i=0,tstate = new->state;inext); NewState(new,tstate); PreCacheActor(spearobj,up); new->flags |= (FL_ABP);//|FL_INVULNERABLE); MakeActive(new); } void SpawnSpring(int tilex,int tiley) { int iconvalue; iconvalue = MAPSPOT(tilex,tiley,2); if (iconvalue == 3) { SpawnNewObj(tilex,tiley,&s_autospring1,springobj); new->ticcount = (GameRandomNumber("Spawn Spring",0) % new->ticcount)+1; new->temp1 = iconvalue; } else { SpawnNewObj(tilex,tiley,&s_spring1,springobj); if (iconvalue == 2) new->temp1 = iconvalue; } PreCacheActor(springobj,0); new->flags &= ~(FL_SHOOTABLE|FL_BLOCK); } void T_Spring(objtype*ob) { objtype *temp; int op,dx,dy,dz; if ((ob->state->condition & SF_DOWN) && (ob->temp1)) { if (ob->ticcount) return; ob->shapenum++; TurnActorIntoSprite(ob); return; } for(temp=firstareaactor[ob->areanumber];temp;temp=temp->nextinarea) { if (temp == ob) continue; if (temp->obclass >= roboguardobj) continue; dx = abs(ob->x-temp->x); dy = abs(ob->y-temp->y); dz = abs(ob->z-temp->z); if ((dx > ACTORSIZE+0x2800) || (dy > ACTORSIZE+0x2800) || (dz > 40)) continue; if (!temp->momentumz) { op = FixedMul(GRAVITY,(temp->z-5)<<16) << 1; temp->momentumz = -FixedSqrtHP(op); SD_PlaySoundRTP(SD_SPRINGBOARDSND,ob->x,ob->y); } } } void T_Count(objtype*ob) { int index; touchplatetype *temp; objtype* tempactor; if (ob->dirchoosetime) { ob->dirchoosetime --; if (ob->dirchoosetime>980) MISCVARS->gasindex=((1050-ob->dirchoosetime)<<4)/70; else if (ob->dirchoosetime<35) MISCVARS->gasindex=(ob->dirchoosetime<<4)/35; if (ob->temp3) { ob->temp3 --; if (ob->temp3 & 1) SD_PlaySoundRTP(SD_GASHISSSND,ob->x,ob->y); } else { ob->temp3 = 105; for(tempactor=firstareaactor[ob->areanumber];tempactor;tempactor=tempactor->nextinarea) { if (tempactor == ob) continue; if (!(tempactor->flags & FL_SHOOTABLE)) continue; if (tempactor->obclass != playerobj) { if ((tempactor->obclass >= lowguardobj) && (tempactor->obclass <= dfiremonkobj)) { int oldviolence = gamestate.violence; gamestate.violence = vl_low; DamageThing(tempactor,EnvironmentDamage(ob)); Collision(tempactor,ob,-(tempactor->momentumx),-(tempactor->momentumy)); gamestate.violence = oldviolence; } } else if (!(tempactor->flags & FL_GASMASK)) { DamageThing(tempactor,EnvironmentDamage(ob)); Collision(tempactor,ob,0,0); M_CheckPlayerKilled(tempactor); } } } } else { int i; playertype *pstate; for(i=0;iflags &= ~FL_GASMASK; pstate->protectiontime = 1; } NewState(ob,&s_gas1); SD_PlaySoundRTP(SD_GASENDSND,ob->x,ob->y); ob->flags &= ~FL_ACTIVE; MISCVARS->gasindex=0; MU_StartSong(song_level); MU_RestoreSongPosition(); MISCVARS->GASON = 0; index = touchindices[ob->temp1][ob->temp2]-1; TRIGGER[index] = 0; for(temp = touchplate[index];temp;temp = temp->nextaction) if (temp->action == EnableObject) { tempactor = (objtype*)(temp->whichobj); tempactor->flags &= ~FL_ACTIVE; } } } void SpawnBlade(int tilex, int tiley,int dir,int upordown,int moving) {int count,i; statetype *nstate; #if (SHAREWARE == 1) if (!upordown) Error("\ndown spinblade at %d,%d not allowed in shareware !",tilex,tiley); if (moving) Error("\nupdown spinblade at %d,%d not allowed in shareware !",tilex,tiley); #endif if (BATTLEMODE && (!gamestate.BattleOptions.SpawnDangers)) return; if (moving) { #if (SHAREWARE == 0) if (upordown) SpawnNewObj(tilex,tiley,&s_spinupblade1,bladeobj); else {SpawnNewObj(tilex,tiley,&s_spindownblade1,bladeobj); new->z = 0; } #endif } else {if (upordown) SpawnNewObj(tilex,tiley,&s_upblade1,bladeobj); #if (SHAREWARE == 0) else {SpawnNewObj(tilex,tiley,&s_downblade1,bladeobj); new->z = 0; } #endif } count = (int)(GameRandomNumber("SpawnBlade",0) % 16); for(nstate=new->state,i=0;inext,i++); NewState(new,nstate); new->flags |= (FL_BLOCK); new->flags &= ~FL_SHOOTABLE; new->dir = dir; if (dir != nodir) {new->flags |= FL_NOFRICTION; new->speed = ENEMYRUNSPEED; } if (!MAPSPOT(tilex,tiley,2)) {new->flags |= FL_ACTIVE; ParseMomentum(new,dirangle8[new->dir]); } PreCacheActor(bladeobj,(moving<<1)+upordown); } void SpawnCrushingColumn(int tilex, int tiley, int upordown) {int i,count; statetype * nstate; #if (SHAREWARE == 1) if (!upordown) Error("\ncrush-up column at %d,%d not allowed in shareware!",tilex,tiley); #endif if (BATTLEMODE && (!gamestate.BattleOptions.SpawnDangers)) return; #if (SHAREWARE == 0) if (!upordown) SpawnNewObj(tilex,tiley,&s_columnupup1,crushcolobj); else #endif {SpawnNewObj(tilex,tiley,&s_columndowndown1,crushcolobj); new->z = 0; } count = (int)(GameRandomNumber("SpawnCrushingColumn",0) % 8); for(nstate=new->state,i=0;inext,i++) {if ((!upordown) && (nstate->condition & SF_UP)) new->temp1 += (((nstate->tictime>>1) + 1)<<2); } NewState(new,nstate); new->flags |= (FL_BLOCK); new->flags &= ~FL_SHOOTABLE; PreCacheActor(crushcolobj,upordown); } void SpawnFirejet(int tilex, int tiley, int dir, int upordown) { int statecount,i; statetype *tstate; statecount = (int)(GameRandomNumber("SpawnFirejet",0) % 22); if (upordown) { for(i=0,tstate=&s_firejetup1;inext); SpawnNewObj(tilex,tiley,tstate,firejetobj); } else { #if (SHAREWARE == 1) Error("\ndown firejet at %d,%d not allowed in shareware",tilex,tiley); #else for(i=0,tstate=&s_firejetdown1;inext); SpawnNewObj(tilex,tiley,tstate,firejetobj); new->z = 0; #endif } PreCacheActor(firejetobj,upordown); new->flags &= ~FL_SHOOTABLE; if (dir != nodir) { new->dir = dir*2; new->flags |= FL_NOFRICTION; new->speed = ENEMYRUNSPEED; ParseMomentum(new,dirangle8[new->dir]); } else new->dir = dir; } void SpawnFirebomb(objtype*ob,int damage,int which) { int i,low,high,doorat; wall_t *tempwall; doorobj_t*tempdoor; if (which == 0) { low = (ob->dir>>1); high = low; } else { low = 0; high = which-1; if ((FindDistance((ob->x-player->x), (ob->y-player->y))<0x120000) && (player->z==nominalheight) ) SHAKETICS = 35; } for (i=low;i<=high;i++) { MissileSound = false; /* if (((which == 0) && ((low == 5) || (low == 6))) || ((which == 6) && ((i==4) || (i==5))) ) { if (((which == 0) && (low == 5)) || ((which == 6) && (i == 4)) ) { newz = ob->z + 64; if (newz > maxheight) continue; SpawnMissile(ob,p_firebombobj,0,0,&s_grexplosion1,0); new->z = newz; new->dir = 10; } else { newz = ob->z - 64; if ((sky == 0) && (newz < 0)) continue; SpawnMissile(ob,p_firebombobj,0,0,&s_grexplosion1,0); new->z = newz; new->dir = 12; } } else */ { SpawnMissile(ob,p_firebombobj,0,dirangle8[2*i],&s_grexplosion1,0x10000); new->z = ob->z; new->dir = (i<<1); } MissileSound = true; SD_PlaySoundRTP(SD_EXPLODEFLOORSND,ob->x,ob->y); new->temp2 = FixedMul(damage,DIAGADJUST); tempwall = (wall_t*)actorat[new->tilex][new->tiley]; doorat= 0; if (M_ISDOOR(new->tilex,new->tiley)) { tempdoor = doorobjlist[tilemap[new->tilex][new->tiley]&0x3ff]; if (tempdoor->position<0x8000) doorat = 1; } if ((tempwall && M_ISWALL(tempwall)) || doorat || (new->tilex <=0) || (new->tilex > MAPSIZE-1) || (new->tiley <=0) || (new->tiley > MAPSIZE-1) ) { new->z = ob->z; SetFinePosition(new,ob->x,ob->y); SetVisiblePosition(new,ob->x,ob->y); } new->whatever = ob->whatever; new->temp3 = ob->temp3 - 1; } } void MissileHitActor(objtype *owner, objtype *missile, objtype *victim, int damage, int hitmomx, int hitmomy ) { int tcl = victim->obclass; int ocl = missile->obclass; if ( (victim->flags & FL_DYING) || // hey, they're dying already; (victim->flags & FL_HEAD) || // don't hurt overrobot's head, wheels (tcl == wallopobj) || // bcraft is invulnerable (tcl == b_darkmonkobj) || // darkmonk is invulnerable (!(victim->flags & FL_SHOOTABLE)) || // don't hurt environment dangers, dead guys ((tcl == b_darksnakeobj) && ((SNAKELEVEL != 3) || (!victim->temp3))// return for non-red snake ) ) return; if ((tcl == playerobj) || (tcl == b_heinrichobj)) victim->target = owner; if (tcl == NMEsaucerobj) // can shoot over's saucer { NewState(victim,&s_explosion1); victim->flags &= ~FL_SHOOTABLE; victim->temp2 = damage; return; } else if (tcl == roboguardobj) // check roboguard { DamageThing(victim,damage); Collision(victim,owner,0,0); } else if (tcl == collectorobj) { if (gamestate.SpawnEluder) return; DamageThing(victim,damage); Collision(victim,owner,0,0); } else if (tcl == patrolgunobj) { DamageThing(victim,damage); if (victim->hitpoints <= 0) { victim->momentumx = victim->momentumy = victim->momentumz = 0; victim->flags |= FL_DYING; if (victim->temp1 == -1) // this is 4-way gun NewState(victim,&s_robogrddie1); #if (SHAREWARE == 0) else // this is normal NewState(victim,&s_gundie1); #endif } } // bosses are "special" ========================== else if ((tcl >= b_darianobj) && (tcl < b_darkmonkobj)) { DamageThing(victim,damage); if (!(victim->flags & FL_ATTACKMODE)) FirstSighting (victim); // put into combat mode if (victim->hitpoints <= 0) { victim->momentumx = victim->momentumy = victim->momentumz = 0; victim->flags |= FL_DYING; NewState(victim,UPDATE_STATES[DIE][victim->obclass-lowguardobj]); switch (victim->obclass) { case b_darianobj: AddMessage("Darian defeated!",MSG_CHEAT); break; case b_heinrichobj: AddMessage("Krist defeated!",MSG_CHEAT); break; case b_robobossobj: AddMessage("NME defeated!",MSG_CHEAT); break; default: ; } MU_StartSong(song_bossdie); } #if (SHAREWARE == 0) else { MISCVARS->REDTIME = (damage >> 1); if (victim->obclass == b_heinrichobj) { NewState(victim,&s_heinrichdefend); if (Near(victim,PLAYER[0],3)) { MISCVARS->HRAMMING = 1; MISCVARS->HMINING = 0; victim->dirchoosetime = 0; } else { MISCVARS->HMINING = 1; MISCVARS->HRAMMING = 0; victim->dirchoosetime = 5;//10; } victim->targettilex = victim->targettiley = 0; victim->target = NULL; } } #endif } #if (SHAREWARE == 0) else if ((tcl == b_darksnakeobj) && (victim->temp3)) // red snake { DamageThing(SNAKEEND,damage); if (victim->state->think == T_DarkSnakeChase) NewState(victim,&s_redheadhit); else NewState(victim,&s_redlinkhit); victim->temp3 = 0; } #endif //=============================================== else // all other actors { if ((tcl == playerobj) && (victim->flags & FL_AV) && (ocl != p_godballobj) ) { playertype *pstate; M_LINKSTATE(victim,pstate); pstate->protectiontime -= ((damage<<1) + damage); if (pstate->protectiontime < 1) pstate->protectiontime = 1; if (victim==player) GM_UpdateBonus (pstate->protectiontime, false); return; // asbestos vest prevents victim damage } DamageThing(victim,damage); if ((tcl < roboguardobj) && (victim->hitpoints <= 0)) { if (ocl != p_godballobj) victim->flags |= FL_HBM; else victim->flags |= (FL_GODSTRUCK | FL_FULLLIGHT); } if (tcl == playerobj) { playertype *pstate; M_LINKSTATE(victim,pstate); if (pstate->health <= 0) { if (ocl != p_godballobj) victim->flags |= FL_HBM; else victim->flags |= (FL_GODSTRUCK | FL_FULLLIGHT); if (M_ISACTOR(owner)) { if (owner->obclass == playerobj) { if (!victim->momentumz) BATTLE_PlayerKilledPlayer(battle_kill_with_missile,owner->dirchoosetime,victim->dirchoosetime); else BATTLE_PlayerKilledPlayer(battle_kill_with_missile_in_air,owner->dirchoosetime,victim->dirchoosetime); } else BATTLE_CheckGameStatus(battle_player_killed,missile->dirchoosetime); } else BATTLE_CheckGameStatus(battle_player_killed,missile->dirchoosetime); } } if ((owner->obclass == playerobj) && (victim->flags & FL_HBM)) { MISCVARS->supergibflag = true; //GivePoints(starthitpoints[gamestate.difficulty][victim->obclass]*5); } Collision(victim,owner,hitmomx,hitmomy); MISCVARS->supergibflag = false; if ((tcl == blitzguardobj) && (owner->obclass == playerobj)) victim->flags |= FL_TARGET; } } void MissileHit (objtype *ob,void *hitwhat) { int damage=0, random,tcl=0,ocl,sound,hitmomx,hitmomy; objtype* tempactor=NULL,*owner; if (ob==missobj) missobj=NULL; if (ob == PLAYER0MISSILE) PLAYER0MISSILE = NULL; ob->momentumz = 0; hitmomx = ob->momentumx; hitmomy = ob->momentumy; if (ob->soundhandle != -1) SD_StopSound(ob->soundhandle); ob->flags &= ~FL_SHOOTABLE; if (FirstExplosionState(ob->state)) return; /* if ((ob->z < -28) || (IsWindow(ob->tilex,ob->tiley))) { NewState(ob,&s_megaremove); return; } */ tempactor = (objtype*)hitwhat; owner = (objtype*)(ob->whatever); random = GameRandomNumber("MissileHit",0); ocl = ob->obclass; if (tempactor) { if (tempactor->which == ACTOR) tcl = tempactor->obclass; else if (tempactor->which == SPRITE) tcl = -1; } if ((!tcl) && (ob->z < -30)) { if (ob->soundhandle != -1) SD_StopSound(ob->soundhandle); NewState(ob,&s_megaremove); return; } if (((ocl != p_kesobj) && (ocl != p_godballobj)) || (!tcl)) ZEROMOM; if (tcl == b_darianobj) MISCVARS->ESAU_SHOOTING = false; switch(ocl) { case p_bazookaobj: NewState(ob,&s_explosion1); if (M_ISACTOR(owner) && (owner->obclass == blitzguardobj)) damage = 30 + (random >> 4); else damage = 2*((random>>3)+80); break; case p_heatseekobj: NewState(ob,&s_explosion1); damage = 2*((random>>3)+50); break; case p_drunkmissileobj: NewState(ob,&s_explosion1); damage = ((random>>3)+25); break; case p_firebombobj: NewState(ob,&s_explosion1); damage = 2*((random>>3)+90); ob->temp3 = 4; SpawnFirebomb(ob,damage,4); break; case p_firewallobj: if (tcl == playerobj) gamestate.DOGROUNDZEROBONUS = true; NewState(ob,&s_explosion1); damage = 2*((random>>3)+50); break; case p_godballobj: if ((tcl >= pillarobj) || (!tcl) || ((tcl == -1) && (!(tempactor->flags & FL_SHOOTABLE)))) NewState(ob,&s_explosion1); ob->target = NULL; damage = 500; break; case shurikenobj: NewState(ob,&s_explosion1); damage = ((random >>3) + 30)>>2; break; case grenadeobj: NewState(ob,&s_explosion1); damage = (random >>3) + 20; break; case fireballobj: NewState(ob,&s_explosion1); damage = (random >> 3) + 10; break; case missileobj: NewState(ob,&s_explosion1); if (M_ISACTOR(owner) && (owner->obclass == wallopobj)) damage = (random >> 5); else damage = (random >>3) + 30; if (tcl && (tcl != b_heinrichobj)) damage = 3*damage>>3; break; case wallfireobj: if ((!tempactor) || (tempactor->which == ACTOR) || (tempactor->which == SPRITE) ) NewState(ob,&s_explosion1); else if (M_ISWALL(tempactor) || (tempactor->which == DOOR)) NewState(ob,&s_crossdone1); damage = EnvironmentDamage(ob); break; case inertobj: ob->state = NULL; return; break; #if (SHAREWARE == 0) case p_splitmissileobj: NewState(ob,&s_explosion1); damage = 2*((random>>3)+50); break; case p_kesobj: if ((tcl >= pillarobj) || (!tcl) || ((tcl == -1) && (!(tempactor->flags & FL_SHOOTABLE))) ) NewState(ob,&s_explosion1); damage = 2*((random>>3)+140); break; case netobj: ob->state=NULL; MISCVARS->NET_IN_FLIGHT = false; if (tempactor == PLAYER[0]) { if ((tempactor->flags & FL_GODMODE) || (tempactor->flags & FL_DOGMODE) || godmode ) damage = 0; else { damage = (random >>4) + 5; PLAYERSTATE[0].NETCAPTURED = -1; PLAYERSTATE[0].weapondowntics = WEAPONS[PLAYERSTATE[0].weapon].screenheight/GMOVE; NewState(PLAYER[0],&s_player); PLAYERSTATE[0].attackframe = PLAYERSTATE[0].weaponframe = 0; PLAYERSTATE[0].batblast = 0; if (PLAYERSTATE[0].HASKNIFE == false) AddMessage("Wiggle left and right to get out of net!", MSG_GAME); } } break; case bigshurikenobj: NewState(ob,&s_oshurikenhit1); if (owner->obclass == wallopobj) damage = (random >> 5); else damage = 4*((random >>3) + 30)/10; break; case dm_spitobj: NewState(ob,&s_spithit1); damage = 30; if (gamestate.difficulty == gd_hard) damage += 15; break; case dm_weaponobj: damage = 20; NewState(ob,&s_explosion1); break; case dm_heatseekobj: damage = 20; NewState(ob,&s_explosion1); break; case dmfballobj: NewState(ob,&s_explosion1); damage = (random >>3) + 20; break; case h_mineobj: NewState(ob,&s_explosion1); damage = (random >>3) + 20; break; case NMEsaucerobj: NewState(ob,&s_explosion1); damage = 2*((random>>3)+30); break; #endif //default: //Error("Unknown ob %d called MissileHit",ob->obclass); } //if (!ob->state) //return; if ((sound = BAS[ob->obclass].hit)!=0) SD_PlaySoundRTP(sound,ob->x,ob->y); if (FirstExplosionState(ob->state)) SD_PlaySoundRTP(SD_EXPLODESND,ob->x,ob->y); if (tcl>0) // actors { MissileHitActor(owner,ob,tempactor,damage,hitmomx,hitmomy); if ((ocl == p_kesobj) && (tcl < roboguardobj)) { tempactor->momentumx = hitmomx; // kes gives wus targets its momentum tempactor->momentumy = hitmomy; //missile->flags |= FL_NOFRICTION; } } else if (tcl < 0) // static { DamageThing(hitwhat,damage); if (FirstExplosionState(new->state)) new->whatever = ob->whatever; } } void T_Spears(objtype*ob) {int dx,dy,dz,i; for(i=0;iflags & FL_DYING) continue; dx = abs(PLAYER[i]->x - ob->x); dy = abs(PLAYER[i]->y - ob->y); dz = abs(PLAYER[i]->z - ob->z); if ((!ob->ticcount)&&(ob->state->condition&SF_SOUND) && areabyplayer[ob->areanumber]) SD_PlaySoundRTP(BAS[ob->obclass].operate,ob->x,ob->y); if ((dx < STANDDIST) && (dy < STANDDIST) && (dz < 20)) {ob->flags &= ~FL_BLOCK; if ((!ob->ticcount) && (ob->state->condition & SF_CRUSH)) {DamageThing(PLAYER[i],EnvironmentDamage(ob)); Collision(PLAYER[i],ob,0,0); M_CheckPlayerKilled(PLAYER[i]); return; } } else {if (ob->state->condition & SF_DOWN) ob->flags &= ~FL_BLOCK; else ob->flags |= FL_BLOCK; } } } void T_CrushUp(objtype*ob) {int dx, dy,dist,dz,i; if ((!ob->ticcount) && (ob->state->condition & SF_SOUND) && areabyplayer[ob->areanumber]) SD_PlaySoundRTP(BAS[ob->obclass].operate,ob->x,ob->y); dist = ACTORSIZE+0x2000; if (ob->state->condition & SF_UP) {ob->temp1 += 4; // Debug("\ncol momz = 4"); } else if (ob->state->condition & SF_DOWN) {ob->temp1 -= 4; // Debug("\ncol mom z = -4"); } else {//ob->momentumz = 0; // Debug("\ncol mom z = 0"); } ob->temp2 = maxheight - ob->temp1 + 32; for(i=0;ix - ob->x); dy = abs(PLAYER[i]->y - ob->y); dz = abs(ob->temp2-PLAYER[i]->z); if ((dx < dist) && (dy < dist) && (dz < 65)) {ob->flags &= ~FL_BLOCK; //player->temp2 = 0; if ((!ob->ticcount) && (ob->state->condition & SF_CRUSH) && (levelheight<2) && (!(ob->flags & FL_DYING))) {DamageThing(PLAYER[i],EnvironmentDamage(ob)); if (PLAYER[i]->hitpoints <= 0) PLAYER[i]->flags |= FL_HBM; Collision(PLAYER[i],ob,0,0); M_CheckPlayerKilled(PLAYER[i]); //NewState(ob,ob->state); //reset ticcount return; } if (ob->state->condition & SF_UP) { PLAYER[i]->momentumz = -(4<<16); if (PLAYER[i]->z < -30) PLAYER[i]->z = -30; } else if (ob->state->condition & SF_DOWN) {PLAYER[i]->momentumz = (4<<16); if (PLAYER[i]->z >= nominalheight) PLAYER[i]->z = nominalheight; } else PLAYER[i]->momentumz = 0; PLAYER[i]->whatever = ob; ob->whatever = PLAYER[i]; //PLAYER[i]->flags |= FL_RIDING; } } {if (ob->state->condition & SF_BLOCK) ob->flags |= FL_BLOCK; else ob->flags &= ~FL_BLOCK; } } void T_CrushDown(objtype*ob) {int dx,dy,dz,i; if ((!ob->ticcount) && (ob->state->condition & SF_SOUND)&& areabyplayer[ob->areanumber]) SD_PlaySoundRTP(BAS[ob->obclass].operate,ob->x,ob->y); ob->temp2 = ob->z; for(i=0;ix - ob->x); dy = abs(PLAYER[i]->y - ob->y); dz = abs(PLAYER[i]->z - ob->z); if ((dx < STANDDIST) && (dy < STANDDIST) && (dz < 20)) {//PLAYER[i]->temp2 = 0; ob->flags &= ~FL_BLOCK; if ((!ob->ticcount) && (ob->state->condition & SF_CRUSH) && (!(ob->flags & FL_DYING))) {DamageThing(PLAYER[i],EnvironmentDamage(ob)); if (PLAYER[i]->hitpoints <= 0) PLAYER[i]->flags |= FL_HBM; Collision(PLAYER[i],ob,0,0); M_CheckPlayerKilled(PLAYER[i]); //NewState(ob,ob->state); //reset ticcount return; } if ((ob->state->condition & SF_DOWN) && ((ob->state != &s_columndowndown1) && (ob->state != s_columndowndown1.next))) {PLAYER[i]->temp2 = COLUMNCRUSH; PLAYER[i]->whatever = ob; } } } {if (ob->state->condition & SF_BLOCK) ob->flags |= FL_BLOCK; else ob->flags &= ~FL_BLOCK; } } void T_Explosion(objtype* ob) { int momx,momy,momz; int dx,dy,dz; int pdamage,dist,blastradius=0x20000, fatalradius=0x9000,impulse,damage, scalefactor; statobj_t* checkstat; objtype* check,*owner; if (ob->ticcount) return; damage = EXPLOSION_DAMAGE; owner = (objtype*)(ob->whatever); if ((ob->temp3) && (ob->obclass == p_firebombobj)) { SpawnFirebomb(ob,damage,0); ob->temp3 = 0; } //================== check surrounding actors ============================// for(check = firstactive;check;check=check->nextactive) { if (check == ob) continue; // if (check == owner) // continue; dx = abs(check->x - ob->x); if (dx > blastradius) continue; dy = abs(ob->y - check->y); if (dy > blastradius) continue; dz = ((abs(ob->z - check->z))<<10); if (dz > blastradius) continue; if (check->flags & FL_HEAD) continue; if (check->flags & FL_DYING) continue; if (!(check->flags & FL_SHOOTABLE)) continue; if ((check->obclass >= roboguardobj) && (check->obclass != b_darkmonkobj)) //(check->obclass <= wallopobj)) continue; if (!CheckLine(ob,check,SIGHT)) continue; if (check->obclass == NMEsaucerobj) { NewState(check,&s_explosion1); check->flags &= ~FL_SHOOTABLE; return; } //#if 0 //magdx = abs(dx); //magdy = abs(dy); dist = Find_3D_Distance(dx,dy,dz); SoftError("\ndist: %x\n",dist); //if (dist < 0x10000) // dist = 0x10000; scalefactor = FixedDiv2(1<<16,FixedMul(dist,dist)); //scalefactor = FixedDiv2(1<<16,dist); if (scalefactor > 0x12000) scalefactor = 0x12000; pdamage = FixedMul(damage,scalefactor); SoftError("\ndamage: %d, scalefactor: %x\n",pdamage,scalefactor); //#endif impulse = FixedMul(EXPLOSION_IMPULSE,scalefactor); if (check->obclass == playerobj) { check->target = owner; if (check->flags & FL_AV) pdamage = 0; } if (check->obclass < roboguardobj) { SoftError("\nhitpoints before: %d",check->hitpoints); DamageThing(check,pdamage); SoftError("\nhitpoints after: %d",check->hitpoints); if ((check->hitpoints <= 0) && (gamestate.violence == vl_excessive) && ((ob->obclass == p_firebombobj) || ((dx < fatalradius) && (dy < fatalradius) && (dz < 20))) ) check->flags |= FL_HBM; GetMomenta(check,ob,&momx,&momy,&momz,impulse); //Debug("\nhitmomx = %d, hitmomy = %d",momx,momy); /*if (M_ISACTOR(owner) && (owner->obclass == playerobj) && (check->hitpoints <=0) ) GivePoints(starthitpoints[gamestate.difficulty][check->obclass]*5); */ Collision(check,owner,momx,momy); check->momentumz += (momz<<6); if ((check->obclass == playerobj) && (check->flags & FL_DYING) && M_ISACTOR(owner)) { if (owner->obclass == playerobj) { if (check->z != nominalheight) BATTLE_PlayerKilledPlayer(battle_kill_with_missile_in_air,owner->dirchoosetime,check->dirchoosetime); else BATTLE_PlayerKilledPlayer(battle_kill_with_missile,owner->dirchoosetime,check->dirchoosetime); } else BATTLE_CheckGameStatus(battle_player_killed,check->dirchoosetime); } } else { if (check->obclass != b_darkmonkobj) { SoftError("non-darkmonk actor %d being helped by explosion",check->obclass); } check->hitpoints += pdamage; } } //======================== check surrounding statics ================ for(checkstat = firstactivestat;checkstat;checkstat=checkstat->nextactive) { if ((!(checkstat->flags & FL_SHOOTABLE)) && (checkstat->itemnumber != stat_priestporridge)) continue; if ((checkstat->itemnumber >= stat_lifeitem1) && (checkstat->itemnumber <= stat_lifeitem4)) continue; dx = abs(checkstat->x - ob->x); dy = abs(checkstat->y - ob->y); dz = ((abs(checkstat->z - ob->z))<<10); if ((dx < blastradius) && (dy < blastradius) && (dz < blastradius)) { dist = Find_3D_Distance(dx,dy,dz)+0xc00; if (dist < 0x10000) dist = 0x10000; scalefactor = FixedDiv2(1<<16,FixedMul(dist,dist)); pdamage = FixedMul(damage,scalefactor); if (checkstat->itemnumber != stat_priestporridge) DamageThing(checkstat,pdamage); else if (!(checkstat->flags & FL_ACTIVE)) { checkstat->flags |= FL_ACTIVE; checkstat->count = 1; //checkstat->numanims = 6; SD_PlaySoundRTP(SD_COOKHEALTHSND,ob->x,ob->y); } } } //======================== check surrounding walls ================ { int tilexlow,tilexhigh; int tileylow,tileyhigh; int radius =0x10000; int x,y; tilexlow = (int)((ob->x-radius) >>TILESHIFT); tileylow = (int)((ob->y-radius) >>TILESHIFT); tilexhigh = (int)((ob->x+radius) >>TILESHIFT); tileyhigh = (int)((ob->y+radius) >>TILESHIFT); for (y=tileylow;y<=tileyhigh;y++) { for (x=tilexlow;x<=tilexhigh;x++) { if ((tilemap[x][y]&0x8000) && (tilemap[x][y]&0x4000) && (abs(ob->z - nominalheight) < 32)) { maskedwallobj_t * mw; mw=maskobjlist[tilemap[x][y]&0x3ff]; if (mw->flags&MW_SHOOTABLE) UpdateMaskedWall(tilemap[x][y]&0x3ff); } } } } } void SpawnScreenEye(objtype *ob) { SpawnNewObj(ob->tilex,ob->tiley,&s_eye1,inertobj); new->targettiley = 0; new->targettilex = GameRandomNumber("eye position",0) + 20; SCREENEYE = new; //RemoveFromArea(new); new->flags |= FL_ABP; MakeActive(new); } void SpawnSuperFatalityGibs(objtype *ob,objtype *attacker) { int crazygibs = (GameRandomNumber("crazy gibs",0) % 6) + 4; int i; if ((MISCVARS->supergibflag == true) && ((crazygibs == 9) || (ludicrousgibs == true)) ) { int olddirect = MISCVARS->directgibs; MISCVARS->directgibs = false; if (ludicrousgibs == false) { if (attacker == player) { AddMessage("Ludicrous Gibs!",MSG_GAME); if (!(attacker->flags&FL_DOGMODE)) SD_Play(PlayerSnds[locplayerstate->player]); } } else { MISCVARS->randgibspeed = true; // SpawnParticles(ob,GUTS,75); //MED SpawnParticles(ob,GUTS,150); MISCVARS->randgibspeed = false; } SpawnParticles(ob,GUTS,40); MISCVARS->directgibs = olddirect; } for (i=gt_head;i<=crazygibs;i++) { if (((ob->obclass == dfiremonkobj) || (ob->obclass == deathmonkobj)) && (i == gt_leg) ) SpawnParticles(ob,gt_arm,1); else SpawnParticles(ob,i,1); } } boolean Vicious_Annihilation(objtype *ob, objtype *attacker) { if ((ob->flags & FL_HBM) && (gamestate.violence >= vl_high)) { ob->shapeoffset = 0; ob->flags &= ~FL_FULLLIGHT; NewState(ob,(ob->obclass == playerobj)?(&s_remoteguts1):(&s_guts1)); SD_PlaySoundRTP(SD_ACTORSQUISHSND,ob->x,ob->y); if (gamestate.violence == vl_excessive) { int numgibs; objtype *prevlast; numgibs = (GameRandomNumber("excessive guts",0) & 7) + 4; //SoftError("\nnumgibs = %d,gamestate.difficulty = %d",numgibs,gamestate.difficulty); prevlast = LASTACTOR; MISCVARS->fulllightgibs = true; SpawnParticles(ob,GUTS,numgibs); MISCVARS->fulllightgibs = false; for(prevlast = prevlast->next;prevlast;prevlast = prevlast->next) prevlast->momentumz += (prevlast->momentumz >> 1); if ((GameRandomNumber("super gib chance",0) < 100) || (ludicrousgibs == true) ) { MISCVARS->directgibs = true; //MED MISCVARS->gibgravity = GRAVITY/2; // MISCVARS->gibgravity = GRAVITY*2; MISCVARS->fulllightgibs = true; SpawnSuperFatalityGibs(ob,attacker); MISCVARS->fulllightgibs = false; MISCVARS->gibgravity = -1; MISCVARS->directgibs = false; } } return true; } if (ob->flags & FL_GODSTRUCK) { ob->shapeoffset = 0; ob->flags |= (FL_FULLLIGHT); ob->flags &= ~FL_COLORED; ob->momentumx = ob->momentumy = ob->momentumz = 0; KillActor(ob); NewState(ob,&s_vaporized1); return true; } if (ob->flags & FL_SKELETON) { KillActor(ob); ob->shapeoffset = 0; ob->flags &= ~FL_COLORED; ob->momentumx = ob->momentumy = ob->momentumz = 0; NewState(ob,&s_skeleton1); SD_PlaySoundRTP(SD_ACTORBURNEDSND,ob->x,ob->y); return true; } return false; } /* ======================== = = BeginEnemyFatality = ======================== */ void BeginEnemyFatality(objtype *ob,objtype *attacker) { if ((attacker == player) && (ob->obclass < (NUMENEMIES + 2))) { GivePoints(starthitpoints[gamestate.difficulty][ob->obclass]*5); if (timelimitenabled) timelimit+=VBLCOUNTER; } ob->flags |= FL_DYING; ob->soundhandle = -1; if (Vicious_Annihilation(ob,attacker)) return; if ((ob->obclass == patrolgunobj) && (ob->temp1 == -1)) NewState(ob,&s_robogrddie1); else if (ob->obclass == collectorobj) { if ((!M_ISACTOR(attacker)) || (attacker->obclass != playerobj)) RespawnEluder(); else BATTLE_CheckGameStatus(battle_shot_deluder,attacker->dirchoosetime); NewState(ob,&s_explosion1); MISCVARS->gibgravity = GRAVITY/2; MISCVARS->fulllightgibs = true; SpawnParticles(ob,gt_sparks,100); MISCVARS->fulllightgibs = false; MISCVARS->gibgravity = -1; } else { statetype *temp; if ((ob->obclass == blitzguardobj) && (ob->state->condition & SF_FAKING) ) { NewState(ob,&s_blitzstruggledie1); ob->flags &= ~FL_FULLLIGHT; } else if ((ob->obclass == blitzguardobj) && (ob->state->condition & SF_DOWN) ) { NewState(ob,&s_blitzplead7); ob->flags &= ~FL_FULLLIGHT; } else if ((temp= M_S(DIE)) != NULL) { if (LOW_VIOLENCE_DEATH_SHOULD_BE_SET(ob)) SET_DEATH_SHAPEOFFSET(ob); NewState(ob,temp); ob->flags &= ~FL_FULLLIGHT; } else Error("Null dead state called in Collision, obclass %d",ob->obclass); } } /* ======================== = = BeginPlayerFatality = ======================== */ void BeginPlayerFatality(objtype *ob,objtype *attacker) { playertype *pstate; M_LINKSTATE(ob,pstate); ob->flags &= ~(FL_ELASTO|FL_GODMODE|FL_DOGMODE|FL_NOFRICTION|FL_RIDING); ob->flags |= FL_DYING; pstate->weapon = -1; if (BATTLEMODE) SD_PlaySoundRTP (SD_PLAYERTCDEATHSND+(pstate->player),ob->x,ob->y); if (Vicious_Annihilation(ob,attacker) == false) { if (LOW_VIOLENCE_DEATH_SHOULD_BE_SET(ob)) SET_DEATH_SHAPEOFFSET(ob); NewState(ob,&s_remotedie1); ob->flags &= ~FL_FULLLIGHT; } } /* ======================== = = BeginEnemyHurt = ======================== */ void BeginEnemyHurt(objtype *ob) { statetype *temp; if ((temp= M_S(COLLIDE1)) != NULL) { if ((ob->obclass == blitzguardobj) && (ob->state->condition & SF_FAKING) ) { ob->temp1 = 1; ob->dirchoosetime = 0; T_PlayDead(ob); } else { if ((ob->obclass == triadenforcerobj) && (GameRandomNumber("george pain chance",0) < (50 + (gamestate.difficulty<<6)) ) ) { ob->flags &= ~FL_FULLLIGHT; return; } if (LOW_VIOLENCE_PAIN_SHOULD_BE_SET(ob)) SET_PAIN_SHAPEOFFSET(ob); if (GameRandomNumber("Collision",0) < 128) NewState(ob,temp); else NewState(ob,M_S(COLLIDE2)); } ob->flags &= ~FL_FULLLIGHT; ob->ticcount = PAINTIME; if (ob->obclass == strikeguardobj) ob->ticcount >>= 1; } } void Collision(objtype*ob,objtype *attacker,int hitmomentumx,int hitmomentumy) { int ocl; if ((!(ob->flags & FL_SHOOTABLE)) || (ob->flags & FL_DYING)) return; ocl = ob->obclass; ob->momentumx += hitmomentumx; ob->momentumy += hitmomentumy; if ((ocl == playerobj) && (gamestate.battlemode == battle_Eluder)) return; //insertion 5 if (ocl != playerobj) { if ((!(ob->flags & FL_ATTACKMODE)) && (TABLE_ACTOR(ob))) ActivateEnemy(ob); if (ob->hitpoints <= 0) BeginEnemyFatality(ob,attacker); else if (ocl != roboguardobj)// && (ob->state->think != T_Collide)) BeginEnemyHurt(ob); } else { playertype *pstate; if ((ob->flags & FL_GODMODE) || (ob->flags & FL_DOGMODE) || godmode) return; M_LINKSTATE(ob,pstate); if (pstate->health<=0) BeginPlayerFatality(ob,attacker); else ob->flags |= FL_PAIN; } } void T_BossExplosions(objtype*ob) { if (ob->temp1) {if (ob->dirchoosetime) ob->dirchoosetime --; else {int randtime,randangle,randdist,sound; statetype *nstate; ob->temp1 --; randtime = GameRandomNumber("Boss Explosion Time",0); ob->dirchoosetime = 10; if (randtime < 128) ob->dirchoosetime >>= 1; randangle = (GameRandomNumber("Boss Explosion Angle",0) << 3); randdist = (GameRandomNumber("Boss Explosion Distance",0) << 7)+0x4000; sound = SD_EXPLODEFLOORSND; if (randtime < 128) {nstate = &s_explosion1; sound++; } #if (SHAREWARE == 0) else nstate = &s_grexplosion1; #endif SpawnMissile(ob,inertobj,0,randangle,nstate,randdist); SD_PlaySoundRTP(sound,new->x,new->y); } } } gib_t RandomGutsType(void) { int rand = GameRandomNumber("gut random",0); if (rand < 128) return gt_organ; //if (rand < 160) return gt_rib; //return gt_pinkorgan; } //MED void SpawnParticles(objtype*ob,int which,int numparticles) { int randphi,randtheta,i,nspeed; boolean eyespawned = false; int gibtype; int randadj; if ((ob->z <= -64) && (sky == 0)) //shouldn't happen return; if (((which == GUTS) || (which == RANDOM)) && (gamestate.violence < vl_high)) which = gt_sparks; gibtype = which; for(i=0;i> 4); if (ob->z > (nominalheight - 32)) randphi &= ((ANGLES/2) - 1); randtheta = (GameRandomNumber("particle generate theta",0) << 3); nspeed = MISCVARS->gibspeed; if (which == RANDOM) { if (GameRandomNumber("random gib",0) < 128) gibtype = RandomGutsType(); else gibtype = gt_sparks; } if ((which == GUTS) || (which == DISEMBOWEL)) { gibtype = RandomGutsType(); if (which == DISEMBOWEL) { randphi>>=2; randtheta=ob->temp1+(randtheta>>3)-(randtheta>>4); } } if ( // (gibtype >= gt_organ) && (gibtype <= gt_limb) && (MISCVARS->numgibs >= MAXGIBS) ) return; if (gibtype == gt_lsoul) { SpawnNewObj(ob->tilex,ob->tiley,&s_littlesoul,inertobj); randphi = 0; } #if (SHAREWARE == 0) else if (gibtype == gt_spit) SpawnNewObj(ob->tilex,ob->tiley,&s_slop1,inertobj); #endif else { SpawnNewObj(ob->tilex,ob->tiley,&s_gibs1,inertobj); new->shapeoffset = gibtype*12; NewState(new,new->state); } if (MISCVARS->directgibs == true) { int dx,dy,dz; dx = PLAYER[0]->x - ob->x; dy = ob->y - PLAYER[0]->y; randtheta = AngleBetween(ob,PLAYER[0]) + (randadj<<4); dz = 100 + (randadj<<3); //MED // nspeed = 0x2800 + (randadj<<7); nspeed = 0x2800; randphi = atan2_appx(FindDistance(dx,dy),dz<<10); } if ((eyespawned == false) && (which == GUTS) && (ob->obclass != playerobj) ) { eyespawned = true; new->flags |= FL_EYEBALL; } if ((gibtype >= gt_organ) && (gibtype <= gt_limb)) { new->dirchoosetime = GIBVALUE; MISCVARS->numgibs ++; } new->temp2 = gibtype; new->temp3 = (MISCVARS->gibgravity == -1)?(GRAVITY):(MISCVARS->gibgravity); new->speed = nspeed>>1; // if (MISCVARS->randgibspeed == true) // new->speed += (randadj << 11); //if (ob->state == &s_snakefireworks) new->z = ob->z; Fix(randphi); Fix(randtheta); Set_3D_Momenta(new,new->speed,randtheta,randphi); new->momentumz <<= 6; new->flags |= (FL_NOFRICTION|FL_CRAZY|FL_ABP|FL_NEVERMARK); if (MISCVARS->fulllightgibs == true) new->flags |= FL_FULLLIGHT; new->dir = west; new->whatever = ob; MakeActive(new); } } void T_SlideDownScreen(objtype *ob) { ob->targettiley += 12; if (ob->targettiley > 300) { NewState(ob,&s_megaremove); SCREENEYE = NULL; } } void T_SpawnSoul(objtype*ob) { if (ob->ticcount) return; SpawnNewObj(ob->tilex,ob->tiley,&s_bigsoul,inertobj); new->momentumz = -4000; new->flags |= (FL_NOFRICTION|FL_CRAZY|FL_ABP|FL_NEVERMARK); new->z = ob->z; new->dir = west; MakeActive(new); SpawnParticles(ob,gt_lsoul,6); } void BloodDrip(objtype *ob,int tilex,int tiley) {int dx,dy,x = 0,y = 0,scale; dx = ob->tilex - tilex; dy = ob->tiley - tiley; if (!dy) { scale = (ob->momentumx)?(FixedDiv2(ob->momentumy,ob->momentumx)):(0); x = (dx < 0)?(tilex << 16):((tilex+1) << 16); y = FixedMul(x - ob->x,scale) + ob->y; } else if (!dx) { scale = (ob->momentumy)?(FixedDiv2(ob->momentumx,ob->momentumy)):(0); y = (dy < 0)?(tiley << 16):((tiley+1) << 16); x = FixedMul(y - ob->y,scale) + ob->x; } ob->temp2 = (GameRandomNumber("BloodDrip",0) << 9) + 0xc000; ob->temp1 = (ob->z<<16); SetFinePosition(ob,x,y); ob->shapeoffset = 0; NewState(ob,&s_blooddrip1); } void T_BloodFall(objtype*ob) { ob->temp1 += ob->temp2; ob->z = (ob->temp1 >> 16); if (ob->z >= maxheight) { ob->shapeoffset = 12; MISCVARS->numgibs--; NewState(ob,&s_gibsdone1); ob->z = nominalheight; } } void T_Xylophone(objtype*ob) { if (!ob->ticcount) SD_PlaySoundRTP(SD_ACTORSKELETONSND,ob->x,ob->y); } void T_ParticleGenerate(objtype*ob) { if (ob->dirchoosetime) ob->dirchoosetime--; else { SetGibSpeed(0x3000); SpawnParticles(ob,gt_sparks,(GameRandomNumber("particle count",0) % 10) + 7); ResetGibSpeed(); ob->dirchoosetime = 10; if (GameRandomNumber("particle generator choose time",0) < 128) ob->dirchoosetime >>= 1; } } void T_Particle(objtype*ob) {int dx,dy,dz; ob->z += (ob->momentumz>>16); if ((ob->z >= nominalheight) || (!ob->momentumz)) { if (ob->z >= nominalheight) ob->z = nominalheight; //done: if (ob->temp2 == gt_spit) ob->state = NULL; else { if (ob->dirchoosetime == GIBVALUE) { MISCVARS->numgibs--; SD_PlaySoundRTP(GIBSOUND,ob->x,ob->y); } NewState(ob,&s_gibsdone1); } return; } else if ((ob->z < -64) && (sky == 0)) { ob->momentumz = 1; //any positive value will do ob->z = -64; } ob->momentumz += ob->temp3; ActorMovement(ob); if (!BATTLEMODE) { dx = abs(ob->x - PLAYER[0]->x); dy = abs(ob->y - PLAYER[0]->y); dz = abs(ob->z - PLAYER[0]->z); #if (SHAREWARE==0) if ((ob->flags & FL_EYEBALL) && (dx < 0x20000) && (dy < 0x20000) && (dz < 64) && (GameRandomNumber("eye chance",0) < 15) && (SCREENEYE == NULL) && (locplayerstate->weapon != wp_dog) ) #else if ((ob->flags & FL_EYEBALL) && (dx < 0x20000) && (dy < 0x20000) && (dz < 64) && (GameRandomNumber("eye chance",0) < 15) && (SCREENEYE == NULL) ) #endif SpawnScreenEye(ob); } //MoveActor(ob); //if ((!ob->momentumx) && (!ob->momentumy)) //goto done; } void DropItemInEmptyTile(int item,int tilex,int tiley) { int stilex = tilex; int stiley = tiley; FindEmptyTile(&stilex,&stiley); SpawnStatic(stilex,stiley,item,9); LASTSTAT->flags |= FL_ABP; MakeStatActive(LASTSTAT); } void KillActor(objtype*ob) {int ocl; ocl = ob->obclass; //GivePoints(starthitpoints[gamestate.difficulty][ob->obclass]*5); if ((ocl == highguardobj) && (GameRandomNumber("Drop mp40 chance",0) < 25)) { DropItemInEmptyTile(stat_mp40,ob->tilex,ob->tiley); } else if ((ocl == blitzguardobj) && (ob->temp3)) { DropItemInEmptyTile(ob->temp3,ob->tilex,ob->tiley); LASTSTAT->ammo = ob->temp2; } if (actorat[ob->tilex][ob->tiley] == (void*)ob) actorat[ob->tilex][ob->tiley] = NULL; gamestate.killcount++; ob->flags &= ~FL_SHOOTABLE; ob->flags &= ~FL_BLOCK; ob->flags |= FL_NEVERMARK; #if (SHAREWARE == 0) if (ocl == b_darksnakeobj) {if (ob == SNAKEHEAD) {SpawnNewObj(ob->tilex,ob->tiley,&s_megaexplosions,inertobj); new->temp1 = 7000; new->flags |= FL_ABP; EXPLOSIONS = new; NewState(ob,&s_darkmonkheaddie1); MakeActive(new); ob->dirchoosetime = 0; } else {objtype *temp; SNAKEEND = (objtype*)(ob->target); SNAKEEND->whatever = NULL; NewState(ob,&s_explosion1); for(temp=SNAKEHEAD;temp;temp = (objtype*)(temp->whatever)) temp->speed += 0x500; } } else #endif {ob->whatever = NULL; if (ob->obclass!=playerobj) ob->target = NULL; } if ((ob->flags & FL_KEYACTOR) && (ocl!=playerobj) && (ocl != blitzguardobj)) {MISCVARS->KEYACTORSLEFT --; if (!MISCVARS->KEYACTORSLEFT) {SpawnNewObj(ob->tilex,ob->tiley,&s_timekeeper,inertobj); new->flags |= FL_ABP; MakeActive(new); } } } void T_End(objtype *ob) { if (ob->ticcount) return; if (MAPSPOT(0,5,2) == LASTLEVELVALUE) playstate = ex_gameover; else playstate = ex_bossdied; } void T_Convert(objtype*ob) { if (ob->ticcount) return; if (ob->obclass == playerobj) { if (ob->state == &s_vaporized8) { T_SpawnSoul(ob); NewState(ob,&s_voidwait); } else if (ob->state == &s_skeleton48) { playertype *pstate; M_LINKSTATE(ob,pstate); if ((pstate->falling == true) || (!ob->momentumz) ) NewState(ob,&s_ashwait); else CheckPlayerSpecials(ob); } } else { if (ob->state == &s_vaporized8) T_SpawnSoul(ob); else if (ob->state == &s_skeleton48) TurnActorIntoSprite(ob); } } void TurnActorIntoSprite(objtype *ob) {statobj_t*temp; objtype *tactor; if (!firstemptystat) temp = (statobj_t*)Z_LevelMalloc(sizeof(statobj_t),PU_LEVELSTRUCT,NULL); else {temp = lastemptystat; //SoftError("\nfree actor available"); RemoveFromFreeStaticList(lastemptystat); } if (temp) { if ((ob->obclass == blitzguardobj) && ((ob->flags & FL_PLEADING) || (ob->flags & FL_UNDEAD)) ) MISCVARS->NUMBEGGINGKEVINS = 0; if (ob->obclass == roboguardobj) {for(tactor=firstareaactor[ob->areanumber];tactor;tactor=tactor->nextinarea) {if (tactor == ob) continue; if (tactor->obclass != ob->obclass) continue; if (tactor->flags & FL_DYING) continue; if (!tactor->state->think) NewState(tactor,UPDATE_STATES[PATH][tactor->obclass-lowguardobj]); } } memset(temp,0,sizeof(*temp)); temp->shapenum = ob->shapenum; temp->linked_to = -1; temp->whichstat = statcount ++; SetFinePosition(temp,ob->x,ob->y); temp->areanumber = MAPSPOT(temp->tilex,temp->tiley,0)-AREATILE; // if ((temp->areanumbers<=0) || (temp->areanumber>NUMAREAS)) // Error ("Sprite at x=%ld y=%ld type=%ld has an illegal areanumber\n",tilex,tiley,mtype); temp->visspot = &spotvis[temp->tilex][temp->tiley]; temp->which = SPRITE; temp->itemnumber = -1; temp->flags = FL_DEADBODY; if (ob->flags & FL_COLORED) {playertype *pstate; M_LINKSTATE(ob,pstate); temp->flags |= FL_COLORED; temp->hitpoints = pstate->uniformcolor; } temp->z = ob->z; AddStatic(temp); // sprites[temp->tilex][temp->tiley] = temp; if (areabyplayer[temp->areanumber]) {temp->flags |= FL_ABP; MakeStatActive(temp); } if (ob->state != &s_guts12) actorat[ob->tilex][ob->tiley] = temp; ob->state = NULL; // say goodbye actor } else Error("Z_LevelMalloc failed in TurnActorIntoSprite!"); } void T_Blood(objtype*ob) { if (ob->dirchoosetime) {ob->dirchoosetime --; return; } ob->dirchoosetime = 35 + (GameRandomNumber("blood time",0) % 20); NewState(ob,&s_deadblood1); } void ActorDeath(objtype*ob) { #if (SHAREWARE == 0) if (ob->obclass == b_heinrichobj) { KillActor(ob); ob->temp1 = ob->dirchoosetime = 5;//10; // init. spin counter for heinrich ob->temp3 = 7; //number of times to stay at fast spin ob->temp2 = ob->dir; //temp2 holds orig. dir. } else if (ob->obclass == b_robobossobj) { objtype *wheels,*head; head = (objtype*)(ob->whatever); wheels = (objtype*)(ob->target); head->flags &= ~(FL_HEAD|FL_SHOOTABLE|FL_BLOCK); head->temp2 = 5; head->flags |= (FL_NOFRICTION|FL_CRAZY); // head->obclass = inertobj; //RemoveObj(wheels); // remove wheels KillActor(ob); ob->whatever = head; ob->target = wheels; //ob->temp1 = 25; //ob->shapeoffset = 0; SpawnNewObj(ob->tilex,ob->tiley,&s_megaexplosions,inertobj); new->temp1 = 18; new->flags |= FL_ABP; MakeActive(new); //ob->state = NULL; NewState(ob,&s_NMEdeathbuildup); } else #endif if ((ob->state == ob->state->next) && (ob->flags & FL_DYING) ) { KillActor(ob); TurnActorIntoSprite(ob); if (LASTSTAT->z < nominalheight) { if ((!IsPlatform(LASTSTAT->tilex,LASTSTAT->tiley)) && (DiskAt(LASTSTAT->tilex,LASTSTAT->tiley) == NULL) ) { SpawnParticles(ob,GUTS,10 + gamestate.difficulty); RemoveStatic(LASTSTAT); } } /* else if ((GameRandomNumber("blood spray",0) < 300) && areabyplayer[ob->areanumber]) {ob->shapeoffset = 0; ob->temp2 = ob->temp3 = 0; ob->temp1 = 10; NewState(ob,&s_deadblood1); return; } */ } } void BeginPostPainAction(objtype *ob) { if ((ob->obclass == strikeguardobj) && (ob->target == (void*)PLAYER[0]) ) {//ob->target = NULL; if (LOW_VIOLENCE_DEATH_IS_SET(ob)) RESET_DEATH_SHAPEOFFSET(ob); if (GameRandomNumber("T_Collide",0) < 128) NewState(ob,&s_strikerollright1); else NewState(ob,&s_strikerollleft1); SelectRollDir(ob); if (ob->dirchoosetime) { SD_PlaySoundRTP(SD_STRIKEROLLSND,ob->x,ob->y); return; } } if (LOW_VIOLENCE_PAIN_IS_SET(ob)) RESET_PAIN_SHAPEOFFSET(ob); if (ob->obclass < roboguardobj) ob->flags &= ~FL_NOFRICTION; if ( (ob->obclass == blitzguardobj) && (gamestate.violence == vl_excessive) && (GameRandomNumber("blitzplead",0) < 128) && (MISCVARS->NUMBEGGINGKEVINS == 0) && (ob->flags & FL_TARGET) && (ob->hitpoints < (starthitpoints[gamestate.difficulty][ob->obclass] >> 1)) && (ob->momentumz == 0) && (!(ob->flags & FL_UNDEAD)) ) { NewState(ob,&s_blitzplead1); MISCVARS->NUMBEGGINGKEVINS = 1; ob->momentumx = ob->momentumy = 0; ob->flags |= FL_PLEADING; ob->flags &= ~FL_TARGET; ob->dirchoosetime = 165; ob->hitpoints = 1; } else { NewState(ob,M_S(CHASE)); ob->targettilex = ob->targettiley = 0; ob->dirchoosetime = 0; } } void T_Collide(objtype*ob) { if (!(ob->flags & FL_SHOOTABLE)) return; ActorMovement(ob); if (ob->state == NULL) return; if (ob->ticcount) return; if (ob->hitpoints <= 0) { if ((ob->soundhandle == -1) && (!ob->ticcount) && (ob->state->next->tictime == 0) ) { ob->soundhandle = SD_PlaySoundRTP(ACTORTHUDSND,ob->x,ob->y); } if (ob->momentumx || ob->momentumy || ob->momentumz) return; ActorDeath(ob); return; } BeginPostPainAction(ob); } /* ========================================================================= = = Special Blitzguard Functions = ========================================================================= */ /* ================= = = T_Plead = ================= */ void T_Plead(objtype*ob) { int handle; ActorMovement(ob); if (ob->dirchoosetime) { if (!(ob->dirchoosetime & 31)) { int random = GameRandomNumber("blitz plead sound",0); if (random < 80) SD_PlaySoundRTP(SD_BLITZPLEADSND,ob->x,ob->y); else if (random < 160) SD_PlaySoundRTP(SD_BLITZPLEAD1SND,ob->x,ob->y); else SD_PlaySoundRTP(SD_BLITZPLEAD2SND,ob->x,ob->y); } ob->dirchoosetime --; return; } ob->hitpoints = (starthitpoints[gamestate.difficulty][blitzguardobj]>>1); //ob->flags |= FL_DYING; ob->flags |= FL_UNDEAD; SET_DEATH_SHAPEOFFSET(ob); NewState(ob,&s_blitzfakedie1); ob->flags &= ~FL_PLEADING; ob->dirchoosetime = (GameRandomNumber("blitz fake time",0) >> 2) + 70; handle = SD_PlaySoundRTP(SD_BLITZOUCHSND,ob->x,ob->y); SD_SetSoundPitch (handle,-500); ob->temp1 = 0; ob->temp1 = (GameRandomNumber("blitz visible rise",0) < 60); } /* ================= = = T_ReallyDead = ================= */ void T_ReallyDead(objtype *ob) { ActorMovement(ob); if ((!ob->ticcount) && (LOW_VIOLENCE_DEATH_SHOULD_BE_SET(ob))) SET_DEATH_SHAPEOFFSET(ob); } /* ================= = = T_PlayDead = ================= */ void T_PlayDead(objtype *ob) { int dangle; ob->flags &= ~FL_DYING; ActorMovement(ob); if (ob->dirchoosetime) { ob->dirchoosetime--; return; } dangle = abs(player->angle - AngleBetween(player,ob)); if (dangle > ANGLES/2) dangle = ANGLES - dangle; if (ob->temp1 || (dangle > ANGLES/4)) { if (LOW_VIOLENCE_DEATH_IS_SET(ob)) RESET_DEATH_SHAPEOFFSET(ob); ob->temp1 = 0; NewState(ob,&s_blitzrise2); } } void AdjustAngle(int maxadjust, short int *currangle,int targetangle) { int dangle,i,magangle; for(i=0;i (ANGLES/2)) { if (dangle > 0) (*currangle) ++; else (*currangle) --; } else { if (dangle > 0) (*currangle) --; else (*currangle) ++; } Fix(*currangle); } } } void ResolveMinimumDistance(objtype *heatseeker, objtype *potential_target, int *currmin) { int currdist,angle,magangle; currdist = FindDistance((heatseeker->x-potential_target->x), (heatseeker->y-potential_target->y)); angle = AngleBetween(heatseeker,potential_target); if (heatseeker->obclass != p_godballobj) { magangle = abs(heatseeker->angle - angle); if (magangle > VANG180) magangle = ANGLES - magangle; if (magangle > ANGLESDIV8) return; } if (currdist > LOOKAHEAD) return; if (currdist < (*currmin)) { *currmin = currdist; heatseeker->target = potential_target; } } void HeatSeek(objtype*ob) {int xydist; int mindist; objtype* tactor; objtype* owner; statobj_t* tstat; int angle,dz,yzangle,adjust; int dx,dy; owner=(objtype *)ob->whatever; if (ob->dirchoosetime) ob->dirchoosetime --; else { if (!ob->target) {mindist = 0x7fffffff; for (tactor=firstactive;tactor;tactor=tactor->nextactive) { if (tactor == owner) continue; if (tactor->flags & FL_HEAD) continue; if ((tactor == ob) || (!(tactor->flags & FL_SHOOTABLE)) || (tactor->flags & FL_DYING)) continue; if (!CheckLine(ob,tactor,SIGHT)) continue; if ((tactor->obclass == bladeobj) || (tactor->obclass == NMEsaucerobj)) continue; ResolveMinimumDistance(ob,tactor,&mindist); } if (ob->obclass != p_godballobj) { for(tstat=firstactivestat;tstat;tstat=tstat->nextactive) { if (!(tstat->flags & FL_HEAT)) continue; if (!CheckLine(ob,tstat,SHOOT)) continue; ResolveMinimumDistance(ob,(objtype*)tstat,&mindist); } } if (!ob->target) ob->dirchoosetime = 5; } else //if (ob->target != owner) { tactor = (objtype*)ob->target; if ((!tactor->nextactive) && (!tactor->prevactive)) { ob->target = NULL; return; } dx = tactor->x - ob->x; dy = ob->y - tactor->y; dz = ob->z - tactor->z; //xydist = FixedSqrtHP((FixedMul(dx,dx) + FixedMul(dy,dy))>>16); xydist = FindDistance(dx,dy); angle = atan2_appx(dx,dy); adjust = (ob->obclass == p_godballobj)?(GODHAPT):(HAAPT); AdjustAngle(adjust,&(ob->angle),angle); ob->dir = angletodir[ob->angle]; ob->momentumx = FixedMul(ob->speed,costable[ob->angle]); ob->momentumy = -FixedMul(ob->speed,sintable[ob->angle]); yzangle = atan2_appx(xydist,(dz<<10)); adjust = (ob->obclass == p_godballobj)?(GODVAPT):(VAAPT); AdjustAngle(adjust,&(ob->yzangle),yzangle); ob->momentumz = -(FixedMul(ob->speed,sintable[ob->yzangle])); } } } void Stagger(objtype*ob) { int randadj; randadj = (int)(GameRandomNumber("Stagger",1) >> 3); if (!ob->dirchoosetime) { ob->momentumz = ob->temp1 + (RandomSign() << 12); ob->dirchoosetime = 6; } else ob->dirchoosetime --; if ((ob->z + (ob->momentumz >> 10)) > (maxheight-12)) ob->momentumz = -ob->momentumz; else if ((ob->z < 5) && (!sky)) ob->z = 5; ob->angle += (RandomSign()*randadj); Fix(ob->angle); ob->momentumx = FixedMul(ob->speed,costable[ob->angle]); ob->momentumy = -FixedMul(ob->speed,sintable[ob->angle]); ob->dir = angletodir[ob->angle]; } void SpawnSplit(objtype *ob,int angle) { Fix(angle); SpawnMissile(ob,p_heatseekobj,ob->speed,angle,&s_p_bazooka1,0x4000); new->momentumz = ob->momentumz; new->whatever = ob->whatever; } void SplitMissile(objtype*ob) { SD_PlaySoundRTP(SD_SPLITSND,ob->x,ob->y); if (ob->soundhandle != -1) SD_StopSound(ob->soundhandle); SpawnSplit(ob,ob->angle + ANGLES/12); SpawnSplit(ob,ob->angle - ANGLES/12); if (missobj == ob) { if (GameRandomNumber("split misscam",0)<128) missobj = LASTACTOR; else missobj = LASTACTOR->prev; } ob->state=NULL; // get rid of current missile } void SpawnMissileSmoke(objtype *ob) { if (!ValidAreanumber(AREANUMBER(ob->tilex,ob->tiley))) return; SpawnStatic(ob->tilex,ob->tiley,stat_missmoke,-1); LASTSTAT->flags |= FL_ABP; MakeStatActive(LASTSTAT); SetFinePosition(LASTSTAT,ob->x,ob->y); LASTSTAT->z = ob->z+3; } void T_Projectile (objtype *ob) { playertype * pstate = 0; objtype *owner = (objtype*)(ob->whatever); if (owner->obclass == playerobj) M_LINKSTATE(owner,pstate); if ((ob->soundhandle != -1) && (!(oldpolltime & 7)) ) SD_PanRTP(ob->soundhandle,ob->x,ob->y); #if (SHAREWARE == 0) if (ob->obclass == h_mineobj) { if (!ob->dirchoosetime) { NewState(ob,&s_grexplosion1); SD_PlaySoundRTP(SD_KRISTMINEHITSND,ob->x,ob->y); } else ob->dirchoosetime --; if ( (ob->state == &s_mine1) && (!ob->ticcount) ) SD_PlaySoundRTP(BAS[ob->obclass].operate,ob->x,ob->y); } #endif if (!ob->ticcount) { if (ob->state == &s_p_grenade) ob->momentumz += (GRAVITY>>6); else if (ob->state == &s_grenade_fall6) { NewState(ob,&s_explosion1); return; } } if (ob->obclass == p_drunkmissileobj) { if (ob->temp3 > 0) { ob->temp3 --; Stagger(ob); } else { if (ob->target == NULL) Stagger(ob); HeatSeek(ob); } } else if (ob->temp1 == NME_DRUNKTYPE) Stagger(ob); else if ((ob->obclass == p_heatseekobj) || (ob->obclass == dm_heatseekobj) || (ob->temp1 == NME_HEATSEEKINGTYPE) || (ob->obclass == p_godballobj) ) HeatSeek(ob); else if ((ob->obclass == p_splitmissileobj) && (!pstate->buttonstate[bt_attack]) ) { SplitMissile(ob); return; } if ((!BATTLEMODE) && (!(ob->ticcount & 7)) && (ob->obclass != p_firewallobj) && (ob->obclass != p_kesobj) && (ob->obclass != p_godballobj) && ((ob->obclass >= p_bazookaobj) || (ob->obclass == missileobj)) )// && SpawnMissileSmoke(ob); MissileMovement(ob); if (ob->obclass == grenadeobj) { if (ob->temp1 > 0) ob->temp1 -= ob->speed; else if (!(ob->flags & FL_DONE)) { NewState(ob,&s_grenade_fall1); ob->flags |= FL_DONE; } } } void StartFirewall(objtype*ob, int newz) { objtype *owner = (objtype*)(ob->whatever); MISCVARS->firespawned = 0; owner->temp1 = 0; SpawnFirewall(ob,2,newz); if (missobj == ob) missobj = LASTACTOR; NewState(ob,&s_megaremove); } void MissileMovement(objtype*ob) {int tryx, tryy,tryz; tryx = ob->x + ob->momentumx; tryy = ob->y + ob->momentumy; tryz = ob->z + (ob->momentumz >> 10); if (!MissileTryMove (ob, tryx, tryy, tryz)) return; ob->z += (ob->momentumz >> 10); MoveActor(ob); } #define DetonateMissile(x,y) \ {MissileHit(x,y); \ return false; \ } \ #define QuietDetonate(ob) \ { \ if (ob->soundhandle != -1) \ SD_StopSound(ob->soundhandle); \ if (ob == missobj) \ missobj = NULL; \ NewState(ob,&s_megaremove); \ return false; \ } boolean MissileTryMove(objtype*ob,int tryx,int tryy,int tryz) { int tilexlow,tileylow,tilexhigh,tileyhigh,x,y, trytilex,trytiley,dx,dy,dzt,dztp1,radius, sprrad,actrad,tcl,ocl,oldsrad,area,zdist, wall; objtype *temp; wall_t *tempwall; doorobj_t *tempdoor; int doorn; statobj_t *tempstat; boolean areatried[NUMAREAS] = {0}; sprrad = 0x4500; actrad = ACTORSIZE+0x2800; ocl = ob->obclass; radius = PROJSIZE-0x2200; if (ocl==wallfireobj) radius-=0x3000; trytilex = (tryx >> TILESHIFT); trytiley = (tryy >> TILESHIFT); if (IsWindow(trytilex,trytiley) || (!InMapBounds((tryx>>16),(tryy>>16)))) { QuietDetonate(ob); } /* */ //==== ceiling/floor clipping =================// if (tryz < -30) {if ((sky==0) || (ocl == inertobj)) { DetonateMissile(ob,NULL); } /* else return true; */ /* else { NewState(ob,&s_megaremove); if (missobj == ob) missobj = NULL; return false; } */ } if (tryz > (maxheight-10)) { if ((ocl == p_firewallobj) && (!(ob->flags & FL_ISFIRE))) StartFirewall(ob,nominalheight); else MissileHit(ob,NULL); return false; } //=============================================// sprrad = PROJSIZE+0x1000; tilexlow = (int)((tryx-radius) >>TILESHIFT); tileylow = (int)((tryy-radius) >>TILESHIFT); tilexhigh = (int)((tryx+radius) >>TILESHIFT); tileyhigh = (int)((tryy+radius) >>TILESHIFT); oldsrad = sprrad; if (ocl == inertobj) goto walls; area = ob->areanumber; areatried[area] = true; actors: for(temp=firstareaactor[area];temp;temp=temp->nextinarea) { if (temp == ob) continue; dx = abs(tryx - temp->x); dy = abs(tryy - temp->y); if ((dx > actrad) || (dy > actrad)) continue; if (temp->flags & FL_HEAD) continue; if ((!(temp->flags & FL_BLOCK)) || (temp->flags & FL_DYING)) continue; tcl = temp->obclass; zdist = 32; dzt = abs(tryz - temp->z); if ((tcl == playerobj) && (temp->flags & FL_DOGMODE)) { dzt = abs(tryz - (temp->z + 30)); zdist = 10; } else if (tcl == diskobj) { zdist = 50; } if (dzt > zdist) continue; //if ((ocl==wallfireobj) && (tcl==playerobj) && (temp->flags&FL_DOGMODE) && (dz>15)) // continue; //if ((ocl==playerobj) && // (ob->whatever == (void*)temp)) //continue; if (ob->whatever && (ob->whatever == temp->whatever))// && // (ocl == tcl))// missiles with same owner // go through each other continue; if (!(ob->flags & FL_ISFIRE)) { int random; if (tcl != b_darkmonkobj) { MissileHit(ob,temp); ob->target = NULL; if (tcl == wallfireobj) MissileHit(temp,NULL); if (((ocl == p_kesobj) || (ocl == p_godballobj)) && (tcl < pillarobj)) continue; else return false; } random = GameRandomNumber("empower darkmonk",0); #if (SHAREWARE == 0) if (ocl == p_kesobj) { NewState(ob,&s_megaremove); //ob->state = NULL; temp->hitpoints += (((random>>3)+140)<<1); CAP_OSCUROS_HITPOINTS(temp); } else if (ocl == p_firebombobj) { NewState(ob,&s_explosion1); temp->hitpoints += (((random>>3)+70)<<1); CAP_OSCUROS_HITPOINTS(temp); ob->target = NULL; } else { NewState(ob,&s_explosion1); temp->hitpoints += (((random>>3)+50)<<1); CAP_OSCUROS_HITPOINTS(temp); ob->target = NULL; } temp->temp3 = ocl; temp->speed = 5*SPDPATROL; NewState(temp,&s_darkmonkreact); #endif return false; } else if (tcl < roboguardobj) {if ((temp->z == nominalheight) && (!((tcl == playerobj) && ((temp->flags & FL_GODMODE) || (temp->flags & FL_DOGMODE) || godmode)))) { if (tcl == playerobj) { playertype *pstate; objtype *owner = (objtype*)(ob->whatever); M_LINKSTATE(temp,pstate); if (temp->flags & FL_AV) {pstate->protectiontime = 1; if (temp==player) GM_UpdateBonus (pstate->protectiontime, false); continue; } //temp->flags &= ~FL_COLORED; pstate->health = 0; pstate->weapon = -1; if (owner->obclass == playerobj) BATTLE_PlayerKilledPlayer(battle_kill_with_missile,owner->dirchoosetime,temp->dirchoosetime); } temp->flags |= FL_SKELETON; temp->hitpoints = 0; Collision(temp,ob->whatever,-temp->momentumx,-temp->momentumy); } continue; } else { NewState(ob,&s_megaremove); ob->target = NULL; #if (SHAREWARE == 0) if (tcl == b_darkmonkobj) NewState(temp,&s_darkmonkfspark1); #endif } return false; } for (y=tileylow;y<=tileyhigh;y++) for (x=tilexlow;x<=tilexhigh;x++) { area = AREANUMBER(x,y); if (ValidAreanumber(area) && (areatried[area]==false)) { areatried[area] = true; goto actors; } } /******************* WALLS/PWALLS *****************************************/ walls: for (y=tileylow;y<=tileyhigh;y++) for (x=tilexlow;x<=tilexhigh;x++) { tempwall = (wall_t*)actorat[x][y]; wall=tilemap[x][y]; if (tempwall && M_ISWALL(tempwall) && (tempwall->which!=MWALL)) {if (ocl == h_mineobj) { if (WallCheck(ob->x-ob->momentumx, tryy)) {ob->momentumx = -ob->momentumx; continue; } else if (WallCheck(tryx, ob->y-ob->momentumy)) {ob->momentumy = -ob->momentumy; continue; } } DetonateMissile(ob,tempwall); //MissileHit(ob,tempwall); //return false; } tempstat = sprites[x][y]; sprrad = oldsrad; if (tempstat && ((tempstat->flags & FL_SHOOTABLE) || (tempstat->flags & FL_BLOCK))) { if ((tempstat->itemnumber >= stat_bcolumn) && (tempstat->itemnumber <= stat_icolumn)) sprrad += 0x5000; dx = tryx - tempstat->x; if ((dx < -sprrad) || (dx > sprrad)) continue; dy = tryy - tempstat->y; if ((dy < -sprrad) || (dy > sprrad)) continue; //#define MINSTATZDIFF 60 dzt = abs(ob->z - tempstat->z); dztp1 = abs(tryz - tempstat->z); /* if (ocl == p_firewallobj)// && (dztp1 <= MINSTATZDIFF)) { if (ob->flags & FL_ISFIRE) { int cz = (ob->z - tempstat->z + MINSTATZDIFF); if ((cz >= -MAXSTEPHEIGHT) && (cz <= 0)) { ob->z = tempstat->z - MINSTATZDIFF; tryz = ob->z + (ob->momentumz >> 16); dzt = MINSTATZDIFF; } } if ((dztp1 >= MINSTATZDIFF) || (dzt >= MINSTATZDIFF)) continue; if (!(ob->flags & FL_ISFIRE)) { StartFirewall(ob,tempstat->z - MINSTATZDIFF); return false; } } else*/ { if (dztp1 > 50) continue; DetonateMissile(ob,tempstat); } //MissileHit(ob,tempstat); //return false; } } //mwalls: if (M_ISMWALL(trytilex,trytiley)) { maskedwallobj_t * mw; wall=tilemap[trytilex][trytiley]; //tempwall = (wall_t*)actorat[trytilex][trytiley]; mw=maskobjlist[wall&0x3ff]; if (!(mw->flags&MW_BLOCKING)) { if ((levelheight > 1) && (((!(mw->flags & MW_ABOVEPASSABLE)) && (tryz <= 32)) || ((!(mw->flags & MW_MIDDLEPASSABLE)) && (tryz > 25) && (tryz < nominalheight-32)) || ((!(mw->flags & MW_BOTTOMPASSABLE)) && (tryz > maxheight - 74)) ) ) DetonateMissile(ob,NULL); } else if (mw->flags&MW_SHOOTABLE) { if (ob->z >= maxheight-64) { UpdateMaskedWall(tilemap[trytilex][trytiley]&0x3ff); } else DetonateMissile(ob,NULL); } else DetonateMissile(ob,NULL); //MissileHit(ob,tempwall); //return false; } /******************* DOOR STUFF ******************************************/ else if (M_ISDOOR(trytilex,trytiley)) { doorn = tilemap[trytilex][trytiley]; tempdoor = doorobjlist[doorn&0x3ff]; if (tempdoor->position>=0x8000) { if (ob->z>maxheight-64) return true; } DetonateMissile(ob,tempdoor); } return true; } void SpawnFirewall(objtype*ob,int which,int newz) {int i,j,count,newx,newy; objtype* owner; wall_t*tempwall; statetype* frame; int offset; owner = (objtype*)(ob->whatever); if ((owner->temp1 < 2) && (MISCVARS->firespawned < 14)) {for(i=0;i<=which;i++) { GetNewActor (); MakeActive(new); MISCVARS->firespawned ++; new->obclass = p_firewallobj; new->which = ACTOR; new->areanumber = ob->areanumber; MakeLastInArea(new); offset = 0x6000; if (!which) new->temp1 = ob->temp1; else if (i==1) new->temp1 = ob->angle + ANGLES/4; else if (i==2) new->temp1 = ob->angle - ANGLES/4; else { new->temp1 = 0; offset = 0; new->flags |= FL_DONE; } Fix(new->temp1); new->speed = 0x8000; new->angle = ob->angle; ParseMomentum(new,new->angle); newx = ob->x + FixedMul(offset,costable[new->temp1]); newy = ob->y - FixedMul(offset,sintable[new->temp1]); SetFinePosition(new,newx,newy); SetVisiblePosition(new,newx,newy); new->whatever = ob->whatever; new->dirchoosetime = 2; new->flags |= (FL_NEVERMARK|FL_ABP|FL_NOFRICTION); count = (int)(GameRandomNumber("SpawFireWall",0) & 15); for(frame = &s_fireunit1,j=0;jnext,j++); NewState(new,frame); new->flags |= FL_ISFIRE; //SD_Play(SD_EXPL); tempwall = (wall_t*)actorat[new->tilex][new->tiley]; new->z = newz; if (tempwall && M_ISWALL(tempwall)) { SetFinePosition(new,ob->x,ob->y); SetVisiblePosition(new,ob->x,ob->y); owner->temp1++; } } } } void T_Firethink(objtype*ob) { if (ob->dirchoosetime) ob->dirchoosetime--; else if (!(ob->flags & FL_DONE)) { SpawnFirewall(ob,0,ob->z); ob->flags |= FL_DONE; } MissileMovement(ob); } void ResolveRide(objtype *ob) { objtype *ride = (objtype*)(ob->whatever); if (M_ISACTOR(ride) && (ob->obclass != playerobj)) { if (ob->flags & FL_RIDING) { int dx,dy; dx = ob->x - ride->x; dy = ob->y - ride->y; if ((dx < -MINACTORDIST) || (dx > MINACTORDIST) || (dy < -MINACTORDIST) || (dy > MINACTORDIST) ) { ride->whatever = NULL; ob->whatever = NULL; ob->flags &= ~FL_RIDING; } } } } void MoveActor(objtype*ob) { int oldarea,newarea, tilex,tiley,oldtilex,oldtiley; ResolveRide(ob); oldtilex = ob->tilex; oldtiley = ob->tiley; SetFinePosition(ob,ob->x+ob->momentumx,ob->y+ob->momentumy); /* if (ob->state == &s_explosion1) Error("moving explosion"); */ if ((ob->obclass == playerobj) || (ob->flags & FL_NOFRICTION) || (ob->state->think == T_Collide) || (ob->obclass == b_heinrichobj) || (ob->obclass == h_mineobj)) SetVisiblePosition(ob,ob->x,ob->y); if (ob->obclass == inertobj) return; if ((ob->obclass == b_darksnakeobj) && (ob != SNAKEHEAD)) { oldarea = ob->areanumber; newarea = SNAKEHEAD->areanumber; if (oldarea != newarea) { RemoveFromArea(ob); ob->areanumber = newarea; MakeLastInArea(ob); } return; } oldarea = ob->areanumber; newarea = AREANUMBER(ob->tilex,ob->tiley); if (!(ob->flags & (FL_NONMARK|FL_NEVERMARK))) { if ((oldtilex != ob->tilex) || (oldtiley != ob->tiley)) { if (actorat[oldtilex][oldtiley] == (void*)ob) actorat[oldtilex][oldtiley] = NULL; if (actorat[ob->tilex][ob->tiley]) { objtype* temp; temp = (objtype*)actorat[ob->tilex][ob->tiley]; if (temp->which != SPRITE) actorat[ob->tilex][ob->tiley] = ob; } else actorat[ob->tilex][ob->tiley] = ob; } } #define CheckAdjacentArea(x,y) \ { \ if (InMapBounds(x,y)) \ { \ temparea = AREANUMBER(x,y); \ if (ValidAreanumber(temparea)) \ newarea = temparea; \ } \ } if (!ValidAreanumber(newarea)) //find empty tile { int temparea; tilex = ob->tilex; tiley = ob->tiley; CheckAdjacentArea(tilex+1,tiley); CheckAdjacentArea(tilex-1,tiley); CheckAdjacentArea(tilex,tiley+1); CheckAdjacentArea(tilex,tiley-1); } //Error("new area invalid for actor %d, class %d", // ob-&objlist[0],ob->obclass); //====================== swap in linked lists ===================== if (oldarea != newarea) { RemoveFromArea(ob); ob->areanumber = newarea; MakeLastInArea(ob); } } void SpawnPushColumn(int tilex,int tiley,int which,int dir, int linked) { if (which==0) { SpawnNewObj(tilex,tiley,&s_pushcolumn1,pillarobj); // for (i=0;i<(levelheight-1);i++) // SpawnStatic(tilex,tiley,stat_bcolumn,-(i<<6)); } else if (which==1) { SpawnNewObj(tilex,tiley,&s_pushcolumn2,pillarobj); // for (i=0;i<(levelheight-1);i++) // SpawnStatic(tilex,tiley,stat_gcolumn,-(i<<6)); } else { SpawnNewObj(tilex,tiley,&s_pushcolumn3,pillarobj); // for (i=0;i<(levelheight-1);i++) // SpawnStatic(tilex,tiley,stat_icolumn,-(i<<6)); } PreCacheActor(pillarobj,which); gamestate.secrettotal++; new->speed = PILLARMOM; new->temp1 = 0x20000; new->temp2 = linked; new->flags |= (FL_BLOCK|FL_NOFRICTION); new->flags &= ~FL_SHOOTABLE; new->flags |= FL_HEIGHTFLIPPABLE; new->dir = dir; if (dir != nodir) ParseMomentum(new,dirangle8[new->dir]); } void SpawnWallfire(int tilex, int tiley, int dir) {int offx,offy; GetNewActor(); new->speed = 0x2000; SetTilePosition(new,tilex,tiley); SetVisiblePosition(new,new->x,new->y); new->obclass = wallfireobj; new->dir = dir*2; new->flags |= (FL_BLOCK|FL_NOFRICTION|FL_NEVERMARK); new->flags &= ~FL_SHOOTABLE; new->which = ACTOR; new->angle = dirangle8[new->dir]; offx = FixedMul(0x10000,costable[new->angle])>>TILESHIFT; offy = -(FixedMul(0x10000,sintable[new->angle])>>TILESHIFT); new->areanumber = MAPSPOT(new->tilex+offx,new->tiley+offy,0)-AREATILE; MakeLastInArea(new); NewState(new,&s_wallfireball); } void SpawnSneaky(int tilex,int tiley) { SpawnNewObj(tilex,tiley,&s_sneakydown,lowguardobj); new->temp3 = SNEAKY; if (!loadedgame) gamestate.killtotal++; StandardEnemyInit(new,north>>1); PreCacheActor(lowguardobj,0); } void RespawnEluder(void) { int rand,count; int nx,ny; rand = (GameRandomNumber("eluder respawn",0) % NUMSPAWNLOCATIONS); for(count=0;count < NUMSPAWNLOCATIONS;count++) { if (!actorat[SPAWNLOC[rand].x][SPAWNLOC[rand].y]) { SpawnCollector(SPAWNLOC[rand].x,SPAWNLOC[rand].y); return; } rand= ((rand + 1) % NUMSPAWNLOCATIONS); } //MED nx = SPAWNLOC[rand].x; ny = SPAWNLOC[rand].y; FindEmptyTile(&nx,&ny); SpawnCollector(nx,ny); } //**************************************************************************** // // // //**************************************************************************** void SpawnCollector(int tilex, int tiley) { #if (SHAREWARE == 0) if ( dopefish==true ) { SpawnNewObj(tilex,tiley,&s_scottwander1,collectorobj); } else #endif { SpawnNewObj(tilex,tiley,&s_collectorwander1,collectorobj); } new->flags |= (FL_SHOOTABLE|FL_BLOCK|FL_NOFRICTION|FL_FULLLIGHT); new->hitpoints = 500; new->speed = 0x3000; new->dir = north; new->dirchoosetime = 175; new->z = PlatformHeight(tilex,tiley); if (new->z == -10) new->z = 0; if (areabyplayer[new->areanumber]) {new->flags |= FL_ABP; MakeActive(new); } } void SelectDoorDir(objtype*ob) {int dx,dy,actrad; dirtype dtry1,dtry2,tdir,olddir; dx= ob->targettilex - ob->x; dy= ob->y - ob->targettiley; olddir = ob->dir; if ((abs(dx) < 0x4000) && (abs(dy) < 0x4000)) {ZEROMOM; SetFinePosition(ob,ob->targettilex,ob->targettiley); SetVisiblePosition(ob,ob->x,ob->y); ParseMomentum(ob,dirangle8[ob->temp2]); ActorMovement(ob); ob->temp2 = 0; ob->temp1 = 20; #if (SHAREWARE == 0) if ( dopefish==true ) { NewState(ob,&s_scottwander1); } else #endif { NewState(ob,&s_collectorwander1); } ob->targettilex = ob->targettiley = 0; ob->dirchoosetime = 165; return; } ZEROMOM; ParseMomentum(ob,atan2_appx(dx,dy)); ActorMovement(ob); if (ob->momentumx || ob->momentumy) return; actrad = ACTORSIZE; dtry1=nodir; dtry2=nodir; if (dx> actrad) dtry1= east; else if (dx< -actrad) dtry1= west; if (dy> actrad) dtry2= north; else if (dy < -actrad) dtry2= south; if (abs(dy)>abs(dx)) {tdir=dtry1; dtry1=dtry2; dtry2=tdir; } if (dtry1 != nodir) M_CHECKDIR(ob,dtry1); if (dtry2 != nodir) M_CHECKDIR(ob,dtry2); if (dtry1 != nodir) M_CHECKDIR(ob,dirorder[dtry1][NEXT]); if (dtry2 != nodir) M_CHECKDIR(ob,dirorder[dtry2][NEXT]); for(tdir = dirorder[olddir][NEXT];tdir != olddir;tdir = dirorder[tdir][NEXT]) M_CHECKDIR(ob,tdir); ob->dir = olddir; } boolean EluderCaught(objtype*ob) { objtype *temp; int dx,dy,dz; int dist = 0xc000; for(temp = PLAYER[0];temp != PLAYER[numplayers-1]->next;temp=temp->next) { #if (SHAREWARE == 0) if (temp->state != &s_doguse) continue; #endif dx = M_ABS(temp->x - ob->x); if (dx > dist) continue; dy = M_ABS(temp->y - ob->y); if (dy > dist) continue; dz = M_ABS(temp->z - ob->z); if (dz > (dist>>10)) continue; //if (DOGSCRATCH.attackinfo[pstate->attackframe].attack == at_pulltrigger) {BATTLE_CheckGameStatus(battle_caught_eluder,temp->dirchoosetime); SpawnNewObj(ob->tilex,ob->tiley,&s_itemspawn1,inertobj); new->flags |= FL_ABP; SetFinePosition(new,ob->x,ob->y); SetVisiblePosition(new,ob->x,ob->y); new->z = ob->z; SD_PlaySoundRTP(SD_GETBONUSSND,ob->x,ob->y); MakeActive(new); NewState(ob,&s_megaremove); return true; } } return false; } void T_CollectorFindDoor(objtype*ob) { if (EluderCaught(ob)) return; if (!(gamestate.TimeCount % 17)) SD_PlaySoundRTP(SD_MONKGRABSND,ob->x,ob->y); if ((ob->z != nominalheight) && (!IsPlatform(ob->tilex,ob->tiley))) ZEROMOM; if (ob->dirchoosetime) ob->dirchoosetime --; else { #if (SHAREWARE == 0) if ( dopefish==true ) { NewState(ob,&s_scottwander1); } else #endif { NewState(ob,&s_collectorwander1); } ob->dirchoosetime = 165; ob->targettilex = ob->targettiley = 0; return; } if (ob->temp1) {int dx,dy; ob->temp1 --; ActorMovement(ob); dx = ob->targettilex-ob->x; dy = ob->targettiley-ob->y; if ((abs(dx) < 0x4000) && (abs(dy) < 0x4000)) {ZEROMOM; SetFinePosition(ob,ob->targettilex,ob->targettiley); SetVisiblePosition(ob,ob->x,ob->y); ParseMomentum(ob,dirangle8[ob->temp2]); ActorMovement(ob); ob->temp2 = 0; ob->temp1 = 35; #if (SHAREWARE == 0) if ( dopefish==true ) { NewState(ob,&s_scottwander1); } else #endif { NewState(ob,&s_collectorwander1); } ob->targettilex = ob->targettiley = 0; ob->dirchoosetime = 165; return; } if (NOMOM) ob->temp1 = 0; return; } ob->temp1 = 5; if (ob->targettilex || ob->targettiley) SelectDoorDir(ob); else {int i; doorobj_t* dptr; //========================================================================== #define SetCollectorTarget(xoffset,yoffset,newdir) \ { \ ob->targettilex = ((dptr->tilex + (xoffset)) << TILESHIFT) + HALFGLOBAL1; \ ob->targettiley = ((dptr->tiley + (yoffset)) << TILESHIFT) + HALFGLOBAL1; \ ob->temp2 = newdir; \ if (GameRandomNumber("collector door search",0) < 100) \ return; \ } //========================================================================== for(i=0;ivertical) { int area1 = AREANUMBER(dptr->tilex-1,dptr->tiley), area2 = AREANUMBER(dptr->tilex+1,dptr->tiley); if (area1 == ob->areanumber) SetCollectorTarget(-1,0,east) else if (area2 == ob->areanumber) SetCollectorTarget(1,0,west); } else { int area1 = AREANUMBER(dptr->tilex,dptr->tiley-1), area2 = AREANUMBER(dptr->tilex,dptr->tiley+1); if (area1 == ob->areanumber) SetCollectorTarget(0,-1,south) else if (area2 == ob->areanumber) SetCollectorTarget(0,1,north); } } } } void T_CollectorWander(objtype*ob) { int newtilex,newtiley; if (EluderCaught(ob)) return; if ((ob->z != nominalheight) && (!IsPlatform(ob->tilex,ob->tiley))) ZEROMOM; if (!(gamestate.TimeCount & 15))//%17 SD_PlaySoundRTP(SD_MONKGRABSND,ob->x,ob->y); if (ob->dirchoosetime) { if (doornum > 0) ob->dirchoosetime --; } else { #if (SHAREWARE == 0) if ( dopefish==true ) { NewState(ob,&s_scottwanderdoor1); } else #endif { NewState(ob,&s_collectorfdoor1); } ob->temp1 = 0; ob->dirchoosetime = 165; ob->targettilex = ob->targettiley = 0; return; } if (ob->temp1) // temp1 holds direction time ob->temp1 --; else { dirtype bestdir,tempdir; bestdir = angletodir[GameRandomNumber("collector theta",0) << 3]; for(tempdir = bestdir;tempdir != dirorder[bestdir][PREV];tempdir = dirorder[tempdir][NEXT]) { ParseMomentum(ob,dirangle8[tempdir]); newtilex = ((ob->x + ob->momentumx)>>16); newtiley = ((ob->y + ob->momentumy)>>16); if (IsWindow(newtilex,newtiley)) continue; ActorMovement(ob); if (ob->momentumx || ob->momentumy) { ob->temp1 = (GameRandomNumber("collector choose time",0) >> 2); return; } } } newtilex = ((ob->x + ob->momentumx)>>16); newtiley = ((ob->y + ob->momentumy)>>16); if (IsWindow(newtilex,newtiley)) { ob->temp1 = 0; return; } ActorMovement(ob); if (NOMOM) ob->temp1 = 0; } boolean CheckDoor(objtype *ob,doorobj_t * door,int trytilex,int trytiley) {boolean doorok=false; switch(ob->dir) {case north: if ((ob->tiley == (door->tiley + 1)) && (trytilex == ob->tilex)) doorok = true; break; case east: if ((ob->tilex == (door->tilex - 1)) && (trytiley == ob->tiley)) doorok = true; break; case south: if ((ob->tiley == (door->tiley - 1)) && (trytilex == ob->tilex)) doorok = true; break; case west: if ((ob->tilex == (door->tilex + 1)) && (trytiley == ob->tiley)) doorok = true; break; default: ; } if (doorok) {SetTilePosition(ob,ob->tilex,ob->tiley); SetVisiblePosition(ob,ob->x,ob->y); return true; } return false; } boolean WallCheck(int tryx,int tryy) {int tilexlow,tilexhigh,tileylow,tileyhigh,y,x; tilexlow = (int)((tryx -PLAYERSIZE) >>TILESHIFT); tileylow = (int)((tryy -PLAYERSIZE) >>TILESHIFT); tilexhigh = (int)((tryx + PLAYERSIZE) >>TILESHIFT); tileyhigh = (int)((tryy + PLAYERSIZE) >>TILESHIFT); for (y=tileylow;y<=tileyhigh;y++) for (x=tilexlow;x<=tilexhigh;x++) {//tempwall = (wall_t*)actorat[x][y]; //if (tempwall && M_ISWALL(tempwall)) if (tilemap[x][y]) return false; } return true; } boolean QuickSpaceCheck(objtype*ob,int tryx, int tryy) {int xlow,xhigh,ylow,yhigh,x,y,dx,dy; objtype* temp; xlow = (int)((tryx-ACTORSIZE) >>TILESHIFT); ylow = (int)((tryy-ACTORSIZE) >>TILESHIFT); xhigh = (int)((tryx+ACTORSIZE) >>TILESHIFT); yhigh = (int)((tryy+ACTORSIZE) >>TILESHIFT); /******************* WALLS/PWALLS *****************************************/ for (y=ylow;y<=yhigh;y++) for (x=xlow;x<=xhigh;x++) {temp = (objtype*)actorat[x][y]; if ((temp && (temp->which != ACTOR)) || (sprites[x][y] && (sprites[x][y]->flags & FL_BLOCK)) || tilemap[x][y]) return false; } for(temp=firstareaactor[ob->areanumber];temp;temp=temp->nextinarea) {if (temp == ob) continue; if ((temp->flags & FL_NONMARK) || (temp->flags & FL_NEVERMARK)) continue; dx = tryx - temp->x; if ((dx < -MINACTORDIST) || (dx > MINACTORDIST)) continue; dy = tryy - temp->y; if ((dy < -MINACTORDIST) || (dy > MINACTORDIST)) continue; if (ob->whatever == (void*)temp) continue; if (temp->whatever == ob->whatever) continue; return false; } return true; } //========================================================================= // // ACTOR TRY MOVE MADNESS // //========================================================================= typedef enum { NO_MOVEMENT, Z_MOVEMENT_ONLY, OK_TO_CONTINUE }movement_status; //==================== Some ActorTryMove macros ============================== #define CheckProximitySpecials(ob,temp) \ { \ if (ocl == b_heinrichobj) \ { \ if (tcl == playerobj) \ { \ playertype *pstate; \ \ M_LINKSTATE(temp,pstate); \ DamageThing(temp,5); \ temp->whatever = ob; \ temp->temp2 = COLUMNCRUSH; \ pstate->heightoffset += 4; \ if (pstate->heightoffset >= 30) \ pstate->heightoffset = 30; \ pstate->oldheightoffset = pstate->heightoffset; \ } \ else \ { \ temp->momentumx = temp->momentumy = temp->momentumz = 0; \ temp->hitpoints = 0; \ } \ if (temp->hitpoints <= 0) \ temp->flags |= FL_HBM; \ Collision(temp,ob,0,0); \ continue; \ } \ \ else if ((ocl == b_darksnakeobj) && (tcl == playerobj)) \ { \ DamageThing(temp,1); \ Collision(temp,ob,0,0); \ M_CheckPlayerKilled(temp); \ } \ \ if ((ocl == boulderobj) && (tcl >= lowguardobj) && (tcl < roboguardobj))\ {temp->momentumx = temp->momentumy = temp->momentumz = 0; \ temp->hitpoints = 0; \ temp->flags |= FL_HBM; \ Collision(temp,ob,0,0); \ SD_PlaySoundRTP(SD_ACTORSQUISHSND,temp->x,temp->y); \ continue; \ } \ \ if (pusher && (ocl != tcl) && (!(temp->flags & FL_DYING)) && \ (tcl < roboguardobj) \ ) \ {if ((!ob->ticcount) && (ocl != collectorobj) && (ocl != diskobj))\ DamageThing(temp,5); \ \ if (tcl == playerobj) \ temp->flags |= FL_PUSHED; \ Collision(temp,ob,ob->momentumx-temp->momentumx,ob->momentumy-temp->momentumy);\ M_CheckPlayerKilled(temp); \ continue; \ } \ \ if (bouncer) \ {ob->momentumx = -ob->momentumx; \ continue; \ } \ } #define CheckStepping(ob,step,minzdiff) \ { \ int cz = (ob->z - step->z + minzdiff); \ \ if ((cz >= -MAXSTEPHEIGHT) && (cz <= MAXSTEPHEIGHT)) \ {if ((ob->obclass == playerobj) && (ob->temp2 == 0) && \ (ob->z != (step->z - minzdiff)) \ ) \ { \ playertype *pstate; \ \ M_LINKSTATE(ob,pstate); \ \ pstate->heightoffset = pstate->oldheightoffset + cz; \ ob->temp2 = (cz >= 0)?(STEPUP):(STEPDOWN); \ } \ ob->z = step->z - minzdiff; \ tryz = ob->z + (ob->momentumz >> 16); \ dzt = minzdiff; \ } \ } \ //============ Players crushing other players ===================== void BattleCrushCheck(objtype *ob,objtype *listrover) \ { if ((ob->obclass == playerobj) && (listrover->obclass == playerobj)) { playertype * pstate; M_LINKSTATE(listrover,pstate); if (pstate->health <= 0) BATTLE_PlayerKilledPlayer(battle_kill_by_crushing,ob->dirchoosetime, listrover->dirchoosetime); } } //================================================================= movement_status CheckOtherActors(objtype*ob,int tryx,int tryy,int tryz) { objtype *listrover; int area; int op; int areatried[NUMAREAS]={0}; int tilexlow,tilexhigh,tileylow,tileyhigh; int radius,actrad,oldrad; boolean bouncer,pusher,thinkingactor,zstoppable,ACTORSTOP; int dzt,dztp1,checkz; int x,y,dx,dy; int ocl,tcl; ocl = ob->obclass; actrad = MINACTORDIST;//ACTORSIZE+0x2800; pusher = ((ocl == wallopobj) || (ocl == pillarobj) || (ocl == roboguardobj) || (ocl == collectorobj) || (ocl == boulderobj) || (ocl == diskobj) ); thinkingactor = ((ocl != playerobj) && (ob->state->think != T_Collide) && (ocl < roboguardobj) ); zstoppable = (!(ob->flags & FL_DYING)); bouncer = ((ocl == playerobj) && (ob->flags & FL_ELASTO)); radius = ACTORSIZE; if (ocl != playerobj) { //actrad = MINACTORDIST; //if ((ob->dir == nodir) && (ocl != b_robobossobj) && // (ocl != wallopobj) && (ocl != roboguardobj) && (ocl != diskobj) // ) // Error("ob called with nodir"); if (ocl == boulderobj) radius += (ACTORSIZE/4); else if (ocl == b_darksnakeobj) radius -= 6000; else if (ocl == inertobj) radius -= 0x2000; } tilexlow = (int)((tryx-radius) >>TILESHIFT); tileylow = (int)((tryy-radius) >>TILESHIFT); tilexhigh = (int)((tryx+radius) >>TILESHIFT); tileyhigh = (int)((tryy+radius) >>TILESHIFT); area = ob->areanumber; areatried[area] = 1; ACTORSTOP = false; oldrad = actrad; actors: for(listrover=firstareaactor[area];listrover;listrover=listrover->nextinarea) { actrad = oldrad; if (listrover == ob) continue; tcl = listrover->obclass; if ((tcl == b_darksnakeobj) && (listrover != SNAKEHEAD)) continue; if (((tcl == bladeobj) || (tcl == firejetobj)) && thinkingactor) actrad += 0x3000; dx = tryx - listrover->x; if ((dx < -actrad) || (dx > actrad)) continue; dy = tryy - listrover->y; if ((dy < -actrad) || (dy > actrad)) continue; if ((ocl == b_darksnakeobj) && (tcl == ocl)) continue; if ((tcl == springobj) && (listrover->state->condition & SF_UP) && (listrover->temp1!=3) && (levelheight > 1) && (abs(listrover->z - ob->z) < 5) && (!ob->momentumz) ) { { op = (FixedMul((int)GRAVITY,(int)((ob->z-10)<<16))<<1); ob->momentumz = -FixedSqrtHP(op); } SD_PlaySoundRTP(SD_SPRINGBOARDSND,listrover->x,listrover->y); NewState(listrover,&s_spring2); } if ((tcl == firejetobj) && (ob->z < listrover->z)) continue; if ((!(listrover->flags & FL_BLOCK)) && (actrad == oldrad)) // if not blocking // and actor not avoiding // env. danger continue; if (tcl == crushcolobj) checkz = listrover->temp2; else checkz = listrover->z; #define MINACTORZDIFF 58 dzt = abs(checkz - ob->z); dztp1 = abs(checkz - tryz); if ((tcl == diskobj) && (dztp1 <= MINACTORZDIFF) && zstoppable && (ocl != b_heinrichobj) ) CheckStepping(ob,listrover,MINACTORZDIFF); dztp1 = abs(checkz - tryz); if ((dzt > (MINACTORZDIFF - 25)) && (dzt < MINACTORZDIFF) && (dztp1 < MINACTORZDIFF) && (tcl < roboguardobj) && (ocl < roboguardobj) ) { int rdx,rdy; rdx = abs(ob->x - listrover->x); rdy = abs(ob->y - listrover->y); if ((rdx < actrad) && (rdy < actrad)) { if (ob->z > listrover->z) listrover->z = ob->z - MINACTORZDIFF; else ob->z = listrover->z - MINACTORZDIFF; dzt = dztp1 = MINACTORZDIFF; } } if ((dztp1 >= MINACTORZDIFF) || (dzt >= MINACTORZDIFF)) { if ((dzt >= MINACTORZDIFF) && (dztp1 <= MINACTORZDIFF) && zstoppable ) {//ob->momentumz = 0; if (ob->z < listrover->z) { ob->z = listrover->z - MINACTORZDIFF; ob->momentumz = 0; } else ob->momentumz = 2*GRAVITY; if ((listrover->z > ob->z) && (tcl < roboguardobj) && (ocl < roboguardobj) && (!(listrover->flags & FL_DYING)) ) { DamageThing(listrover,5); BattleCrushCheck(ob,listrover); Collision(listrover,ob,listrover->momentumx,listrover->momentumy); /* if ((ocl == playerobj) && (listrover->flags & FL_DYING)) GivePoints(starthitpoints[gamestate.difficulty][tcl]); */ } if (((tcl == bladeobj) || (tcl == diskobj)) && (ob->z < listrover->z)) { ob->whatever = listrover; if (listrover->flags & FL_ACTIVE) ob->flags |= FL_RIDING; listrover->whatever = ob; } //Debug("\nplayerz %d, tryz %d momz zeroed at %d, clearances %d and %d", // ob->z,tryz,listrover->z-64 + (listrover->momentumz >> 16),dzt,dztp1); } continue; } CheckProximitySpecials(ob,listrover); ACTORSTOP = true; if (!ob->momentumz) return NO_MOVEMENT; } for (y=tileylow;y<=tileyhigh;y++) for (x=tilexlow;x<=tilexhigh;x++) { area = AREANUMBER(x,y); if (ValidAreanumber(area) && (areatried[area]==0)) { areatried[area] = 1; goto actors; } } if (ACTORSTOP==true) return Z_MOVEMENT_ONLY; return OK_TO_CONTINUE; } movement_status CheckRegularWalls(objtype *ob,int tryx,int tryy,int tryz) { int tilexlow,tilexhigh,tileylow,tileyhigh,x,y,radius; classtype ocl; boolean ISPLAYER=false; ocl = ob->obclass; if (ocl != playerobj) { radius = ACTORSIZE - 0x1000; //actrad = MINACTORDIST; //if ((ob->dir == nodir) && (ocl != b_robobossobj) && // (ocl != wallopobj) && (ocl != roboguardobj) && (ocl != diskobj) // ) // Error("ob called with nodir"); if (ocl == boulderobj) radius += (ACTORSIZE/4); else if (ocl == b_darksnakeobj) radius -= 6000; else if (ocl == inertobj) radius -= 0x2000; } else { radius = PLAYERSIZE; ISPLAYER = true; } tilexlow = (int)((tryx-radius) >>TILESHIFT); tileylow = (int)((tryy-radius) >>TILESHIFT); tilexhigh = (int)((tryx+radius) >>TILESHIFT); tileyhigh = (int)((tryy+radius) >>TILESHIFT); for (y=tileylow;y<=tileyhigh;y++) for (x=tilexlow;x<=tilexhigh;x++) { wall_t *tempwall; tempwall = (wall_t*)actorat[x][y]; if (tempwall) { if (tempwall->which==WALL)// && IsWindow(x,y)==false) { if (ocl == boulderobj) { #if (SHAREWARE == 0) NewState(ob,&s_bouldersink1); #endif SD_PlaySoundRTP(SD_BOULDERHITSND,ob->x,ob->y); } else if (ISPLAYER && (!(ob->flags & FL_DYING)) && (!(ob->flags & FL_AV)) && (tempwall->flags & FL_W_DAMAGE)) { DamageThing(ob,5); Collision(ob,(objtype*)tempwall,0,0); M_CheckPlayerKilled(ob); SD_PlaySoundRTP(SD_PLAYERBURNEDSND,ob->x,ob->y); } //return false; if ((ocl == inertobj) && (ob->dirchoosetime == GIBVALUE) && (((ob->tilex - x) == 0) != ((ob->tiley - y) == 0)) && (ob->z > -28) ) { // SoftError ("Blood Dripping oldpolltime=%ld\n",oldpolltime); BloodDrip(ob,x,y); return NO_MOVEMENT; } if (!ob->momentumz) return NO_MOVEMENT; else// if (ocl != inertobj) return Z_MOVEMENT_ONLY; //else //goto doors; } else if (tempwall->which==PWALL) { pwallobj_t*pw; int dx,dy; pw=(pwallobj_t *)tempwall; dx = abs(pw->x - tryx); if (dx > PWALLRAD+0x5000) continue; dy = abs(pw->y - tryy); if (dy > PWALLRAD+0x5000) continue; return NO_MOVEMENT; } } } return OK_TO_CONTINUE; } movement_status CheckStaticObjects(objtype *ob,int tryx,int tryy,int tryz) { int dx,dy,dzt,dztp1,x,y; statobj_t*tempstat; int sprrad,oldsrad,sprtrad; boolean specialstat=false,widestat=false,zstoppable; int sprxlow,sprxhigh,sprylow,spryhigh; boolean SPRSTOP; classtype ocl; ocl = ob->obclass; if (ocl != playerobj) sprtrad = ACTORSIZE - 0x1000; else sprtrad = ACTORSIZE - 0x1000 + 0x10000; sprxlow = (int)((tryx-sprtrad) >>TILESHIFT); sprylow = (int)((tryy-sprtrad) >>TILESHIFT); sprxhigh = (int)((tryx+sprtrad) >>TILESHIFT); spryhigh = (int)((tryy+sprtrad) >>TILESHIFT); if (sprxlow < 0) sprxlow = 0; if (sprxhigh > (MAPSIZE-1)) sprxhigh = MAPSIZE-1; if (sprylow < 0) sprylow = 0; if (spryhigh > (MAPSIZE-1)) spryhigh = MAPSIZE-1; SPRSTOP = false; sprrad = 0x4500; zstoppable = (!(ob->flags & FL_DYING)); oldsrad = sprrad; for (y=sprylow;y<=spryhigh;y++) for (x=sprxlow;x<=sprxhigh;x++) { tempstat = sprites[x][y]; sprrad = oldsrad; if (tempstat) { specialstat = ((tempstat->itemnumber == stat_heatgrate) || (tempstat->itemnumber == stat_pit) ); widestat = (((tempstat->itemnumber >= stat_bcolumn) && (tempstat->itemnumber <= stat_icolumn)) || (tempstat->itemnumber == stat_disk) ); if ((tempstat->flags & FL_BLOCK) || (specialstat==true)) { if ((specialstat==true) && (ocl !=playerobj) && (ob->state->think != T_Collide) ) sprrad += 0x5000; if (widestat==true) sprrad += 0x3b00; if ((tempstat->itemnumber == stat_ironbarrel) || (tempstat->itemnumber == stat_bonusbarrel)) sprrad += 0x5000; dx = abs(tryx - tempstat->x); if (dx > sprrad) continue; dy = abs(tryy - tempstat->y); if (dy > sprrad) continue; #define MINSTATZDIFF 58 dzt = abs(ob->z - tempstat->z); dztp1 = abs(tryz - tempstat->z); if (widestat && (dztp1 <= MINSTATZDIFF) && zstoppable && (ocl != b_heinrichobj) ) CheckStepping(ob,tempstat,MINSTATZDIFF); dztp1 = abs(tryz - tempstat->z); #if (SHAREWARE == 0) if ((ocl == b_darksnakeobj) && (tempstat->itemnumber == stat_heatgrate)) { if (ob->state->think == T_DarkSnakeChase) NewState(ob,&s_darkmonkredhead); else NewState(ob,&s_darkmonkredlink); ob->temp3 ++; // make shootable } #endif if (specialstat==true) continue; if ((dztp1 >= MINSTATZDIFF) || (dzt >= MINSTATZDIFF)) {if ((dzt >= MINSTATZDIFF) && (dztp1 <= MINSTATZDIFF) && zstoppable) {//ob->momentumz = 0; if (ob->z <= tempstat->z) { ob->z = tempstat->z - MINSTATZDIFF; ob->momentumz = 0; } else ob->momentumz = 2*GRAVITY; // ((2*GRAVITY + GRAVITY) >> 16) = 1 } continue; } if (ocl == boulderobj) {if ((tempstat->itemnumber < stat_bcolumn) || (tempstat->itemnumber > stat_icolumn) ) { tempstat->flags |= FL_SHOOTABLE; DamageThing(tempstat,tempstat->hitpoints); continue; } #if (SHAREWARE == 0) else NewState(ob,&s_bouldersink1); #endif } //ob->momentumz=0; //return false; SPRSTOP=true; if (!ob->momentumz) return NO_MOVEMENT; } } } if (SPRSTOP == true) return Z_MOVEMENT_ONLY; return OK_TO_CONTINUE; } //============== Platform craziness ====================================== #define ClipHeight(ob,clipz) \ { ob->momentumz = 0; \ \ if (ISPLAYER && (ob->z != clipz) && (ob->temp2 == 0)) \ {playertype *pstate; \ int dz = ob->z - clipz; \ \ M_LINKSTATE(ob,pstate); \ \ pstate->heightoffset = pstate->oldheightoffset + dz; \ ob->temp2 = (dz >= 0)?(STEPUP):(STEPDOWN); \ } \ \ ob->z = clipz; \ } //====================== #define CheckSpecialGibMovement(blocker) \ { \ int centerx = ((trytilex<<16) + 0x8000); \ int centery = ((trytiley<<16) + 0x8000); \ \ if (blocker->vertical==false) \ { \ int dyt = centery - ob->y; \ int dytp1 = centery - tryy; \ \ if ((abs(dytp1) > abs(dyt)) && \ (SGN(dyt) == SGN(dytp1)) \ ) \ return OK_TO_CONTINUE; \ \ } \ else \ { \ int dxt = centerx - ob->x; \ int dxtp1 = centerx - tryx; \ \ if ((abs(dxtp1) > abs(dxt)) && \ (SGN(dxt) == SGN(dxtp1)) \ ) \ return OK_TO_CONTINUE; \ \ } \ } movement_status CheckMaskedWalls(objtype *ob,int tryx,int tryy,int tryz) { int trytilex,trytiley; boolean MWALLSTOP; int ISPLAYER = (ob->obclass == playerobj); classtype ocl = ob->obclass; trytilex = (tryx >> TILESHIFT); trytiley = (tryy >> TILESHIFT); MWALLSTOP = false; //for (y=tileylow;y<=tileyhigh;y++) // for (x=tilexlow;x<=tilexhigh;x++) if (M_ISMWALL(trytilex,trytiley)) { int wall = tilemap[trytilex][trytiley]; maskedwallobj_t * mw; mw=maskobjlist[wall&0x3ff]; if (ocl == inertobj) CheckSpecialGibMovement(mw); if (!(mw->flags&MW_BLOCKING)) { if (mw->flags&MW_NONDOGBLOCKING) { if ((ocl==playerobj)&&(ob->flags&FL_DOGMODE)) { if (ob->z < nominalheight) { MWALLSTOP = true; if (!ob->momentumz) return NO_MOVEMENT; } } else { MWALLSTOP = true; if (!ob->momentumz) return NO_MOVEMENT; } } else { if (mw->flags & MW_ABOVEPASSABLE) {if (mw->flags & MW_MIDDLEPASSABLE) // ==> not bottom {if (ob->z > LOWFALLCLIPZ+MAXSTEPHEIGHT) MWALLSTOP = true; else if (tryz >= LOWFALLCLIPZ) ClipHeight(ob,LOWFALLCLIPZ); } else if (mw->flags & MW_BOTTOMPASSABLE) {if ((ob->z > HIGHFALLCLIPZ+MAXSTEPHEIGHT) && (ob->z < LOWRISECLIPZ)) MWALLSTOP = true; else if (ob->z <= HIGHFALLCLIPZ+MAXSTEPHEIGHT) {if (tryz >= HIGHFALLCLIPZ) ClipHeight(ob,HIGHFALLCLIPZ); } else if (tryz <= LOWRISECLIPZ) ob->momentumz = 0; } else // ==> above only {if (ob->z > HIGHFALLCLIPZ+MAXSTEPHEIGHT) MWALLSTOP = true; else if (tryz >= HIGHFALLCLIPZ) ClipHeight(ob,HIGHFALLCLIPZ); } } else if (mw->flags & MW_MIDDLEPASSABLE) {if (mw->flags & MW_BOTTOMPASSABLE) //==> not above passable {if (ob->z >= HIGHRISECLIPZ) {if (tryz <= HIGHRISECLIPZ) ob->momentumz = 0; } else if (tryz <= HIGHRISECLIPZ) MWALLSTOP = true; } else //==> middle only {if (ob->z > LOWFALLCLIPZ+MAXSTEPHEIGHT) MWALLSTOP = true; else if (tryz >= LOWFALLCLIPZ) ClipHeight(ob,LOWFALLCLIPZ) else {if (ob->z >= HIGHRISECLIPZ) {if (tryz <= HIGHRISECLIPZ) ob->momentumz = 0; } else if (tryz <= HIGHRISECLIPZ) MWALLSTOP = true; } } } else // ==> bottompassable only {if (ob->z < LOWRISECLIPZ) MWALLSTOP = true; else if (tryz < LOWRISECLIPZ) ob->momentumz = 0; } } } else { if ( (mw->flags&MW_SHOOTABLE) && (mw->flags&MW_BLOCKINGCHANGES) && (ob->z >= nominalheight) ) { int speed=FindDistance(ob->momentumx,ob->momentumy); if ((speed>0x2800) && (!(ob->flags & FL_DYING))) { if (ob->obclass == playerobj) { DamageThing(ob,10); Collision(ob,(objtype*)mw,0,0); } UpdateMaskedWall(wall&0x3ff); if (tryz < nominalheight) ob->momentumz = 0; } else { MWALLSTOP = true; if (!ob->momentumz) return NO_MOVEMENT; } } else { MWALLSTOP = true; if (!ob->momentumz) return NO_MOVEMENT; } } } if (MWALLSTOP == true) return Z_MOVEMENT_ONLY; return OK_TO_CONTINUE; } movement_status CheckDoors(objtype *ob,int tryx,int tryy,int tryz) { int trytilex,trytiley; int ocl; trytilex = (tryx >> TILESHIFT); trytiley = (tryy >> TILESHIFT); ocl = ob->obclass; if (M_ISDOOR(trytilex,trytiley)) { doorobj_t*tempdoor; int doorn; doorn = tilemap[trytilex][trytiley]; tempdoor = doorobjlist[doorn&0x3ff]; if (tempdoor->action == dr_open) { if (ob->z >= nominalheight) { if (tryz < nominalheight) ob->momentumz = 0; return OK_TO_CONTINUE; } } if (ocl == inertobj) { CheckSpecialGibMovement(tempdoor); } else if ((ocl == playerobj) || (ocl > b_darksnakeobj)) return NO_MOVEMENT; else if (ob->state->think != T_Collide) { #define DOOR_LOCKED(door) \ (((door->flags & DF_ELEVLOCKED) || (door->lock)) && \ (ob->obclass != b_darianobj) \ ) #define GAS_DOOR(x,y) (MISCVARS->GASON && (MAPSPOT(x,y,1) == GASVALUE)) if ((!DOOR_LOCKED(tempdoor)) && (!GAS_DOOR(trytilex,trytiley)) ) //) { ob->door_to_open = doorn&0x3ff; LinkedOpenDoor(ob->door_to_open); if (tempdoor->eindex != -1) OperateElevatorDoor(doorn&0x3ff); } //if ((nstate = M_S(USE)) != NULL) //{ob->whatever = ob->state; // NewState(ob,nstate); // ob->flags |= FL_USE; // } return NO_MOVEMENT; } else return NO_MOVEMENT; } return OK_TO_CONTINUE; } boolean ActorTryMove(objtype*ob,int tryx, int tryy, int tryz) { movement_status (*reduced_movement_check[3])(objtype*,int,int,int)= { CheckRegularWalls, CheckMaskedWalls, CheckDoors, }; movement_status (*complete_movement_check[5])(objtype*,int,int,int)= { CheckOtherActors, CheckRegularWalls, CheckStaticObjects, CheckMaskedWalls, CheckDoors, }; movement_status (**movement_function)(objtype*,int,int,int); movement_status movement_check_result; int numcheckfunctions; int i; boolean xyblocked; if ((tryz < -30) && (sky==0) && (ob->obclass != inertobj)) { ob->z = -28; ob->momentumz = 0; return false; } if ((!InMapBounds(tryx>>16,tryy>>16)) || ((ob->obclass != playerobj) && (IsWindow((tryx>>16),(tryy>>16)))) ) return false; switch(ob->obclass) { case inertobj: case bladeobj: case firejetobj: movement_function = &reduced_movement_check[0]; numcheckfunctions = 3; break; default: movement_function = &complete_movement_check[0]; numcheckfunctions = 5; break; } for(xyblocked=false,i=0;ix + pwall->momentumx); tryy = (pwall->y + pwall->momentumy); trytilex = (tryx >> 16); trytiley = (tryy >> 16); areanumber = AREANUMBER(trytilex,trytiley); for(temp=firstareaactor[areanumber];temp;temp=temp->nextinarea) { tcl = temp->obclass; if (temp->flags & FL_HEAD) //ignore NME's head and wheels continue; if ((temp->flags & FL_DYING) || (!(temp->flags & FL_SHOOTABLE))) continue; if (tcl > b_darianobj) continue; dx = abs(tryx - temp->x); if (dx > actrad) continue; dy = abs(tryy - temp->y); if (dy > actrad) continue; if (pwall->flags&PW_DAMAGE) {if (!((tcl == playerobj) && (temp->flags & FL_AV))) DamageThing(temp,5); Collision(temp,(objtype*)pwall,0,0); M_CheckPlayerKilled(temp); if (temp->flags & FL_DYING) return; } pushem=false; switch (pwall->dir) { #define PWALLTOL (0xc000) case north: if ((temp->yy) && (dxx>pwall->x) && (dyyy) && (dxx>pwall->x) && (dyyy) && (dxxx) && (dyy>pwall->y) && (dxxx) && (dyy>pwall->y) && (dxx>pwall->x) && (dyy>pwall->y) && (dxxx) && (dydir); break; } //if (!pushem) //continue; //temp->momentumx = temp->momentumy = 0; if (temp->obclass==playerobj) temp->flags|=FL_PUSHED; if (!pushem) { Collision(temp,(objtype*)pwall,-temp->momentumx,-temp->momentumy); continue; } if ((temp->obclass >= lowguardobj) && (temp->obclass < roboguardobj)) { temp->momentumx = temp->momentumy = temp->momentumz = 0; temp->hitpoints = 0; if (gamestate.violence >= vl_high) temp->flags |= FL_HBM; Collision(temp,(objtype*)pwall,0,0); /* if (gamestate.violence < vl_high) {if ((tstate = UPDATE_STATES[CRUSH][temp->obclass - lowguardobj])!=NULL) NewState(temp,tstate); else Error("\n\Null low-violence crush state in push wall crush, instance of %s",debugstr[temp->obclass]); } else {temp->shapeoffset = 0; //tactor->flags|=FL_HBM; NewState(temp,&s_guts1); //KillActor(temp); }*/ SD_PlaySoundRTP(SD_ACTORSQUISHSND,temp->x,temp->y); } else { if (!ActorTryMove(temp,temp->x + temp->momentumx,temp->y + temp->momentumy, temp->z + (temp->momentumz >> 16)) ) { DamageThing(temp,30); if ((temp->obclass==playerobj) && (temp->hitpoints <= 0)) temp->target = (objtype *)pwall; } Collision(temp,(objtype*)pwall,pwall->momentumx-temp->momentumx,pwall->momentumy-temp->momentumy); M_CheckPlayerKilled(temp); } } } void ActorMovement (objtype *ob) { int max = 0; if ((ob->obclass == strikeguardobj) && (!(ob->flags & FL_DYING)) && (gamestate.difficulty > gd_easy) ) { AvoidPlayerMissile(ob); ob->flags &= ~FL_FULLLIGHT; } if ((!ob->momentumx) && (!ob->momentumy) && (!ob->momentumz)) {if (ob->flags & FL_RIDING) goto ride; else return; } int limitok = 1; int friction = ACTORFRICTION; if (!(ob->flags & FL_DYING)) friction >>= 1; int ocl = ob->obclass; if (ocl == playerobj) { playertype *pstate; M_LINKSTATE(ob,pstate); max = pstate->topspeed; friction = PLAYERFRICTION; if ((ob->temp2 == PITFALL) || (ob->temp2 == PITRISE)) friction >>= 4; } else if (/*(ob->state->think != T_Collide) &&*/ (ocl != b_robobossobj) && (ocl != boulderobj) && (ocl !=b_darkmonkobj) && (ocl != b_darksnakeobj) && (ocl != inertobj) && (ocl != collectorobj)) max = MAXMOVE; else limitok = 0; if (limitok) {if (ocl == playerobj) {int dist,scale; dist = FindDistance(ob->momentumx,ob->momentumy); if (dist > max) {scale = FixedDiv2(max,dist); ob->momentumx = FixedMul(ob->momentumx,scale); ob->momentumy = FixedMul(ob->momentumy,scale); } } else { if (ob->momentumx > max) ob->momentumx = max; else if (ob->momentumx < -max) ob->momentumx = -max; if (ob->momentumy > max) ob->momentumy = max; else if (ob->momentumy < -max) ob->momentumy = -max; } } int tryx = ob->x + ob->momentumx; int tryy = ob->y + ob->momentumy; int tryz = ob->z + (ob->momentumz >> 16); if (ocl != playerobj) ob->flags &= ~FL_STUCK; if (!ActorTryMove (ob, tryx, tryy, tryz)) {if (ocl == playerobj) {if (!(ob->flags & FL_ELASTO)) PlayerSlideMove (ob); else {if (ActorTryMove(ob,tryx, ob->y-ob->momentumy,tryz)) ob->momentumy = -(ob->momentumy); else if (ActorTryMove(ob,ob->x-ob->momentumx,tryy,tryz)) ob->momentumx = -(ob->momentumx); else ZEROMOM; } } else {ZEROMOM; ob->flags |= FL_STUCK; return; } } MoveActor(ob); ride: if (ob->flags & FL_RIDING) { objtype *ride = (objtype*)(ob->whatever); ob->z += (ride->momentumz >> 16); if ((ride->momentumx || ride->momentumy) && ActorTryMove(ob,ob->x+ride->momentumx,ob->y+ride->momentumy,tryz) ) SetFinePosition(ob,ob->x+ride->momentumx,ob->y+ride->momentumy); } #define SLIDER(ob) ((ob->flags & FL_NOFRICTION) && (ob->state->think != T_Collide)) #define AIRBORNE(ob) ((ob->obclass != playerobj) && (ob->z != nominalheight) &&\ (!IsPlatform(ob->tilex,ob->tiley)) && \ (DiskAt(ob->tilex,ob->tiley) == NULL) \ ) if (SLIDER(ob) || AIRBORNE(ob)) return; if ( (abs(ob->momentumx) < STOPSPEED) && (abs(ob->momentumy) < STOPSPEED) ) { ZEROMOM; } else if ((ob->flags & FL_DYING) && (ob->state == ob->state->next)) {ob->momentumx = FixedMul (ob->momentumx, DEADFRICTION); ob->momentumy = FixedMul (ob->momentumy, DEADFRICTION); } else {ob->momentumx = FixedMul (ob->momentumx, friction); ob->momentumy = FixedMul (ob->momentumy, friction); } } void T_Guts(objtype*ob) {if (ob->ticcount) return; SpawnParticles(ob,GUTS,50); } void T_Special(objtype*ob) { if (ob->ticcount) return; #if (SHAREWARE == 0) if (ob->state == &s_NMEheadexplosion) { ob->z -= 42; SetGibSpeed(0x4000); SpawnParticles(ob,gt_sparks,100); ResetGibSpeed(); SD_PlaySoundRTP(SD_EXPLODESND,ob->x,ob->y); return; } #endif if (ob->obclass != b_robobossobj) return; NewState(ob,&s_bossdeath); } void SpawnBoulder(int tilex,int tiley,int dir) { #if (SHAREWARE == 1) tilex = tilex; tiley = tiley; dir = dir; Error("Boulders aren't allowed in shareware!"); #endif #if (SHAREWARE == 0) SpawnNewObj(tilex,tiley,&s_boulderspawn,inertobj); new->z = 0; PreCacheActor(boulderobj,0); new->dir = 2*dir; #endif } #define InitSprayPart(newflags) \ { \ new->hitpoints = starthitpoints[gamestate.difficulty][b_robobossobj]; \ new->dir = dir*4; \ new->speed = 7*SPDPATROL; \ new->door_to_open = -1; \ new->flags |= (newflags); \ } \ void SpawnMultiSpriteActor(classtype actorclass, int tilex,int tiley,int dir) { #if (SHAREWARE==1) actorclass = actorclass; tilex = tilex; tiley = tiley; dir = dir; Error("\nSPRAY not allowed in shareware !"); #else { objtype *temp; gamestate.killtotal++; SpawnNewObj(tilex,tiley,&s_NMEstand,actorclass); InitSprayPart(FL_BLOCK|FL_NOFRICTION|FL_SHOOTABLE); new->temp1 = -1; // temp1 used as one-event queue for directions when chasing // -1 when isn't waiting to try new dir, dirnumber when waiting temp = new; SpawnNewObj(tilex,tiley,&s_NMEhead1,actorclass); InitSprayPart(FL_NOFRICTION|FL_SHOOTABLE|FL_HEAD|FL_NEVERMARK); //new->whatever = temp; // head points to body temp->whatever = new; // body points to head SpawnNewObj(tilex,tiley,&s_NMEwheels2,actorclass); InitSprayPart(FL_NOFRICTION|FL_SHOOTABLE|FL_HEAD|FL_NEVERMARK); //new->whatever = temp; // head points to body temp->target = new; // body also points to wheels actorat[tilex][tiley] = NULL; PreCacheActor(b_robobossobj,0); } #endif } void SpawnSnake(int tilex,int tiley) { #if (SHAREWARE == 1) tilex = tilex; tiley = tiley; Error("snake not allowed in shareware!"); #else GetNewActor(); MakeActive(new); new->flags |= (FL_DONE|FL_ABP|FL_NEVERMARK); SetTilePosition(new,tilex,tiley); SetVisiblePosition(new,new->x,new->y); new->obclass = b_darkmonkobj; new->which = ACTOR; new->z = nominalheight; if (SNAKELEVEL == 2) NewState(new,&s_darkmonkfastspawn); else NewState(new,&s_darkmonkhspawn); #endif } void SpawnGunThingy(classtype which, int tilex, int tiley, int dir) { #if (SHAREWARE == 1) which = which; tilex = tilex; tiley = tiley; dir = dir; Error("no emplacements allowed in shareware!"); #else SpawnNewObj(tilex,tiley,&s_gunstand,which); if (!loadedgame) gamestate.killtotal++; PreCacheActor(patrolgunobj,0); new->hitpoints = starthitpoints[gamestate.difficulty][which]; new->dir = dir*2; // new->speed = 0x500; // ParseMomentum(new,dirangle8[new->dir]); new->flags |= (FL_BLOCK|FL_SHOOTABLE); #endif } void SpawnFourWayGun(int tilex, int tiley) { #if (SHAREWARE == 1) tilex = tilex; tiley = tiley; Error("no 4-way emplacements allowed in shareware!"); #else SpawnNewObj(tilex,tiley,&s_4waygun,patrolgunobj); if (!loadedgame) gamestate.killtotal++; PreCacheActor(patrolgunobj,0); new->temp1 = -1; new->hitpoints = starthitpoints[gamestate.difficulty][patrolgunobj]*3; new->flags |= (FL_BLOCK|FL_SHOOTABLE); #endif } /* ======================================================================= = = NON-SHAREWARE CODE = ======================================================================= */ #if (SHAREWARE == 0) void T_BoulderSpawn(objtype*ob) {objtype *tactor; int dx,dy,cl; if (!(ob->flags & FL_ACTIVE)) return; else if (!ob->ticcount) {for(tactor = firstareaactor[ob->areanumber];tactor;tactor = tactor->nextinarea) {cl = tactor->obclass; if (tactor == ob) continue; if (!(tactor->flags & FL_SHOOTABLE)) continue; dx = abs(tactor->x - ob->x); if (dx > MINACTORDIST) continue; dy = abs(tactor->y - ob->y); if (dy > MINACTORDIST) continue; if ((cl == b_heinrichobj) || (cl== b_darkmonkobj) || (cl == b_darianobj) || (cl == b_robobossobj) || (cl == pillarobj) || (cl == wallopobj) || (cl == boulderobj)) return; else break; } SpawnNewObj(ob->tilex,ob->tiley,&s_boulderdrop1,boulderobj); new->z = 0; new->dir = ob->dir; //new->angle = dirangle8[new->dir]; new->speed = 0x4000; ParseMomentum(new,dirangle8[new->dir]); new->flags |= (FL_BLOCK|FL_NOFRICTION); new->flags &= ~FL_SHOOTABLE; new->whatever = ob; if (tactor) new->target = tactor; MakeActive(new); new->flags |= FL_ABP; } } void T_BoulderDrop(objtype*ob) {int dx,dy,dz; objtype * tactor; statetype *tstate; if (ob->state == &s_boulderdrop12) { if (ob->z == nominalheight) NewState(ob,&s_boulderroll1); else if (ob->momentumz) {ob->z += (ob->momentumz>>16); ob->momentumz += (GRAVITY<<1); if (ob->z > nominalheight) {ob->z = nominalheight; ob->momentumz = 0; //ob->flags &= ~FL_NOFRICTION; } } else if (!ob->temp1) {ob->momentumz = (GRAVITY<<6); ob->temp1 = 1; } } if (ob->ticcount) return; if (ob->state->condition & SF_SOUND) SD_PlaySoundRTP(SD_BOULDERFALLSND,ob->x,ob->y); tactor = (objtype*)(ob->target); if (tactor && (!(tactor->flags & FL_DYING))) {dx = tactor->x - ob->x; dy = tactor->y - ob->y; dz = tactor->z - ob->z; if ((abs(dx) < MINACTORDIST) && (abs(dy) < MINACTORDIST) && (abs(dz) < 50)) {if (tactor->obclass != playerobj) {tactor->momentumx = tactor->momentumy = tactor->momentumz = 0; tactor->flags |= FL_DYING; tactor->hitpoints = 0; if (gamestate.violence < vl_high) {if ((tstate = UPDATE_STATES[CRUSH][tactor->obclass - lowguardobj])!=NULL) NewState(tactor,tstate); //else //Error("\n\Null low-violence crush state in boulder drop, instance of %s",debugstr[tactor->obclass]); } else {tactor->shapeoffset = 0; //tactor->flags|=FL_HBM; NewState(tactor,&s_guts1); } } else {DamageThing(tactor,200); Collision(tactor,ob,0,0); M_CheckPlayerKilled(tactor); } SD_PlaySoundRTP(SD_ACTORSQUISHSND,tactor->x,tactor->y); ob->target = NULL; } } } void CheckCrush(objtype*ob) { objtype *temp; int dx,dy,dz; for(temp = PLAYER[0];temp != PLAYER[numplayers-1]->next;temp=temp->next) { if (ob->flags & FL_DYING) continue; dx = abs(temp->x - ob->x); if (dx > MINACTORDIST) continue; dy = abs(temp->y - ob->y); if (dy > MINACTORDIST) continue; dz = abs(temp->z - ob->z); if (dz > (MINACTORDIST>>10)) continue; if (!ob->ticcount) DamageThing(temp,EnvironmentDamage(ob)); Collision(temp,ob,ob->momentumx-temp->momentumx,ob->momentumy-temp->momentumy); M_CheckPlayerKilled(temp); } } void T_BoulderMove(objtype*ob) { if (MAPSPOT(ob->tilex,ob->tiley,1) == 395) {NewState(ob,&s_bouldersink1); return; } if (NOMOM) ParseMomentum(ob,dirangle8[ob->dir]); if ((!ob->ticcount) && (ob->state->condition & SF_SOUND) && areabyplayer[ob->areanumber]) SD_PlaySoundRTP(BAS[ob->obclass].operate,ob->x,ob->y); SelectPathDir(ob); } /* ========================================================================= = = Boss Functions = ========================================================================= */ //***************************** Esau ************************************ enum { ESAU_USING_HOLES=1, ESAU_LEAVING_CONTROL_ROOM, ESAU_USING_TOUCH_PEDASTALS, ESAU_CHASING_PLAYER }; void T_EsauWait(objtype*ob) { int dist; dist = FindDistance(ob->tilex-PLAYER[0]->tilex,ob->tiley-PLAYER[0]->tiley); MISCVARS->ESAU_SHOOTING = false; if (ob->dirchoosetime) ob->dirchoosetime --; if ((dist>81) || (dist<36)) { if (CheckLine(ob,PLAYER[0],MISSILE)) { NewState(ob,&s_darianshoot1); ob->momentumx = ob->momentumy = 0; } return; } else if ((!ob->dirchoosetime) && (CheckLine(ob,PLAYER[0],SHOOT))) { NewState(ob,&s_dariandefend1); ob->dirchoosetime = (GameRandomNumber("T_EsauWait",0) % 35) + 17;//35; return; } } void T_EsauRise(objtype*ob) { int newarea,oldarea; // if (gamestate.victoryflag) // return; if (!ob->ticcount) {//Debug("\n tx before: %d, ty before: %d", // ob->targettilex,ob->targettiley); SelectTouchDir(ob); if (ob->targettilex || ob->targettiley) {//Debug("\n ob->tilex: %d, ob->tiley: %d, targettilex: %d, targettiley: %d", // ob->tilex, ob->tiley, ob->targettilex, ob->targettiley); SetTilePosition(ob,ob->targettilex,ob->targettiley); SetVisiblePosition(ob,ob->x,ob->y); oldarea = ob->areanumber; newarea = AREANUMBER(ob->tilex,ob->tiley); if (oldarea != newarea) { RemoveFromArea(ob); ob->areanumber = newarea; MakeLastInArea(ob); } } else MISCVARS->EPOP[ob->temp3].x = MISCVARS->EPOP[ob->temp3].y = 0; ob->dirchoosetime= (GameRandomNumber("T_EsauRise",0) % 35) + 17; MISCVARS->ESAU_HIDING = false; MISCVARS->ESAU_SHOOTING = true; ob->flags |= FL_SHOOTABLE; } } void T_EsauChase(objtype*ob) { int dx,dy,chance,dist; statetype *temp; if ((ob->tilex == ob->targettilex) && (ob->tiley == ob->targettiley)) { if (MISCVARS->DSTATE == ESAU_USING_HOLES) { MISCVARS->ESAU_HIDING = true; MISCVARS->ESAU_SHOOTING = false; SD_PlaySoundRTP(SD_DARIANHIDESND,ob->x,ob->y); NewState(ob,&s_dariansink1); ob->flags &= ~FL_SHOOTABLE; return; } else if (MISCVARS->DSTATE == ESAU_LEAVING_CONTROL_ROOM) { if (!MISCVARS->doorcount) { SetTilePosition(ob,ob->tilex,ob->tiley); SetVisiblePosition(ob,ob->x,ob->y); } MISCVARS->doorcount ++; if (MISCVARS->doorcount == 4) MISCVARS->DSTATE = ESAU_USING_HOLES; else // hack to FORCE esau to walk through door { switch (ob->temp1) { case east: ob->targettilex ++; break; case west: ob->targettilex --; break; case north: ob->targettiley --; break; case south: ob->targettiley ++; break; } } SelectTouchDir(ob); return; } } if (touchsprite && (touchsprite->itemnumber == stats[stat_dariantouch].type)) { dx = touchsprite->x - ob->x; dy = touchsprite->y - ob->y; if (((dx > -0x5000) && (dx < 0x5000)) && ((dy > -0x5000) && (dy < 0x5000))) { SD_PlaySoundRTP(SD_DARIANGONNAUSESND,ob->x,ob->y); NewState(ob,&s_darianuse1); return; } } if (ob->dirchoosetime) ob->dirchoosetime --; if (NOMOM || (!ob->dirchoosetime)) { SelectTouchDir(ob); ob->dirchoosetime = M_CHOOSETIME(ob); } else ActorMovement(ob); if (!ob->ticcount) { if (CheckLine(ob,PLAYER[0],MISSILE)) // got a shot at player? { if (Near(ob,PLAYER[0],1)) chance = 300; else { dx = abs(PLAYER[0]->tilex-ob->tilex); dy = abs(PLAYER[0]->tiley-ob->tiley); dist = (dx>dy)?dx:dy; chance = 400/dist; } if (GameRandomNumber("T_EsauChase",0) dirchoosetime = 0; ob->momentumx = ob->momentumy = 0; SetVisiblePosition(ob,ob->x,ob->y); return; } } if (MISCVARS->ESAU_SHOOTING) { SetVisiblePosition(ob,ob->x,ob->y); return; } } } } void T_EsauSpears(objtype*ob) { if (ob->ticcount == (ob->state->tictime>>1)-1) { OLDTILEX = PLAYER[0]->tilex; OLDTILEY = PLAYER[0]->tiley; } else if (!ob->ticcount) { SpawnNewObj(OLDTILEX,OLDTILEY,&s_speardown1,spearobj); new->flags |= FL_ABP; MakeActive(new); } } void FindDoor(objtype*ob) { int i,area1,area2,min,curr, dest1x,dest1y,dest2x,dest2y, d1,d2; dirtype tdir1,tdir2; doorobj_t*dr; min = 0x7fffffff; for(i=0;ivertical) { area1 = MAPSPOT(dr->tilex-1,dr->tiley,0)-AREATILE; dest1x = dr->tilex-1; dest1y = dr->tiley; tdir1 = east; area2 = MAPSPOT(dr->tilex+1,dr->tiley,0)-AREATILE; dest2x = dr->tilex+1; dest2y = dr->tiley; tdir2 = west; } else { area1 = MAPSPOT(dr->tilex,dr->tiley-1,0)-AREATILE; dest1x = dr->tilex; dest1y = dr->tiley-1; tdir1 = south; area2 = MAPSPOT(dr->tilex,dr->tiley+1,0)-AREATILE; dest2x = dr->tilex; dest2y = dr->tiley+1; tdir2 = north; } //============================================================ #define CheckMinDist(destx,desty,dir) \ { \ curr = FindDistance(destx-ob->tilex,desty-ob->tiley); \ if (curr < min) \ { \ min = curr; \ ob->targettilex = destx; \ ob->targettiley = desty; \ ob->temp1 = dir; \ } \ } //============================================================ if (area1 == ob->areanumber) { if (area1 == area2) { d1 = FindDistance(dest1x-ob->tilex,dest1y-ob->tiley); d2 = FindDistance(dest2x-ob->tilex,dest2y-ob->tiley); if (d2 < d1) //swap areas { CheckMinDist(dest2x,dest2y,tdir2); continue; } } CheckMinDist(dest1x,dest1y,tdir1); } else if (area2 == ob->areanumber) CheckMinDist(dest2x,dest2y,tdir2); } } int FindTouch(objtype *ob) { int i,curr,min,tx,ty,noneleft; statobj_t* tempstat; min = 0x7fffffff; noneleft = 1; for(i=0;inexttouch;i++) { if (MISCVARS->ETOUCH[i].x || MISCVARS->ETOUCH[i].y) { noneleft = 0; tx = MISCVARS->ETOUCH[i].x; ty = MISCVARS->ETOUCH[i].y; tempstat = sprites[tx][ty]; curr = FindDistance(tx-ob->tilex,ty-ob->tiley); if (curr < min) { min = curr; ob->targettilex = tx; ob->targettiley = ty; touchsprite = tempstat; } } } return (!noneleft); } typedef enum { down_in_a_hole=-1, no_holes_available=0, holes_unreachable=1, hole_targetted=2 }hiding_status; hiding_status HoleStatus(objtype*ob) { int i,tx,ty,dist,noneleft,invisible,curr,min; tpoint dummy,*dptr = &dummy; objtype *tactor; _2Dpoint *tdptr; min = 0x7fffffff; noneleft = 1; for(i=0;inextpop;i++) { tdptr = &(MISCVARS->EPOP[i]); if (tdptr->x || tdptr->y) { tactor = (objtype*)actorat[tdptr->x][tdptr->y]; if (tactor && (tactor->obclass == pillarobj)) { tdptr->x = 0; tdptr->y = 0; MISCVARS->popsleft --; } } } if (MISCVARS->popsleft > 1) { for(i=0;inextpop;i++) { tdptr = &(MISCVARS->EPOP[i]); if (tdptr->x || tdptr->y) { tx = tdptr->x; ty = tdptr->y; if ((PLAYER[0]->tilex == tx) || (PLAYER[0]->tiley == ty)) continue; if (MISCVARS->ESAU_HIDING) { dist = FindDistance(PLAYER[0]->tilex-tx,PLAYER[0]->tiley-ty); if ((ob->tilex == tx) && (ob->tiley == ty) && (MISCVARS->popsleft != 1)) continue; noneleft = 0; if ((MAPSPOT(tx,ty,0)-AREATILE) == ob->areanumber) { ob->targettilex = tx; ob->targettiley = ty; ob->temp3 = i; if ((dist < 81) && (dist > 36)) return down_in_a_hole; } } else if (!MISCVARS->ESAU_SHOOTING) { curr = FindDistance(tx-ob->tilex,ty-ob->tiley); if (curr < min) { min = curr; noneleft = 0; dptr->which = ACTOR; SetTilePosition(dptr,tx,ty); //dptr->x = (tx << TILESHIFT) + TILEGLOBAL/2; //dptr->y = (ty << TILESHIFT) + TILEGLOBAL/2; dptr->z = ob->z; invisible = 0; if ((!CheckLine(ob,dptr,SHOOT)) && (MISCVARS->DSTATE != ESAU_USING_HOLES)) { invisible = 1; MISCVARS->DSTATE = ESAU_LEAVING_CONTROL_ROOM; } else MISCVARS->DSTATE = ESAU_USING_HOLES; ob->targettilex = tx; ob->targettiley = ty; } } } } } if (MISCVARS->ESAU_HIDING) return down_in_a_hole; if (noneleft) { MISCVARS->DSTATE = ESAU_CHASING_PLAYER; return no_holes_available; } if (invisible) //leave present room return holes_unreachable; return hole_targetted; } void SelectTouchDir (objtype *ob) { int dx,dy; hiding_status hole; dirtype d[3]; dirtype tdir, olddir, turnaround; olddir=ob->dir; turnaround= opposite[olddir]; if (!MISCVARS->notouch) { if (!FindTouch(ob)) MISCVARS->notouch = 1; else MISCVARS->DSTATE = ESAU_USING_TOUCH_PEDASTALS; } else if ((!MISCVARS->noholes) && (MISCVARS->DSTATE != ESAU_LEAVING_CONTROL_ROOM)) { hole = HoleStatus(ob); switch(hole) { case down_in_a_hole: return; case no_holes_available: MISCVARS->noholes = 1; break; case holes_unreachable: FindDoor(ob); break; default: break; } } else if (MISCVARS->DSTATE == ESAU_CHASING_PLAYER) // only gets here if all gimmicks (touch tables, // holes) are inoperative { ob->flags |= FL_SHOOTABLE; ob->targettilex = PLAYER[0]->tilex; ob->targettiley = PLAYER[0]->tiley; } /* if (DSTATE == SDOOR) {dx = ((ob->targettilex<<16)+TILEGLOBAL/2) - ob->x; dy = ob->y - ((ob->targettiley<<16)+TILEGLOBAL/2); angle = atan2_appx(dx,dy); ZEROMOM; ParseMomentum(ob,angle); ActorMovement(ob); if (ob->momentumx || ob->momentumy) {ob->angle = angle; ob->dir = angletodir[ob->angle]; return; } } else */ dx = ob->targettilex - ob->tilex; dy = ob->tiley - ob->targettiley; d[1]=nodir; d[2]=nodir; if (dx>0) d[1]= east; else if (dx<0) d[1]= west; if (dy>0) d[2]=north; else if (dy<0) d[2]=south; if (GameRandomNumber("SelectTouchDir",0)<128) { tdir=d[1]; d[1]=d[2]; d[2]=tdir; } ZEROMOM; if (d[1]!=nodir) M_CHECKDIR(ob,d[1]); if (d[2]!=nodir) M_CHECKDIR(ob,d[2]); if (GameRandomNumber("SelectTouchDir",ob->obclass)>128) //randomly determine direction of search { for (tdir=north;tdir<=west;tdir++) { if (tdir!=turnaround) M_CHECKDIR(ob,tdir); } } else { for (tdir=west;tdir>=north;tdir--) { if (tdir!=turnaround) M_CHECKDIR(ob,tdir); } } if (turnaround != nodir) M_CHECKDIR(ob,turnaround); if (olddir!=nodir) M_CHECKDIR(ob,olddir); } //************** Krist **************************************************** void CheckRunover(objtype*ob) {int dx,dy,dz; dx = abs(PLAYER[0]->x - ob->x); if (dx > MINACTORDIST) return; dy = abs(PLAYER[0]->y - ob->y); if (dy > MINACTORDIST) return; dz = abs(PLAYER[0]->z - ob->z); if (dz > 10) return; locplayerstate->heightoffset = 18 + locplayerstate->playerheight; locplayerstate->oldheightoffset = locplayerstate->heightoffset; PLAYER[0]->temp2 = RENORMALIZE; DamageThing(PLAYER[0],30); Collision(PLAYER[0],ob,0,0); M_CheckPlayerKilled(PLAYER[0]); } void T_HeinrichChase(objtype*ob) { int dx,dy,dist,chance,perpangle; // statetype *temp; boolean doorok; CheckRunover(ob); // ob->flags &= ~FL_DODGE; if (CheckLine(ob,PLAYER[0],SIGHT)) {ob->targettilex = PLAYER[0]->x; ob->targettiley = PLAYER[0]->y; } if (!ob->ticcount) { // if (gamestate.victoryflag) // return; if (CheckLine(ob,PLAYER[0],SHOOT)) // got a shot at PLAYER[0]? {dx = abs(ob->tilex - PLAYER[0]->tilex); dy = abs(ob->tiley - PLAYER[0]->tiley); dist = dx>dy ? dx : dy; if (!dist || dist==1) chance = 300; else chance = 2400/dist; if (GameRandomNumber("T_HeinrichChase",0) which = ACTOR; dptr->x = ob->x + FixedMul(0x10000l,costable[perpangle]); dptr->y = ob->y - FixedMul(0x10000l,sintable[perpangle]); dptr->z = ob->z; if (!CheckLine(dptr,PLAYER[0],SHOOT)) goto cdoor; ob->target = PLAYER[0]; NewState(ob,M_S(AIM)); ob->dirchoosetime = 0; return; } } } cdoor: doorok = NextToDoor(ob); if (ob->dirchoosetime) ob->dirchoosetime--; if ((ob->flags & FL_STUCK) || (!ob->dirchoosetime) || doorok) {/*if ((ob->flags & FL_DODGE) && (!doorok)) SelectKristDodgeDir (ob); else */ SD_PlaySoundRTP(SD_KRISTMOTORSND,ob->x,ob->y); SelectKristChaseDir(ob); ob->dirchoosetime = 4*M_CHOOSETIME(ob); } else {if (NOMOM) ParseMomentum(ob,dirangle8[ob->dir]); ActorMovement(ob); } } void T_Heinrich_Defend (objtype*ob) { CheckRunover(ob); if (ob->dirchoosetime) ob->dirchoosetime--; if (MISCVARS->HRAMMING) ParseMomentum(ob,dirangle8[ob->dir]); if ((ob->flags & FL_STUCK) || (!ob->dirchoosetime)) {if (MISCVARS->HRAMMING) {if (!Near(ob,PLAYER[0],3)) {NewState(ob,M_S(CHASE)); ob->dirchoosetime = 0; return; } SelectKristChaseDir(ob); } else if (MISCVARS->HMINING) {SelectMineDir(ob); if (!MISCVARS->HMINING) goto hchase; ob->dirchoosetime = 5;//10; return; } else hchase: NewState(ob,M_S(CHASE)); ob->dirchoosetime = 0; } else {if (NOMOM) ParseMomentum(ob,dirangle8[ob->dir]); ActorMovement(ob); } } void T_Heinrich_Out_of_Control(objtype*ob) { if (ob->dirchoosetime) ob->dirchoosetime --; else { if (!ob->temp1) { SetGibSpeed(0x4000); SpawnParticles(ob,RANDOM,120); ResetGibSpeed(); NewState(ob,&s_dexplosion1); SD_PlaySoundRTP(SD_EXPLODESND,ob->x,ob->y); } else { ob->dir = dirorder[ob->dir][PREV]; ob->angle = dirangle8[ob->dir]; if (ob->dir == (unsigned)ob->temp2) { if (ob->temp1 > 1) ob->temp1--; else { if (ob->temp3 == 7) { SpawnNewObj(ob->tilex,ob->tiley,&s_megaexplosions,inertobj); new->temp1 = 25; new->flags |= FL_ABP; MakeActive(new); SpawnNewObj(ob->tilex,ob->tiley,&s_superparticles,inertobj); new->flags |= FL_ABP; PARTICLE_GENERATOR = new; MakeActive(new); } if (ob->temp3) ob->temp3 --; else ob->temp1 --; } } if (ob->temp1) ob->dirchoosetime = ob->temp1; else { ob->dirchoosetime = 70; // end of spin wait for megaexplosion if (PARTICLE_GENERATOR) { NewState(PARTICLE_GENERATOR,&s_megaremove); PARTICLE_GENERATOR = NULL; } } } } } void SelectKristChaseDir(objtype*ob) {int dx,dy,tx,ty,angle; dirtype dtry1,dtry2,tdir,olddir,next,prev,straight; //tpoint dummy,*dptr=&dummy; olddir=ob->dir; //dptr->which = ACTOR; //dptr->z = ob->z; if (ob->targettilex || ob->targettiley) {tx = ob->targettilex; ty = ob->targettiley; dx= tx - ob->x; dy= ob->y - ty; // SetFinePosition(dptr,tx,ty); if ( ((dx < 0x20000) && (dx > -0x20000)) && ((dy < 0x20000) && (dy > -0x20000))) { dx= PLAYER[0]->x-ob->x; dy= ob->y-PLAYER[0]->y; // SetFinePosition(dptr,PLAYER[0]->x,PLAYER[0]->y); } } else { dx= PLAYER[0]->x-ob->x; dy= ob->y-PLAYER[0]->y; //SetFinePosition(dptr,PLAYER[0]->x,PLAYER[0]->y); } angle = atan2_appx(dx,dy); straight = angletodir[angle]; /* if (ob->areanumber == PLAYER[0]->areanumber) {//tpoint newpos1,newpos2; //dirtype leftdir; //int leftangle1,leftangle2; if (CheckLine(ob,&dummy,DIRCHECK)) {//Debug("\ntrying straight dir %d",straight); M_CHECKTURN(ob,straight); //Debug("\nstraight dir %d failed",straight); } //leftdir = dirorder[straight][PREV]; //leftangle1 = dirangle8[leftdir]; //newpos1.which = ACTOR; //rightangle = dirangle[dirorder[straight][NEXT]]; //newpos1.x = ob->x + FixedMul(0x10000,costable[leftangle1]); //newpos1.y = ob->y - FixedMul(0x10000,sintable[leftangle1]); //newpos1.z = ob->z; //leftangle2 = dirangle8[dirorder[leftdir][PREV]]; //newpos2.which = ACTOR; //rightangle = dirangle[dirorder[straight][NEXT]]; //newpos2.x = ob->x + FixedMul(0x10000,costable[leftangle2]); //newpos2.y = ob->y - FixedMul(0x10000,sintable[leftangle2]); //newpos2.z = ob->z; //if (CheckLine(&newpos1,&dummy,SHOOT))// || CheckLine(&newpos2,&dummy,SHOOT)) {for(tdir = dirorder[straight][PREV];tdir != dirorder[straight][NEXT];tdir = dirorder[tdir][PREV]) {//Debug("\ntried left-hand rule dir %d",tdir); M_CHECKTURN(ob,tdir); } } //else //{for(tdir = dirorder[straight][NEXT];tdir != dirorder[straight][PREV];tdir = dirorder[tdir][NEXT]) // {//Debug("\ntrying right-hand rule dir %d",tdir); // M_CHECKTURN(ob,tdir); //Debug("\nright-hand rule dir %d failed\n",tdir); // } // } } else*/ {dtry1=nodir; dtry2=nodir; if (dx> ACTORSIZE) dtry1= east; else if (dx< -ACTORSIZE) dtry1= west; if (dy> ACTORSIZE) dtry2=north; else if (dy < -ACTORSIZE) dtry2= south; if (abs(dy)>abs(dx)) {tdir=dtry1; dtry1=dtry2; dtry2=tdir; } // ZEROMOM; ob->momentumx = FixedMul (ob->momentumx, DEADFRICTION>>gamestate.difficulty); ob->momentumy = FixedMul (ob->momentumy, DEADFRICTION>>gamestate.difficulty); M_CHECKTURN(ob,straight); if (dtry1 != nodir) M_CHECKTURN(ob,dtry1); if (dtry2 != nodir) M_CHECKTURN(ob,dtry2); if (dtry1 != nodir) {M_CHECKTURN(ob,dirorder[dtry1][NEXT]); M_CHECKTURN(ob,dirorder[dtry1][PREV]); } for(tdir = dirorder[olddir][NEXT];tdir != olddir;tdir = dirorder[tdir][NEXT]) M_CHECKTURN(ob,tdir); ob->dir = olddir; } } void T_KristLeft(objtype*ob) {CheckRunover(ob); ActorMovement(ob); if (!ob->ticcount) {SD_PlaySoundRTP(SD_KRISTTURNSND,ob->x,ob->y); if (ob->dir != (unsigned)ob->temp1) ob->dir = dirorder[ob->dir][NEXT]; else {ob->temp1 = 0; NewState(ob,&s_heinrichchase); } } } void T_KristRight(objtype*ob) {CheckRunover(ob); ActorMovement(ob); if (!ob->ticcount) {SD_PlaySoundRTP(SD_KRISTTURNSND,ob->x,ob->y); if (ob->dir != (unsigned)ob->temp1) ob->dir = dirorder[ob->dir][PREV]; else {ob->temp1 = 0; NewState(ob,&s_heinrichchase); } } } void T_KristCheckFire(objtype*ob) {int perpangle,angle; tpoint dummy; if (!ob->ticcount) {angle = AngleBetween(ob,PLAYER[0]); if (ob->state == &s_heinrichshoot1) perpangle = angle + ANGLES/4; else perpangle = angle - ANGLES/4; Fix(perpangle); dummy.which = ACTOR; dummy.x = ob->x + FixedMul(0x4000,costable[angle]) + FixedMul(0x4000l,costable[perpangle]) + FixedMul(PROJSIZE,costable[perpangle]); // offset ahead plus // offset for left/right missile plus offset for missile // radius (will missile reach player without hitting wall,etc.) dummy.y = ob->y - FixedMul(0x4000,sintable[angle]) - FixedMul(0x4000l,sintable[perpangle]) - FixedMul(PROJSIZE,sintable[perpangle]); dummy.x -= (FixedMul(PROJSIZE,costable[perpangle])<<1); dummy.y += (FixedMul(PROJSIZE,sintable[perpangle])<<1); dummy.z = ob->z; if (!CheckLine(&dummy,PLAYER[0],SHOOT)) {NewState(ob,&s_heinrichchase); return; } } } void SelectMineDir(objtype*ob) {int angle,missangle; dirtype olddir,tdir,next,prev,destdir; static int nummines=0; if (!CheckLine(ob,PLAYER[0],SIGHT)) {NewState(ob,M_S(CHASE)); MISCVARS->HMINING = 0; return; } olddir = ob->dir; angle = AngleBetween(ob,PLAYER[0]); tdir = angletodir[angle]; destdir = opposite[tdir]; if (destdir != olddir) {next = dirorder[olddir][NEXT]; prev = dirorder[olddir][PREV]; if (dirdiff[destdir][next] < dirdiff[destdir][prev]) ob->dir = next; else ob->dir = prev; return; } nummines ++; missangle = angle; if (nummines == 2) missangle -= (ANGLES/36); else if (nummines == 3) missangle += (ANGLES/36); Fix(missangle); // if (missangle > (ANGLES - 1)) // missangle -= ANGLES; // else if (missangle < 0) // missangle += ANGLES; SpawnMissile(ob,h_mineobj,0x2000,missangle,&s_mine1,0xa000); new->dirchoosetime = 140; SD_PlaySoundRTP(SD_KRISTDROPSND,ob->x,ob->y); if (nummines == 3) {MISCVARS->HMINING = 0; nummines = 0; } } void A_HeinrichShoot(objtype* ob) {int angle,perpangle; if (!ob->ticcount) {angle = AngleBetween(ob,PLAYER[0]); if (ob->state == &s_heinrichshoot4) perpangle = angle + ANGLES/4; else perpangle = angle - ANGLES/4; Fix(perpangle); SpawnMissile(ob,missileobj,0x4000,angle,&s_missile1,0x8000); SD_PlaySoundRTP(BAS[ob->obclass].fire,ob->x,ob->y); SetFinePosition(new,new->x + FixedMul(0x4000l,costable[perpangle]), new->y - FixedMul(0x4000l,sintable[perpangle])); SetVisiblePosition(new,new->x,new->y); } } //***************************///////************************************** //***************************/ NME /************************************** //***************************///////************************************** void UpdateNMELinkedActors(objtype*ob) { objtype *head,*wheels; int oldarea; head = (objtype*)(ob->whatever); wheels = (objtype*)(ob->target); oldarea = head->areanumber; SetFinePosition(head,ob->x,ob->y); SetFinePosition(wheels,ob->x,ob->y); SetVisiblePosition(head,ob->x,ob->y); SetVisiblePosition(wheels,ob->x,ob->y); if (oldarea != ob->areanumber) { RemoveFromArea(head); head->areanumber = ob->areanumber; MakeLastInArea(head); RemoveFromArea(wheels); wheels->areanumber = ob->areanumber; MakeLastInArea(wheels); } } void T_OrobotChase(objtype*ob) { int dx = 0; int dy = 0; if (CheckLine(ob,PLAYER[0],SIGHT)) { ob->targettilex = PLAYER[0]->tilex; ob->targettiley = PLAYER[0]->tiley; } if (!ob->ticcount) { if (NMEspincheck(ob)) return; dx = PLAYER[0]->x - ob->x; dy = ob->y - PLAYER[0]->y; /* if ((dx > -0x18000) && (dx < 0x18000) && (dy > -0x18000) && (dy < 0x18000)) {NewState(ob,&s_NMEavoid); return; } */ if (CheckLine(ob,PLAYER[0],SIGHT)) { int inrange = 0; switch(gamestate.difficulty) { case gd_baby: inrange = Near(ob,PLAYER[0],6);break; case gd_easy: inrange = Near(ob,PLAYER[0],9);break; case gd_medium: inrange = Near(ob,PLAYER[0],12);break; case gd_hard: inrange = 1;break; } if ((!Near(ob,PLAYER[0],3)) && inrange) { SD_PlaySoundRTP(SD_NMEREADYSND,ob->x,ob->y); if ((ob->hitpoints < 2000) && (GameRandomNumber("NME special attack",0) < 120)) { int next,prev; next = dirorder16[ob->dir][NEXT]; prev = dirorder16[ob->dir][PREV]; ob->targettilex = (angletodir[atan2_appx(dx,dy)]<<1); if (dirdiff16[prev][ob->targettilex] < dirdiff16[next][ob->targettiley]) ob->temp3 = PREV; else ob->temp3 = NEXT; NewState(ob,&s_NMEspinfire); } else { NewState(ob,&s_NMEwindup); ob->temp3 = 0; } //NewState((objtype*)(ob->target),&s_NMEwheelspin); NewState((objtype*)(ob->target),&s_NMEwheels120); return; } } } if (ob->dirchoosetime) ob->dirchoosetime --; if ((ob->flags & FL_STUCK) || (!ob->dirchoosetime)) { SelectOrobotChaseDir(ob); ob->dirchoosetime = 4;//8; } else { ActorMovement(ob); UpdateNMELinkedActors(ob); } } void T_Saucer(objtype*ob) {int angle,dangle; if (!ob->ticcount) // if on track at end of each state, accelerate // towards PLAYER[0] {if (ob->state->condition & SF_SOUND) SD_PlaySoundRTP(SD_NMEREADYSND,ob->x,ob->y); angle = AngleBetween(ob,PLAYER[0]); dangle = ob->angle - angle; if ((dangle > -(ANGLES/72)) && (dangle < (ANGLES/72))) {if (ob->speed < 0x10000) {ob->speed += 0x200; ZEROMOM; ParseMomentum(ob,ob->angle); } } else // off track; zero mom. and select new dir. {ob->speed = 0x1000; ZEROMOM; ob->angle = angle; ParseMomentum(ob,ob->angle); } } MissileMovement(ob); } void T_NME_WindUp(objtype*ob) {objtype *head,*wheels; head = (objtype*)(ob->whatever); wheels = (objtype*)(ob->target); if (ob->dirchoosetime) {ob->dirchoosetime--; return; } ob->dirchoosetime = 0;//3; if (MISCVARS->NMErotate < 3) {head->dir = dirorder16[head->dir][NEXT]; MISCVARS->NMErotate ++; } else if (MISCVARS->NMErotate < 6) {head->dir = dirorder16[head->dir][PREV]; MISCVARS->NMErotate ++; } else if (MISCVARS->NMErotate < 9) {ob->dir = dirorder16[ob->dir][NEXT]; wheels->dir = ob->dir; MISCVARS->NMErotate++; } else if (MISCVARS->NMErotate < 12) {ob->dir = dirorder16[ob->dir][PREV]; wheels->dir = ob->dir; MISCVARS->NMErotate ++; } else {MISCVARS->NMErotate = 0; NewState(ob,&s_NMEattack); ob->dirchoosetime = 0; //ob->dirchoosetime = 50 - (ob->shapeoffset >> 2) - (gamestate.difficulty << 2);//70; if (!ob->temp2) NewState((objtype*)(ob->whatever),&s_NMEhead1rl); else NewState((objtype*)(ob->whatever),&s_NMEhead2rl); NewState(wheels,&s_NMEwheels2); } } #define SPRAYDIST 0x12000 void SelectOrobotChaseDir(objtype*ob) // this code is for head { int dx,dy,angle,tx,ty; int tdir,olddir,nextdir,prevdir; objtype* head,*wheels; head = (objtype*)(ob->whatever); wheels = (objtype*)(ob->target); olddir=head->dir; findplayer: if (ob->temp1 == -1) { if (ob->targettilex || ob->targettiley) { tx = (int)((ob->targettilex << TILESHIFT) + HALFGLOBAL1); ty = (int)((ob->targettiley << TILESHIFT) + HALFGLOBAL1); dx= tx - ob->x; dy= ob->y - ty; if (((dx -SPRAYDIST)) && ((dy -SPRAYDIST))) { dx= PLAYER[0]->x-ob->x; dy= ob->y - PLAYER[0]->y; } } else { dx= PLAYER[0]->x - ob->x; dy= ob->y - PLAYER[0]->y; } angle = atan2_appx(dx,dy); tdir = (((angletodir[angle])<<1) & 0xf); } else { tdir = (ob->temp1 & 0xf); if ((head->dir == (unsigned)tdir) && (ob->dir == (unsigned)tdir)) // increment // tried dir if robot will attempt to move at tdir => // head and body are at move try dir {//Debug("\ntrying next queue dir %d",tdir); MISCVARS->NMEdirstried ++; if (MISCVARS->NMEdirstried == MISCVARS->NMEqueuesize) //gone through all queue entries {//Debug("\nqueue exhausted"); ob->temp1 = -1; MISCVARS->NMEdirstried = 0; goto findplayer; } } } if (tdir != olddir) //rotate head to new chase direction { nextdir = dirorder16[olddir][NEXT]; prevdir = dirorder16[olddir][PREV]; if (dirdiff16[tdir][nextdir] < dirdiff16[tdir][prevdir]) head->dir = nextdir; else head->dir = prevdir; return; } //Debug("\nhead aligned to dir %d",tdir); //oddir = ob->dir; if (ob->dir != head->dir) // align body and wheels with head { ZEROMOM; NewState(wheels,&s_NMEwheels120); //rotate wheels for spinning nextdir = dirorder16[ob->dir][NEXT]; prevdir = dirorder16[ob->dir][PREV]; if (dirdiff16[head->dir][nextdir] < dirdiff16[head->dir][prevdir]) ob->dir = nextdir; else ob->dir = prevdir; wheels->dir = ob->dir; return; } // Debug("\nbody aligned to head at dir %d",ob->dir); ZEROMOM; ParseMomentum(ob,dirangle16[head->dir]); // Debug("\ntrying to move at dir %d",head->dir); ActorMovement(ob); UpdateNMELinkedActors(ob); if (ob->momentumx || ob->momentumy) { NewState(wheels,&s_NMEwheels2); // align wheels for movement //Debug("\nmove at dir %d succesful, resetting queue",head->dir); ob->temp1 = -1; //clear direction queue return; } else if (ob->temp1 == -1) // if queue is empty //make a queue of directions (byte packed) { //Debug("\nmove at dir %d failed and queue empty",head->dir); ob->temp1 = 0; MISCVARS->NMEdirstried = 0; MISCVARS->NMEqueuesize = 0; nextdir = ((tdir + 6) & 0xf); prevdir = ((tdir - 6) & 0xf); for(; MISCVARS->NMEqueuesize < 6;MISCVARS->NMEqueuesize += 2) { ob->temp1 <<= 4; ob->temp1 += nextdir; ob->temp1 <<= 4; ob->temp1 += prevdir; nextdir = ((nextdir-2) & 0xf); prevdir = ((prevdir+2) & 0xf); } } else // else goto next queue dir; { ob->temp1 >>= 4; } } void T_NME_Explode(objtype*ob) { if (ob->ticcount == 35) {objtype*head; int op; head = (objtype*)(ob->whatever); op = FixedMul(GRAVITY,(head->z-25)<<16) << 1; head->momentumz = -FixedSqrtHP(op); head->momentumx = (GameRandomNumber("NME head momx",0) << 2); head->momentumy = (GameRandomNumber("NME head momy",0) << 2); head->hitpoints = 0; head->flags |= FL_DYING; NewState(head,&s_shootinghead); //RemoveObj((objtype*)(ob->whatever)); // remove head } else if (!ob->ticcount) {ob->shapeoffset = 0; NewState(ob,&s_explosion1); SetGibSpeed(0x4000); SpawnParticles(ob,gt_sparks,200); ResetGibSpeed(); RemoveObj((objtype*)(ob->target)); } } void T_NME_HeadShoot(objtype*ob) {//int randtheta,i,offx,offy; ob->z += (ob->momentumz>>16); /*if (ob->momentumz < 0) {for(i=0;i<3;i++) {randtheta = (GameRandomNumber("NME spark drop",0) << 3); SpawnNewObj(ob->tilex,ob->tiley,&s_particle1,inertobj); new->temp2 = 1; offx = FixedMul(0x400,costable[randtheta]); offy = -FixedMul(0x400,sintable[randtheta]); new->x = new->drawx = ob->x + offx; new->y = new->drawy = ob->y + offy; new->z = ob->z-15; new->flags |= (FL_NOFRICTION|FL_CRAZY|FL_ABP); new->dir = west; MakeActive(new); } }*/ ob->momentumz += GRAVITY; if (ob->z >= (nominalheight+45)) {ob->z = nominalheight+45; if (ob->temp2) {ob->momentumz = -30000*ob->temp2; ob->temp2--; } else {ob->momentumx = ob->momentumy = ob->momentumz = 0; ob->shapeoffset = 0; NewState(ob,&s_NMEheadexplosion); return; } } ActorMovement(ob); } boolean NMEspincheck(objtype*ob) { int dx,dy,dz; dx = abs(PLAYER[0]->x - ob->x); dy = abs(PLAYER[0]->y - ob->y); dz = abs(PLAYER[0]->z - ob->z); if ((dx < 0x10000) && (dy < 0x10000) && (dz < 32)) { NewState(ob,&s_NMEspinattack); NewState((objtype*)(ob->target),&s_NMEwheelspin); if (!ob->temp2) NewState((objtype*)(ob->whatever),&s_NMEhead1); else NewState((objtype*)(ob->whatever),&s_NMEhead2); ob->dirchoosetime = 1; return true; } return false; } void T_NME_SpinAttack(objtype* ob) {int mx,my,mz; objtype*head,*wheels; if (ob->ticcount == 30) // knock player back {GetMomenta(PLAYER[0],ob,&mx,&my,&mz,0x4000); DamageThing(PLAYER[0],20); Collision(PLAYER[0],ob,mx,my); M_CheckPlayerKilled(PLAYER[0]); } if (ob->dirchoosetime) ob->dirchoosetime --; else {head = (objtype*)(ob->whatever); wheels = (objtype*)(ob->target); wheels->dir = head->dir = ob->dir = dirorder16[dirorder16[ob->dir][NEXT]][NEXT]; ob->dirchoosetime = 1; } } void T_NME_SpinFire(objtype*ob) { int randtheta,oldyzangle,dx,dy,xydist,dz; objtype *head,*wheels; head = (objtype*)(ob->whatever); wheels = (objtype*)(ob->target); if (ob->dir != (unsigned)ob->targettilex) {ob->dir = head->dir = wheels->dir = dirorder16[ob->dir][ob->temp3]; return; } if (ob->dirchoosetime) {ob->dirchoosetime --; return; } if (ob->temp3 < 20) {//randphi = (GameRandomNumber("NME generate phi",0) << 3) & ((ANGLES/2) -1); if (GameRandomNumber("NME generate theta",0) < 128) randtheta = (GameRandomNumber("NME generate theta",0)>>4); else randtheta = -(GameRandomNumber("NME generate theta",0)>>4); dx = PLAYER[0]->x-ob->x; dy = ob->y-PLAYER[0]->y; if (GameRandomNumber("bcraft shoot up/down",0) < 128) dz = 5; else dz = -5; xydist = FindDistance(dx,dy); randtheta += atan2_appx(dx,dy); Fix(randtheta); oldyzangle = ob->yzangle; ob->yzangle = atan2_appx(xydist,dz<<10); //ob->yzangle = randphi; SD_PlaySoundRTP(BAS[ob->obclass].fire+1,ob->x,ob->y); //wheels->dir = head->dir = ob->dir = dirorder16[dirorder16[ob->dir][NEXT]][NEXT]; SpawnMissile(ob,fireballobj,0x6000,randtheta,&s_NMEminiball1,0x10000); ob->dirchoosetime = 1; ob->yzangle = oldyzangle; ob->temp3 ++; } else {ob->temp3 = 0; NewState(ob,&s_NMEchase); NewState((objtype*)(ob->target),&s_NMEwheels2); if (!ob->temp2) NewState((objtype*)(ob->whatever),&s_NMEhead1); else NewState((objtype*)(ob->whatever),&s_NMEhead2); } } void T_NME_Attack(objtype*ob) {int angle,perpangle,i; if (NMEspincheck(ob)) {//ob->temp3 = 0; return; } if (ob->dirchoosetime) {ob->dirchoosetime --; return; } if (!CheckLine(ob,PLAYER[0],SIGHT)) {//ob->temp3 = 0; NewState(ob,&s_NMEchase); NewState((objtype*)(ob->target),&s_NMEwheels2); if (!ob->temp2) NewState((objtype*)(ob->whatever),&s_NMEhead1); else NewState((objtype*)(ob->whatever),&s_NMEhead2); return; } //sound = BAS[ob->obclass].fire; angle = AngleBetween(ob,PLAYER[0]); if ((ob->temp3 == 0) || (ob->temp3 == 1)) //heatseek {SD_PlaySoundRTP(BAS[ob->obclass].fire+2,ob->x,ob->y); angle = AngleBetween(ob,PLAYER[0]); SpawnMissile(ob,missileobj,0x6000,angle,&s_missile1,0x8000); if (ob->temp3 == 3) perpangle = angle + ANGLES/4; else perpangle = angle - ANGLES/4; Fix(perpangle); new->temp1 = NME_HEATSEEKINGTYPE; SetFinePosition(new,new->x + FixedMul(0x8000l,costable[perpangle]), new->y - FixedMul(0x8000l,sintable[perpangle])); SetVisiblePosition(new,new->x,new->y); if (!ob->temp3) ob->dirchoosetime = 20; else {ob->dirchoosetime = 35 - (ob->shapeoffset >> 2) - (gamestate.difficulty << 2);//70; if (!ob->temp2) NewState((objtype*)(ob->whatever),&s_NMEhead1); else NewState((objtype*)(ob->whatever),&s_NMEhead2); } ob->temp3 ++; } else if (ob->temp3 == 2) // saucer { SpawnMissile(ob,NMEsaucerobj,0x1000,angle,&s_NMEsaucer1,0xc000); new->flags |= FL_SHOOTABLE; ob->temp3++; ob->dirchoosetime = 35 - (ob->shapeoffset >> 2) - (gamestate.difficulty << 2);//70; if (!ob->temp2) NewState((objtype*)(ob->whatever),&s_NMEhead1rl); else NewState((objtype*)(ob->whatever),&s_NMEhead2rl); } else if ((ob->temp3 == 3) || (ob->temp3 == 4)) // drunk {SD_PlaySoundRTP(BAS[ob->obclass].fire+2,ob->x,ob->y); if (!ob->temp3) perpangle = angle + ANGLES/4; else perpangle = angle - ANGLES/4; Fix(perpangle); for(i=0;i<(2+gamestate.difficulty);i++) { SpawnMissile(ob,missileobj,0x6000,angle,&s_missile1,0x8000); new->temp1 = NME_DRUNKTYPE; SetFinePosition(new,new->x + FixedMul(0x8000l,costable[perpangle]), new->y - FixedMul(0x8000l,sintable[perpangle])); SetVisiblePosition(new,new->x,new->y); } if (ob->temp3 == 3) ob->dirchoosetime = 20; else {ob->temp3 = 0; NewState(ob,&s_NMEchase); if (!ob->temp2) NewState((objtype*)(ob->whatever),&s_NMEhead1); else NewState((objtype*)(ob->whatever),&s_NMEhead2); } ob->temp3 ++; } } //================== Tom/Snake ============================================ void T_DarkSnakeSpawn(objtype*ob) { objtype * linkinfront; if (((ob->state == &s_darkmonkhspawn) && (!(ob->ticcount%8))) || ((ob->state == &s_darkmonkfastspawn) && (!(ob->ticcount%4)))) { GetNewActor(); MakeActive(new); SetFinePosition(new,ob->x,ob->y); SetVisiblePosition(new,ob->x,ob->y); new->z = nominalheight; new->areanumber = MAPSPOT(new->tilex,new->tiley,0)-AREATILE; MakeLastInArea(new); new->obclass = b_darksnakeobj; new->which = ACTOR; new->angle = AngleBetween(ob,PLAYER[0]); new->dir = angletodir[new->angle]; if (SNAKELEVEL == 1) new->speed = 0x5000; else if (SNAKELEVEL == 2) new->speed = 0x5800; else new->speed = 0x2000; new->hitpoints = 1000; new->dirchoosetime = 0; new->door_to_open = -1; new->flags |= (FL_ABP|FL_NOFRICTION|FL_SHOOTABLE|FL_BLOCK); if (ob->whatever) { linkinfront = (objtype*)(ob->whatever); linkinfront->whatever = new; new->target = linkinfront; new->targettilex = linkinfront->x; new->targettiley = linkinfront->y; new->angle = AngleBetween(new,linkinfront); new->dir = angletodir[new->angle]; new->flags |= FL_NEVERMARK; ParseMomentum(new,new->angle); NewState(new,&s_darkmonksnakelink); } else { SNAKEHEAD = new; if (SNAKELEVEL == 3) NewState(new,&s_darkmonkhead); else if (SNAKELEVEL == 1) { NewState(new,&s_snakefindpath); new->flags |= FL_ATTACKMODE; } else if (SNAKELEVEL == 2) { NewState(new,&s_snakepath); new->angle = 3*ANGLES/4; new->dir = angletodir[new->angle]; new->flags |= FL_ATTACKMODE; } ob->targettilex = ob->targettiley = 0; ParseMomentum(new,new->angle); } if (!ob->ticcount) SNAKEEND = new; ob->whatever = new; } } void T_GenericMove(objtype*ob) {int dx,dy; if (ob->temp3 == -1) return; if (!(SNAKEHEAD->flags & FL_ATTACKMODE)) return; if (ob->hitpoints <= 0) {KillActor(ob); ob->temp3 = 0; return; } if (!ob->ticcount) {if (ob->state == &s_darkmonkredlink) ob->temp3 = 0; else if ((ob!=SNAKEEND) && (ob->state == &s_redlinkhit)) NewState((objtype*)(ob->whatever),&s_redlinkhit); } dx = ob->targettilex-ob->x; dy = ob->y-ob->targettiley; if ((dx > -0xa000) && (dx < 0xa000) && (dy > -0xa000) && (dy < 0xa000)) {if (ob->temp1 && ob->temp2) {dx = ob->temp1 - ob->x; dy = ob->y - ob->temp2; ZEROMOM; /* if ((ob->targettilex == ob->temp1) && (ob->targettiley == ob->temp2)) return; */ //ob->x = ob->drawx = ob->targettilex; //ob->y = ob->drawy = ob->targettiley; //ob->tilex = ob->x >> TILESHIFT; //ob->tiley = ob->y >> TILESHIFT; ob->targettilex = ob->temp1; ob->targettiley = ob->temp2; #if (0) Debug("\nfollower %d's new targetx %4x, targety %4x", ob-SNAKEHEAD,ob->temp1,ob->temp2); #endif ob->angle = atan2_appx(dx,dy); ob->dir = angletodir[ob->angle]; ParseMomentum(ob,ob->angle); } } else if (NOMOM) {//SNAKEHEAD->dirchoosetime = 0; ParseMomentum(ob,ob->angle); } if (ob->momentumx || ob->momentumy) MoveActor(ob); // ActorMovement(ob); } /* =============== = = SelectSnakeDir = =============== */ void SelectSnakeDir (objtype *ob) { int spot,centerx,centery,dx,dy; spot = MAPSPOT(ob->tilex,ob->tiley,1)-ICONARROWS; if ((spot >= 0) && (spot<= 7) && ((ob->dir!=(unsigned)spot)||(!(ob->flags & FL_DONE)))) { centerx= (ob->tilex << 16) + HALFGLOBAL1; centery= (ob->tiley << 16) + HALFGLOBAL1; dx = abs(centerx - ob->x); dy = abs(centery - ob->y); if ((dx < SNAKERAD) && (dy < SNAKERAD)) // new direction {ZEROMOM; ob->dir = spot; ob->flags |= FL_DONE; ParseMomentum(ob,dirangle8[ob->dir]); SetFinePosition(ob,centerx,centery); SetVisiblePosition(ob,ob->x,ob->y); if (ob==SNAKEHEAD) { SoftError("\n path changed at %d, %d",ob->tilex,ob->tiley); } } } MoveActor(ob); } void T_SnakePath(objtype*ob) {objtype*temp,*follower; if (SNAKEEND && (SNAKELEVEL == 2)) {if (CheckLine(SNAKEEND,PLAYER[0],SIGHT)) {if (ob->temp3 == -1) //if snake can see player //and he's presently stopped, restart {for(temp=ob;temp;temp=(objtype*)(temp->whatever)) {temp->temp3 = 0; temp->momentumx = temp->temp1; temp->momentumy = temp->temp2; } ob->dirchoosetime = 0; } } else if (ob->temp3 != -1) //else if he hasn't been stopped, stop him {for(temp=ob;temp;temp = (objtype*)(temp->whatever)) {temp->temp1 = temp->momentumx; temp->temp2 = temp->momentumy; temp->temp3 = -1; temp->momentumx = temp->momentumy = 0; } } else return; } if (ob->dirchoosetime) ob->dirchoosetime--; else {int count = 0; for(temp=ob;temp->whatever;temp=(objtype*)(temp->whatever)) {follower = (objtype*)(temp->whatever); follower->temp1 = temp->x; follower->temp2 = temp->y; SoftError("\n follower %d temp1 set to %4x, temp2 set to %4x", count,temp->x,temp->y); count ++; } ob->dirchoosetime = 2 ;//15 } if (ob->momentumx || ob->momentumy) SelectSnakeDir(ob); //else // {ParseMomentum(ob,ob->angle); // MoveActor(ob); // } } void FindClosestPath(objtype*ob) {int tx,ty,dx,dy,angle; tx = (ob->targettilex << 16) + TILEGLOBAL/2; ty = (ob->targettiley << 16) + TILEGLOBAL/2; dx= tx - ob->x; dy= ob->y - ty; angle = atan2_appx(dx,dy); ZEROMOM; ParseMomentum(ob,angle); MoveActor(ob); } void T_SnakeFindPath(objtype*ob) {int i,dx,dy,currdist,mindist,map; tpoint dstruct,*dummy=&dstruct; objtype*temp,*follower; if (ob->targettilex || ob->targettiley) {FindClosestPath(ob); dx = ob->targettilex - ob->tilex; dy = ob->targettiley - ob->tiley; if ((!dx) && (!dy)) {SetTilePosition(ob,ob->tilex,ob->tiley); SetVisiblePosition(ob,ob->x,ob->y); ob->y = ob->drawy = (ob->tiley << TILESHIFT) + TILEGLOBAL/2; NewState(ob,&s_snakepath); return; } } else {dummy->which = ACTOR; mindist = 0x7fffffff; for(i=0;iz = ob->z; if (CheckLine(ob,dummy,SIGHT)) {currdist = FindDistance(ob->tilex-dummy->tilex,ob->tiley-dummy->tiley); map = MAPSPOT(ob->tilex,ob->tiley,0)-AREATILE; if ((currdist < mindist) && (map >= 0) && (map <= NUMAREAS)) {ob->targettilex = dummy->tilex; ob->targettiley = dummy->tiley; mindist = currdist; } } } } if (ob->dirchoosetime) ob->dirchoosetime--; else {for(temp=ob;temp->whatever;temp=(objtype*)(temp->whatever)) {follower = (objtype*)(temp->whatever); follower->temp1 = temp->x; follower->temp2 = temp->y; } ob->dirchoosetime = 2 ;//15 } } void T_SnakeFinale(objtype*ob) { if ((ob->state == &s_snakefireworks1)||(ob->state == &s_snakefireworks2)) { if (ob->z != (maxheight-200)) { ob->z --; return; } SetGibSpeed(0x4500); SpawnParticles(ob,RANDOM,100); SpawnParticles(ob,gt_spit,100); ResetGibSpeed(); NewState(ob,&s_dexplosion1); } else { if (!ob->ticcount) { NewState(EXPLOSIONS,&s_megaremove); // SpawnParticles(ob,RANDOM,100); // SpawnParticles(ob,SPIT,100); return; } if (ob->dirchoosetime) ob->dirchoosetime --; else { ob->dirchoosetime = (GameRandomNumber("snake finale choose",0) % 7) + 15; SetGibSpeed(0x3000); SpawnParticles(ob,RANDOM,30); SpawnParticles(ob,gt_spit,20); ResetGibSpeed(); } } } void T_DarkSnakeChase(objtype*ob) { objtype* temp,*follower; int tdir,angle; if (!(ob->flags & FL_ATTACKMODE)) { if (!(CheckSight(ob,player) || Near(ob,player,4))) return; else { ob->flags |= FL_ATTACKMODE; MU_StartSong(song_bosssee); } } if (ob->hitpoints <= 0) { MU_StartSong(song_bossdie); KillActor(ob); AddMessage("Oscuro defeated!",MSG_CHEAT); return; } angle = AngleBetween(ob,PLAYER[0]); tdir = angletodir[angle]; if (Near(ob,PLAYER[0],6) && (ob->dir == (unsigned)tdir) && (!(ob->state->condition & SF_DOWN))) { NewState(ob,&s_snakefire1); SD_PlaySoundRTP(SD_SNAKEREADYSND,ob->x,ob->y); } if (!ob->ticcount) { if (ob->state == &s_darkmonkredhead) ob->temp3 = 0; // no longer hitable else if ((ob->state == &s_redheadhit) && (ob != SNAKEEND)) NewState((objtype*)(ob->whatever),&s_redlinkhit); else if (ob->state->condition & SF_UP) { SpawnMissile(ob,dm_spitobj,0x6000,angle,&s_spit1,0x6000); SD_PlaySoundRTP(BAS[ob->obclass].fire,ob->x,ob->y); //new->z -= 5; } //spawn spit; } if (CheckLine(ob,PLAYER[0],SIGHT)) { ob->targettilex = PLAYER[0]->x; ob->targettiley = PLAYER[0]->y; } if (ob->dirchoosetime) { ob->dirchoosetime--; ActorMovement(ob); if (NOMOM) ob->dirchoosetime = 0; } else {//if (ob) for(temp=ob;temp->whatever;temp=(objtype*)(temp->whatever)) { follower = (objtype*)(temp->whatever); follower->temp1 = temp->x; follower->temp2 = temp->y; } SelectChaseDir(ob); ob->dirchoosetime = 7 ;//15 } } void T_DarkmonkReact(objtype*ob) { if (ob->z < nominalheight) {MISCVARS->monkz += MZADJUST; ob->z = nominalheight + (MISCVARS->monkz >> 16); //ob->z++; return; } else {int ocl; ocl = ob->temp3; if (ocl == p_kesobj) NewState(ob,&s_darkmonkabsorb1); else if (ocl == p_heatseekobj) NewState(ob,&s_darkmonkhball1); else if (ocl == p_firebombobj) NewState(ob,&s_darkmonkbreathe1); else NewState(ob,&s_darkmonkchase1); ob->dirchoosetime = 0; } } void T_DarkmonkCharge(objtype*ob) {int dx,dy; dx = abs(PLAYER[0]->x - ob->x); dy = abs(PLAYER[0]->y - ob->y); if ((dx < 0xa000) && (dy < 0xa000)) {DamageThing(PLAYER[0],10); Collision(PLAYER[0],ob,0,0); M_CheckPlayerKilled(PLAYER[0]); } if (!ob->ticcount) ob->speed >>= 1; if (ob->dirchoosetime) ob->dirchoosetime --; if (NOMOM || (!ob->dirchoosetime)) {ob->angle = AngleBetween(ob,PLAYER[0]); ob->dir = angletodir[ob->angle]; ParseMomentum(ob,ob->angle); ob->dirchoosetime = 5; } ActorMovement(ob); } void T_DarkmonkLandAndFire(objtype*ob) { if (ob->z < nominalheight) {MISCVARS->monkz += MZADJUST; ob->z = nominalheight + (MISCVARS->monkz >> 16); //ob->z++; return; } if (Near(ob,PLAYER[0],3)) {if (GameRandomNumber("darkmonkland",0)<128) NewState(ob,&s_darkmonkbball1); else {ob->angle = AngleBetween(ob,PLAYER[0]); ob->dir = angletodir[ob->angle]; ob->speed <<= 1; // goes twice as fast ZEROMOM; ParseMomentum(ob,ob->angle); ob->dirchoosetime = 5; // change dir every 5 tics ob->hitpoints -= 200; // big penalty for charging if (ob->hitpoints <= 0) {objtype*column = (objtype*)(ob->whatever); EnableObject((intptr_t)column); ob->whatever = NULL; KillActor(ob); NewState(ob,&s_darkmonkfastspawn); AddMessage("Oscuro flees!",MSG_CHEAT); return; } NewState(ob,&s_darkmonkcharge1); } } else if (ob->temp1) NewState(ob,&s_darkmonklightning1); else NewState(ob,&s_dmgreenthing1); ob->temp1 ^= 1; ob->dirchoosetime = 0; } void T_DarkmonkChase(objtype*ob) {int chance,dx,dy,dist; if (!Near(ob,PLAYER[0],2)) {if (ob->z > (maxheight - 100)) {MISCVARS->monkz -= MZADJUST; ob->z = nominalheight + (MISCVARS->monkz >> 16); //ob->z--; return; } } else if (ob->z < nominalheight) {MISCVARS->monkz += MZADJUST; ob->z = nominalheight + (MISCVARS->monkz >> 16); //ob->z++; return; } if (CheckLine(ob,PLAYER[0],SIGHT)) {ob->targettilex = PLAYER[0]->x; ob->targettiley = PLAYER[0]->y; } if (!ob->ticcount) { if (CheckLine(ob,PLAYER[0],SHOOT)) // got a shot at player? {dx = abs(ob->tilex - PLAYER[0]->tilex); dy = abs(ob->tiley - PLAYER[0]->tiley); dist = dx>dy ? dx : dy; if (!dist || dist==1) chance = 300;//300; else chance = 400/dist;//300/dist; if (GameRandomNumber("T_DarkMonkChase",0) < chance) {NewState(ob,&s_dmlandandfire); return; } } } if (ob->dirchoosetime) ob->dirchoosetime--; if ((ob->flags & FL_STUCK) || (!ob->dirchoosetime)) {SelectChaseDir(ob); ob->dirchoosetime = M_CHOOSETIME(ob); } else {if (NOMOM) ParseMomentum(ob,dirangle8[ob->dir]); ActorMovement(ob); } } //====================== End of Boss Functions ===========================// void T_GunStand(objtype*ob) {int dy,dx,infrontof,dz; objtype* temp; // if (ob->target) // Error("gun reset with non-null target"); for(temp = firstareaactor[ob->areanumber];temp;temp= temp->nextinarea) {if (temp == ob) continue; if (temp->obclass == ob->obclass) continue; if ((!(temp->flags & FL_SHOOTABLE)) || (temp->flags & FL_DYING)) continue; dy = ob->y - temp->y; dx = ob->x - temp->x; dz = ob->z - temp->z; if ((abs(dy)>0x40000) || (abs(dx)>0x40000) || (abs(dz) > 20)) continue; infrontof = 0; switch (ob->dir) {case north: if ((dy > 0) && (abs(dx)<0x8000)) infrontof = 1; break; case east: if ((dx < 0) && (abs(dy)<0x8000)) infrontof = 1; break; case south: if ((dy < 0) && (abs(dx)<0x8000)) infrontof = 1; break; case west: if ((dx > 0) && (abs(dy)<0x8000)) infrontof = 1; break; default: break; } if (infrontof && CheckLine(ob,temp,SHOOT)) {ob->target = temp; NewState(ob,&s_gunraise1); return; } } } void T_4WayGunStand(objtype*ob) { int dy,dx,dz; objtype* temp; if (ob->target) Error("gun reset with non-null target"); for(temp = firstareaactor[ob->areanumber];temp;temp= temp->nextinarea) { if (temp == ob) continue; if (temp->obclass == ob->obclass) continue; if ((!(temp->flags & FL_SHOOTABLE)) || (temp->flags & FL_DYING)) continue; dy = abs(ob->x-temp->x); dx = abs(ob->y-temp->y); dz = abs(ob->z-temp->z); if ((dx < 0x40000) && (dy < 0x40000) && (dz< 20) && CheckLine(ob,temp,SHOOT)) {//if ((dx < 0x8000) || (dy <0x8000)) ob->target = temp; NewState(ob,&s_4waygunfire1); return; } } } void A_GunShoot(objtype*ob) { int dx,dy,dz,damage,infrontof,tnear,savedangle; objtype * target; if (!ob->ticcount) {target = (objtype*)(ob->target); if (!target) Error("an instance of %s called gunshoot without a target\n",debugstr[ob->obclass]); if ((!(target->flags & FL_SHOOTABLE)) || (target->flags & FL_DYING)) {NewState(ob,&s_gunlower1); ob->target = NULL; return; } dx = target->x-ob->x; dy = ob->y-target->y; dz = ob->z-target->z; tnear = ((abs(dy)<0x40000) && (abs(dx)<0x40000) && (abs(dz) < 20)); infrontof = 0; switch (ob->dir) {case north: if ((dy > 0) && (abs(dx)<0x8000)) infrontof = 1; break; case east: if ((dx < 0) && (abs(dy)<0x8000)) infrontof = 1; break; case south: if ((dy < 0) && (abs(dx)<0x8000)) infrontof = 1; break; case west: if ((dx > 0) && (abs(dy)<0x8000)) infrontof = 1; break; default: break; } if ((!infrontof) || (!CheckLine(ob,target,SHOOT)) || (!tnear)) {NewState(ob,&s_gunlower1); ob->target = NULL; return; } //SD_PlaySoundRTP(SD_FIRE,PLAYER[0]->x,PLAYER[0]->y,ob->x,ob->y); //hitchance = 128; // if (!target) // Error("object called shoot without a target\n"); damage = DMG_AHGUN; if (target->obclass == playerobj) {target->target = ob; if (target->flags & FL_BPV) damage >>= 1; } savedangle = ob->angle; ob->angle = atan2_appx(dx,dy); RayShoot(ob,damage,GameRandomNumber("A_GunShoot Accuracy",0) % 20); ob->angle = savedangle; SD_PlaySoundRTP(SD_BIGEMPLACEFIRESND,ob->x,ob->y); } } void A_4WayGunShoot(objtype*ob) { int dx,dy,dz,damage,savedangle; objtype * target; if (ob->ticcount == (ob->state->tictime >> 1)) { target = (objtype*)(ob->target); if (!target) Error("an instance of %s called 4waygunshoot without a target\n",debugstr[ob->obclass]); dx = abs(target->x-ob->x); dy = abs(ob->y-target->y); dz = abs(ob->z-target->z); if ((dx > 0x40000) || (dy > 0x40000) || (dz > 20) || (!CheckLine(ob,target,SHOOT)) || (!(target->flags & FL_SHOOTABLE)) || (target->flags & FL_DYING) ) { ob->target = NULL; NewState(ob,&s_4waygun); return; } //SD_PlaySoundRTP(SD_FIRE,PLAYER[0]->x,PLAYER[0]->y,ob->x,ob->y); //hitchance = 128; // if (!target) // Error("object called shoot without a target\n"); damage = DMG_AHGUN; SD_PlaySoundRTP(BAS[ob->obclass].fire,ob->x,ob->y); if (target->obclass == playerobj) { target->target = ob; if (target->flags & FL_BPV) damage >>= 1; } savedangle = ob->angle; ob->angle = 0; RayShoot(ob,damage,GameRandomNumber("A_4WayGunShoot Accuracy",0) % 20); ob->angle = ANG90; RayShoot(ob,damage,GameRandomNumber("A_4WayGunShoot Accuracy",0) % 20); ob->angle = ANG180; RayShoot(ob,damage,GameRandomNumber("A_4WayGunShoot Accuracy",0) % 20); ob->angle = ANG270; RayShoot(ob,damage,GameRandomNumber("A_4WayGunShoot Accuracy",0) % 20); ob->angle = savedangle; } } void A_Drain (objtype *ob) { int dx,dy,dz,damage; dx = abs(PLAYER[0]->x - ob->x); dy = abs(PLAYER[0]->y - ob->y); dz = abs(PLAYER[0]->z - ob->z); if ((dx > TOUCHDIST) || (dy > TOUCHDIST) || (dz > (TOUCHDIST>>10))) { NewState(ob,&s_dmonkshoot5); return; } if (ob->ticcount) return; else { damage = (GameRandomNumber("A_Drain",ob->obclass) >> 3); DamageThing (PLAYER[0],damage); ob->hitpoints += damage; if (ob->hitpoints > starthitpoints[gamestate.difficulty][ob->obclass]) ob->hitpoints = starthitpoints[gamestate.difficulty][ob->obclass]; Collision(PLAYER[0],ob,0,0); if (PLAYER[0]->flags & FL_DYING) PLAYER[0]->target = ob; M_CheckPlayerKilled(PLAYER[0]); SD_PlaySoundRTP(SD_MONKGRABSND,ob->x,ob->y); } } void A_DmonkAttack(objtype*ob) {int angle,nobclass = 0,nspeed,altangle1=0,altangle2=0,zoff=0,sound; statetype *nstate = NULL; if (!ob->ticcount) { ob->hitpoints -= 120;//120; if (ob->hitpoints <= 0) { objtype*column = (objtype*)(ob->whatever); EnableObject((intptr_t)column); ob->whatever = NULL; KillActor(ob); NewState(ob,&s_darkmonkfastspawn); return; } } if (ob->dirchoosetime) ob->dirchoosetime --; else {sound = BAS[ob->obclass].fire; angle = AngleBetween(ob,PLAYER[0]); nspeed = 0x6000; if (ob->state == &s_darkmonksphere8) {nstate = &s_kessphere1; nobclass = p_kesobj; ob->dirchoosetime = 70; } else if (ob->state == &s_darkmonkhball7) {nstate = &s_handball1; nobclass = dm_heatseekobj; nspeed = 0x3000; ob->dirchoosetime = 5; } else if (ob->state == &s_darkmonkbball7) {nstate = &s_faceball1; nobclass = dm_weaponobj; nspeed = 0x3000; ob->dirchoosetime = 5; } else if (ob->state == &s_darkmonklightning9) {nstate = &s_lightning; nobclass = dm_weaponobj; ob->dirchoosetime = 3; sound++; } else if (ob->state == &s_dmgreenthing8) {nstate = &s_energysphere1; nobclass = dm_weaponobj; sound +=2; ob->dirchoosetime = 70; } else if (ob->state == &s_darkmonkfspark5) {nstate = &s_floorspark1; altangle1 = angle + ANGLES/24; altangle2 = angle - ANGLES/24; Fix(altangle1); Fix(altangle2); nobclass = dm_weaponobj; ob->dirchoosetime = 3; sound += 3; } else if (ob->state == &s_darkmonkbreathe6) {nstate = &s_crossfire1; ob->dirchoosetime = 3; nobclass = dm_weaponobj; zoff = -15; sound += 3; } SpawnMissile(ob,nobclass,nspeed,angle,nstate,0xb000); SD_PlaySoundRTP(sound,ob->x,ob->y); new->z = ob->z+zoff; if (altangle1) { SpawnMissile(ob,nobclass,nspeed,altangle1,nstate,0xb000); SpawnMissile(ob,nobclass,nspeed,altangle2,nstate,0xb000); } } } #endif // SHAREWARE endif //=====================================================================// /* =============== = = T_Stand = =============== */ void T_Stand (objtype *ob) { if (!ob->ticcount) SightPlayer (ob); else SoftError("\n ob type %s ticcount of %d in T_Stand",debugstr[ob->obclass], ob->ticcount); } void DamagePlayerActor(objtype *ob, int damage) { playertype *pstate; switch (gamestate.difficulty) { case 0: damage >>= 1; break; case 1: damage -= (damage >> 2); break; case 2: break; case 3: //damage += (damage>>2); break; //default: Error("Um, Gamestate.Difficulty, uh, has problems.\n"); } if (!damage) damage++; M_LINKSTATE(ob,pstate); pstate->health -= damage; ob->hitpoints = pstate->health; SD_PlaySoundRTP(SD_PLAYERTCHURTSND+(pstate->player),ob->x,ob->y); if (ob==player) { damagecount += damage; if ( SHOW_BOTTOM_STATUS_BAR() ) DrawBarHealth (false); } if (pstate->health<=0) { pstate->health = 0; ob->hitpoints = 0; } } void DamageNonPlayerActor(objtype *ob,int damage) { //if ((ob->obclass == b_darksnakeobj) && (!ob->temp3)) // return; if (!(ob->flags & FL_ATTACKMODE)) damage <<= 1; ob->hitpoints -= damage; if (ob->hitpoints <= 0) { int sound; sound = BAS[ob->obclass].die; if (ob->obclass == lowguardobj) { if (ob->shapeoffset) sound ++; } SD_PlaySoundRTP(sound,ob->x,ob->y); } else SD_PlaySoundRTP(BAS[ob->obclass].hit,ob->x,ob->y); #if (SHAREWARE == 0) if ((ob->obclass == b_robobossobj) && (ob->temp2 <= 2)) { if (ob->hitpoints < ((3-ob->temp2)*starthitpoints[gamestate.difficulty][ob->obclass]>>2) ) { SD_PlaySoundRTP(SD_NMEAPARTSND,ob->x,ob->y); ob->temp2++; ob->shapeoffset += 16; ob->speed += 0x500; SpawnNewObj(ob->tilex,ob->tiley,&s_megaexplosions,inertobj); new->temp1 = 3; new->flags |= FL_ABP; MakeActive(new); } if (ob->temp2 == 1) NewState((objtype*)(ob->whatever),&s_NMEhead2); } #endif MISCVARS->madenoise = true; } void DamageStaticObject(statobj_t*tempstat,int damage) { tempstat->hitpoints -= damage; if (tempstat->hitpoints <= 0) { sprites[tempstat->tilex][tempstat->tiley]=NULL; tempstat->flags |= FL_NONMARK; if (tempstat->flags&FL_LIGHT) { if (MAPSPOT(tempstat->tilex,tempstat->tiley,2)) {touchplatetype *tplate; for(tplate=touchplate[tempstat->linked_to];tplate;tplate = tplate->nextaction) if (tplate->whichobj == (intptr_t)(tempstat)) RemoveTouchplateAction(tplate,tempstat->linked_to); } if (tempstat->flags & FL_LIGHTON) TurnOffLight(tempstat->tilex,tempstat->tiley); if (tempstat->itemnumber<=stat_chandelier) //SpawnFallingDebris(tempstat->x,tempstat->y,tempstat->z-32); { objtype *prevlast = LASTACTOR; SpawnSlowParticles(gt_sparks,4,tempstat->x,tempstat->y,tempstat->z-32); for(prevlast = prevlast->next;prevlast;prevlast= prevlast->next) { prevlast->momentumz = 1; // any positive value will do prevlast->momentumx >>= 1; prevlast->momentumy >>= 1; } } else { SpawnStatic(tempstat->tilex,tempstat->tiley,stat_metalshards,-1); LASTSTAT->flags |= (FL_ABP|FL_NONMARK); sprites[tempstat->tilex][tempstat->tiley] = NULL; MakeStatActive(LASTSTAT); switch (tempstat->itemnumber) { case stat_lamp: case stat_altbrazier1: case stat_altbrazier2: case stat_torch: SpawnSlowParticles(gt_sparks,5,tempstat->x,tempstat->y,tempstat->z-32); break; case stat_floorfire: SpawnSlowParticles(gt_sparks,5,tempstat->x,tempstat->y,tempstat->z); break; default: ; } } SpawnSolidStatic(tempstat); SD_PlaySoundRTP(SD_ITEMBLOWSND,tempstat->x,tempstat->y); } else { switch (tempstat->itemnumber) { case stat_dariantouch: MISCVARS->ETOUCH[tempstat->linked_to].x = MISCVARS->ETOUCH[tempstat->linked_to].y = 0; case stat_tntcrate: case stat_bonusbarrel: SpawnNewObj(tempstat->tilex,tempstat->tiley,&s_staticexplosion1,inertobj); MakeActive(new); new->flags |= FL_ABP; new->whatever = tempstat; new->temp2 = damage; if (tempstat->itemnumber == stat_bonusbarrel) { int rand = GameRandomNumber("DamageThing",0); if (rand < 80) { if (rand & 1) SpawnStatic(tempstat->tilex,tempstat->tiley,stat_monkmeal,-1); else SpawnStatic(tempstat->tilex,tempstat->tiley,stat_priestporridge,-1); gamestate.healthtotal ++; } else if (rand < 160) { if (rand & 1) SpawnStatic(tempstat->tilex,tempstat->tiley,stat_lifeitem1,-1); else SpawnStatic(tempstat->tilex,tempstat->tiley,stat_lifeitem3,-1); } else { if (rand & 1) SpawnStatic(tempstat->tilex,tempstat->tiley,stat_mp40,-1); else { SpawnStatic(tempstat->tilex,tempstat->tiley,stat_heatseeker,-1); gamestate.missiletotal ++; } LASTSTAT->flags &= ~FL_RESPAWN; } //LASTSTAT->flags &= ~FL_SHOOTABLE; LASTSTAT->flags |= FL_ABP; MakeStatActive(LASTSTAT); SD_PlaySoundRTP(SD_BONUSBARRELSND,tempstat->x,tempstat->y); } else { ExplodeStatic(tempstat); if (tempstat == touchsprite) touchsprite = NULL; } SpawnSolidStatic(tempstat); //SD_Play(SD_EXPL); break; #if (SHAREWARE == 0) case stat_mine: SpawnNewObj(tempstat->tilex,tempstat->tiley,&s_grexplosion1,inertobj); MakeActive(new); new->flags |= FL_ABP; new->whatever = tempstat; new->temp2 = damage; RemoveStatic(tempstat); break; case stat_tomlarva: SD_PlaySoundRTP(SD_ACTORSQUISHSND,tempstat->x,tempstat->y); SpawnGroundExplosion(tempstat->x,tempstat->y,tempstat->z); //MISCVARS->gibgravity = GRAVITY/2; MISCVARS->fulllightgibs = true; SetGibSpeed(0x4000); SpawnSlowParticles(GUTS,30,tempstat->x, tempstat->y,tempstat->z); ResetGibSpeed(); MISCVARS->fulllightgibs = false; //MISCVARS->gibgravity = -1; RemoveStatic(tempstat); break; #endif case stat_lifeitem1: case stat_lifeitem2: case stat_lifeitem3: case stat_lifeitem4: SD_PlaySoundRTP(SD_ITEMBLOWSND,tempstat->x,tempstat->y); gamestate.treasurecount ++; SpawnSlowParticles(gt_sparks,10,tempstat->x,tempstat->y,tempstat->z); SpawnSolidStatic(tempstat); break; default: if ((tempstat->itemnumber == stat_plant) || (tempstat->itemnumber == stat_tree)) gamestate.plantcount++; //tempstat->shapenum = -1; //tempstat->flags &= ~FL_SHOOTABLE; ExplodeStatic(tempstat); SpawnSolidStatic(tempstat); break; } } } } void DamageThing (void *thing, int damage) { objtype* tempactor; statobj_t* tempstat; tempactor = (objtype*)thing; if (!tempactor) return; if ((tempactor->which == ACTOR) && (!(tempactor->flags & FL_SHOOTABLE))) return; if ((tempactor->which == ACTOR) || (tempactor->which == SPRITE)) { if (tempactor->which == ACTOR) { if (tempactor->obclass == playerobj) { if ((tempactor->flags & FL_GODMODE) || (tempactor->flags & FL_DOGMODE) || godmode || (gamestate.battlemode == battle_Eluder) ) return; DamagePlayerActor(tempactor,damage); } else { if ((tempactor->obclass == collectorobj) && (gamestate.SpawnEluder)) return; if (tempactor->hitpoints <= 0) return; DamageNonPlayerActor(tempactor,damage); } } else { tempstat = (statobj_t*)thing; MISCVARS->madenoise = true; if (!(tempstat->flags & FL_SHOOTABLE)) return; DamageStaticObject(tempstat,damage); } } } void ExplodeStatic(statobj_t*tempstat) { //SpawnSolidStatic(tempstat); if (tempstat->flags & FL_WOODEN) { SpawnStatic(tempstat->tilex,tempstat->tiley,stat_woodfrag,-1); if ((gamestate.BattleOptions.RespawnItems) && (tempstat->itemnumber == stat_tntcrate) ) { tempstat->linked_to = (intptr_t)(LASTSTAT); tempstat->flags |= FL_RESPAWN; } } else if (tempstat->flags & FL_METALLIC) SpawnStatic(tempstat->tilex,tempstat->tiley,stat_metalfrag,-1); else SpawnStatic(tempstat->tilex,tempstat->tiley,stat_rubble,-1); LASTSTAT->flags |= (FL_ABP|FL_NONMARK); sprites[tempstat->tilex][tempstat->tiley] = NULL; MakeStatActive(LASTSTAT); SD_PlaySoundRTP(SD_ITEMBLOWSND,tempstat->x,tempstat->y); } void EnableObject(intptr_t object) { objtype* ob; int i,gasicon; doorobj_t*tdoor; ob = (objtype*)object; #if (BNACRASHPREVENT == 1)// if (ob == 0){return;} #endif ob->flags |= FL_ACTIVE; if (ob->obclass == bladeobj) { ParseMomentum(ob,dirangle8[ob->dir]); if (ob->whatever) { objtype *passenger=(objtype*)(ob->whatever); passenger->momentumx += ob->momentumx; passenger->momentumy += ob->momentumy; } } if (ob->obclass == gasgrateobj) { NewState(ob,&s_gas2); SD_PlaySoundRTP(SD_GASSTARTSND,ob->x,ob->y); ob->dirchoosetime = GASTICS; for(i=0;itilex,tdoor->tiley,1); if (gasicon == GASVALUE) LinkedCloseDoor(i); } MU_StoreSongPosition(); MU_StartSong(song_gason); MISCVARS->GASON = 1; ob->temp3 = 105; } else if (ob->obclass == pillarobj) { ob->flags |= FL_FLIPPED; gamestate.secretcount++; } if (!(ob->flags & FL_ABP)) { ob->flags |= FL_ABP; MakeActive(ob); } } void DisableObject(intptr_t object) {objtype*ob; ob = (objtype*)object; ob->flags &= ~FL_ACTIVE; } void T_MoveColumn(objtype* ob) {int spot,index; if (!(ob->flags & FL_ACTIVE)) return; /* switch (ob->dir) {case north: ob->momentumy = -PILLARMOM; break; case south: ob->momentumy = PILLARMOM; break; case east: ob->momentumx = PILLARMOM; break; case west: ob->momentumx = -PILLARMOM; break; } */ ActorMovement(ob); index = touchindices[ob->tilex][ob->tiley]; if (index) TRIGGER[index-1] = 1; ob->temp1 -= PILLARMOM; if ((ob->temp1 <= 0) || NOMOM) {ZEROMOM; ob->temp1 = 0x20000; ob->flags &= ~FL_ACTIVE; spot = MAPSPOT(ob->tilex,ob->tiley,1)-ICONARROWS; if ((spot >= 0) && (spot <= 7)) {ob->dir = spot; if (!ob->temp2) { gamestate.secrettotal++; } else { ob->flags |= FL_ACTIVE; } ParseMomentum(ob,dirangle8[ob->dir]); } else ob->flags |= FL_DONE; } } boolean NextToDoor(objtype*ob) { int tilex,tiley,centerx,centery,dx,dy; tilex = ob->tilex; tiley = ob->tiley; if (M_ISDOOR(tilex+1,tiley) || M_ISDOOR(tilex-1,tiley)) {centery = (tiley << TILESHIFT) + HALFGLOBAL1; dy = abs(ob->y - centery); if (dy < 0x2000) return true; } if (M_ISDOOR(tilex,tiley+1) || M_ISDOOR(tilex,tiley-1)) {centerx = (tilex << TILESHIFT) + HALFGLOBAL1; dx = abs(ob->x - centerx); if (dx < 0x2000) return true; } return false; } /* ================= = = T_Use = ================= */ void T_Use(objtype*ob) {if (ob->ticcount) return; switch (ob->obclass) { #if (SHAREWARE == 0) case b_darianobj: if (touchsprite) touchsprite->flags |= FL_ACTIVE; if ((!sprites[PLAYER[0]->tilex][PLAYER[0]->tiley]) && (ob->areanumber == PLAYER[0]->areanumber)) {SpawnNewObj(PLAYER[0]->tilex,PLAYER[0]->tiley,&s_dspear1,spearobj); new->flags |= (FL_ABP);//|FL_INVULNERABLE); new->z = 0; MakeActive(new); } ZEROMOM; ob->flags |= FL_STUCK; SD_PlaySoundRTP(SD_DARIANUSESND,ob->x,ob->y); //NewState(ob,&s_darianspears); break; #endif default: ; } } #define RollStart(ob,state,angle) \ { \ int oldspeed = ob->speed; \ \ ob->speed = ROLLMOMENTUM+0x200; \ NewState(ob,state); \ ParseMomentum(ob,angle); \ ob->speed = oldspeed; \ } \ void AvoidPlayerMissile(objtype*ob) { objtype *temp; int dx,dy,dz; int magangle,angle1,rollangle1,rollangle2,dangle1,dangle2; if (PLAYER0MISSILE == NULL) return; if (GameRandomNumber("scott missile avoid",0) > 160) return; if (ob->momentumz) return; if ((ob->state->think == T_Roll) || (ob->state->think == T_Reset)) return; temp = PLAYER0MISSILE; dx = abs(temp->x - ob->x); dy = abs(ob->y - temp->y); dz = abs(ob->z - temp->z); angle1 = AngleBetween(temp,ob); magangle = abs(temp->angle - angle1); if (magangle > VANG180) magangle = ANGLES - magangle; if ((magangle > ANGLES/48) || (dx > 0x50000) || (dy > 0x50000) || (dz > 32)) return; rollangle1 = angle1 + ANGLES/4; Fix(rollangle1); dangle1 = abs(temp->angle - rollangle1); if (dangle1 > VANG180) dangle1 = ANGLES - dangle1; rollangle2 = angle1 - ANGLES/4; Fix(rollangle2); dangle2 = abs(temp->angle - rollangle2); if (dangle2 > VANG180) dangle2 = ANGLES - dangle2; ob->momentumx = ob->momentumy = 0; if (dangle1 > dangle2) { RollStart(ob,&s_strikerollleft1,rollangle1); } else { RollStart(ob,&s_strikerollright1,rollangle2); } ob->flags |= FL_NOFRICTION; ob->target = PLAYER[0]; //SelectRollDir(ob); } /* ================= = = T_Chase = ================= */ void T_Chase (objtype *ob) { int dx,dy,dz,dist,chance; classtype ocl; statetype *temp; boolean doorok; ocl = ob->obclass; if ((ocl == deathmonkobj) || (ocl == blitzguardobj)) {dx = abs(PLAYER[0]->x - ob->x); dy = abs(ob->y - PLAYER[0]->y); dz = abs(ob->z - PLAYER[0]->z); if ((dx < TOUCHDIST) && (dy < TOUCHDIST) && (dz < (TOUCHDIST >> 10))) { #if (SHAREWARE == 0) if (ocl == deathmonkobj) {NewState(ob,&s_dmonkshoot1); STOPACTOR(ob); return; } else #endif if ((!ob->temp3) && (PLAYERSTATE[0].missileweapon != -1) && (PLAYERSTATE[0].missileweapon < wp_godhand)) {NewState(ob,&s_blitzsteal1); STOPACTOR(ob); return; } } } ob->flags &= ~FL_DODGE; //if (CheckLine(ob,PLAYER[0],DIRCHECK) && (ocl != roboguardobj)) if (!ob->ticcount) {if (CheckLine(ob,PLAYER[0],SIGHT)) // got a shot at player? {if (ocl != roboguardobj) {ob->targettilex = PLAYER[0]->x; ob->targettiley = PLAYER[0]->y; } } if (CheckLine(ob,PLAYER[0],SHOOT) && (!(player->flags&FL_DYING))) // got a shot at player? { dx = abs(ob->tilex - PLAYER[0]->tilex); dy = abs(ob->tiley - PLAYER[0]->tiley); dist = (dx>dy)?(dx):(dy); if ((!dist) || (dist==1)) chance = 300; else if (ocl >= b_darianobj) chance = 400/dist; else chance = 300/dist; if (GameRandomNumber("T_Chase",ocl) dir = angletodir[AngleBetween(ob,PLAYER[0])]; STOPACTOR(ob); #if (SHAREWARE == 0) if ((ocl == overpatrolobj) && (!Near(ob,PLAYER[0],3)) && (!PLAYERSTATE[0].NETCAPTURED) && (!MISCVARS->NET_IN_FLIGHT)) {NewState(ob,&s_opbolo1); MISCVARS->NET_IN_FLIGHT = true; return; } #endif if ((ocl == triadenforcerobj) && (!Near(ob,PLAYER[0],3))) {NewState(ob,&s_enforcerthrow1); return; } if ((temp=M_S(AIM)) != NULL) {if ((ob->flags & FL_HASAUTO) && (!ob->temp3)) ob->temp3 = (GameRandomNumber("T_Chase FL_HASAUTO",ocl) % 5) + 3; ob->target = PLAYER[0]; NewState(ob,temp); return; } } //if ((CheckSight(ob,PLAYER[0])) && (!ob->angle))// && //(ocl != b_heinrichobj)) //ob->flags |= FL_DODGE; } } cdoor: doorok = NextToDoor(ob); if (ob->dirchoosetime) ob->dirchoosetime--; if ((ob->flags & FL_STUCK) || (!ob->dirchoosetime) || doorok) {//if (ob->flags & FL_DODGE) // SelectDodgeDir(ob); //else SelectChaseDir(ob); ob->dirchoosetime = M_CHOOSETIME(ob); } else {if (NOMOM) ParseMomentum(ob,dirangle8[ob->dir]); ActorMovement(ob); } } void SpawnMissile(objtype* shooter,classtype nobclass,int nspeed,int nangle,statetype*nstate,int offset) { GetNewActor(); MakeActive(new); new->which = ACTOR; new->obclass = nobclass; new->angle = nangle; new->speed = nspeed; if (shooter->obclass == playerobj) offset += FindDistance(shooter->momentumx,shooter->momentumy); SetFinePosition(new,shooter->x + FixedMul(offset,costable[nangle]), shooter->y - FixedMul(offset,sintable[nangle])); SetVisiblePosition(new,new->x,new->y); //SoftError("\n missx:%d, missy:%d, speed:%d, offset:%d, angle%d, drawx:%d, drawy:%d", // new->x,new->y,nspeed,offset,nangle,new->drawx,new->drawy); new->z = shooter->z; new->areanumber = shooter->areanumber; new->soundhandle = -1; if (nobclass != inertobj) { MakeLastInArea(new); if (MissileSound == true) new->soundhandle = SD_PlaySoundRTP(BAS[new->obclass].operate,new->x,new->y); } if ((shooter->obclass == playerobj) || (shooter->obclass == wallopobj) || (shooter->obclass == b_robobossobj)) { Set_3D_Momenta(new,new->speed,new->angle,shooter->yzangle); if (nobclass == p_drunkmissileobj) new->temp1 = new->momentumz; new->z -= FixedMulShift(offset,sintable[shooter->yzangle],26); if ((shooter->obclass == playerobj) && (shooter->flags & FL_GODMODE)) new->z -= 10; } else ParseMomentum(new,new->angle); if (nobclass == p_drunkmissileobj) new->temp3 = VBLCOUNTER/3; new->flags |= (FL_NEVERMARK|FL_ABP|FL_NOFRICTION|FL_FULLLIGHT); new->whatever = shooter; // keep track of missile possession NewState(new,nstate); } /* ================= = = T_Roll = ================= */ void T_Roll (objtype *ob) { ActorMovement(ob); } /* =============== = = T_Path = =============== */ void T_Path (objtype *ob) {int dx,dy,dz,ocl,damage=1; objtype*temp,*ttarg,*twhat; ocl = ob->obclass; if (((ocl == firejetobj) || (ocl == bladeobj)) && (!ob->ticcount)) { if (ocl == bladeobj) { if (ob->state->condition & SF_DOWN ) ob->flags &= ~FL_BLOCK; else if (ob->state->condition & SF_UP) { ob->flags |= FL_BLOCK; damage = 0; } } if ((ob->state->condition & SF_SOUND) && areabyplayer[ob->areanumber]) SD_PlaySoundRTP(BAS[ob->obclass].operate,ob->x,ob->y); if (damage) { for(temp=firstareaactor[ob->areanumber];temp;temp=temp->nextinarea) { if (temp == ob) continue; if (temp->obclass >= roboguardobj) continue; //WAS ttarg = (objtype*)(temp->target); twhat = (objtype*)(temp->whatever); if ((M_ISACTOR(ttarg) && (ttarg->obclass == b_robobossobj)) || (M_ISACTOR(twhat) && (twhat->obclass == b_robobossobj)) ) continue; if ((!(temp->flags & FL_SHOOTABLE)) || (temp->flags & FL_DYING)) continue; if (temp->obclass == playerobj) { if ((temp->flags & FL_GODMODE) || (temp->flags & FL_DOGMODE)) continue; if ((temp->flags & FL_AV) && (ocl == firejetobj)) continue; } dx = temp->x - ob->x; if (abs(dx) > 0xa000) continue; dy = temp->y - ob->y; if (abs(dy) > 0xa000) continue; //if (temp->obclass == playerobj) //Collision(temp,-temp->momentumx+ob->momentumx,-temp->momentumy + ob->momentumy); dz = temp->z - ob->z; if (abs(dz) > 32) continue; DamageThing(temp,EnvironmentDamage(ob)); if ((ocl == firejetobj) && (temp->obclass < roboguardobj)) SD_PlaySoundRTP(SD_PLAYERBURNEDSND,temp->x,temp->y); if ((gamestate.violence == vl_excessive) && (temp->obclass < roboguardobj)) { if (ocl == bladeobj) { SpawnParticles(temp,GUTS,1); if (temp->hitpoints <= 0) temp->flags |= FL_HBM; } else if (ocl == firejetobj) { if ((temp->hitpoints <= 0) && (temp->z == nominalheight)) { temp->hitpoints = 0; temp->flags |= FL_SKELETON; if (temp->obclass == playerobj) { playertype *pstate; temp->flags &= ~FL_COLORED; M_LINKSTATE(temp,pstate); pstate->health = 0; pstate->weapon = -1; } Collision(temp,ob,-temp->momentumx,-temp->momentumy); M_CheckPlayerKilled(temp); continue; } } } //SD_PlaySoundRTP(SD_ACTORBURNEDSND,temp->x,temp->y); // if ((ocl == bladeobj) || (ob->state->condition == SF_CRUSH)) Collision(temp,ob,-temp->momentumx,-temp->momentumy); M_CheckPlayerKilled(temp); } } } if (ob->dir == nodir) return; if ((ocl != firejetobj) && (ocl != bladeobj) && (ocl != diskobj)) { if (!ob->ticcount) { if (SightPlayer (ob)) return; } else SoftError("\n ob type %s with ticcount %d in T_Path", debugstr[ob->obclass],ob->ticcount); } SelectPathDir (ob); if (NOMOM) ParseMomentum(ob,dirangle8[ob->dir]); } int EnvironmentDamage(objtype *ob) { if (BATTLEMODE && (gamestate.BattleOptions.DangerDamage != bo_danger_normal)) { return(gamestate.BattleOptions.DangerDamage); } else { int damage = 1; switch(ob->obclass) { case firejetobj: case bladeobj: damage = 6; break; case boulderobj: damage = 50; break; case spearobj: damage = 7; break; case gasgrateobj: damage = 20; break; case wallfireobj: damage = ((GameRandomNumber("wallfire damage",0) >>3) + 10); break; case crushcolobj: damage = 10; break; default: ; } if (gamestate.difficulty < gd_hard) damage >>= 1; return damage; } //SoftError("unknown environment danger"); } void T_AutoShootAlign(objtype*ob) { if (ob->dir != (dirtype)ob->temp1) ob->dir = dirorder16[ob->dir][NEXT]; else NewState(ob,M_S(AIM)); } void T_AutoRealign(objtype*ob) { if (ob->dir != (dirtype)ob->targettilex) ob->dir = dirorder16[ob->dir][NEXT]; else {objtype *temp; NewState(ob,M_S(PATH)); for(temp=firstareaactor[ob->areanumber];temp;temp=temp->nextinarea) {if (temp == ob) continue; if (temp->obclass != ob->obclass) continue; if (!temp->state->think) NewState(temp,UPDATE_STATES[PATH][temp->obclass-lowguardobj]); } } } /* =============== = = T_AutoPath = =============== */ void T_AutoPath (objtype *ob) {objtype *temp; // ob->temp3 holds random number of shots before resuming path if (CheckLine(ob,PLAYER[0],SIGHT) && (Near(ob,PLAYER[0],4) || MISCVARS->madenoise)) {int dx,dy,destdir,ocl; statetype *align,*wait; ocl = ob->obclass; dx = player->x - ob->x; dy = ob->y - player->y; destdir = (angletodir[atan2_appx(dx,dy)] << 1); ob->temp1 = destdir; ob->targettilex = ob->dir; //save old dir #if (SHAREWARE == 0) if (ocl == wallopobj) {//if (ob->temp3) // Error("may be writing over temp3"); ob->temp3 = (GameRandomNumber("T_WallPath",0)%4) + 1; align = &s_wallalign; wait = &s_wallwait; } else #endif {align = &s_roboalign; wait = &s_robowait; } NewState(ob,align); for(temp=firstareaactor[ob->areanumber];temp;temp=temp->nextinarea) {if (temp == ob) continue; if (temp->obclass != ob->obclass) continue; if (temp->flags & FL_DYING) continue; if (CheckLine(temp,PLAYER[0],SIGHT) && (Near(temp,PLAYER[0],4) || MISCVARS->madenoise)) {dx = PLAYER[0]->x - temp->x; dy = temp->y - PLAYER[0]->y; destdir = (angletodir[atan2_appx(dx,dy)] << 1); temp->temp1 = destdir; temp->targettilex = temp->dir; NewState(temp,align); temp->temp3 = ob->temp3; } else NewState(temp,wait); } return; } SD_PlaySoundRTP(SD_ROBOTMOVESND,ob->x,ob->y); SelectPathDir(ob); } /* =============== = = A_Shoot = = Try to damage the player, based on skill level and player's speed = =============== */ void A_Shoot (objtype *ob) { int dx,dy,dz,dist; int accuracy,damage,sound; objtype * target; int num; int savedangle; ActorMovement(ob); ob->flags |= FL_FULLLIGHT; //if (!(ob->flags & FL_SHOOTABLE)) //Error("\na dead instance of %s is shooting at you",debugstr[ob->obclass]); if (!ob->ticcount) {if (ob->obclass == strikeguardobj) ob->flags &= ~FL_NOFRICTION; target = (objtype*)(ob->target); if (!target) Error("an instance of %s called shoot without a target\n",debugstr[ob->obclass]); ob->flags &= ~FL_FULLLIGHT; dx = (target->x - ob->x); dy = (ob->y - target->y); dz = target->z-ob->z; if ((ob->obclass == blitzguardobj) && (ob->temp3) && (ob->temp3 != stat_gasmask) && (ob->temp3 != stat_asbesto) && (ob->temp3 != stat_bulletproof) && (gamestate.difficulty >= gd_medium) && ((abs(dx) > 0xc000) || (abs(dy) > 0xc000)) ) { int i; missile_stats* newmissiledata; newmissiledata = &PlayerMissileData[GetWeaponForItem(ob->temp3)]; // ready to annihilate this poor bastard SpawnMissile(ob,newmissiledata->obclass,newmissiledata->speed, AngleBetween(ob,player), newmissiledata->state, newmissiledata->offset); if (newmissiledata->obclass == p_drunkmissileobj) { for(i=0;i<4;i++) { SpawnMissile(ob,newmissiledata->obclass,newmissiledata->speed, AngleBetween(ob,player), newmissiledata->state, newmissiledata->offset); } } ob->target = NULL; ob->temp2 --; if (ob->temp2 == 0) ob->temp3 = 0; return; } if ((!areabyplayer[ob->areanumber]) && (target->obclass == playerobj)) return; //if (!CheckLine(ob,target,SHOOT)) // player is behind a wall //return; savedangle=ob->angle; ob->angle = atan2_appx (dx,dy); dist = FindDistance(dx,dy); ob->yzangle = FINEANGLES-atan2_appx(dist, dz<<10); if ((ob->yzangle>MAXYZANGLE) && (ob->yzangleyzangle=MAXYZANGLE; dist>>=16; accuracy=(WHICHACTOR<<4)+((gamestate.difficulty) << 6); num = GameRandomNumber("A_Shoot3",ob->obclass); if (num<128) num=128; // Don't let accuracy fall below 50% original accuracy=FixedMulShift(num,accuracy,8); // scale accuracy based off randomness // check for maximum accuracy; if (accuracy>255) accuracy=255; if (ob->obclass==highguardobj) damage=DMG_MP40; else if (ob->obclass == triadenforcerobj) damage=DMG_MP40; else damage=DMG_ENEMYBULLETWEAPON; RayShoot (ob, damage, 255-accuracy); ob->angle=savedangle; sound = BAS[ob->obclass].fire; SD_PlaySoundRTP(sound,ob->x,ob->y); MISCVARS->madenoise = true; if ((!(ob->flags& FL_HASAUTO)) || (!ob->temp3)) ob->target = NULL; } } void A_Repeat(objtype*ob) { ActorMovement(ob); if (!ob->ticcount) {ob->temp3 --; if (ob->temp3 <= 0) NewState(ob,M_S(CHASE)); } } void A_MissileWeapon(objtype *ob) { #if (SHAREWARE == 0) int oldyzangle = 0; #endif classtype nobclass = inertobj; statetype *nstate = NULL; if ((ob->obclass == wallopobj) || (ob->obclass == roboguardobj)); //SelectPathDir(ob); else ActorMovement(ob); if (!ob->ticcount) { #if (SHAREWARE == 0) if ((ob->obclass == wallopobj) && (!ob->temp3)) { NewState(ob,&s_wallrestore); return; } #endif if ((ob->obclass == b_darianobj) && (!CheckLine(ob,PLAYER[0],SHOOT))) {NewState(ob,M_S(CHASE)); return; } // Move sounds, flags into switch cases int sound = BAS[ob->obclass].fire; int nspeed = 0x4000; int noffset = 0x8000; int zoffset = 0; switch (ob->obclass) { case triadenforcerobj: nobclass = grenadeobj; nstate= &s_grenade1; sound++; break; case roboguardobj: nobclass = shurikenobj; nspeed = 0x2000; noffset = 0x10000; nstate = &s_robogrdshuriken1; break; /* case b_darkmonkobj: nobclass = dmfballobj; nstate = &s_dmfball1; break; */ /* case b_robobossobj: nobclass = bigshurikenobj; nstate = &s_oshuriken1; break; */ #if (SHAREWARE == 0) case b_darianobj: nobclass = missileobj; //nspeed = 0x100; //noffset = 0x18000; nstate = &s_missile1; zoffset = -20; break; case dfiremonkobj: nobclass = fireballobj; nstate = &s_monkfire1; break; case overpatrolobj: nobclass = netobj; nstate = &s_bolocast1; sound ++; break; case wallopobj: {int dx,dy,dz,xydist; ob->temp2 ^= 1; // increment numfired ob->temp3 --; // decrement random fire no. dx = PLAYER[0]->x-ob->x; dy = ob->y-PLAYER[0]->y; if (GameRandomNumber("bcraft shoot up/down",0) < 128) dz = 10; else dz = -10; xydist = FindDistance(dx,dy); oldyzangle = ob->yzangle; ob->yzangle = atan2_appx(xydist,dz<<10); if (ob->temp2) {nobclass = missileobj; nstate = &s_missile1; } else {nobclass = bigshurikenobj; nstate = &s_bstar1; } } break; #endif default: ; } SpawnMissile(ob,nobclass,nspeed,AngleBetween(ob,PLAYER[0]),nstate,noffset); new->z += zoffset; SD_PlaySoundRTP(sound,ob->x,ob->y); MISCVARS->madenoise = true; if (ob->obclass == triadenforcerobj) {//new->flags |= (FL_SHOOTABLE); new->temp1 = 0x50000; } #if (SHAREWARE == 0) else if (ob->obclass == wallopobj) ob->yzangle = oldyzangle; #endif } } void A_Wallfire(objtype *ob) { if (!(ob->flags & FL_ACTIVE)) return; if (!ob->ticcount) {SpawnMissile(ob,wallfireobj,0x4000,ob->angle,&s_crossfire1,0xa000); if (areabyplayer[ob->areanumber]) SD_PlaySoundRTP(SD_FIRECHUTESND,ob->x,ob->y); new->dir = angletodir[new->angle]; new->z = nominalheight; } } void T_Reset(objtype *ob) { ActorMovement(ob); if (ob->ticcount) return; ob->momentumx = ob->momentumy = ob->dirchoosetime = 0; ob->flags &= ~FL_NOFRICTION; } void SelectRollDir(objtype *ob) {int angle,tryx,tryy; if (ob->state == &s_strikerollright1) angle = AngleBetween(ob,PLAYER[0]) + ANGLES/4; else angle = AngleBetween(ob,PLAYER[0]) - ANGLES/4; Fix(angle); tryx = ob->x + FixedMul(0x20000l,costable[angle]); tryy = ob->y - FixedMul(0x20000l,sintable[angle]); ZEROMOM; if (QuickSpaceCheck(ob,tryx,tryy)) {int oldspeed; oldspeed = ob->speed; ob->speed = ROLLMOMENTUM; ParseMomentum(ob,angle); ob->speed = oldspeed; ob->dirchoosetime = 5; ob->flags |= FL_NOFRICTION; } else ob->dirchoosetime = 0; } void SelectDodgeDir (objtype *ob) { int dx = 0; int dy = 0; int tx = 0; int ty = 0; dirtype dirtry[5] = {0}; dirtype turnaround = {0}; dirtype tdir = {0}; dirtype olddir = ob->dir; if (ob->flags & FL_FIRSTATTACK) { // // turning around is only ok the very first time after noticing the // player // turnaround = nodir; ob->flags &= ~FL_FIRSTATTACK; } else turnaround=opposite[ob->dir]; if (ob->targettilex || ob->targettiley) {tx = ob->targettilex; ty = ob->targettiley; dx= tx - ob->x; dy= ty - ob->y; if ( ((dx < MINACTORDIST) && (dx > -MINACTORDIST)) && ((dy < MINACTORDIST) && (dy > -MINACTORDIST))) {dx= PLAYER[0]->x-ob->x; dy= PLAYER[0]->y-ob->y; } } else {dx= PLAYER[0]->x-ob->x; dy= PLAYER[0]->y-ob->y; } // // arange 5 direction choices in order of preference // the four cardinal directions plus the diagonal straight towards // the player // if (dx>ACTORSIZE) { dirtry[1]= east; dirtry[3]= west; } else if (dx < -ACTORSIZE) { dirtry[1]= west; dirtry[3]= east; } if (dy>ACTORSIZE) { dirtry[2]= south; // south dirtry[4]= north; // north } else if (dy <-ACTORSIZE) { dirtry[2]= north; // north dirtry[4]= south; // south } // // randomize a bit for dodging // unsigned int absdx = abs(dx); unsigned int absdy = abs(dy); if (absdx > absdy) { tdir = dirtry[1]; dirtry[1] = dirtry[2]; dirtry[2] = tdir; tdir = dirtry[3]; dirtry[3] = dirtry[4]; dirtry[4] = tdir; } if (GameRandomNumber("SelectDogeDir",ob->obclass) < 128) { tdir = dirtry[1]; dirtry[1] = dirtry[2]; dirtry[2] = tdir; tdir = dirtry[3]; dirtry[3] = dirtry[4]; dirtry[4] = tdir; } dirtry[0] = diagonal [dirtry[1]] [dirtry[2]]; ZEROMOM; for (size_t i=0;i<5;i++) {if ((dirtry[i] == nodir) || (dirdiff[dirtry[i]][olddir] > 1)) continue; M_CHECKDIR(ob,dirtry[i]); } // // turn around only as a last resort // // for(tdir = east;tdir<=southeast;tdir++) //if (tdir != turnaround) // M_CHECKDIR(ob,tdir); if (turnaround != nodir) M_CHECKDIR(ob,turnaround); } #define TryAbruptProximalDirections(trydir) \ { \ next = dirorder[trydir][NEXT]; \ prev = dirorder[trydir][PREV]; \ if (GameRandomNumber("actor choose dir",0) < 128) \ { \ dirtype temp = next; \ \ next = prev; \ prev = temp; \ } \ \ if (!dirtried[next]) \ { \ M_CHECKDIR(ob,next); \ dirtried[next]=1; \ } \ \ if (!dirtried[prev]) \ { \ M_CHECKDIR(ob,prev); \ dirtried[prev]=1; \ } \ \ } #define TrySmoothProximalDirections(trydir) \ { \ \ if (((trydir == olddir) || (dirdiff[trydir][olddir] < 2)) && \ (!dirtried[trydir])) \ { \ M_CHECKDIR(ob,trydir); \ dirtried[trydir] = 1; \ } \ next = dirorder[olddir][NEXT]; \ prev = dirorder[olddir][PREV]; \ \ if (dirdiff[trydir][next] <= dirdiff[trydir][prev]) \ { \ start = next; \ whichway = NEXT; \ } \ else \ { \ start = prev; \ whichway = PREV; \ } \ \ for (tdir= start; tdir != dirorder[trydir][whichway]; \ tdir = dirorder[tdir][whichway] \ ) \ { \ if (dirtried[tdir]) \ continue; \ M_CHECKDIR(ob,tdir); \ dirtried[tdir]=1; \ } \ \ } #define ChasePlayer(ob) \ { \ dx= player->x-ob->x; \ dy= ob->y-player->y; \ if ((abs(dx) < 0xb000) && (abs(dy) < 0xb000)) \ return; \ } void SelectChaseDir (objtype *ob) { int dx,dy,whichway,tx,ty,actrad,visible, realdiff; dirtype dtry1,dtry2,tdir,olddir,next,prev,start,straight; byte dirtried[9] = {0}; olddir=ob->dir; visible = CheckLine(ob,PLAYER[0],SIGHT); /* if (ob->flags & FL_FIRSTATTACK) { // // turning around is only ok the very first time after noticing the // player // turnaround = opposite[ob->dir]; ob->flags &= ~FL_FIRSTATTACK; } else turnaround=nodir; */ if (ob->targettilex || ob->targettiley) { tx = ob->targettilex; ty = ob->targettiley; dx= tx - ob->x; dy= ob->y - ty; if ((abs(dx) < 0x2000) && (abs(dy) < 0x2000)) ChasePlayer(ob); } else ChasePlayer(ob); //if ((abs(dx) < 0x10000) && (abs(dy) < 0x10000)) //return; straight = angletodir[atan2_appx(dx,dy)]; realdiff = dirdiff[straight][ob->dir]; ZEROMOM; //insertion 20 actrad = ACTORSIZE; dtry1=nodir; dtry2=nodir; if (dx> actrad) dtry1= east; else if (dx< -actrad) dtry1= west; if (dy> actrad) dtry2=north; else if (dy < -actrad) dtry2= south; if (abs(dy)>abs(dx)) { tdir=dtry1; dtry1=dtry2; dtry2=tdir; } if (GameRandomNumber("chase minor",0) < 80) { tdir=dtry1; dtry1=dtry2; dtry2=tdir; } ZEROMOM; if ((!visible) || (realdiff > 2)) // don't worry about abrupt or unrealistic turns if player // can't see guards { M_CHECKDIR(ob,straight); dirtried[straight]=1; next = dirorder[straight][NEXT]; prev = dirorder[straight][PREV]; if ((dtry1 != nodir) && (dtry1 != straight)) { M_CHECKDIR(ob,dtry1); dirtried[dtry1]=1; } if ((dtry2 != nodir) && (!dirtried[dtry2])) { M_CHECKDIR(ob,dtry2); dirtried[dtry2]=1; } if (dtry1 != nodir) TryAbruptProximalDirections(dtry1); if (dtry2 != nodir) TryAbruptProximalDirections(dtry2); } else { if (realdiff < 2) { M_CHECKDIR(ob,straight); dirtried[straight]=1; } if (dtry1 != nodir) TrySmoothProximalDirections(dtry1); if (dtry2 != nodir) TrySmoothProximalDirections(dtry2); } if ((dtry1!=nodir) || (dtry2!=nodir)) { if (GameRandomNumber("actor choose dir",0) < 128) whichway = NEXT; else whichway = PREV; for(tdir = dirorder[olddir][whichway];tdir != olddir;tdir = dirorder[tdir][whichway]) { if (dirtried[tdir]) continue; M_CHECKDIR(ob,tdir); } } ob->dir = olddir; } int Near(objtype *ob,void* what,int distance) { objtype *aw; aw = (objtype*) what; if (FindDistance((aw->x - ob->x),(aw->y - ob->y)) <= (distance<<16)) return 1; return 0; } /* =============== = = SelectPathDir = =============== */ void SelectPathDir (objtype *ob) { int spot,centerx,centery,dx,dy,set,done,radius,ocl; ocl = ob->obclass; if ((ocl == bladeobj) && (!(ob->flags & FL_ACTIVE))) return; spot = MAPSPOT(ob->tilex,ob->tiley,1)-ICONARROWS; set = ((ocl == wallopobj) || (ocl == roboguardobj)); done = (((!set) && (ob->dir == (dirtype)spot)) || (set && (ob->dir == (dirtype)(spot<<1)))); if ((spot >= 0) && (spot<= 7) && (!done)) { centerx= (ob->tilex << 16) + HALFGLOBAL1; centery= (ob->tiley << 16) + HALFGLOBAL1; dx = abs(centerx - ob->x); dy = abs(centery - ob->y); //radius = (ob->speed > 0x4800)?(0xb000):(0x4000); radius = 0x4000; if ((dx < radius) && (dy < radius)) // new direction { ZEROMOM; if ((ocl == wallopobj) || (ocl == roboguardobj)) { ob->dir = spot<<1; ParseMomentum(ob,dirangle16[ob->dir]); } else { ob->dir = spot; ParseMomentum(ob,dirangle8[ob->dir]); } dx = centerx - ob->x; dy = centery - ob->y; SetFinePosition(ob,centerx,centery); SetVisiblePosition(ob,centerx,centery); /* if (((ocl == bladeobj) || (ocl == diskobj)) && ob->whatever) {objtype*passenger = (objtype*)(ob->whatever); passenger->x += dx; passenger->y += dy; passenger->drawx = passenger->x; passenger->drawy = passenger->y; passenger->tilex = passenger->x >> 16; passenger->tiley = passenger->y >> 16; }*/ // if (ob==SNAKEHEAD) // Debug("\n path changed at %d, %d", // ob->tilex,ob->tiley); } } if (NOMOM) { if ((ocl == wallopobj) || (ocl == roboguardobj)) ParseMomentum(ob,dirangle16[ob->dir]); else ParseMomentum(ob,dirangle8[ob->dir]); } //if ((ob->obclass == firejetobj) || (ob->obclass == bladeobj)) //MoveActor(ob); //else ActorMovement(ob); } /* ================ = = CheckSight = = Checks a straight line between player and current object = = If the sight is ok, check alertness and angle to see if they notice = = returns true if the player has been spoted = ================ */ boolean CheckSight (objtype *ob,void *atwhat) { long deltax,deltay; objtype * what; // // don't bother tracing a line if the area isn't connected to the player's // if (!areabyplayer[ob->areanumber]) return false; // // if the player is real close, sight is automatic // what = (objtype*)atwhat; deltax = what->x - ob->x; deltay = what->y - ob->y; if ((deltax > -MINSIGHT) && (deltax < MINSIGHT) && (deltay > -MINSIGHT) && (deltay < MINSIGHT)) return true; // // see if they are looking in the right direction // switch (ob->dir) { case north: if (deltay > 0) return false; break; case east: if (deltax < 0) return false; break; case south: if (deltay < 0) return false; break; case west: if (deltax > 0) return false; break; default: ; } // // trace a line to check for blocking tiles (corners) // return CheckLine (ob,atwhat,SIGHT); } void ActivateEnemy(objtype*ob) {statetype *temp; ob->flags |= (FL_ATTACKMODE|FL_FIRSTATTACK); if (ob->obclass == roboguardobj) return; if (ob->temp3 == SNEAKY) { NewState(ob,&s_sneakyrise1); ob->temp3=0; } else if ((temp = M_S(CHASE)) != NULL) NewState(ob,temp); /* ob->speed = ENEMYRUNSPEED; */ if (ob->obclass == b_heinrichobj) ob->speed = 7*ob->speed/2; else if (ob->obclass == b_darianobj) ob->speed = 3*SPDPATROL; if (ob->door_to_open != -1) ob->door_to_open = -1; // ignore the door opening command ob->dirchoosetime = 0; } /* =============== = = FirstSighting = = Puts an actor into attack mode and possibly reverses the direction = if the player is behind it = =============== */ void FirstSighting (objtype *ob) { statetype *temp; int sound; if (ob->temp3 == SNEAKY) { NewState(ob,&s_sneakyrise1); ob->temp3=0; if (ob->shapeoffset==0) SD_PlaySoundRTP(SD_SNEAKYSPRINGMSND,ob->x,ob->y); else SD_PlaySoundRTP(SD_SNEAKYSPRINGFSND,ob->x,ob->y); } else if ((temp = M_S(CHASE)) != NULL) { int rand; NewState(ob,temp); sound = BAS[ob->obclass].see; rand = GameRandomNumber("FirstSighting low",0); if ((ob->obclass > lowguardobj) && (ob->obclass <= blitzguardobj) && (rand < 128)) //hack for alternate sound++; //if ((ob->obclass == lowguardobj) && (rand < 80)) //sound ++; else if (ob->obclass == lowguardobj) {if (rand < 128) {if ((PLAYERSTATE[0].player == 1) || (PLAYERSTATE[0].player == 3)) sound++; } else sound += 2; if (ob->shapeoffset) sound += 4; } SD_PlaySoundRTP(sound,ob->x,ob->y); if ((ob->obclass>=b_darianobj) && (ob->obclass<=b_darksnakeobj)) { MU_StartSong(song_bosssee); } } /* ob->speed = ENEMYRUNSPEED;*/ if (ob->obclass == b_heinrichobj) ob->speed = 7*ob->speed/2; else if (ob->obclass == b_darianobj) ob->speed = 3*SPDPATROL; if (ob->door_to_open != -1) ob->door_to_open = -1; // ignore the door opening command ob->dirchoosetime = 0; ob->flags |= (FL_ATTACKMODE|FL_FIRSTATTACK); } /* =============== = = SightPlayer = = Called by actors that ARE NOT chasing the player. If the player = is detected (by sight, noise, or proximity), the actor is put into = it's combat frame and true is returned. = = Incorporates a random reaction delay = =============== */ boolean SightPlayer (objtype *ob) { //if (ob->flags & FL_ATTACKMODE) //Error ("An instance of %s in ATTACKMODE called SightPlayer!",debugstr[ob->obclass]); if (!areabyplayer[ob->areanumber]) return false; if (ob->obclass == b_robobossobj) { if (!(CheckSight(ob,player) || Near(ob,player,6))) return false; } else if (ob->flags & FL_AMBUSH) { if (!CheckSight (ob,PLAYER[0])) { //SoftError("\n failed from ambush in SightPlayer"); return false; } ob->flags &= ~FL_AMBUSH; } else { if (ob->temp3 == SNEAKY) { if (!Near(ob,PLAYER[0],2)) return false; } else if (!((MISCVARS->madenoise) || (CheckSight (ob,player)) || (Near(ob,player,4)) ) ) { //SoftError("\n failed from SightPlayer"); return false; } } FirstSighting (ob); return true; } /* ===================== = = CheckLine = = Returns true if a straight line between two obs is unobstructed = ===================== */ boolean CheckLine (void *from, void *to, int condition) { objtype *tempactor,*ob,*orig; statobj_t *checksprite; int destx,desty,destz; int desttilex,desttiley; int snx,sny; int incr[2]; int thedir[2]; int cnt; int grid[2]; int index; int vx,vy; int yzangle; int value; int dx,dy,dz; int xydist; int otx,oty,count=0; ob = (objtype*)to; orig = (objtype*)from; if (ob->which == SPRITE) { destx = ((statobj_t*)to)->x; desty = ((statobj_t*)to)->y; destz = ((statobj_t*)to)->z; } else { destx = ob->x; desty = ob->y; destz = ob->z; } desttilex=destx>>16; desttiley=desty>>16; if ((desttilex == orig->tilex) && (desttiley == orig->tiley)) return true; dx=destx-orig->x; dy=orig->y-desty; dz=orig->z-destz; xydist = FindDistance(dx,dy); yzangle = atan2_appx(xydist,dz<<10); if ((yzangle>MAXYZANGLE) && (yzanglex >> TILESHIFT; oty = orig->y >> TILESHIFT; if (xydist==0) { /* SoftError("\nCheckLine:xydist=0"); if (orig->which == ACTOR) SoftError("shooter: %s",debugstr[orig->obclass]); if (ob->which == ACTOR) SoftError("target: %s",debugstr[ob->obclass]);*/ vy=-dy; vx=dx; } else { vy = -FixedDiv2(dy,xydist); vx = FixedDiv2(dx,xydist); } snx=orig->x&0xffff; sny=orig->y&0xffff; grid[0]=otx; grid[1]=oty; if (vx>0) { thedir[0]=1; snx^=0xffff; incr[1]=-vx; } else { thedir[0]=-1; incr[1]=vx; } if (vy>0) { thedir[1]=1; sny^=0xffff; incr[0]=vy; } else { thedir[1]=-1; incr[0]=-vy; } cnt=FixedMul(snx,incr[0])+FixedMul(sny,incr[1]); do {count ++; /* if (count > 1000) Error("possible infinite loop in CheckLine"); if ((grid[0] < 0) || (grid[0] > (MAPSIZE-1)) || (grid[1] < 0) || (grid[1] > (MAPSIZE-1))) Error("out of bounds in check line, grid[0] = %d, grid[1] = %d",grid[0],grid[1]); */ if ((grid[0]==desttilex) && (grid[1]==desttiley)) return true; tempactor = (objtype*)actorat[grid[0]][grid[1]]; value = tilemap[grid[0]][grid[1]]; checksprite = sprites[grid[0]][grid[1]]; if (value) { if (value&0x8000) { if (!(value&0x4000)) { doorobj_t*dptr = doorobjlist[value&0x3ff]; if (dptr->position < 0x8000) { int x = (grid[0] << 16) + 0x8000; int y = (grid[1] << 16) + 0x8000; if (dptr->vertical) { if (abs(dx) > abs(x-orig->x)) return false; } else { if (abs(dy) > abs(orig->y-y)) return false; } } } else { if (condition == SHOOT) { if ( maskobjlist[value&0x3ff]->flags & MW_SHOOTABLE ) { #if (0) SoftError("\nfailed from shootable mask"); #endif return false; } else if ( maskobjlist[value&0x3ff]->flags & MW_WEAPONBLOCKING ) { #if (0) SoftError("\nfailed from block mask"); #endif return false; } } else if ((condition == MISSILE) && ( maskobjlist[value&0x3ff]->flags & MW_BLOCKING ) ) return false; } } else { #if (0) SoftError("\n obx %d, oby %d, origx %d, origy %d" "\n xydist %d, vx %d, vy %d",ob->x,ob->y,orig->x, orig->y,xydist,vx,vy); SoftError("\nfailed from normal wall"); #endif return false; } } if (condition == SHOOT) { if (tempactor && (tempactor->which == ACTOR) && (tempactor->flags & FL_BLOCK) && (tempactor != orig) && (tempactor != ob)) //&& // (InRange(orig,tempactor, // FindDistance(orig->x-tempactor->x,orig->y-tempactor->y) ) // ==true) ) { #if (0) SoftError("\nfailed from actor"); #endif return false; } } if (checksprite && (checksprite->flags & FL_BLOCK) && (condition == SHOOT) && ((void *)checksprite != to) && (checksprite->itemnumber!=stat_disk) && (InRange(orig,(objtype *)checksprite, FindDistance(orig->x-checksprite->x,orig->y-checksprite->y) ) ==true) ) { #if (0) SoftError("\nfailed from sprite"); #endif return false; } if (tempactor && (tempactor->which == PWALL)) { #if (0) SoftError("\nfailed from pushwall"); #endif return false; } index=(cnt>=0); cnt+=incr[index]; grid[index]+=thedir[index]; } while (1); } /* ===================== = = ShootActor = = Shoot an actor. = ===================== */ void ShootActor(objtype * shooter, objtype * target, int damage, int accuracy, int angle) { int dx,dy,dist; int newmomx, newmomy; int tcl; if (target->flags & FL_DYING) return; dx = abs(shooter->x - target->x); dy = abs(shooter->y - target->y); dist = FindDistance(dx,dy)>>16; tcl=target->obclass; if (tcl==playerobj) { target->target=shooter; if (target->flags&FL_BPV) { playertype *pstate; M_LINKSTATE(target,pstate); pstate->protectiontime -= (damage<<1); if (pstate->protectiontime < 1) pstate->protectiontime = 1; if (target==player) GM_UpdateBonus (pstate->protectiontime, false); return; } else if ((target->flags&FL_GODMODE) || (target->flags&FL_DOGMODE) || godmode) return; //damage=FixedMulShift((gamestate.difficulty+1),damage,2); // player object difficulty } else if (tcl == NMEsaucerobj) { target->momentumx = target->momentumy = 0; NewState(target,&s_explosion1); target->flags &= ~FL_SHOOTABLE; return; } else if (tcl == b_darianobj) MISCVARS->ESAU_SHOOTING = false; else if ((tcl == strikeguardobj) || (tcl == b_heinrichobj)) target->target = shooter; if (( (!(target->flags & FL_SHOOTABLE)) || (tcl == roboguardobj) || (tcl == wallopobj) || (tcl == patrolgunobj) ) && (tcl!=playerobj) ) SpawnMetalSparks(target,angle); else if ((tcl < b_darianobj) || (tcl > b_darksnakeobj)) { //target->flags &= ~FL_USE; damage=FixedMulShift(511-accuracy,damage,9); // Min half damage if (dist<64) { if (dist>2) damage=FixedMulShift(63-dist,damage,6); if (damage<1) damage=1; } else damage=1; if (damage>MAXDAMAGE) damage=MAXDAMAGE; // absolutely clip it DamageThing(target,damage); if ((tcl == collectorobj) && gamestate.SpawnDeluder) { Collision(target,shooter,0,0); if (target->hitpoints <= 0) BATTLE_CheckGameStatus(battle_shot_deluder,shooter->dirchoosetime); } else {newmomx = FixedMul(damage<<7,costable[angle]); newmomy = -FixedMul(damage<<7,sintable[angle]); Collision(target,shooter,-(target->momentumx)+newmomx,-(target->momentumy)+newmomy); if (tcl == playerobj) { playertype * pstate; M_LINKSTATE(target,pstate); if (pstate->health <= 0) { if (shooter->obclass == playerobj) { if (!target->momentumz) BATTLE_PlayerKilledPlayer(battle_kill_with_bullet,shooter->dirchoosetime,target->dirchoosetime); else BATTLE_PlayerKilledPlayer(battle_kill_with_bullet_in_air,shooter->dirchoosetime,target->dirchoosetime); } } } // SoftError("ShootActor: damage=%ld dist=%ld\n",damage,dist); if ((GameRandomNumber("disembowel",0)<64) && (gamestate.violence == vl_excessive)) { int temp; temp=target->temp1; target->temp1=angle; SpawnParticles(target,DISEMBOWEL,damage>>3); target->temp1=temp; } else if (gamestate.violence > 0) SpawnBlood(target,angle); } } } /* ===================== = = ShootSprite = = Shoot a sprite. = ===================== */ void ShootSprite(objtype * shooter, statobj_t * target, int damage, int accuracy, int angle) { int dx,dy,dist; if (!(target->flags & FL_SHOOTABLE)) // Watchout for sprite being passed in as actor WARNING SpawnMetalSparks((objtype *)target,angle); else { dx = abs(shooter->x - target->x); dy = abs(shooter->y - target->y); dist = FindDistance(dx,dy)>>16; damage=FixedMulShift(511-accuracy,damage,9); // Min half damage if (dist<64) { if (dist>2) damage=FixedMulShift(63-dist,damage,6); if (damage<1) damage=1; } else damage=1; if (damage>MAXDAMAGE) damage=MAXDAMAGE; // absolutely clip it // SoftError("ShootSprite: damage=%ld dist=%ld\n",damage,dist); DamageThing((objtype *)target,damage); if (FirstExplosionState(new->state)) new->whatever = shooter; SpawnStaticDamage(target, angle); } } /* ===================== = = RayShoot = = Cast a ray out at the shooter's angle and yzangle, return = ===================== */ void RayShoot (objtype * shooter, int damage, int accuracy) { objtype *tempactor; statobj_t *checksprite; int snx,sny; int incr[2]; int zincr[2]; int thedir[2]; int cnt; int grid[2]; int index; int vx,vy; int angle; int yzangle; int value; int offset; int z; int lastcnt; int bullethole=0; enum {gs_door, gs_wall, gs_floor, gs_ceiling, gs_pushwall}; int smokecondition=0; if ((shooter->areanumber==player->areanumber) && (Near(shooter,player,3))) SetIllumination(2); offset = ((GameRandomNumber("RayShoot",0)-128)>>MAXSHOOTSHIFT); offset = FixedMulShift(accuracy,offset,8); if (offset>MAXSHOOTOFFSET) offset=MAXSHOOTOFFSET; else if (offset<-MAXSHOOTOFFSET) offset=-MAXSHOOTOFFSET; angle=(shooter->angle+offset)&(FINEANGLES-1); offset = ((GameRandomNumber("RayShoot",1)-128)>>MAXSHOOTSHIFT); offset = FixedMulShift(accuracy,offset,8); if (offset>MAXSHOOTOFFSET) offset=MAXSHOOTOFFSET; else if (offset<-MAXSHOOTOFFSET) offset=-MAXSHOOTOFFSET; yzangle=(shooter->yzangle+offset)&(FINEANGLES-1); vy = -sintable[angle]; vx = costable[angle]; snx=shooter->x&0xffff; sny=shooter->y&0xffff; grid[0]=shooter->tilex; grid[1]=shooter->tiley; if (shooter->obclass==playerobj) { playertype * pstate; M_LINKSTATE(shooter,pstate); z=shooter->z+pstate->playerheight-32; } else z=shooter->z-7; if (vx>0) { thedir[0]=1; snx^=0xffff; incr[1]=-vx; } else { thedir[0]=-1; incr[1]=vx; } if (vy>0) { thedir[1]=1; sny^=0xffff; incr[0]=vy; } else { thedir[1]=-1; incr[0]=-vy; } zincr[0]=-FixedMulShift(sintable[yzangle],abs(vx),26); zincr[1]=-FixedMulShift(sintable[yzangle],abs(vy),26); cnt=FixedMul(snx,incr[0])+FixedMul(sny,incr[1]); index= (cnt >= 0); do { tempactor = (objtype*)actorat[grid[0]][grid[1]]; value = tilemap[grid[0]][grid[1]]; checksprite = sprites[grid[0]][grid[1]]; if (value) { if (value&0x8000) { if (!(value&0x4000)) { if ((doorobjlist[value&0x3ff]->action==dr_closed) || (zposition<=0x8000) { smokecondition=gs_door; break; } } else { if ( maskobjlist[value&0x3ff]->flags & MW_SHOOTABLE ) { if (z>maxheight-64) // Are we shooting above the glass { UpdateMaskedWall(value&0x3ff); return; } } else if ( maskobjlist[value&0x3ff]->flags & MW_WEAPONBLOCKING ) { smokecondition=gs_door; break; } } } else { smokecondition=gs_wall; break; } } if (checksprite && ((checksprite->flags & FL_BLOCK)||(checksprite->flags & FL_SHOOTABLE)) && (abs(checksprite->z-z)<32) && (InRange(shooter,(objtype *)checksprite, FindDistance(shooter->x-checksprite->x,shooter->y-checksprite->y) ) ==true ) ) { ShootSprite(shooter, checksprite, damage, accuracy, angle); return; } if (tempactor) {if (tempactor->which == ACTOR) {if ((abs(tempactor->z-z)<32 ) && (!(tempactor->flags & FL_DYING)) && (tempactor->flags & FL_BLOCK) && (tempactor != shooter) && (tempactor->obclass!=diskobj) && (InRange(shooter,tempactor, FindDistance(shooter->x-tempactor->x,shooter->y-tempactor->y) ) ==true ) ) {ShootActor(shooter, tempactor, damage, accuracy, angle); return; } } else if (tempactor->which == PWALL) return; } if (z<-32) { smokecondition=gs_ceiling; break; } else if (z>maxheight) { smokecondition=gs_floor; break; } index= (cnt >= 0); cnt+=incr[index]; z +=zincr[index]; grid[index]+=thedir[index]; } while (1); if (IsWindow(grid[0],grid[1])) return; lastcnt=cnt-incr[index]; if (smokecondition==gs_floor) { int dist; int tangentangle; tangentangle=tantable[yzangle]; if (tangentangle!=0) { dist=FixedDiv2(((shooter->z-maxheight)<<10),(tangentangle<<1)); xintercept=shooter->x+FixedMul(dist,costable[angle]); yintercept=shooter->y-FixedMul(dist,sintable[angle]); } z=maxheight; // bullethole=5; } else if (smokecondition==gs_ceiling) { int dist; int tangentangle; if (sky!=0) return; tangentangle=tantable[yzangle]; if (tangentangle!=0) { dist=FixedDiv2(((shooter->z+32)<<10),(tangentangle<<1)); xintercept=shooter->x+FixedMul(dist,costable[angle]); yintercept=shooter->y-FixedMul(dist,sintable[angle]); } z=-32; // bullethole=5; } else { int dx,dy,xydist; #define CORNERVALUE 0x500 if (IsWindow(grid[0],grid[1])) return; if (lastcnt<0) { xintercept=grid[0]<<16; if (smokecondition==gs_door) { if (thedir[0]<0) xintercept+=0x9fff; else xintercept+=0x5fff; yintercept=FixedScale(xintercept-shooter->x,vy,vx)+shooter->y; if ((yintercept>>16)!=grid[1]) { if ((yintercept>>16)>grid[1]) yintercept=(grid[1]<<16)+0xffff; else yintercept=(grid[1]<<16); } } else if (smokecondition==gs_wall) { if (thedir[0]<0) { objtype * ta; xintercept += 0x10000; yintercept=FixedScale(xintercept-shooter->x,vy,vx)+shooter->y; xintercept += SMOKEWALLOFFSET; bullethole=1; if (yintercept < ((grid[1] << 16) + CORNERVALUE)) bullethole = 0; else if (yintercept > ((grid[1] << 16) + 0x10000 - CORNERVALUE)) bullethole = 0; ta = (objtype*)actorat[grid[0]][grid[1]]; if ((ta) && (ta->which==PWALL)) bullethole=0; } else { objtype * ta; yintercept=FixedScale(xintercept-shooter->x,vy,vx)+shooter->y; xintercept-=SMOKEWALLOFFSET; bullethole=2; if (yintercept < ((grid[1] << 16) + CORNERVALUE)) bullethole = 0; else if (yintercept > ((grid[1] << 16) + 0x10000 - CORNERVALUE)) bullethole = 0; ta = (objtype*)actorat[grid[0]][grid[1]]; if ((ta) && (ta->which==PWALL)) bullethole=0; } } } else { yintercept=grid[1]<<16; if (smokecondition==gs_door) { if (thedir[1]<0) yintercept+=0x9fff; else yintercept+=0x5fff; xintercept=FixedScale(yintercept-shooter->y,vx,vy)+shooter->x; if ((xintercept>>16)!=grid[0]) { if ((xintercept>>16)>grid[0]) xintercept=(grid[0]<<16)+0xffff; else xintercept=(grid[0]<<16); } } else if (smokecondition==gs_wall) { if (thedir[1]<0) { objtype * ta; yintercept += 0x10000; xintercept=FixedScale(yintercept-shooter->y,vx,vy)+shooter->x; yintercept += SMOKEWALLOFFSET; bullethole=3; if (xintercept < ((grid[0] << 16) + CORNERVALUE)) bullethole = 0; else if (xintercept > ((grid[0] << 16) + 0x10000 - CORNERVALUE)) bullethole = 0; ta = (objtype*)actorat[grid[0]][grid[1]]; if ((ta) && (ta->which==PWALL)) bullethole=0; } else { objtype * ta; xintercept=FixedScale(yintercept-shooter->y,vx,vy)+shooter->x; yintercept-=SMOKEWALLOFFSET; bullethole=4; if (xintercept < ((grid[0] << 16) + CORNERVALUE)) bullethole = 0; else if (xintercept > ((grid[0] << 16) + 0x10000 - CORNERVALUE)) bullethole = 0; ta = (objtype*)actorat[grid[0]][grid[1]]; if ((ta) && (ta->which==PWALL)) bullethole=0; } } } dx = xintercept - shooter->x; dy = shooter->y - yintercept; xydist = FindDistance(dx,dy); if (shooter->obclass==playerobj) { playertype * pstate; M_LINKSTATE(shooter,pstate); z=shooter->z-FixedMulShift(xydist,tantable[yzangle],25)+pstate->playerheight-32; } else z=shooter->z-FixedMulShift(xydist,tantable[yzangle],25); if (smokecondition==gs_wall) { if (z<-32) z=-32; } } SpawnGunSmoke(xintercept,yintercept,z,angle,bullethole); } /* ===================== = = T_BossDied () = ===================== */ void T_BossDied (objtype *ob) { if (ob->ticcount) return; switch (ob->obclass) { case b_darianobj: case b_heinrichobj: case b_darkmonkobj: case b_robobossobj: case b_darksnakeobj: playstate = ex_bossdied; break; default: ; } } /* ===================== = = T_Wind () = ===================== */ static int WindDistance = 1000; static int WindCurrentDistance = 1000; static int WindHandle = -1; static int WindLastTic = -1; static int WindPlaying = false; static int WindPitch = 0; static int WindDestPitch = 0; static int WindPitchRate = 0; void T_Wind ( objtype *ob ) { int distance; int dx; int dy; if ( ( GetTicCount() - WindLastTic ) > 0 ) { WindDistance = 1000; WindPitch += WindPitchRate; if ( WindPitch == WindDestPitch ) { WindDestPitch = ( RandomNumber( "Wind Pitch", 0 ) - 128 ) << 3; WindPitchRate = 1; if ( WindDestPitch < WindPitch ) { WindPitchRate = -WindPitchRate; } } } WindLastTic = GetTicCount(); dx = ( ob->x - PLAYER[0]->x ); dy = ( PLAYER[0]->y - ob->y ); distance = 1000; if ( areabyplayer[ ob->areanumber ] ) { distance = ( FindDistance( dx, dy ) ) >> 13; } if ( distance < WindDistance ) { WindDistance = distance; } if ( WindDistance < 255 ) { WindPlaying = true; WindCurrentDistance = WindDistance; } else { if ( WindPlaying ) { WindCurrentDistance += 3; } } if ( WindPlaying ) { if ( WindCurrentDistance < 255 ) { if ( !SD_SoundActive( WindHandle ) ) { WindHandle = SD_PlayPitchedSound( SD_WINDSND, 255 - WindCurrentDistance, WindPitch ); } else { SD_SetSoundPitch( WindHandle, WindPitch ); SD_SetPan( WindHandle, 255 - WindCurrentDistance, 255 - WindCurrentDistance, 255 - WindCurrentDistance ); } } else { SD_StopSound( WindHandle ); WindPlaying = false; } } } /* ===================== = = StopWind () = ===================== */ void StopWind ( void ) { objtype *temp; FX_SetReverb( 0 ); SD_StopSound( WindHandle ); WindDistance = 1000; WindCurrentDistance = 1000; WindHandle = -1; WindLastTic = -1; WindPlaying = false; WindPitch = 0; WindDestPitch = 0; WindPitchRate = 0; for(temp=FIRSTACTOR;temp;temp=temp->next) { if (temp->soundhandle != -1) SD_StopSound(temp->soundhandle); } } rott-20230810/rott/rt_actor.h000066400000000000000000000267361446517470200157510ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_actor_public #define _rt_actor_public //*************************************************************************** // // RT_ACTOR.C (actor functions) // //*************************************************************************** #include "states.h" #define FL_SYNCED 0x400 #define FL_MASTER 0x800 #define FL_SKELETON 0x02 #define GASTICS 1050 #define M_ISACTOR(x) ((x!=NULL) && (x->which == ACTOR)) #define SF_GUTS 0x20 #define NUMENEMIES 16 #define NUMCLASSES 51 #define MAXTOUCH 10 #define MAXPOP 32 #define MAXDELETE 512 #define InMapBounds(x,y) (((x) >= 0) && ((x) < MAPSIZE) && ((y) >= 0) && ((y) < MAPSIZE)) #define ACTIVE(ob) ((ob == firstactive) || (ob->prevactive) || (ob->nextactive)) enum {SHOOT,SIGHT,DIRCHECK,EXPLOSION,MISSILE}; typedef enum { gt_sparks, gt_organ, gt_rib, gt_pinkorgan, gt_head, gt_arm, gt_leg, gt_humerus, gt_pelvis, gt_limb, gt_bsoul, gt_lsoul, gt_spit, NumGibTypes }gib_t; #define GUTS (NumGibTypes) #define RANDOM (NumGibTypes + 1) #define DISEMBOWEL (NumGibTypes + 2) #define GASVALUE 192 #define PAINOFFSET 2 #define PMFOFFSET 50 #define REMOTEOFFSET 86 #define ACTORSIZE 0x5800 #define PWALLRAD 0xa000 #define M_ABS abs #define M_CheckPlayerKilled(ob) \ { if ((ob->obclass == playerobj) && (ob->flags & FL_DYING)) \ BATTLE_CheckGameStatus(battle_player_killed,ob->dirchoosetime);\ } #define SetTilePosition(ob, newtilex, newtiley) \ { \ ob->tilex = newtilex; \ ob->tiley = newtiley; \ ob->x = (ob->tilex << TILESHIFT) + TILEGLOBAL/2; \ ob->y = (ob->tiley << TILESHIFT) + TILEGLOBAL/2; \ } #define SetFinePosition(ob, newx, newy) \ { \ ob->x = newx; \ ob->y = newy; \ ob->tilex = (ob->x >> TILESHIFT); \ ob->tiley = (ob->y >> TILESHIFT); \ } #define SetVisiblePosition(ob, x, y) \ { \ ob->drawx = x; \ ob->drawy = y; \ } //*************************************************************************** // // WeaponDamages // //*************************************************************************** #define DMG_PISTOL 13 #define DMG_MP40 10 #define DMG_AHGUN 10 #define DMG_ENEMYBULLETWEAPON 10 typedef struct bas { short operate, see, fire, hit, die; } basic_actor_sounds; extern basic_actor_sounds BAS[NUMCLASSES+3]; typedef struct {int x,y; }_2Dpoint; typedef enum { inertobj, playerobj, lowguardobj, highguardobj, overpatrolobj, strikeguardobj, blitzguardobj, triadenforcerobj, deathmonkobj, dfiremonkobj, roboguardobj, b_darianobj, b_heinrichobj, b_robobossobj, b_darkmonkobj, b_darksnakeobj, patrolgunobj, wallopobj, //specials pillarobj, firejetobj, bladeobj, crushcolobj, boulderobj, spearobj, gasgrateobj, springobj, // Missile weapon types shurikenobj, wallfireobj, netobj, h_mineobj, grenadeobj, fireballobj, dmfballobj, bigshurikenobj, missileobj, NMEsaucerobj, dm_weaponobj, dm_heatseekobj, dm_spitobj, p_bazookaobj, p_firebombobj, p_heatseekobj, p_drunkmissileobj, p_firewallobj, p_splitmissileobj, p_kesobj, p_godballobj, collectorobj, diskobj, rainobj }classtype; typedef struct objstruct { thingtype which; byte tilex,tiley; fixed x,y,z; int shapenum; unsigned flags; short ticcount; signed short hitpoints; word whichactor; signed short dirchoosetime; fixed drawx,drawy; classtype obclass; statetype * state; signed char door_to_open; byte areanumber; signed short shapeoffset; int targettilex,targettiley; dirtype dir; short int angle; short int yzangle; int soundhandle; int speed; int momentumx, momentumy, momentumz; int temp1,temp2,temp3; void *whatever,*target; struct objstruct *next, *prev; struct objstruct *nextactive, *prevactive; struct objstruct *nextinarea, *previnarea; } objtype; typedef struct b_struct {int NMErotate; int NMEdirstried; int NMEqueuesize; int ESAU_HIDING,ESAU_SHOOTING; int HRAMMING, HMINING; int SOUNDTIME; int redindex,REDTIME; int monkz; int monkup; int firespawned; int notouch,noholes; int nexttouch,nextpop; int popsleft; int DSTATE; int doorcount; int KEYACTORSLEFT; int GASON; int gasindex; boolean NET_IN_FLIGHT; boolean madenoise; _2Dpoint ETOUCH[MAXTOUCH],EPOP[MAXPOP],TOMLOC; int NUMWEAPONS; int BulletHoleNum; int NUMBEGGINGKEVINS; boolean fulllightgibs; boolean directgibs; int gibgravity; int gibspeed; boolean supergibflag; boolean randgibspeed; int numgibs; boolean elevatormusicon; }misc_stuff; extern boolean ludicrousgibs; extern objtype* PLAYER0MISSILE; extern byte deathshapeoffset[8]; extern byte RANDOMACTORTYPE[10]; extern objtype* FIRSTACTOR,*LASTACTOR; extern objtype *FIRSTRAIN,*LASTRAIN; extern objtype* SCREENEYE; extern objtype *firstareaactor[NUMAREAS+1],*lastareaactor[NUMAREAS+1]; extern misc_stuff mstruct,*MISCVARS; extern int actorstart,actorstop; extern exit_t playstate; extern objtype *lastactive,*firstactive; extern objtype *new,**objlist, *killerobj; extern void *actorat[MAPSIZE][MAPSIZE]; extern int angletodir[ANGLES]; extern _2Dpoint SNAKEPATH[512]; /* extern int STOPSPEED; */ extern int FRICTION; extern int objcount; void SpawnInertActor(int,int,int); objtype* DiskAt(int tilex,int tiley); void GetRainActors(void); void DoRain(void); void SpawnDisk(int,int,int,boolean); void T_ElevDisk(objtype*); void Add_To_Delete_Array(void*); void Remove_Delete_Array_Entries(void); void MakeInactive(objtype*ob); void RespawnEluder(void); void SpawnCollector(int,int); void MakeLastInArea(objtype*); void RemoveFromArea(objtype*); void GetMomenta(objtype*,objtype*,int*,int*,int*,int); int AngleBetween(objtype*,objtype*); void TurnActorIntoSprite(objtype*); void ResolveDoorSpace(int,int); void RemoveObj(objtype*); void SpawnParticles(objtype*,int,int); void MakeActive(objtype*); void SpawnSpear(int,int,int); void SpawnBoulder(int,int,int); void SpawnCrushingColumn(int,int,int); void SpawnFirejet(int,int,int,int); void T_Firethink(objtype*); void SpawnBlade(int,int,int,int,int); void T_OrobotChase(objtype*); void SpawnMultiSpriteActor(classtype,int,int,int); boolean ActorTryMove(objtype*,int,int,int); void A_Repeat(objtype*); void T_Heinrich_Defend(objtype*); void T_Heinrich_Out_of_Control(objtype*); void A_HeinrichShoot(objtype*); void T_EsauWait(objtype*); void T_EsauRise(objtype*); void A_Drain(objtype*ob); void T_Explosion(objtype*ob); void T_MoveColumn(objtype*); void EnableObject(intptr_t object); void DisableObject(intptr_t object); void T_Collide(objtype*); void Collision(objtype*ob,objtype *attacker,int hitmomentumx,int hitmomentumy); void ActorMovement (objtype *); void MoveActor(objtype*); void InitActorList(void); void NewState(objtype*,statetype*); void DoActor(objtype*); void SpawnPushColumn(int tilex,int tiley,int which,int dir, int linked); void SpawnGunThingy(classtype which, int tilex, int tiley, int dir); void SpawnStand (classtype which, int tilex, int tiley, int dir, int ambush); void SpawnPatrol (classtype which, int tilex, int tiley, int dir); void SpawnDeadGuard (int tilex, int tiley); void SpawnWallfire(int tilex, int tiley, int dir); void SpawnMissile(objtype*,classtype,int,int,statetype*,int); void InitHitRect (objtype *ob, unsigned radius); void NewState (objtype *ob, statetype *state); void SelectPathDir(objtype*); void SelectChaseDir (objtype *ob); boolean SightPlayer (objtype *ob); boolean CheckLine (void*,void *,int); boolean CheckSight (objtype *ob,void*); void KillActor (objtype *ob); void DamageThing (void *, int); void MissileHit (objtype *,void*); void GetNewActor(void); void T_WallPath(objtype*); void T_Path (objtype *ob); //done void T_RoboChase(objtype*ob); void T_RoboPath(objtype*ob); void T_Chase (objtype *ob); //done void T_EsauChase(objtype*ob); //done void T_Spears(objtype*); void T_Projectile (objtype *ob); //done void T_Stand (objtype *ob); //done void T_GunStand(objtype *ob); //done void T_Use(objtype *ob); // done void A_Shoot (objtype *ob); // done void A_MissileWeapon(objtype*); // done void A_Wallfire(objtype*); void A_Steal(objtype*); void T_Roll(objtype*); void T_BossDied (objtype *ob); boolean QuickSpaceCheck(objtype*,int,int); void PushWallMove(int num); void SpawnNewObj(unsigned,unsigned,statetype*,classtype); void SpawnSpring(int,int); void SpawnFourWayGun(int,int); void SpawnSnake(int tilex,int tiley); void SpawnSneaky(int,int); boolean MissileTryMove(objtype*ob,int,int,int); void SaveActors(byte ** buf, int * size); void LoadActors(byte * buf, int size); boolean TurnOffLight0 (int tilex, int tiley); boolean TurnOffLight1 (int tilex, int tiley, int i, int j); boolean TurnOffLight2 (int tilex, int tiley, int j); boolean TurnOffLight3 (int tilex, int tiley, int i); void ParseMomentum(objtype *ob,int angle); void SpawnGroundExplosion(int x, int y, int z); void RayShoot (objtype * shooter, int damage, int accuracy); void FindEmptyTile(int *stilex, int *stiley); void T_Wind( objtype *ob ); void StopWind( void ); #endif rott-20230810/rott/rt_battl.c000066400000000000000000000714771446517470200157440ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: RT_BATTL.C author: James R. Dose phone: (214)-271-1365 Ext #221 date: September 8, 1994 Battle mode support routines for Rise of the Triad. (c) Copyright 1994 Apogee Software. All Rights Reserved. **********************************************************************/ #include #include "rt_def.h" #include "rottnet.h" #include "isr.h" #include "rt_battl.h" #include "rt_actor.h" #include "rt_rand.h" #include "rt_playr.h" #include "rt_game.h" #include "rt_sound.h" #include "rt_com.h" #include "rt_msg.h" #include "rt_view.h" #include "rt_util.h" #include "rt_main.h" #define INFINITE -1 static battle_status BATTLE_StartRound( void ); static int Timer; static int TimeLimit; static int NumberOfPlayers; static int BattleRound; static int BattleMode; static boolean RoundOver; static boolean KillsEndGame; static boolean KeepTrackOfKills; boolean UpdateKills; static boolean SwapFlag; static battle_type BattleOptions; specials BattleSpecialsTimes = { 60, // god 60, // dog 20, // shrooms 20, // elasto 60, // asbestos vest 60, // bullet proof vest GASTICS / VBLCOUNTER, // gas mask 60, // mercury mode 300, // god respawn 60, // dog respawn 60, // shrooms respawn 60, // elasto respawn 60, // asbestos vest respawn 60, // bullet proof vest respawn 60, // gas mask respawn 60 // mercury mode respawn }; short WhoKilledWho[ MAXPLAYERS ][ MAXPLAYERS ]; short BATTLE_Points[ MAXPLAYERS ]; short BATTLE_PlayerOrder[ MAXPLAYERS ]; short BATTLE_Team[ MAXPLAYERS ]; short BATTLE_TeamLeader[ MAXPLAYERS ]; int BATTLE_NumberOfTeams; int BATTLE_NumCollectorItems; int PointGoal; int DisplayPoints; int BATTLE_It; boolean BATTLE_ShowKillCount; boolean BATTLEMODE = false; /*--------------------------------------------------------------------- Function: BATTLE_Init Initializes the battle information. ---------------------------------------------------------------------*/ void BATTLE_Init ( int battlemode, int numplayers ) { int index; int index2; int team; int TeamNumber[ MAXPLAYERCOLORS ]; #if (BATTLECHECK == 1) if ( ( gamestate.teamplay ) && ( BattleMode == battle_Tag ) ) { Error( "BATTLE_Init : Cannot play Tag in team mode.\n" ); } if ( ( gamestate.teamplay ) && ( BattleMode == battle_CaptureTheTriad ) ) { Error( "BATTLE_Init : Can only play Capture the Triad in team mode.\n" ); } #endif Timer = 0; RoundOver = false; BattleRound = -1; BATTLE_It = 0; BattleMode = battlemode; BATTLEMODE = false; UpdateKills = true; gamestate.BattleOptions.Gravity = NORMAL_GRAVITY; gamestate.BattleOptions.Speed = bo_normal_speed; gamestate.BattleOptions.Ammo = bo_normal_shots; gamestate.BattleOptions.HitPoints = bo_character_hitpoints; gamestate.BattleOptions.LightLevel = bo_light_normal; gamestate.BattleOptions.Kills = bo_kills_default; gamestate.BattleOptions.DangerDamage = bo_danger_normal; gamestate.BattleOptions.TimeLimit = bo_time_infinite; gamestate.BattleOptions.RespawnTime = bo_normal_respawn_time; gamestate.BattleOptions.RandomWeapons = false; gamestate.BattleOptions.FriendlyFire = true; gamestate.BattleOptions.WeaponPersistence = false; gamestate.BattleOptions.SpawnMines = false; if ( BattleMode != battle_StandAloneGame ) { BATTLEMODE = true; if ( gamestate.Product == ROTT_SHAREWARE ) { switch( battlemode ) { case battle_Normal : case battle_Collector : case battle_Hunter : break; default : Error( "Shareware version can only play Normal, Collector, " "or Hunter in Comm-bat game." ); } } gamestate.BattleOptions.Gravity = BattleOptions.Gravity; gamestate.BattleOptions.Speed = BattleOptions.Speed; gamestate.BattleOptions.Ammo = BattleOptions.Ammo; gamestate.BattleOptions.HitPoints = BattleOptions.HitPoints; gamestate.BattleOptions.LightLevel = BattleOptions.LightLevel; gamestate.BattleOptions.Kills = BattleOptions.Kills; gamestate.BattleOptions.DangerDamage = BattleOptions.DangerDamage; gamestate.BattleOptions.TimeLimit = BattleOptions.TimeLimit; gamestate.BattleOptions.RespawnTime = BattleOptions.RespawnTime; gamestate.BattleOptions.RandomWeapons = BattleOptions.RandomWeapons; gamestate.BattleOptions.FriendlyFire = BattleOptions.FriendlyFire; gamestate.BattleOptions.SpawnMines = BattleOptions.SpawnMines; gamestate.BattleOptions.WeaponPersistence = BattleOptions.WeaponPersistence; } gamestate.ShowScores = true; gamestate.BattleOptions.SpawnHealth = true; gamestate.BattleOptions.SpawnWeapons = true; gamestate.BattleOptions.SpawnDangers = true; gamestate.SpawnCollectItems = false; gamestate.SpawnEluder = false; gamestate.SpawnDeluder = false; gamestate.BattleOptions.RespawnItems = false; NumberOfPlayers = numplayers; BATTLE_NumberOfTeams = numplayers; for( index = 0; index < MAXPLAYERS; index++ ) { BATTLE_PlayerOrder[ index ] = index; BATTLE_Points[ index ] = 0; for( index2 = 0; index2 < MAXPLAYERS; index2++ ) { WhoKilledWho[ index ][ index2 ] = 0; } BATTLE_Team[ index ] = index; BATTLE_TeamLeader[ index ] = index; } if ( gamestate.teamplay ) { for( index = 0; index < MAXPLAYERCOLORS; index++ ) { TeamNumber[ index ] = -1; } BATTLE_NumberOfTeams = 0; for( index = 0; index < numplayers; index++ ) { team = PLAYERSTATE[ index ].uniformcolor; if ( TeamNumber[ team ] == -1 ) { TeamNumber[ team ] = BATTLE_NumberOfTeams; BATTLE_TeamLeader[ BATTLE_NumberOfTeams ] = index; BATTLE_NumberOfTeams++; } BATTLE_Team[ index ] = TeamNumber[ team ]; } } PointGoal = gamestate.BattleOptions.Kills; if ( ( gamestate.BattleOptions.Kills == bo_kills_random ) || ( gamestate.BattleOptions.Kills == bo_kills_blind ) ) { // Possibility of playing from 5 to 50 kills PointGoal = ( GameRandomNumber( "BATTLE_Init", 0 ) % 46 ) + 5; } DisplayPoints = PointGoal; for( index = 0; index < MAXPLAYERS; index++ ) { gamestate.PlayerHasGun[ index ] = true; } KillsEndGame = true; KeepTrackOfKills = true; switch( BattleMode ) { case battle_StandAloneGame : KillsEndGame = false; KeepTrackOfKills = false; break; case battle_Normal : break; case battle_ScoreMore : break; case battle_Collector : for( index = 0; index < MAXPLAYERS; index++ ) { gamestate.PlayerHasGun[ index ] = false; } KillsEndGame = false; KeepTrackOfKills = false; gamestate.BattleOptions.SpawnHealth = false; gamestate.BattleOptions.SpawnWeapons = false; gamestate.SpawnCollectItems = true; break; case battle_Scavenger : KillsEndGame = false; KeepTrackOfKills = false; gamestate.BattleOptions.SpawnWeapons = true; gamestate.BattleOptions.SpawnHealth = true; gamestate.SpawnCollectItems = true; break; case battle_Hunter : PointGoal *= BATTLE_NumberOfTeams; KillsEndGame = false; KeepTrackOfKills = true; BATTLE_It = 0; for( index = 0; index < NumberOfPlayers; index++ ) { if ( BATTLE_Team[ index ] == 0 ) { gamestate.PlayerHasGun[ index ] = false; } } break; case battle_Tag : for( index = 0; index < MAXPLAYERS; index++ ) { gamestate.PlayerHasGun[ index ] = false; } gamestate.BattleOptions.SpawnHealth = false; gamestate.BattleOptions.SpawnWeapons = false; gamestate.BattleOptions.SpawnDangers = true; KeepTrackOfKills = true; KillsEndGame = true; break; case battle_Eluder : KeepTrackOfKills = false; KillsEndGame = false; for( index = 0; index < MAXPLAYERS; index++ ) { gamestate.PlayerHasGun[ index ] = false; } gamestate.BattleOptions.SpawnWeapons = false; gamestate.SpawnEluder = true; break; case battle_Deluder : KeepTrackOfKills = false; KillsEndGame = false; gamestate.SpawnDeluder = true; break; case battle_CaptureTheTriad : KillsEndGame = false; KeepTrackOfKills = false; break; } if ( BattleMode != battle_StandAloneGame ) { if ( BattleOptions.RespawnItems ) { gamestate.BattleOptions.RespawnItems = true; } if ( !BattleOptions.SpawnDangers ) { gamestate.BattleOptions.SpawnDangers = false; } if ( !BattleOptions.SpawnHealth ) { gamestate.BattleOptions.SpawnHealth = false; } if ( !BattleOptions.SpawnWeapons ) { gamestate.BattleOptions.SpawnWeapons = false; } if ( gamestate.BattleOptions.Kills == bo_kills_blind ) { gamestate.ShowScores = false; } GRAVITY = gamestate.BattleOptions.Gravity; if ( gamestate.BattleOptions.Kills == bo_kills_infinite ) { KillsEndGame = false; } } BATTLE_StartRound(); #if (BATTLEINFO == 1) SoftError( "GRAVITY = %d\n", GRAVITY ); SoftError( "BO_Gravity = %d\n", BattleOptions.Gravity ); SoftError( "BO_Speed = %d\n", BattleOptions.Speed ); SoftError( "BO_Ammo = %d\n", BattleOptions.Ammo ); SoftError( "BO_HitPoints = %d\n", BattleOptions.HitPoints ); SoftError( "BO_Dangers = %d\n", BattleOptions.SpawnDangers ); SoftError( "BO_Health = %d\n", BattleOptions.SpawnHealth ); SoftError( "BO_Weapons = %d\n", BattleOptions.SpawnWeapons ); SoftError( "BO_Respawn = %d\n", BattleOptions.RespawnItems ); SoftError( "BO_Light = %d\n", BattleOptions.LightLevel ); SoftError( "BO_Kills = %d\n", BattleOptions.Kills ); SoftError( "BO_DangerDam = %d\n", BattleOptions.DangerDamage ); SoftError( "BO_TimeLimit = %d\n", BattleOptions.TimeLimit ); #endif } /*--------------------------------------------------------------------- Function: BATTLE_GetSpecials Set the battle special times. ---------------------------------------------------------------------*/ void BATTLE_GetSpecials ( void ) { int *src; int *dest; src = ( int * )&BattleSpecialsTimes; dest = ( int * )&gamestate.SpecialsTimes; while( src < ( int * )( &BattleSpecialsTimes + 1 ) ) { *dest = *src * VBLCOUNTER; dest++; src++; } } /*--------------------------------------------------------------------- Function: BATTLE_SetOptions Set the battle options. ---------------------------------------------------------------------*/ void BATTLE_SetOptions ( battle_type *options ) { memcpy( &BattleOptions, options, sizeof( battle_type ) ); } /*--------------------------------------------------------------------- Function: BATTLE_GetOptions Returns the battle options. ---------------------------------------------------------------------*/ void BATTLE_GetOptions ( battle_type *options ) { memcpy( options, &BattleOptions, sizeof( battle_type ) ); } /*--------------------------------------------------------------------- Function: BATTLE_Shutdown Shutsdown the battle information. ---------------------------------------------------------------------*/ void BATTLE_Shutdown ( void ) { int index; int index2; Timer = 0; RoundOver = false; BattleRound = 0; BattleMode = battle_StandAloneGame; BATTLEMODE = false; NumberOfPlayers = 1; BATTLE_NumberOfTeams = 1; PointGoal = 0; KillsEndGame = false; KeepTrackOfKills = false; for( index = 0; index < MAXPLAYERS; index++ ) { BATTLE_Points[ index ] = 0; for( index2 = 0; index2 < MAXPLAYERS; index2++ ) { WhoKilledWho[ index ][ index2 ] = 0; } gamestate.PlayerHasGun[ index ] = true; } gamestate.BattleOptions.SpawnHealth = true; gamestate.BattleOptions.SpawnWeapons = true; gamestate.BattleOptions.SpawnDangers = true; gamestate.BattleOptions.RandomWeapons = false; gamestate.BattleOptions.FriendlyFire = true; gamestate.BattleOptions.WeaponPersistence = false; gamestate.BattleOptions.SpawnMines = false; gamestate.ShowScores = true; gamestate.SpawnCollectItems = false; gamestate.SpawnEluder = false; gamestate.SpawnDeluder = false; } /*--------------------------------------------------------------------- Function: BATTLE_StartRound Begins a round of battle. ---------------------------------------------------------------------*/ static battle_status BATTLE_StartRound ( void ) { int index; Timer = 0; TimeLimit = INFINITE; RoundOver = false; if ( !BATTLEMODE ) { return( battle_no_event ); } BattleRound++; if ( gamestate.BattleOptions.TimeLimit == bo_time_infinite ) { if ( BattleMode == battle_Hunter ) { TimeLimit = MINUTES_TO_GAMECOUNT( 99 ); } else { TimeLimit = INFINITE; } } else { TimeLimit = MINUTES_TO_GAMECOUNT( gamestate.BattleOptions.TimeLimit ); } if ( BattleMode == battle_Hunter ) { for( index = 0; index < MAXPLAYERS; index++ ) { gamestate.PlayerHasGun[ index ] = true; } if ( ( gamestate.BattleOptions.Kills != bo_kills_infinite ) && ( BattleRound >= PointGoal ) ) { return( battle_end_game ); } BATTLE_It = BattleRound % BATTLE_NumberOfTeams; for( index = 0; index < NumberOfPlayers; index++ ) { if ( BATTLE_Team[ index ] == BATTLE_It ) { gamestate.PlayerHasGun[ index ] = false; } } } return( battle_no_event ); } /*--------------------------------------------------------------------- Function: BATTLE_CheckGameStatus Checks if certain battle mode conditions have been met and determines the appropriate response. ---------------------------------------------------------------------*/ battle_status BATTLE_CheckGameStatus ( battle_event reason, int player ) { battle_status status; int team; if ( ( player < 0 ) || ( player >= MAXPLAYERS ) ) { #if (BATTLECHECK == 1) Error( "BATTLE_CheckGameStatus - reason %d : Player out of range!\n", reason ); #else return( battle_no_event ); #endif } if ( !BATTLEMODE ) { return( battle_no_event ); } team = BATTLE_Team[ player ]; status = battle_no_event; switch( reason ) { case battle_refresh : Timer++; if ( ( TimeLimit != INFINITE ) && ( Timer > TimeLimit ) ) { RoundOver = true; if ( BattleMode == battle_Hunter ) { status = BATTLE_StartRound(); if ( status == battle_no_event ) { status = battle_end_round; } } else { status = battle_out_of_time; } UpdateKills = true; } if ( UpdateKills ) { BATTLE_SortPlayerRanks(); if ( gamestate.ShowScores ) { DrawKills (false); } UpdateKills = false; } if ( RoundOver ) { return( battle_end_game ); } break; case battle_player_killed : #if (BATTLEINFO == 1) SoftError( "BATTLE_CheckGameStatus: Player %d Died", player ); SoftError( "---ticks = %d\n", Timer ); #endif switch( BattleMode ) { case battle_Normal : case battle_ScoreMore : case battle_Hunter : if ( BattleOptions.FriendlyFire ) { BATTLE_Points[ team ]--; UpdateKills = true; } break; case battle_Tag : // Same as being tagged if ( BattleOptions.FriendlyFire ) { BATTLE_Points[ team ]++; UpdateKills = true; } break; } WhoKilledWho[ player ][ player ]++; break; case battle_get_collector_item : if ( ( BattleMode != battle_Collector ) && ( BattleMode != battle_Scavenger ) ) { #if (BATTLECHECK == 1) Error( "BATTLE_CheckGameStatus : Got collector item on wrong battle mode!" ); #else return( battle_no_event ); #endif } BATTLE_Points[ team ]++; UpdateKills = true; BATTLE_NumCollectorItems--; if ( BATTLE_NumCollectorItems <= 0 ) { RoundOver = true; return( battle_end_game ); } break; case battle_caught_eluder : if ( BattleMode == battle_Deluder ) { return( battle_no_event ); } if ( BattleMode != battle_Eluder ) { #if (BATTLECHECK == 1) Error( "BATTLE_CheckGameStatus : Caught Eluder on non-Eluder battle mode!" ); #else return( battle_no_event ); #endif } BATTLE_Points[ team ]++; UpdateKills = true; if ( ( gamestate.BattleOptions.Kills != bo_kills_infinite ) && ( BATTLE_Points[ team ] >= PointGoal ) ) { RoundOver = true; return( battle_end_game ); } RespawnEluder(); break; case battle_shot_deluder : if ( BattleMode == battle_Eluder ) { return( battle_no_event ); } if ( BattleMode != battle_Deluder ) { #if (BATTLECHECK == 1) Error( "BATTLE_CheckGameStatus : Shot Eluder on non-Eluder battle mode!" ); #else return( battle_no_event ); #endif } BATTLE_Points[ team ]++; UpdateKills = true; if ( ( gamestate.BattleOptions.Kills != bo_kills_infinite ) && ( BATTLE_Points[ team ] >= PointGoal ) ) { RoundOver = true; return( battle_end_game ); } RespawnEluder(); break; case battle_captured_triad : if ( BattleMode != battle_CaptureTheTriad ) { #if (BATTLECHECK == 1) Error( "BATTLE_CheckGameStatus : Triad Captured on invalid battle mode!" ); #else return( battle_no_event ); #endif } if ( consoleplayer == player ) { AddMessage( "You captured a triad! You rule!", MSG_GAME ); } BATTLE_Points[ team ]++; UpdateKills = true; if ( ( gamestate.BattleOptions.Kills != bo_kills_infinite ) && ( BATTLE_Points[ team ] >= PointGoal ) ) { RoundOver = true; return( battle_end_game ); } break; default : #if (BATTLECHECK == 1) Error( "BATTLE_CheckGameStatus called with a reason of %d.", reason ); #else return( battle_no_event ); #endif break; } return( status ); } /*--------------------------------------------------------------------- Function: BATTLE_SortPlayerRanks Sorts the players in order of score. ---------------------------------------------------------------------*/ void BATTLE_SortPlayerRanks ( void ) { int i; int j; int temp; SwapFlag = false; if ( BattleMode == battle_Tag ) { for( i = 0; i < BATTLE_NumberOfTeams - 1; i++ ) { for( j = i + 1; j < BATTLE_NumberOfTeams; j++ ) { if ( BATTLE_Points[ BATTLE_PlayerOrder[ i ] ] > BATTLE_Points[ BATTLE_PlayerOrder[ j ] ] ) { SwapFlag = true; temp = BATTLE_PlayerOrder[ i ]; BATTLE_PlayerOrder[ i ] = BATTLE_PlayerOrder[ j ]; BATTLE_PlayerOrder[ j ] = temp; } } } } else { for( i = 0; i < BATTLE_NumberOfTeams - 1; i++ ) { for( j = i + 1; j < BATTLE_NumberOfTeams; j++ ) { if ( BATTLE_Points[ BATTLE_PlayerOrder[ i ] ] < BATTLE_Points[ BATTLE_PlayerOrder[ j ] ] ) { SwapFlag = true; temp = BATTLE_PlayerOrder[ i ]; BATTLE_PlayerOrder[ i ] = BATTLE_PlayerOrder[ j ]; BATTLE_PlayerOrder[ j ] = temp; } } if ( BattleMode != battle_Hunter ) { BATTLE_It = BATTLE_PlayerOrder[ 0 ]; } } } #if (BATTLEINFO == 1) for( i = 0; i < BATTLE_NumberOfTeams; i++ ) { SoftError( "Sorted rank %d = player %d : Score = %d\n", i, BATTLE_PlayerOrder[ i ], BATTLE_Points[ BATTLE_PlayerOrder[ i ] ] ); } #endif if ( ( SwapFlag == true ) && ( gamestate.ShowScores ) && ( SHOW_TOP_STATUS_BAR() || SHOW_KILLS() ) ) { SD_Play ( SD_ENDBONUS1SND ); } } /*--------------------------------------------------------------------- Function: BATTLE_PlayerKilledPlayer Increases the number of kills a player has. ---------------------------------------------------------------------*/ battle_status BATTLE_PlayerKilledPlayer ( battle_event reason, int killer, int victim ) { int points; int status; int killerteam; int victimteam; #if (BATTLEINFO == 1) SoftError( "PlayerKilledPlayer:\nMode = %d\n", BattleMode ); SoftError( "Reason = %d\n", reason ); SoftError( "killer = %d, team = %d\n", killer, killerteam ); SoftError( "victim = %d, team = %d\n", victim, victimteam ); SoftError( "---ticks = %d\n", Timer ); #endif if ( ( killer < 0 ) || ( killer >= MAXPLAYERS ) ) { #if (BATTLECHECK == 1) Error( "BATTLE_PlayerKilledPlayer - reason %d : Killer out of range!\n", reason ); #else return( battle_no_event ); #endif } if ( ( victim < 0 ) || ( victim >= MAXPLAYERS ) ) { #if (BATTLECHECK == 1) Error( "BATTLE_PlayerKilledPlayer - reason %d : Victim out of range!\n", reason ); #else return( battle_no_event ); #endif } if ( ( killer == victim ) && ( reason != battle_kill_with_missile ) && ( reason != battle_kill_with_missile_in_air ) ) { #if (BATTLECHECK == 1) Error( "BATTLE_PlayerKilledPlayer : Player " "killed self with illegal reason of %d.", reason ); #else return( battle_no_event ); #endif } killerteam = BATTLE_Team[ killer ]; victimteam = BATTLE_Team[ victim ]; if ( ( killerteam < 0 ) || ( killerteam >= BATTLE_NumberOfTeams ) || ( victimteam < 0 ) || ( victimteam >= BATTLE_NumberOfTeams ) ) { #if (BATTLECHECK == 1) Error( "BATTLE_PlayerKilledPlayer - reason %d : Team out of range!\n", reason ); #else return( battle_no_event ); #endif } if ( !BATTLEMODE ) { return( battle_no_event ); } if ( ( consoleplayer == victim ) && ( reason == battle_kill_by_crushing ) ) { AddMessage( "Oh yeah. You've been crushed.", MSG_GAME ); } status = battle_no_event; if ( BattleMode == battle_ScoreMore ) { points = 0; switch( reason ) { case battle_kill_with_missile : points = 1; break; case battle_kill_with_bullet : points = 2; break; case battle_kill_with_missile_in_air : points = 2; break; case battle_kill_with_bullet_in_air : points = 3; break; case battle_kill_by_crushing : points = 4; break; default : #if (BATTLECHECK == 1) Error( "BATTLE_PlayerKilledPlayer called with a reason of %d.", reason ); #else return( battle_no_event ); #endif } if ( killerteam == victimteam ) { if ( BattleOptions.FriendlyFire ) { BATTLE_Points[ killerteam ]--; WhoKilledWho[ killer ][ victim ]++; } } else { BATTLE_Points[ killerteam ] += points; WhoKilledWho[ killer ][ victim ] += points; } UpdateKills = true; } else if ( BattleMode == battle_Tag ) { if ( reason == battle_player_tagged ) { WhoKilledWho[ killer ][ victim ]++; BATTLE_Points[ victimteam ]++; UpdateKills = true; BATTLE_It = victimteam; if ( ( gamestate.BattleOptions.Kills != bo_kills_infinite ) && ( BATTLE_Points[ victimteam ] >= PointGoal ) ) { RoundOver = true; status = battle_end_game; } } #if (BATTLECHECK == 1) else if ( reason != battle_kill_by_crushing ) { Error( "BATTLE_PlayerKilledPlayer - reason %d : " "Illegal reason in Tag!\n", reason ); } #endif return( status ); } else if ( BattleMode == battle_Hunter ) { switch( reason ) { case battle_kill_with_missile : case battle_kill_with_bullet : case battle_kill_with_missile_in_air : case battle_kill_with_bullet_in_air : case battle_kill_by_crushing : if ( victimteam == BATTLE_It ) { WhoKilledWho[ killer ][ victim ]++; if ( killerteam == victimteam ) { if ( BattleOptions.FriendlyFire ) { BATTLE_Points[ killerteam ]--; UpdateKills = true; } } else { BATTLE_Points[ killerteam ]++; UpdateKills = true; } } break; default : #if (BATTLECHECK == 1) Error( "BATTLE_PlayerKilledPlayer called with a " "reason of %d in Hunter.", reason ); #else ; #endif } } else { switch( reason ) { case battle_kill_with_missile : case battle_kill_with_bullet : case battle_kill_with_missile_in_air : case battle_kill_with_bullet_in_air : case battle_kill_by_crushing : WhoKilledWho[ killer ][ victim ]++; if ( KeepTrackOfKills ) { if ( killerteam == victimteam ) { if ( BattleMode == battle_Normal ) { if ( BattleOptions.FriendlyFire ) { BATTLE_Points[ killerteam ]--; UpdateKills = true; } } } else { BATTLE_Points[ killerteam ]++; UpdateKills = true; } } break; default : #if (BATTLECHECK == 1) Error( "BATTLE_PlayerKilledPlayer called with a reason of %d.", reason ); #else return( battle_no_event ); #endif } } if ( ( KillsEndGame ) && ( BATTLE_Points[ killerteam ] >= PointGoal ) ) { RoundOver = true; status = battle_end_game; } return( status ); } rott-20230810/rott/rt_battl.h000066400000000000000000000110541446517470200157320ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: RT_BATTL.H author: James R. Dose phone: (214)-271-1365 Ext #221 date: September 8, 1994 Public header for RT_BATTL.C (c) Copyright 1994 Apogee Software. All Rights Reserved. **********************************************************************/ #ifndef __RT_BATTLE_public #define __RT_BATTLE_public #define BIT_MASK( bit_number ) ( 1 << ( bit_number ) ) #define MINUTES_TO_GAMECOUNT( minutes ) \ ( ( minutes ) * 60 * VBLCOUNTER ) // // Return codes // typedef enum { battle_no_event, battle_end_game, battle_end_round, battle_out_of_time } battle_status; // // Types of battle events // typedef enum { battle_refresh, battle_player_killed, battle_player_tagged, battle_kill_with_missile, battle_kill_with_bullet, battle_kill_with_missile_in_air, battle_kill_with_bullet_in_air, battle_kill_by_crushing, battle_get_collector_item, battle_caught_eluder, battle_shot_deluder, battle_captured_triad } battle_event; // // Battle modes // enum { battle_StandAloneGame, battle_Normal, battle_ScoreMore, battle_Collector, battle_Scavenger, battle_Hunter, battle_Tag, battle_Eluder, battle_Deluder, battle_CaptureTheTriad, battle_NumBattleModes }; // // Battle mode option : Gravity // //enum // { // bo_low_gravity, // bo_normal_gravity, // bo_high_gravity // }; // // Battle mode option : Speed // enum { bo_normal_speed, bo_fast_speed }; // // Battle mode option : Ammo // enum { bo_one_shot, bo_normal_shots, bo_infinite_shots }; // // Battle mode option : Hit points // #define bo_character_hitpoints 0 #define bo_default_hitpoints 250 // // Battle mode option : Light levels // enum { bo_light_dark, bo_light_normal, bo_light_bright, bo_light_fog, bo_light_periodic, bo_light_lightning }; // // Battle mode option : Number of kills // enum { bo_kills_random = -2, bo_kills_blind = -1, bo_kills_infinite = 0, bo_kills_default = 21 }; // // Battle mode option : Environment danger damage // enum { bo_danger_normal = -1, bo_danger_low = 1, bo_danger_kill = 30000 }; // // Battle mode option : Time limit // #define bo_time_infinite 0 // // Battle mode configuration // typedef struct { unsigned Gravity; unsigned Speed; unsigned Ammo; unsigned HitPoints; unsigned SpawnDangers; unsigned SpawnHealth; unsigned SpawnWeapons; unsigned SpawnMines; unsigned RespawnItems; unsigned WeaponPersistence; unsigned RandomWeapons; unsigned FriendlyFire; unsigned LightLevel; int Kills; int DangerDamage; unsigned TimeLimit; unsigned RespawnTime; } battle_type; #define bo_normal_respawn_time 30 extern boolean BATTLEMODE; extern short WhoKilledWho[ MAXPLAYERS ][ MAXPLAYERS ]; extern short BATTLE_Points[ MAXPLAYERS ]; extern short BATTLE_PlayerOrder[ MAXPLAYERS ]; extern int BATTLE_NumCollectorItems; extern int PointGoal; extern int DisplayPoints; extern int BATTLE_It; extern boolean BATTLE_ShowKillCount; extern short BATTLE_Team[ MAXPLAYERS ]; extern short BATTLE_TeamLeader[ MAXPLAYERS ]; extern int BATTLE_NumberOfTeams; extern boolean UpdateKills; // Located in RT_MENU.C extern battle_type BATTLE_Options[ battle_NumBattleModes ]; void BATTLE_Init( int battlemode, int numplayers ); void BATTLE_GetSpecials( void ); void BATTLE_SetOptions( battle_type *options ); void BATTLE_GetOptions( battle_type *options ); battle_status BATTLE_CheckGameStatus( battle_event reason, int player ); void BATTLE_SortPlayerRanks( void ); battle_status BATTLE_PlayerKilledPlayer( battle_event reason, int killer, int victim ); void BATTLE_Shutdown( void ); #endif rott-20230810/rott/rt_build.c000066400000000000000000001103061446517470200157160ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ // RT_BUILD.C #include "rt_def.h" #include #include "watcom.h" #include #include #include "rt_build.h" #include "_rt_buil.h" #include "rt_dr_a.h" #include "rt_draw.h" #include "rt_scale.h" #include "rt_menu.h" #include "rt_main.h" #include "isr.h" #include "rt_util.h" #include "engine.h" #include "lumpy.h" #include "rt_fc_a.h" #include "z_zone.h" #include "w_wad.h" #include "rt_view.h" #include "rt_cfg.h" #include "rt_vid.h" #include "rt_sound.h" #include "modexlib.h" #include "rt_str.h" byte * intensitytable; // LOCAL VARIABLES static byte * menubuf; static byte * menubuffers[2]; static char menutitles[2][40]; static int alternatemenubuf=0; static int titleshade=16; static int titleshadedir=1; static int titleyoffset=0; static char titlestring[40]="\0"; static int readytoflip; static boolean MenuBufStarted=false; static int mindist=0x2700; static boolean BackgroundDrawn=false; static plane_t planelist[MAXPLANES],*planeptr; static int StringShade=16; extern void (*USL_MeasureString)(const char *, int *, int *, font_t *); static char strbuf[MaxString]; //****************************************************************************** // // DrawRotPost // //****************************************************************************** void DrawRotPost ( int height, byte * src, byte * buf, int origheight) { int y1; int y2; hp_srcstep=(origheight<<18)/height; y1 = (((centery<<8)-(height<<5)+(MENUOFFY<<8))); y2 = (((height<<6)+y1)>>8); if (((y1>>8)>=200) || (y2<0)) return; if (y1<0) { hp_startfrac=FixedMulShift(-y1,hp_srcstep,8); y2 = (((height<<6)+y1)>>8); y1=0; } else { hp_startfrac=FixedMulShift(255-(y1&0xff),hp_srcstep,8); y1>>=8; } if (y2>200) { DrawMenuPost(200-y1, src, buf+ylookup[y1]); } else { DrawMenuPost(y2-y1, src, buf+ylookup[y1]); } } /* ======================== = = GetPoint = ======================== */ void GetPoint (int x1, int y1, int px, int py, int * screenx, int * height, int angle) { fixed gxt,gyt,nx,ny; fixed gxtt,gytt; int gx,gy; // // translate point to view centered coordinates // gx = x1-px; gy = y1-py; // // calculate newx // gxt = FixedMul(gx,costable[angle]); gyt = FixedMul(gy,sintable[angle]); nx =gxt-gyt; if (nxx2-plane->x1+1); if (plane->h1<=0 || plane->h2<=0 || (dx==0)) return; d1=65536/plane->h1; d2=65536/plane->h2; dh=((plane->h2-plane->h1)<<8)/dx; top=0; topinc=(d1)*((plane->textureend-plane->texturestart)>>4); bot=d2*dx; botinc=d1-d2; height=(plane->h1<<8); if (plane->x1>=viewwidth) return; for (i=plane->x1;i<=plane->x2;i++) { if ((i>=0 && i>8))) { if (bot) { texture=((top/bot)+(plane->texturestart>>4))>>6; posts[i].texture=texture*plane->viewx; posts[i].lump=plane->shapenum; posts[i].wallheight=(height>>8); posts[i].offset=plane->viewx; } } top+=topinc; bot+=botinc; height+=dh; } } //****************************************************************************** // // DrawPlanePosts // //****************************************************************************** void DrawPlanePosts (void) { int height; byte * buf; byte * shape; int lastwall=-2; int i; shadingtable=colormap+(16<<8); { VGAWRITEMAP(plane); buf=(byte *)(bufferofs); for (i=0;ix1,pptr->y1,pptr->x2,pptr->y2,px,py)<0) { GetPoint (pptr->x1,pptr->y1,px,py,&visptr->x1,&visptr->h1,angle); GetPoint (pptr->x2,pptr->y2,px,py,&visptr->x2,&visptr->h2,angle); visptr->textureend=0x0; visptr->texturestart=pptr->texturewidth; } else { GetPoint (pptr->x2,pptr->y2,px,py,&visptr->x1,&visptr->h1,angle); GetPoint (pptr->x1,pptr->y1,px,py,&visptr->x2,&visptr->h2,angle); visptr->texturestart=0x0; visptr->textureend=pptr->texturewidth; } visptr->shapenum=pptr->texture; visptr->viewx=pptr->origheight; visptr->viewheight=MAX(visptr->h1,visptr->h2); NextVisptr(); } } //****************************************************************************** // // DrawTransformedPlanes // //****************************************************************************** void DrawTransformedPlanes ( void ) { int numvisible; int greatest; int height; int i; visobj_t * closest; numvisible = visptr-&vislist[0]; if (!numvisible) return; // no visible objects for (i = 0; iviewheight; if (height > greatest) { greatest = height; closest = visstep; } } InterpolatePlane(closest); closest->viewheight = 0; } } //****************************************************************************** // // ClearMenuBuf // //****************************************************************************** void ClearMenuBuf ( void ) { byte * shape; if (MenuBufStarted==false) Error("Called ClearMenuBuf without menubuf started\n"); shape=W_CacheLumpName(MENUBACKNAME,PU_CACHE, Cvt_patch_t, 1); shape+=8; memcpy (menubuf,shape,TEXTUREW*TEXTUREHEIGHT); } //****************************************************************************** // // ShutdownMenuBuf // //****************************************************************************** void ShutdownMenuBuf ( void ) { if (MenuBufStarted==false) return; MenuBufStarted=false; SafeFree(menubuffers[0]); SafeFree(menubuffers[1]); if (loadedgame==false) SetViewSize(viewsize); } //****************************************************************************** // // SetupMenuBuf // //****************************************************************************** void SetupMenuBuf ( void ) { #define SRCH 148 #define SRCW 258 #define PLANEX1 (-0x24000) #define PLANEX2 (0x23fff) #define PLANEW (16<<10) #define PLANEY (0x40000) #define PLANEW2 (0x5a827) if (MenuBufStarted==true) return; MenuBufStarted=true; // No top offsets like in game centery=100; centeryfrac=centery<<16; strcpy(titlestring,menutitles[0]); screenofs=0; viewwidth=320; viewheight=200; alternatemenubuf=0; ResetPlaneptr(); planeptr->texture=-1; planeptr->y1=PLANEX1; planeptr->x1=PLANEW; planeptr->y2=PLANEX2; planeptr->x2=PLANEW; planeptr->origheight=TEXTUREHEIGHT; planeptr->texturewidth=TEXTUREWIDTH; NextPlaneptr(); planeptr->texture=-1; planeptr->y1=PLANEX1; planeptr->x1=-PLANEW; planeptr->y2=PLANEX2; planeptr->x2=-PLANEW; planeptr->origheight=TEXTUREHEIGHT; planeptr->texturewidth=TEXTUREWIDTH; NextPlaneptr(); planeptr->texture=W_GetNumForName(MENUBACKNAME); planeptr->y1=PLANEX1; planeptr->x1=PLANEW; planeptr->y2=PLANEX1; planeptr->x2=-PLANEW; planeptr->origheight=TEXTUREHEIGHT; planeptr->texturewidth=TEXTUREWIDTH; NextPlaneptr(); planeptr->texture=W_GetNumForName(MENUBACKNAME); planeptr->y1=PLANEX2; planeptr->x1=PLANEW; planeptr->y2=PLANEX2; planeptr->x2=-PLANEW; planeptr->origheight=TEXTUREHEIGHT; planeptr->texturewidth=TEXTUREWIDTH; NextPlaneptr(); menubuffers[0]=SafeMalloc(TEXTUREW*TEXTUREHEIGHT); menubuffers[1]=SafeMalloc(TEXTUREW*TEXTUREHEIGHT); menubuf=menubuffers[0]; ClearMenuBuf(); BackgroundDrawn=false; } //****************************************************************************** // // PositionMenuBuf // //****************************************************************************** void PositionMenuBuf( int angle, int distance, boolean drawbackground ) { int px,py; font_t * oldfont; int width,height; if (MenuBufStarted==false) Error("Called PositionMenuBuf without menubuf started\n"); CalcTics(); SetupPlanes(); if ((drawbackground==true) || (BackgroundDrawn==false)) { VL_DrawPostPic (W_GetNumForName("trilogo")); } px=FixedMulShift(distance,costable[angle&(FINEANGLES-1)],16); py=FixedMulShift(-distance,sintable[angle&(FINEANGLES-1)],16); CalcPlanes(px,py,(angle+ANG180)&(FINEANGLES-1)); DrawTransformedPlanes(); DrawPlanePosts(); oldfont=CurrentFont; CurrentFont = (font_t *)W_CacheLumpName ("newfnt1", PU_CACHE, Cvt_font_t, 1); US_MeasureStr (&width, &height, "%s", titlestring); US_ClippedPrint ((320-width)>>1, MENUTITLEY-titleyoffset, titlestring); CurrentFont=oldfont; FlipPage(); titleshade+=titleshadedir; if (abs(titleshade-16)>6) titleshadedir=-titleshadedir; if (BackgroundDrawn==false) { VL_CopyDisplayToHidden(); BackgroundDrawn=true; } } //****************************************************************************** // // RefreshMenuBuf // //****************************************************************************** void RefreshMenuBuf( int time ) { int i; if (MenuBufStarted==false) Error("Called RefreshMenuBuf without menubuf started\n"); if (readytoflip) return; for (i=0;i<=time;i+=tics) { //PositionMenuBuf (0,NORMALVIEW,false); PositionMenuBuf (0,NORMALVIEW,true);//bna++ in not true bg in menu is no redrawn } } //****************************************************************************** // // ScaleMenuBufPost // //****************************************************************************** void ScaleMenuBufPost (byte * src, int topoffset, byte * buf) { int d; int offset; int length; int s; while (1) { offset=*(src++); if (offset==0xff) return; else { d=offset-topoffset; length=*(src++); for (s=0;s=TEXTUREW)) Error ("DrawMenuBufPicture: x is out of range\n"); if ((y<0) || (y+h>=TEXTUREHEIGHT)) Error ("DrawMenuBufPicture: y is out of range\n"); for (i=0;ileftoffset)<0) || ((x-p->leftoffset+p->width)>=TEXTUREW)) Error ("DrawMenuBufItem: x is out of range\n"); if (((y-p->topoffset)<0) || ((y-p->topoffset+p->height)>=TEXTUREHEIGHT)) Error ("DrawMenuBufItem: y is out of range\n"); buffer = (byte*)menubuf+y+((x-p->leftoffset)*TEXTUREHEIGHT); for (cnt = 0; cnt < p->width; cnt++,buffer+=TEXTUREHEIGHT) ScaleMenuBufPost ((byte *)(p->collumnofs[cnt]+shape), p->topoffset, buffer); } //****************************************************************************** // // IScaleMenuBufPost // //****************************************************************************** void IScaleMenuBufPost (byte * src, int topoffset, byte * buf, int color) { int d; int offset; int length; int s; while (1) { offset=*(src++); if (offset==0xff) return; else { d=offset-topoffset; length=*(src++); for (s=0;sleftoffset)<0) || ((x-p->leftoffset+p->width)>=TEXTUREW)) Error ("DrawIMenuBufItem: x is out of range\n"); if (((y-p->topoffset)<0) || ((y-p->topoffset+p->height)>=TEXTUREHEIGHT)) Error ("DrawIMenuBufItem: y is out of range\n"); buffer = (byte*)menubuf+y+((x-p->leftoffset)*TEXTUREHEIGHT); for (cnt = 0; cnt < p->width; cnt++,buffer+=TEXTUREHEIGHT) IScaleMenuBufPost ((byte *)(p->collumnofs[cnt]+shape), p->topoffset, buffer, color); } //****************************************************************************** // // TScaleMenuBufPost // //****************************************************************************** void TScaleMenuBufPost (byte * src, int topoffset, byte * buf) { int d; int offset; int length; byte pixel; int s; while (1) { offset=*(src++); if (offset==0xff) return; else { d=offset-topoffset; length=*(src++); for (s=0;s=TEXTUREW)) Error ("EraseMenuBufRegion: x is out of range\n"); if ((y<0) || (y+height>=TEXTUREHEIGHT)) Error ("EraseMenuBufRegion: y is out of range\n"); shape=W_CacheLumpName(MENUBACKNAME,PU_CACHE, Cvt_patch_t, 1); shape+=8; shape+=(x*TEXTUREHEIGHT)+y; buffer = (byte*)menubuf+(x*TEXTUREHEIGHT)+y; for (xx = 0; xx < width; xx++) { for (yy = 0; yy < height; yy++) *(buffer+yy)=*(shape+yy); buffer+=TEXTUREHEIGHT; shape+=TEXTUREHEIGHT; } } //****************************************************************************** // // DrawTMenuBufPic // //****************************************************************************** void DrawTMenuBufPic (int x, int y, int shapenum) { byte *buffer; byte *buf; int xx,yy; int plane; int pixel; byte *shape; pic_t *p; if (MenuBufStarted==false) Error("Called DrawTMenuBufPic without menubuf started\n"); shadingtable=colormap+(25<<8); shape = W_CacheLumpNum (shapenum, PU_CACHE, Cvt_pic_t, 1); p = (pic_t *)shape; if ((x<0) || ((x+(p->width<<2))>=TEXTUREW)) Error ("DrawTMenuBufPic: x is out of range\n"); if ((y<0) || ((y+p->height)>=TEXTUREHEIGHT)) Error ("DrawTMenuBufPic: y is out of range\n"); buffer = (byte*)menubuf+(x*TEXTUREHEIGHT)+y; for (plane=0;plane<4;plane++,buffer+=TEXTUREHEIGHT) { for (yy = 0; yy < p->height; yy++) { buf=buffer+yy; for (xx = 0; xx < p->width; xx++,buf+=TEXTUREHEIGHT<<2) { pixel = *(buf); pixel = *(shadingtable+pixel); *(buf) = pixel; } } } } //****************************************************************************** // // DrawTMenuBufItem // //****************************************************************************** void DrawTMenuBufItem (int x, int y, int shapenum) { byte *buffer; int cnt; byte *shape; patch_t *p; if (MenuBufStarted==false) Error("Called DrawTMenuBufItem without menubuf started\n"); shape = W_CacheLumpNum (shapenum, PU_CACHE, Cvt_patch_t, 1); p = (patch_t *)shape; shadingtable=colormap+(25<<8); if (((x-p->leftoffset)<0) || ((x-p->leftoffset+p->width)>=TEXTUREW)) Error ("DrawTMenuBufItem: x is out of range\n"); if (((y-p->topoffset)<0) || ((y-p->topoffset+p->height)>=TEXTUREHEIGHT)) Error ("DrawTMenuBufItem: y is out of range\n"); buffer = (byte*)menubuf+y+((x-p->leftoffset)*TEXTUREHEIGHT); for (cnt = 0; cnt < p->width; cnt++,buffer+=TEXTUREHEIGHT) TScaleMenuBufPost ((byte *)(p->collumnofs[cnt]+shape), p->topoffset, buffer); } //****************************************************************************** // // DrawColoredMenuBufItem // //****************************************************************************** void DrawColoredMenuBufItem (int x, int y, int shapenum, int color) { byte *buffer; int cnt; byte *shape; patch_t *p; if (MenuBufStarted==false) Error("Called DrawColoredMenuBufItem without menubuf started\n"); shape = W_CacheLumpNum (shapenum, PU_CACHE, Cvt_patch_t, 1); p = (patch_t *)shape; shadingtable=playermaps[color]+(16<<8); if (((x-p->leftoffset)<0) || ((x-p->leftoffset+p->width)>=TEXTUREW)) Error ("DrawColoredMenuBufItem: x is out of range\n"); if (((y-p->topoffset)<0) || ((y-p->topoffset+p->height)>=TEXTUREHEIGHT)) Error ("DrawColoredMenuBufItem: y is out of range\n"); buffer = (byte*)menubuf+y+((x-p->leftoffset)*TEXTUREHEIGHT); for (cnt = 0; cnt < p->width; cnt++,buffer+=TEXTUREHEIGHT) CScaleMenuBufPost ((byte *)(p->collumnofs[cnt]+shape), p->topoffset, buffer); } //****************************************************************************** // // DrawMenuBufPic // //****************************************************************************** void DrawMenuBufPic (int x, int y, int shapenum) { byte *buffer; byte *buf; int xx,yy; int plane; byte *shape; byte *src; pic_t *p; if (MenuBufStarted==false) Error("Called DrawMenuBufPic without menubuf started\n"); shape = W_CacheLumpNum (shapenum, PU_CACHE, Cvt_pic_t, 1); p = (pic_t *)shape; if ((x<0) || ((x+(p->width<<2))>=TEXTUREW)) Error ("DrawTMenuBufPic: x is out of range\n"); if ((y<0) || ((y+p->height)>=TEXTUREHEIGHT)) Error ("DrawTMenuBufPic: y is out of range\n"); buffer = (byte*)menubuf+(x*TEXTUREHEIGHT)+y; src=(byte *)&p->data; for (plane=0;plane<4;plane++,buffer+=TEXTUREHEIGHT) { for (yy = 0; yy < p->height; yy++) { buf=buffer+yy; for (xx = 0; xx < p->width; xx++,buf+=TEXTUREHEIGHT<<2) *(buf)=*(src++); } } } //****************************************************************************** // // DrawTMenuBufBox // //****************************************************************************** void DrawTMenuBufBox ( int x, int y, int width, int height ) { byte *buffer; int xx; int yy; int pixel; if (MenuBufStarted==false) Error("Called DrawTMenuBufBox without menubuf started\n"); shadingtable = colormap + ( 25 << 8 ); if ( ( x < 0 ) || ( ( x + width ) >= TEXTUREW ) ) Error ("DrawTMenuBar : x is out of range\n"); if ( ( y < 0 ) || ( y + height ) >= TEXTUREHEIGHT ) Error ("DrawTMenuBar : y is out of range\n"); buffer = ( byte * )menubuf + ( x * TEXTUREHEIGHT ) + y; for ( xx = 0; xx < width; xx++ ) { for ( yy = 0; yy < height; yy++ ) { pixel = *( buffer + yy ); pixel = *( shadingtable + pixel ); *( buffer + yy ) = pixel; } buffer += TEXTUREHEIGHT; } } //****************************************************************************** // // DrawTMenuBufHLine // //****************************************************************************** void DrawTMenuBufHLine (int x, int y, int width, boolean up) { byte *buffer; byte *buf; int xx; int plane; int pixel; int w = width>>2; int ww = w; if ((x<0) || ((x+(width))>=TEXTUREW)) Error ("DrawTMenuBufBox: x is out of range\n"); if (y<0) Error ("DrawTMenuBufBox: y is out of range\n"); buffer = (byte*)menubuf+(x*TEXTUREHEIGHT)+y; if (up) shadingtable=colormap+(13<<8); else shadingtable=colormap+(25<<8); for (plane = 0; plane < 4; plane++, buffer += TEXTUREHEIGHT) { w = ww; switch (plane) { case 0: if (width % 4) w++; break; case 1: if ((width % 4) > 1) w++; break; case 2: if ((width % 4) > 2) w++; break; } buf = buffer; for (xx = 0; xx < w; xx++, buf += (TEXTUREHEIGHT<<2)) { pixel = *(buf); pixel = *(shadingtable+pixel); *(buf) = pixel; } } } //****************************************************************************** // // DrawTMenuBufVLine // //****************************************************************************** void DrawTMenuBufVLine (int x, int y, int height, boolean up) { byte *buffer; byte *buf; int yy; int pixel; if (x<0) Error ("DrawTMenuBufBox: x is out of range\n"); if ((y<0) || ((y+height)>=TEXTUREHEIGHT)) Error ("DrawTMenuBufBox: y is out of range\n"); buffer = (byte*)menubuf+(x*TEXTUREHEIGHT)+y; if (up) shadingtable=colormap+(13<<8); else shadingtable=colormap+(25<<8); for (yy = 0; yy < height; yy++) { buf = buffer+yy; pixel = *(buf); pixel = *(shadingtable+pixel); *(buf) = pixel; } } //****************************************************************************** //****************************************************************************** // // STRING ROUTINES // //****************************************************************************** //****************************************************************************** //****************************************************************************** // // DrawMenuBufPropString () // //****************************************************************************** void DrawMenuBufPropString (int px, int py, const char *string) { byte pix; int width,height,ht; byte *source, *dest, *origdest; int ch; if (MenuBufStarted==false) Error("Called DrawMenuBufPropString without menubuf started\n"); ht = CurrentFont->height; dest = origdest = (byte*)menubuf+(px*TEXTUREHEIGHT)+py; while ((ch = (unsigned char)*string++)!=0) { ch -= 31; width = CurrentFont->width[ch]; source = ((byte *)CurrentFont)+CurrentFont->charofs[ch]; while (width--) { height = ht; while (height--) { pix = *source; if (pix) *dest = pix; source++; dest ++; } PrintX++; origdest+=TEXTUREHEIGHT; dest = origdest; } } } //****************************************************************************** // // DrawMenuBufIString () // //****************************************************************************** void DrawMenuBufIString (int px, int py, const char *string, int color) { byte pix; int width,height,ht; byte *source, *dest, *origdest; int ch; if (MenuBufStarted==false) Error("Called DrawMenuBufPropString without menubuf started\n"); if ( ( color < 0 ) || ( color > 255 ) ) { Error( "Intensity Color out of range\n" ); } ht = IFont->height; dest = origdest = (byte*)menubuf+(px*TEXTUREHEIGHT)+py; PrintX = px; PrintY = py; while ((ch = (unsigned char)*string++)!=0) { // Tab if ( ch == '\x9' ) { int offset; PrintX -= px; offset = 4 * 5 - PrintX % ( 4 * 5 ); PrintX += offset + px; origdest += offset * TEXTUREHEIGHT; dest = origdest; continue; } ch -= 31; width = IFont->width[ ch ]; source = ( ( byte * )IFont ) + IFont->charofs[ ch ]; while (width--) { height = ht; while (height--) { pix = *source; if ( pix != 0xFE ) { *dest = ( ( byte )intensitytable[ ( pix << 8 ) + color ] ); GetIntensityColor( pix ); } source++; dest ++; } PrintX++; origdest+=TEXTUREHEIGHT; dest = origdest; } } } //****************************************************************************** // // DrawTMenuBufPropString () // // Draws a string at px, py to bufferofs // //****************************************************************************** void DrawTMenuBufPropString (int px, int py, const char *string) { byte pix; int width,height,ht; byte *source, *dest, *origdest; int ch; if (MenuBufStarted==false) Error("Called DrawTMenuBufPropString without menubuf started\n"); ht = CurrentFont->height; dest = origdest = (byte*)menubuf+(px*TEXTUREHEIGHT)+py; shadingtable=colormap+(StringShade<<8); while ((ch = (unsigned char)*string++)!=0) { ch -= 31; width = CurrentFont->width[ch]; source = ((byte *)CurrentFont)+CurrentFont->charofs[ch]; while (width--) { height = ht; while (height--) { pix = *source; if (pix) { pix = *dest; pix = *(shadingtable+pix); *dest = pix; } source++; dest ++; } PrintX++; origdest+=TEXTUREHEIGHT; dest = origdest; } } } //****************************************************************************** // // MenuBufCPrintLine() - Prints a string centered on the current line and // advances to the next line. Newlines are not supported. // //****************************************************************************** void MenuBufCPrintLine (const char *s) { int w, h; USL_MeasureString (s, &w, &h, CurrentFont); if (w > WindowW) Error("MenuBufCPrintLine() - String exceeds width"); PrintX = WindowX + ((WindowW - w) / 2); DrawMenuBufPropString (PrintX, PrintY, s); PrintY += h; } //****************************************************************************** // // MenuBufCPrint() - Prints a string in the current window. Newlines are // supported. // //****************************************************************************** void MenuBufCPrint (const char *string) { char c, *se, *s; /* !!! FIXME: this is lame. */ if (strlen(string) >= sizeof (strbuf)) { fprintf(stderr, "buffer overflow!\n"); return; } /* prevent writing to literal strings... ( MenubufCPrint("feh"); ) */ strcpy(strbuf, string); s = strbuf; while (*s) { se = s; while ((c = *se) && (c != '\n')) se++; *se = '\0'; MenuBufCPrintLine(s); s = se; if (c) { *se = c; s++; } } } //****************************************************************************** // // MenuBufPrintLine() - Prints a string on the current line and // advances to the next line. Newlines are not supported. // //****************************************************************************** void MenuBufPrintLine (const char *s) { int w, h; USL_MeasureString (s, &w, &h, CurrentFont); if (w > WindowW) Error("MenuBufCPrintLine() - String exceeds width"); PrintX = WindowX; DrawMenuBufPropString (PrintX, PrintY, s); PrintY += h; } //****************************************************************************** // // MenuBufPrint() - Prints a string in the current window. Newlines are // supported. // //****************************************************************************** void MenuBufPrint (const char *string) { char c, *se, *s; strcpy(strbuf, string); s = strbuf; while (*s) { se = s; while ((c = *se) && (c != '\n')) se++; *se = '\0'; MenuBufPrintLine(s); s = se; if (c) { *se = c; s++; } } } //****************************************************************************** // // MenuTBufPrintLine() - Prints a string on the current line and // advances to the next line. Newlines are not supported. // //****************************************************************************** void MenuTBufPrintLine (const char *s, int shade) { int w, h; USL_MeasureString (s, &w, &h, CurrentFont); if (w > WindowW) Error("MenuBufCPrintLine() - String exceeds width"); PrintX = WindowX; StringShade=shade; DrawTMenuBufPropString (PrintX, PrintY, s); PrintY += h; } //****************************************************************************** // // FlipMenuBuf // //****************************************************************************** void FlipMenuBuf ( void ) { int i; int dh; int h; int y; int dy; int time; int flip; if (MenuBufStarted==false) Error("Called FlipMenuBuf without menubuf started\n"); if (!readytoflip) Error("FlipMenuBuf called without SetAlternateMenuBuf beforehand"); readytoflip=0; if (Menuflipspeed<=5) { menubuf=menubuffers[alternatemenubuf]; strcpy(titlestring,menutitles[alternatemenubuf]); RefreshMenuBuf(0); } else { menubuf=menubuffers[alternatemenubuf^1]; strcpy(titlestring,menutitles[alternatemenubuf^1]); time=Menuflipspeed-5; dh=(1024<<8)/time; h=0; dy=((MENUTITLEY*6)<<8)/time; y=0; flip=0; titleyoffset=0; for (i=0;i>8,NORMALVIEW,true); h+=dh*tics; y+=dy*tics; titleyoffset=y>>8; if ((h>=512<<8) && (flip==0)) { MN_PlayMenuSnd (SD_MENUFLIP); h=1536<<8; dy=-dy; menubuf=menubuffers[alternatemenubuf]; strcpy(titlestring,menutitles[alternatemenubuf]); flip=1; } } } titleyoffset=0; BackgroundDrawn=false; } //****************************************************************************** // // RotatePlane // //****************************************************************************** void RotatePlane ( void ) { SetupMenuBuf(); while (!(Keyboard[0x01])) { RefreshMenuBuf(100); SetAlternateMenuBuf(); ClearMenuBuf(); DrawMenuBufPic (0,0,W_GetNumForName("newg11")); DrawMenuBufItem (0,0,W_GetNumForName("apogee")); FlipMenuBuf(); EraseMenuBufRegion(30,30,30,30); RefreshMenuBuf(100); SetAlternateMenuBuf(); ClearMenuBuf(); FlipMenuBuf(); } ShutdownMenuBuf(); } rott-20230810/rott/rt_build.h000066400000000000000000000044621446517470200157300ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_build_public #define _rt_build_public //*************************************************************************** // // RT_BUILD.C // //*************************************************************************** extern int Menuflipspeed; extern byte * intensitytable; void SetupMenuBuf ( void ); void ShutdownMenuBuf ( void ); void ClearMenuBuf ( void ); void SetAlternateMenuBuf ( void ); void SetMenuTitle ( const char * menutitle ); void PositionMenuBuf( int angle, int distance, boolean drawbackground ); void RefreshMenuBuf( int time ); void FlipMenuBuf ( void ); void DrawMenuBufItem (int x, int y, int shapenum); void DrawMenuBufIString (int px, int py, const char *string, int color); void DrawTMenuBufItem (int x, int y, int shapenum); void DrawIMenuBufItem (int x, int y, int shapenum, int color); void DrawColoredMenuBufItem (int x, int y, int shapenum, int color); void DrawMenuBufPic (int x, int y, int shapenum); void DrawTMenuBufPic (int x, int y, int shapenum); void EraseMenuBufRegion (int x, int y, int width, int height); void DrawMenuBufPropString (int px, int py, const char *string); void DrawTMenuBufPropString (int px, int py, const char *string); void DrawTMenuBufBox (int x, int y, int width, int height); void DrawTMenuBufHLine (int x, int y, int width, boolean up); void DrawTMenuBufVLine (int x, int y, int height, boolean up); void MenuBufCPrintLine (const char *s); void MenuBufCPrint (const char *s); void MenuBufPrint (const char *s); void MenuTBufPrintLine (const char *s, int shade); void DrawMenuBufPicture (int x, int y, const byte * pic, int w, int h); #endif rott-20230810/rott/rt_cfg.c000066400000000000000000001675711446517470200153760ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //**************************************************************************** // // RT_CFG.C // //**************************************************************************** #include #include #include #include #include #include #include #include "rt_def.h" #include "rt_cfg.h" #include "version.h" #include "scriplib.h" #include "rt_playr.h" #include "rt_menu.h" #include "rt_game.h" #include "rt_in.h" #include "z_zone.h" #include "w_wad.h" #include "rt_crc.h" #include "rt_sound.h" #include "rt_util.h" #include "rt_main.h" #include "rt_view.h" #include "rt_msg.h" #include "rt_battl.h" #include "rt_net.h" #include "isr.h" #include "fx_man.h" #include "develop.h" //****************************************************************************** // // GLOBALS // //****************************************************************************** extern int G_weaponscale; extern boolean iG_aimCross; boolean WriteSoundFile = true; int FXMode = 0; int MusicMode = 0; int MUvolume = 196; int FXvolume = 196; boolean mouseenabled = 1; boolean usemouselook = 0; int inverse_mouse = 1; //set to -1 to invert mouse boolean sdl_fullscreen = 1; boolean joystickenabled = 0; boolean joypadenabled = 0; int joystickport = 0; int mouseadjustment = 5; int threshold = 1; int NumVoices = 4; int NumChannels = 1; int NumBits = 8; boolean AutoDetailOn = true; int DoubleClickSpeed = 20; boolean BobbinOn = true; int Menuflipspeed = 15; int DetailLevel = 2; //HI DETAIL int fandc = 1; int blanktime = (2*60*VBLCOUNTER); boolean ConfigLoaded = false; boolean stereoreversed = false; int DefaultDifficulty = 2; int DefaultPlayerCharacter = 0; int DefaultPlayerColor = 0; byte passwordstring[20]; MacroList CommbatMacros[MAXMACROS]; char *ApogeePath; //****************************************************************************** // // LOCALS // //****************************************************************************** static char SoundName[13] = "sound.rot"; static char *ConfigName = "config.rot"; static char *ScoresName = "scores.rot"; static char *ROTT = "rott.rot"; static char *CONFIG = "setup.rot"; static char *BattleName = "battle.rot"; AlternateInformation RemoteSounds; //AlternateInformation PlayerGraphics; AlternateInformation GameLevels; AlternateInformation BattleLevels; char CodeName[MAXCODENAMELENGTH]; //****************************************************************************** // // ReadScores () // //****************************************************************************** void ReadScores (void) { int file; char *filename; filename = M_StringJoin(ApogeePath, PATH_SEP_STR, ScoresName, NULL); if (access (filename, F_OK) == 0) { file = SafeOpenRead (filename); SafeRead (file, &Scores, sizeof (Scores)); close(file); } else gamestate.violence = 0; free(filename); } //****************************************************************************** // // ReadInt // //****************************************************************************** void ReadInt (const char * s1, int * val) { GetToken (true); if (!strcmpi (token,s1)) { if (TokenAvailable()==true) { GetToken(false); *val=ParseNum(token); } } } //****************************************************************************** // // ReadBoolean // //****************************************************************************** void ReadBoolean (const char * s1, boolean * val) { int temp; temp = (int)(*val); ReadInt (s1,&temp); *val = (boolean) temp; } //****************************************************************************** // // ReadUnsigned // //****************************************************************************** void ReadUnsigned (const char * s1, unsigned long * val) { int temp; temp = (int)(*val); ReadInt (s1,&temp); *val = (unsigned) temp; } //****************************************************************************** // // ParseSoundFile () // //****************************************************************************** boolean ParseSoundFile (void) { boolean retval = true; int version = 0; ReadInt("Version",&version); if (version == ROTTVERSION) { // Read in Music Mode ReadInt ("MusicMode",&MusicMode); // Read in FX Mode ReadInt ("FXMode",&FXMode); // Read in Music Volume ReadInt ("MusicVolume", &MUvolume); // Read in FX Volume ReadInt ("FXVolume", &FXvolume); // Read in numvoices ReadInt ("NumVoices",&NumVoices); // Read in numchannels ReadInt ("NumChannels",&NumChannels); // Read in numbits ReadInt ("NumBits",&NumBits); // Read in stereo reversal ReadBoolean ("StereoReverse",&stereoreversed); } else retval = false; return (retval); } //****************************************************************************** // // SetSoundDefaultValues () // //****************************************************************************** void SetSoundDefaultValues ( void ) { // // no config file, so select default values // // icculus' SDL_mixer driver looks like a soundscape to us MusicMode = 6; FXMode = 6; NumVoices = 8; NumChannels = 2; NumBits = 16; stereoreversed = false; } extern char pword[ 13 ]; //****************************************************************************** // // ConvertStringToPasswordString () // //****************************************************************************** #define PASSWORDENCRYPTER "7d7e4a2d3b6a0319554654231f6d2a" void ConvertStringToPasswordString ( char * string ) { int i; unsigned int j; char temp[3]; memset(temp,0,sizeof(temp)); for (i=0;i<13;i++) { memcpy(&temp[0],&string[i<<1],2); sscanf(&temp[0],"%x",&j); passwordstring[i+0] = j & 0xff; j >>= 8; passwordstring[i+1] = j & 0xff; j >>= 8; passwordstring[i+2] = j & 0xff; j >>= 8; passwordstring[i+3] = j & 0xff; } } //****************************************************************************** // // ConvertPasswordStringToPassword () // //****************************************************************************** void ConvertPasswordStringToPassword ( void ) { int i; int x; char temp[3]; char key[40]; memset(temp,0,sizeof(temp)); strcpy(&key[0],PASSWORDENCRYPTER); for (i=0;i<12;i++) { memcpy(&temp[0],&key[i<<1],2); sscanf(&temp[0],"%x",&x); pword[i]=passwordstring[i]^x; } memcpy(&temp[0],&key[i<<1],2); sscanf(&temp[0],"%x",&x); gamestate.violence=passwordstring[i]^x; if ( (gamestate.violence<0) || (gamestate.violence>3) ) gamestate.violence=0; } //****************************************************************************** // // ConvertPasswordStringToString () // //****************************************************************************** void ConvertPasswordStringToString ( char * string ) { int i; char temp[8]; memset(temp,0,sizeof(temp)); for (i=0;i<13;i++) { itoa((passwordstring[i]>>4),&temp[0],16); string[(i<<1)+0]=temp[0]; itoa((passwordstring[i]&0xf),&temp[0],16); string[(i<<1)+1]=temp[0]; } } //****************************************************************************** // // ConvertPasswordToPasswordString () // //****************************************************************************** void ConvertPasswordToPasswordString ( void ) { int i; int x; char temp[3]; char key[40]; memset(temp,0,sizeof(temp)); strcpy(&key[0],PASSWORDENCRYPTER); for (i=0;i<12;i++) { memcpy(&temp[0],&key[i<<1],2); sscanf(&temp[0],"%x",&x); passwordstring[i]=pword[i]^x; } memcpy(&temp[0],&key[i<<1],2); sscanf(&temp[0],"%x",&x); passwordstring[i]=gamestate.violence^x; } //****************************************************************************** // // ParseConfigFile () // //****************************************************************************** boolean ParseConfigFile (void) { // int temp; boolean retval = true; int version = 0; ReadInt("Version",&version); if (version == ROTTVERSION) { // Read in MouseEnabled ReadBoolean("MouseEnabled",&mouseenabled); // Read in UseMouseLook ReadBoolean("UseMouseLook",&usemouselook); ReadInt("InverseMouse",&inverse_mouse); // Read in CrossHair ReadBoolean("CrossHair",&iG_aimCross); // Read in JoystickEnabled ReadBoolean("JoystickEnabled",&joystickenabled); // Read in JoypadEnabled ReadBoolean("JoypadEnabled",&joypadenabled); // Read in JoystickPort ReadInt("JoystickPort",&joystickport); // Read in fullscreen ReadBoolean("FullScreen", &sdl_fullscreen); // Read in resolution ReadInt("ScreenWidth", &iGLOBAL_SCREENWIDTH); ReadInt("ScreenHeight", &iGLOBAL_SCREENHEIGHT); // Read in ViewSize ReadInt("ViewSize",&viewsize); // Read in Weaponscale ReadInt("Weaponscale",&G_weaponscale);//bna added if ((G_weaponscale <150)||(G_weaponscale>600)){ if (iGLOBAL_SCREENWIDTH == 320){ G_weaponscale=168; }else if (iGLOBAL_SCREENWIDTH == 640){ G_weaponscale=299; } } // Read in MouseAdjustment ReadInt("MouseAdjustment",&mouseadjustment); // Read in threshold ReadInt("Threshold",&threshold); // Read in Auto Detail ReadBoolean ("AutoDetail", &AutoDetailOn); // Read in Light Dim ReadInt ("LightDim", &fulllight); // Read in Bobbin' On ReadBoolean ("BobbingOn", &BobbinOn); // Read in Double Click Speed ReadInt ("DoubleClickSpeed", &DoubleClickSpeed); // Read in Menu Flip Speed ReadInt ("MenuFlipSpeed", &Menuflipspeed); // Read in Detail Level ReadInt ("DetailLevel", &DetailLevel); // Read in Floor and Ceiling ReadInt ("FloorCeiling", &fandc); // Read in MessagesEnabled ReadBoolean ("Messages", &MessagesEnabled ); // Read in Autorun ReadInt ("AutoRun", &gamestate.autorun ); // Read in GammaIndex ReadInt ("GammaIndex", &gammaindex); // Read screen blanking time ReadInt ("BlankTime", &blanktime); blanktime=blanktime*60*VBLCOUNTER; // Read keys ReadInt ("Fire", &buttonscan[0]); ReadInt ("Strafe", &buttonscan[1]); ReadInt ("Run", &buttonscan[2]); ReadInt ("Use", &buttonscan[3]); ReadInt ("LookUp", &buttonscan[4]); ReadInt ("LookDn", &buttonscan[5]); ReadInt ("Swap", &buttonscan[6]); ReadInt ("Drop", &buttonscan[7]); ReadInt ("TargetUp", &buttonscan[8]); ReadInt ("TargetDn", &buttonscan[9]); ReadInt ("SelPistol", &buttonscan[10]); ReadInt ("SelDualPistol",&buttonscan[11]); ReadInt ("SelMP40", &buttonscan[12]); ReadInt ("SelMissile", &buttonscan[13]); ReadInt ("AutoRun", &buttonscan[14]); ReadInt ("LiveRemRid", &buttonscan[15]); ReadInt ("StrafeLeft", &buttonscan[16]); ReadInt ("StrafeRight", &buttonscan[17]); ReadInt ("VolteFace", &buttonscan[18]); ReadInt ("Aim", &buttonscan[19]); ReadInt ("Forward", &buttonscan[20]); ReadInt ("Right", &buttonscan[21]); ReadInt ("Backward", &buttonscan[22]); ReadInt ("Left", &buttonscan[23]); ReadInt ("Map", &buttonscan[24]); ReadInt ("SendMessage", &buttonscan[25]); ReadInt ("DirectMessage",&buttonscan[26]); ReadInt ("MouseButton0",&buttonmouse[0]); ReadInt ("MouseButton1",&buttonmouse[1]); ReadInt ("MouseButton2",&buttonmouse[2]); ReadInt ("DblClickB0", &buttonmouse[3]); ReadInt ("DblClickB1", &buttonmouse[4]); ReadInt ("DblClickB2", &buttonmouse[5]); ReadInt ("JoyButton0", &buttonjoy[0]); ReadInt ("JoyButton1", &buttonjoy[1]); ReadInt ("JoyButton2", &buttonjoy[2]); ReadInt ("JoyButton3", &buttonjoy[3]); ReadInt ("DblClickJB0", &buttonjoy[4]); ReadInt ("DblClickJB1", &buttonjoy[5]); ReadInt ("DblClickJB2", &buttonjoy[6]); ReadInt ("DblClickJB3", &buttonjoy[7]); ReadInt ("JoyMaxX", &joyxmax); ReadInt ("JoyMaxY", &joyymax); ReadInt ("JoyMinX", &joyxmin); ReadInt ("JoyMinY", &joyymin); ReadInt( "DefaultDifficulty", &DefaultDifficulty ); ReadInt( "DefaultPlayerCharacter", &DefaultPlayerCharacter ); ReadInt( "DefaultPlayerColor", &DefaultPlayerColor ); // Get Password string GetToken (true); if (!stricmp (token, "SecretPassword")) { GetTokenEOL (false); ConvertStringToPasswordString ( &name[0] ); } if (!MousePresent) mouseenabled = false; if (!JoysPresent[joystickport]) joystickenabled = false; // precaution if (!joyxmin || !joyxmax || !joyymin || !joyymax) joystickenabled = false; if (joystickenabled) IN_SetupJoy (joystickport, joyxmin, joyxmax, joyymin, joyymax); } else retval = false; return (retval); } //****************************************************************************** // // ParseBattleFile () // //****************************************************************************** boolean ParseBattleFile (void) { boolean retval = true; int version = 0; int index; int temp; extern specials BattleSpecialsTimes; ReadInt("Version",&version); if (version != ROTTVERSION) retval = false; else { ReadBoolean( "ShowKillCount", &BATTLE_ShowKillCount ); ReadInt( "GodModeTime", &BattleSpecialsTimes.GodModeTime ); ReadInt( "DogModeTime", &BattleSpecialsTimes.DogModeTime ); ReadInt( "ShroomsModeTime", &BattleSpecialsTimes.ShroomsModeTime ); ReadInt( "ElastoModeTime", &BattleSpecialsTimes.ElastoModeTime ); ReadInt( "AsbestosVestTime", &BattleSpecialsTimes.AsbestosVestTime ); ReadInt( "BulletProofVestTime", &BattleSpecialsTimes.BulletProofVestTime ); ReadInt( "GasMaskTime", &BattleSpecialsTimes.GasMaskTime ); ReadInt( "MercuryModeTime", &BattleSpecialsTimes.MercuryModeTime ); ReadInt( "GodModeRespawnTime", &BattleSpecialsTimes.GodModeRespawnTime ); ReadInt( "DogModeRespawnTime", &BattleSpecialsTimes.DogModeRespawnTime ); ReadInt( "ShroomsModeRespawnTime", &BattleSpecialsTimes.ShroomsModeRespawnTime ); ReadInt( "ElastoModeRespawnTime", &BattleSpecialsTimes.ElastoModeRespawnTime ); ReadInt( "AsbestosVestRespawnTime", &BattleSpecialsTimes.AsbestosVestRespawnTime ); ReadInt( "BulletProofVestRespawnTime", &BattleSpecialsTimes.BulletProofVestRespawnTime ); ReadInt( "GasMaskRespawnTime", &BattleSpecialsTimes.GasMaskRespawnTime ); ReadInt( "MercuryModeRespawnTime", &BattleSpecialsTimes.MercuryModeRespawnTime ); ReadBoolean( "EKG", &battlegibs ); for( index = battle_Normal; index < battle_NumBattleModes; index++ ) { // Read Gravity temp = BATTLE_Options[ index ].Gravity; ReadInt( "Gravity", &temp ); BATTLE_Options[ index ].Gravity = temp; // Read Speed temp = bo_normal_speed; ReadInt( "Speed", &temp ); if ( ( temp >= bo_normal_speed ) && ( temp <= bo_fast_speed ) ) { BATTLE_Options[ index ].Speed = temp; } if ( ( index != battle_Collector ) && ( index != battle_Tag ) && ( index != battle_Eluder ) ) { // Read Ammo temp = bo_normal_shots; BATTLE_Options[ index ].Ammo = bo_normal_shots; ReadInt( "Ammo", &temp ); if ( ( temp >= bo_one_shot ) && ( temp <= bo_infinite_shots ) ) { BATTLE_Options[ index ].Ammo = temp; } } if ( index != battle_Eluder ) { // Read Hitpoints temp = BATTLE_Options[ index ].HitPoints; ReadInt( "Hitpoints", &temp ); BATTLE_Options[ index ].HitPoints = temp; } // Read Spawn Dangers temp = 1; ReadInt( "SpawnDangers", &temp ); BATTLE_Options[ index ].SpawnDangers = temp; if ( index != battle_Eluder ) { // Read Spawn Health temp = 1; ReadInt( "SpawnHealth", &temp ); BATTLE_Options[ index ].SpawnHealth = temp; // Read Spawn Mines temp = 0; ReadInt( "SpawnMines", &temp ); BATTLE_Options[ index ].SpawnMines = temp; } if ( ( index != battle_Collector ) && ( index != battle_Tag ) && ( index != battle_Eluder ) ) { // Read Spawn Weapons temp = 1; ReadInt( "SpawnWeapons", &temp ); BATTLE_Options[ index ].SpawnWeapons = temp; // Read Random Weapons temp = 0; ReadInt( "RandomWeapons", &temp ); BATTLE_Options[ index ].RandomWeapons = temp; // Read Weapon Persistence temp = 0; ReadInt( "WeaponPersistence", &temp ); BATTLE_Options[ index ].WeaponPersistence = temp; } if ( ( index == battle_Normal ) || ( index == battle_ScoreMore ) || ( index == battle_Hunter ) || ( index == battle_Tag ) ) { // Read Friendly Fire temp = 1; ReadInt( "FriendlyFire", &temp ); BATTLE_Options[ index ].FriendlyFire = temp; } if ( index != battle_Eluder ) { // Read Respawn Items temp = 1; ReadInt( "RespawnItems", &temp ); BATTLE_Options[ index ].RespawnItems = temp; } // Read Light Level temp = bo_light_normal; ReadInt( "LightLevel", &temp ); if ( ( temp >= bo_light_dark ) && ( temp <= bo_light_lightning ) ) { BATTLE_Options[ index ].LightLevel = temp; } if ( ( index != battle_Collector ) && ( index != battle_Scavenger ) ) { // Read Point Goal temp = bo_kills_default; ReadInt( "PointGoal", &temp ); BATTLE_Options[ index ].Kills = temp; if ( temp < bo_kills_random ) { BATTLE_Options[ index ].Kills = bo_kills_default; } } if ( index != battle_Eluder ) { // Read Danger Damage temp = bo_danger_normal; ReadInt( "DangerDamage", &temp ); BATTLE_Options[ index ].DangerDamage = temp; } // Read Time Limit temp = bo_time_infinite; ReadInt( "TimeLimit", &temp ); if ( ( index == battle_Hunter ) && ( temp == bo_time_infinite ) ) { temp = 99; } BATTLE_Options[ index ].TimeLimit = temp; // Read Respawn time temp = bo_normal_respawn_time; ReadInt( "RespawnTime", &temp ); BATTLE_Options[ index ].RespawnTime = temp; } } return (retval); } //****************************************************************************** // // SetBattleDefaultValues () // //****************************************************************************** void SetBattleDefaultValues (void) { int index; // // no config file, so select default values // for( index = battle_StandAloneGame; index < battle_NumBattleModes; index++ ) { BATTLE_Options[ index ].Gravity = NORMAL_GRAVITY; BATTLE_Options[ index ].Speed = bo_normal_speed; BATTLE_Options[ index ].Ammo = bo_normal_shots; BATTLE_Options[ index ].HitPoints = bo_default_hitpoints; BATTLE_Options[ index ].SpawnDangers = 1; BATTLE_Options[ index ].SpawnHealth = 1; BATTLE_Options[ index ].SpawnMines = 0; BATTLE_Options[ index ].SpawnWeapons = 1; BATTLE_Options[ index ].RespawnItems = 1; BATTLE_Options[ index ].RandomWeapons = 0; BATTLE_Options[ index ].WeaponPersistence = 0; BATTLE_Options[ index ].FriendlyFire = 1; BATTLE_Options[ index ].LightLevel = bo_light_normal; BATTLE_Options[ index ].Kills = bo_kills_default; BATTLE_Options[ index ].DangerDamage = bo_danger_normal; BATTLE_Options[ index ].TimeLimit = bo_time_infinite; BATTLE_Options[ index ].RespawnTime = bo_normal_respawn_time; } BATTLE_Options[ battle_CaptureTheTriad ].Kills = 1; BATTLE_Options[ battle_Hunter ].TimeLimit = 1; BATTLE_Options[ battle_Eluder ].SpawnHealth = 0; BATTLE_Options[ battle_Eluder ].RespawnItems = 0; BATTLE_Options[ battle_Eluder ].SpawnWeapons = 0; BATTLE_Options[ battle_Eluder ].FriendlyFire = 0; BATTLE_Options[ battle_Collector ].SpawnWeapons = 0; BATTLE_Options[ battle_Collector ].FriendlyFire = 0; BATTLE_Options[ battle_Tag ].SpawnWeapons = 0; battlegibs=false; BATTLE_ShowKillCount = true; } //****************************************************************************** // // SetConfigDefaultValues () // //****************************************************************************** void SetConfigDefaultValues (void) { // // no config file, so select default values // if (MousePresent) mouseenabled = true; joystickenabled = false; joypadenabled = false; joystickport = 0; viewsize = 7; mouseadjustment = 5; gammaindex = 0; gamestate.violence = 3; passwordstring[0]=0x7d; passwordstring[1]=0x7e; passwordstring[2]=0x4a; passwordstring[3]=0x2d; passwordstring[4]=0x3b; passwordstring[5]=0x6a; passwordstring[6]=0x03; passwordstring[7]=0x19; passwordstring[8]=0x55; passwordstring[9]=0x46; passwordstring[10]=0x54; passwordstring[11]=0x23; passwordstring[12]=0x1c; } //****************************************************************************** // // DeleteSoundFile () // //****************************************************************************** void DeleteSoundFile ( void ) { char *filename; filename = M_StringJoin(ApogeePath, PATH_SEP_STR, SoundName, NULL); unlink (filename); // Delete SOUND.ROT free(filename); } //****************************************************************************** // // ReadConfig () // //****************************************************************************** void ReadConfig (void) { char *filename; filename = M_StringJoin(ApogeePath, PATH_SEP_STR, SoundName, NULL); SetSoundDefaultValues (); if (access (filename, F_OK) == 0) { LoadScriptFile (filename); if (ParseSoundFile () == false) { DeleteSoundFile(); } Z_Free (scriptbuffer); } ReadScores(); free(filename); filename = M_StringJoin(ApogeePath, PATH_SEP_STR, ConfigName, NULL); SetConfigDefaultValues (); if (access(filename,F_OK)==0) { LoadScriptFile(filename); if (ParseConfigFile () == false) { unlink (filename); // Delete CONFIG.ROT } Z_Free(scriptbuffer); } free(filename); filename = M_StringJoin(ApogeePath, PATH_SEP_STR, BattleName, NULL); SetBattleDefaultValues (); if (access(filename,F_OK)==0) { LoadScriptFile(filename); if (ParseBattleFile() == false) { unlink (filename); // Delete BATTLE.ROT } Z_Free(scriptbuffer); } ConfigLoaded = true; free(filename); } //****************************************************************************** // // CheckVendor () // //****************************************************************************** #if (SHAREWARE==1) #define VENDORDOC ("VENDOR.DOC") #define VENDORLUMP ("VENDOR") #else #define VENDORDOC ("LICENSE.DOC") #define VENDORLUMP ("LICENSE") #endif void CheckVendor (void) { boolean saveout=false; int wadcrc; int filecrc; int size; int lump; byte * vendor; char *filename; filename = M_StringJoin(ApogeePath, PATH_SEP_STR, VENDORDOC, NULL); if (access (filename, F_OK) == 0) { size = LoadFile(filename,(void **)&vendor); filecrc = CalculateCRC (vendor, size); SafeFree(vendor); lump=W_GetNumForName(VENDORLUMP); vendor = W_CacheLumpNum(lump,PU_CACHE, CvtNull, 1); size=W_LumpLength(lump); wadcrc = CalculateCRC (vendor, size); if (wadcrc != filecrc) saveout=true; } else saveout=true; if (saveout==true) { lump=W_GetNumForName(VENDORLUMP); vendor = W_CacheLumpNum(lump,PU_CACHE, CvtNull, 1); size = W_LumpLength(lump); SaveFile (filename,vendor,size); } free(filename); } //****************************************************************************** // // WriteParameter // //****************************************************************************** void WriteParameter (int file, const char * s1, int val) { char s[50]; // Write out Header SafeWriteString (file, (char *)s1); // Write out space character strcpy (&s[0],(const char *)" "); SafeWriteString (file, &s[0]); // Write out value itoa(val,&s[0],10); SafeWriteString (file, &s[0]); // Write out EOL character strcpy (&s[0],(const char *)"\n"); SafeWriteString (file, &s[0]); } //****************************************************************************** // // WriteParameterHex // //****************************************************************************** void WriteParameterHex (int file, const char * s1, int val) { char s[50]; // Write out Header SafeWriteString (file, (char *)s1); // Write out space character strcpy (&s[0],(const char *)" $"); SafeWriteString (file, &s[0]); // Write out value itoa(val,&s[0],16); SafeWriteString (file, &s[0]); // Write out EOL character strcpy (&s[0],(const char *)"\n"); SafeWriteString (file, &s[0]); } //****************************************************************************** // // WriteScores () // //****************************************************************************** void WriteScores (void) { int file; char *filename; filename = M_StringJoin(ApogeePath, PATH_SEP_STR, ScoresName, NULL); file=SafeOpenWrite( filename ); SafeWrite (file, &Scores, sizeof (Scores)); close(file); free(filename); } //****************************************************************************** // // WriteBattleConfig () // //****************************************************************************** void WriteBattleConfig ( void ) { int file; int index; char *filename; extern specials BattleSpecialsTimes; // Write Battle File filename = M_StringJoin(ApogeePath, PATH_SEP_STR, BattleName, NULL); file = open( filename, O_RDWR | O_TEXT | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE ); if ( file == -1 ) { Error( "Error opening %s: %s", filename, strerror( errno ) ); } free(filename); // Write out BATTLECONFIG header SafeWriteString( file, ";Rise of the Triad Battle Configuration File\n" "; (c) 1995\n" ";\n" ";You may change these options at you own risk. Using any values\n" ";other than the ones documented may make the game unplayable.\n" ";If this happens, you may delete this file (BATTLE.ROT) and ROTT\n" ";will recreate it with the default values selected.\n" ";\n" ";With that in mind, have fun!\n" ";\n" "\n" ); // Write out Version WriteParameter( file, "Version ", ROTTVERSION ); // Write out BATTLE_ShowKillPics SafeWriteString(file, "\n;\n"); WriteParameter( file, "; Yes - ", 1 ); WriteParameter( file, "; No - ", 0 ); WriteParameter( file, "ShowKillCount ", BATTLE_ShowKillCount ); // Write out specials' times SafeWriteString(file, "\n;\n" "; These are the time in seconds of the various powerups.\n" "; You could modify these to give you infinite Mercury mode,\n" "; stronger vests, or to make them persistent.\n;\n" ); WriteParameter( file, "GodModeTime ", BattleSpecialsTimes.GodModeTime ); WriteParameter( file, "DogModeTime ", BattleSpecialsTimes.DogModeTime ); WriteParameter( file, "ShroomsModeTime ", BattleSpecialsTimes.ShroomsModeTime ); WriteParameter( file, "ElastoModeTime ", BattleSpecialsTimes.ElastoModeTime ); WriteParameter( file, "AsbestosVestTime ", BattleSpecialsTimes.AsbestosVestTime ); WriteParameter( file, "BulletProofVestTime ", BattleSpecialsTimes.BulletProofVestTime ); WriteParameter( file, "GasMaskTime ", BattleSpecialsTimes.GasMaskTime ); WriteParameter( file, "MercuryModeTime ", BattleSpecialsTimes.MercuryModeTime ); WriteParameter( file, "GodModeRespawnTime ", BattleSpecialsTimes.GodModeRespawnTime ); WriteParameter( file, "DogModeRespawnTime ", BattleSpecialsTimes.DogModeRespawnTime ); WriteParameter( file, "ShroomsModeRespawnTime ", BattleSpecialsTimes.ShroomsModeRespawnTime ); WriteParameter( file, "ElastoModeRespawnTime ", BattleSpecialsTimes.ElastoModeRespawnTime ); WriteParameter( file, "AsbestosVestRespawnTime ", BattleSpecialsTimes.AsbestosVestRespawnTime ); WriteParameter( file, "BulletProofVestRespawnTime ", BattleSpecialsTimes.BulletProofVestRespawnTime ); WriteParameter( file, "GasMaskRespawnTime ", BattleSpecialsTimes.GasMaskRespawnTime ); WriteParameter( file, "MercuryModeRespawnTime ", BattleSpecialsTimes.MercuryModeRespawnTime ); // Write out battlegibs SafeWriteString(file, "\n;\n"); WriteParameter( file, "; Yes - ", 1 ); WriteParameter( file, "; No - ", 0 ); WriteParameter( file, "EKG ", battlegibs ); // Describe options // Write out Gravity SafeWriteString(file, "\n" ";\n" "; Here is a description of the possible values for" " each option:\n" ";\n" "; Gravity options:\n" ); WriteParameter( file, "; Low Gravity - ", LOW_GRAVITY ); WriteParameter( file, "; Normal Gravity - ", NORMAL_GRAVITY ); WriteParameter( file, "; High Gravity - ", HIGH_GRAVITY ); // Write out Speed SafeWriteString(file, ";\n" "; Speed options:\n" ); WriteParameter( file, "; Normal Speed - ", bo_normal_speed ); WriteParameter( file, "; Fast Speed - ", bo_fast_speed ); // Write out Ammo SafeWriteString(file, ";\n" "; Ammo options:\n" ); WriteParameter( file, "; One Shot - ", bo_one_shot ); WriteParameter( file, "; Normal Shots - ", bo_normal_shots ); WriteParameter( file, "; Infinite Shots - ", bo_infinite_shots ); // Write out Hit Points SafeWriteString(file, ";\n" "; Hitpoint options:\n" ); WriteParameter( file, "; Character Hitpoints - ", bo_character_hitpoints ); WriteParameter( file, "; 1 Hitpoint - ", 1 ); WriteParameter( file, "; 25 Hitpoints - ", 25 ); WriteParameter( file, "; 100 Hitpoints - ", 100 ); WriteParameter( file, "; 500 Hitpoints - ", 500 ); WriteParameter( file, "; 250 Hitpoints - ", 250 ); WriteParameter( file, "; 4000 Hitpoints - ", 4000 ); // Write out Danger Spawning SafeWriteString(file, ";\n" "; SpawnDangers options:\n" "; Spawn Dangers - 1\n" "; Don't Spawn Dangers - 0\n" ); // Write out Health Spawning SafeWriteString(file, ";\n" "; SpawnHealth options:\n" "; Spawn Health - 1\n" "; Don't Spawn Health - 0\n" ); // Write out Mine Spawning SafeWriteString(file, ";\n" "; SpawnMines options:\n" "; Spawn Mines - 1\n" "; Don't Spawn Mines - 0\n" ); // Write out Weapon Spawning SafeWriteString(file, ";\n" "; SpawnWeapons options:\n" "; Spawn Weapons - 1\n" "; Don't Spawn Weapons - 0\n" ); // Write out Random Weapons SafeWriteString(file, ";\n" "; RandomWeapons options:\n" "; Randomize Weapons - 1\n" "; Don't Randomize Weapons - 0\n" ); // Write out Weapon Persistence SafeWriteString(file, ";\n" "; WeaponPersistence options:\n" "; Weapons Persist - 1\n" "; Weapons don't Persist - 0\n" ); // Write out Friendly Fire SafeWriteString(file, ";\n" "; FriendlyFire options:\n" "; Penalize Friendly Fire - 1\n" "; No penalty - 0\n" ); // Write out Respawn Items SafeWriteString(file, ";\n" "; RespawnItems options:\n" "; Respawn Items - 1\n" "; Don't Respawn Items - 0\n" ); // Write out Light Level SafeWriteString(file, ";\n" "; LightLevel options:\n" ); WriteParameter( file, "; Dark - ", bo_light_dark ); WriteParameter( file, "; Normal Light Levels - ", bo_light_normal ); WriteParameter( file, "; Bright - ", bo_light_bright ); WriteParameter( file, "; Fog - ", bo_light_fog ); WriteParameter( file, "; Periodic light - ", bo_light_periodic ); WriteParameter( file, "; Lightning - ", bo_light_lightning ); // Write out Point Goal SafeWriteString(file, ";\n" "; PointGoal options:\n" ); WriteParameter( file, "; 1 Point - ", 1 ); WriteParameter( file, "; 5 Points - ", 5 ); WriteParameter( file, "; 11 Points - ", 11 ); WriteParameter( file, "; 21 Points - ", 21 ); WriteParameter( file, "; 50 Points - ", 50 ); WriteParameter( file, "; 100 Points - ", 100 ); WriteParameter( file, "; Random Points - ", bo_kills_random ); WriteParameter( file, "; Blind Points - ", bo_kills_blind ); WriteParameter( file, "; Infinite Points - ", bo_kills_infinite ); // Write out Danger Damage SafeWriteString(file, ";\n" "; DangerDamage options:\n" ); WriteParameter( file, "; Normal Damage - ", bo_danger_normal ); WriteParameter( file, "; Low Damage - ", bo_danger_low ); WriteParameter( file, "; Kill - ", bo_danger_kill ); // Write out TimeLimit SafeWriteString(file, ";\n" "; TimeLimit options:\n" ); WriteParameter( file, "; 1 minute - ", 1 ); WriteParameter( file, "; 2 minute - ", 2 ); WriteParameter( file, "; 5 minutes - ", 5 ); WriteParameter( file, "; 10 minutes - ", 10 ); WriteParameter( file, "; 21 minutes - ", 21 ); WriteParameter( file, "; 30 minutes - ", 30 ); WriteParameter( file, "; 99 minutes - ", 99 ); WriteParameter( file, "; No limit - ", bo_time_infinite ); // Write out RespawnTime SafeWriteString(file, ";\n" "; RespawnTime options:\n" ); WriteParameter( file, "; 1 second - ", 1 ); WriteParameter( file, "; 1 minute - ", 60 ); WriteParameter( file, "; 2 minutes - ", 120 ); WriteParameter( file, "; normal - ", bo_normal_respawn_time ); for( index = battle_Normal; index < battle_NumBattleModes; index++ ) { SafeWriteString(file, "\n;\n"); switch( index ) { case battle_Normal : SafeWriteString( file, "; Standard battle options\n;\n" ); break; case battle_ScoreMore : SafeWriteString( file, "; Score More battle options\n;\n" ); break; case battle_Collector : SafeWriteString( file, "; Collector battle options\n;\n" ); break; case battle_Scavenger : SafeWriteString( file, "; Scavenger battle options\n;\n" ); break; case battle_Hunter : SafeWriteString( file, "; Hunter battle options\n;\n" ); break; case battle_Tag : SafeWriteString( file, "; Tag battle options\n;\n" ); break; case battle_Eluder : SafeWriteString( file, "; Eluder battle options\n;\n" ); break; case battle_Deluder : SafeWriteString( file, "; Deluder battle options\n;\n" ); break; case battle_CaptureTheTriad : SafeWriteString( file, "; Capture the Triad battle options\n;\n" ); break; } // Write out Gravity WriteParameter( file, "Gravity ", BATTLE_Options[ index ].Gravity ); // Write out Speed WriteParameter( file, "Speed ", BATTLE_Options[ index ].Speed ); if ( ( index != battle_Collector ) && ( index != battle_Tag ) && ( index != battle_Eluder ) ) { // Write out Ammo WriteParameter( file, "Ammo ", BATTLE_Options[ index ].Ammo ); } if ( index != battle_Eluder ) { // Write out Hit Points WriteParameter( file, "Hitpoints ", BATTLE_Options[ index ].HitPoints ); } // Write out Danger Spawning WriteParameter( file, "SpawnDangers ", BATTLE_Options[ index ].SpawnDangers ); if ( index != battle_Eluder ) { // Write out Health Spawning WriteParameter( file, "SpawnHealth ", BATTLE_Options[ index ].SpawnHealth ); // Write out Mine Spawning WriteParameter( file, "SpawnMines ", BATTLE_Options[ index ].SpawnMines ); } if ( ( index != battle_Collector ) && ( index != battle_Tag ) && ( index != battle_Eluder ) ) { // Write out Weapon Spawning WriteParameter( file, "SpawnWeapons ", BATTLE_Options[ index ].SpawnWeapons ); // Write out Random Weapons WriteParameter( file, "RandomWeapons ", BATTLE_Options[ index ].RandomWeapons ); // Write out Weapon Persistence WriteParameter( file, "WeaponPersistence", BATTLE_Options[ index ].WeaponPersistence ); } if ( ( index == battle_Normal ) || ( index == battle_ScoreMore ) || ( index == battle_Hunter ) || ( index == battle_Tag ) ) { // Write out Friendly Fire WriteParameter( file, "FriendlyFire ", BATTLE_Options[ index ].FriendlyFire ); } if ( index != battle_Eluder ) { // Write out Respawn Items WriteParameter( file, "RespawnItems ", BATTLE_Options[ index ].RespawnItems ); } // Write out Light Level WriteParameter( file, "LightLevel ", BATTLE_Options[ index ].LightLevel ); if ( ( index != battle_Collector ) && ( index != battle_Scavenger ) ) { // Write out Point Goal WriteParameter( file, "PointGoal ", BATTLE_Options[ index ].Kills ); } if ( index != battle_Eluder ) { // Write out Danger Damage WriteParameter( file, "DangerDamage ", BATTLE_Options[ index ].DangerDamage ); } // Write out TimeLimit WriteParameter( file, "TimeLimit ", BATTLE_Options[ index ].TimeLimit ); // Write out RespawnTime WriteParameter( file, "RespawnTime ", BATTLE_Options[ index ].RespawnTime ); } close( file ); } //****************************************************************************** // // WriteSoundConfig () // //****************************************************************************** void WriteSoundConfig ( void ) { int file; char *filename; if ( !WriteSoundFile ) { return; } filename = M_StringJoin(ApogeePath, PATH_SEP_STR, SoundName, NULL); file = open ( filename, O_RDWR | O_TEXT | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE); if (file == -1) Error ("Error opening %s: %s", filename, strerror(errno)); free(filename); // Write out ROTTSOUND header SafeWriteString (file, ";Rise of the Triad Sound File\n"); SafeWriteString (file, "; (c) 1995\n\n"); // Write out Version WriteParameter(file,"Version ",ROTTVERSION); // Write out Music Mode SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; Music Modes\n"); SafeWriteString(file,"; 0 - Off\n"); SafeWriteString(file,"; 6 - On\n"); WriteParameter(file,"MusicMode ",MusicMode); // Write out FX Mode SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; FX Modes\n"); SafeWriteString(file,"; 0 - Off\n"); SafeWriteString(file,"; 6 - On\n"); WriteParameter(file,"FXMode ",FXMode); // Write in Music Volume SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; Music Volume\n"); SafeWriteString(file,"; (low) 0 - 255 (high)\n"); WriteParameter (file, "MusicVolume ", MUvolume); // Write in FX Volume SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; FX Volume\n"); SafeWriteString(file,"; (low) 0 - 255 (high)\n"); WriteParameter (file, "FXVolume ", FXvolume); // Write out numvoices SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; Number of Voices\n"); SafeWriteString(file,"; 1 - 8\n"); WriteParameter(file,"NumVoices ",NumVoices); // Write out numchannels SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; Stereo or Mono\n"); SafeWriteString(file,"; 1 - Mono\n"); SafeWriteString(file,"; 2 - Stereo\n"); WriteParameter(file,"NumChannels ",NumChannels); // Write out numbits SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; Resolution\n"); SafeWriteString(file,"; 8 bit\n"); SafeWriteString(file,"; 16 bit\n"); WriteParameter(file,"NumBits ",NumBits); // Write out stereo reversal SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; ReverseStereo\n"); SafeWriteString(file,"; 0 no reversal\n"); SafeWriteString(file,"; 1 reverse stereo\n"); WriteParameter (file,"StereoReverse ",stereoreversed); close (file); } //****************************************************************************** // // WriteConfig () // //****************************************************************************** void WriteConfig (void) { int file; char *filename; char passwordtemp[50]; static int inconfig = 0; if (inconfig > 0) return; inconfig++ ; if ( !ConfigLoaded ) { return; } // Write Sound File WriteSoundConfig(); // Write Config, Battle and Score files WriteScores(); WriteBattleConfig(); filename = M_StringJoin(ApogeePath, PATH_SEP_STR, ConfigName, NULL); file = open( filename,O_RDWR | O_TEXT | O_CREAT | O_TRUNC , S_IREAD | S_IWRITE); if (file == -1) Error ("Error opening %s: %s",filename,strerror(errno)); free(filename); // Write out ROTTCONFIG header SafeWriteString (file, ";Rise of the Triad Configuration File\n"); SafeWriteString (file, "; (c) 1995\n\n"); // Write out Version WriteParameter(file,"Version ",ROTTVERSION); // Write out MouseEnabled SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; 1 - Mouse Enabled\n"); SafeWriteString(file,"; 0 - Mouse Disabled\n"); WriteParameter(file,"MouseEnabled ",mouseenabled); // Write out UseMouseLook SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; 1 - UseMouseLook Enabled\n"); SafeWriteString(file,"; 0 - UseMouseLook Disabled\n"); WriteParameter(file,"UseMouseLook ",usemouselook); // Write out InverseMouse SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; 1 - Normal Mouse Enabled\n"); SafeWriteString(file,"; -1 - Inverse Mouse Enabled\n"); WriteParameter(file,"InverseMouse ",inverse_mouse); // Write out CrossHair SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; 1 - CrossHair Enabled\n"); SafeWriteString(file,"; 0 - CrossHair Disabled\n"); WriteParameter(file,"CrossHair ", iG_aimCross); // Write out JoystickEnabled SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; 1 - Joystick Enabled\n"); SafeWriteString(file,"; 0 - Joystick Disabled\n"); WriteParameter(file,"JoystickEnabled ",joystickenabled); // Write out JoypadEnabled SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; 1 - Joypad Enabled\n"); SafeWriteString(file,"; 0 - Joypad Disabled\n"); WriteParameter(file,"JoypadEnabled ",joypadenabled); // Write out JoystickPort SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; 0 - Use Joystick Port 1\n"); SafeWriteString(file,"; 1 - Use Joystick Port 2\n"); WriteParameter(file,"JoystickPort ",joystickport); // Write out fullscreen SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; 0 - Start in windowed mode\n"); SafeWriteString(file,"; 1 - Start in fullscreen mode\n"); WriteParameter(file,"FullScreen ",sdl_fullscreen); // Write out resolution SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; Screen Resolution, supported resolutions: \n"); SafeWriteString(file,"; 320x200 and 640x480\n"); WriteParameter(file,"ScreenWidth ",iGLOBAL_SCREENWIDTH); WriteParameter(file,"ScreenHeight ",iGLOBAL_SCREENHEIGHT); // Write out ViewSize SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; Size of View port.\n"); SafeWriteString(file,"; (smallest) 0 - 10 (largest)\n"); WriteParameter(file,"ViewSize ",viewsize); // Write out WEAPONSCALE bna added SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; Size of Weaponscale.\n"); SafeWriteString(file,"; (smallest) 150 - 600 (largest)\n"); G_weaponscale = (weaponscale * 168 )/65536; if ((G_weaponscale <150)||(G_weaponscale>600)){ if (iGLOBAL_SCREENWIDTH == 320){ G_weaponscale=168; }else if (iGLOBAL_SCREENWIDTH == 640){ G_weaponscale=299; } } WriteParameter(file,"Weaponscale ",G_weaponscale); // Write out MouseAdjustment SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; Sensitivity of Mouse\n"); SafeWriteString(file,"; (lowest) 0 - 11 (highest)\n"); WriteParameter(file,"MouseAdjustment ",mouseadjustment); // Write out threshold SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; Threshold of Mouse and Joystick\n"); SafeWriteString(file,"; (smallest) 1 - 15 (largest)\n"); WriteParameter(file,"Threshold ",threshold); // Write in Auto Detail SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; 1 - Auto Detail on\n"); SafeWriteString(file,"; 0 - Auto Detail off\n"); WriteParameter (file,"AutoDetail ", AutoDetailOn); // Write in Light Dim SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; 1 - Light Diminishing on\n"); SafeWriteString(file,"; 0 - Light Diminishing off\n"); WriteParameter (file,"LightDim ", fulllight); // Write in Bobbin' On SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; 1 - Bobbing on\n"); SafeWriteString(file,"; 0 - Bobbing off\n"); WriteParameter (file,"BobbingOn ", BobbinOn); // Write in Double Click Speed SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; (slowest) 50 - 5 (fastest)\n"); WriteParameter (file,"DoubleClickSpeed ", DoubleClickSpeed); // Write in Menu Flip Speed SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; Menu Flip Speed\n"); SafeWriteString(file,"; (slowest) 100 - 5 (fastest)\n"); WriteParameter (file,"MenuFlipSpeed ", Menuflipspeed); // Write in Detail Level SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; 0 - Detail Level Low\n"); SafeWriteString(file,"; 1 - Detail Level Medium\n"); SafeWriteString(file,"; 2 - Detail Level High\n"); WriteParameter (file,"DetailLevel ", DetailLevel); // Write in Floor and Ceiling SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; 1 - Floor and Ceiling on\n"); SafeWriteString(file,"; 0 - Floor and Ceiling off\n"); WriteParameter (file,"FloorCeiling ", fandc); // Write in DisableMessages SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; 1 - Messages on\n"); SafeWriteString(file,"; 0 - Messages off\n"); WriteParameter (file,"Messages ", MessagesEnabled ); // Write in AutoRun SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; 1 - AutoRun on\n"); SafeWriteString(file,"; 0 - AutoRun off\n"); WriteParameter (file,"AutoRun ", gamestate.autorun ); // Write in GammaIndex SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; 0 - Gamma Correction level 1\n"); SafeWriteString(file,"; 1 - Gamma Correction level 2\n"); SafeWriteString(file,"; 2 - Gamma Correction level 3\n"); SafeWriteString(file,"; 3 - Gamma Correction level 4\n"); SafeWriteString(file,"; 4 - Gamma Correction level 5\n"); WriteParameter (file,"GammaIndex ", gammaindex); // Write out screen saver time SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; Minutes before screen blanking\n"); WriteParameter (file,"BlankTime ", blanktime/(VBLCOUNTER*60)); // Write out keys SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; Scan codes for keyboard buttons\n"); WriteParameter (file,"Fire ", buttonscan[0]); WriteParameter (file,"Strafe ", buttonscan[1]); WriteParameter (file,"Run ", buttonscan[2]); WriteParameter (file,"Use ", buttonscan[3]); WriteParameter (file,"LookUp ", buttonscan[4]); WriteParameter (file,"LookDn ", buttonscan[5]); WriteParameter (file,"Swap ", buttonscan[6]); WriteParameter (file,"Drop ", buttonscan[7]); WriteParameter (file,"TargetUp ", buttonscan[8]); WriteParameter (file,"TargetDn ", buttonscan[9]); WriteParameter (file,"SelPistol ", buttonscan[10]); WriteParameter (file,"SelDualPistol ", buttonscan[11]); WriteParameter (file,"SelMP40 ", buttonscan[12]); WriteParameter (file,"SelMissile ", buttonscan[13]); WriteParameter (file,"AutoRun ", buttonscan[14]); WriteParameter (file,"LiveRemRid ", buttonscan[15]); WriteParameter (file,"StrafeLeft ", buttonscan[16]); WriteParameter (file,"StrafeRight ", buttonscan[17]); WriteParameter (file,"VolteFace ", buttonscan[18]); WriteParameter (file,"Aim ", buttonscan[19]); WriteParameter (file,"Forward ", buttonscan[20]); WriteParameter (file,"Right ", buttonscan[21]); WriteParameter (file,"Backward ", buttonscan[22]); WriteParameter (file,"Left ", buttonscan[23]); WriteParameter (file,"Map ", buttonscan[24]); WriteParameter (file,"SendMessage ", buttonscan[25]); WriteParameter (file,"DirectMessage ", buttonscan[26]); SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; Mouse buttons\n"); WriteParameter (file,"MouseButton0 ", buttonmouse[0]); WriteParameter (file,"MouseButton1 ", buttonmouse[1]); WriteParameter (file,"MouseButton2 ", buttonmouse[2]); WriteParameter (file,"DblClickB0 ", buttonmouse[3]); WriteParameter (file,"DblClickB1 ", buttonmouse[4]); WriteParameter (file,"DblClickB2 ", buttonmouse[5]); SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; Joystick buttons\n"); WriteParameter (file,"JoyButton0 ", buttonjoy[0]); WriteParameter (file,"JoyButton1 ", buttonjoy[1]); WriteParameter (file,"JoyButton2 ", buttonjoy[2]); WriteParameter (file,"JoyButton3 ", buttonjoy[3]); WriteParameter (file,"DblClickJB0 ", buttonjoy[4]); WriteParameter (file,"DblClickJB1 ", buttonjoy[5]); WriteParameter (file,"DblClickJB2 ", buttonjoy[6]); WriteParameter (file,"DblClickJB3 ", buttonjoy[7]); SafeWriteString(file,"\n;\n"); SafeWriteString(file,"; Joystick calibration coordinates\n"); WriteParameter (file,"JoyMaxX ", joyxmax); WriteParameter (file,"JoyMaxY ", joyymax); WriteParameter (file,"JoyMinX ", joyxmin); WriteParameter (file,"JoyMinY ", joyymin); // Write out DefaultDifficulty SafeWriteString(file,"\n;\n"); WriteParameter(file,"; Easy - ", gd_baby ); WriteParameter(file,"; Medium - ", gd_easy ); WriteParameter(file,"; Hard - ", gd_medium ); WriteParameter(file,"; Crezzy - ", gd_hard ); WriteParameter(file,"DefaultDifficulty ", DefaultDifficulty ); // Write out DefaultPlayerCharacter SafeWriteString(file,"\n;\n"); WriteParameter(file,"; Taradino Cassatt - ", 0 ); WriteParameter(file,"; Thi Barrett - ", 1 ); WriteParameter(file,"; Doug Wendt - ", 2 ); WriteParameter(file,"; Lorelei Ni - ", 3 ); WriteParameter(file,"; Ian Paul Freeley - ", 4 ); WriteParameter(file,"DefaultPlayerCharacter ", DefaultPlayerCharacter ); // Write out DefaultPlayerColor SafeWriteString(file,"\n;\n"); WriteParameter(file,"; Gray - ", 0 ); WriteParameter(file,"; Brown - ", 1 ); WriteParameter(file,"; Black - ", 2 ); WriteParameter(file,"; Tan - ", 3 ); WriteParameter(file,"; Red - ", 4 ); WriteParameter(file,"; Olive - ", 5 ); WriteParameter(file,"; Blue - ", 6 ); WriteParameter(file,"; White - ", 7 ); WriteParameter(file,"; Green - ", 8 ); WriteParameter(file,"; Purple - ", 9 ); WriteParameter(file,"; Orange - ", 10 ); WriteParameter(file,"DefaultPlayerColor ", DefaultPlayerColor ); // Writeout password Password string SafeWriteString(file,"\n;\nSecretPassword "); memset(passwordtemp,0,sizeof(passwordtemp)); ConvertPasswordStringToString ( &passwordtemp[0] ); SafeWriteString(file,&passwordtemp[0]); SafeWriteString(file,"\n"); close (file); inconfig--; } //**************************************************************************** // // GetAlternatePath () // //**************************************************************************** void GetAlternatePath (char * tokenstr, AlternateInformation *info) { info->path = "."; GetToken (true); if (!stricmp (token, tokenstr)) { GetTokenEOL (false); info->path = strdup(name); } } //**************************************************************************** // // GetAlternateFile () // //**************************************************************************** void GetAlternateFile (char * tokenstr, AlternateInformation *info) { // Read in remote sound file // info->file = "foo.foo"; GetToken (true); if (!stricmp (token, tokenstr)) { if (TokenAvailable()==true) { GetToken (false); if (stricmp (token, "~")) { #if (SHAREWARE == 0) info->avail = true; info->file = strdup(token); #else printf("Alternate file %s ignored.\n",token); info->file = ""; #endif } } } } //**************************************************************************** // // ReadSETUPFiles () // //**************************************************************************** void ReadSETUPFiles (void) { char *filename; int i; RemoteSounds.avail = false; // PlayerGraphics.avail = false; GameLevels.avail = false; BattleLevels.avail = false; filename = M_StringJoin(ApogeePath, PATH_SEP_STR, CONFIG, NULL); if (access (filename, F_OK) == 0) { LoadScriptFile (filename); GetTokenEOL (true); //MODEMNAME GetTokenEOL (true); //MODEMINITSTR GetTokenEOL (true); //MODEMHANGUP GetTokenEOL (true); //RATE GetTokenEOL (true); //COMPORT GetTokenEOL (true); //IRQ GetTokenEOL (true); //UART GetTokenEOL (true); //PULSE GetTokenEOL (true); //AUTOMATICDIALOUT GetAlternatePath ("REMOTESOUNDPATH", &RemoteSounds); // GetAlternatePath ("PLAYERGRAPHICSPATH", &PlayerGraphics); GetAlternatePath ("GAMELEVELPATH", &GameLevels); GetAlternatePath ("BATTLELEVELPATH", &BattleLevels); // Get CodeName GetToken (true); if (stricmp (token, "CODENAME")) Error ("Can't find %s token.\n", "CODENAME"); GetTokenEOL (false); memset (&CodeName[0], 0, sizeof (CodeName)); if (stricmp (name, "~")) { // Get First (MAXCODENAMELENGTH-1) characters for (i=0;i #include #include #include #include #include "rt_def.h" #include "_rt_com.h" #include "rt_com.h" #include "rt_util.h" #include "rt_in.h" #include "rt_crc.h" #include "rt_playr.h" #include "isr.h" #include "rt_msg.h" #include "rottnet.h" #include "rt_main.h" #include "rt_net.h" #include "rt_draw.h" //#include "rt_ser.h" // GLOBAL VARIABLES // Same as in real mode rottcom_t * rottcom; int badpacket; int consoleplayer; byte ROTTpacket[MAXCOMBUFFERSIZE]; int controlsynctime; // LOCAL VARIABLES static int ComStarted=false; static int transittimes[MAXPLAYERS]; void SyncTime( int client ); void SetTransitTime( int client, int time ); #ifndef _WIN32 static void ReadUDPPacket() { rottcom->remotenode = -1; } static void WriteUDPPacket() { } #endif /* =============== = = InitROTTNET = =============== */ void InitROTTNET (void) { #ifndef _WIN32 int netarg; #endif if (ComStarted==true) return; ComStarted=true; #ifndef _WIN32 /* server-specific options: -net: enables netplay -server: run as rott server (default port 34858) -port: select a non-default port for server -host: select a non-default ip address to bind to -standalone: run as standalone server -remoteridicule: enable remote ridicule -players: number of players to expect client-specific options: -master: request to have control -net: specifies the host to connect to -port: select a non-default port to connect to */ rottcom = (rottcom_t *) malloc (sizeof(rottcom_t)); memset(rottcom, 0, sizeof(rottcom_t)); rottcom->ticstep = 1; rottcom->gametype = 1; rottcom->remotenode = -1; if (CheckParm("server")) { if (CheckParm("standalone")) { rottcom->consoleplayer = 0; } else { rottcom->consoleplayer = 1; } if (CheckParm("remoteridicule")) { rottcom->remoteridicule = 1; } else { rottcom->remoteridicule = 0; } netarg = CheckParm("players"); if (netarg && netarg < _argc-1) { rottcom->numplayers = atoi(_argv[netarg+1]); } else { rottcom->numplayers = 2; } rottcom->client = 0; } else { rottcom->client = 1; /* consoleplayer will be initialized after connecting */ /* numplayers will be initialized after connecting */ /* remoteridicule will be initialized after connecting */ } /* client-server negotiation protocol, as inspired by ipxsetup.c */ /* Best case: client sends a HereIAm packet. server replies with a YouAre packet, and broadcasts an Info packet to the rest, indicating that the new player has joined. client replies with an IAm packet until all players have joined, the server broadcasts an Info packet to the rest, indicating that another player is needed. once server has enough players, it broadcasts an AllDone packet. In detail: Client state: HereIAm (initial connection) Client sends HereIAm packet, waits for YouAre from server. At timeout, Client resends HereIam When client receives YouAre, client switches to IAm state Client state: IAm Client sends IAm packet, waits for IAmAck from server. At timeout, Client resends IAm When client receives IAmAck, client switches to WaitForDone state. Client state: WaitForDone Client waits for AllDone packet. When client receives AllDone, it sends an AllDoneAck. */ #endif remoteridicule = false; remoteridicule = rottcom->remoteridicule; if (rottcom->ticstep != 1) remoteridicule = false; if (remoteridicule == true) { if (!quiet) printf("ROTTNET: LIVE Remote Ridicule Enabled\n"); } if (!quiet) { printf("ROTTNET: consoleplayer=%ld\n",(long int)rottcom->consoleplayer); } } /* ================ = = ReadPacket = ================ */ boolean ReadPacket (void) { word crc; word sentcrc; // Set command (Get Packet) rottcom->command=CMD_GET; badpacket = 0; // Check to see if a packet is ready #ifndef _WIN32 ReadUDPPacket(); #endif // Is it ready? if (rottcom->remotenode!=-1) { // calculate crc on packet crc=CalculateCRC ((byte *)&rottcom->data[0], rottcom->datalength-sizeof(word)); // get crc inside packet sentcrc=*((word *)(&rottcom->data[rottcom->datalength-sizeof(word)])); // are the crcs the same? if (crc!=sentcrc) { badpacket=1; SoftError("BADPKT at %d\n",GetTicCount()); } if (networkgame==false) { rottcom->remotenode=server; } else { if ((IsServer==true) && (rottcom->remotenode>0)) rottcom->remotenode--; } memcpy(&ROTTpacket[0], &rottcom->data[0], rottcom->datalength); // SoftError( "ReadPacket: time=%ld size=%ld src=%ld type=%d\n",GetTicCount(), rottcom->datalength,rottcom->remotenode,rottcom->data[0]); return true; } else // Not ready yet.... return false; } /* ============= = = WritePacket = ============= */ void WritePacket (void * buffer, int len, int destination) { word crc; if (!rottcom) return; // set send command rottcom->command=CMD_SEND; // set destination rottcom->remotenode=destination; if (len>(int)(MAXCOMBUFFERSIZE-sizeof(word))) { Error("WritePacket: Overflowed buffer\n"); } // copy local buffer into realmode buffer memcpy((byte *)&(rottcom->data[0]),(byte *)buffer,len); // calculate CRC crc=CalculateCRC (buffer, len); // put CRC into realmode buffer packet *((word *)&rottcom->data[len])=crc; // set size of realmode packet including crc rottcom->datalength=len+sizeof(word); if (*((byte *)buffer)==0) Error("Packet type = 0\n"); if (networkgame==true) { if (IsServer==true) rottcom->remotenode++; // server fix-up } // SoftError( "WritePacket: time=%ld size=%ld src=%ld type=%d\n",GetTicCount(),rottcom->datalength,rottcom->remotenode,rottcom->data[0]); // Send It ! #ifndef _WIN32 WriteUDPPacket(); #endif } /* ============= = = ValidSyncPacket = ============= */ boolean ValidSyncPacket ( synctype * sync ) { if (ReadPacket() && (badpacket==0)) { if (((syncpackettype *)&(ROTTpacket[0]))->type==COM_SYNC) { memcpy(&(sync->pkt),&(ROTTpacket[0]),sizeof(sync->pkt)); return true; } } return false; } /* ============= = = SendSyncPacket = ============= */ void SendSyncPacket ( synctype * sync, int dest) { sync->pkt.type=COM_SYNC; sync->sendtime=GetTicCount(); WritePacket( &(sync->pkt.type) , sizeof(syncpackettype) , dest ); } /* ============= = = SlavePhaseHandler = ============= */ boolean SlavePhaseHandler( synctype * sync ) { boolean done; done=false; switch (sync->pkt.phase) { case SYNC_PHASE1: break; case SYNC_PHASE2: ISR_SetTime(sync->pkt.clocktime); break; case SYNC_PHASE3: sync->pkt.clocktime=GetTicCount(); break; case SYNC_PHASE4: ISR_SetTime(GetTicCount()-sync->pkt.delta); sync->pkt.clocktime=GetTicCount(); break; case SYNC_PHASE5: ISR_SetTime(GetTicCount()-sync->pkt.delta); sync->sendtime=sync->pkt.clocktime; done=true; break; } return done; } /* ============= = = MasterPhaseHandler = ============= */ boolean MasterPhaseHandler( synctype * sync ) { boolean done; done=false; switch (sync->pkt.phase) { case SYNC_PHASE1: sync->pkt.phase=SYNC_PHASE2; sync->pkt.clocktime=GetTicCount()+(sync->deltatime>>1); break; case SYNC_PHASE2: sync->pkt.phase=SYNC_PHASE3; break; case SYNC_PHASE3: sync->pkt.delta=sync->pkt.clocktime-GetTicCount()+(sync->deltatime>>1); sync->pkt.phase=SYNC_PHASE4; break; case SYNC_PHASE4: sync->pkt.phase=SYNC_PHASE5; sync->pkt.delta=sync->pkt.clocktime-GetTicCount()+(sync->deltatime>>1); sync->sendtime=GetTicCount()+SYNCTIME; sync->pkt.clocktime=sync->sendtime; done=true; break; } return done; } /* ============= = = ComSetTime = ============= */ void ComSetTime ( void ) { int i; syncpackettype * syncpacket; boolean done=false; syncpacket=(syncpackettype *)SafeMalloc(sizeof(syncpackettype)); // Sync clocks if (networkgame==true) { if (IsServer==true) { for (i=0;itype=COM_START; syncpacket->clocktime=GetTicCount(); controlsynctime=syncpacket->clocktime; if (networkgame==true) nump=numplayers; else nump=1; time = GetTicCount(); for (i=0;itype) , sizeof(syncpackettype) , i ); } while (GetTicCount()type) , sizeof(syncpackettype) , i ); } if (standalone==true) printf("ComSetTime: Start packets sent\n"); } else // Slave/Client { while (done==false) { AbortCheck("ComSetTime aborted as client"); if (ReadPacket() && (badpacket==0)) { memcpy(syncpacket,&(ROTTpacket[0]),sizeof(syncpackettype)); if (syncpacket->type==COM_START) { controlsynctime=syncpacket->clocktime; done=true; } } } } if (standalone==false) { AddMessage("All players synched.",MSG_SYSTEM); ThreeDRefresh(); } SafeFree(syncpacket); // // flush out any extras // while (GetTicCount()pkt.type=COM_SYNC; sync->pkt.phase=SYNC_MEMO; sync->pkt.clocktime=client; SendSyncPacket(sync,i); } } // Initialize send time so as soon as we enter the loop, we send sync->sendtime=GetTicCount()-SYNCTIME; while (done==false) { sync->pkt.phase=SYNC_PHASE0; AbortCheck("Initial sync aborted as master"); if ((sync->sendtime+SYNCTIME) <= GetTicCount()) SendSyncPacket(sync,client); if (ValidSyncPacket(sync)==true) { if (sync->pkt.phase==SYNC_PHASE0) { int time=GetTicCount(); while (time+SYNCTIME>GetTicCount()) { ReadPacket(); } time=GetTicCount(); while (time+SYNCTIME>GetTicCount()) {} done=true; } } } } /* ============= = = InitialSlaveSync = ============= */ void InitialSlaveSync ( synctype * sync ) { boolean done=false; while (done==false) { AbortCheck("Initial sync aborted as slave"); if (ValidSyncPacket(sync)==true) { if (sync->pkt.phase==SYNC_MEMO) { char str[50]="Server is synchronizing player "; char str2[10]; strcat(str,itoa(sync->pkt.clocktime+1,str2,10)); AddMessage(str,MSG_SYSTEM); ThreeDRefresh(); } if (sync->pkt.phase==SYNC_PHASE0) { int time=GetTicCount(); SendSyncPacket(sync,server); while (time+SYNCTIME>GetTicCount()) { ReadPacket(); } done=true; } } } AddMessage("Server is synchronizing your system",MSG_SYSTEM); ThreeDRefresh(); } /* ============= = = SyncTime = ============= */ void SyncTime( int client ) { int dtime[NUMSYNCPHASES]; boolean done; int i; synctype * sync; sync=(synctype *)SafeMalloc(sizeof(synctype)); if ( ((networkgame==true) && (IsServer==true)) || ((networkgame==false) && (consoleplayer==0)) ) { // Master InitialMasterSync ( sync, client ); done=false; // Initial setup for Master // Initialize send time so as soon as we enter the loop, we send sync->pkt.phase=SYNC_PHASE1; sync->sendtime=GetTicCount()-SYNCTIME; while (done==false) { // Master AbortCheck("SyncTime aborted as master"); if ((sync->sendtime+SYNCTIME) <= GetTicCount()) SendSyncPacket(sync,client); while (ValidSyncPacket(sync)==true) { // find average delta sync->deltatime=0; // calculate last delta dtime[sync->pkt.phase]=GetTicCount()-sync->sendtime; for (i=0;i<=sync->pkt.phase;i++) sync->deltatime+=dtime[i]; if (i!=0) sync->deltatime/=i; else Error("SyncTime: this should not happen\n"); done = MasterPhaseHandler( sync ); SendSyncPacket(sync,client); } } } else { // Slave InitialSlaveSync ( sync ); done=false; while (done==false) { // Slave AbortCheck("SyncTime aborted as slave"); while (ValidSyncPacket(sync)==true) { done = SlavePhaseHandler( sync ); if (done==false) SendSyncPacket(sync,server); } } } while (sync->sendtime > GetTicCount()) { while (ReadPacket()) {} } while ((sync->sendtime+SYNCTIME) > GetTicCount()) { } if ( ((networkgame==true) && (IsServer==true)) || ((networkgame==false) && (consoleplayer==0)) ) SetTransitTime( client, (sync->deltatime>>1)); SafeFree(sync); } /* ============= = = SetTransitTime = ============= */ void SetTransitTime( int client, int time ) { transittimes[client]=time; } /* ============= = = GetTransitTime = ============= */ int GetTransitTime( int client ) { return transittimes[client]; } rott-20230810/rott/rt_com.h000066400000000000000000000025041446517470200154020ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_com_public #define _rt_com_public //*************************************************************************** // // RT_COM.C // //*************************************************************************** #define MAXPACKET 512 #include "rottnet.h" extern int badpacket; extern int consoleplayer; extern byte ROTTpacket[MAXCOMBUFFERSIZE]; extern int controlsynctime; //#define consoleplayer (rottcom->consoleplayer) void InitROTTNET (void); boolean ReadPacket (void); void WritePacket (void * buffer, int len, int destination); void ComSetTime (void); int GetTransitTime( int client ); #endif rott-20230810/rott/rt_crc.c000066400000000000000000000067601446517470200153760ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ // CRC lib #include #include #include #include "rt_crc.h" /* variables */ static const unsigned short int crc16tab[256] = { 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040, 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240, 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41, 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41, 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041, 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441, 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41, 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640, 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241, 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440, 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 }; /* update crc reverse */ int updatecrc(int crc, int c) { int tmp; tmp=crc^c; crc=(crc>>8)^crc16tab[tmp & 0xff]; return crc; } //****************************************************************************** // // CalculateCRC () // //****************************************************************************** word CalculateCRC (byte *source, unsigned size) { unsigned i; int checksum; int tmp; checksum=0; for (i = 0; i < size; i++) { tmp=checksum^(*(source++)); checksum=(checksum>>8)^crc16tab[tmp & 0xff]; } return ((word)checksum); } rott-20230810/rott/rt_crc.h000066400000000000000000000014731446517470200153770ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" int updatecrc(int,int); word CalculateCRC (byte *source, unsigned size); rott-20230810/rott/rt_datadir.c000066400000000000000000000076571446517470200162450ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. Copyright (C) 2005-2014 Simon Howard Copyright (C) 2023 Fabian Greffrath 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. */ #include "SDL_filesystem.h" #include "m_misc2.h" #include "rt_util.h" static char *GetExeDir (void) { static char *dir; if (dir == NULL) { char *result; result = SDL_GetBasePath(); if (result != NULL) { dir = M_StringDuplicate(result); SDL_free(result); } else { result = M_DirName(_argv[0]); dir = M_StringDuplicate(result); } } return dir; } char *GetPrefDir (void) { static char *dir; if (dir == NULL) { char *result; #ifndef _WIN32 result = SDL_GetPrefPath("", PACKAGE_TARNAME); if (result != NULL) { dir = M_StringDuplicate(result); SDL_free(result); } else #endif { result = GetExeDir(); dir = M_StringDuplicate(result); } M_MakeDirectory(dir); #if !(SHAREWARE == 1) result = dir; dir = M_StringJoin(result, "darkwar", PATH_SEP_STR, NULL); free(result); M_MakeDirectory(dir); #endif } return dir; } char *datadir = NULL; #define MAX_DATADIRS 16 static char *datadirs[MAX_DATADIRS] = {0}; static int num_datadirs = 0; static void AddDataDir(char *dir) { if (num_datadirs < MAX_DATADIRS) { datadirs[num_datadirs++] = dir; } } #ifndef _WIN32 static void AddDataPath(const char *path, const char *suffix) { char *left, *p, *dup_path; dup_path = M_StringDuplicate(path); // Split into individual dirs within the list. left = dup_path; for (;;) { p = strchr(left, LIST_SEP_CHAR); if (p != NULL) { *p = '\0'; AddDataDir(M_StringJoin(left, suffix, NULL)); left = p + 1; } else { break; } } AddDataDir(M_StringJoin(left, suffix, NULL)); free(dup_path); } static void AddXdgDirs(void) { char *env, *tmp_env; env = getenv("XDG_DATA_HOME"); tmp_env = NULL; if (env == NULL) { char *homedir = getenv("HOME"); if (homedir == NULL) { homedir = "/"; } tmp_env = M_StringJoin(homedir, "/.local/share", NULL); env = tmp_env; } AddDataDir(M_StringJoin(env, "/games/rott", NULL)); free(tmp_env); env = getenv("XDG_DATA_DIRS"); if (env == NULL) { env = "/usr/local/share:/usr/share"; } AddDataPath(env, "/games/rott"); } #endif static void BuildDataDirList(void) { if (datadirs[0]) { return; } // current directory AddDataDir("."); // executable directory AddDataDir(GetExeDir()); #ifdef DATADIR // build-time data directory AddDataDir(DATADIR); #endif #ifndef _WIN32 AddXdgDirs(); #endif } char *FindFileByName(const char *name) { char *path; char *probe; int i; // Absolute path? probe = M_FileCaseExists(name); if (probe != NULL) { return probe; } BuildDataDirList(); for (i = 0; i < num_datadirs; i++) { path = M_StringJoin(datadirs[i], PATH_SEP_STR, name, NULL); probe = M_FileCaseExists(path); if (probe != NULL) { return probe; } free(path); } // File not found return NULL; } rott-20230810/rott/rt_datadir.h000066400000000000000000000014471446517470200162410ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. Copyright (C) 2005-2014 Simon Howard Copyright (C) 2023 Fabian Greffrath 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. */ #ifndef RT_DATADIR_H #define RT_DATADIR_H #include "m_misc2.h" extern char *datadir; char *GetPrefDir (void); char *FindFileByName(const char *name); #endif rott-20230810/rott/rt_debug.c000066400000000000000000000747421446517470200157220ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "rt_debug.h" #include "isr.h" #include "rt_game.h" #include "rt_menu.h" #include "rt_build.h" #include "rt_str.h" #include "rt_vid.h" #include "rt_playr.h" #include "rt_main.h" #include "rt_util.h" #include "rt_draw.h" #include "rt_in.h" #include "z_zone.h" #include "rt_ted.h" #include "rt_view.h" #include "develop.h" #include "rt_msg.h" #include "rt_net.h" #include "rt_sound.h" #include "rt_stat.h" #include "rt_map.h" #include #include #include "w_wad.h" extern int iDemoNames; extern boolean iG_aimCross; extern void DisplayMessage (int num,int position); typedef struct { char code[15]; byte length; } CodeStruct; enum { ENABLECHEAT, // enable cheats ENABLECHEATALT, // enable cheats SOMEITEMS, // three keys, more health SOMEITEMSALT, // three keys, more health INVULNERABLE, // normal god mode INVULNERABLEALT, // normal god mode WARP, // warp WARPALT, // warp ITEMS, // all keys, armor, 100% health ITEMSALT, // all keys, armor, 100% health GODMODEPWUP, // god mode powerup GODMODEPWUPALT, // god mode powerup #if (SHAREWARE == 0) DOGMODEPWUP, // dog mode powerup DOGMODEPWUPALT, // dog mode powerup #endif MERCURYPWUP, // mercury mode powerup MERCURYPWUPALT, // mercury mode powerup SHROOMSPWUP, // shrooms mode powerup SHROOMSPWUPALT, // shrooms mode powerup ELASTOPWUP, // elasto mode powerup ELASTOPWUPALT, // elasto mode powerup RESTARTGAME, // warp to level 1, start with pistol RESTARTGAMEALT, // warp to level 1, start with pistol HURTPLAYER, // hurt player 10% HURTPLAYERALT, // hurt player 10% TOMHALLMODE, // run fast all the time TOMHALLMODEALT, // run fast all the time NORMAL, // back to normal NORMALALT, // back to normal LIGHTDIMON, // light diminishing on LIGHTDIMONALT, // light diminishing on LIGHTDIMOFF, // light diminishing off LIGHTDIMOFFALT, // light diminishing off FOGON, // fog on (0x00 - 0x80 minmax) FOGONALT, // fog on (0x00 - 0x80 minmax) FOGOFF, // fog off (0x80 - 0xFF minmax) FOGOFFALT, // fog off (0x80 - 0xFF minmax) QUITGAME, // blow out of game QUITGAMEALT, // blow out of game ENDLEVEL, // end the current level ENDLEVELALT, // end the current level FANDCOFF, // floor and ceiling off FANDCOFFALT, // floor and ceiling off FANDCON, // floor and ceiling on FANDCONALT, // floor and ceiling on BULLETARMOR, // bullet proof armor BULLETARMORALT, // bullet proof armor FIREARMOR, // fire proof armor FIREARMORALT, // fire proof armor GASMASK, // gas mask GASMASKALT, // gas mask OUTFIT, // all keys, armor, 100% health, MP40, heatseek OUTFITALT, // all keys, armor, 100% health, MP40, heatseek KILLPLAYER, // kill player KILLPLAYERALT, // kill player RESTARTLEVEL, // re-enter level RESTARTLEVELALT, // re-enter level WEAPONTWOPISTOL, // give double pistol WEAPONTWOPISTOLALT, // give double pistol WEAPONMP40, // give mp40 WEAPONMP40ALT, // give mp40 WEAPONBAZOOKA, // give bazooka WEAPONBAZOOKAALT, // give bazooka WEAPONHEAT, // give heatseeker WEAPONHEATALT, // give heatseeker WEAPONDRUNK, // give drunk missile WEAPONDRUNKALT, // give drunk missile WEAPONFIREBOMB, // give firebomb WEAPONFIREBOMBALT, // give firebomb WEAPONFIREWALL, // give firewall WEAPONFIREWALLALT, // give firewall WEAPONGOD, // give godhand WEAPONGODALT, // give godhand AIMCROSS, // bna++ AIMCROSSALT, // give bna++ #if (SHAREWARE == 0) WEAPONSPLIT, // give split missile WEAPONSPLITALT, // give split missile WEAPONKES, // give kes WEAPONKESALT, // give kes WEAPONBAT, // give bat WEAPONBATALT, // give bat WEAPONDOG, // give dogmode WEAPONDOGALT, // give dogmode #endif MISSILECAMTOGGLE, // Turn missile cam on/off MISSILECAMTOGGLEALT, // Turn missile cam on/off HUDTOGGLE, // Turn HUD on/off HUDTOGGLEALT, // Turn HUD on/off ROTATIONFUN, // Rotation fun DEMORECORD, // Start recording demo DEMOEND, // End recording demo DEMOPLAYBACK, // Playback demo CRAZYGIBS, // Engine Killing Gibs JUKEBOX, // JukeBox JUKEBOXALT, // JukeBox MAPCHEAT, // Map Cheat MAPCHEATALT, // Map Cheat Alt MAXCODES }; CodeStruct Codes[MAXCODES + 6] = { {"KCITSPID", 8}, // enable cheats {"CCE\\", 4}, // enable cheats {"REKCALS", 7}, // three keys, more health {"MUB\\", 4}, // three keys, more health {"NIJOHC", 6}, // normal god mode {"WWW\\", 4}, // normal god mode {"OTOG", 4}, // warp {"LTG\\", 4}, // warp {"SYOTXIS", 7}, // all keys, armor, 100% health {"IAG\\", 4}, // all keys, armor, 100% health {"DASOOT", 6}, // god mode powerup {"DOG\\", 4}, // god mode powerup #if (SHAREWARE == 0) {"FOOW", 4}, // dog mode powerup {"GOD\\", 4}, // dog mode powerup #endif {"YOBYLF", 6}, // mercury mode powerup {"REM\\", 4}, // mercury mode powerup {"PIRTDAB", 7}, // shrooms mode powerup {"RHS\\", 4}, // shrooms mode powerup {"GNIOB", 5}, // elasto mode powerup {"ALE\\", 4}, // elasto mode powerup {"SREBOOG", 7}, // warp to level 1, start with pistol {"OOG\\", 4}, // warp to level 1, start with pistol {"KCAHW", 5}, // hurt player 10% {"FOO\\", 4}, // hurt player 10% {"DEEPS", 5}, // run fast all the time {"AFR\\", 4}, // run fast all the time {"CINAP", 5}, // back to normal {"NAP\\", 4}, // back to normal {"NOMID", 5}, // light diminishing on {"NOD\\", 4}, // light diminishing on {"FFOMID", 6}, // light diminishing off {"FOD\\", 4}, // light diminishing off {"NODNOL", 6}, // fog on (0x00 - 0x80 minmax) {"NOF\\", 4}, // fog on (0x00 - 0x80 minmax) {"LONDON", 6}, // fog off (0x80 - 0xFF minmax) {"FOF\\", 4}, // fog off (0x80 - 0xFF minmax) {"SETAGOG", 7}, // blow out of game {"R8L\\", 4}, // blow out of game {"HCRAOG", 6}, // end the current level {"LCE\\", 4}, // end the current level {"683ATOG", 7}, // floor and ceiling off {"NOC\\", 4}, // floor and ceiling off {"684ATOG", 7}, // floor and ceiling on {"FOC\\", 4}, // floor and ceiling on {"EMTOOHS", 7}, // bullet proof armor {"RAB\\", 4}, // bullet proof armor {"EMNRUB", 6}, // fire proof armor {"RAF\\", 4}, // fire proof armor {"GNUDGNUL", 8}, // gas mask {"RAG\\", 4}, // gas mask {"KCAPTNUH", 8}, // all keys, armor, 100% health, MP40, heatseek {"PFO\\", 4}, // all keys, armor, 100% health, MP40, heatseek {"EM68", 4}, // kill player {"EID\\", 4}, // kill player {"REEN", 4}, // re-enter level {"LER\\", 4}, // re-enter level {"OOWNHOJ", 7}, // give double pistol {"2WG\\", 4}, // give double pistol {"EMGULP", 6}, // give mp40 {"3WG\\", 4}, // give mp40 {"ALLINAV", 7}, // give bazooka {"4WG\\", 4}, // give bazooka {"SEMITTOH", 8}, // give heatseeker {"5WG\\", 4}, // give heatseeker {"EZOOB", 5}, // give drunk missile {"6WG\\", 4}, // give drunk missile {"BMOBERIF", 8}, // give firebomb {"7WG\\", 4}, // give firebomb {"SENOB", 5}, // give firewall {"8WG\\", 4}, // give firewall {"AYEES", 5}, // give god hand {"9WG\\", 4}, // give god hand {"MIA", 3}, // give aim bna++ {"MIA\\", 4}, // give aim bna++ #if (SHAREWARE == 0) {"TILPS", 5}, // give split missile {"AWG\\", 4}, // give split missile {"HTAEDFOSEK", 10}, // give kes {"BWG\\", 4}, // give kes {"NUREMOH", 8}, // give bat {"CWG\\", 4}, // give bat {"OJUC", 4}, // give dog weapon {"DWG\\", 4}, // give dog weapon #endif {"EDIR", 4}, // give MISSILE CAM {"MAC\\", 4}, // give Missile Cam {"EREHW", 5}, // turn where am i on/off {"DUH\\", 4}, // give hud {"NUF\\", 4}, // Rotation fun {"DROCER", 6}, // Demo RECORD {"POTS", 4}, // Demo stop recording {"YALP", 4}, // Demo Playback {"GKE\\", 4}, // Engine Killing Gibs {"ORTSEAM", 7}, // JukeBox {"EEL\\", 4}, // JukeBox {"REITRAC", 7}, // Map Cheat {"PAM\\", 4}, // Map Cheat {"UOY\\", 4}, // Secret Message {"EVAH", 4}, // Secret Message {"ON\\", 3}, // Secret Message {"EFIL", 4}, // Secret Message }; /* ================ = = CheatSpawnItem = ================ */ void CheatSpawnItem (int item) { SpawnStatic(player->tilex, player->tiley, item,-1); LASTSTAT->z = player->z; MakeStatActive(LASTSTAT); LASTSTAT->flags|=FL_ABP; } /* ================ = = FixupPowerupsY = ================ */ void FixupPowerupsY (void) { player->z = nominalheight; } /* ================ = = EnableCheatCodes = ================ */ void EnableCheatCodes (void) { DebugOk ^= 1; if (DebugOk) AddMessage ("Cheat Codes \\cENABLED!", MSG_CHEAT); else AddMessage ("Cheat Codes \\cDISABLED!", MSG_CHEAT); } /* ================ = = ResetCheatCodes = ================ */ void ResetCheatCodes (void) { // godmode = false; } /* ================ = = DoMapCheat = ================ */ void DoMapCheat (void) { AddMessage ("Entire Map Revealed!", MSG_CHEAT); CheatMap (); } /* ================ = = DoGodMode = ================ */ void DoGodMode (void) { if (godmode) AddMessage ("Woundless With Weapons \\cOFF", MSG_CHEAT); else AddMessage ("Woundless With Weapons \\cON", MSG_CHEAT); godmode ^= 1; } /* ================ = = DoWarp = ================ */ #include "byteordr.h"//bna++ void DoWarp (void) { /* char str[10]; boolean esc; int level; CurrentFont = smallfont; US_CenterWindow(26,3); PrintY+=6; US_Print(" Warp to level(1-99):"); VW_UpdateScreen(); ShutdownClientControls(); esc = !US_LineInput (px, py, str, NULL, true, 2, 25, 13); if (!esc) { level = ParseNum (str); if (level>0 && level<=99) { gamestate.mapon = level-1; playstate = ex_warped; gamestate.episode = GetEpisode (gamestate.mapon); } } while (Keyboard[sc_Escape]) IN_UpdateKeyboard (); IN_ClearKeyboardQueue (); */ int level; EnableScreenStretch();//bna++ shut on streech mode MU_StoreSongPosition(); MU_StartSong( song_secretmenu); StopWind(); ShutdownClientControls(); SetupMenuBuf(); SetUpControlPanel (); level = CP_LevelSelectionMenu(); CleanUpControlPanel(); ShutdownMenuBuf(); //bna++ section if (( playstate == ex_stillplaying )&&(iGLOBAL_SCREENWIDTH > 320)){ pic_t *shape; shape = ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 ); DrawTiledRegion( 0, 16, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 32, 0, 16, shape ); DisableScreenStretch();//dont strech when we go BACK TO GAME DrawPlayScreen(true);//repaint ammo and life stat VW_UpdateScreen ();//update screen } //bna section end EnableScreenStretch();//bna++ shut on streech mode while( Keyboard[ sc_Escape ] ) { IN_UpdateKeyboard(); } IN_ClearKeyboardQueue(); if ((level == -1) || (level == gamestate.mapon)) { MU_StartSong(song_level); MU_RestoreSongPosition(); } if ( level >= 0 ) { playstate = ex_warped; gamestate.mapon = level; GetEpisode( gamestate.mapon ); VL_FadeOut (0, 255, 0, 0, 0, 20); } else { DisableScreenStretch();//dont strech when we go BACK TO GAME SetupScreen(true); } StartupClientControls(); } /* ================ = = DoJukeBox = ================ */ void DoJukeBox (void) { if (iGLOBAL_SCREENWIDTH > 320) { EnableScreenStretch();//bna++ shut on streech mode } StopWind(); ShutdownClientControls(); SetupMenuBuf(); SetUpControlPanel (); MU_JukeBoxMenu(); CleanUpControlPanel(); ShutdownMenuBuf(); //bna++ section if (( playstate == ex_stillplaying )&&(iGLOBAL_SCREENWIDTH > 320)){ pic_t *shape; shape = ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 ); DrawTiledRegion( 0, 16, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 32, 0, 16, shape ); DisableScreenStretch();//dont strech when we go BACK TO GAME DrawPlayScreen(true);//repaint ammo and life stat VW_UpdateScreen ();//update screen } //bna section end SetupScreen(true); while( Keyboard[ sc_Escape ] ) { IN_UpdateKeyboard(); } IN_ClearKeyboardQueue(); StartupClientControls(); } /* ================ = = DoNormalThing = ================ */ void DoNormalThing (void) { AddMessage ("BACK TO NORMAL. AH.", MSG_CHEAT); player->flags &= ~(FL_BPV|FL_AV|FL_GASMASK); locplayerstate->protectiontime = 0; if (player->flags & FL_ELASTO) player->flags &= ~FL_NOFRICTION; player->flags &= ~(FL_SHROOMS|FL_ELASTO|FL_FLEET); locplayerstate->poweruptime = 0; InitializeWeapons(locplayerstate); locplayerstate->keys = 0; DrawPlayScreen (false); } /* ================ = = DoItemCheat = ================ */ void DoItemCheat (void) { AddMessage ("Items Aplenty!", MSG_CHEAT); GivePoints (100000); HealPlayer (99, player); locplayerstate->keys = 0xF; DrawKeys (false); player->flags &= ~(FL_GASMASK|FL_BPV|FL_AV); CheatSpawnItem(stat_bulletproof); /* player->flags |= FL_BPV; player->flags &= ~(FL_GASMASK|FL_AV); locplayerstate->protectiontime = POWERUPTICS; GM_DrawBonus (stat_bulletproof); */ } /* ================ = = DoSomeItemCheat = ================ */ void DoSomeItemCheat (void) { AddMessage ("Slacker pack!", MSG_CHEAT); HealPlayer (40, player); locplayerstate->keys = 0x7; DrawKeys (false); } /* ================ = = DoGodModePowerup = ================ */ void DoGodModePowerup (void) { if (PLAYER[0]->flags & FL_GODMODE) return; CheatSpawnItem(stat_godmode); } /* ================ = = DoDogModePowerup = ================ */ void DoDogModePowerup (void) { if (PLAYER[0]->flags & FL_DOGMODE) return; CheatSpawnItem(stat_dogmode); } /* ================ = = DoMercuryModePowerup = ================ */ void DoMercuryModePowerup (void) { if (PLAYER[0]->flags & FL_FLEET) return; CheatSpawnItem(stat_fleetfeet); } /* ================ = = DoElastoModePowerup = ================ */ void DoElastoModePowerup (void) { if (PLAYER[0]->flags & FL_ELASTO) return; CheatSpawnItem(stat_elastic); } /* ================ = = DoShroomsModePowerup = ================ */ void DoShroomsModePowerup (void) { if (PLAYER[0]->flags & FL_SHROOMS) return; AddMessage ("SHROOMS MODE POWERDOWN!", MSG_CHEAT); CheatSpawnItem(stat_mushroom); } /* ================ = = RestartNormal = ================ */ void RestartNormal (void) { EnableScreenStretch();//bna DoNormalThing (); AddMessage ("Restart to level 1", MSG_CHEAT); gamestate.mapon = 0; playstate = ex_warped; GetEpisode (gamestate.mapon); } /* ================ = = HurtPlayer = ================ */ void HurtPlayer (void) { int oldhitpoints; oldhitpoints = player->hitpoints; DamageThing (player, MaxHitpointsForCharacter(locplayerstate) / 10); if (player->hitpoints < oldhitpoints) AddMessage ("OUCH!!!!", MSG_CHEAT); Collision(player,player,0,0); } /* ================ = = SetLightDiminish = ================ */ void SetLightDiminish (boolean off) { if (off) { AddMessage ("Light Diminishing \\cOff", MSG_CHEAT); fulllight = 1; } else { AddMessage ("Light Diminishing \\cOn", MSG_CHEAT); fulllight = 0; } } /* ================ = = SetFog = ================ */ void SetFog (boolean on) { if (on) { AddMessage ("Fog \\cOn", MSG_CHEAT); MAPSPOT(2,0,1)=105; MAPSPOT(3,0,1)=0; SetupLightLevels (); } else { AddMessage ("Fog \\cOff", MSG_CHEAT); MAPSPOT(2,0,1)=104; SetupLightLevels (); } } /* ================ = = ToggleMissileCam = ================ */ void ToggleMissileCam (void) { if (missilecam==false) { missilecam=true; AddMessage ("Missile Cam \\cOn", MSG_CHEAT); } else { missilecam=false; AddMessage ("Missile Cam \\cOff", MSG_CHEAT); } } /* ================ = = ToggleHUD = ================ */ void ToggleHUD (void) { if (HUD==false) { HUD=true; AddMessage ("HUD \\cOn", MSG_CHEAT); } else { HUD=false; AddMessage ("HUD \\cOff", MSG_CHEAT); } } /* ================ = = EndLevel = ================ */ void EndLevel (void) { AddMessage ("End Level", MSG_CHEAT); playstate = ex_skiplevel; } /* ================ = = FloorandCeiling = ================ */ void FloorandCeiling (boolean off) { if (off) { AddMessage ("Floor and Ceiling \\cON", MSG_CHEAT); fandc = 1; } else { AddMessage ("Floor and Ceiling \\cOFF", MSG_CHEAT); fandc = 0; } } /* ================ = = GiveGasMask = ================ */ void GiveGasMask () { if (PLAYER[0]->flags & FL_GASMASK) return; CheatSpawnItem(stat_gasmask); } /* ================ = = GiveBulletProofArmor = ================ */ void GiveBulletProofArmor () { if (PLAYER[0]->flags & FL_BPV) return; CheatSpawnItem(stat_bulletproof); } /* ================ = = GiveAsbestoArmor = ================ */ void GiveAsbestoArmor () { if (PLAYER[0]->flags & FL_AV) return; CheatSpawnItem(stat_asbesto); } /* ================ = = OutfitPlayer = ================ */ void OutfitPlayer () { AddMessage ("Outfit Player!", MSG_CHEAT); locplayerstate->keys = 0xF; DrawKeys (false); HealPlayer (99, player); /* player->flags |= FL_BPV; player->flags &= ~(FL_GASMASK|FL_AV); locplayerstate->protectiontime = POWERUPTICS; GM_DrawBonus (stat_bulletproof); GiveWeapon (player,wp_mp40); */ #if (SHAREWARE == 0) CheatSpawnItem(stat_splitmissile); #else CheatSpawnItem(stat_heatseeker); #endif } /* ================ = = KillPlayer = ================ */ void KillPlayer () { AddMessage ("Say Goodnight.", MSG_CHEAT); playstate = ex_died; } /* ================ = = RestartCurrentLevel = ================ */ void RestartCurrentLevel (void) { playstate = ex_warped; GetEpisode (gamestate.mapon); } /* ================ = = EndDemo = ================ */ void EndDemo ( void ) { char str[10]; boolean esc; int demonumber; if (demorecord==false) return; ShutdownClientControls(); CurrentFont = smallfont; demorecord = false; US_CenterWindow (26, 4); US_CPrint ("Save demo as:"); US_Print ("\n"); US_CPrint ("Demo Number (1-4):"); VW_UpdateScreen(); esc = !US_LineInput (px, py, str, NULL, true, 1, 25, 13); if (!esc) { demonumber = ParseNum (str); if ((demonumber > 0) && (demonumber < 5)) { SaveDemo (demonumber); } } IN_ClearKeysDown (); while (Keyboard[sc_Enter]) IN_UpdateKeyboard (); while (Keyboard[sc_Escape]) IN_UpdateKeyboard (); IN_ClearKeyboardQueue (); StartupClientControls(); DisableScreenStretch(); } /* ================ = = RecordDemoQuery = ================ */ void RecordDemoQuery ( void ) { char str[10]; boolean esc; int level; ShutdownClientControls(); CurrentFont = smallfont; US_CenterWindow (26, 5); PrintY += 6; US_CPrint ("Record Demo"); US_Print ("\n"); #if (SHAREWARE==0) US_CPrint ("Which level (1-36):"); #else US_CPrint ("Which level (1-8):"); #endif VW_UpdateScreen(); esc = !US_LineInput (px, py, str, NULL, true, 2, 25, 13); if (!esc) { level = ParseNum (str); #if (SHAREWARE==0) if ((level > 0) && (level < 37)) #else if ((level > 0) && (level < 9)) #endif { EnableScreenStretch();//bna gamestate.mapon = level-1; playstate = ex_demorecord; } } while (Keyboard[sc_Enter]) IN_UpdateKeyboard (); while (Keyboard[sc_Escape]) IN_UpdateKeyboard (); IN_ClearKeyboardQueue (); StartupClientControls(); } /* ================ = = PlaybackDemoQuery = ================ */ void PlaybackDemoQuery ( void ) { char str[10]; boolean esc; int level; ShutdownClientControls(); CurrentFont = smallfont; US_CenterWindow (33, 4); US_CPrint ("Playback demo"); US_Print ("\n"); US_CPrint ("Enter demo number (1-4):"); VW_UpdateScreen (); esc = !US_LineInput (px, py, str, NULL, true, 1, 25, 13); if (!esc) { level = ParseNum (str); if ((level > 0) && (level < 5)) { if (DemoExists (level) == true) LoadDemo (level); } } while (Keyboard[sc_Enter]) IN_UpdateKeyboard (); while (Keyboard[sc_Escape]) IN_UpdateKeyboard (); IN_ClearKeyboardQueue (); StartupClientControls(); EnableScreenStretch(); } /* ================ = = DebugKeys = ================ */ int DebugKeys (void) { //TODO: Remove function. return (0); } /* ================ = = WeaponCheat = ================ */ void WeaponCheat (int weapon) { if ((player->flags & FL_GODMODE) || (player->flags & FL_DOGMODE)) return; if ((weapon <= wp_mp40) && (PLAYERSTATE[0].HASBULLETWEAPON[weapon])) return; CheatSpawnItem(GetItemForWeapon(weapon)); } /* ================ = = CheckCode () = ================ */ void CheckCode (int which) { int pos = (LastLetter-1)&(MAXLETTERS-1); int num = 0; int start; start = pos; while ((toupper(LetterQueue[pos]) == Codes[which].code[num]) && (num < Codes[which].length)) { pos = (pos-1)&(MAXLETTERS-1); num++; } if (num == Codes[which].length) { // Kill last letter so the debug rtn will not keep triggering LetterQueue[start] = 0; switch (which) { case ENABLECHEAT: case ENABLECHEATALT: EnableCheatCodes (); break; case INVULNERABLE: case INVULNERABLEALT: DoGodMode (); break; case WARP: case WARPALT: DoWarp (); break; case ITEMS: case ITEMSALT: DoItemCheat (); break; case SOMEITEMS: case SOMEITEMSALT: DoSomeItemCheat (); break; case GODMODEPWUP: case GODMODEPWUPALT: DoGodModePowerup (); break; #if (SHAREWARE == 0) case DOGMODEPWUP: case DOGMODEPWUPALT: DoDogModePowerup (); break; #endif case MERCURYPWUP: case MERCURYPWUPALT: DoMercuryModePowerup (); break; case SHROOMSPWUP: case SHROOMSPWUPALT: DoShroomsModePowerup (); break; case ELASTOPWUP: case ELASTOPWUPALT: DoElastoModePowerup (); break; case RESTARTGAME: case RESTARTGAMEALT: RestartNormal (); break; case HURTPLAYER: case HURTPLAYERALT: HurtPlayer (); break; case TOMHALLMODE: case TOMHALLMODEALT: gamestate.autorun = true; AddMessage("Autorun enabled!",MSG_CHEAT); break; case NORMAL: case NORMALALT: DoNormalThing (); break; case LIGHTDIMON: case LIGHTDIMONALT: SetLightDiminish (false); break; case LIGHTDIMOFF: case LIGHTDIMOFFALT: SetLightDiminish (true); break; case FOGON: case FOGONALT: SetFog (true); break; case FOGOFF: case FOGOFFALT: SetFog (false); break; case QUITGAME: case QUITGAMEALT: QuitGame (); break; case ENDLEVEL: case ENDLEVELALT: EndLevel (); break; case FANDCOFF: case FANDCOFFALT: FloorandCeiling (false); break; case FANDCON: case FANDCONALT: FloorandCeiling (true); break; case AIMCROSS: case AIMCROSSALT: if (iG_aimCross == 0) { iG_aimCross = 1; AddMessage("Crosshair on",MSG_GAME); }else{ iG_aimCross = 0; AddMessage("Crosshair off",MSG_GAME); } break; case BULLETARMOR: case BULLETARMORALT: GiveBulletProofArmor (); break; case FIREARMOR: case FIREARMORALT: GiveAsbestoArmor (); break; case GASMASK: case GASMASKALT: GiveGasMask (); break; case OUTFIT: case OUTFITALT: OutfitPlayer (); break; case KILLPLAYER: case KILLPLAYERALT: KillPlayer (); break; case RESTARTLEVEL: case RESTARTLEVELALT: RestartCurrentLevel (); break; case WEAPONTWOPISTOL: case WEAPONTWOPISTOLALT: WeaponCheat(wp_twopistol); break; case WEAPONMP40: case WEAPONMP40ALT: WeaponCheat(wp_mp40); break; case WEAPONBAZOOKA: case WEAPONBAZOOKAALT: WeaponCheat(wp_bazooka); break; case WEAPONFIREBOMB: case WEAPONFIREBOMBALT: WeaponCheat(wp_firebomb); break; case WEAPONHEAT: case WEAPONHEATALT: WeaponCheat(wp_heatseeker); break; case WEAPONDRUNK: case WEAPONDRUNKALT: WeaponCheat(wp_drunk); break; case WEAPONFIREWALL: case WEAPONFIREWALLALT: WeaponCheat(wp_firewall); break; case WEAPONGOD: case WEAPONGODALT: WeaponCheat(wp_godhand); break; #if (SHAREWARE == 0) case WEAPONSPLIT: case WEAPONSPLITALT: WeaponCheat(wp_split); break; case WEAPONKES: case WEAPONKESALT: WeaponCheat(wp_kes); break; case WEAPONBAT: case WEAPONBATALT: WeaponCheat(wp_bat); break; case WEAPONDOG: case WEAPONDOGALT: WeaponCheat(wp_dog); break; #endif case MISSILECAMTOGGLE: case MISSILECAMTOGGLEALT: ToggleMissileCam(); break; case HUDTOGGLE: case HUDTOGGLEALT: ToggleHUD(); break; case ROTATIONFUN: ShutdownClientControls(); RotationFun(); StartupClientControls(); SetupScreen( true ); break; case DEMORECORD: RecordDemoQuery(); break; case DEMOEND: EndDemo(); break; case DEMOPLAYBACK: PlaybackDemoQuery(); break; case CRAZYGIBS: if (gamestate.violence == vl_excessive) { ludicrousgibs ^= 1; if (ludicrousgibs == true) AddMessage("EKG mode on!",MSG_GAME); else AddMessage("EKG mode off!",MSG_GAME); } break; case JUKEBOX: case JUKEBOXALT: DoJukeBox(); break; case MAPCHEAT: case MAPCHEATALT: DoMapCheat(); break; } } } /* ================ = = CheckDebug () = ================ */ void CheckDebug (void) { int which; if (DebugOk == false) { CheckCode (0); // Check for Debug switch only CheckCode (1); // Check for Debug switch only CheckCode (2); // Check for Slacker pack CheckCode (3); // Check for Slacker pack } else { if (demoplayback==true) { return; } else if (demorecord==true) { CheckCode (DEMORECORD); CheckCode (DEMOEND); } else { for (which = 0; which < MAXCODES; which++) // Check all debug codes CheckCode (which); } } } rott-20230810/rott/rt_debug.h000066400000000000000000000020531446517470200157110ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_debug_public #define _rt_debug_public //*************************************************************************** // // RT_DEBUG.C // //*************************************************************************** void ResetCheatCodes (void); int DebugKeys (void); void CheckDebug (void); void EndDemo ( void ); #endif rott-20230810/rott/rt_def.h000066400000000000000000000311411446517470200153610ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_def_public #define _rt_def_public // RT_DEF.H Zee big one #include #include #include #include "develop.h" #include #include #include #include #include #include #ifdef _WIN32 #define PATH_SEP_CHAR '\\' #define PATH_SEP_STR "\\" #define LIST_SEP_CHAR ';' #else #define PATH_SEP_CHAR '/' #define PATH_SEP_STR "/" #define LIST_SEP_CHAR ':' #define ROOTDIR "/" #define CURDIR "./" #endif #if defined(__GNUC__) || defined(__clang__) #define PRINTF_ATTR(fmt, first) __attribute__((format(printf, fmt, first))) #define PRINTF_ARG_ATTR(x) __attribute__((format_arg(x))) #define NORETURN __attribute__((noreturn)) #else #define PRINTF_ATTR(fmt, first) #define PRINTF_ARG_ATTR(x) #define NORETURN #endif #if (!defined MAX_PATH) #if (defined MAXPATHLEN) #define MAX_PATH MAXPATHLEN #elif (defined PATH_MAX) #define MAX_PATH PATH_MAX #else #define MAX_PATH 256 #endif #endif // // // //*************************************************************************** // // Global Constants // //*************************************************************************** #undef PI #undef M_PI #ifndef NULL #define NULL 0 #endif #define PI 3.141592657 #define LONG(a) ((int)a) #define M_PI 3.14159 #ifndef O_BINARY #define O_BINARY 0 #endif #ifndef O_TEXT #define O_TEXT 0 #endif #ifndef min #define min(a, b) (((a) < (b)) ? (a) : (b)) #endif #ifndef max #define max(a, b) (((a) > (b)) ? (a) : (b)) #endif #ifdef _WIN32 #define strcmpi(x, y) stricmp(x, y) #define _fstricmp(x, y) stricmp(x, y) #else #ifndef strcmpi #define strcmpi(x, y) strcasecmp(x, y) #endif #ifndef stricmp #define stricmp(x, y) strcasecmp(x, y) #endif #ifndef _fstricmp #define _fstricmp(x, y) strcasecmp(x, y) #endif #endif #define arrlen(array) (sizeof(array) / sizeof(*array)) char *strupr(char *); char *itoa(int, char *, int); char *ltoa(long, char *, int); char *ultoa(unsigned long, char *, int); char getch(void); long filelength(int handle); #define STUB_FUNCTION fprintf(stderr,"STUB: %s at " __FILE__ ", line %d, thread %d\n",__FUNCTION__,__LINE__,getpid()) #define far #define cdecl //*************************************************************************** // // Screen Constants // //*************************************************************************** #define VIEWGLOBAL 0x10000 // globals visable flush to wall /* #define VIEWWIDTH MAXSCREENWIDTH//320*2 // size of view window #define VIEWHEIGHT MAXSCREENHEIGHT//200*2 #define MAXSCANLINES MAXSCREENHEIGHT//200*2 // size of ylookup table */ #define CHARWIDTH 2 #define TILEWIDTH 4 #define STATUSLINES 16 //*************************************************************************** // // Engine Constants // //*************************************************************************** #define ANGLES 2048 // must be divisible by 4 #define ANGLEQUAD (ANGLES/4) #define FINEANGLES 2048 #define FINEANGLEQUAD (FINEANGLES/4) #define ANG90 (FINEANGLES/4) #define ANG180 (ANG90*2) #define ANG270 (ANG90*3) #define ANG360 (ANG90*4) #define VANG90 (ANGLES/4) #define VANG180 (VANG90*2) #define VANG270 (VANG90*3) #define VANG360 (VANG90*4) #define ANGLESDIV8 (ANGLES/8) #define MINDIST (0x5800l) #define PIXRADIUS 512 #define FOCALLENGTH (0x5700l) // in global coordinates #define MAXTICS 10 //*************************************************************************** // // Map Constants/ macros // //*************************************************************************** #define GLOBAL1 (1l<<16) #define TILEGLOBAL GLOBAL1 #define PIXGLOBAL (GLOBAL1/64) #define TILESHIFT 16l #define UNSIGNEDSHIFT 8 #define PLAYERSIZE 0x5700l // player radius #define MAPSIZE 128 // maps are 64*64 max #define NUMAREAS 47 #define MAPSPOT(x,y,plane) (mapplanes[plane][MAPSIZE*(y)+(x)]) #define AREATILE 107 #define ICONARROWS 72 #define PUSHABLETILE 80 #define ELEVATORTILE 72 #define ALTELEVATORTILE 106 #define LASTLEVELVALUE 459 #define AREANUMBER(x,y) (MAPSPOT((x),(y),0)-AREATILE) //*************************************************************************** // // Scale Constants // //*************************************************************************** #define SFRACBITS 16 #define SFRACUNIT (0x10000) #define FRACUNIT (0x100) //*************************************************************************** // // Actor Constants // //*************************************************************************** #define RUNSPEED 6000 #define MINACTORDIST 0x9000l #define MAXSTATS 400 // max number of lamps, bonus, etc #define MAXWALLTILES 105 // max number of wall tiles #define MAXACTORS 600 #define NORTH 0 #define EAST 1 #define SOUTH 2 #define WEST 3 //*************************************************************************** // // Input Defines - joystick, keyboard and mouse // //*************************************************************************** #define MaxJoys 2 #define MaxKbds 2 #define MaxJoys 2 #define NumCodes 128 // Key definitions #define key_None 0 #define key_Return 0x0d #define key_Enter key_Return #define key_Escape 0x1b #define key_Space 0x20 #define key_BackSpace 0x08 #define key_Tab 0x09 #define key_Delete 0x7f #define ANGLEBITS 16 #define ANGLEFRACMAX (FINEANGLES< PLAYBACKBUFFERSIZE) amount=PLAYBACKBUFFERSIZE-PlaybackPointer; memcpy ( &PlaybackBuffer[PlaybackPointer], ptr, amount); PlaybackPointer = (PlaybackPointer + amount) & (PLAYBACKBUFFERSIZE - 1); ptr+=amount; if (length!=amount) { amount=length-amount; memcpy ( &PlaybackBuffer[PlaybackPointer], ptr, amount); PlaybackPointer = (PlaybackPointer + amount) & (PLAYBACKBUFFERSIZE - 1); } if (PlayingPointer==-1) { Playing=true; PlayingPointer=0; } if (PlaybackPointer==PlayingPointer) { Playback=false; } } //*************************************************************************** // // SD_UpdateRecordingSound - Update recording a sound in chunks // //*************************************************************************** extern int whereami; void SD_UpdateRecordingSound ( char * ptr, int length ) { int amount; whereami = 69; if ( Recording==false ) { return; } whereami = 70; amount=length; if (RecordingPointer+length > RECORDINGBUFFERSIZE) amount=RECORDINGBUFFERSIZE-RecordingPointer; memcpy ( &RecordingBuffer[RecordingPointer], ptr, amount); whereami = 71; RecordingPointer = (RecordingPointer + amount) & (RECORDINGBUFFERSIZE - 1); if (length!=amount) { ptr += amount; amount=length-amount; memcpy ( &RecordingBuffer[RecordingPointer], ptr, amount); RecordingPointer = (RecordingPointer + amount) & (RECORDINGBUFFERSIZE - 1); } whereami = 72; if (Feeder == false) { Feeder = true; } whereami = 73; if (RecordingPointer==FeederPointer) { Recording=false; } whereami = 74; } //*************************************************************************** // // SD_StartRecordingSound - Start recording a sound in chunks // //*************************************************************************** boolean SD_StartRecordingSound ( void ) { int status; if (SD_Started==false) return false; if (remoteridicule == false) return false; if ( ( Recording==true ) || ( Playback==true ) || (Feeder==true)) { return false; } Recording=true; RecordingBuffer = SafeMalloc (RECORDINGBUFFERSIZE); Feeder = false; FeederPointer = -1; RecordingPointer = 0; status=FX_StartRecording( RECORDINGSAMPLERATE, SD_UpdateRecordingSound); if (status!=FX_Ok) { Recording=false; SafeFree(RecordingBuffer); return false; } return true; } //*************************************************************************** // // SD_StopRecordingSound - Stop recording a sound // //*************************************************************************** void SD_StopRecordingSound ( void ) { if (SD_Started==false) return; if (Recording == true) { FX_StopRecord(); Recording=false; } } //*************************************************************************** // // SD_SetRecordingActive - Set the recording active flag // //*************************************************************************** void SD_SetRecordingActive ( void ) { RecordingSemaphore=true; } //*************************************************************************** // // SD_ClearRecordingActive - Clear the recording active flag // //*************************************************************************** void SD_ClearRecordingActive ( void ) { RecordingSemaphore=false; } //*************************************************************************** // // SD_RecordingActive - Check if recording is active on some system // //*************************************************************************** boolean SD_RecordingActive ( void ) { return RecordingSemaphore; } //*************************************************************************** // // SD_GetSoundData - Returns next piece of sound data, returns: // // nodata if no sound data is ready // newsound if it is the start of a new sound // data is also returned; // endsound if the sound is finished // data if data is ready // //*************************************************************************** recordstate SD_GetSoundData ( byte * data, word length ) { recordstate status=rs_data; int amount; if (SD_Started==false) return rs_nodata; if (Feeder==false) return rs_nodata; if (FeederPointer==RecordingPointer) { if (Recording==false) { SafeFree(RecordingBuffer); Feeder=false; return rs_endsound; } else { return rs_nodata; } } if (FeederPointer==-1) { status=rs_newsound; FeederPointer=0; } amount=length; if (FeederPointer+length > RECORDINGBUFFERSIZE) amount=RECORDINGBUFFERSIZE-FeederPointer; memcpy ( data, &RecordingBuffer[FeederPointer], amount); FeederPointer = (FeederPointer + amount) & (RECORDINGBUFFERSIZE - 1); data += amount; if (length!=amount) { amount=length-amount; memcpy ( data, &RecordingBuffer[FeederPointer], amount); FeederPointer = (FeederPointer + amount) & (RECORDINGBUFFERSIZE - 1); } return status; } //*************************************************************************** // // SD_SoundDataReady - Returns true if data is ready // //*************************************************************************** boolean SD_SoundDataReady ( void ) { if (SD_Started==false) return false; return Feeder; } rott-20230810/rott/rt_dmand.h000066400000000000000000000072621446517470200157150ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_dmand_public #define _rt_dmand_public typedef enum { rs_nodata, rs_newsound, rs_endsound, rs_data } recordstate; //*************************************************************************** // // SD_StartIncomingSound - Setup to receive an incoming sound in chunks // //*************************************************************************** void SD_StartIncomingSound ( void ); //*************************************************************************** // // SD_StopIncomingSound - Stop receiving an incoming sound and playback // //*************************************************************************** void SD_StopIncomingSound ( void ); //*************************************************************************** // // SD_UpdateIncomingSound - Update an incoming sound // //*************************************************************************** void SD_UpdateIncomingSound ( byte * data, word length ); //*************************************************************************** // // SD_GetSoundData - Returns next piece of sound data, returns: // // nodata if no sound data is ready // newsound if it is the start of a new sound // data is also returned; // data if data is ready // //*************************************************************************** recordstate SD_GetSoundData ( byte * data, word length ); //*************************************************************************** // // SD_SoundDataReady - Returns true if data is ready // //*************************************************************************** boolean SD_SoundDataReady ( void ); //*************************************************************************** // // SD_SetRecordingActive - Set the recording active flag // //*************************************************************************** void SD_SetRecordingActive ( void ); //*************************************************************************** // // SD_ClearRecordingActive - Clear the recording active flag // //*************************************************************************** void SD_ClearRecordingActive ( void ); //*************************************************************************** // // SD_RecordingActive - Check if recording is active on some system // //*************************************************************************** boolean SD_RecordingActive ( void ); //*************************************************************************** // // SD_StartRecordingSound - Start recording a sound in chunks // //*************************************************************************** boolean SD_StartRecordingSound ( void ); //*************************************************************************** // // SD_StopRecordingSound - Stop recording a sound // //*************************************************************************** void SD_StopRecordingSound ( void ); #endif rott-20230810/rott/rt_door.c000066400000000000000000002506321446517470200155710ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "rt_sound.h" #include "rt_door.h" #include "rt_actor.h" #include "rt_stat.h" #include "_rt_door.h" #include "z_zone.h" #include "w_wad.h" #include "rt_ted.h" #include "rt_draw.h" #include "rt_main.h" #include "rt_playr.h" #include "rt_util.h" #include "rt_menu.h" #include "rt_ted.h" #include "rt_msg.h" #include "rt_game.h" #include "rt_vid.h" #include "rt_net.h" #include "isr.h" #include "develop.h" #include "rt_rand.h" #include "engine.h" #include #include /*============================================================================= DOORS doorobjlist[] holds most of the information for the doors Open doors conect two areas, so sounds will travel between them and sight will be checked when the player is in a connected area. Areaconnect is incremented/decremented by each door. If >0 they connect Every time a door opens or closes the areabyplayer matrix gets recalculated. An area is true if it connects with the player's current spor. ============================================================================= */ // Global Variables #define ELEVATORMUSICTIME 560 elevator_t ELEVATOR[MAXELEVATORS]; int _numelevators; animmaskedwallobj_t* FIRSTANIMMASKEDWALL,*LASTANIMMASKEDWALL; maskedwallobj_t* FIRSTMASKEDWALL,*LASTMASKEDWALL; byte touchindices[MAPSIZE][MAPSIZE],lasttouch; touchplatetype *touchplate[MAXTOUCHPLATES],*lastaction[MAXTOUCHPLATES]; byte numactions[MAXTOUCHPLATES]; int totalactions; byte TRIGGER[MAXTOUCHPLATES]; doorobj_t *doorobjlist[MAXDOORS]; int doornum; maskedwallobj_t *maskobjlist[MAXMASKED]; int maskednum; pwallobj_t *pwallobjlist[MAXPWALLS]; int pwallnum; byte areaconnect[NUMAREAS][NUMAREAS]; boolean areabyplayer[NUMAREAS]; // Local Variables static void (*touchactions[NUMTOUCHPLATEACTIONS])(intptr_t) = {ActivatePushWall, ActivateMoveWall, LinkedOpenDoor, LinkedCloseDoor, EnableObject, DisableObject, ActivateLight, DeactivateLight}; void UtilizeDoor (int door,void (*action)(int)); void UseDoor (int door); void Teleport(elevator_t*eptr,int destination); void ConnectPushWall (int pwall); void SetupPushWall (int pwall); void WallMoving (int pwall); int SetNextAction(elevator_t*eptr,int action); /* =============== = = MakeMaskedWallActive = =============== */ void MakeMaskedWallActive(maskedwallobj_t* tmwall) {if (!FIRSTMASKEDWALL) FIRSTMASKEDWALL = tmwall; else {tmwall->prev = LASTMASKEDWALL; LASTMASKEDWALL->next = tmwall; } LASTMASKEDWALL = tmwall; } /* =============== = = MakeMaskedWallInactive = =============== */ void MakeMaskedWallInactive(maskedwallobj_t* tmwall) { if (tmwall == LASTMASKEDWALL) LASTMASKEDWALL = tmwall->prev; else tmwall->next->prev = tmwall->prev; if (tmwall == FIRSTMASKEDWALL) FIRSTMASKEDWALL = tmwall->next; else tmwall->prev->next = tmwall->next; tmwall->prev = NULL; tmwall->next = NULL; } /* =============== = = ActivateAnimMaskedWall = =============== */ void ActivateAnimMaskedWall(animmaskedwallobj_t* amwall) { if (!FIRSTANIMMASKEDWALL) FIRSTANIMMASKEDWALL = amwall; else { amwall->prev = LASTANIMMASKEDWALL; LASTANIMMASKEDWALL->next = amwall; } LASTANIMMASKEDWALL = amwall; } /* =============== = = DeactivateAnimMaskedWall = =============== */ void DeactivateAnimMaskedWall(animmaskedwallobj_t* amwall) { if (amwall == LASTANIMMASKEDWALL) LASTANIMMASKEDWALL = amwall->prev; else amwall->next->prev = amwall->prev; if (amwall == FIRSTANIMMASKEDWALL) FIRSTANIMMASKEDWALL = amwall->next; else amwall->prev->next = amwall->next; amwall->prev = NULL; amwall->next = NULL; } int PlatformHeight(int tilex,int tiley) { int platform; if (!IsPlatform(tilex,tiley)) return nominalheight; platform = MAPSPOT(tilex,tiley,2); switch(platform) { case 1: return -10; case 4: return nominalheight; case 5: case 6: return nominalheight - 64; case 7: return nominalheight; case 8: case 9: return -10; } return -1000; } void SpawnAnimatedMaskedWall ( int num ) { animmaskedwallobj_t * temp; temp = (animmaskedwallobj_t *)Z_LevelMalloc(sizeof(animmaskedwallobj_t),PU_LEVELSTRUCT,NULL); if (!temp) Error("SpawnAnimatedMaskedWall: Failed on allocation of animated masked wall"); temp->num=num; temp->count=AMW_NUMFRAMES; temp->ticcount=AMW_TICCOUNT; temp->next=NULL; temp->prev=NULL; ActivateAnimMaskedWall(temp); } void KillAnimatedMaskedWall ( animmaskedwallobj_t * temp ) { DeactivateAnimMaskedWall(temp); Z_Free(temp); } void DoAnimatedMaskedWalls ( void ) { boolean done; animmaskedwallobj_t * temp; for(temp=FIRSTANIMMASKEDWALL;temp;) { done=false; temp->ticcount-=tics; while (temp->ticcount<0) { temp->ticcount+=AMW_TICCOUNT; temp->count--; maskobjlist[temp->num]->bottomtexture++; if (temp->count==0) { done=true; break; } } if (done==true) { animmaskedwallobj_t * temp2; temp2=temp->next; KillAnimatedMaskedWall(temp); temp=temp2; } else temp=temp->next; } } int GetIndexForAction(void (*action)(intptr_t)) {int i; for(i=0;inextaction) { dummy.tictime = temp->tictime; dummy.ticcount = temp->ticcount; dummy.triggered = temp->triggered; dummy.done = temp->done; dummy.complete = temp->complete; if (temp->action) dummy.actionindex = GetIndexForAction(temp->action); else dummy.actionindex = -1; if (temp->swapaction) dummy.swapactionindex = GetIndexForAction(temp->swapaction); else dummy.swapactionindex = -1; if ((dummy.actionindex > 5) || (dummy.swapactionindex > 5)) // means whichobj holds pointer to actor { statobj_t *tstat; tstat = (statobj_t*)(temp->whichobj); dummy.whichobj = (tstat->whichstat|FL_TSTAT); } else if ((dummy.actionindex > 3) || (dummy.swapactionindex > 3)) { objtype *tactor; tactor = (objtype*)(temp->whichobj); dummy.whichobj = (tactor->whichactor|FL_TACT); } else dummy.whichobj = temp->whichobj; memcpy(tptr,&dummy,sizeof(saved_touch_type)); tptr+=sizeof(saved_touch_type); } } } statobj_t* GetStatForIndex(int index) {statobj_t *temp; for(temp = FIRSTSTAT;temp;temp=temp->statnext) if (temp->whichstat == index) return temp; SoftError("\nstat not found in GetStatForIndex"); return NULL; } void LoadTouchPlates(byte * buffer, int size) {touchplatetype *temp; int i,savedactions,loadedactions,index=0; saved_touch_type dummy; savedactions = (size-sizeof(TRIGGER)-sizeof(numactions))/sizeof(saved_touch_type); memset(touchplate,0,sizeof(touchplate)); memset(lastaction,0,sizeof(lastaction)); memset(numactions,0,sizeof(numactions)); totalactions = 0; memcpy(&TRIGGER[0],buffer,sizeof(TRIGGER)); buffer += sizeof(TRIGGER); memcpy(&numactions[0],buffer,sizeof(numactions)); buffer += sizeof(numactions); for(loadedactions=0,index=0,i=0;itictime = dummy.tictime; temp->ticcount = dummy.ticcount; temp->triggered = dummy.triggered; temp->done = dummy.done; temp->complete = dummy.complete; if (dummy.whichobj & FL_TACT) temp->whichobj = (intptr_t)(objlist[dummy.whichobj & ~FL_TACT]); else if (dummy.whichobj & FL_TSTAT) temp->whichobj = (intptr_t)(GetStatForIndex(dummy.whichobj & ~FL_TSTAT)); else temp->whichobj = dummy.whichobj; if (dummy.actionindex != -1) temp->action = touchactions[dummy.actionindex]; else temp->action = NULL; if (dummy.swapactionindex != -1) temp->swapaction = touchactions[dummy.swapactionindex]; else temp->swapaction = NULL; buffer+=sizeof(saved_touch_type); while (!numactions[index]) index ++; AddTouchplateAction(temp,index); /*if (touchplate[index]) lastaction[index]->nextaction = temp; else touchplate[index] = temp; lastaction[index] = temp;*/ totalactions ++; loadedactions++; if (loadedactions == numactions[index]) // found end of a touchplate's actions, goto next touch. {loadedactions = 0; index++; } } SafeFree(objlist); } void AddTouchplateAction(touchplatetype *tplate,int index) { if (touchplate[index]) {tplate->prevaction = lastaction[index]; lastaction[index]->nextaction = tplate; } else touchplate[index] = tplate; lastaction[index] = tplate; } void RemoveTouchplateAction(touchplatetype *tplate,int index) { if (tplate == lastaction[index]) // remove from master list lastaction[index] = tplate->prevaction; else tplate->nextaction->prevaction = tplate->prevaction; if (tplate == touchplate[index]) touchplate[index] = tplate->nextaction; else tplate->prevaction->nextaction = tplate->nextaction; Z_Free(tplate); numactions[index]--; totalactions--; } void Link_To_Touchplate(word touchlocx, word touchlocy, void (*maction)(intptr_t), void (*swapaction)(intptr_t), intptr_t wobj, int delaytime) {touchplatetype *temp; int index; index = touchindices[touchlocx][touchlocy]-1; temp = (touchplatetype*)Z_LevelMalloc(sizeof(touchplatetype),PU_LEVELSTRUCT,NULL); if (!temp) Error("Link_To_Touchplate: Failed on allocation of touchplate\n"); memset(temp,0,sizeof(*temp)); temp->action = maction; temp->swapaction = swapaction; temp->whichobj = wobj; temp->tictime = temp->ticcount = delaytime; AddTouchplateAction(temp,index); /*if(touchplate[index]) lastaction[index]->nextaction=temp; else touchplate[index] = temp; lastaction[index] = temp;*/ numactions[index]++; totalactions++; } void ClockLink (void (*saction)(intptr_t), void (*eaction)(intptr_t), intptr_t wobj,int whichclock) {touchplatetype*temp; // adding two actions per clock temp = (touchplatetype*)Z_LevelMalloc(sizeof(touchplatetype),PU_LEVELSTRUCT,NULL); if (!temp) Error("ClockLink: Failed on allocation of clock"); memset(temp,0,sizeof(*temp)); temp->action = saction; temp->swapaction = eaction; temp->whichobj = wobj; temp->clocktype = 1; AddTouchplateAction(temp,whichclock); /* if(touchplate[whichclock]) lastaction[whichclock]->nextaction = temp; else touchplate[whichclock] = temp; lastaction[whichclock]=temp;*/ numactions[whichclock]++; totalactions ++; } void DisplayMessageForAction(touchplatetype *temp, boolean *wallmessage, boolean *doormessage, boolean*columnmessage) { if ((temp->action == ActivatePushWall) || (temp->action == ActivateMoveWall) ) { if (*wallmessage == false) { if (temp->clocktype) AddMessage("Time-delay wall moves.",MSG_GAME); else AddMessage("A wall moves.",MSG_GAME); *wallmessage = true; } } else if (temp->action == LinkedCloseDoor) { if (*doormessage == false) { if (temp->clocktype) AddMessage("Time-delay door closes.",MSG_GAME); else AddMessage("A door closes.",MSG_GAME); *doormessage = true; } } else if (temp->action == LinkedOpenDoor) { if (*doormessage == false) { if (temp->clocktype) AddMessage("Time-delay door opens.",MSG_GAME); else AddMessage("A door opens.",MSG_GAME); *doormessage = true; } } else if (temp->action == EnableObject) { objtype *tempactor = (objtype*)(temp->whichobj); if (M_ISACTOR(tempactor) && (tempactor->obclass == pillarobj)) { if (*columnmessage == false) { if (temp->clocktype) AddMessage("Time-delay column moves.",MSG_GAME); else AddMessage("A column moves.",MSG_GAME); *columnmessage = true; } } } } void TriggerStuff(void) { touchplatetype *temp; int i,touchcomplete,j; int playeron; void (*tempact)(intptr_t); boolean wallmessage,doormessage,columnmessage; for(i=0;itilex ][ PLAYER[ j ]->tiley ] - 1 ) { playeron = true; break; } } #if (BNACRASHPREVENT == 1) //SetTextMode ( ); qwert // CRASH IN SHAREWARE 'ride em cowboy' BNA FIX // DONT ALLOW BAD touchplate ( == 0 ) see rt_playr.c if (touchplate[i] == 0) {continue;} #endif if (!TRIGGER[i]) continue; else if (touchplate[i]->complete) { if (!playeron) TRIGGER[i] = 0; continue; } if (touchplate[i]->done) { if (!playeron) { for(temp = touchplate[i];temp;temp = temp->nextaction) temp->triggered=false; TRIGGER[i] = 0; touchplate[i]->done = false; } } else { wallmessage = false; doormessage = false; columnmessage = false; for(temp = touchplate[i];temp;temp = temp->nextaction) { if (temp->action && (!temp->triggered)) { if (!temp->ticcount) { temp->action(temp->whichobj); if (temp->action == ActivateMoveWall) { int tilex,tiley; tilex = pwallobjlist[temp->whichobj]->tilex; tiley = pwallobjlist[temp->whichobj]->tiley; tilemap[tilex][tiley] = 0; } if (gamestate.difficulty == gd_baby) { DisplayMessageForAction(temp,&wallmessage,&doormessage,&columnmessage); } tempact = temp->action; temp->action = temp->swapaction; temp->swapaction = tempact; temp->ticcount = temp->tictime; temp->triggered = true; } else temp->ticcount --; } } //done: // check to see if any actions will ever be triggered by this // touchplate again; if not, null touchplate out; else, // check status of other actions touchcomplete = 1; for(temp = touchplate[i];temp;temp = temp->nextaction) { if (temp->action) { touchcomplete = 0; break; } } if (touchcomplete) touchplate[i]->complete = 1; // this touchplate is out of commission else { touchplate[i]->done = true; for(temp = touchplate[i];temp;temp = temp->nextaction) { if (temp->action && (!temp->triggered)) { touchplate[i]->done = false; break; } } } } } } //==================== Tile stuff ==================================== boolean CheckTile(int x, int y) { if ((x < 2) || (x > (MAPSIZE-1)) || (y < 2) || (y > (MAPSIZE - 1))) return false; if (actorat[x][y]) {objtype *check = (objtype*)(actorat[x][y]); if (insetupgame) return false; if (!(M_ISACTOR(check) && (check->obclass == playerobj))) return false; } if (DiskAt(x,y)) return false; if (sprites[x][y]) return false; if ((tilemap[x][y]) && (IsPlatform(x,y)==false)) return false; if ((AREANUMBER(x,y)<=0) || (AREANUMBER(x,y)>NUMAREAS)) return false; if (IsWindow(x,y)) return false; return true; } #define CountTile(x,y) \ { \ if (oldarea == AREANUMBER(x,y))\ {if (CheckTile(x,y)) \ numemptytiles ++; \ \ areanumbercount++; \ if (areanumbercount == numareatiles[oldarea])\ return numemptytiles; \ } \ \ } \ int Number_of_Empty_Tiles_In_Area_Around(int x, int y) {int roverx,rovery,areanumbercount=0, numemptytiles=0,oldarea,i,limit,j; oldarea = AREANUMBER(x,y); for (i=1;;i++) {roverx = x-i; rovery = y-i; CountTile(roverx,rovery); limit = i<<1; for(j=0;jobclass == diskobj) && (ob->flags & FL_MASTER)) memset (areabyplayer,0,sizeof(areabyplayer)); for (i=0;iareanumber] = true; RecursiveConnect (PLAYER[i]->areanumber); } for(temp=FIRSTACTOR;temp;temp=temp->next) { if (MASTER_DISK(temp)) continue; if (!areabyplayer[temp->areanumber]) continue; if (!(temp->flags & FL_ABP)) {temp->flags |= FL_ABP; MakeActive(temp); } } for(tstat=FIRSTSTAT;tstat;tstat=tstat->statnext) {if (areabyplayer[tstat->areanumber]) {if (!(tstat->flags & FL_ABP)) {tstat->flags |= FL_ABP; MakeStatActive(tstat); } } else if (tstat->flags & FL_ABP) {MakeStatInactive(tstat); tstat->flags &= ~FL_ABP; } } for(i=0;iareanumber]) {if (!(maskobjlist[i]->flags & MW_ABP)) {maskobjlist[i]->flags |= MW_ABP; MakeMaskedWallActive(maskobjlist[i]); } } else if (maskobjlist[i]->flags & MW_ABP) {MakeMaskedWallInactive(maskobjlist[i]); maskobjlist[i]->flags &= ~MW_ABP; } } } void InitAreas (void) { memset (areabyplayer,0,sizeof(areabyplayer)); memset (areaconnect,0,sizeof(areaconnect)); } /* =============== = = InitDoorList = =============== */ void InitDoorList (void) { doornum=0; pwallnum=0; maskednum=0; lasttouch = 0; numclocks=0; memset(touchindices,0,sizeof(touchindices)); memset(touchplate,0,sizeof(touchplate)); memset(lastaction,0,sizeof(lastaction)); memset(numactions,0,sizeof(numactions)); totalactions = 0; memset(TRIGGER,0,sizeof(TRIGGER)); memset(Clocks,0,sizeof(Clocks)); FIRSTMASKEDWALL=NULL; LASTMASKEDWALL=NULL; FIRSTANIMMASKEDWALL=NULL; LASTANIMMASKEDWALL=NULL; } /* =============== = = IsWall = =============== */ int IsWall (int tilex, int tiley) { int map; map=MAPSPOT(tilex,tiley,0); if ((map>=1) && (map<=89)) return 1; else if ((map>=106) && (map<=107)) return 1; else if ((map>=224) && (map<=233)) return 1; else if ((map>=242) && (map<=244)) return 1; return 0; } /* =============== = = InitElevators = =============== */ void InitElevators(void) {_numelevators = 0; memset(ELEVATOR,0,sizeof(ELEVATOR)); } /* =============== = = IsDoor = =============== */ int IsDoor (int tilex, int tiley) { int map; map=MAPSPOT(tilex,tiley,0); if ((map>=33) && (map<=35)) return 1; if ((map>=90) && (map<=104)) return 1; if ((map>=154) && (map<=156)) return 1; if (M_ISDOOR(tilex,tiley)) return 1; return 0; } /* =============== = = SpawnDoor = =============== */ void SpawnDoor (int tilex, int tiley, int lock, int texture) { int i; doorobj_t * lastdoorobj; int up,dn,lt,rt; int basetexture; doorobjlist[doornum]=(doorobj_t*)Z_LevelMalloc(sizeof(doorobj_t),PU_LEVELSTRUCT,NULL); if (!doorobjlist[doornum]) Error("SpawnDoor: Failed on allocation of door %d ",doornum); memset(doorobjlist[doornum],0,sizeof(doorobj_t)); lastdoorobj=doorobjlist[doornum]; if ( ( MAPSPOT(tilex,tiley,1) >= 29 ) && ( MAPSPOT(tilex,tiley,1) <= 32 ) ) { lock = MAPSPOT(tilex,tiley,1) - 28; } lastdoorobj->position = 0; lastdoorobj->tilex = tilex; lastdoorobj->tiley = tiley; lastdoorobj->lock = lock; lastdoorobj->action = dr_closed; lastdoorobj->which = DOOR; lastdoorobj->flags = 0; lastdoorobj->eindex = -1; // // make the door space solid // if (loadedgame==false) actorat[tilex][tiley] = lastdoorobj; if (IsDoor(tilex,tiley-1)) up=2; else if (IsWall(tilex,tiley-1)) up=1; else up=0; if (IsDoor(tilex,tiley+1)) dn=2; else if (IsWall(tilex,tiley+1)) dn=1; else dn=0; if (IsDoor(tilex-1,tiley)) lt=2; else if (IsWall(tilex-1,tiley)) lt=1; else lt=0; if (IsDoor(tilex+1,tiley)) rt=2; else if (IsWall(tilex+1,tiley)) rt=1; else rt=0; if ((up==1) && (dn==1)) lastdoorobj->vertical = true; else if ((lt==1) && (rt==1)) lastdoorobj->vertical = false; else if ((up>0) && (dn>0)) lastdoorobj->vertical = true; else if ((lt>0) && (rt>0)) lastdoorobj->vertical = false; else if (up>0) lastdoorobj->vertical = true; else if (dn>0) lastdoorobj->vertical = true; else if (lt>0) lastdoorobj->vertical = false; else if (rt>0) lastdoorobj->vertical = false; switch (texture) { case 0: case 8: basetexture = W_GetNumForName("RAMDOOR1\0"); break; case 1: case 9: basetexture = W_GetNumForName("DOOR2\0"); break; case 2: case 3: case 13: basetexture = W_GetNumForName("TRIDOOR1\0"); break; case 10: case 11: case 14: basetexture = W_GetNumForName("SDOOR4\0"); break; case 12: basetexture = W_GetNumForName("EDOOR\0"); break; case 15: basetexture = W_GetNumForName("SNDOOR\0"); break; case 16: basetexture = W_GetNumForName("SNADOOR\0"); break; case 17: basetexture = W_GetNumForName("SNKDOOR\0"); break; case 18: basetexture = W_GetNumForName("TNDOOR\0"); break; case 19: basetexture = W_GetNumForName("TNADOOR\0"); break; case 20: basetexture = W_GetNumForName("TNKDOOR\0"); break; default: Error("Illegal door value encountered\n"); break; } lastdoorobj->basetexture = basetexture; lastdoorobj->texture = lastdoorobj->basetexture; SD_PreCacheSoundGroup(SD_OPENDOORSND,SD_CLOSEDOORSND); // // make the door tile a special tile, and mark the adjacent tiles // for door sides // tilemap[tilex][tiley] = doornum | 0x8000; switch (texture) { case 0: case 1: case 2: case 3: case 8: case 9: case 10: case 11: case 12: case 13: case 14: lastdoorobj->sidepic = W_GetNumForName("SIDE8"); lastdoorobj->alttexture = W_GetNumForName("ABOVEW3"); break; case 15: case 16: case 17: #if (SHAREWARE == 1) lastdoorobj->sidepic = W_GetNumForName("SIDE8"); #else lastdoorobj->sidepic = W_GetNumForName("SIDE16"); #endif lastdoorobj->alttexture = W_GetNumForName("ABOVEW16"); break; case 18: case 19: case 20: #if (SHAREWARE == 1) lastdoorobj->sidepic = W_GetNumForName("SIDE8"); lastdoorobj->alttexture = W_GetNumForName("ABOVEW3"); #else lastdoorobj->sidepic = W_GetNumForName("SIDE17"); lastdoorobj->alttexture = W_GetNumForName("ABOVEW17"); #endif break; default: Error("Illegal door value encountered\n"); break; } if ((lock>0) && (lock<5)) lastdoorobj->sidepic = W_GetNumForName("lock1")+lock-1; PreCacheLump(lastdoorobj->sidepic,PU_CACHEWALLS,cache_pic_t); PreCacheLump(lastdoorobj->alttexture,PU_CACHEWALLS,cache_pic_t); if (lastdoorobj->vertical==true) { if (up==1) tilemap[tilex][tiley-1] |= 0x4000; else if (up==2) lastdoorobj->flags|=DF_MULTI; if (dn==1) tilemap[tilex][tiley+1] |= 0x4000; else if (dn==2) lastdoorobj->flags|=DF_MULTI; } else { if (lt==1) tilemap[tilex-1][tiley] |= 0x4000; else if (lt==2) lastdoorobj->flags|=DF_MULTI; if (rt==1) tilemap[tilex+1][tiley] |= 0x4000; else if (rt==2) lastdoorobj->flags|=DF_MULTI; } PreCacheLump(lastdoorobj->texture,PU_CACHEWALLS,cache_pic_t); for (i=1;i<9;i++) // only first texture is pic_t! PreCacheLump(lastdoorobj->texture+i,PU_CACHEWALLS,cache_patch_t); doornum++; lastdoorobj++; if (doornum==MAXDOORS) Error ("Too many doors on level!"); } /* =============== = = MakeWideDoorVisible = =============== */ void MakeWideDoorVisible ( int doornum ) { int dx,dy; doorobj_t * dr2; doorobj_t * dr; int tx,ty; dr=doorobjlist[doornum]; dx=0;dy=0; if (dr->vertical==true) dy=1; else dx=1; spotvis[dr->tilex][dr->tiley]=1; tx=dr->tilex+dx; ty=dr->tiley+dy; while (M_ISDOOR(tx,ty)) { int num; num=tilemap[tx][ty]&0x3ff; dr2=doorobjlist[num]; if (!(dr2->flags&DF_MULTI)) break; spotvis[tx][ty]=1; tx+=dx; ty+=dy; } tx=dr->tilex-dx; ty=dr->tiley-dy; while (M_ISDOOR(tx,ty)) { int num; num=tilemap[tx][ty]&0x3ff; dr2=doorobjlist[num]; if (!(dr2->flags&DF_MULTI)) break; spotvis[tx][ty]=1; tx-=dx; ty-=dy; } } /* ===================== = = LockLinkedDoor = ===================== */ void LockLinkedDoor (int door) { doorobj_t*dptr; dptr = doorobjlist[door]; if (!dptr->lock) dptr->lock=5; } /* ===================== = = IsDoorLinked = ===================== */ boolean IsDoorLinked (int door) { doorobj_t*dptr; dptr = doorobjlist[door]; if (dptr->lock==5) return true; return false; } /* =============== = = FixDoorAreaNumbers = =============== */ void FixDoorAreaNumbers ( void ) { int i; int up,dn,lt,rt; int tilex,tiley; for (i=0;itilex; tiley=doorobjlist[i]->tiley; up=MAPSPOT(tilex,tiley-1,0)-AREATILE; dn=MAPSPOT(tilex,tiley+1,0)-AREATILE; lt=MAPSPOT(tilex-1,tiley,0)-AREATILE; rt=MAPSPOT(tilex+1,tiley,0)-AREATILE; up = ((up>0) && (up<=NUMAREAS)); dn = ((dn>0) && (dn<=NUMAREAS)); lt = ((lt>0) && (lt<=NUMAREAS)); rt = ((rt>0) && (rt<=NUMAREAS)); if (doorobjlist[i]->vertical==true) { if (rt) MAPSPOT(tilex,tiley,0) = MAPSPOT(tilex+1,tiley,0); else if (lt) MAPSPOT(tilex,tiley,0) = MAPSPOT(tilex-1,tiley,0); else Error("FixDoors: Couldn't fix up area at x=%d y=%d\n",tilex,tiley); } else { if (dn) MAPSPOT(tilex,tiley,0) = MAPSPOT(tilex,tiley+1,0); else if (up) MAPSPOT(tilex,tiley,0) = MAPSPOT(tilex,tiley-1,0); else Error("FixDoors: Couldn't fix up area at x=%d y=%d\n",tilex,tiley); } if (IsDoorLinked(i)) UtilizeDoor(i,LockLinkedDoor); } } //=========================================================================== /* ===================== = = OpenDoor = ===================== */ void OpenDoor (int door) { if (doorobjlist[door]->action == dr_open) doorobjlist[door]->ticcount = 0; // reset open time else { doorobjlist[door]->action = dr_opening; // start it opening } } /* ===================== = = DoorUnBlocked = ===================== */ boolean DoorUnBlocked (int door) { int tilex,tiley; objtype *check; doorobj_t*dptr; dptr = doorobjlist[door]; // // don't close on anything solid // tilex = dptr->tilex; tiley = dptr->tiley; check = (objtype*)actorat[tilex][tiley]; if (check && (check->which == ACTOR)) return false; if (dptr->vertical==true) { check = (objtype*)actorat[tilex-1][tiley]; if (check && (check->which==ACTOR) && ((check->x+MINDIST) >> TILESHIFT) == tilex ) return false; check = (objtype*)actorat[tilex+1][tiley]; if (check && (check->which==ACTOR) && ((check->x-MINDIST) >> TILESHIFT) == tilex ) return false; } else if (dptr->vertical==false) { check = (objtype*)actorat[tilex][tiley-1]; if (check && (check->which==ACTOR) && ((check->y+MINDIST) >> TILESHIFT) == tiley ) return false; check = (objtype*)actorat[tilex][tiley+1]; if (check && (check->which==ACTOR) && ((check->y-MINDIST) >> TILESHIFT) == tiley ) return false; } return true; } /* ===================== = = DoorReadyToClose = = Alter the door's state = ===================== */ boolean DoorReadyToClose(int door) { doorobj_t*dptr; int dx,dy; doorobj_t * dr2; int tx,ty; dptr = doorobjlist[door]; if (dptr->action==dr_closed) return true; if (DoorUnBlocked(door)==false) return false; dx=0;dy=0; if (dptr->vertical==true) dy=1; else dx=1; tx=dptr->tilex+dx; ty=dptr->tiley+dy; while (M_ISDOOR(tx,ty)) { int num; num=tilemap[tx][ty]&0x3ff; dr2=doorobjlist[num]; if (!(dr2->flags&DF_MULTI)) break; if (DoorUnBlocked(num)==false) return false; tx+=dx; ty+=dy; } tx=dptr->tilex-dx; ty=dptr->tiley-dy; while (M_ISDOOR(tx,ty)) { int num; num=tilemap[tx][ty]&0x3ff; dr2=doorobjlist[num]; if (!(dr2->flags&DF_MULTI)) break; if (DoorUnBlocked(num)==false) return false; tx-=dx; ty-=dy; } return true; } /* ===================== = = CloseDoor = ===================== */ void CloseDoor (int door) { int tilex,tiley,area; doorobj_t*dptr; dptr = doorobjlist[door]; if (dptr->action == dr_closed) return; tilex = dptr->tilex; tiley = dptr->tiley; // // play door sound // area = MAPSPOT(tilex,tiley,0)-AREATILE; if (areabyplayer[area]) { dptr->soundhandle=SD_PlaySoundRTP ( SD_CLOSEDOORSND, dptr->tilex<<16, dptr->tiley<<16 ); } dptr->action = dr_closing; // // make the door space solid // actorat[tilex][tiley] = dptr; } /* ===================== = = OperateDoor = = The player wants to change the door's direction = ===================== */ void OperateDoor (int keys, int door, boolean localplayer ) { int lock; doorobj_t*dptr; dptr = doorobjlist[door]; if ( ( dptr->flags & DF_ELEVLOCKED ) || ( MISCVARS->GASON && ( MAPSPOT( dptr->tilex, dptr->tiley, 1 ) == GASVALUE ) ) ) { if ( localplayer ) { // locked SD_Play ( SD_NOITEMSND ); } return; } lock = dptr->lock; if ( lock && !( keys & ( 1 << ( lock - 1 ) ) ) ) { if ( localplayer ) { // locked switch (lock) { case 1: AddMessage("You need the \\EGOLD key",MSG_DOOR); break; case 2: AddMessage("You need the \\FSILVER key",MSG_DOOR); break; case 3: AddMessage("You need the \\8IRON key",MSG_DOOR); break; case 4: AddMessage("You need the \\AOSCURO key",MSG_DOOR); break; default: AddMessage("This door appears to be locked",MSG_DOOR); break; } SD_Play( SD_NOITEMSND ); } return; } UseDoor(door); } /* ===================== = = LinkedOpenDoor = ===================== */ void LinkedOpenDoor (intptr_t door) { UtilizeDoor(door,OpenDoor); } /* ===================== = = LinkedCloseDoor = ===================== */ void LinkedCloseDoor (intptr_t door) { if (DoorReadyToClose(door)==true) UtilizeDoor(door,CloseDoor); } /* ===================== = = UtilizeDoor = = Alter the door's state = ===================== */ void UtilizeDoor (int door,void (*action)(int)) { doorobj_t*dptr; int dx,dy; doorobj_t * dr2; int tx,ty; dptr = doorobjlist[door]; action(door); dx=0;dy=0; if (dptr->vertical==true) dy=1; else dx=1; tx=dptr->tilex+dx; ty=dptr->tiley+dy; while (M_ISDOOR(tx,ty)) { int num; num=tilemap[tx][ty]&0x3ff; dr2=doorobjlist[num]; if (!(dr2->flags&DF_MULTI)) break; action(num); tx+=dx; ty+=dy; } tx=dptr->tilex-dx; ty=dptr->tiley-dy; while (M_ISDOOR(tx,ty)) { int num; num=tilemap[tx][ty]&0x3ff; dr2=doorobjlist[num]; if (!(dr2->flags&DF_MULTI)) break; action(num); tx-=dx; ty-=dy; } } /* ===================== = = UseDoor = = Alter the door's state = ===================== */ void UseDoor (int door) { switch (doorobjlist[door]->action) { case dr_closing: SD_StopSound(doorobjlist[door]->soundhandle); case dr_closed: UtilizeDoor(door,OpenDoor); break; case dr_opening: SD_StopSound(doorobjlist[door]->soundhandle); case dr_open: if (DoorReadyToClose(door)==true) UtilizeDoor(door,CloseDoor); break; } } //=========================================================================== /* =============== = = DoorOpen = = Close the door after three seconds = =============== */ void DoorOpen (int door) {doorobj_t* dptr; dptr = doorobjlist[door]; dptr->ticcount += 1; if ((dptr->ticcount >= OPENTICS) && (!(dptr->flags & DF_TIMED)) && (DoorReadyToClose(door)==true)) UtilizeDoor(door,CloseDoor); } /* =============== = = DoorOpening = =============== */ void DoorOpening (int door) { int area1,area2; word *map; long position; int tilex,tiley; position = doorobjlist[door]->position; tilex = doorobjlist[door]->tilex; tiley = doorobjlist[door]->tiley; if (!position) { // // door is just starting to open, so connect the areas // map = &MAPSPOT(tilex,tiley,0); if (doorobjlist[door]->vertical==true) { area1 = *(map+1); area2 = *(map-1); } else { area1 = *(map-mapwidth); area2 = *(map+mapwidth); } area1 -= AREATILE; area2 -= AREATILE; areaconnect[area1][area2]++; areaconnect[area2][area1]++; if ((insetupgame==false) && (loadedgame==false)) ConnectAreas (); if (areabyplayer[area1]) { doorobjlist[door]->soundhandle=SD_PlaySoundRTP ( SD_OPENDOORSND, doorobjlist[door]->tilex<<16, doorobjlist[door]->tiley<<16 ); } } // // slide the door by an adaptive amount // position += 1<<12; if (position >= 0xffff) { // // door is all the way open // position = 0xffff; doorobjlist[door]->ticcount = 0; doorobjlist[door]->action = dr_open; if (doorobjlist[door] == actorat[tilex][tiley]) actorat[tilex][tiley] = 0; } doorobjlist[door]->position = position; doorobjlist[door]->texture=doorobjlist[door]->basetexture+((position+1)>>13); } /* =============== = = DoorClosing = =============== */ void DoorClosing (int door) { int area1,area2; word *map; long position; int tilex,tiley; doorobj_t *dptr; dptr = doorobjlist[door]; tilex = dptr->tilex; tiley = dptr->tiley; position = dptr->position; // // slide the door by an adaptive amount // position -= 1<<12; if (position < (0xffff >> 1)) ResolveDoorSpace(tilex,tiley); if (position <= 0) { // // door is closed all the way, so disconnect the areas // position = 0; dptr->action = dr_closed; map = &MAPSPOT(tilex,tiley,0); if (areabyplayer[(*map-AREATILE)]) { dptr->soundhandle=SD_PlaySoundRTP ( SD_DOORHITSND, dptr->tilex<<16, dptr->tiley<<16 ); } if (dptr->vertical==true) { area1 = *(map+1); area2 = *(map-1); } else { area1 = *(map-mapwidth); area2 = *(map+mapwidth); } area1 -= AREATILE; area2 -= AREATILE; areaconnect[area1][area2]--; areaconnect[area2][area1]--; ConnectAreas (); } dptr->position = position; dptr->texture=dptr->basetexture+((position+1)>>13); } /* =============== = = IsMaskedWall = =============== */ int IsMaskedWall (int tilex, int tiley) { int map; if (IsPlatform(tilex,tiley)) return 1; map=MAPSPOT(tilex,tiley,0); if ((map>=157) && (map<=160)) return 1; if ((map>=162) && (map<=179)) return 1; if (M_ISMWALL(tilex,tiley)) return 1; return 0; } /* =============== = = SpawnMaskedWall = =============== */ void SpawnMaskedWall (int tilex, int tiley, int which, int flags) {word *map; int area1, area2; int up,dn,lt,rt; int himask; boolean sidepic; int side, middle, above, bottom; maskedwallobj_t * lastmaskobj; boolean metal; himask=W_GetNumForName("HMSKSTRT")+1; maskobjlist[maskednum]=(maskedwallobj_t*)Z_LevelMalloc(sizeof(maskedwallobj_t),PU_LEVELSTRUCT,NULL); memset(maskobjlist[maskednum],0,sizeof(maskedwallobj_t)); lastmaskobj=maskobjlist[maskednum]; sidepic=true; lastmaskobj->tilex = tilex; lastmaskobj->tiley = tiley; lastmaskobj->which = MWALL; up=MAPSPOT(tilex,tiley-1,0)-AREATILE; dn=MAPSPOT(tilex,tiley+1,0)-AREATILE; lt=MAPSPOT(tilex-1,tiley,0)-AREATILE; rt=MAPSPOT(tilex+1,tiley,0)-AREATILE; if (IsMaskedWall(tilex,tiley-1)) up=2; else if (IsWall(tilex,tiley-1)) up=1; else up=0; if (IsMaskedWall(tilex,tiley+1)) dn=2; else if (IsWall(tilex,tiley+1)) dn=1; else dn=0; if (IsMaskedWall(tilex-1,tiley)) lt=2; else if (IsWall(tilex-1,tiley)) lt=1; else lt=0; if (IsMaskedWall(tilex+1,tiley)) rt=2; else if (IsWall(tilex+1,tiley)) rt=1; else rt=0; if ((up==1) && (dn==1)) lastmaskobj->vertical = true; else if ((lt==1) && (rt==1)) lastmaskobj->vertical = false; else if ((up>0) && (dn>0)) lastmaskobj->vertical = true; else if ((lt>0) && (rt>0)) lastmaskobj->vertical = false; else if (up>0) lastmaskobj->vertical = true; else if (dn>0) lastmaskobj->vertical = true; else if (lt>0) lastmaskobj->vertical = false; else if (rt>0) lastmaskobj->vertical = false; tilemap[tilex][tiley] = maskednum | 0xc000; map = &MAPSPOT(tilex,tiley,0); if (lastmaskobj->vertical==true) { area1 = *(map+1); area2 = *(map-1); area1 -= AREATILE; area2 -= AREATILE; if (lt==0 && rt==0) { areaconnect[area1][area2]++; areaconnect[area2][area1]++; } } else { area1 = *(map-mapwidth); area2 = *(map+mapwidth); area1 -= AREATILE; area2 -= AREATILE; if (up==0 && dn==0) { areaconnect[area1][area2]++; areaconnect[area2][area1]++; } } lastmaskobj->flags=flags; if (IsPlatform(tilex,tiley)) { if (MAPSPOT(tilex,tiley,0)==21) { metal=true; actorat[tilex][tiley]=0; } else metal=false; } switch (which) { case mw_peephole: //#if (SHAREWARE == 1) side = W_GetNumForName("SIDE21"); middle = W_GetNumForName("ABOVEM4A") ; above = W_GetNumForName("ABOVEM4") ; /* #else side = W_GetNumForName("SIDE16"); middle = W_GetNumForName("ABOVEM3A") ; above = W_GetNumForName("ABOVEM2A") ; #endif */ bottom = W_GetNumForName("PEEPMASK"); break; case mw_dogwall: side = W_GetNumForName("SIDE21"); above = W_GetNumForName("ABOVEM4") ; #if (SHAREWARE == 1) middle = W_GetNumForName("ABOVEM4A") ; #else middle = W_GetNumForName("ABOVEM9") ; #endif bottom = W_GetNumForName("DOGMASK"); break; case mw_multi1: /* #if (SHAREWARE == 1) side = W_GetNumForName("SIDE21"); middle = W_GetNumForName("ABOVEM4A") ; above = W_GetNumForName("ABOVEM4") ; #else */ //side = W_GetNumForName("SIDE23") ; side = W_GetNumForName("SIDE21") ; middle = W_GetNumForName("ABOVEM5A") ; above = W_GetNumForName("ABOVEM5") ; // #endif bottom = W_GetNumForName("MULTI1"); break; case mw_multi2: /* #if (SHAREWARE == 1) side = W_GetNumForName("SIDE21"); middle = W_GetNumForName("ABOVEM4A"); above = W_GetNumForName("ABOVEM4") ; #else */ //side = W_GetNumForName("SIDE23") ; side = W_GetNumForName("SIDE21") ; middle = W_GetNumForName("ABOVEM5B"); above = W_GetNumForName("ABOVEM5") ; //#endif bottom = W_GetNumForName("MULTI2"); break; case mw_multi3: /* #if (SHAREWARE == 1) side = W_GetNumForName("SIDE21"); middle = W_GetNumForName("ABOVEM4A") ; above = W_GetNumForName("ABOVEM4") ; #else */ //side = W_GetNumForName("SIDE23") ; side = W_GetNumForName("SIDE21") ; middle = W_GetNumForName("ABOVEM5C") ; above = W_GetNumForName("ABOVEM5") ; //#endif bottom = W_GetNumForName("MULTI3"); break; case mw_singlepane: // #if (SHAREWARE == 1) side = W_GetNumForName("SIDE21"); // #else // side = W_GetNumForName("SIDE22") ; // #endif middle = W_GetNumForName("ABOVEM4A") ; above = W_GetNumForName("ABOVEM4") ; bottom = W_GetNumForName("MASKED4"); break; case mw_normal1: side = W_GetNumForName("SIDE21"); // #if (SHAREWARE == 1) middle = W_GetNumForName("ABOVEM4A") ; above = W_GetNumForName("ABOVEM4") ; //#else // middle = W_GetNumForName("ABOVEM1A") ; // above = W_GetNumForName("ABOVEM1") ; //#endif bottom = W_GetNumForName("MASKED1"); break; case mw_normal2: side = W_GetNumForName("SIDE21"); //#if (SHAREWARE == 1) middle = W_GetNumForName("ABOVEM4A") ; above = W_GetNumForName("ABOVEM4") ; //#else // middle = W_GetNumForName("ABOVEM2A") ; // above = W_GetNumForName("ABOVEM2") ; //#endif bottom = W_GetNumForName("MASKED2"); break; case mw_normal3: side = W_GetNumForName("SIDE21"); //#if (SHAREWARE == 1) middle = W_GetNumForName("ABOVEM4A") ; above = W_GetNumForName("ABOVEM4") ; //#else // middle = W_GetNumForName("ABOVEM3A") ; // above = W_GetNumForName("ABOVEM3") ; //#endif bottom = W_GetNumForName("MASKED3"); break; case mw_exitarch: side = W_GetNumForName("SIDE21"); //#if (SHAREWARE == 1) middle = W_GetNumForName("ABOVEM4A") ; above = W_GetNumForName("ABOVEM4") ; //#else // middle = W_GetNumForName("ABOVEM6A") ; // above = W_GetNumForName("ABOVEM6") ; //#endif bottom = W_GetNumForName("EXITARCH"); break; case mw_secretexitarch: side = W_GetNumForName("SIDE21"); //#if (SHAREWARE == 1) middle = W_GetNumForName("ABOVEM4A") ; above = W_GetNumForName("ABOVEM4") ; //#else // middle = W_GetNumForName("ABOVEM8A") ; // above = W_GetNumForName("ABOVEM8") ; //#endif bottom = W_GetNumForName("EXITARCA"); break; case mw_railing: sidepic = false; middle = -1; above = -1; bottom = W_GetNumForName("RAILING"); break; case mw_hiswitchon: sidepic = false; middle = himask+1; above = himask+3; bottom = himask; break; case mw_hiswitchoff: sidepic = false; middle = himask+1; above = himask+2; bottom = himask; break; case mw_entrygate: side = W_GetNumForName("SIDE21"); //#if (SHAREWARE == 1) //side = W_GetNumForName("SIDE21"); middle = W_GetNumForName("ABOVEM4A") ; above = W_GetNumForName("ABOVEM4") ; //#else //side = W_GetNumForName("SIDE20") ; // middle = W_GetNumForName("ABOVEM7A") ; // above = W_GetNumForName("ABOVEM7") ; //#endif bottom = W_GetNumForName("ENTRARCH"); break; case mw_platform1: sidepic = false; bottom = -1; middle = -1; above = himask+10; if (metal==true) { bottom = -1; middle = -1; above = himask+15; } break; case mw_platform2: sidepic = false; bottom = himask+8; middle = -1; above = -1; if (metal==true) { bottom = himask+14; middle = -1; above = -1; } else lastmaskobj->flags|=MW_BOTTOMFLIPPING; break; case mw_platform3: sidepic = false; bottom = himask+8; middle = -1; above = himask+10; if (metal==true) { bottom = himask+14; middle = -1; above = himask+15; } else lastmaskobj->flags|=MW_BOTTOMFLIPPING; break; case mw_platform4: sidepic = false; bottom = himask+12; middle = himask+7; above = himask+7; if (metal==true) { bottom = -1; middle = himask+15; above = himask+15; } break; case mw_platform5: sidepic = false; bottom = himask+12; middle = himask+7; above = himask+5; if (metal==true) { bottom = -1; middle = himask+15; above = -1; } else lastmaskobj->flags|=MW_TOPFLIPPING; break; case mw_platform6: sidepic = false; bottom = himask+4; middle = himask+7; above = himask+5; if (metal==true) { bottom = himask+14; middle = himask+15; above = -1; } else lastmaskobj->flags|=MW_TOPFLIPPING; break; case mw_platform7: sidepic = false; bottom = himask+4; middle = himask+7; above = himask+5; if ((up==1) || (dn==1)) lastmaskobj->vertical=true; else if ((lt==1) || (rt==1)) lastmaskobj->vertical=false; else Error("Perpendicular platform used with no wall near it\n"); if (metal==true) { bottom = himask+14; middle = himask+15; above = -1; } else lastmaskobj->flags|=MW_TOPFLIPPING; break; } switch (which) { case mw_multi1: case mw_multi2: case mw_multi3: case mw_singlepane: case mw_normal1: case mw_normal2: case mw_normal3: if (!(flags & MW_SHOOTABLE)) bottom+=9; break; } lastmaskobj->midtexture=middle; lastmaskobj->toptexture=above; lastmaskobj->bottomtexture=bottom; if (sidepic == true) { lastmaskobj->sidepic=side; if (lastmaskobj->vertical==true) { if (up==1) tilemap[tilex][tiley-1] |= 0x4000; if (dn==1) tilemap[tilex][tiley+1] |= 0x4000; } else { if (lt==1) tilemap[tilex-1][tiley] |= 0x4000; if (rt==1) tilemap[tilex+1][tiley] |= 0x4000; } } // Cache in the broken version if (lastmaskobj->flags & MW_SHOOTABLE) { int i; for (i=1;ibottomtexture+i,PU_CACHEWALLS,cache_transpatch_t); } SD_PreCacheSound(SD_GLASSBREAKSND); } if (sidepic==true) { PreCacheLump(lastmaskobj->sidepic,PU_CACHEWALLS,cache_pic_t); } if (lastmaskobj->bottomtexture>=0) PreCacheLump(lastmaskobj->bottomtexture,PU_CACHEWALLS,cache_transpatch_t); if (lastmaskobj->toptexture>=0) PreCacheLump(lastmaskobj->toptexture,PU_CACHEWALLS,cache_patch_t); if (lastmaskobj->midtexture>=0) PreCacheLump(lastmaskobj->midtexture,PU_CACHEWALLS,cache_patch_t); maskednum++; lastmaskobj++; if (maskednum==MAXMASKED) Error ("Too many masked walls\n"); } /* =============== = = FixMaskedWallAreaNumbers = =============== */ void FixMaskedWallAreaNumbers ( void ) { int i; int up,dn,lt,rt; int tilex,tiley; for (i=0;itilex; tiley=maskobjlist[i]->tiley; tile=MAPSPOT(tilex,tiley,0)-AREATILE; if ((tile<=NUMAREAS) && (tile>0)) { maskobjlist[i]->areanumber = tile; continue; } up=MAPSPOT(tilex,tiley-1,0)-AREATILE; dn=MAPSPOT(tilex,tiley+1,0)-AREATILE; lt=MAPSPOT(tilex-1,tiley,0)-AREATILE; rt=MAPSPOT(tilex+1,tiley,0)-AREATILE; up = ((up>0) && (up<=NUMAREAS)); dn = ((dn>0) && (dn<=NUMAREAS)); lt = ((lt>0) && (lt<=NUMAREAS)); rt = ((rt>0) && (rt<=NUMAREAS)); if (maskobjlist[i]->vertical==true) { if (rt) MAPSPOT(tilex,tiley,0) = MAPSPOT(tilex+1,tiley,0); else if (lt) MAPSPOT(tilex,tiley,0) = MAPSPOT(tilex-1,tiley,0); else if (up) MAPSPOT(tilex,tiley,0) = MAPSPOT(tilex,tiley-1,0); else if (dn) MAPSPOT(tilex,tiley,0) = MAPSPOT(tilex,tiley+1,0); else Error("FixMaskedWalls: Couldn't fix up area at x=%d y=%d\n",tilex,tiley); } else { if (dn) MAPSPOT(tilex,tiley,0) = MAPSPOT(tilex,tiley+1,0); else if (up) MAPSPOT(tilex,tiley,0) = MAPSPOT(tilex,tiley-1,0); else if (rt) MAPSPOT(tilex,tiley,0) = MAPSPOT(tilex+1,tiley,0); else if (lt) MAPSPOT(tilex,tiley,0) = MAPSPOT(tilex-1,tiley,0); else Error("FixMaskedWalls: Couldn't fix up area at x=%d y=%d\n",tilex,tiley); } maskobjlist[i]->areanumber = MAPSPOT(tilex,tiley,0)-AREATILE; if ((maskobjlist[i]->areanumber <0) || (maskobjlist[i]->areanumber > NUMAREAS)) Error("Bad masked wall areanumber of %d",maskobjlist[i]->areanumber); } } /* =============== = = CheckMaskedWall = =============== */ int CheckMaskedWall( maskedwallobj_t * mw ) { int result; result=0; if (mw->flags & MW_SHOOTABLE) { if (mw->flags & MW_BLOCKINGCHANGES) { mw->flags&=~MW_BLOCKINGCHANGES; mw->flags&=~MW_BLOCKING; mw->flags|=MW_BOTTOMPASSABLE; } mw->flags&=~MW_SHOOTABLE; // mw->bottomtexture++; result=1; } return result; } /* =============== = = UpdateMaskedWall = =============== */ int UpdateMaskedWall (int num) { maskedwallobj_t * mw; int result; mw=maskobjlist[num]; result=CheckMaskedWall(mw); if (result==1) { SpawnAnimatedMaskedWall(num); if (loadedgame==false) SD_PlaySoundRTP(SD_GLASSBREAKSND,mw->tilex<<16,mw->tiley<<16); if (mw->flags&MW_MULTI) { int i; int dx,dy; int r; maskedwallobj_t * mw2; dx=0;dy=0; if (mw->vertical==true) dy=1; else dx=1; i=1; while (M_ISMWALL(mw->tilex+(dx*i),mw->tiley+(dy*i))) { int num; num=tilemap[mw->tilex+(dx*i)][mw->tiley+(dy*i)]&0x3ff; mw2=maskobjlist[num]; if (!(mw2->flags&MW_MULTI)) break; r=CheckMaskedWall(mw2); if (r==1) { SpawnAnimatedMaskedWall(num); if (loadedgame==false) SD_PlaySoundRTP(SD_GLASSBREAKSND,mw2->tilex<<16,mw2->tiley<<16); } i++; } i=1; while (M_ISMWALL(mw->tilex-(dx*i),mw->tiley-(dy*i))) { int num; num=tilemap[mw->tilex-(dx*i)][mw->tiley-(dy*i)]&0x3ff; mw2=maskobjlist[num]; if (!(mw2->flags&MW_MULTI)) break; r=CheckMaskedWall(mw2); if (r==1) { SpawnAnimatedMaskedWall(num); if (loadedgame==false) SD_PlaySoundRTP(SD_GLASSBREAKSND,mw2->tilex<<16,mw2->tiley<<16); } i++; } } } return result; } /* ============================ = = ExecuteElevatorStopActions = ============================ */ void ExecuteElevatorStopActions(elevator_t *eptr, int teleport_location, int desttilex,int desttiley) { eptr->state = ev_doorclosing; eptr->doorclosing = eptr->doortoopen; doorobjlist[eptr->doortoopen]->flags &= ~DF_ELEVLOCKED; OpenDoor(eptr->doortoopen); SD_PlaySoundRTP(SD_ELEVATORENDSND,desttilex,desttiley); Teleport(eptr,teleport_location); eptr->ticcount = OPENTICS; eptr->doortoopen = -1; if (MISCVARS->elevatormusicon == true) { MU_StartSong(song_level); MU_RestoreSongPosition(); MISCVARS->elevatormusicon = false; } } boolean PlayerInElevator(elevator_t *eptr) { if (eptr->state == ev_mts) { if ((eptr->dx == player->tilex) && (eptr->dy == player->tiley)) return true; } else if (eptr->state == ev_mtd) { if ((eptr->sx == player->tilex) && (eptr->sy == player->tiley)) return true; } return false; } #define SHOULD_START_ELEVATOR_MUSIC(eptr) \ ((demoplayback == false) && (demorecord == false) && \ (MusicStarted() == true) && \ (!BATTLEMODE) && \ (!(player->flags & FL_GODMODE)) &&\ (GameRandomNumber("elevator music",0) < 25) && \ (PlayerInElevator(eptr)) \ ) \ /* ========================== = = SetElevatorOperationTime = ========================== */ void SetElevatorOperationTime(elevator_t*eptr) { if (SHOULD_START_ELEVATOR_MUSIC(eptr)) { MU_StoreSongPosition(); MU_StartSong(song_elevator); MISCVARS->elevatormusicon = true; eptr->ticcount = ELEVATORMUSICTIME; } else if (AREANUMBER(eptr->sx,eptr->sy) == AREANUMBER(eptr->dx,eptr->dy)) eptr->ticcount = 70; else eptr->ticcount = 170; } /* ===================== = = CheckElevatorStart = ===================== */ void CheckElevatorStart (elevator_t*eptr) { doorobj_t *dptr = doorobjlist[eptr->doorclosing]; if (dptr->action == dr_closed) { if (eptr->nextaction!=-1) { eptr->state = eptr->nextaction; eptr->nextaction = -1; switch (eptr->state) { case ev_mtd: eptr->doortoopen = eptr->door2; SD_PlaySoundRTP(SD_ELEVATORONSND,eptr->sx<<16,eptr->sy<<16); //eptr->doorclosing = eptr->door1; SetElevatorOperationTime(eptr); break; case ev_mts: eptr->doortoopen = eptr->door1; SD_PlaySoundRTP(SD_ELEVATORONSND,eptr->dx<<16,eptr->dy<<16); SetElevatorOperationTime(eptr); break; } } else if (eptr->doorclosing == eptr->door1) eptr->state = ev_ras; else if (eptr->doorclosing == eptr->door2) eptr->state = ev_rad; eptr->doorclosing = -1; } } /* ===================== = = ProcessElevators = = Called from PlayLoop = ===================== */ void ProcessElevators (void) { int ectr; elevator_t *eptr; for (ectr = 0 ; ectr < _numelevators ; ectr++) { eptr = &ELEVATOR[ectr]; if (eptr->ticcount) eptr->ticcount --; else { switch (eptr->state) { /* case ev_ras: break; case ev_rad: break; */ case ev_mts: ExecuteElevatorStopActions(eptr,0,(eptr->sx << 16),(eptr->sy << 16)); break; case ev_mtd: ExecuteElevatorStopActions(eptr,1,(eptr->dx << 16),(eptr->dy << 16)); break; case ev_doorclosing: CheckElevatorStart(eptr); break; } } } } void Teleport(elevator_t*eptr,int destination) {statobj_t*tstat; objtype*temp; int startx,starty,destx,desty; if (destination) // move to dest {startx = eptr->sx; starty = eptr->sy; destx = eptr->dx; desty = eptr->dy; tilemap[eptr->esx][eptr->esy] = (elevatorstart + 5) | 0x2000; } else {startx = eptr->dx; starty = eptr->dy; destx = eptr->sx; desty = eptr->sy; tilemap[eptr->edx][eptr->edy] = (elevatorstart + 5) | 0x2000; } for(tstat=firstactivestat;tstat;tstat=tstat->nextactive) {if ((tstat->tilex == startx) && (tstat->tiley == starty)) { tstat->x += ((destx - tstat->tilex) << TILESHIFT); tstat->y += ((desty - tstat->tiley) << TILESHIFT); tstat->tilex = tstat->x >> TILESHIFT; tstat->tiley = tstat->y >> TILESHIFT; tstat->visspot = &spotvis[tstat->tilex][tstat->tiley]; if (sprites[startx][starty] == tstat) {sprites[startx][starty] = NULL; sprites[destx][desty] = tstat; } } } for(temp=firstactive;temp;temp=temp->nextactive) {if ((temp->tilex == startx) && (temp->tiley == starty)) {temp->x += ((destx - temp->tilex) << TILESHIFT); temp->y += ((desty - temp->tiley) << TILESHIFT); temp->tilex = temp->x >> TILESHIFT; temp->tiley = temp->y >> TILESHIFT; if (temp->obclass!=inertobj) { RemoveFromArea (temp); temp->areanumber = AREANUMBER(temp->tilex,temp->tiley); MakeLastInArea (temp); } if (temp == player) SHAKETICS = 10; } } } void OperateElevatorDoor(int dnum) { elevator_t*eptr; doorobj_t *dptr; dptr = doorobjlist[dnum]; eptr = &ELEVATOR[dptr->eindex]; switch(eptr->state) {/* case ev_mtd: // if already on the way to request, // ignore; else, put request in if (dnum == eptr->door1) {eptr->nextaction = ev_mts; //eptr->doortoopen = eptr->door1; } break; case ev_mts: if (dnum == eptr->door2) {eptr->nextaction = ev_mtd; //eptr->doortoopen = eptr->door2; } break; */ case ev_rad: // if ready at other place, if ((dnum == eptr->door1) && (eptr->nextaction != ev_mts)) // process request, lock doors, { // start moving to current loc; SetNextAction(eptr,0); // if already there, do nothing } break; case ev_ras: if ((dnum == eptr->door2) && (eptr->nextaction != ev_mtd)) { SetNextAction(eptr,1); } break; case ev_doorclosing: if (eptr->doorclosing == dnum) // if opening door at current loc, // reset elev state to ready {//if (eptr->door1 == dnum) // eptr->nextaction = ev_ras; //else //eptr->nextaction = ev_rad; } else //else prepare for movement {if ((eptr->door1 == dnum) && (eptr->nextaction != ev_mts)) { SetNextAction(eptr,0); } else if ((eptr->door2 == dnum) && (eptr->nextaction != ev_mtd)) { SetNextAction(eptr,1); } } break; } } int SetNextAction(elevator_t*eptr,int action) {int dn; if (action) {if (!DoorReadyToClose(eptr->door1)) return false; eptr->nextaction = ev_mtd; dn = eptr->door1; } else {if (!DoorReadyToClose(eptr->door2)) return false; eptr->nextaction = ev_mts; dn = eptr->door2; } eptr->state = ev_doorclosing; eptr->doorclosing = dn; if (doorobjlist[dn]->action != dr_closed) CloseDoor(dn); doorobjlist[dn]->flags |= DF_ELEVLOCKED; return true; } void OperateElevatorSwitch(objtype*ob,int elevnum,int checkx,int checky) {elevator_t*eptr; doorobj_t *door1; eptr = &ELEVATOR[elevnum]; if ((eptr->state == ev_mts) || (eptr->state == ev_mtd)) { return; } door1 = doorobjlist[eptr->door1]; if ((abs(ob->tilex-door1->tilex)<=1) && //switch at source (abs(ob->tiley-door1->tiley)<=1)) {if (!SetNextAction(eptr,1)) // set next to dest return; eptr->ticcount = 0; } else //switch at dest {if (!SetNextAction(eptr,0)) // set next to src return; eptr->ticcount = 0; } tilemap[checkx][checky] = (elevatorstart + 6) | 0x2000; SD_PlaySoundRTP(SD_TOUCHPLATESND,ob->x,ob->y); } /* ===================== = = MoveDoors = = Called from PlayLoop = ===================== */ void MoveDoors (void) { int door; for (door = 0 ; door < doornum ; door++) switch (doorobjlist[door]->action) { case dr_open: DoorOpen (door); break; case dr_opening: DoorOpening(door); SD_PanRTP ( doorobjlist[door]->soundhandle, doorobjlist[door]->tilex<<16, doorobjlist[door]->tiley<<16 ); break; case dr_closing: DoorClosing(door); SD_PanRTP ( doorobjlist[door]->soundhandle, doorobjlist[door]->tilex<<16, doorobjlist[door]->tiley<<16 ); break; default: ; } } //=========================================================== // // PUSHWALLS // //=========================================================== /* =============== = = GetAreaNumber = =============== */ int GetAreaNumber ( int tilex, int tiley, int dir ) { int up,dn,lt,rt; up=MAPSPOT(tilex,tiley-1,0)-AREATILE; dn=MAPSPOT(tilex,tiley+1,0)-AREATILE; lt=MAPSPOT(tilex-1,tiley,0)-AREATILE; rt=MAPSPOT(tilex+1,tiley,0)-AREATILE; if ((up<=0) || (up>NUMAREAS)) up=0; if ((dn<=0) || (dn>NUMAREAS)) dn=0; if ((lt<=0) || (lt>NUMAREAS)) lt=0; if ((rt<=0) || (rt>NUMAREAS)) rt=0; switch (dir) { case north: if (up) return up; else if (dn) return dn; break; case south: if (dn) return dn; else if (up) return up; break; case east: if (rt) return rt; else if (lt) return lt; break; case west: if (lt) return lt; else if (rt) return rt; break; } if (up) return up; else if (dn) return dn; else if (lt) return lt; else if (rt) return rt; else Error("Cannot find an area number for tile at x=%d y=%d\n",tilex,tiley); return -1; } /* =============== = = SpawnPushWall = =============== */ void SpawnPushWall (int tilex, int tiley, int lock, int texture, int dir, int type) { pwallobj_t * lastpwallobj; if (pwallnum==MAXPWALLS) Error ("MAXPWALLS on level!"); pwallobjlist[pwallnum]=(pwallobj_t*)Z_LevelMalloc(sizeof(pwallobj_t),PU_LEVELSTRUCT,NULL); memset(pwallobjlist[pwallnum],0,sizeof(pwallobj_t)); lastpwallobj=pwallobjlist[pwallnum]; lastpwallobj->x = (tilex<<16)+0x8000; lastpwallobj->y = (tiley<<16)+0x8000; lastpwallobj->momentumx=0; lastpwallobj->momentumy=0; lastpwallobj->tilex = tilex; lastpwallobj->tiley = tiley; lastpwallobj->lock = lock; lastpwallobj->action = pw_npushed; lastpwallobj->which = PWALL; lastpwallobj->dir = dir; lastpwallobj->num = pwallnum; actorat[tilex][tiley] = (pwallobj_t*)(lastpwallobj); // consider it a solid wall if ( (MAPSPOT(tilex,tiley,0)==44) || (MAPSPOT(tilex,tiley,0)==233) ) lastpwallobj->flags=PW_DAMAGE; lastpwallobj->texture = texture; if (!(texture&0x1000)) PreCacheLump(texture,PU_CACHEWALLS,cache_pic_t); lastpwallobj->areanumber = GetAreaNumber(tilex,tiley,lastpwallobj->dir); MAPSPOT (tilex, tiley, 0)=(word)(lastpwallobj->areanumber+AREATILE); switch(type) { case 0: case 1: case 3: lastpwallobj->speed = 2; break; case 2: case 4: lastpwallobj->speed = 4; break; default: Error("Illegal PushWall type passed into SpawnPushWall\n"); break; } if (type>2) { tilemap[tilex][tiley] = 0; ActivateMoveWall(pwallnum); } else { tilemap[tilex][tiley] = texture|0x800; if ((loadedgame==false) && (type==0)) gamestate.secrettotal++; } pwallnum++; lastpwallobj++; SD_PreCacheSoundGroup(SD_PUSHWALLSND,SD_TURBOWALLSND); } /* ===================== = = OperatePushWall = = The player wants to change the pushwall's direction = ===================== */ void OperatePushWall (int pwall, int dir, boolean localplayer ) { pwallobj_t * pw; pw=pwallobjlist[pwall]; if (pw->lock) { if ( localplayer ) { // Can't push AddMessage("This push wall appears to be locked...",MSG_DOOR); PlayNoWaySound(); } return; } switch (pw->action) { case pw_npushed: if ((dir!=pw->dir) && (pw->dir!=nodir)) { // Can't push if ( localplayer ) { PlayNoWaySound(); } return; } else if (localplayer && (gamestate.difficulty == gd_baby)) AddMessage("Push Wall Activated.",MSG_GAME); pw->action=pw_pushing; pw->dir=dir; SD_PlaySoundRTP ( SD_TOUCHPLATESND, pw->x, pw->y ); ConnectPushWall(pwall); SetupPushWall(pwall); gamestate.secretcount++; break; default: // Can't push if ( localplayer ) { PlayNoWaySound(); } break; } } /* ===================== = = ActivateAllPushWalls = = A Push wall has beeen activated by a touch plate = ===================== */ void ActivateAllPushWalls(void) { int i; for(i=0;idir != nodir) { ActivatePushWall(i); } } } /* ===================== = = ActivatePushWall = = A Push wall has beeen activated by a touch plate = ===================== */ void ActivatePushWall (intptr_t pwall) { pwallobj_t * pw; pw=pwallobjlist[pwall]; switch (pw->action) { case pw_npushed: pw->action=pw_pushing; ConnectPushWall(pwall); SetupPushWall(pwall); gamestate.secretcount++; break; default: // Can't push SD_Play( SD_BADTOUCHSND ); break; } } /* ===================== = = ActivateMoveWall = = A Push wall has beeen activated by a touch plate = ===================== */ void ActivateMoveWall (intptr_t pwall) { pwallobj_t * pw; pw=pwallobjlist[pwall]; switch (pw->action) { case pw_npushed: pw->action=pw_moving; SetupPushWall(pwall); break; default: SD_Play( SD_BADTOUCHSND ); break; } } /* =============== = = ConnectPushWall = =============== */ void ConnectPushWall (int pwall) { int checkx; int checky; int area1,area2; int area3,area4; word *map; pwallobj_t * pw; pw=pwallobjlist[pwall]; checkx=pw->tilex; checky=pw->tiley; tilemap[checkx][checky] = 0; map = &MAPSPOT (checkx, checky, 0); area1 = *(map-mapwidth); area2 = *(map+mapwidth); area3 = *(map+1); area4 = *(map-1); area1 -= AREATILE; area2 -= AREATILE; area3 -= AREATILE; area4 -= AREATILE; if (((area1>0) && (area10) && (area20) && (area30) && (area4speed<dir) { case north: pw->momentumx=0; pw->momentumy=-speed; break; case east: pw->momentumx=speed; pw->momentumy=0; break; case northeast: pw->momentumx=speed; pw->momentumy=-speed; break; case southeast: pw->momentumx=speed; pw->momentumy=speed; break; case south: pw->momentumx=0; pw->momentumy=speed; break; case west: pw->momentumx=-speed; pw->momentumy=0; break; case northwest: pw->momentumx=-speed; pw->momentumy=-speed; break; case southwest: pw->momentumx=-speed; pw->momentumy=speed; break; } if (pw->action==pw_pushing) { if (loadedgame==false) pw->soundhandle=SD_PlaySoundRTP ( SD_PUSHWALLSND, pw->x, pw->y ); pw->state=(0x20000L/speed); } if (pw->action==pw_moving) pw->state=(0x10000L/speed); } /* ===================== = = MovePWalls = = Called from PlayLoop = ===================== */ void MovePWalls (void) { int pwall; for (pwall = 0 ; pwall < pwallnum ; pwall++) { if (pwallobjlist[pwall]->action==pw_pushing) { WallPushing (pwall); SD_PanRTP (pwallobjlist[pwall]->soundhandle, pwallobjlist[pwall]->x, pwallobjlist[pwall]->y ); } if (pwallobjlist[pwall]->action==pw_moving) { WallMoving (pwall); SD_PanRTP (pwallobjlist[pwall]->soundhandle, pwallobjlist[pwall]->x, pwallobjlist[pwall]->y ); } } } void ClearActorat(pwallobj_t*pw) {int txhigh,txlow,tyhigh,tylow; int tryx,tryy,x,y; int pwrad = 0x6fff; tryx = pw->x; tryy = pw->y; txlow = (tryx - pwrad) >> 16; txhigh = (tryx + pwrad) >> 16; tylow = (tryy - pwrad) >> 16; tyhigh = (tryy + pwrad) >> 16; for(y=tylow;y<=tyhigh;y++) for(x=txlow;x<=txhigh;x++) {if (actorat[x][y] == pw) actorat[x][y] = NULL; } } void SetActorat(pwallobj_t*pw) {int txhigh,txlow,tyhigh,tylow; int tryx,tryy,x,y; int pwrad = 0x6fff; tryx = pw->x; tryy = pw->y; txlow = (tryx - pwrad) >> 16; txhigh = (tryx + pwrad) >> 16; tylow = (tryy - pwrad) >> 16; tyhigh = (tryy + pwrad) >> 16; for(y=tylow;y<=tyhigh;y++) for(x=txlow;x<=txhigh;x++) actorat[x][y] = pw; } /* ================= = = FinishPushWall = ================= */ void FinishPushWall (pwallobj_t * pw) { pw->action = pw_pushed; actorat[pw->tilex][pw->tiley] = (wall_t*)&walls[GetWallIndex(pw->texture)]; tilemap[pw->tilex][pw->tiley] = pw->texture; } /* ================= = = ResetPushWall = ================= */ void ResetPushWall (pwallobj_t * pw) { SetActorat(pw); tilemap[pw->tilex][pw->tiley] = pw->texture|0x800; } /* ================= = = WallPushing = ================= */ void WallPushing (int pwall) { int checkx,checky; int spot; pwallobj_t * pw; pw=pwallobjlist[pwall]; ClearActorat(pw); PushWallMove(pwall); pw->x+=pw->momentumx; pw->y+=pw->momentumy; pw->state--; checkx=pw->tilex; checky=pw->tiley; pw->tilex=pw->x>>16; pw->tiley=pw->y>>16; if ((pw->tilex!=checkx) || (pw->tiley!=checky)) { int x,y; int area = MAPSPOT(pw->tilex,pw->tiley,0)-AREATILE; if ((area<=0) || (area>NUMAREAS)) { area=pw->areanumber; MAPSPOT (pw->tilex, pw->tiley, 0)=(word)(pw->areanumber+AREATILE); } // block crossed into a new block // // the tile can now be walked into // mapseen[checkx][checky] = 0; pw->areanumber = area; if (pw->momentumx>0) x=1; else if (pw->momentumx<0) x=-1; else x=0; if (pw->momentumy>0) y=1; else if (pw->momentumy<0) y=-1; else y=0; if (tilemap[pw->tilex+x][pw->tiley+y]) { pw->state=(0x8000L/(pw->speed<tilex+x][pw->tiley+y]) ResolveDoorSpace(pw->tilex+x,pw->tiley+y); } if (pw->state==0) { pw->x=(pw->tilex<<16)+0x8000; pw->y=(pw->tiley<<16)+0x8000; spot = MAPSPOT(pw->tilex,pw->tiley,1)-ICONARROWS; if ((spot >= 0) && (spot <= 7)) { pw->action = pw_npushed; pw->dir = spot; ResetPushWall (pw); if (pw->lock) { pw->action=pw_pushing; ConnectPushWall(pwall); SetupPushWall(pwall); } else { gamestate.secrettotal++; } } else { FinishPushWall (pw); } } else SetActorat(pw); } /* ================= = = WallMoving = ================= */ void WallMoving (int pwall) { int checkx,checky; int spot; pwallobj_t * pw; pw=pwallobjlist[pwall]; ClearActorat(pw); PushWallMove(pwall); pw->x+=pw->momentumx; pw->y+=pw->momentumy; pw->state--; checkx=pw->tilex; checky=pw->tiley; pw->tilex=pw->x>>16; pw->tiley=pw->y>>16; if ((pw->tilex!=checkx) || (pw->tiley!=checky)) { int area = MAPSPOT(pw->tilex,pw->tiley,0)-AREATILE; if ((area<=0) || (area>NUMAREAS)) { area=pw->areanumber; MAPSPOT (pw->tilex, pw->tiley, 0)=(word)(pw->areanumber+AREATILE); } // block crossed into a new block // // the tile can now be walked into // if (areabyplayer[area]) { if (pw->speed==2) pw->soundhandle=SD_PlaySoundRTP ( SD_GOWALLSND, pw->x, pw->y ); else pw->soundhandle=SD_PlaySoundRTP ( SD_TURBOWALLSND, pw->x, pw->y ); } if (actorat[pw->tilex][pw->tilex]) ResolveDoorSpace(pw->tilex,pw->tiley); mapseen[checkx][checky] = 0; pw->areanumber = MAPSPOT (pw->tilex, pw->tiley, 0)-AREATILE; //actorat[pw->tilex][pw->tiley]=pw; if ( (pw->tilex==0) || (pw->tilex==127) || (pw->tiley==0) || (pw->tiley==127) ) { if (W_CheckNumForName("imfree")>=0) { lbm_t *LBM; LBM = (lbm_t *) W_CacheLumpNum (W_GetNumForName ("imfree"), PU_CACHE, Cvt_lbm_t, 1); VL_DecompressLBM (LBM,true); VW_UpdateScreen (); I_Delay (2000); } Error ("PushWall Attempting to escape off the edge of the map\nIt is located at x=%d y=%d\nI'm Free!!!!\n", pw->tilex, pw->tiley); } } if (pw->state==0) { pw->x=(pw->tilex<<16)+0x8000; pw->y=(pw->tiley<<16)+0x8000; spot = MAPSPOT(pw->tilex,pw->tiley,1)-ICONARROWS; if ((spot >= 0) && (spot <= 7)) { int area = MAPSPOT(pw->tilex,pw->tiley,0)-AREATILE; if ((area<=0) || (area>NUMAREAS)) { area=pw->areanumber; MAPSPOT (pw->tilex, pw->tiley, 0)=(word)(pw->areanumber+AREATILE); } if (areabyplayer[area] && (abs(spot-pw->dir)==4)) SD_PlaySoundRTP ( SD_PUSHWALLHITSND, pw->x, pw->y ); pw->dir = spot; } SetupPushWall(pwall); } else SetActorat(pw); } /* ================= = = SavePushWalls = ================= */ void SavePushWalls(byte ** buf, int * sz) { int unitsize; pwallobj_t * pw; byte * bufptr; int i; int size; if (pwallnum==0) { *sz=0; *buf=SafeMalloc(16); return; } pw=pwallobjlist[0]; unitsize=0; unitsize+=sizeof(pw->state); unitsize+=sizeof(pw->x); unitsize+=sizeof(pw->y); unitsize+=sizeof(pw->dir); unitsize+=sizeof(pw->speed); unitsize+=sizeof(pw->action); *sz=pwallnum*unitsize; *buf=SafeMalloc(*sz); bufptr=*buf; for (i=0;istate); memcpy(bufptr,&(pw->state),size); bufptr+=size; size=sizeof(pw->x); memcpy(bufptr,&(pw->x),size); bufptr+=size; size=sizeof(pw->y); memcpy(bufptr,&(pw->y),size); bufptr+=size; size=sizeof(pw->dir); memcpy(bufptr,&(pw->dir),size); bufptr+=size; size=sizeof(pw->speed); memcpy(bufptr,&(pw->speed),size); bufptr+=size; size=sizeof(pw->action); memcpy(bufptr,&(pw->action),size); bufptr+=size; } } /* ================= = = LoadPushWalls = ================= */ void LoadPushWalls(byte * bufptr, int sz) { int unitsize; pwallobj_t * pw; pwallobj_t new; int i; int num; int size; int area; if (sz==0) return; SetupPushWalls(); pw=pwallobjlist[0]; unitsize=0; unitsize+=sizeof(pw->state); unitsize+=sizeof(pw->x); unitsize+=sizeof(pw->y); unitsize+=sizeof(pw->dir); unitsize+=sizeof(pw->speed); unitsize+=sizeof(pw->action); num=sz/unitsize; if (pwallnum!=num) Error("Different number of Push Walls when trying to load a game\npwallnum=%d num=%d",pwallnum,num); for (i=0;itilex][pw->tiley] = 0; mapseen[pw->tilex][pw->tiley] = 0; new.tilex=new.x>>16; new.tiley=new.y>>16; if ((new.tilex!=pw->tilex) || (new.tiley!=pw->tiley)) { ClearActorat(pw); tilemap[pw->tilex][pw->tiley] = 0; if (pw->state!=pw_moving) { ConnectPushWall(i); } } // fixup area if needed area = MAPSPOT(new.tilex,new.tiley,0)-AREATILE; if ((area<=0) || (area>NUMAREAS)) { MAPSPOT (new.tilex, new.tiley, 0)=(word)(pw->areanumber+AREATILE); } pw->tilex=new.tilex; pw->tiley=new.tiley; pw->x=new.x; pw->y=new.y; pw->action=new.action; pw->dir=new.dir; pw->speed=new.speed; SetupPushWall(i); pw->state=new.state; pw->areanumber = MAPSPOT (pw->tilex, pw->tiley, 0)-AREATILE; if (pw->action==pw_pushed) { FinishPushWall (pw); } else if (pw->action==pw_npushed) { ResetPushWall (pw); } else { SetActorat(pw); } } } /* ================= = = SaveMaskedWalls = ================= */ void SaveMaskedWalls(byte ** buf, int * size) { int unitsize; maskedwallobj_t * mw; byte * bufptr; int i; int sz; if (maskednum==0) { *size=0; *buf=SafeMalloc(16); return; } mw=maskobjlist[0]; unitsize=0; unitsize+=sizeof(mw->flags); *size=maskednum*unitsize; *buf=SafeMalloc(*size); bufptr=*buf; for (i=0;iflags); memcpy(bufptr,&(mw->flags),sz); bufptr+=sz; } } /* ================= = = LoadMaskedWalls = ================= */ void LoadMaskedWalls(byte * bufptr, int sz) { int unitsize; maskedwallobj_t * mw; int i; int size; int num; if (sz==0) return; SetupMaskedWalls(); FixMaskedWallAreaNumbers(); mw=maskobjlist[0]; unitsize=0; unitsize+=sizeof(mw->flags); num=sz/unitsize; if (maskednum!=num) Error("Different number of Masked Walls when trying to load a game\nmaskednum=%d num=%d",maskednum,num); for (i=0;iflags); memcpy(&flags,bufptr,size); bufptr+=size; if ((flags&0xff)!=mw->flags) // Preserves original behavior UpdateMaskedWall(i); if (mw->flags&MW_SWITCHON) mw->toptexture--; } } /* ================= = = SaveDoors = ================= */ void SaveDoors (byte ** buf, int * size) { int door; int doorsave; byte doorflag; byte doorlocked; signed char dooreindex; short int doortime; int unitsize; byte *ptr; if (doornum==0) { *size=0; *buf=SafeMalloc(16); return; } // // Size = (int + byte + byte) * numdoors // unitsize=0; unitsize+=sizeof(doorsave); unitsize+=sizeof(doorflag); unitsize+=sizeof(doorlocked); unitsize+=sizeof(doortime); unitsize+=sizeof(dooreindex); *size = unitsize*doornum; *buf = (byte *) SafeMalloc (*size); ptr = *buf; for (door = 0; door < doornum ; door++) { doorsave = doorobjlist[door]->position & ~3; doorsave |= doorobjlist[door]->action; doorflag = doorobjlist[door]->flags; doorlocked = doorobjlist[door]->lock; doortime = doorobjlist[door]->ticcount; dooreindex = doorobjlist[door]->eindex; memcpy (ptr, &doorsave, sizeof (doorsave)); ptr += sizeof (doorsave); memcpy (ptr, &doorflag, sizeof (doorflag)); ptr += sizeof (doorflag); memcpy (ptr, &doorlocked, sizeof (doorlocked)); ptr += sizeof (doorlocked); memcpy (ptr, &doortime, sizeof (doortime)); ptr += sizeof (doortime); memcpy (ptr, &dooreindex, sizeof (dooreindex)); ptr += sizeof (dooreindex); } } /* ================= = = LoadDoors = ================= */ void LoadDoors (byte * buf, int size) { int door; int doorsave; byte doorflag; byte doorlocked; signed char dooreindex; short int doortime; byte *ptr; int unitsize; int num; SetupDoors (); FixDoorAreaNumbers(); ptr = buf; unitsize=0; unitsize+=sizeof(doorsave); unitsize+=sizeof(doorflag); unitsize+=sizeof(doorlocked); unitsize+=sizeof(doortime); unitsize+=sizeof(dooreindex); num=size/unitsize; if (doornum!=num) Error("Different number of Doors when trying to load a game\ndoornum=%d num=%d",doornum,num); for (door = 0; door < doornum; door++) { memcpy (&doorsave, ptr, sizeof (doorsave)); ptr += sizeof (doorsave); memcpy (&doorflag, ptr, sizeof (doorflag)); ptr += sizeof (doorflag); memcpy (&doorlocked, ptr, sizeof (doorlocked)); ptr += sizeof (doorlocked); memcpy (&doortime, ptr, sizeof (doortime)); ptr += sizeof (doortime); memcpy (&dooreindex, ptr, sizeof (dooreindex)); ptr += sizeof (dooreindex); doorobjlist[door]->action = doorsave & 3; // Update Areas if (doorobjlist[door]->action != dr_closed) DoorOpening(door); doorobjlist[door]->action = doorsave & 3; doorobjlist[door]->position = doorsave; doorobjlist[door]->flags = doorflag; doorobjlist[door]->lock = doorlocked; doorobjlist[door]->ticcount = doortime; doorobjlist[door]->eindex = dooreindex; if (doorobjlist[door]->action == dr_open) doorobjlist[door]->position = 0xFFFF; else if (doorobjlist[door]->action == dr_closed) doorobjlist[door]->position = 0; if ( (doorobjlist[door]->action == dr_closing) || (doorobjlist[door]->action == dr_closed) ) { actorat[doorobjlist[door]->tilex][doorobjlist[door]->tiley] = doorobjlist[door]; } doorobjlist[door]->texture = doorobjlist[door]->basetexture + ((doorobjlist[door]->position+1)>>13); } } /* ===================== = = SaveElevators = = ===================== */ void SaveElevators(byte ** buffer,int *size) {int i; byte * tptr; *size = _numelevators*sizeof(elevator_t); *buffer = (byte *)SafeMalloc(*size); tptr = *buffer; for(i=0;i<_numelevators;i++) {memcpy(tptr,&ELEVATOR[i],sizeof(elevator_t)); tptr += sizeof(elevator_t); } } /* ===================== = = LoadElevators = = ===================== */ void LoadElevators(byte * buffer,int size) {int i; _numelevators = size/sizeof(elevator_t); for(i=0;i<_numelevators;i++) {memcpy(&ELEVATOR[i],buffer,sizeof(elevator_t)); buffer += sizeof(elevator_t); } } rott-20230810/rott/rt_door.h000066400000000000000000000165051446517470200155750ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_door_public #define _rt_door_public //*************************************************************************** // // RT_DOOR.C - doors // //*************************************************************************** #define MAXTOUCHPLATES 64 #define MAXMASKED 300 // max masked walls #define MAXDOORS 150 // max number of sliding doors #define MAXPWALLS 150 // max number of pushwalls #define DF_TIMED 0x01 #define DF_ELEVLOCKED 0x02 #define DF_MULTI 0x04 #define MAXELEVATORS 16 #define PW_DAMAGE 0x01 #define NUMELEVATORACTIONS 5 typedef enum {ev_ras, //ready at source ev_rad, //ready at destination ev_mts, //moving to source ev_mtd, //moving to destination //door at elevator location open ev_doorclosing //door at elevator location closed }estate; typedef enum { mw_peephole, mw_dogwall, mw_multi1, mw_multi2, mw_multi3, mw_singlepane, mw_normal1, mw_normal2, mw_normal3, mw_exitarch, mw_secretexitarch, mw_railing, mw_hiswitchon, mw_hiswitchoff, mw_platform1, mw_platform2, mw_platform3, mw_platform4, mw_platform5, mw_platform6, mw_platform7, mw_entrygate }masked_walls; typedef struct elevator { short sx,sy; short dx,dy; short esx,esy,edx,edy; short door1,door2; signed char state; short doortoopen; short doorclosing; short ticcount; short nextaction; }elevator_t; typedef struct doorstruct { thingtype which; byte tilex,tiley; word texture; word alttexture; word sidepic; word basetexture; byte lock; byte flags; short int ticcount; signed char eindex; boolean vertical; int soundhandle; int position; enum {dr_open,dr_closed,dr_opening,dr_closing} action; } doorobj_t; typedef struct pwallstruct { thingtype which; int x,y; int momentumx,momentumy; byte areanumber; byte lock; byte dir; byte tilex,tiley; byte num; byte speed; word texture; int soundhandle; enum {pw_npushed,pw_pushing,pw_pushed,pw_moving} action; int state; byte flags; } pwallobj_t; typedef struct tplate { void (*action)(intptr_t); void (*swapaction)(intptr_t); struct tplate * nextaction; struct tplate * prevaction; intptr_t whichobj; byte tictime; byte ticcount; byte triggered; byte done; byte complete; byte clocktype; } touchplatetype; #define MW_SHOOTABLE 0x01 #define MW_BLOCKING 0x02 #define MW_MULTI 0x04 #define MW_BLOCKINGCHANGES 0x08 #define MW_ABOVEPASSABLE 0x10 #define MW_NONDOGBLOCKING 0x20 #define MW_WEAPONBLOCKING 0x40 #define MW_BOTTOMPASSABLE 0x80 #define MW_MIDDLEPASSABLE 0x100 #define MW_ABP 0x200 #define MW_SWITCHON 0x400 #define MW_BOTTOMFLIPPING 0x800 #define MW_TOPFLIPPING 0x1000 #define M_ISDOOR(x,y) ((tilemap[x][y] & 0x8000) && (!(tilemap[x][y] & 0x4000))) #define M_ISMWALL(x,y) ((tilemap[x][y] & 0x8000) && (tilemap[x][y] & 0x4000)) typedef struct mwall { thingtype which; byte tilex,tiley; signed char areanumber; signed short toptexture; signed short midtexture; signed short bottomtexture; word flags; boolean vertical; int sidepic; struct mwall *next; struct mwall *prev; } maskedwallobj_t; typedef struct animmwall { word num; byte count; signed char ticcount; struct animmwall *next; struct animmwall *prev; } animmaskedwallobj_t; extern elevator_t ELEVATOR[MAXELEVATORS]; extern int _numelevators; extern animmaskedwallobj_t *FIRSTANIMMASKEDWALL,*LASTANIMMASKEDWALL; extern maskedwallobj_t *FIRSTMASKEDWALL,*LASTMASKEDWALL; extern byte touchindices[MAPSIZE][MAPSIZE],lasttouch; extern touchplatetype *touchplate[MAXTOUCHPLATES],*lastaction[MAXTOUCHPLATES]; extern byte TRIGGER[MAXTOUCHPLATES]; extern doorobj_t *doorobjlist[MAXDOORS]; extern int doornum; extern maskedwallobj_t *maskobjlist[MAXMASKED]; extern int maskednum; extern pwallobj_t *pwallobjlist[MAXPWALLS]; extern int pwallnum; // 0xffff = fully open extern byte areaconnect[NUMAREAS][NUMAREAS]; extern boolean areabyplayer[NUMAREAS]; void ActivateAllPushWalls(void); boolean CheckTile(int,int); void FindEmptyTile(int*,int*); int Number_of_Empty_Tiles_In_Area_Around(int,int); void AddTouchplateAction(touchplatetype*,int); void RemoveTouchplateAction(touchplatetype*,int); void InitElevators(void); void ProcessElevators(void); void OperateElevatorDoor(int); int PlatformHeight(int,int); void Link_To_Touchplate(word, word, void (*)(intptr_t), void (*)(intptr_t), intptr_t, int); void TriggerStuff(void); void ClockLink(void (*)(intptr_t),void(*)(intptr_t),intptr_t,int); void RecursiveConnect(int); void ConnectAreas(void); void InitAreas(void); void InitDoorList(void); void SpawnDoor(int,int,int,int); void SpawnMaskedWall (int tilex, int tiley, int which, int flags); void OpenDoor(int); void CloseDoor(int); void OperateDoor (int keys, int door, boolean localplayer ); void DoorOpen(int); void DoorOpening(int); void DoorClosing(int door); void MoveDoors(void); void SpawnPushWall (int tilex, int tiley, int lock, int texture, int dir, int type); void MovePWalls(void); void WallPushing (int pwall); void PushWall (int pwall, int dir); void OperatePushWall (int pwall, int dir, boolean localplayer ); void ActivatePushWall (intptr_t pwall); void ActivateMoveWall (intptr_t pwall); int UpdateMaskedWall (int num); void FixDoorAreaNumbers ( void ); void FixMaskedWallAreaNumbers ( void ); void SaveMaskedWalls(byte ** buf, int * size); void LoadMaskedWalls(byte * buf, int size); void SaveDoors(byte ** buf, int * size); void SaveTouchPlates(byte ** buf, int * size); void LoadDoors(byte * buf, int size); void LoadTouchPlates(byte * buf, int size); void SavePushWalls(byte ** buf, int * sz); void LoadPushWalls(byte * bufptr, int sz); void DeactivateAnimMaskedWall(animmaskedwallobj_t* amwall); void ActivateAnimMaskedWall(animmaskedwallobj_t* amwall); void SpawnAnimatedMaskedWall ( int num ); void KillAnimatedMaskedWall ( animmaskedwallobj_t * temp ); void DoAnimatedMaskedWalls ( void ); void SaveElevators(byte ** buffer,int *size); void LoadElevators(byte * buffer,int size); void MakeWideDoorVisible ( int doornum ); void LinkedCloseDoor (intptr_t door); void LinkedOpenDoor (intptr_t door); int IsWall (int tilex, int tiley); int IsDoor (int tilex, int tiley); int IsMaskedWall (int tilex, int tiley); #endif rott-20230810/rott/rt_dr_a.h000066400000000000000000000025301446517470200155300ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_dr_a_public #define _rt_dr_a_public //*************************************************************************** // // RT_DR_A.ASM - Low level draw stuff, DrawPost // //*************************************************************************** void SetMode240(void); void RefreshClear(void); void DrawPost (int height, char * column, char * buf); void DrawHeightPost (int height, byte * src, byte * buf); // IN rt_dr_a.asm void R_DrawWallColumn (byte * buf); void DrawMenuPost (int height, byte * src, byte * buf); // IN rt_dr_a.asm void DrawMapPost (int height, byte * src, byte * buf); // IN rt_dr_a.asm #endif rott-20230810/rott/rt_draw.c000066400000000000000000003571411446517470200155660ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ // RT_DRAW.C #include "profile.h" #include "rt_def.h" #include #include "watcom.h" #include "sprites.h" #include "rt_actor.h" #include "rt_stat.h" #include "rt_draw.h" #include "_rt_draw.h" #include "rt_dr_a.h" #include "rt_fc_a.h" #include "rt_scale.h" #include "rt_floor.h" #include "rt_main.h" #include "rt_playr.h" #include "rt_door.h" #include "rt_ted.h" #include "isr.h" #include "rt_util.h" #include "engine.h" #include "z_zone.h" #include "w_wad.h" #include "lumpy.h" #include "rt_menu.h" #include "rt_game.h" #include "rt_vid.h" #include "rt_view.h" #include #include #include "rt_cfg.h" #include "rt_str.h" #include "develop.h" #include "rt_sound.h" #include "rt_msg.h" #include "modexlib.h" #include "rt_rand.h" #include "rt_net.h" #include "rt_sc_a.h" extern void VH_UpdateScreen (void); //int testval; /* ============================================================================= Global Variables GLOBAL VARIABLES ============================================================================= */ int iG_masked; int whereami=-1; byte * shadingtable; word tilemap[MAPSIZE][MAPSIZE]; // wall values only byte spotvis[MAPSIZE][MAPSIZE]; byte mapseen[MAPSIZE][MAPSIZE]; unsigned long * lights; int wstart; const int dirangle8[9] = {0,FINEANGLES/8,2*FINEANGLES/8,3*FINEANGLES/8,4*FINEANGLES/8, 5*FINEANGLES/8,6*FINEANGLES/8,7*FINEANGLES/8,8*FINEANGLES/8}; const int dirangle16[16] = {0,FINEANGLES/16,2*FINEANGLES/16,3*FINEANGLES/16, 4*FINEANGLES/16,5*FINEANGLES/16,6*FINEANGLES/16, 7*FINEANGLES/16,8*FINEANGLES/16,9*FINEANGLES/16, 10*FINEANGLES/16,11*FINEANGLES/16,12*FINEANGLES/16, 13*FINEANGLES/16,14*FINEANGLES/16,15*FINEANGLES/16}; // // math tables // short tantable[FINEANGLES]; int sintable[FINEANGLES+FINEANGLEQUAD+1], *costable = sintable+(FINEANGLES/4); // // refresh variables // fixed viewx,viewy; // the focal point int viewangle; int c_startx, c_starty; fixed viewsin,viewcos; int tics; // // ray tracing variables // long xintercept,yintercept; int doublestep=0; int hp_startfrac; int hp_srcstep; int levelheight; int actortime=0; int drawtime=0; visobj_t vislist[MAXVISIBLE],*visptr,*visstep,*farthest; int firstcoloffset=0; /* ================== = = Local Variables = ================== */ static int nonbobpheight; static visobj_t * sortedvislist[MAXVISIBLE]; static const fixed mindist = 0x1000; static int walltime=0; static int weaponbobx, weaponboby; static int pretics[3]; static int preindex; static int netlump; static int gmasklump; int G_gmasklump; static const int weaponshape[NUMWEAPGRAPHICS] = { #if (SHAREWARE == 0) W_KNIFE, #endif W_MALEPISTOL1, W_MRIGHTPISTOL1, W_MP40, W_BAZOOKA, W_HEATSEEKER, W_DRUNK, W_FIREBOMB, W_FIREWALL, W_GODHAND, #if (SHAREWARE == 0) W_SPLIT, W_KES, W_BAT, W_DOG, W_FEMALEPISTOL1, W_BMALEPISTOL1 #endif }; void SetColorLightLevel (int x, int y, visobj_t * sprite, int dir, int color, int fullbright); void DrawRotatedScreen(int cx, int cy, byte *destscreen, int angle, int scale, int masked); void InterpolateMaskedWall (visobj_t * plane); void InterpolateDoor (visobj_t * plane); void InterpolateWall (visobj_t * plane); /* ================== = = BuildTables = ================== */ void BuildTables (void) { byte * table; byte * ptr; int length; int i; // // load in tables file // table=W_CacheLumpName("tables",PU_STATIC, CvtNull, 1); ptr=table; // // get size of first table // memcpy(&length,ptr,sizeof(int)); SwapIntelLong(&length); // // skip first table // ptr+=(length+1)*sizeof(int); // // get size of sin/cos table // memcpy(&length,ptr,sizeof(int)); SwapIntelLong(&length); ptr+=sizeof(int); // // get sin/cos table // memcpy(&sintable[0],ptr,length*sizeof(int)); SwapIntelLongArray(&sintable[0], length); ptr+=(length)*sizeof(int); // // get size of tangent table // memcpy(&length,ptr,sizeof(int)); SwapIntelLong(&length); ptr+=sizeof(int); // // get tangent table // memcpy(tantable,ptr,length*sizeof(short)); SwapIntelShortArray(tantable, length); ptr+=(length)*sizeof(short); // // get size of gamma table // memcpy(&length,ptr,sizeof(int)); SwapIntelLong(&length); ptr+=sizeof(int); // // get gamma table // memcpy(&gammatable[0],ptr,length*sizeof(byte)); table=W_CacheLumpName("tables",PU_CACHE, CvtNull, 1); costable = (fixed *)&(sintable[FINEANGLES/4]); wstart=W_GetNumForName("WALLSTRT"); #if (SHAREWARE==0) netlump=W_GetNumForName("net1"); #endif gmasklump=W_GetNumForName("p_gmask"); G_gmasklump = gmasklump; preindex=0; pretics[0]=0x10000; pretics[2]=0x10000; pretics[1]=0x10000; for(i=0;i=viewwidth) { svc=(centerx)*viewcos; svs=(centerx)*viewsin; vx=(scale*viewcos)+svs; vy=(-scale*viewsin)+svc; if (vertical) { if ((viewcos+viewsin)==0) { *height=20000<viewx=vertical; txstart=plane->texturestart; txend=plane->textureend; result1=TransformSimplePoint(x1,y1,&(plane->x1),&(plane->h1),&(plane->texturestart),vertical); result2=TransformSimplePoint(x2,y2,&(plane->x2),&(plane->h2),&(plane->textureend),vertical); if (result1==true) { if (plane->x1>=viewwidth) return false; if (result2==false) { plane->textureend=txend; TransformPoint(x2,y2,&(plane->x2),&(plane->h2),&(plane->textureend),vertical); } } else { if (result2==false) return false; else { if (plane->x2<0) return false; plane->texturestart=txstart; TransformPoint(x1,y1,&(plane->x1),&(plane->h1),&(plane->texturestart),vertical); } } if (plane->x1<0) { plane->texturestart=txstart; TransformPoint(x1,y1,&(plane->x1),&(plane->h1),&(plane->texturestart),vertical); } if (plane->x2>=viewwidth) { plane->textureend=txend; TransformPoint(x2,y2,&(plane->x2),&(plane->h2),&(plane->textureend),vertical); } plane->viewheight=(plane->h1+plane->h2)>>1; if ((plane->viewheight>=(2000<x1>=viewwidth-1) || (plane->x2<=0)) return false; return true; } //========================================================================== /* ==================== = = CalcHeight = = Calculates the height of xintercept,yintercept from viewx,viewy = ==================== */ int CalcHeight (void) { fixed gxt,gyt,nx; long gx,gy; whereami=0; gx = xintercept-viewx; gxt = FixedMul(gx,viewcos); gy = yintercept-viewy; gyt = FixedMul(gy,viewsin); nx = gxt-gyt; if (nxx - player->x; dy = player->y - temp->y; angle = atan2_appx(dx,dy); angle = angle-VANG180-dirangle8[temp->count]; angle+=ANGLES/16; while (angle>=ANGLES) angle-=ANGLES; while (angle<0) angle+=ANGLES; return angle/(ANGLES/8); } /* ===================== = = CalcRotate = ===================== */ int CalcRotate (objtype *ob) { int angle,viewangle; int dx,dy; int rotation; whereami=1; // this isn't exactly correct, as it should vary by a trig value' // but it is close enough with only eight rotations /* if (ob->obclass == b_robobossobj) viewangle = player->angle; else viewangle = player->angle + (centerx - ob->viewx)/8;*/ dx = ob->x - player->x; dy = player->y - ob->y; viewangle = atan2_appx(dx,dy); if ((ob->obclass >= p_bazookaobj) || (ob->obclass == missileobj)) {angle = viewangle - ob->angle; #if (0) Debug("\nviewangle: %d, angle: %d",viewangle,angle); #endif } else if ((ob->obclass > wallopobj) && (ob->obclass != b_darksnakeobj)) angle = (viewangle-ANG180)- ob->angle; else if (ob->state->rotate == 16) angle = (viewangle-ANG180)- dirangle16[ob->dir]; else angle = (viewangle-ANG180)- dirangle8[ob->dir]; if (ob->state->rotate == true) angle += ANGLES/16; else if (ob->state->rotate == 16) angle += ANGLES/32; while (angle>=ANGLES) angle-=ANGLES; while (angle<0) angle+=ANGLES; if (ob->state->rotate == 2) // 2 rotation pain frame {rotation = 4*(angle/(ANG180)); return rotation; } if (ob->state->rotate == 16) {rotation = angle/(ANGLES/16); #if (0) Debug("\nrotation: %d", rotation); #endif return rotation; } rotation = angle/(ANGLES/8); return rotation; } /* ====================== = = SortScaleds = Sort the scaleds using a HEAPSORT = ====================== */ #define SGN(x) ((x>0) ? (1) : ((x==0) ? (0) : (-1))) /*--------------------------------------------------------------------------*/ int CompareHeights(s1p,s2p) visobj_t **s1p,**s2p; { whereami=3; return SGN((*s1p)->viewheight-(*s2p)->viewheight); } void SwitchPointers(s1p,s2p) visobj_t **s1p,**s2p; { visobj_t * temp; whereami=4; temp=*s1p; *s1p=*s2p; *s2p=temp; } void SortVisibleList( int numvisible, visobj_t * vlist ) { int i; whereami=5; for (i=0;inext) { if (spotvis[tmwall->tilex][tmwall->tiley]) { mapseen[tmwall->tilex][tmwall->tiley]=1; if (tmwall->vertical) { gx=(tmwall->tilex<<16)+0x8000; gy=(tmwall->tiley<<16); visptr->texturestart=0; visptr->textureend=0; if (viewxshapenum=tmwall->bottomtexture; visptr->altshapenum=tmwall->midtexture; visptr->viewx=tmwall->toptexture; visptr->shapesize=2; } else { gx=(tmwall->tilex<<16); gy=(tmwall->tiley<<16)+0x8000; visptr->texturestart=0; visptr->textureend=0; if (viewyshapenum=tmwall->bottomtexture; visptr->altshapenum=tmwall->midtexture; visptr->viewx=tmwall->toptexture; visptr->shapesize=2; } if ((tmwall->flags&MW_TOPFLIPPING) && (nonbobpheight>64) ) { visptr->viewx++; } else if ((tmwall->flags&MW_BOTTOMFLIPPING) && (nonbobpheight>maxheight-32) ) { visptr->shapenum++; } if ((visptr < &vislist[MAXVISIBLE-1]) && (result==true)) // don't let it overflo' visptr++; } } // // place static objects // UpdateClientControls(); for (statptr = firstactivestat ; statptr; statptr=statptr->nextactive) { //redraw: if((visptr->shapenum = statptr->shapenum) == NOTHING) continue; visptr->shapenum += shapestart; if ((visptr->shapenum <= shapestart) || (visptr->shapenum >= shapestop)) Error("actor shapenum %d out of range (%d-%d)",visptr->shapenum,shapestart,shapestop); visspot = statptr->visspot; if (!((*(visspot-0)) || (*(visspot-1)) || (*(visspot+1)) || (*(visspot-129)) || (*(visspot-128)) || (*(visspot-127)) || (*(visspot+129)) || (*(visspot+128)) || (*(visspot+127)))) {statptr->flags &= ~FL_VISIBLE; continue; // not visible } result = TransformObject (statptr->x,statptr->y,&(visptr->viewx),&(visptr->viewheight)); if ((result==false) || (visptr->viewheight< (1<<(HEIGHTFRACTION+2)))) continue; // to close to the object statptr->flags |= FL_SEEN; statptr->flags |= FL_VISIBLE; if (statptr->flags & FL_ROTATING) visptr->shapenum += StatRotate(statptr); if (statptr->flags&FL_TRANSLUCENT) { visptr->shapesize=1; if (statptr->flags&FL_FADING) visptr->h2=transparentlevel; else visptr->h2=FIXEDTRANSLEVEL; SetSpriteLightLevel(statptr->x,statptr->y,visptr,0,(statptr->flags&FL_FULLLIGHT)); } else if (statptr->flags&FL_SOLIDCOLOR) { visptr->shapesize=4; visptr->h2=statptr->hitpoints; } else if (statptr->flags&FL_COLORED) { visptr->shapesize=0; SetColorLightLevel(statptr->x,statptr->y,visptr, 0,statptr->hitpoints, (statptr->flags&FL_FULLLIGHT)); } else { visptr->shapesize=0; SetSpriteLightLevel(statptr->x,statptr->y,visptr,0,(statptr->flags&FL_FULLLIGHT)); } visptr->h1=pheight-statptr->z; if ((statptr->itemnumber != (unsigned int)-1) && (statptr->flags&FL_HEIGHTFLIPPABLE) ) { if (statptr->itemnumber==stat_disk) { int value; value=nonbobpheight-statptr->z-32; if ((value<=HF_2) && (value>HF_1)) { visptr->shapenum++; } else if ((value<=HF_1) && (value>=-HF_1)) { visptr->shapenum+=2; } else if ((value<-HF_1) && (value>=-HF_2)) { visptr->shapenum+=3; } else if (value<-HF_2) { visptr->shapenum+=4; } } else if ((nonbobpheight-statptr->z)<-16) { visptr->shapenum++; } } if (visptr < &vislist[MAXVISIBLE-1]) // don't let it overflo' visptr++; } // // place active objects // UpdateClientControls(); for (obj = firstactive;obj;obj=obj->nextactive) { if (obj==player) continue; if ((visptr->shapenum = obj->shapenum) == NOTHING) continue; // no shape visptr->shapenum += shapestart; if ((visptr->shapenum <= shapestart) || (visptr->shapenum >= shapestop)) Error("actor shapenum %d out of range (%d-%d)",visptr->shapenum,shapestart,shapestop); visspot = &spotvis[obj->tilex][obj->tiley]; // // could be in any of the nine surrounding tiles // if (*visspot || ( *(visspot-1)) || ( *(visspot+1)) || ( *(visspot-129)) || ( *(visspot-128)) || ( *(visspot-127)) || ( *(visspot+129)) || ( *(visspot+128)) || ( *(visspot+127)) ) { // result = TransformObject (obj->drawx, obj->drawy,&(visptr->viewx),&(visptr->viewheight)); result = TransformObject (obj->x, obj->y,&(visptr->viewx),&(visptr->viewheight)); if ((result==false) || (visptr->viewheight< (1<<(HEIGHTFRACTION+2)))) continue; // to close to the object if (obj->state->rotate) visptr->shapenum += CalcRotate (obj); visptr->shapesize=0; if (player->flags&FL_SHROOMS) { visptr->shapesize=4; visptr->h2=(GetTicCount()&0xff); } if (obj->obclass==playerobj) { if (obj->flags&FL_GODMODE) { visptr->shapesize=4; visptr->h2=240+(GetTicCount()&0x7); } else if (obj->flags & FL_COLORED) { playertype *pstate; M_LINKSTATE(obj,pstate); SetColorLightLevel(obj->x,obj->y,visptr, obj->dir,pstate->uniformcolor, (obj->flags&FL_FULLLIGHT) ); } else SetSpriteLightLevel(obj->x,obj->y,visptr,obj->dir,(obj->flags&FL_FULLLIGHT)); } else { if ((obj->obclass >= b_darianobj) && (obj->obclass <= b_robobossobj) && MISCVARS->redindex) { visptr->colormap=redmap+((MISCVARS->redindex-1)<<8); } else { SetSpriteLightLevel(obj->x,obj->y,visptr,obj->dir,(obj->flags&FL_FULLLIGHT)); } } visptr->h1= pheight - obj->z; if (obj->obclass==diskobj) { int value; value=nonbobpheight-obj->z-32; if ((value<=HF_2) && (value>HF_1)) { visptr->shapenum++; } else if ((value<=HF_1) && (value>=-HF_1)) { visptr->shapenum+=2; } else if ((value<-HF_1) && (value>=-HF_2)) { visptr->shapenum+=3; } else if (value<-HF_2) { visptr->shapenum+=4; } } else if ( (obj->obclass==pillarobj) && ((nonbobpheight-obj->z)<-16) ) { visptr->shapenum++; } if (visptr < &vislist[MAXVISIBLE-1]) // don't let it overflo' visptr++; obj->flags |= FL_SEEN; obj->flags |= FL_VISIBLE; } else obj->flags &= ~FL_VISIBLE; } // // draw from back to front // numvisible = visptr-&vislist[0]; if (!numvisible) return; // no visible objects SortVisibleList( numvisible, &vislist[0] ); UpdateClientControls(); for (i = 0; ishapesize==4) { ScaleSolidShape(sortedvislist[i]); } else if (sortedvislist[i]->shapesize==3) { InterpolateDoor (sortedvislist[i]); } else if (sortedvislist[i]->shapesize==2) { InterpolateMaskedWall (sortedvislist[i]); } else if (sortedvislist[i]->shapesize==1) { ScaleTransparentShape(sortedvislist[i]); } else { ScaleShape(sortedvislist[i]); } } } //========================================================================== /* ============== = = DrawPlayerWeapon = = Draw the player's hand' = ============== */ void DrawPlayerWeapon (void) { int shapenum,index; int xdisp=0; int ydisp=0; int female,black; int altshape=0; whereami=7; SoftError("\n attackframe: %d, weaponframe: %d, weapondowntics: %d" " weaponuptics: %d",locplayerstate->attackframe, locplayerstate->weaponframe,locplayerstate->weapondowntics, locplayerstate->weaponuptics); if ((locplayerstate->NETCAPTURED == 1) && (!locplayerstate->HASKNIFE)) return; if (locplayerstate->weapon != -1) {female = ((locplayerstate->player == 1) || (locplayerstate->player == 3)); black = (locplayerstate->player == 2); if (((locplayerstate->NETCAPTURED >= 1) || (locplayerstate->NETCAPTURED == -2)) && (locplayerstate->HASKNIFE == 1)) // if raising or lowering {index = 0; shapenum = gunsstart + weaponshape[index] + locplayerstate->weaponframe; } else if (locplayerstate->weapon != wp_twopistol) {if (locplayerstate->weapon==wp_pistol) {if (female) index = NUMWEAPGRAPHICS-2; else if (black) index = NUMWEAPGRAPHICS-1; else #if (SHAREWARE == 0) index = 1; #else index = 0; #endif } else #if (SHAREWARE == 0) index = locplayerstate->weapon + 1; #else index = locplayerstate->weapon; #endif if ((index<0) || (index>=NUMWEAPGRAPHICS)) Error ("Weapon shapenum out of range\n"); shapenum = gunsstart + weaponshape[index] + locplayerstate->weaponframe; #if (SHAREWARE == 0) if ((shapenum < W_GetNumForName("KNIFE1")) || (shapenum > W_GetNumForName("DOGPAW4")) ) #else if ((shapenum < W_GetNumForName("MPIST11")) || (shapenum > W_GetNumForName("GODHAND8")) ) #endif Error("\n illegal weapon shapenum %d, index %d, weaponframe %d", shapenum,index,locplayerstate->weaponframe); } else { #if (SHAREWARE == 0) if (female) {altshape = W_FLEFTPISTOL1; shapenum = W_FRIGHTPISTOL1; } else if (black) {altshape = W_BMLEFTPISTOL1; shapenum = W_BMRIGHTPISTOL1; } else #endif {altshape = W_MLEFTPISTOL1; shapenum = W_MRIGHTPISTOL1; } altshape += gunsstart; shapenum += gunsstart; if (locplayerstate->weaponframe > 2) altshape += (locplayerstate->weaponframe - 3); else shapenum += locplayerstate->weaponframe; } if (!(locplayerstate->NETCAPTURED) || (locplayerstate->NETCAPTURED == -1) || (locplayerstate->HASKNIFE == 0)) {switch (locplayerstate->weapon) { case wp_godhand: break; case wp_mp40: break; case wp_firewall: ydisp = 10; break; case wp_bazooka: break; case wp_heatseeker: ydisp = 20; break; case wp_pistol: break; case wp_twopistol: xdisp = 80; break; case wp_drunk: ydisp = 10; break; case wp_firebomb: break; #if (SHAREWARE == 0) case wp_kes: break; case wp_bat: xdisp = 20; break; case wp_split: ydisp = 20; break; case wp_dog: break; #endif default: Error("Illegal weapon value = %d\n",locplayerstate->weapon); break; } } else xdisp = 60; if (altshape) { int temp; int delta; temp = weaponscale; delta = FixedMul((weaponbobx<<9),weaponscale); weaponscale += delta; ScaleWeapon(xdisp - weaponbobx,ydisp + weaponboby + locplayerstate->weaponheight,shapenum); weaponscale -= delta; ScaleWeapon(weaponbobx - 80,ydisp + weaponboby + locplayerstate->weaponheight,altshape); weaponscale = temp; } else { int temp; int delta; temp = weaponscale; delta = FixedMul((weaponbobx<<9),weaponscale); weaponscale -= delta; ScaleWeapon(xdisp + weaponbobx,ydisp + weaponboby + locplayerstate->weaponheight,shapenum); weaponscale = temp; } } } void AdaptDetail ( void ) { #if PROFILE return; #else whereami=8; if ((preindex<0) || (preindex>2)) Error("preindex out of range\n"); pretics[preindex]=(pretics[0]+pretics[1]+pretics[2]+(tics<<16)+0x8000)>>2; if (pretics[preindex]>GOLOWER) { pretics[0]=GOHIGHER; pretics[1]=GOHIGHER; pretics[2]=GOHIGHER; doublestep++; if (doublestep>2) doublestep=2; } else if (pretics[preindex]0) doublestep--; } preindex++; if (preindex>2) preindex=0; #endif } /* ===================== = = CalcTics = ===================== */ extern void I_Sleep (int ms); void CalcTics (void) { #if PROFILE tics=PROFILETICS; GetTicCount()+=PROFILETICS; oldtime=GetTicCount(); return; #else volatile int tc; whereami=9; // SoftError("InCalcTics\n"); // SoftError("CT GetTicCount()=%ld\n",GetTicCount()); // SoftError("CT oldtime=%ld\n",oldtime); // // calculate tics since last refresh for adaptive timing // tc=GetTicCount(); while (tc==oldtime) { tc=GetTicCount(); I_Sleep(1);} /* endwhile */ tics=tc-oldtime; // SoftError("CT GetTicCount()=%ld\n",GetTicCount()); // if (tics>MAXTICS) // { // tc-=(tics-MAXTICS); // GetTicCount() = tc; // tics = MAXTICS; // } if (demoplayback || demorecord) { if (tics>MAXTICS) { tc=oldtime+MAXTICS; tics=MAXTICS; ISR_SetTime(tc); } } oldtime=tc; #endif } /* ========================== = = SetSpriteLightLevel = ========================== */ void SetSpriteLightLevel (int x, int y, visobj_t * sprite, int dir, int fullbright) { int i; int lv; int intercept; whereami=10; if (MISCVARS->GASON==1) { sprite->colormap=greenmap+(MISCVARS->gasindex<<8); return; } if (fulllight || fullbright) { sprite->colormap=colormap+(1<<12); return; } if (fog) { i=((sprite->viewheight*200/iGLOBAL_SCREENHEIGHT)>>normalshade)+minshade; if (i>maxshade) i=maxshade; sprite->colormap=colormap+(i<<8); } else { if (lightsource) { if (dir==east || dir==west) intercept=(x>>11)&0x1c; else intercept=(y>>11)&0x1c; lv=(((LightSourceAt(x>>16,y>>16)>>intercept)&0xf)>>1); i=maxshade-(sprite->viewheight>>normalshade)-lv; if (icolormap=colormap+(i<<8); } else { i=maxshade-(sprite->viewheight>>normalshade); if (icolormap=colormap+(i<<8); } } } /* ========================== = = SetColorLightLevel = ========================== */ void SetColorLightLevel (int x, int y, visobj_t * sprite, int dir, int color, int fullbright) { int i; int lv; int intercept; int height; byte * map; whereami=11; height=sprite->viewheight<<1; map=playermaps[color]; if (MISCVARS->GASON==1) { sprite->colormap=greenmap+(MISCVARS->gasindex<<8); return; } if ((fulllight) || (fullbright)) { sprite->colormap=map+(1<<12); return; } if (fog) { i=((height*200/iGLOBAL_SCREENHEIGHT)>>normalshade)+minshade; if (i>maxshade) i=maxshade; sprite->colormap=map+(i<<8); } else { if (lightsource) { if (dir==east || dir==west) intercept=(x>>11)&0x1c; else intercept=(y>>11)&0x1c; lv=(((LightSourceAt(x>>16,y>>16)>>intercept)&0xf)>>1); i=maxshade-(height>>normalshade)-lv; if (icolormap=map+(i<<8); } else { i=maxshade-(height>>normalshade); if (icolormap=map+(i<<8); } } } /* ========================== = = SetWallLightLevel = ========================== */ void SetWallLightLevel (wallcast_t * post) { int la; int lv; int i; whereami=12; if (MISCVARS->GASON==1) { shadingtable=greenmap+(MISCVARS->gasindex<<8); return; } switch (post->posttype) { case 0: la=0; break; case 1: la=4; break; case 2: la=(4-gamestate.difficulty); break; case 3: la=3+(4-gamestate.difficulty); break; } if (lightsource) { int x,y; int intercept; x=post->offset>>7; y=post->offset&0x7f; intercept=(post->texture>>11)&0x1c; lv=(((LightSourceAt(x,y)>>intercept)&0xf)>>1); } else lv=0; if (fulllight) { if (fog) { i =16+minshade-lv+la; if (i>maxshade+la) i=maxshade+la; shadingtable=colormap+(i<<8); } else { i =maxshade-16-lv+la; if (i>=maxshade) i=maxshade; if (iwallheight*200/iGLOBAL_SCREENHEIGHT)>>normalshade)+minshade-lv+la; if (i>maxshade+la) i=maxshade+la; shadingtable=colormap+(i<<8); } else { i =maxshade-(post->wallheight>>normalshade)-lv+la; if (i>=maxshade) i=maxshade; if (ilump) src=W_CacheLumpNum(post->lump,PU_CACHE, CvtNull, 1); if (post->alttile!=0) { if (post->alttile==-1) { ht=maxheight+32; dc_invscale = post->wallheight<<(10-HEIGHTFRACTION); dc_texturemid = (pheight<>1); topscreen = centeryfrac - FixedMul(dc_texturemid,dc_invscale); bottomscreen = topscreen + (dc_invscale*ht); dc_yh = ((bottomscreen-1)>>SFRACBITS)+1; if (dc_yh < 0) { post->floorclip=-1; post->ceilingclip=0; } else if (dc_yh >= viewheight) { post->floorclip=viewheight-1; post->ceilingclip=viewheight; } else { post->floorclip=dc_yh-1; post->ceilingclip=dc_yh; } return; } else { ht=nominalheight; src2=W_CacheLumpNum(post->alttile,PU_CACHE, CvtNull, 1); } } else { ht=maxheight+32; src2=src; } dc_invscale = post->wallheight<<(10-HEIGHTFRACTION); dc_texturemid = (pheight<>1); topscreen = centeryfrac - FixedMul(dc_texturemid,dc_invscale); bottomscreen = topscreen + (dc_invscale*ht); dc_yl = (topscreen+SFRACUNIT-1)>>SFRACBITS; dc_yh = ((bottomscreen-1)>>SFRACBITS)+1; if (dc_yl >= viewheight) { post->ceilingclip=viewheight; post->floorclip=viewheight-1; return; } else if (dc_yl < 0) dc_yl = 0; dc_iscale = (64<<(16+HEIGHTFRACTION))/post->wallheight; if (dc_yh < 0) { post->floorclip=-1; post->ceilingclip=0; goto bottomcheck; } else if (dc_yh > viewheight) dc_yh = viewheight; post->ceilingclip=dc_yl; post->floorclip=dc_yh-1; dc_source=src2+((post->texture>>4)&0xfc0); R_DrawWallColumn (buf); bottomcheck: if (ht!=nominalheight) return; dc_texturemid-=(nominalheight<>SFRACBITS; dc_yh = ((bottomscreen-1)>>SFRACBITS); if (dc_yl >= viewheight) return; else if (dc_yl < 0) dc_yl = 0; if (dc_yh < 0) return; else if (dc_yh > viewheight) dc_yh = viewheight; post->floorclip=dc_yh-1; dc_source=src+((post->texture>>4)&0xfc0); R_DrawWallColumn (buf); } /* ==================== = = DrawWalls = ==================== */ void DrawWalls (void) { byte * buf; int plane; wallcast_t * post; whereami=13; plane = 0; if (doublestep>1) { { VGAMAPMASK((1<ceilingclip=post->ceilingclip; (post+1)->floorclip=post->floorclip; } } } else { { VGAWRITEMAP(plane); buf=(byte *)(bufferofs); for (post=&posts[plane];post<&posts[viewwidth];post++,buf++) { SetWallLightLevel(post); DrawWallPost(post,buf); } } } } /* ==================== = = TransformDoors = ==================== */ void TransformDoors( void ) { int i; int numvisible; boolean result; int gx,gy; visobj_t visdoorlist[MAXVISIBLEDOORS],*doorptr; whereami=14; doorptr=&visdoorlist[0]; // // place door objects // for (i = 0;itilex][doorobjlist[i]->tiley]) { mapseen[doorobjlist[i]->tilex][doorobjlist[i]->tiley]=1; doorptr->texturestart=0; doorptr->textureend=0; if (doorobjlist[i]->vertical) { gx=(doorobjlist[i]->tilex<<16)+0x8000; gy=(doorobjlist[i]->tiley<<16); if (viewxtilex<<16); gy=(doorobjlist[i]->tiley<<16)+0x8000; if (viewyviewx=0; doorptr->shapenum=doorobjlist[i]->texture; doorptr->altshapenum=doorobjlist[i]->alttexture; if (doorobjlist[i]->texture==doorobjlist[i]->basetexture) { doorptr->shapesize=(doorobjlist[i]->tilex<<7)+doorobjlist[i]->tiley; if (doorptr < &visdoorlist[MAXVISIBLEDOORS-1]) // don't let it overflo' doorptr++; } else { doorptr->shapesize=3; memcpy(visptr,doorptr,sizeof(visobj_t)); if (visptr < &vislist[MAXVISIBLE-1]) visptr++; } } } } // // draw from back to front // numvisible = doorptr-&visdoorlist[0]; if (!numvisible) return; SortVisibleList( numvisible, &visdoorlist[0] ); for (i = 0; iaction==pw_pushed) || (pwallobjlist[i]->action==pw_npushed)) continue; visspot = &spotvis[pwallobjlist[i]->x>>16][pwallobjlist[i]->y>>16]; if (*visspot || ( *(visspot-1)) || ( *(visspot+1)) || ( *(visspot-128)) || ( *(visspot+128))) { gx=pwallobjlist[i]->x; gy=pwallobjlist[i]->y; mapseen[gx>>16][gy>>16]=1; if (viewxtexturestart=(gx-0x8000)&0xffff; visptr->textureend=visptr->texturestart; result=TransformPlane(gx+0x7fff,gy-0x8000,gx-0x8000,gy-0x8000,visptr); visptr->texturestart^=0xffff; visptr->textureend^=0xffff; visptr->shapenum=pwallobjlist[i]->texture; visptr->shapesize=((pwallobjlist[i]->x>>16)<<7)+(pwallobjlist[i]->y>>16); visptr->viewx+=2; if ((visptr < &vislist[MAXVISIBLE-1]) && (result==true)) // don't let it overflo' visptr++; visptr->texturestart=(gy-0x8000)&0xffff; visptr->textureend=visptr->texturestart;//-0xffff; result=TransformPlane(gx-0x8000,gy-0x8000,gx-0x8000,gy+0x7fff,visptr); } else { visptr->texturestart=(gy-0x8000)&0xffff; visptr->textureend=visptr->texturestart;//-0xffff; result=TransformPlane(gx-0x8000,gy-0x8000,gx-0x8000,gy+0x7fff,visptr); visptr->shapenum=pwallobjlist[i]->texture; visptr->shapesize=((pwallobjlist[i]->x>>16)<<7)+(pwallobjlist[i]->y>>16); visptr->viewx+=2; if ((visptr < &vislist[MAXVISIBLE-1]) && (result==true)) // don't let it overflo' visptr++; visptr->texturestart=(gx-0x8000)&0xffff; visptr->textureend=visptr->texturestart;//-0xffff; result=TransformPlane(gx-0x8000,gy+0x7fff,gx+0x7fff,gy+0x7fff,visptr); } } else { if (viewytexturestart=(gy-0x8000)&0xffff; visptr->textureend=visptr->texturestart; result=TransformPlane(gx+0x7fff,gy+0x7fff,gx+0x7fff,gy-0x8000,visptr); visptr->texturestart^=0xffff; visptr->textureend^=0xffff; visptr->shapenum=pwallobjlist[i]->texture; visptr->shapesize=((pwallobjlist[i]->x>>16)<<7)+(pwallobjlist[i]->y>>16); visptr->viewx+=2; if ((visptr < &vislist[MAXVISIBLE-1]) && (result==true)) // don't let it overflo' visptr++; visptr->texturestart=(gx-0x8000)&0xffff; visptr->textureend=visptr->texturestart; result=TransformPlane(gx+0x7fff,gy-0x8000,gx-0x8000,gy-0x8000,visptr); visptr->texturestart^=0xffff; visptr->textureend^=0xffff; } else { visptr->texturestart=(gx-0x8000)&0xffff; visptr->textureend=visptr->texturestart;//-0xffff; result=TransformPlane(gx-0x8000,gy+0x7fff,gx+0x7fff,gy+0x7fff,visptr); visptr->shapenum=pwallobjlist[i]->texture; visptr->shapesize=((pwallobjlist[i]->x>>16)<<7)+(pwallobjlist[i]->y>>16); visptr->viewx+=2; if ((visptr < &vislist[MAXVISIBLE-1]) && (result==true)) // don't let it overflo' visptr++; visptr->texturestart=(gy-0x8000)&0xffff; visptr->textureend=visptr->texturestart; result=TransformPlane(gx+0x7fff,gy+0x7fff,gx+0x7fff,gy-0x8000,visptr); visptr->texturestart^=0xffff; visptr->textureend^=0xffff; } } visptr->viewx+=2; visptr->shapenum=pwallobjlist[i]->texture; visptr->shapesize=((pwallobjlist[i]->x>>16)<<7)+(pwallobjlist[i]->y>>16); if ((visptr < &vislist[MAXVISIBLE-1]) && (result==true)) // don't let it overflo' visptr++; } } // // draw from back to front // numvisible = visptr-savedptr; if (!numvisible) return; SortVisibleList( numvisible, savedptr ); for (i = 0; ishapenum & 0x1000) sortedvislist[i]->shapenum=animwalls[sortedvislist[i]->shapenum&0x3ff].texture; sortedvislist[i]->altshapenum=0; InterpolateWall (sortedvislist[i]); } visptr=savedptr; } /* ==================== = = WallRefresh = ==================== */ void WallRefresh (void) { volatile int dtime; int mag; int yzangle; whereami=16; firstcoloffset=(firstcoloffset+(tics<<8))&65535; dtime=GetFastTics(); if (missobj) { viewangle=missobj->angle; viewx=missobj->x-costable[viewangle]; viewy=missobj->y+sintable[viewangle]; pheight = missobj->z + 32; nonbobpheight=pheight; spotvis[missobj->tilex][missobj->tiley]=1; yzangle=missobj->yzangle; } else { if (player->flags&FL_SHROOMS) { viewangle = (player->angle + FixedMulShift(FINEANGLES,sintable[(GetTicCount()<<5)&(FINEANGLES-1)],(16+4)))&(FINEANGLES-1); ChangeFocalWidth(FixedMulShift(40,sintable[(GetTicCount()<<5)&(FINEANGLES-1)],16)); } else viewangle = player->angle; if ((viewangle<0) && (viewangle>=FINEANGLES)) Error ("View angle out of range = %d\n",viewangle); viewx = player->x; viewy = player->y; pheight = player->z + locplayerstate->playerheight + locplayerstate->heightoffset; nonbobpheight=pheight; if ( ( (player->z == nominalheight) || (IsPlatform(player->tilex,player->tiley)) || (DiskAt(player->tilex,player->tiley)) ) && (!(player->flags & FL_DOGMODE)) && (BobbinOn==true) && (GamePaused==false) ) { int mag; mag=(player->speed>MAXBOB ? MAXBOB : player->speed); pheight+=FixedMulShift(mag,sintable[(GetTicCount()<<7)&2047],28); weaponbobx=FixedMulShift(mag,costable[((GetTicCount()<<5))&(FINEANGLES-1)],27); weaponboby=FixedMulShift(mag,sintable[((GetTicCount()<<5))&((FINEANGLES/2)-1)],26); } else { weaponbobx=0; weaponboby=0; } yzangle=player->yzangle; spotvis[player->tilex][player->tiley]=1; } if (yzangle > ANG180) pheight -= (sintable[yzangle&2047] >> 14); else pheight += (sintable[yzangle&2047] >> 14); viewx -= (FixedMul(sintable[yzangle&2047],costable[viewangle&2047])>>1); viewy += (FixedMul(sintable[yzangle&2047],sintable[viewangle&2047])>>1); // Set YZ angle centery=viewheight>>1; if (yzangle>ANG180) centery-=FixedMul(FINEANGLES-yzangle,yzangleconverter); else centery+=FixedMul(yzangle,yzangleconverter); centeryfrac=(centery<<16); if (pheight < 1) pheight = 1; else if (pheight > maxheight+30) pheight = maxheight+30; if (nonbobpheight < 1) nonbobpheight = 1; else if (nonbobpheight > maxheight+30) nonbobpheight = maxheight+30; // Set light level of touchplates etc. mag=7+((3-gamestate.difficulty)<<2); transparentlevel=FixedMul(mag,sintable[(GetTicCount()<<5)&(FINEANGLES-1)])+mag; viewsin = sintable[viewangle]; viewcos = costable[viewangle]; c_startx=(scale*viewcos)-(centerx*viewsin); c_starty=(-scale*viewsin)-(centerx*viewcos); Refresh (); UpdateClientControls(); TransformPushWalls(); TransformDoors(); UpdateClientControls(); DrawWalls(); UpdateClientControls(); walltime=GetFastTics()-dtime; } /* ==================== = = GetRainBoundingBox = ==================== */ void GetRainBoundingBox (int * xmin, int * xmax, int * ymin, int * ymax) { wallcast_t * post; int x,y; // zero out all boundaries by default *xmax=0; *ymax=0; *xmin=127<<16; *ymin=127<<16; // check player's x and y if (viewx<(*xmin)) (*xmin)=viewx; else if (viewx>(*xmax)) (*xmax)=viewx; if (viewy<(*ymin)) (*ymin)=viewy; else if (viewy>(*ymax)) (*ymax)=viewy; for (post=&posts[0];post<&posts[viewwidth];post+=(viewwidth>>2)) { x=(post->offset>>7)<<16; y=(post->offset&0x7f)<<16; if (x<(*xmin)) (*xmin)=x; else if (x>(*xmax)) (*xmax)=x; if (y<(*ymin)) (*ymin)=y; else if (y>(*ymax)) (*ymax)=y; } } /* ======================== = = InterpolateWall = ======================== */ void InterpolateWall (visobj_t * plane) { int d1,d2; int top; int topinc; int bot; int botinc; int i; int texture; int dh; int dx; int height; whereami=17; dx=(plane->x2-plane->x1+1); if (plane->h1<=0 || plane->h2<=0 || dx==0) return; d1=(1<<(16+HEIGHTFRACTION)) / plane->h1; d2=(1<<(16+HEIGHTFRACTION)) / plane->h2; dh=(((plane->h2-plane->h1)<textureend-plane->texturestart,4); bot=d2*dx; botinc=d1-d2; height=plane->h1<x1>=viewwidth) return; for (i=plane->x1;i<=plane->x2;i++) { if ((i>=0 && i>DHEIGHTFRACTION))) { if (bot) { texture=((top/bot)+(plane->texturestart>>4))&0xfc0; posts[i].texture=texture<<4; posts[i].lump=plane->shapenum; posts[i].alttile=plane->altshapenum; posts[i].posttype=plane->viewx; posts[i].offset=plane->shapesize; posts[i].wallheight=height>>DHEIGHTFRACTION; } } top+=topinc; bot+=botinc; height+=dh; } } /* ======================== = = InterpolateDoor = ======================== */ void InterpolateDoor (visobj_t * plane) { int d1,d2; int top; int topinc; int bot; int botinc; int i; int texture; int dh; int dx; int height; int bottomscreen; byte * shape; byte * shape2; byte * buf; patch_t *p; whereami=18; dx=(plane->x2-plane->x1+1); if (plane->h1<=0 || plane->h2<=0 || dx==0) return; shape=W_CacheLumpNum(plane->shapenum,PU_CACHE, Cvt_patch_t, 1); shape2=W_CacheLumpNum(plane->altshapenum,PU_CACHE, Cvt_patch_t, 1); p=(patch_t *)shape; d1=(1<<(16+HEIGHTFRACTION)) / plane->h1; d2=(1<<(16+HEIGHTFRACTION)) / plane->h2; dh=(((plane->h2-plane->h1)<textureend-plane->texturestart,4); botinc=d1-d2; if (plane->x1>=viewwidth) return; { top=0; bot=(d2*dx); height=(plane->h1<x1); for (i=plane->x1;i<=plane->x2;i++,buf++) { if ((i>=0 && i>DHEIGHTFRACTION)) ) { dc_invscale=height>>(HEIGHTFRACTION+DHEIGHTFRACTION-10); dc_iscale = 0xffffffffu/(unsigned)dc_invscale; dc_texturemid=((pheight-nominalheight+p->topoffset)<>1); sprtopoffset=centeryfrac - FixedMul(dc_texturemid,dc_invscale); texture=((top/bot)+(plane->texturestart>>4))>>6; SetLightLevel(height>>DHEIGHTFRACTION); ScaleMaskedPost (p->collumnofs[texture]+shape,buf); if (levelheight>1) { sprtopoffset-=(dc_invscale<<6)*(levelheight-1); bottomscreen =sprtopoffset + (dc_invscale*nominalheight); dc_yl = (sprtopoffset+SFRACUNIT-1)>>SFRACBITS; dc_yh = ((bottomscreen-1)>>SFRACBITS)+1; if (dc_yl >= viewheight) continue; else if (dc_yl < 0) dc_yl = 0; if (dc_yh > viewheight) dc_yh = viewheight; dc_source=shape2+((texture<<6)&0xfc0); R_DrawWallColumn (buf); } } top+=topinc; bot+=botinc; height+=dh; } } } /* ======================== = = InterpolateMaskedWall = ======================== */ void InterpolateMaskedWall (visobj_t * plane) { int d1,d2; int top; int topinc; int bot; int botinc; int i; int j; int texture; int dh; int dx; int height; byte * shape; byte * shape2; byte * shape3; byte * buf; transpatch_t *p; patch_t *p2; patch_t *p3; boolean drawbottom,drawmiddle,drawtop; int topoffset; whereami=19; dx=(plane->x2-plane->x1+1); if (plane->h1<=0 || plane->h2<=0 || dx==0) return; if (plane->altshapenum>=0) { drawmiddle=true; shape2=W_CacheLumpNum(plane->altshapenum,PU_CACHE, Cvt_patch_t, 1); p2=(patch_t *)shape2; topoffset=p2->topoffset; } else { drawmiddle=false; } if (plane->viewx>=0) { drawtop=true; shape3=W_CacheLumpNum(plane->viewx,PU_CACHE, Cvt_patch_t, 1); p3=(patch_t *)shape3; topoffset=p3->topoffset; } else { drawtop=false; } if (plane->shapenum>=0) { drawbottom=true; shape=W_CacheLumpNum(plane->shapenum,PU_CACHE, Cvt_transpatch_t, 1); p = (transpatch_t *)shape; topoffset=p->topoffset; } else { drawbottom=false; } d1=(1<<(16+HEIGHTFRACTION)) / plane->h1; d2=(1<<(16+HEIGHTFRACTION)) / plane->h2; dh=(((plane->h2-plane->h1)<textureend-plane->texturestart,4); botinc=d1-d2; if (plane->x1>=viewwidth) return; { top=0; bot=(d2*dx); height=(plane->h1<x1); for (i=plane->x1;i<=plane->x2;i++,buf++) { if ((i>=0 && i>DHEIGHTFRACTION)) ) { dc_invscale=height>>(HEIGHTFRACTION+DHEIGHTFRACTION-10); dc_iscale = 0xffffffffu/(unsigned)dc_invscale; dc_texturemid=((pheight-nominalheight+topoffset)<>1); sprtopoffset=centeryfrac - FixedMul(dc_texturemid,dc_invscale); texture=((top/bot)+(plane->texturestart>>4))>>6; SetLightLevel(height>>DHEIGHTFRACTION); if (drawbottom==true) ScaleTransparentPost (p->collumnofs[texture]+shape,buf,(p->translevel+8)); for (j=0;jcollumnofs[texture]+shape2,buf); } if (levelheight>1) { sprtopoffset-=(dc_invscale<<6); dc_texturemid+=(1<<22); if (drawtop==true) ScaleMaskedPost (p3->collumnofs[texture]+shape3,buf); } } top+=topinc; bot+=botinc; height+=dh; } } } /* ======================== = = DrawPlayerLocation = ======================== */ #define PLX (320-24) #define PLY 16 void DrawPlayerLocation ( void ) { int i; char buf[30]; CurrentFont=tinyfont; whereami=20; VGAMAPMASK(15); for (i=0;i<18;i++) memset((byte *)bufferofs+(ylookup[i+PLY])+PLX,0,6); px=PLX; py=PLY; VW_DrawPropString(strupr(itoa(player->x,&buf[0],16))); px=PLX; py=PLY+6; VW_DrawPropString(strupr(itoa(player->y,&buf[0],16))); px=PLX; py=PLY+12; VW_DrawPropString(strupr(itoa(player->angle,&buf[0],16))); } /* ======================== = = ThreeDRefresh = ======================== */ int playerview=0; void ThreeDRefresh (void) { objtype * tempptr; whereami=21; tempptr=player; // // Erase old messages // RestoreMessageBackground(); bufferofs += screenofs; RefreshClear(); UpdateClientControls (); // // follow the walls from there to the right, drawwing as we go // visptr = &vislist[0]; WallRefresh (); UpdateClientControls (); if (fandc) DrawPlanes(); UpdateClientControls (); // // draw all the scaled images // DrawScaleds(); // draw scaled stuff UpdateClientControls (); if (!missobj) { if (locplayerstate->NETCAPTURED && (locplayerstate->NETCAPTURED != -2)) { int value; if (locplayerstate->NETCAPTURED < 0) value = -locplayerstate->NETCAPTURED; else value = locplayerstate->NETCAPTURED; DrawScreenSizedSprite(netlump+value-1); } DrawPlayerWeapon (); // draw player's hand' if (SCREENEYE) DrawScreenSprite(SCREENEYE->targettilex,SCREENEYE->targettiley,SCREENEYE->state->condition + GIBEYE1 + shapestart); UpdateClientControls (); if (player->flags&FL_GASMASK) DrawScreenSizedSprite(gmasklump); if ( SHOW_PLAYER_STATS() ) { DrawStats (); } DoBorderShifts (); UpdateClientControls (); } bufferofs -= screenofs; DrawMessages(); bufferofs += screenofs; if ( ((GamePaused==true) && (!Keyboard[sc_LShift])) || (controlupdatestarted==0) ) DrawPause (); // // show screen and time last cycle // if ((fizzlein==true) && (modemgame==false)) { if (newlevel==true) ShutdownClientControls(); bufferofs-=screenofs; DrawPlayScreen (true); RotateBuffer(0,FINEANGLES,FINEANGLES*8,FINEANGLES,(VBLCOUNTER*3)/4); bufferofs+=screenofs; fizzlein = false; StartupClientControls(); } bufferofs -= screenofs; UpdateClientControls (); if (HUD == true) DrawPlayerLocation(); FlipPage(); gamestate.frame++; player=tempptr; } //****************************************************************************** // // FlipPage // //****************************************************************************** void FlipPage ( void ) { whereami=22; if ( ( SHAKETICS != 0xFFFF ) && ( !inmenu ) && ( !GamePaused ) && ( !fizzlein ) ) { ScreenShake (); } /* TODO some shake thing */ /* just call the one in modexlib.c */ XFlipPage(); } //****************************************************************************** // // TurnShakeOff // //****************************************************************************** void TurnShakeOff ( void ) { // _disable(); OUTP (CRTC_INDEX, CRTC_STARTHIGH ); OUTP (CRTC_DATA, ( ( displayofs & 0x0000ffff ) >> 8 ) ); OUTP (CRTC_INDEX, CRTC_STARTLOW); OUTP (CRTC_DATA, (displayofs&0x000000FF)); // _enable(); SHAKETICS = 0xFFFF; } //****************************************************************************** // // DrawScaledScreen // draw sreen after reentering fro restore game //****************************************************************************** void DrawScaledScreen(int x, int y, int step, byte * src) { int xfrac; int yfrac; // int plane; int i,j; byte * p; byte * buf; int xsize; int ysize; xsize=(iGLOBAL_SCREENWIDTH<<16)/step; if (xsize>iGLOBAL_SCREENWIDTH) xsize=iGLOBAL_SCREENWIDTH; ysize=(iGLOBAL_SCREENHEIGHT<<16)/step; if (ysize>iGLOBAL_SCREENHEIGHT) ysize=iGLOBAL_SCREENHEIGHT; { yfrac=0; for (j=y;j>16)); buf=(byte *)bufferofs+ylookup[j]+x; xfrac=0; yfrac+=step; for (i=x;i>16)); buf++; xfrac+=step; } } } } //****************************************************************************** // // DoLoadGameSequence // //****************************************************************************** void DoLoadGameSequence ( void ) { int x; int y; int dx; int dy; int s; int ds; int time; int i; byte * destscreen; pic_t *shape;//bna++ fizzlein=false; x=(18+SaveGamePicX)<<16; y=(30+SaveGamePicY)<<16; time=VBLCOUNTER; s=0x2000000; dx=(-x)/time; dy=(-y)/time; ds=-((s-0x1000000)/time); destscreen=SafeMalloc(64000*8);//bna fixme SetupScreen(false); ThreeDRefresh(); FlipPage(); FlipPage(); VL_CopyPlanarPageToMemory ( (byte *)bufferofs, destscreen ); VL_CopyDisplayToHidden (); CalcTics(); for (i=0;i>16),(y>>16),(s>>8),destscreen); FlipPage(); x+=(dx*tics); if (x<0) x=0; y+=(dy*tics); if (y<0) y=0; s+=(ds*tics); } DrawScaledScreen(0,0,0x10000,destscreen); FlipPage(); VL_CopyDisplayToHidden (); SafeFree(destscreen); CalcTics(); CalcTics(); //bna++ section shape = ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 ); DrawTiledRegion( 0, 16, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 32, 0, 16, shape );//bna++ DrawPlayScreen(false); DisableScreenStretch(); SHAKETICS = 0xFFFF; //bna section end } //****************************************************************************** // // StartupRotateBuffer // //****************************************************************************** byte * RotatedImage; boolean RotateBufferStarted = false; void StartupRotateBuffer ( int masked) { int k;////zxcv int a,b; iG_masked = masked; if (RotateBufferStarted == true) return; RotateBufferStarted = true; // RotatedImage=SafeMalloc(131072);org //RotatedImage=SafeMalloc(131072*8); if (iGLOBAL_SCREENWIDTH == 320) { RotatedImage=SafeMalloc(131072); }else if (iGLOBAL_SCREENWIDTH == 640) { RotatedImage=SafeMalloc(131072*4); } //SetupScreen(false);//used these 2 to test screen size //VW_UpdateScreen (); if (masked==0) { if (iGLOBAL_SCREENWIDTH == 320) { memset(RotatedImage,0,131072); }else if (iGLOBAL_SCREENWIDTH == 640) { memset(RotatedImage,0,131072*4); } } else { if (iGLOBAL_SCREENWIDTH == 320) { memset(RotatedImage,0xff,131072); }else if (iGLOBAL_SCREENWIDTH == 640) { memset(RotatedImage,0xff,131072*4); } } //memset(RotatedImage,0xff,131072);//org //memset(RotatedImage,0xff,131072*8); if ((masked == false)&&(iGLOBAL_SCREENWIDTH == 640)) { DisableScreenStretch(); k=(28*512);//14336; for (a=0;a 512 i difference *(RotatedImage+(512)+0) = bufferofs+(0*800)+0); *(RotatedImage+(512)+100) = bufferofs+(100*800)+0); */ //****************************************************************************** // // ShutdownRotateBuffer // //****************************************************************************** void ShutdownRotateBuffer ( void ) { if (RotateBufferStarted == false) return; RotateBufferStarted = false; SafeFree(RotatedImage); } //****************************************************************************** // // ScaleAndRotateBuffer // //****************************************************************************** void ScaleAndRotateBuffer (int startangle, int endangle, int startscale, int endscale, int time) { int anglestep; int scalestep; int angle; int scale; int i; //bna section // int Xh = 160;//org // int Yh = 100;//org int Xh = iGLOBAL_SCREENWIDTH/2; int Yh = iGLOBAL_SCREENHEIGHT/2; DisableScreenStretch();//bna++ anglestep=((endangle-startangle)<<16)/time; scalestep=((endscale-startscale)<<6)/time; angle=(startangle<<16); scale=(startscale<<6); CalcTics(); CalcTics(); for (i=0;i>16)&(FINEANGLES-1),scale>>6,0); FlipPage(); scale+=(scalestep*tics); angle+=(anglestep*tics); CalcTics(); } DrawRotatedScreen(Xh,Yh, (byte *)bufferofs,endangle&(FINEANGLES-1),endscale,0); FlipPage(); DrawRotatedScreen(Xh,Yh, (byte *)bufferofs,endangle&(FINEANGLES-1),endscale,0); FlipPage(); DrawRotatedScreen(Xh,Yh, (byte *)bufferofs,endangle&(FINEANGLES-1),endscale,0); CalcTics(); CalcTics(); //I_Delay (240);//bna++ //bna++ section if ( playstate == ex_stillplaying ) {//bna++ pic_t *shape; shape = ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 ); DrawTiledRegion( 0, 16, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 32, 0, 16, shape );//bna++ DisableScreenStretch();//dont strech when we go BACK TO GAME DrawPlayScreen(true);//repaint ammo and life stat } } //bna section end //****************************************************************************** // // RotateBuffer // //****************************************************************************** void RotateBuffer (int startangle, int endangle, int startscale, int endscale, int time) { int savetics; //save off fastcounter savetics=GetFastTics(); StartupRotateBuffer (0); ScaleAndRotateBuffer (startangle, endangle, startscale, endscale, time); ShutdownRotateBuffer (); // restore fast counter SetFastTics(savetics); } //****************************************************************************** // // DrawRotatedScreen // //****************************************************************************** void DrawRotatedScreen(int cx, int cy, byte *destscreen, int angle, int scale, int masked) {//ZXCV int c, s; int xst, xct; int y; byte * screen; //int Xres = 320;//old value //int Yres = 200;//old val int Xr = iGLOBAL_SCREENWIDTH;//640; int Yr = (iGLOBAL_SCREENHEIGHT);//400; //bna aaaa fix // SetTextMode ( ); c = FixedMulShift(scale,costable[angle],11); s = FixedMulShift(scale,sintable[angle],11); // c = c/2; //these values are to rotate degres or? // s = s/2; // xst & xct= start center values ; if ((iGLOBAL_SCREENWIDTH == 320 )||(masked == true)) { xst = (((-cx)*s)+(128<<16))-(cy*c); xct = (((-cx)*c)+(256<<16)+(1<<18)-(1<<16))+(cy*s); } else if ((iGLOBAL_SCREENWIDTH == 640 )&&(masked == false)) { xst = (((-cx)*s)+((268)<<16))-(cy*c); xct = (((-cx)*c)+((317)<<16)+(1<<18)-(1<<16))+(cy*s); }//y=268;x=317 mr_xstep=s; mr_ystep=c; screen=destscreen; if (masked==0) { { mr_yfrac=xct; mr_xfrac=xst; VGAWRITEMAP(plane); for (y=0; yorigsize; dc_iscale=(p->origsize<<16)/height; dc_texturemid=(((p->origsize>>1)+p->topoffset)<>1); sprtopoffset=centeryfrac - FixedMul(dc_texturemid,dc_invscale); shadingtable=colormap+(1<<12); VGAWRITEMAP(x&3); ScaleMaskedPost(((p->collumnofs[offset])+src), (byte *)bufferofs+x); } void ApogeeTitle (void) { byte pal[768]; int angle; int scale; int x,y; int danglex; int anglex; int dy,dangle,dscale; int time; CalcTics(); CalcTics(); IN_ClearKeysDown(); viewwidth=320; viewheight=200; memcpy(&pal[0],W_CacheLumpName("ap_pal",PU_CACHE, CvtNull, 1),768); shadingtable=colormap+(1<<12); VL_NormalizePalette(&pal[0]); SwitchPalette(&pal[0],35); // DrawWorld(); // RotateBuffer(0,FINEANGLES*6,FINEANGLES*48,FINEANGLES,(VBLCOUNTER*2)); // DoLaserShoot("apogee"); // DoZIntro(); VL_ClearBuffer (bufferofs, 255); DrawNormalSprite (0, 0, W_GetNumForName("ap_titl")); StartupRotateBuffer (1); //save off fastcounter #define APOGEEXANGLE 913 #define APOGEEXMAG 180 #define APOGEESTARTY 0 #define APOGEEENDY 100 #define APOGEESCALESTART ((unsigned)FINEANGLES<<4) #define APOGEESCALEEND (FINEANGLES) #define APOGEESONGTIME (124-1) time = APOGEESONGTIME; anglex=0; danglex=(APOGEEXANGLE<<16)/time; y=APOGEESTARTY<<16; dy=((APOGEEENDY-APOGEESTARTY)<<16)/time; dscale=(int)((APOGEESCALEEND-APOGEESCALESTART)<<16)/time; scale=(int)(APOGEESCALESTART<<16); angle=0; dangle=(FINEANGLES<<17)/time; MU_StartSong(song_apogee); CalcTics(); while (time>=0) { VL_DrawPostPic (W_GetNumForName("ap_wrld")); IN_PumpEvents(); x=100+FixedMul(APOGEEXMAG,sintable[anglex>>16]); DrawRotatedScreen(x,y>>16,(byte *)bufferofs,(angle>>16)&(FINEANGLES-1),scale>>16,1); FlipPage(); CalcTics(); angle+=dangle*tics; scale+=dscale*tics; y+=dy*tics; anglex+=danglex*tics; time-=tics; if ((LastScan) || IN_GetMouseButtons()) goto apogeeexit; } CalcTics(); CalcTics(); VL_DrawPostPic (W_GetNumForName("ap_wrld")); DrawRotatedScreen(x,y>>16,(byte *)bufferofs,0,APOGEESCALEEND,1); FlipPage(); while (MU_SongPlaying()) { IN_PumpEvents(); if ((LastScan) || IN_GetMouseButtons()) goto apogeeexit; } // I_Delay(65); //bna added apogeeexit: VL_ClearBuffer (bufferofs, 0); //bna added MenuFadeOut(); //bna added VH_UpdateScreen (); //bna added ShutdownRotateBuffer (); } #if (SHAREWARE==0) void DopefishTitle (void) { int shapenum; int height; shapenum=W_GetNumForName("scthead1"); CalcTics(); CalcTics(); IN_ClearKeysDown(); MU_StartSong( song_secretmenu); viewwidth=320; viewheight=200; SwitchPalette(origpal,35); oldtime=GetTicCount(); FlipPage(); for (height=1;height<200;height+=(tics<<2)) { DrawPositionedScaledSprite (160, 100, shapenum, height, 0); FlipPage(); CalcTics(); if ((LastScan) || IN_GetMouseButtons()) break; } SD_Play ( SD_DOPEFISHSND ); oldtime=GetTicCount(); for (height=0;height0) scale-=30; } else if (buttons & (1 << 1)) { scale+=30; } } CalcTics(); CalcTics(); Keyboard[sc_Escape]=0; ShutdownRotateBuffer (); } boolean ScreenSaverStarted=false; screensaver_t * ScreenSaver; #define PAUSETIME (70) //****************************************************************************** // // SetupScreenSaverPhase // //****************************************************************************** void SetupScreenSaverPhase ( void ) { if (ScreenSaverStarted==false) return; if (ScreenSaver->phase==0) { ScreenSaver->x=160; ScreenSaver->y=100; ScreenSaver->angle=0; ScreenSaver->scale=FINEANGLES; ScreenSaver->dangle=FINEANGLES/VBLCOUNTER; ScreenSaver->dx=0; ScreenSaver->dy=0; ScreenSaver->dscale=((FINEANGLES<<2)-(FINEANGLES))/VBLCOUNTER; ScreenSaver->time=VBLCOUNTER; } else if (ScreenSaver->phase==1) { ScreenSaver->x=160; ScreenSaver->y=100; ScreenSaver->angle=0; ScreenSaver->scale=FINEANGLES<<2; ScreenSaver->dangle=FINEANGLES/VBLCOUNTER; ScreenSaver->dx=RandomNumber("StartupScreen",0)>>5; ScreenSaver->dy=RandomNumber("StartupScreen",0)>>5; ScreenSaver->dscale=0; ScreenSaver->time=-1; } } //****************************************************************************** // // StartupScreenSaver // //****************************************************************************** void StartupScreenSaver ( void ) { if (ScreenSaverStarted==true) return; ScreenSaverStarted=true; StartupRotateBuffer (0); ScreenSaver=(screensaver_t *)SafeMalloc(sizeof(screensaver_t)); ScreenSaver->phase=0; ScreenSaver->pausetime=PAUSETIME; if (iGLOBAL_SCREENWIDTH == 320){ ScreenSaver->pausex=120; ScreenSaver->pausey=84; }else if (iGLOBAL_SCREENWIDTH == 640){ ScreenSaver->pausex=240; ScreenSaver->pausey=201; } ScreenSaver->pausex=120; ScreenSaver->pausey=84; SetupScreenSaverPhase(); } //****************************************************************************** // // ShutdownScreenSaver // //****************************************************************************** void ShutdownScreenSaver ( void ) { if (ScreenSaverStarted==false) return; ScreenSaverStarted=false; ShutdownRotateBuffer (); SafeFree(ScreenSaver); //bna section StartupClientControls(); } //****************************************************************************** // // UpdateScreenSaver // //****************************************************************************** #define SPINSIZE 40 #define MAXSPEED 8 void UpdateScreenSaver ( void ) { //EnableScreenStretch(); if (ScreenSaver->time!=-1) { ScreenSaver->time-=tics; if (ScreenSaver->time<0) { ScreenSaver->phase++; SetupScreenSaverPhase(); } } ScreenSaver->x+=ScreenSaver->dx*tics; ScreenSaver->y+=ScreenSaver->dy*tics; ScreenSaver->angle=(ScreenSaver->angle+(ScreenSaver->dangle*tics))&(FINEANGLES-1); ScreenSaver->scale+=ScreenSaver->dscale*tics; if (ScreenSaver->xx=SPINSIZE; ScreenSaver->dx=abs(ScreenSaver->dx); ScreenSaver->dy+=(RandomNumber("Rotate",0)>>6)-2; } else if (ScreenSaver->x>iGLOBAL_SCREENWIDTH-SPINSIZE) { ScreenSaver->x=iGLOBAL_SCREENWIDTH-SPINSIZE; ScreenSaver->dx=-(abs(ScreenSaver->dx)); ScreenSaver->dy+=(RandomNumber("Rotate",0)>>6)-2; } if (ScreenSaver->yy=SPINSIZE; ScreenSaver->dy=abs(ScreenSaver->dy); ScreenSaver->dx+=(RandomNumber("Rotate",0)>>6)-2; } else if (ScreenSaver->y>iGLOBAL_SCREENHEIGHT-SPINSIZE) { ScreenSaver->y=iGLOBAL_SCREENHEIGHT-SPINSIZE; ScreenSaver->dy=-(abs(ScreenSaver->dy)); ScreenSaver->dx+=(RandomNumber("Rotate",0)>>6)-2; } if (abs(ScreenSaver->dx)>MAXSPEED) ScreenSaver->dx=SGN(ScreenSaver->dx)*MAXSPEED; if (abs(ScreenSaver->dy)>MAXSPEED) ScreenSaver->dy=SGN(ScreenSaver->dy)*MAXSPEED; DrawRotatedScreen(ScreenSaver->x,ScreenSaver->y, (byte *)bufferofs,ScreenSaver->angle,ScreenSaver->scale,0); ScreenSaver->pausetime-=tics; if (ScreenSaver->pausetime<=0) { ScreenSaver->pausetime=PAUSETIME; if (iGLOBAL_SCREENWIDTH == 320){ ScreenSaver->pausex=RandomNumber ("pausex",0)%240; ScreenSaver->pausey=RandomNumber ("pausey",0)%168; }else if (iGLOBAL_SCREENWIDTH == 640){ ScreenSaver->pausex=RandomNumber ("pausex",0)%480; ScreenSaver->pausey=RandomNumber ("pausey",0)%403; } } DrawPauseXY (ScreenSaver->pausex, ScreenSaver->pausey); FlipPage(); } //****************************************************************************** // // DrawBackground // //****************************************************************************** void DrawBackground ( byte * bkgnd ) { // int plane; int size; size=linewidth*200; { VGAWRITEMAP(plane); memcpy((byte *)bufferofs,bkgnd,size); bkgnd+=size; } } //****************************************************************************** // // PrepareBackground // //****************************************************************************** void PrepareBackground ( byte * bkgnd ) { // int plane; int size; size=linewidth*200; { VGAREADMAP(plane); memcpy(bkgnd,(byte *)bufferofs,size); bkgnd+=size; } } //****************************************************************************** // // WarpString // //****************************************************************************** void WarpString ( int x, int y, int endx, int endy, int time, byte * back, char * str ) { int dx; int dy; int cx; int cy; LastScan = 0; dx=((endx-x)<<16)/time; dy=((endy-y)<<16)/time; cx=x<<16; cy=y<<16; CalcTics(); while (time>0) { DrawBackground ( back ); US_ClippedPrint (cx>>16, cy>>16, str); FlipPage(); CalcTics(); cx+=dx*tics; cy+=dy*tics; time-=tics; if (LastScan != 0) break; } // DrawBackground ( back ); // US_ClippedPrint (endx, endy, str); // FlipPage(); } #if (SHAREWARE==1) //****************************************************************************** // // DoEndCinematic // //****************************************************************************** //****************************************************************************** // // WarpSprite // //****************************************************************************** void WarpSprite ( int x, int y, int endx, int endy, int time, byte * back, int shape ) { int dx; int dy; int cx; int cy; int starttime; LastScan = 0; dx=((endx-x)<<16)/time; dy=((endy-y)<<16)/time; cx=x<<16; cy=y<<16; starttime=time; CalcTics(); while (time>0) { DrawBackground ( back ); DrawUnScaledSprite (cx>>16, cy>>16, shape, 16); FlipPage(); CalcTics(); cx+=dx*tics; cy+=dy*tics; time-=tics; if (LastScan != 0) break; } } char *EndCinematicPicNames[5] = { "lwgshoo2", "hg2shoo2", "ankshoo1", "ligrise4", "tritoss5", }; #define NUMENDMESSAGES 24 char *EndCinematicText[NUMENDMESSAGES] = { "You've won the battle, Cassatt.\n" "But when the Oscuridos return,\n" "will you be ready as they wage\n" "their Dark War?", "Armed with only a pistol and 30\n" "bucks, you must stop the minions of\n" "El Oscuro before they kill millions\n" "of innocent people.", "But for now, hey, enjoy the medal\n" "you received and take a vacation.\n" "You've earned it. Maybe on \n" "San Nicolas Island . . ." , "Thanks for playing. If you liked\n" "\"The HUNT Begins\", check Ordering\n" "Info for information about \n" "continuing your adventure.", "Okay, you can stop reading now.", "Press a key. That's all there is.\n" "Thanks.", "Are you lazy, or illiterate?\n" "PRESS A KEY.", "Look, this is pointless. You\n" "are done. Push off.", "Okay, show's over. Nothing\n" "more to see here.", "Wow, you must like this fine\n" "background screen.", "For waiting this long, you get . . .\n" "nothing! Go away!", "I mean, I like you as a friend,\n" "but . . .", "\"Bob\"", "All right, um . . . you found the\n" "secret message! Congratulations!", "Didn't work, huh? Okay, how about\n" "this . . .", "THE END", "Dang. Thought I had you there.", "Stop watching.", "You know that if you registered,\n" "there would be a lot more cool\n" "stuff happening right now.", "Episode IV: A New Hope\n", "Just think of all the new secret\n" "messages you could find hidden\n" "in the registered version!", "Someone right now is probably\n" "enjoying the really exciting\n" "ending of the registered version.", "ROTT was filmed before\n" "a live audience.", "No animals were harmed during the\n" "creation of this video game, although\n" "one dog did get its butt spanked\n" "when it peed on the carpet.\n", }; char NextGameString1[] = "The Developers of Incredible Power"; char NextGameString2[] = "shall return"; void DoEndCinematic ( void ) { int trilogo; int group; int world; int width; int height; int x,y; int shape; int time1,time2; byte * tmp; byte * sky; byte * bkgnd; int i; byte pal[768]; EnableScreenStretch(); viewwidth = 320;//MAXSCREENWIDTH; viewheight = 200;//MAXSCREENHEIGHT; MU_StartSong(song_youwin); bkgnd=SafeMalloc(800*linewidth); trilogo=W_GetNumForName("trilogo"); world=W_GetNumForName("ap_wrld"); group=W_GetNumForName("mmbk"); VL_DrawPostPic (trilogo); PrepareBackground ( bkgnd ); WarpSprite (160, -100, 160, 100, (VBLCOUNTER*3), bkgnd, W_GetNumForName("youwin")); if (LastScan !=0) goto fadelogo; I_Delay(30); fadelogo: MenuFadeOut(); ClearGraphicsScreen(); memcpy(&pal[0],W_CacheLumpName("ap_pal",PU_CACHE,CvtNull,1),768); VL_NormalizePalette(&pal[0]); SwitchPalette(&pal[0],35); VL_DrawPostPic (world); PrepareBackground ( bkgnd ); WarpSprite (160, 250, 160, 100, (VBLCOUNTER*3), bkgnd, W_GetNumForName("wrldsafe")); if (LastScan !=0) goto fadeworld; I_Delay(10); if (LastScan !=0) goto fadeworld; WarpSprite (160, 100, 160, -50, (VBLCOUNTER*3), bkgnd, W_GetNumForName("wrldsafe")); if (LastScan !=0) goto fadeworld; I_Delay(20); fadeworld: MenuFadeOut(); ClearGraphicsScreen(); MenuFadeIn(); sky=W_CacheLumpNum(W_GetNumForName("SKYSTART")+2,PU_CACHE,CvtNull,1); tmp=sky; for (x=0;x<256;x++) { VGAWRITEMAP(x&3); for (y=0;y<200;y++) { *((byte *)bufferofs+ylookup[y]+x)=*tmp++; } } tmp=sky; for (x=256;x<320;x++) { VGAWRITEMAP(x&3); for (y=0;y<200;y++) { *((byte *)bufferofs+ylookup[y]+x)=*tmp++; } } for(i=0;i<5;i++) { int tx,ty; tx = 32 + (i << 6); ty = 100; shape = W_GetNumForName(EndCinematicPicNames[i]); DrawUnScaledSprite (tx, ty, shape,16); } PrepareBackground ( bkgnd ); //CurrentFont = (font_t *)W_CacheLumpName ("newfnt1", PU_CACHE); CurrentFont = smallfont; LastScan = 0; for(i=0;i3) I_Delay(50); US_MeasureStr (&width, &height, "%s", &(EndCinematicText[i][0])); if (LastScan !=0) break; x=(320-width)>>1; y=(200-height)>>1; time1 = (300 - y)*(VBLCOUNTER*4)/300; time2 = VBLCOUNTER*4-time1; WarpString (x, 250, x, y-50,time1, bkgnd, EndCinematicText[i]); if (LastScan !=0) break; I_Delay(40); if (LastScan !=0) break; if (i<=3) I_Delay(40); if (LastScan !=0) break; WarpString (x, y-50, x, -50, time2, bkgnd, EndCinematicText[i]); if (LastScan !=0) break; } if (LastScan!=0) goto finalfade; sky=W_CacheLumpNum(W_GetNumForName("SKYSTART")+2,PU_CACHE,CvtNull,1); tmp=sky; for (x=0;x<256;x++) { VGAWRITEMAP(x&3); for (y=0;y<200;y++) { *((byte *)bufferofs+ylookup[y]+x)=*tmp++; } } tmp=sky; for (x=256;x<320;x++) { VGAWRITEMAP(x&3); for (y=0;y<200;y++) { *((byte *)bufferofs+ylookup[y]+x)=*tmp++; } } for(i=0;i<5;i++) { int tx,ty; tx = 32 + (i << 6); ty = 100; shape = W_GetNumForName(EndCinematicPicNames[i]); DrawUnScaledSprite (tx, ty, shape,16); } shape = W_GetNumForName("robogrd3"); PrepareBackground ( bkgnd ); WarpSprite (420,100,300,100,VBLCOUNTER*3,bkgnd,shape); if (LastScan !=0) goto finalfade; PrepareBackground ( bkgnd ); WarpString (200,80,200,80,VBLCOUNTER*3,bkgnd, "Am I late?"); if (LastScan !=0) goto finalfade; I_Delay(20); finalfade: MenuFadeOut(); VL_ClearVideo (0); I_Delay(10); if (LastScan == 0) { US_MeasureStr (&width, &height, "%s", NextGameString1); x=(320-width)>>1; y=(200-height)>>1; US_ClippedPrint (x,y-6, NextGameString1); US_MeasureStr (&width, &height, "%s", NextGameString2); x=(320-width)>>1; y=(200-height)>>1; US_ClippedPrint (x,y+6, NextGameString2); FlipPage(); VL_FadeIn(0,255,origpal,150); I_Delay(50); VL_FadeOut(0,255,0,0,0,150); VL_ClearVideo (0); I_Delay(10); } SafeFree(bkgnd); } #else // REGISTERED VERSION ====================================================== static char burnCastle1Msg []= "The monastery burns.\n" "\n" "El Oscuro is dead.\n" "\n" "The world is safe.\n"; // If all Snake Eggs not destroyed on final level: static char notDoneMsg[] = "Unfortunately not all\n" "of El Oscuro's larvae\n" "were destroyed.\n" "\n" "Thirty years later,\n" "a descendant of\n" "El Oscuro wiped out\n" "the entire world,\n" "but nice job anyway.\n"; static char tryAgainMsg[] = "Try Again.\n" "\n" "The world will not be\n" "safe until all of El\n" "Oscuro's larvae are\n" "destroyed. Find them.\n"; // If all snake eggs destroyed: static char doneMsg[] = "You have destroyed\n" "El Oscuro and all his\n" "descendants. Well done!\n"; // On Triad background, in bigger font. static char youWin1Msg[] = "So, HUNT Members, how\n" "do you think the\n" "mission went?\n"; // Place menu pix of characters here (maybe modem frame too?) static char youWin2Msg[] = "Barrett: Well, I think\n" "I got shin splints from\n" "all those jump pads.\n" "But hey, action-wise,\n" "I've been in tougher\n" "bar fights, for crying\n" "out loud.\n"; static char youWin3Msg[] = "Cassatt: Apart from\n" "the other HUNT members\n" "saying I look like\n" "Richard Mulligan, it\n" "was quite a success.\n" "And some of the\n" "monastery's ironwork\n" "was very nice.\n"; static char youWin4Msg[] = "Ni: it was quite easy,\n" "actually. I just\n" "pictured the enemy\n" "having the face of\n" "my ex-husband, and\n" "man, I was a force\n" "of Nature.\n"; static char youWin5Msg[] = "Wendt: I was kind of\n" "disappointed. I think\n" "I used the missile\n" "weapons way too much.\n" "Next time, bullets\n" "only. Nothing sweeter\n" "than a head shot from\n" "a hundred feet.\n"; static char youWin6Msg[] = "Freeley: I'm still\n" "trying to adjust in\n" "the aftermath. It's\n" "kinda tough. I mean,\n" "I save the damn world,\n" "and all people ask\n" "about is my name.\n" "Sheesh.\n"; // On caching screen static char youWin7Msg[] = "The HUNT is victorious!\n" "\n" " THE END\n"; static char youWin8Msg[] = "Now go and celebrate!\n" "\n" " THE REAL END"; #define NUMEXPLOSIONTYPES 4 typedef struct { char name[11]; byte numframes; } ExplosionInfoType; ExplosionInfoType ExplosionInfo[NUMEXPLOSIONTYPES]= { {"EXPLOS1\0",20}, {"EXP1\0",20}, {"GREXP1\0",25}, {"PART1\0",12}, }; typedef struct { byte which; byte frame; byte x; byte y; } ExplosionType; #define MAXTRANSMITTEREXPLOSIONS 30 static ExplosionType Explosions[MAXTRANSMITTEREXPLOSIONS]; void ResetTransmitterExplosion ( ExplosionType * Explosion ) { Explosion->which=RandomNumber("Explosion",0)%NUMEXPLOSIONTYPES; Explosion->frame=0; Explosion->x=(RandomNumber("Explosion",2)>>1)+(160-64); Explosion->y=(RandomNumber("Explosion",3)>>1); } void CacheTransmitterExplosions ( void ) { int i,j,num; for (i=0;i=(ExplosionInfo[Explosions[i].which].numframes<<1)) { ResetTransmitterExplosion(&Explosions[i]); SD_Play(SD_EXPLODEFLOORSND+(RandomNumber("Explosion",4)>>7)); } } } void DrawTransmitterExplosions ( void ) { int i; for (i=0;i>1)), 16 ); } } void DoTransmitterExplosion ( void ) { byte * back; int i; VL_ClearVideo(0); back=SafeMalloc(800*linewidth); CalcTics(); CalcTics(); DrawNormalSprite(0,0,W_GetNumForName("transmit")); PrepareBackground ( back ); SetupTransmitterExplosions (); CacheTransmitterExplosions (); DrawBackground ( back ); FlipPage(); VL_FadeIn (0, 255, origpal, 30); SHAKETICS=VBLCOUNTER*15; for (i=0;i<(VBLCOUNTER*15);i+=tics) { DrawBackground ( back ); DrawTransmitterExplosions (); FlipPage(); CalcTics(); UpdateTransmitterExplosions (); } VL_FadeOut (0, 255, 63, 63, 63, 150); screenfaded=false; SD_Play(SD_PLAYERTCSND); SD_Play(SD_PLAYERTBSND); SD_Play(SD_PLAYERDWSND); SD_Play(SD_PLAYERLNSND); SD_Play(SD_PLAYERIPFSND); VL_FadeOut (0, 255, 0, 0, 0, 30); TurnShakeOff(); SafeFree(back); } void ShowTransmitter ( void ) { MenuFadeOut(); DrawNormalSprite(0,0,W_GetNumForName("transmit")); FlipPage(); VL_FadeIn (0, 255, origpal, 30); I_Delay(30); VL_FadeOut (0, 255, 0, 0, 0, 30); } void ShowFinalDoor ( void ) { byte pal[768]; MenuFadeOut(); VL_ClearBuffer (bufferofs, 0); DrawNormalSprite (0, (200-120)>>1, W_GetNumForName("finldoor")); FlipPage(); memcpy(&pal[0],W_CacheLumpName("findrpal",PU_CACHE,CvtNull, 1),768); VL_NormalizePalette(&pal[0]); SD_Play(SD_OPENDOORSND); VL_FadeIn (0, 255, pal, 30); I_Delay(30); VL_FadeOut (0, 255, 0, 0, 0, 30); } void ShowFinalFire ( void ) { byte pal[768]; MenuFadeOut(); VL_ClearBuffer (bufferofs, 0); DrawNormalSprite (0, (200-120)>>1, W_GetNumForName("finlfire")); FlipPage(); memcpy(&pal[0],W_CacheLumpName("finfrpal",PU_CACHE,CvtNull, 1),768); VL_NormalizePalette(&pal[0]); SD_Play(SD_BAZOOKAFIRESND); VL_FadeIn (0, 255, pal, 30); SD_Play(SD_FIREBOMBFIRESND); I_Delay(2); SD_Play(SD_HEATSEEKFIRESND); I_Delay(2); SD_Play(SD_DRUNKFIRESND); SD_Play(SD_HEATSEEKFIRESND); I_Delay(2); SD_Play(SD_ATKMP40SND); SD_Play(SD_ATKMP40SND); I_Delay(2); SD_Play(SD_HEATSEEKFIRESND); SD_Play(SD_FIREBOMBFIRESND); I_Delay(2); SD_Play(SD_ATKMP40SND); SD_Play(SD_HEATSEEKFIRESND); I_Delay(2); SD_Play(SD_DRUNKFIRESND); I_Delay(2); SD_Play(SD_FIREBOMBFIRESND); I_Delay(2); SD_Play(SD_HEATSEEKFIRESND); SD_Play(SD_ATKMP40SND); I_Delay(2); SD_Play(SD_DRUNKFIRESND); SD_Play(SD_HEATSEEKFIRESND); I_Delay(2); SD_Play(SD_FIREBOMBFIRESND); SD_Play(SD_ATKMP40SND); I_Delay(2); SD_Play(SD_DRUNKFIRESND); I_Delay(2); SD_Play(SD_HEATSEEKFIRESND); SD_Play(SD_FIREBOMBFIRESND); I_Delay(2); SD_Play(SD_ATKMP40SND); SD_Play(SD_HEATSEEKFIRESND); I_Delay(2); SD_Play(SD_DRUNKFIRESND); SD_Play(SD_FIREBOMBFIRESND); I_Delay(2); SD_Play(SD_HEATSEEKFIRESND); SD_Play(SD_DRUNKFIRESND); SD_Play(SD_BAZOOKAFIRESND); I_Delay(4); VL_FadeOut (0, 255, 0, 0, 0, 30); } void ScrollString ( int cy, char * string, byte * bkgnd, int scrolltime, int pausetime ) { int x,y; int width,height; int time1,time2; LastScan=0; US_MeasureStr (&width, &height, "%s", string); x=(320-width)>>1; y=cy-(height>>1); time1 = ((220 - y)*scrolltime)/(220+height); time2 = scrolltime-time1; WarpString (x, 210, x, y, time1, bkgnd, string); if (LastScan !=0) return; I_Delay(pausetime); if (LastScan !=0) return; WarpString (x, y, x, -10-height, time2, bkgnd, string); } void DoBurningCastle ( void ) { byte * back; LastScan=0; VL_ClearVideo(0); back=SafeMalloc(800*linewidth); DrawNormalSprite(0,0,W_GetNumForName("finale")); PrepareBackground ( back ); CurrentFont = smallfont; FlipPage(); VL_FadeIn (0, 255, origpal, 30); CurrentFont = (font_t *)W_CacheLumpName ("newfnt1", PU_STATIC, Cvt_font_t, 1 ); ScrollString ( 150, &burnCastle1Msg[0], back, 4*VBLCOUNTER, 80); W_CacheLumpName ("newfnt1", PU_CACHE, Cvt_font_t, 1); VL_FadeOut (0, 255, 0, 0, 0, 80); SafeFree(back); } void DoFailedScreen ( void ) { byte * back; back=SafeMalloc(800*linewidth); VL_DrawPostPic (W_GetNumForName("trilogo")); PrepareBackground ( back ); CurrentFont = smallfont; FlipPage(); VL_FadeIn (0, 255, origpal, 30); ScrollString ( 100, ¬DoneMsg[0], back, 4*VBLCOUNTER, 100); VL_FadeOut (0, 255, 0, 0, 0, 80); SafeFree(back); } void DoTryAgainScreen ( void ) { byte * back; back=SafeMalloc(800*linewidth); VL_DrawPostPic (W_GetNumForName("trilogo")); PrepareBackground ( back ); CurrentFont = smallfont; FlipPage(); VL_FadeIn (0, 255, origpal, 30); ScrollString ( 100, tryAgainMsg, back, 4*VBLCOUNTER, 80); VL_FadeOut (0, 255, 0, 0, 0, 80); SafeFree(back); } void ResetWorldExplosion ( ExplosionType * Explosion ) { Explosion->which=RandomNumber("Explosion",0)%NUMEXPLOSIONTYPES; Explosion->frame=0; // RandomNumber("Explosion",1)%ExplosionInfo[Explosions[i].which].numframes; Explosion->x=(RandomNumber("Explosion",2))+64; Explosion->y=(RandomNumber("Explosion",3)%180); } void SetupWorldExplosions ( void ) { int i; for (i=0;i=(ExplosionInfo[Explosions[i].which].numframes<<1)) { ResetWorldExplosion(&Explosions[i]); SD_Play(SD_EXPLODEFLOORSND+(RandomNumber("Explosion",4)>>7)); } } } void DestroyEarth ( void ) { byte * back; int i; VL_ClearVideo(0); back=SafeMalloc(800*linewidth); CalcTics(); CalcTics(); DrawNormalSprite(0,0,W_GetNumForName("ourearth")); PrepareBackground ( back ); SetupWorldExplosions (); CacheTransmitterExplosions (); DrawBackground ( back ); FlipPage(); VL_FadeIn (0, 255, origpal, 30); SHAKETICS=VBLCOUNTER*10; for (i=0;i<(VBLCOUNTER*10);i+=tics) { DrawBackground ( back ); DrawTransmitterExplosions (); FlipPage(); CalcTics(); UpdateWorldExplosions (); } VL_FadeOut (0, 255, 63, 63, 63, 150); screenfaded=false; if (gamestate.violence==vl_excessive) SD_Play(SD_YOUSUCKSND); VL_FadeOut (0, 255, 0, 0, 0, 50); TurnShakeOff(); SafeFree(back); } boolean DestroyedAllEggs ( void ) { statobj_t * temp; for(temp=FIRSTSTAT;temp;temp=temp->statnext) { if (temp->itemnumber==stat_tomlarva) return false; } return true; } void DoSanNicolas ( void ) { byte pal[768]; LastScan=0; VL_ClearVideo(0); DrawNormalSprite(0,16,W_GetNumForName("nicolas")); DrawNormalSprite(10,200-58,W_GetNumForName("budgcut")); FlipPage(); memcpy(&pal[0],W_CacheLumpName("nicpal",PU_CACHE, CvtNull, 1),768); VL_NormalizePalette(&pal[0]); VL_FadeIn (0, 255, pal, 30); I_Delay(60); VL_FadeOut (0, 255, 0, 0, 0, 80); } void PlayerQuestionScreen ( void ) { byte * back; back=SafeMalloc(800*linewidth); VL_DrawPostPic (W_GetNumForName("trilogo")); PrepareBackground ( back ); CurrentFont = smallfont; FlipPage(); VL_FadeIn (0, 255, origpal, 30); CurrentFont = (font_t *)W_CacheLumpName ("newfnt1", PU_STATIC, Cvt_font_t, 1); ScrollString ( 100, &doneMsg[0], back, 4*VBLCOUNTER, 40); ScrollString ( 100, &youWin1Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawXYPic ( 8, 100-24, W_GetNumForName("player2")); PrepareBackground ( back ); CurrentFont = smallfont; SD_Play(SD_PLAYERTBSND); ScrollString ( 100, &youWin2Msg[0], back, 4*VBLCOUNTER, 100); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawXYPic ( 8, 100-24, W_GetNumForName("player1")); PrepareBackground ( back ); SD_Play(SD_PLAYERTCSND); ScrollString ( 100, &youWin3Msg[0], back, 4*VBLCOUNTER, 100); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawXYPic ( 8, 100-24, W_GetNumForName("player4")); PrepareBackground ( back ); SD_Play(SD_PLAYERLNSND); ScrollString ( 100, &youWin4Msg[0], back, 4*VBLCOUNTER, 100); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawXYPic ( 8, 100-24, W_GetNumForName("player3")); PrepareBackground ( back ); SD_Play(SD_PLAYERDWSND); ScrollString ( 100, &youWin5Msg[0], back, 4*VBLCOUNTER, 100); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawXYPic ( 8, 100-24, W_GetNumForName("player5")); PrepareBackground ( back ); SD_Play(SD_PLAYERIPFSND); ScrollString ( 100, &youWin6Msg[0], back, 4*VBLCOUNTER, 100); W_CacheLumpName ("newfnt1", PU_CACHE, Cvt_font_t, 1); VL_FadeOut (0, 255, 0, 0, 0, 80); SafeFree(back); } void DoYouWin ( void ) { pic_t * pic; byte * back; back=SafeMalloc(800*linewidth); LastScan=0; VL_ClearVideo(0); pic = (pic_t *) W_CacheLumpNum (W_GetNumForName ("mmbk"), PU_CACHE, Cvt_pic_t, 1); VWB_DrawPic (0, 0, pic); PrepareBackground ( back ); FlipPage(); VL_FadeIn (0, 255, origpal, 30); CurrentFont = (font_t *)W_CacheLumpName ("newfnt1", PU_STATIC, Cvt_font_t, 1); ScrollString ( 100, &youWin7Msg[0], back, 4*VBLCOUNTER, 300); W_CacheLumpName ("newfnt1", PU_CACHE, Cvt_font_t, 1); VL_FadeOut (0, 255, 0, 0, 0, 80); SafeFree(back); } void DoFinalEnd ( void ) { pic_t * pic; byte * back; back=SafeMalloc(800*linewidth); LastScan=0; VL_ClearVideo(0); pic = (pic_t *) W_CacheLumpNum (W_GetNumForName ("mmbk"), PU_CACHE, Cvt_pic_t, 1); VWB_DrawPic (0, 0, pic); DrawNormalSprite(0,0,W_GetNumForName("sombrero")); DrawNormalSprite(0,0,W_GetNumForName("amflag")); DrawNormalSprite(0,0,W_GetNumForName("witchhat")); DrawNormalSprite(0,0,W_GetNumForName("esterhat")); DrawNormalSprite(0,0,W_GetNumForName("santahat")); PrepareBackground ( back ); FlipPage(); VL_FadeIn (0, 255, origpal, 30); CurrentFont = (font_t *)W_CacheLumpName ("newfnt1", PU_STATIC, Cvt_font_t, 1); ScrollString ( 100, &youWin8Msg[0], back, 4*VBLCOUNTER, 100); W_CacheLumpName ("newfnt1", PU_CACHE, Cvt_font_t, 1); VL_FadeOut (0, 255, 0, 0, 0, 80); SafeFree(back); VL_ClearVideo(0); } static char dipMsg[] = "The Developers of Incredible Power!\n" "\n" "Susan Tom Jim Stephen\n" "Mark William Chuck\n"; static char creditsMsg[] = "Rise of the Triad Credits\n"; static char credits1Msg[] = "Programmers\n" "\n" "Mark Dochtermann\n" "William Scarboro\n" "Jim Dose'\n" "Nolan Martin\n"; static char credits2Msg[] = "Creative Director\n" "\n" "Tom Hall\n"; static char credits3Msg[] = "Artists\n" "\n" "Stephen Hornback\n" "Tim Neveu\n" "Chuck Jones\n" "Susan Singer\n" "James Storey\n" "Cygnus Multimedia\n"; static char credits4Msg[] = "Level Designers\n" "\n" "Tom Hall\n" "Joseph Selinske\n" "Marianna Vayntrub\n" "Joe Siegler\n"; static char credits5Msg[] = "Music\n" "\n" "Lee Jackson\n" "Bobby Prince\n"; static char credits6Msg[] = "Robot Models\n" "\n" "Gregor Punchatz\n"; static char credits7Msg[] = "Special Thanks\n" "\n" "George Broussard\n" "Scott Miller\n" "Steven Blackburn\n" "Apogee Technical Support\n" "Apogee Support Staff\n" "John Carmack\n" "Ken Silverman\n"; static char credits8Msg[] = "The Hand of God\n" "\n" "Tim Neveu's Hand\n"; static char credits9Msg[] = "Dog Snout and Paw\n" "\n" "Loki\n" "The Carpet Wetting Maestro\n"; static char credits10Msg[] = "Krist's chair\n" "\n" "Stephen Blackburn's Comfy Chair\n" "Marianna's Paper and Glue\n"; static char credits11Msg[] = "Character Voices\n" "\n" "Darian - Mark Dochtermann\n" "Krist - Joe Siegler\n" "NME - Sound CD#4005\n" "Oscuro - Tom Hall\n" "Low Guard - Steve Quarrella\n" "High Guard - Steven Blackburn\n" "Over Patrol - Chuck Jones\n"; static char credits12Msg[] = "Character Voices Continued\n" "\n" "Strike Team - Scott Miller\n" "Lightning Guard - William Scarboro\n" "Triad Enforcer - George Broussard\n" "All Monks - Tom Hall\n" "Taradino - Joe Selinske\n" "Lorelei - Pau Suet Ying\n" "Ian Paul - Jim Dose'\n" "Doug - Lee Jackson\n" "Thi - Susan Singer\n"; static char actorsMsg[] = "The Actors\n"; static char actors1Msg[] = "Low Guard\n" "\n" "Steve Quarrella\n"; static char actors2Msg[] = "High Guard\n" "\n" "Steven Blackburn\n"; static char actors3Msg[] = "Over Patrol\n" "\n" "Nolan Martin\n"; static char actors4Msg[] = "Strike Team\n" "\n" "Scott Miller\n"; static char actors5Msg[] = "Lightning Guard\n" "\n" "Kevin Green\n"; static char actors6Msg[] = "Triad Enforcer\n" "\n" "George Broussard\n"; static char actors7Msg[] = "Death Monk\n" "\n" "Lee Jackson\n"; static char actors8Msg[] = "Deathfire Monk\n" "\n" "Allen Blum III\n"; static char actors9Msg[] = "Robot Guard\n" "\n" "Himself\n"; static char actors10Msg[] = "General Darian\n" "\n" "Steve Maines\n"; static char actors11Msg[] = "Sebastian Krist\n" "\n" "Joe Siegler\n"; static char actors12Msg[] = "The NME\n" "\n" "Himself\n"; static char actors13Msg[] = "El Oscuro\n" "\n" "Tom Hall\n"; static char cut1Msg[] = "Deathfire Monk\n" "\n" "Mark Dochtermann\n"; static char cut2Msg[] = "Over Patrol\n" "\n" "Pat Miller\n"; static char cut3Msg[] = "Low Guard\n" "\n" "Marianna Vayntrub\n"; static char cut4Msg[] = "Strike Team\n" "\n" "Ann Grauerholz\n"; static char cut5Msg[] = "Lightning Guard\n" "\n" "William Scarboro\n"; static char cut6Msg[] = "High Guard\n" "\n" "Stephen Hornback\n"; static char playersCutMsg[] = "Actors who were\n" "cut from the game\n"; void DIPCredits ( void ) { byte * back; back=SafeMalloc(800*linewidth); VL_DrawPostPic (W_GetNumForName("trilogo")); PrepareBackground ( back ); FlipPage(); VL_FadeIn (0, 255, origpal, 30); CurrentFont = (font_t *)W_CacheLumpName ("newfnt1", PU_STATIC, Cvt_font_t, 1); ScrollString ( 100, &creditsMsg[0], back, 4*VBLCOUNTER, 30); CurrentFont = smallfont; ScrollString ( 100, &credits1Msg[0], back, 4*VBLCOUNTER, 50); ScrollString ( 100, &credits2Msg[0], back, 4*VBLCOUNTER, 50); ScrollString ( 100, &credits3Msg[0], back, 4*VBLCOUNTER, 50); ScrollString ( 100, &credits4Msg[0], back, 4*VBLCOUNTER, 50); ScrollString ( 100, &credits5Msg[0], back, 4*VBLCOUNTER, 50); ScrollString ( 100, &credits6Msg[0], back, 4*VBLCOUNTER, 50); ScrollString ( 100, &credits7Msg[0], back, 4*VBLCOUNTER, 50); ScrollString ( 100, &credits8Msg[0], back, 4*VBLCOUNTER, 50); ScrollString ( 100, &credits9Msg[0], back, 4*VBLCOUNTER, 50); ScrollString ( 100, &credits10Msg[0], back, 4*VBLCOUNTER, 50); ScrollString ( 100, &credits11Msg[0], back, 4*VBLCOUNTER, 80); ScrollString ( 100, &credits12Msg[0], back, 4*VBLCOUNTER, 80); CurrentFont = (font_t *)W_CacheLumpName ("newfnt1", PU_STATIC, Cvt_font_t, 1); ScrollString ( 100, &actorsMsg[0], back, 4*VBLCOUNTER, 50); CurrentFont = smallfont; VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("lwgshoo2")); PrepareBackground ( back ); ScrollString ( 100, &actors1Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("hg2shoo2")); PrepareBackground ( back ); ScrollString ( 100, &actors2Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("obpshoo1")); PrepareBackground ( back ); ScrollString ( 100, &actors3Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("ankshoo1")); PrepareBackground ( back ); ScrollString ( 100, &actors4Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("ligrise4")); PrepareBackground ( back ); ScrollString ( 100, &actors5Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("tritoss5")); PrepareBackground ( back ); ScrollString ( 100, &actors6Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("monkdr4")); PrepareBackground ( back ); ScrollString ( 100, &actors7Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("allksh4")); PrepareBackground ( back ); ScrollString ( 100, &actors8Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("robogrd1")); PrepareBackground ( back ); ScrollString ( 100, &actors9Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("darshoo1")); PrepareBackground ( back ); ScrollString ( 100, &actors10Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("hdope8")); PrepareBackground ( back ); ScrollString ( 100, &actors11Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("rbody101")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("rhead101")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("rsw01")); PrepareBackground ( back ); ScrollString ( 100, &actors12Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("tomfly21")); PrepareBackground ( back ); ScrollString ( 100, &actors13Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); PrepareBackground ( back ); CurrentFont = (font_t *)W_CacheLumpName ("newfnt1", PU_STATIC, Cvt_font_t, 1); ScrollString ( 100, &playersCutMsg[0], back, 4*VBLCOUNTER, 40); CurrentFont = smallfont; VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("cutmark")); PrepareBackground ( back ); ScrollString ( 100, &cut1Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("cutpat")); PrepareBackground ( back ); ScrollString ( 100, &cut2Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("cutmari")); PrepareBackground ( back ); ScrollString ( 100, &cut3Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("cutann")); PrepareBackground ( back ); ScrollString ( 100, &cut4Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("cutwill")); PrepareBackground ( back ); ScrollString ( 100, &cut5Msg[0], back, 4*VBLCOUNTER, 50); VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite(0,(200-128)>>1,W_GetNumForName("cutstev")); PrepareBackground ( back ); ScrollString ( 100, &cut6Msg[0], back, 4*VBLCOUNTER, 50); VL_FadeOut (0, 255, 0, 0, 0, 80); DrawNormalSprite(0,0,W_GetNumForName("grouppic")); PrepareBackground ( back ); FlipPage(); VL_FadeIn (0, 255, origpal, 30); ScrollString ( 175, &dipMsg[0], back, 4*VBLCOUNTER, 140); VL_FadeOut (0, 255, 0, 0, 0, 80); W_CacheLumpName ("newfnt1", PU_CACHE, Cvt_font_t, 1); SafeFree(back); } void DoEndCinematic ( void ) { EnableScreenStretch(); viewwidth = 320;//MAXSCREENWIDTH; viewheight = 200;//MAXSCREENHEIGHT; MU_FadeOut ( 1000 ); MU_StopSong (); ShowFinalDoor(); ShowTransmitter (); ShowFinalFire(); DoTransmitterExplosion(); MU_StartSong(song_youwin); DoBurningCastle (); DoSanNicolas(); if (DestroyedAllEggs () == true) { PlayerQuestionScreen(); DIPCredits(); DoYouWin(); if (LastScan !=0) { IN_UpdateKeyboard(); return; } DoFinalEnd(); } else { MU_StartSong(song_gameover); DoFailedScreen(); DestroyEarth(); DoTryAgainScreen (); playstate=ex_warped; gamestate.mapon=33; } IN_UpdateKeyboard(); } void DoInBetweenCinematic (int yoffset, int lump, int delay, char * string ) { int width,height; int x,y; VL_FadeOut (0, 255, 0, 0, 0, 20); VL_ClearBuffer (bufferofs, 0); DrawNormalSprite(0,yoffset,lump); CurrentFont=smallfont; US_MeasureStr (&width, &height, "%s", string); x=(320-width)>>1; y=190-height; US_ClippedPrint (x, y, string); FlipPage(); VL_FadeIn(0,255,origpal,20); I_Delay (delay); VL_FadeOut (0, 255, 0, 0, 0, 20); } #endif //****************************************************************************** // // DoCreditScreen // //****************************************************************************** #define NUMFIRSTCREDITMESSAGES 22 #define NUMSECONDCREDITMESSAGES 28 typedef struct CreditType { char text[80]; byte font; byte endy; } CreditType; CreditType FirstCredits[NUMFIRSTCREDITMESSAGES] = { {"Rise of the Triad Credits",0,0}, {"COPYRIGHT (c) 1995 Apogee Software Ltd.",1,10}, {"Apogee's Developers of Incredible Power",1,20}, {"Creative Director",0,30}, {"Tom Hall",1,40}, {"Programmers",0,50}, {"Mark Dochtermann William Scarboro",1,60}, {"Jim Dose' Nolan Martin",1,66}, {"Artists",0,76}, {"Stephen Hornback Chuck Jones",1,86}, {"Susan Singer Tim Neveu",1,92}, {"James Storey Cygnus Multimedia",1,98}, {"Level Designers",0,108}, {"Joseph Selinske Tom Hall",1,118}, {"Marianna Vayntrub Joe Siegler",1,124}, {"Musicians",0,134}, {"Lee Jackson Robert Prince",1,144}, {"Uniforms",0,154}, {"D.J. Goodwin Matt McKinney",1,164}, {"Special Thanks",0,174}, {"John Carmack Ken Silverman Gregor Punchatz",1,184}, }; CreditType SecondCredits[NUMSECONDCREDITMESSAGES] = { {"Rise of the Triad Credits",0,0}, {"COPYRIGHT (c) 1995 Apogee Software Ltd.",1,10}, {"Executive Producers",0,20}, {"George Broussard Scott Miller",1,30}, {"Manual Design",0,40}, {"Robert Atkins",1,50}, {"Beta Testers",0,60}, {"Steven Blackburn",1,70}, {"Todd Aubin Mike Bartelt",1,76}, {"Wayne Benner Neil Bonner",1,82}, {"Glenn Brensinger Douglas Brewer",1,88}, {"David Butler Daniel Creeron",1,94}, {"Scott Darling Jason Ewasiuk",1,100}, {"Craig Hamilton Ken Heckbert",1,106}, {"Terry Herrin Greg Hively",1,112}, {"John Howard Douglas Howell",1,118}, {"Dennis Kurek Hank Leukart",1,124}, {"Jim Lietzan Ken Mayer",1,130}, {"Wayne Millard Penny Plant",1,136}, {"Brian Prinner Jeff Rausch",1,142}, {"Kelly Rogers Neil Rubenking",1,148}, {"Steven Salter Chris White",1,154}, {"Special Thanks",0,162}, {"Apogee Technical Support Pau Suet Ying",1,172}, {"Anthony, Zach, Rajan, Miki, Loki",1,178}, {"Nathan, Petro, Tim, Jake, MacKay",1,184}, {"Loyal, Ric, Teller, Amano",1,190}, }; void DrawPreviousCredits ( int num, CreditType * Credits ) { int width; int height; int x,y; int i; for(i=0;i>1; y=Credits[i].endy; US_ClippedPrint (x, y+4, &Credits[i].text[0]); } } #define CREDITSTARTY 220 //****************************************************************************** // // WarpCreditString // //****************************************************************************** extern boolean dopefish; void WarpCreditString ( int time, byte * back, int num, CreditType * Credits) { int dy; int cy; int x; int y; int width; int height; boolean soundplayed; LastScan = 0; if (Credits[num].font==0) CurrentFont=smallfont; else CurrentFont=tinyfont; US_MeasureStr (&width, &height, "%s", &(Credits[num].text[0])); x=(320-width)>>1; y=Credits[num].endy; dy=((y-CREDITSTARTY)<<16)/time; cy=CREDITSTARTY<<16; CalcTics(); soundplayed=false; while (time>0) { DrawBackground ( back ); DrawPreviousCredits ( num, Credits ); if (Credits[num].font==0) CurrentFont=smallfont; else CurrentFont=tinyfont; US_ClippedPrint (x, (cy>>16)+4, &Credits[num].text[0]); if ( ((cy>>16)<196) && (soundplayed==false)) { if ((dopefish==true) && (SD_Started==true)) { int snd; do { snd=(RandomNumber("DoCredits",0)+RandomNumber("DoCredits",0))%MAXSOUNDS; } while (SD_SoundOkay ( snd ) == false); SD_Play ( snd ); } else { // SD_Play ( SD_BAZOOKAFIRESND ); #if (SHAREWARE == 0) SD_Play ( SD_BAZOOKAFIRESND + (RandomNumber("DoCredits",1)%13) ); #else SD_Play ( SD_BAZOOKAFIRESND + (RandomNumber("DoCredits",1)%6) ); #endif soundplayed=true; } } FlipPage(); CalcTics(); cy+=dy*tics; time-=tics; if (LastScan != 0) break; } } void DoCreditScreen ( void ) { int trilogo; int time; byte * bkgnd; font_t * oldfont; int i; EnableScreenStretch(); viewwidth = 320;//MAXSCREENWIDTH; viewheight = 200;//MAXSCREENHEIGHT; bkgnd=SafeMalloc(800*linewidth); trilogo=W_GetNumForName("trilogo"); VL_DrawPostPic (trilogo); // SetTextMode ( ); PrepareBackground ( bkgnd ); oldfont=CurrentFont; for(i=0;i> 16]; buf += linewidth; frac += hp_srcstep; } } void DrawMapPost (int height, byte * src, byte * buf) { int frac = 0; while (height--) { *buf = src[frac >> 16]; buf += linewidth; frac += hp_srcstep; } } void DrawRotRow(int count, byte * dest, byte * src) { unsigned eax, ecx, edx; // unsigned a, b, c,d; ecx = mr_yfrac; edx = mr_xfrac; if ((iGLOBAL_SCREENWIDTH == 320)||(iG_masked==true)) { while (count--) { eax = edx >> 16; if (eax < 256 && (ecx >> 16) < 512) { eax = (eax << 9) | ((ecx << 7) >> (32-9)); } else { eax = 0; } *dest++ = src[eax]; edx += mr_xstep; ecx += mr_ystep; } }else if (iGLOBAL_SCREENWIDTH == 640) { while (count--) { eax = edx >> 16; if (eax < (256*2.0) && (ecx >> 16) < (512*1.8)) { eax = (eax << 10) | ((ecx << 6) >> (32-10)); } else { eax = 0; } *dest++ = src[eax]; edx += mr_xstep; ecx += mr_ystep; } } } void DrawMaskedRotRow(int count, byte * dest, byte * src) { unsigned eax; unsigned xfrac, yfrac; xfrac = mr_xfrac; yfrac = mr_yfrac; while (count--) { eax = xfrac >> 16; if (eax < 256 && (yfrac >> 16) < 512) { eax = (eax << 9) | ((yfrac << 7) >> (32-9)); } else { eax = 0; } if (src[eax] != 0xff) *dest = src[eax]; dest++; xfrac += mr_xstep; yfrac += mr_ystep; } } void DrawSkyPost (byte * buf, byte * src, int height) { { int i = 0; byte *const orig_src = src; // org code while (height--) { *buf = shadingtable[*src]; buf += linewidth; src = orig_src + (++i*200/iGLOBAL_SCREENHEIGHT); } // } /* int lw = linewidth * 2; int h = height; while (h--) { *(buf) = shadingtable[*src]; buf += lw; *(buf) = shadingtable[*src]; buf += lw; //buf += lw; src++; }*/ } #define CEILINGCOLOR 24 //default color when no sky or floor #define FLOORCOLOR 32 void RefreshClear (void) { int start, base; memset(spotvis, 0, sizeof(spotvis)); if (fandc) { return; } start = min(centery, viewheight); if (start > 0) { VL_Bar(0, 0, iGLOBAL_SCREENHEIGHT, start, CEILINGCOLOR); } else { start = 0; } base = start; start = min(viewheight-start, viewheight); if (start > 0) { VL_Bar(0, base, iGLOBAL_SCREENHEIGHT, start, FLOORCOLOR); } } rott-20230810/rott/rt_draw.h000066400000000000000000000063311446517470200155630ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_draw_public #define _rt_draw_public //*************************************************************************** // // RT_DRAW.C - Draw-o-rama // //*************************************************************************** #define MAXVISIBLE 256 extern int whereami; extern byte * shadingtable; // Shading table for DrawPost typedef struct { int viewheight; int viewx; int shapenum; int altshapenum; int shapesize; int x1,x2,h1,h2; int texturestart; int textureend; byte * colormap; } visobj_t; extern word tilemap[MAPSIZE][MAPSIZE]; // wall values only extern byte spotvis[MAPSIZE][MAPSIZE]; extern int tics; extern int wstart; extern int fandc; // // math tables // extern short tantable[FINEANGLES]; extern fixed sintable[FINEANGLES+FINEANGLEQUAD+1]; extern fixed *costable; // // refresh variables // extern fixed viewx,viewy; // the focal point extern int viewangle; extern fixed viewsin,viewcos; // // ray tracing variables // extern visobj_t vislist[MAXVISIBLE]; extern visobj_t *visptr,*visstep,*farthest; extern long xintercept,yintercept; extern byte mapseen[MAPSIZE][MAPSIZE]; extern unsigned long * lights; extern int hp_startfrac; extern int hp_srcstep; extern int levelheight; extern int maxheight; extern int nominalheight; extern int actortime; extern int drawtime; extern int c_startx; extern int c_starty; extern const int dirangle8[9]; extern const int dirangle16[16]; extern int firstcoloffset; //=========================== macros ============================= #define LightSourceAt(x,y) (*(lights+((x)<<7)+(y))) #define SetLight(x,y,level) (LightSourceAt((x),(y))|=(unsigned long)(level)) //=========================== functions ============================= void BuildTables (void); void CalcTics (void); void ThreeDRefresh (void); void FlipPage ( void ); void TurnShakeOff( void ); void AdaptDetail ( void ); int CalcHeight (void); void DoLoadGameSequence( void ); void RotateBuffer (int startangle, int endangle, int startscale, int endscale, int time); void ApogeeTitle (void); void DopefishTitle (void); void RotationFun (void); void GetRainBoundingBox (int * xmin, int * xmax, int * ymin, int * ymax); void StartupScreenSaver ( void ); void ShutdownScreenSaver ( void ); void UpdateScreenSaver ( void ); void DoEndCinematic ( void ); void DoCreditScreen ( void ); void DoMicroStoryScreen ( void ); void DoInBetweenCinematic (int yoffset, int lump, int delay, char * string ); #endif rott-20230810/rott/rt_err.c000066400000000000000000000602051446517470200154110ustar00rootroot00000000000000const unsigned char ROTT_ERR[4000] = { 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC9, 0x1B, 0xCD, 0x1B, 0xB5, 0x1B, 0x1E, 0x9C, 0x52, 0x1E, 0x69, 0x1E, 0x73, 0x1E, 0x65, 0x1E, 0x20, 0x1E, 0x6F, 0x1E, 0x66, 0x1E, 0x20, 0x1E, 0x74, 0x1E, 0x68, 0x1E, 0x65, 0x1E, 0x20, 0x1E, 0x54, 0x1E, 0x72, 0x1E, 0x69, 0x1E, 0x61, 0x1E, 0x64, 0x1E, 0x20, 0x1E, 0x45, 0x1E, 0x72, 0x1E, 0x72, 0x1E, 0x6F, 0x1E, 0x72, 0x1E, 0x21, 0x1E, 0x1E, 0x9C, 0xC6, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xB5, 0x1B, 0x76, 0x19, 0x53, 0x19, 0x31, 0x19, 0x2E, 0x19, 0x30, 0x19, 0xC6, 0x1B, 0xCD, 0x1B, 0xBB, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xBA, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0xBA, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xBA, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0xBA, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xBA, 0x1B, 0x20, 0x1B, 0x50, 0x1B, 0x6C, 0x1B, 0x65, 0x1B, 0x61, 0x1B, 0x73, 0x1B, 0x65, 0x1B, 0x20, 0x1B, 0x72, 0x1B, 0x75, 0x1B, 0x6E, 0x1B, 0x20, 0x1B, 0x52, 0x1B, 0x4F, 0x1B, 0x54, 0x1B, 0x54, 0x1B, 0x48, 0x1B, 0x45, 0x1B, 0x4C, 0x1B, 0x50, 0x1B, 0x2E, 0x1B, 0x45, 0x1B, 0x58, 0x1B, 0x45, 0x1B, 0x20, 0x1B, 0x66, 0x1B, 0x6F, 0x1B, 0x72, 0x1B, 0x20, 0x1B, 0x6D, 0x1B, 0x6F, 0x1B, 0x72, 0x1B, 0x65, 0x1B, 0x2C, 0x1B, 0x20, 0x1B, 0x77, 0x1B, 0x65, 0x1B, 0x6C, 0x1B, 0x6C, 0x1B, 0x2C, 0x1B, 0x20, 0x1B, 0x68, 0x1F, 0x65, 0x1F, 0x6C, 0x1F, 0x70, 0x1F, 0x66, 0x1F, 0x75, 0x1F, 0x6C, 0x1F, 0x20, 0x1B, 0x69, 0x1B, 0x6E, 0x1B, 0x66, 0x1B, 0x6F, 0x1B, 0x72, 0x1B, 0x6D, 0x1B, 0x61, 0x1B, 0x74, 0x1B, 0x69, 0x1B, 0x6F, 0x1B, 0x6E, 0x1B, 0x2E, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0xBA, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC8, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xBC, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC9, 0x1B, 0xCD, 0x1B, 0xB5, 0x1B, 0x1E, 0x9C, 0x55, 0x1E, 0x68, 0x1E, 0x2C, 0x1E, 0x20, 0x1E, 0x6F, 0x1E, 0x68, 0x1E, 0x2E, 0x1E, 0x20, 0x1E, 0x4D, 0x1E, 0x65, 0x1E, 0x6D, 0x1E, 0x6F, 0x1E, 0x72, 0x1E, 0x79, 0x1E, 0x20, 0x1E, 0x70, 0x1E, 0x72, 0x1E, 0x6F, 0x1E, 0x62, 0x1E, 0x6C, 0x1E, 0x65, 0x1E, 0x6D, 0x1E, 0x73, 0x1E, 0x2E, 0x1E, 0x1E, 0x9C, 0xC6, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xB5, 0x1B, 0x76, 0x19, 0x53, 0x19, 0x31, 0x19, 0x2E, 0x19, 0x30, 0x19, 0xC6, 0x1B, 0xCD, 0x1B, 0xBB, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xBA, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0xBA, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xBA, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x59, 0x1B, 0x6F, 0x1B, 0x75, 0x1B, 0x20, 0x1B, 0x64, 0x1B, 0x6F, 0x1B, 0x20, 0x1B, 0x6E, 0x1B, 0x6F, 0x1B, 0x74, 0x1B, 0x20, 0x1B, 0x68, 0x1B, 0x61, 0x1B, 0x76, 0x1B, 0x65, 0x1B, 0x20, 0x1B, 0x65, 0x1B, 0x6E, 0x1B, 0x6F, 0x1B, 0x75, 0x1B, 0x67, 0x1B, 0x68, 0x1B, 0x20, 0x1B, 0x6D, 0x1B, 0x65, 0x1B, 0x6D, 0x1B, 0x6F, 0x1B, 0x72, 0x1B, 0x79, 0x1B, 0x20, 0x1B, 0x74, 0x1B, 0x6F, 0x1B, 0x20, 0x1B, 0x72, 0x1B, 0x75, 0x1B, 0x6E, 0x1B, 0x20, 0x1B, 0x52, 0x1F, 0x69, 0x1F, 0x73, 0x1F, 0x65, 0x1F, 0x20, 0x1F, 0x6F, 0x1F, 0x66, 0x1F, 0x20, 0x1F, 0x74, 0x1F, 0x68, 0x1F, 0x65, 0x1F, 0x20, 0x1F, 0x54, 0x1F, 0x72, 0x1F, 0x69, 0x1F, 0x61, 0x1F, 0x64, 0x1F, 0x2E, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0xBA, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xBA, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x53, 0x1B, 0x6F, 0x1B, 0x6D, 0x1B, 0x65, 0x1B, 0x20, 0x1B, 0x74, 0x1B, 0x68, 0x1B, 0x69, 0x1B, 0x6E, 0x1B, 0x67, 0x1B, 0x73, 0x1B, 0x20, 0x1B, 0x79, 0x1B, 0x6F, 0x1B, 0x75, 0x1B, 0x20, 0x1B, 0x6D, 0x1B, 0x69, 0x1B, 0x67, 0x1B, 0x68, 0x1B, 0x74, 0x1B, 0x20, 0x1B, 0x74, 0x1B, 0x72, 0x1B, 0x79, 0x1B, 0x20, 0x1B, 0x74, 0x1B, 0x6F, 0x1B, 0x20, 0x1B, 0x63, 0x1B, 0x6F, 0x1B, 0x72, 0x1B, 0x72, 0x1B, 0x65, 0x1B, 0x63, 0x1B, 0x74, 0x1B, 0x20, 0x1B, 0x74, 0x1B, 0x68, 0x1B, 0x69, 0x1B, 0x73, 0x1B, 0x20, 0x1B, 0x73, 0x1B, 0x69, 0x1B, 0x74, 0x1B, 0x75, 0x1B, 0x61, 0x1B, 0x74, 0x1B, 0x69, 0x1B, 0x6F, 0x1B, 0x6E, 0x1B, 0x3A, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0xBA, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xBA, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0xBA, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xBA, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x07, 0x1B, 0x20, 0x1B, 0x75, 0x1B, 0x6E, 0x1B, 0x6C, 0x1B, 0x6F, 0x1B, 0x61, 0x1B, 0x64, 0x1B, 0x20, 0x1B, 0x61, 0x1B, 0x6E, 0x1B, 0x79, 0x1B, 0x20, 0x1B, 0x54, 0x1B, 0x53, 0x1B, 0x52, 0x1B, 0x73, 0x1B, 0x20, 0x1B, 0x79, 0x1B, 0x6F, 0x1B, 0x75, 0x1B, 0x20, 0x1B, 0x68, 0x1B, 0x61, 0x1B, 0x76, 0x1B, 0x65, 0x1B, 0x20, 0x1B, 0x69, 0x1B, 0x6E, 0x1B, 0x20, 0x1B, 0x6D, 0x1B, 0x65, 0x1B, 0x6D, 0x1B, 0x6F, 0x1B, 0x72, 0x1B, 0x79, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0xBA, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xBA, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x07, 0x1B, 0x20, 0x1B, 0x64, 0x1B, 0x6F, 0x1B, 0x20, 0x1B, 0x6E, 0x1B, 0x6F, 0x1B, 0x74, 0x1B, 0x20, 0x1B, 0x6C, 0x1B, 0x6F, 0x1B, 0x61, 0x1B, 0x64, 0x1B, 0x20, 0x1B, 0x53, 0x1B, 0x4D, 0x1B, 0x41, 0x1B, 0x52, 0x1B, 0x54, 0x1B, 0x44, 0x1B, 0x52, 0x1B, 0x56, 0x1B, 0x2E, 0x1B, 0x45, 0x1B, 0x58, 0x1B, 0x45, 0x1B, 0x20, 0x1B, 0x69, 0x1B, 0x6E, 0x1B, 0x20, 0x1B, 0x79, 0x1B, 0x6F, 0x1B, 0x75, 0x1B, 0x72, 0x1B, 0x20, 0x1B, 0x41, 0x1B, 0x55, 0x1B, 0x54, 0x1B, 0x4F, 0x1B, 0x45, 0x1B, 0x58, 0x1B, 0x45, 0x1B, 0x43, 0x1B, 0x2E, 0x1B, 0x42, 0x1B, 0x41, 0x1B, 0x54, 0x1B, 0x20, 0x1B, 0x66, 0x1B, 0x69, 0x1B, 0x6C, 0x1B, 0x65, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0xBA, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xBA, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x07, 0x1B, 0x20, 0x1B, 0x64, 0x1B, 0x6F, 0x1B, 0x20, 0x1B, 0x6E, 0x1B, 0x6F, 0x1B, 0x74, 0x1B, 0x20, 0x1B, 0x62, 0x1B, 0x6F, 0x1B, 0x6F, 0x1B, 0x74, 0x1B, 0x20, 0x1B, 0x77, 0x1B, 0x69, 0x1B, 0x74, 0x1B, 0x68, 0x1B, 0x20, 0x1B, 0x61, 0x1B, 0x20, 0x1B, 0x6D, 0x1B, 0x65, 0x1B, 0x6D, 0x1B, 0x6F, 0x1B, 0x72, 0x1B, 0x79, 0x1B, 0x20, 0x1B, 0x6D, 0x1B, 0x61, 0x1B, 0x6E, 0x1B, 0x61, 0x1B, 0x67, 0x1B, 0x65, 0x1B, 0x72, 0x1B, 0x20, 0x1B, 0x28, 0x1B, 0x6C, 0x1B, 0x69, 0x1B, 0x6B, 0x1B, 0x65, 0x1B, 0x20, 0x1B, 0x45, 0x1B, 0x4D, 0x1B, 0x4D, 0x1B, 0x33, 0x1B, 0x38, 0x1B, 0x36, 0x1B, 0x29, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0xBA, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xBA, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x07, 0x1B, 0x20, 0x1B, 0x64, 0x1B, 0x6F, 0x1B, 0x20, 0x1B, 0x6E, 0x1B, 0x6F, 0x1B, 0x74, 0x1B, 0x20, 0x1B, 0x6C, 0x1B, 0x6F, 0x1B, 0x61, 0x1B, 0x64, 0x1B, 0x20, 0x1B, 0x61, 0x1B, 0x6E, 0x1B, 0x79, 0x1B, 0x20, 0x1B, 0x64, 0x1B, 0x69, 0x1B, 0x73, 0x1B, 0x6B, 0x1B, 0x20, 0x1B, 0x63, 0x1B, 0x6F, 0x1B, 0x6D, 0x1B, 0x70, 0x1B, 0x72, 0x1B, 0x65, 0x1B, 0x73, 0x1B, 0x73, 0x1B, 0x69, 0x1B, 0x6F, 0x1B, 0x6E, 0x1B, 0x20, 0x1B, 0x64, 0x1B, 0x72, 0x1B, 0x69, 0x1B, 0x76, 0x1B, 0x65, 0x1B, 0x72, 0x1B, 0x73, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0xBA, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xBA, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x07, 0x1B, 0x20, 0x1B, 0x72, 0x1B, 0x75, 0x1B, 0x6E, 0x1B, 0x20, 0x1B, 0x52, 0x1B, 0x4F, 0x1B, 0x54, 0x1B, 0x54, 0x1B, 0x48, 0x1B, 0x45, 0x1B, 0x4C, 0x1B, 0x50, 0x1B, 0x2E, 0x1B, 0x45, 0x1B, 0x58, 0x1B, 0x45, 0x1B, 0x20, 0x1B, 0x66, 0x1B, 0x6F, 0x1B, 0x72, 0x1B, 0x20, 0x1B, 0x69, 0x1B, 0x6E, 0x1B, 0x66, 0x1B, 0x6F, 0x1B, 0x72, 0x1B, 0x6D, 0x1B, 0x61, 0x1B, 0x74, 0x1B, 0x69, 0x1B, 0x6F, 0x1B, 0x6E, 0x1B, 0x20, 0x1B, 0x6F, 0x1B, 0x6E, 0x1B, 0x20, 0x1B, 0x68, 0x1B, 0x6F, 0x1B, 0x77, 0x1B, 0x20, 0x1B, 0x74, 0x1B, 0x6F, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0xBA, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xBA, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x61, 0x1B, 0x6C, 0x1B, 0x6C, 0x1B, 0x65, 0x1B, 0x76, 0x1B, 0x69, 0x1B, 0x61, 0x1B, 0x74, 0x1B, 0x65, 0x1B, 0x20, 0x1B, 0x74, 0x1B, 0x68, 0x1B, 0x69, 0x1B, 0x73, 0x1B, 0x20, 0x1B, 0x70, 0x1B, 0x72, 0x1B, 0x6F, 0x1B, 0x62, 0x1B, 0x6C, 0x1B, 0x65, 0x1B, 0x6D, 0x1B, 0x20, 0x1B, 0x28, 0x1B, 0x73, 0x1B, 0x65, 0x1B, 0x61, 0x1B, 0x72, 0x1B, 0x63, 0x1B, 0x68, 0x1B, 0x20, 0x1B, 0x66, 0x1B, 0x6F, 0x1B, 0x72, 0x1B, 0x20, 0x1B, 0x22, 0x1B, 0x4D, 0x1B, 0x65, 0x1B, 0x6D, 0x1B, 0x6F, 0x1B, 0x72, 0x1B, 0x79, 0x1B, 0x20, 0x1B, 0x50, 0x1B, 0x72, 0x1B, 0x6F, 0x1B, 0x62, 0x1B, 0x6C, 0x1B, 0x65, 0x1B, 0x6D, 0x1B, 0x73, 0x1B, 0x22, 0x1B, 0x29, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0xBA, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xBA, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0xBA, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xBA, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x54, 0x1B, 0x68, 0x1B, 0x61, 0x1B, 0x74, 0x1B, 0x27, 0x1B, 0x73, 0x1B, 0x20, 0x1B, 0x61, 0x1B, 0x62, 0x1B, 0x6F, 0x1B, 0x75, 0x1B, 0x74, 0x1B, 0x20, 0x1B, 0x61, 0x1B, 0x6C, 0x1B, 0x6C, 0x1B, 0x20, 0x1B, 0x77, 0x1B, 0x65, 0x1B, 0x20, 0x1B, 0x63, 0x1B, 0x61, 0x1B, 0x6E, 0x1B, 0x20, 0x1B, 0x66, 0x1B, 0x69, 0x1B, 0x74, 0x1B, 0x20, 0x1B, 0x69, 0x1B, 0x6E, 0x1B, 0x20, 0x1B, 0x74, 0x1B, 0x68, 0x1B, 0x69, 0x1B, 0x73, 0x1B, 0x20, 0x1B, 0x73, 0x1B, 0x71, 0x1B, 0x75, 0x1B, 0x61, 0x1B, 0x72, 0x1B, 0x65, 0x1B, 0x2E, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x54, 0x1B, 0x72, 0x1B, 0x79, 0x1B, 0x20, 0x1B, 0x52, 0x1B, 0x4F, 0x1B, 0x54, 0x1B, 0x54, 0x1B, 0x48, 0x1B, 0x45, 0x1B, 0x4C, 0x1B, 0x50, 0x1B, 0x21, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0xBA, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xBA, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0x20, 0x1B, 0xBA, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC8, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xCD, 0x1B, 0xBC, 0x1B, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0xC4, 0x04, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07 }; rott-20230810/rott/rt_error.h000066400000000000000000000015651446517470200157630ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_error_public #define _rt_error_public extern boolean DivisionError; void UL_ErrorStartup ( void ); void UL_ErrorShutdown ( void ); #endif rott-20230810/rott/rt_fc_a.h000066400000000000000000000023111446517470200155100ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_fc_a_public #define _rt_fc_a_public //*************************************************************************** // // RT_FC_A.ASM - Maprow stuff for floor and ceiling // //*************************************************************************** void DrawSkyPost (byte * buf, byte * src, int height); void DrawRow(int count, byte * dest, byte * src); void DrawRotRow(int count, byte * dest, byte * src); void DrawMaskedRotRow(int count, byte * dest, byte * src); #endif rott-20230810/rott/rt_floor.c000066400000000000000000000275621446517470200157530ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ // RT_FLOOR.C #include "rt_def.h" #include "watcom.h" #include "rt_floor.h" #include "rt_fc_a.h" #include "_rt_floo.h" #include "rt_draw.h" #include "rt_util.h" #include "engine.h" #include "rt_main.h" #include "w_wad.h" #include "z_zone.h" #include "rt_view.h" #include "rt_ted.h" #include "rt_cfg.h" #include "rt_actor.h" #include #include "isr.h" #include "modexlib.h" #include "rt_playr.h" #include "rt_sound.h" #include "rt_rand.h" /* ============================================================================= Global Variables GLOBAL VARIABLES ============================================================================= */ int sky; int mr_rowofs; int mr_count; int mr_xstep; int mr_ystep; int mr_xfrac; int mr_yfrac; byte * mr_dest; byte * mr_src; /* ================== = = Local Variables = ================== */ static byte *floor; static byte *ceiling; //static int xstarts[MAXVIEWHEIGHT]; static int xstarts[600];//set to max hight res static byte * skysegs[MAXSKYSEGS]; static byte * skydata[MAXSKYDATA]; static int horizonheight; static int centerskypost; static int oldsky=-1; void DrawSky( void ) { byte * src; int dest; // int plane; int height; const int height2 = viewheight*200/iGLOBAL_SCREENHEIGHT; int ang; int angle; int ofs; angle=viewangle; if ((fog==0) && (lightning==true)) shadingtable=colormap+((basemaxshade-6-lightninglevel)<<8); else shadingtable=colormap+(1<<12); ofs=(((maxheight)-(player->z))>>3)+(centery*200/iGLOBAL_SCREENHEIGHT-((height2)>>1)); if (ofs>centerskypost) { ofs=centerskypost; } else if (((centerskypost-ofs)+height2)>1799) { ofs=-(1799-(centerskypost+height2)); } //ofs=centerskypost; { { for (dest=0;destz))>>3)+(centery-(viewheight>>1)); if (ofs>centerskypost) { ofs=centerskypost; } else if (((centerskypost-ofs)+viewheight)>599) { ofs=-(599-(centerskypost+viewheight)); } bufferofs+=screenofs; { for (dest=0;dest>16)); src+=srcstep; } } } /* =================== = = MakeSkyData = =================== */ void MakeSkyData ( void ) { byte * temp; byte * ptr; int c; temp=SafeMalloc(256*800); ptr=temp; for (c=0;c<256;c++) { memcpy(ptr,skydata[1]+(c*200),200); ptr+=200; memcpy(ptr,skydata[0]+(c*200),200); ptr+=200; //memcpy(ptr,skydata[1]+(c*200),200); //ptr+=200; //memcpy(ptr,skydata[0]+(c*200),200); //ptr+=200; } skydata[0]=temp; } /* =================== = = GetFloorCeilingLump = =================== */ int GetFloorCeilingLump ( int num ) { int lump; switch (num) { case 1: lump=W_GetNumForName("FLRCL1\0"); break; case 2: lump=W_GetNumForName("FLRCL2\0"); break; case 3: lump=W_GetNumForName("FLRCL3\0"); break; case 4: lump=W_GetNumForName("FLRCL4\0"); break; case 5: lump=W_GetNumForName("FLRCL5\0"); break; case 6: lump=W_GetNumForName("FLRCL6\0"); break; case 7: lump=W_GetNumForName("FLRCL7\0"); break; case 8: lump=W_GetNumForName("FLRCL8\0"); break; case 9: lump=W_GetNumForName("FLRCL9\0"); break; case 10: lump=W_GetNumForName("FLRCL10\0"); break; case 11: lump=W_GetNumForName("FLRCL11\0"); break; case 12: lump=W_GetNumForName("FLRCL12\0"); break; case 13: lump=W_GetNumForName("FLRCL13\0"); break; case 14: lump=W_GetNumForName("FLRCL14\0"); break; case 15: lump=W_GetNumForName("FLRCL15\0"); break; case 16: lump=W_GetNumForName("FLRCL16\0"); break; default: Error("Illegal Floor/Ceiling Tile = %d\n",num); break; } return lump; } /* =================== = = SkyExists = =================== */ boolean SkyExists (void) { if (MAPSPOT(1,0,0) >= 234) { return true; } else { return false; } } /* =================== = = SetPlaneViewSize = =================== */ void SetPlaneViewSize (void) { int x; int i; int s; int floornum; int ceilingnum; int skytop; int skybottom; sky=0; if (oldsky>0) { SafeFree(skydata[0]); oldsky=-1; } lightning=false; if (MAPSPOT(1,0,0) >= 234) { word crud; sky = (MAPSPOT(1,0,0) - 233); if ((sky<1) || (sky>6)) Error("Illegal Sky Tile = %d\n",sky); ceilingnum=1; crud=(word)MAPSPOT(1,0,1); if ((crud>=90) && (crud<=97)) horizonheight=crud-89; else if ((crud>=450) && (crud<=457)) horizonheight=crud-450+9; else Error("You must specify a valid horizon height sprite icon over the sky at (2,0) on map %d\n",gamestate.mapon); // Check for lightnign icon crud=(word)MAPSPOT(4,0,1); if (crud==377) lightning=true; } else ceilingnum = MAPSPOT(1,0,0)-197; floornum = MAPSPOT(0,0,0)-(179); floornum = GetFloorCeilingLump ( floornum ); //ceilingnum = GetFloorCeilingLump ( ceilingnum ); floor = W_CacheLumpNum(floornum,PU_LEVELSTRUCT, Cvt_patch_t, 1); floor +=8; if (sky==0) // Don't cache in if not used { ceilingnum = GetFloorCeilingLump ( ceilingnum ); ceiling = W_CacheLumpNum(ceilingnum,PU_LEVELSTRUCT, Cvt_patch_t, 1); ceiling +=8; } else { ceiling = NULL; } s = W_GetNumForName("SKYSTART"); switch (sky) { case 1: skytop=s+1; skybottom=s+2; break; case 2: skytop=s+3; skybottom=s+4; break; case 3: skytop=s+5; skybottom=s+6; break; case 4: skytop=s+7; skybottom=s+8; break; case 5: skytop=s+9; skybottom=s+10; break; case 6: skytop=s+11; skybottom=s+12; break; } if (sky!=0) { skydata[0]=W_CacheLumpNum(skytop,PU_STATIC, CvtNull, 1); skydata[1]=W_CacheLumpNum(skybottom,PU_STATIC, CvtNull, 1); centerskypost=MINSKYHEIGHT-(horizonheight*6); oldsky=sky; MakeSkyData(); W_CacheLumpNum(skytop,PU_CACHE, CvtNull, 1); W_CacheLumpNum(skybottom,PU_CACHE, CvtNull, 1); x=511; for (i=0;i>1)*400)+centerskypost; x--; if (x==-1) { x=511; } } /* endfor */ } } /* ========================== = = SetFCLightLevel = ========================== */ void SetFCLightLevel (int height) { int i; if (MISCVARS->GASON==1) { shadingtable=greenmap+(MISCVARS->gasindex<<8); return; } if (fulllight) { shadingtable=colormap+(1<<12); return; } if (fog) { i=((height*200/iGLOBAL_SCREENHEIGHT)>>normalshade)+minshade; if (i>maxshade) i=maxshade; shadingtable=colormap+(i<<8); } else { i=maxshade-(height>>normalshade); if (icentery) { int hd; buf=floor; hd=yp-centery; height=(hd<<13)/(maxheight-pheight+32); } else { int hd; /* ROTT bug? It'd draw when there was no ceiling. - SBF */ if (ceiling == NULL) return; buf=ceiling; hd=centery-yp; height=(hd<<13)/pheight; } SetFCLightLevel(height>>(8-HEIGHTFRACTION-1)); mr_xstep = ((viewsin<<8)/(height)); mr_ystep = ((viewcos<<8)/(height)); startxfrac = ((viewx>>1) + FixedMulShift(mr_ystep,scale,2))- FixedMulShift(mr_xstep,(centerx-xleft),2); startyfrac = ((viewy>>1) - FixedMulShift(mr_xstep,scale,2))- FixedMulShift(mr_ystep,(centerx-xleft),2); dest=(byte *)bufferofs+ylookup[yp]; /* TODO: horizontal isn't as easy as vertical in packed */ { { mr_dest=dest+xleft; mr_xfrac = startxfrac; mr_yfrac = startyfrac; // back off the pixel increment (orig. is 4x) mr_xstep >>= 2; mr_ystep >>= 2; mr_count = xright-xleft+1; if (mr_count) DrawRow(mr_count,mr_dest,buf); } } } void DrawPlanes( void ) { int x,y; int twall; int bwall; if (sky) DrawSky(); else { y=0; for (x=0;xtwall) { y--; DrawHLine(xstarts[y],x-1,y); } } while (y>0) { y--; DrawHLine(xstarts[y],viewwidth-1,y); } } y=viewheight-1; for (x=0;xbwall) { xstarts[y]=x; y--; } while (y> (32-7)) | ((frac >> (32-23)) << 7)) & 16383; *dest++ = shadingtable[src[coord]]; frac += fracstep; } } rott-20230810/rott/rt_floor.h000066400000000000000000000024051446517470200157450ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_floor_public #define _rt_floor_public //*************************************************************************** // // RT_FLOOR.C - Floor and Ceiling stuff // //*************************************************************************** extern int mr_xstep; extern int mr_ystep; extern int mr_xfrac; extern int mr_yfrac; extern int sky; //Whether Parallax is on or off void DrawPlanes (void); void SetPlaneViewSize( void ); void MakeSkyTile (byte * tile); void DrawFullSky( void ); boolean SkyExists (void); #endif rott-20230810/rott/rt_game.c000066400000000000000000003673101446517470200155410ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "rt_main.h" #include "rt_game.h" #include "_rt_game.h" #include "rt_menu.h" #include "z_zone.h" #include "w_wad.h" #include "lumpy.h" #include "rt_playr.h" #include "rt_util.h" #include "rt_ted.h" #include "rt_draw.h" #include "rt_view.h" #include "rt_vid.h" #include "rt_door.h" #include "rt_in.h" #include "rt_str.h" #include "isr.h" #include "rt_build.h" #include "rt_rand.h" #include "rt_cfg.h" #include "rt_sound.h" #include "version.h" #include "rt_crc.h" #include "modexlib.h" #include "engine.h" #include "gmove.h" #include "rt_com.h" #include "rt_net.h" #include "watcom.h" #include "rt_floor.h" #include "rt_msg.h" #include "rt_scale.h" #include "develop.h" #if (SHAREWARE == 1) #define NUMAMMOGRAPHICS 10 #else #define NUMAMMOGRAPHICS 20 #endif //****************************************************************************** // // GLOBALS // //****************************************************************************** int PlayerSnds[5] = {SD_PLAYERTCSND, SD_PLAYERTBSND, SD_PLAYERDWSND, SD_PLAYERLNSND, SD_PLAYERIPFSND}; unsigned short SHAKETICS = 0xFFFF;//bna++ //int SHAKETICS = 0xFFFF; int damagecount = 0; HighScore Scores[MaxScores] = { {"Tom",70000,7,1}, {"Chuck",60000,6,1}, {"Mark",50000,5,1}, {"The Joes",40000,4,1}, {"William",30000,3,1}, {"Jim",20000,2,1}, {"Steve",10000,1,1}, }; //****************************************************************************** // // LOCALS // //****************************************************************************** static int KeyX[4] = {KEY1_X, KEY2_X, KEY3_X, KEY4_X}; static const char *Names[ 5 ] = { "Taradino", "Thi", "Doug", "Lorelei", "Ian Paul" }; static const char *LastNames[ 5 ] = { "Cassatt", "Barrett", "Wendt", "Ni", "Freeley" }; static STR ScoreStr; static STR LivesStr; static STR TriadStr; static STR KillStr; static pic_t *lifeptnums[10]; static pic_t *lifenums[10]; static pic_t *timenums[10]; static pic_t *scorenums[10]; static pic_t *keys[4]; static pic_t *men[5]; static pic_t *health[6]; static pic_t *ammo[26]; static pic_t *erase; static pic_t *eraseb; static pic_t *fragpic[ 5 ]; static pic_t *frag100pic[ 5 ]; static pic_t *negfragpic[ 5 ]; static pic_t *menneg[ 5 ]; static pic_t *blankfragpic; static int powerpics; static int poweradjust; static int poweruptime; static int powerupheight; static int protectiontime; static int protectionheight; static boolean EndLevelStuff = false; static boolean borderset = false; static int oldsec = -1; static pic_t *BkPic; int SaveTime = 0; int oldhealth; static int oldplayerhealth; static int oldpercenthealth; static int playeruniformcolor; #define NUMBONUSES 11 #define BONUSBONUS 100000 extern void VL_MemToScreenClipped (byte *source, int width, int height, int x, int y); void DrawPPic (int xpos, int ypos, int width, int height, byte *src, int num, boolean up, boolean bufferofsonly); extern void MoveScreenUpLeft(); extern void MoveScreenUpRight(); extern void MoveScreenDownLeft(); extern void MoveScreenDownRight(); //****************************************************************************** // // V_ReDrawBkgnd () // //****************************************************************************** void V_ReDrawBkgnd (int x, int y, int width, int height, boolean shade) { byte *src; byte *dest; byte *origdest; int j, k, planes, mask, m; m = (x&3); mask = (1 << m); origdest = (byte *)(bufferofs+ylookup[y]+x); if (VW_MarkUpdateBlock (x, y, x+width-1, y+height-1)) { for (planes = 0; planes < 4; planes++) { src = (&(BkPic->data)+((80*200)*m)+(80*y)+(x>>2)); dest = origdest; dest += planes; for (j = 0; j < height; j++) { for (k = 0; k < (width/4); k++) { if (shade) { *dest = *(colormap + ((MENUSHADELEVEL>>2)<<8) + *src++); } else { *dest = *src++; } dest += 4; } // draw the remainder. did the DOS version even bother? - SBF if ((width & 3) > planes) { if (shade) { *dest = *(colormap + ((MENUSHADELEVEL>>2)<<8) + *src); } else { *dest = *src; } } src += (80-(width/4)); dest += (linewidth-(width&~3)); } m++; mask <<= 1; if (mask == 16) { x+=4; mask = 1; m = 0; } } } } //****************************************************************************** // // CacheLumpGroup () // //****************************************************************************** void CacheLumpGroup ( char *startlump, pic_t **lumparray, int numberoflumps ) { int lumpnum; int i; lumpnum = W_GetNumForName( startlump ); for( i = 0; i < numberoflumps; i++ ) { lumparray[ i ] = ( pic_t * )W_CacheLumpNum( lumpnum + i, PU_LEVEL, Cvt_pic_t, 1 ); } } //****************************************************************************** // // SetupPlayScreen () // //****************************************************************************** void SetupPlayScreen ( void ) { int i; int j; int num; erase = ( pic_t * )W_CacheLumpName( "erase", PU_LEVEL, Cvt_pic_t, 1 ); eraseb = ( pic_t * )W_CacheLumpName( "eraseb", PU_LEVEL, Cvt_pic_t, 1 ); CacheLumpGroup( "tmnum0", timenums, 10 ); CacheLumpGroup( "lfnum0", lifeptnums, 10 ); CacheLumpGroup( "lvnum0", lifenums, 10 ); CacheLumpGroup( "health1b", health, 6 ); CacheLumpGroup( "key1", keys, 4 ); if ( !BATTLEMODE ) { CacheLumpGroup( "scnum0", scorenums, 10 ); num = locplayerstate->player; men[ num ] = ( pic_t * )W_CacheLumpNum( W_GetNumForName( "MAN1" ) + num, PU_LEVEL, Cvt_pic_t, 1 ); } else { int man; int num100; int negnum; int negman; CacheLumpGroup( "kilnum0", scorenums, 10 ); negnum = W_GetNumForName( "botnpic1" ); num = W_GetNumForName( "botpic0" ); num100 = W_GetNumForName( "botopic1" ); negman = W_GetNumForName( "negman1" ); man = W_GetNumForName( "man1" ); blankfragpic = ( pic_t * )W_CacheLumpNum( num, PU_LEVEL, Cvt_pic_t, 1 ); num++; for( i = 0; i < numplayers; i++ ) { j = PLAYERSTATE[ i ].player; if ( !gamestate.teamplay ) { fragpic[ j ] = ( pic_t * )W_CacheLumpNum( num + j, PU_LEVEL, Cvt_pic_t, 1 ); frag100pic[ j ] = ( pic_t * )W_CacheLumpNum( num100 + j, PU_LEVEL, Cvt_pic_t, 1 ); negfragpic[ j ] = ( pic_t * )W_CacheLumpNum( negnum + j, PU_LEVEL, Cvt_pic_t, 1 ); } else { negfragpic[ j ] = ( pic_t * )W_CacheLumpName( "teamnpic", PU_LEVEL, Cvt_pic_t, 1 ); fragpic[ j ] = ( pic_t * )W_CacheLumpName( "teampic", PU_LEVEL, Cvt_pic_t, 1 ); frag100pic[ j ] = fragpic[ j ]; } menneg[ j ] = ( pic_t * )W_CacheLumpNum( negman + j, PU_LEVEL, Cvt_pic_t, 1 ); men[ j ] = ( pic_t * )W_CacheLumpNum( man + j, PU_LEVEL, Cvt_pic_t, 1 ); } } powerpics = W_GetNumForName( "GDMODEP" ); poweradjust = POWERUPTICS / 16; num = W_GetNumForName( "INF_B" ); // bullet weapons ammo[0] = ( pic_t * )W_CacheLumpNum( num, PU_LEVEL, Cvt_pic_t, 1 ); ammo[1] = ( pic_t * )W_CacheLumpNum( num, PU_LEVEL, Cvt_pic_t, 1 ); ammo[2] = ( pic_t * )W_CacheLumpNum( num++, PU_LEVEL, Cvt_pic_t, 1 ); for(i=3;i < 13; i++ ) { ammo[ i ] = ( pic_t * )W_CacheLumpNum( num++, PU_LEVEL, Cvt_pic_t, 1 ); } ammo[13] = ( pic_t * )W_CacheLumpNum( num, PU_LEVEL, Cvt_pic_t, 1 ); ammo[14] = ( pic_t * )W_CacheLumpNum( num, PU_LEVEL, Cvt_pic_t, 1 ); ammo[15] = ( pic_t * )W_CacheLumpNum( num++, PU_LEVEL, Cvt_pic_t, 1 ); for(i=16;i < 26; i++ ) { ammo[ i ] = ( pic_t * )W_CacheLumpNum( num++, PU_LEVEL, Cvt_pic_t, 1 ); } oldplayerhealth = -1; oldpercenthealth = -1; } //****************************************************************************** // // GameMemToScreen() // //****************************************************************************** void GameMemToScreen ( pic_t *source, int x, int y, int bufferofsonly ) { if ( bufferofsonly ) { VL_MemToScreen( ( byte * )&source->data, source->width, source->height, x, y ); } else { GM_MemToScreen( ( byte * )&source->data, source->width, source->height, x, y ); } } //****************************************************************************** // // DrawPlayScreen () // //****************************************************************************** void DrawPlayScreen (boolean bufferofsonly) { pic_t *shape; int shapenum = 0; int ShowKillsYoffset = 0;//bna++ //return; if ( SHOW_TOP_STATUS_BAR() ) { if (iGLOBAL_SCREENWIDTH == 640) { //use this as dummy pic to fill out missing bar shape = ( pic_t * ) W_CacheLumpName( "bottbar", PU_CACHE, Cvt_pic_t, 1 ); //GameMemToScreen( shape, 0, 0, bufferofsonly ); GameMemToScreen( shape, 320, 0, bufferofsonly ); // delete hart in middle of topbar DrawPPic( 323,1, 8 >> 2, 16, ( byte * )&erase->data, 2, true, bufferofsonly ); // delete bullet in end of topbar DrawPPic( 620,1, 8 >> 2, 16, ( byte * )&erase->data, 2, true, bufferofsonly ); shape = ( pic_t * )W_CacheLumpName( "stat_bar", PU_CACHE, Cvt_pic_t, 1 ); GameMemToScreen( shape, 0, 0, bufferofsonly ); } else if (iGLOBAL_SCREENWIDTH == 320) { //SetTextMode ( ); shape = ( pic_t * )W_CacheLumpName( "stat_bar", PU_CACHE, Cvt_pic_t, 1 ); GameMemToScreen( shape, 0, 0, bufferofsonly ); } } if ( BATTLEMODE ) { DrawKills( bufferofsonly ); } if ( SHOW_BOTTOM_STATUS_BAR() ) { shape = ( pic_t * ) W_CacheLumpName( "bottbar", PU_CACHE, Cvt_pic_t, 1 ); if ( SHOW_KILLS() ) { ShowKillsYoffset = KILLS_HEIGHT; //shape = ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 ); //DrawTiledRegion( 0, 584, iGLOBAL_SCREENWIDTH, 32-16, 0, 16, shape );//bna++ // health_y = iGLOBAL_HEALTH_Y; // if ( SHOW_KILLS() ) // { // health_y -= KILLS_HEIGHT; //GameMemToScreen( shape, 0, (iGLOBAL_SCREENHEIGHT-40)+16, bufferofsonly ); //GameMemToScreen( shape, 0, 160, bufferofsonly );bna++ } //else { if (iGLOBAL_SCREENWIDTH == 640) { //bna fix - not to good? but no one has 286 any more //statusbar dosent cover hole screen, because its a lump picture width max 320 //first write dummy shape and next over it GameMemToScreen( shape, 320, (224*2)+16-ShowKillsYoffset, bufferofsonly ); //copy next shape to mem GameMemToScreen( shape, 0, (224*2)+16-ShowKillsYoffset, bufferofsonly ); // delete bullet in middle of shape picture DrawPPic( 310, (224*2)+17-ShowKillsYoffset, 8 >> 2, 16, ( byte * )&erase->data, 2, true, bufferofsonly ); // delete hart in middle of shape picture DrawPPic( 324, (224*2)+17-ShowKillsYoffset, 8 >> 2, 16, ( byte * )&erase->data, 2, true, bufferofsonly ); } else { GameMemToScreen( shape, 0, 184, bufferofsonly ); } } DrawBarAmmo( bufferofsonly ); DrawBarHealth( bufferofsonly ); if ( demoplayback ) { shape = ( pic_t * )W_CacheLumpName( "demo", PU_CACHE, Cvt_pic_t, 1 ); if (iGLOBAL_SCREENWIDTH == 640) { //DrawPPic( 148, 185, shape->width, shape->height, // ( byte * )&shape->data, 1, true, bufferofsonly );bna DrawPPic( 148*2, 465, shape->width, shape->height, ( byte * )&shape->data, 1, true, bufferofsonly ); } else { DrawPPic( 148, 185, shape->width, shape->height, ( byte * )&shape->data, 1, true, bufferofsonly ); } } } if ( !SHOW_TOP_STATUS_BAR() ) { return; } //draws small player picture and name in topbar oldsec = -1; DrawTime( bufferofsonly ); if ( !BATTLEMODE ) { int character; int width; int height; character = locplayerstate->player; GameMemToScreen( men[ character ], MEN_X, MEN_Y,bufferofsonly ); CurrentFont = tinyfont; // Draw player's name DrawGameString ( MEN_X + 3, MEN_Y + 2, Names[ character ], bufferofsonly ); VW_MeasurePropString( LastNames[ character ], &width, &height ); DrawGameString ( MEN_X + 44 - width, MEN_Y + 8, LastNames[ character ], bufferofsonly ); UpdateLives( locplayerstate->lives ); UpdateScore( gamestate.score ); DrawTriads( bufferofsonly ); DrawLives( bufferofsonly ); DrawScore( bufferofsonly ); } DrawKeys( bufferofsonly ); if ( locplayerstate->poweruptime ) { if ( player->flags & FL_GODMODE ) { shapenum = powerpics; } else if ( player->flags & FL_DOGMODE ) { shapenum = powerpics + 1; } else if ( player->flags & FL_FLEET ) { shapenum = powerpics + 2; } else if ( player->flags & FL_ELASTO ) { shapenum = powerpics + 3; } else if ( player->flags & FL_SHROOMS ) { shapenum = powerpics + 4; } shape = ( pic_t * )W_CacheLumpNum ( shapenum, PU_CACHE, Cvt_pic_t, 1 ); GameMemToScreen( eraseb, POWERUP1X, POWERUPY, bufferofsonly ); DrawMPPic( POWERUP1X, POWERUPY + powerupheight, shape->width, shape->height - powerupheight, powerupheight, ( byte * )&shape->data, bufferofsonly ); } if ( locplayerstate->protectiontime ) { if ( player->flags & FL_BPV ) { shapenum = powerpics + 6; } else if ( player->flags & FL_GASMASK ) { shapenum = powerpics + 5; } else if ( player->flags & FL_AV ) { shapenum = powerpics + 7; } shape = ( pic_t * )W_CacheLumpNum( shapenum, PU_CACHE, Cvt_pic_t, 1 ); GameMemToScreen( eraseb, POWERUP2X, POWERUPY, bufferofsonly ); DrawMPPic( POWERUP2X, POWERUPY + protectionheight, shape->width, shape->height - protectionheight, protectionheight, ( byte * )&shape->data, bufferofsonly ); } } //****************************************************************************** // // ShortenCodeName() // //****************************************************************************** void GetShortCodeName ( char *dest, char *source, int maxwidth ) { int width; int height; int length; strcpy( dest, source ); // Shorten name to fit length = strlen( dest ); VW_MeasurePropString( dest, &width, &height ); while( width > maxwidth ) { dest[ length ] = 0; length--; VW_MeasurePropString( dest, &width, &height ); } } //****************************************************************************** // // DrawKills () // //****************************************************************************** void DrawKills ( boolean bufferofsonly ) { int rank; int xpos; char codename[ MAXCODENAMELENGTH ]; int width; int playernum; int playerimage; int temp; int iKILLS_Y; pic_t *pic; CurrentFont = tinyfont; if ( SHOW_TOP_STATUS_BAR() ) { playernum = BATTLE_Team[ consoleplayer ]; playerimage = BATTLE_TeamLeader[ playernum ]; // Set uniformcolor playeruniformcolor = PLAYERSTATE[ playerimage ].uniformcolor; // Draw player's point box pic = men[ PLAYERSTATE[ playerimage ].player ]; if ( ( gamestate.ShowScores ) && ( BATTLE_Points[ playernum ] < 0 ) ) { pic = menneg[ PLAYERSTATE[ playerimage ].player ]; } DrawPPic( MEN_X, MEN_Y, pic->width, pic->height, ( byte * )&pic->data, 1, true, bufferofsonly ); // Draw player's name if ( gamestate.teamplay ) { GetShortCodeName( codename, colorname[ playeruniformcolor ], 42 ); } else { GetShortCodeName( codename, PLAYERSTATE[ playerimage ].codename, 42 ); } DrawGameString ( MEN_X + 2, MEN_Y + 2, codename, bufferofsonly ); // Draw "It" if player is 'it' if ( ( ( gamestate.battlemode == battle_Tag ) || ( gamestate.battlemode == battle_Hunter ) ) && ( BATTLE_It == BATTLE_Team[ consoleplayer ] ) ) { DrawGameString ( MEN_X + 22, MEN_Y + 8, "It", bufferofsonly); } // Draw triad if player is 'it' or has caught a triad if ( PLAYER[ consoleplayer ]->flags & FL_DESIGNATED ) { pic = W_CacheLumpName( "smalltri", PU_CACHE, Cvt_pic_t, 1 ); DrawPPic( TRIAD_X - 1, TRIAD_Y - 2, pic->width, pic->height, ( byte * )&pic->data, 1, true, bufferofsonly ); } else if ( ( gamestate.ShowScores ) && ( DisplayPoints != bo_kills_infinite ) ) { // Draw Kill goal if ( ( gamestate.battlemode == battle_Collector ) || ( gamestate.battlemode == battle_StandAloneGame ) ) { temp = BATTLE_NumCollectorItems; } else { temp = DisplayPoints; } ltoa ( temp % 1000, KillStr.str, 10); KillStr.length = strlen (KillStr.str); DrawNumber (TRIAD_X - 6, TRIAD_Y, 3, 5, bufferofsonly); } // Set uniformcolor playeruniformcolor = PLAYERSTATE[ consoleplayer ].uniformcolor; if ( gamestate.ShowScores ) { // Draw local player's points temp = BATTLE_Points[ playernum ] % 1000; if ( temp < 0 ) { temp = -temp; } ltoa ( temp, KillStr.str, 10); KillStr.length = strlen (KillStr.str); DrawNumber( LIVES_X - 12, LIVES_Y, 3, 4, bufferofsonly); } else { pic = W_CacheLumpName( "minus", PU_CACHE, Cvt_pic_t, 1 ); StatusDrawColoredPic( LIVES_X - 12, LIVES_Y, pic, bufferofsonly, playeruniformcolor ); StatusDrawColoredPic( LIVES_X - 4, LIVES_Y, pic, bufferofsonly, playeruniformcolor ); } // Draw whoever is 'It' playernum = BATTLE_It; playerimage = BATTLE_TeamLeader[ playernum ]; // Set uniformcolor playeruniformcolor = PLAYERSTATE[ playerimage ].uniformcolor; // Draw player's point box pic = men[ PLAYERSTATE[ playerimage ].player ]; if ( ( gamestate.ShowScores ) && ( BATTLE_Points[ playernum ] < 0 ) ) { pic = menneg[ PLAYERSTATE[ playerimage ].player ]; } DrawPPic( LEADER_X, LEADER_Y, pic->width, pic->height, (byte *)&pic->data, 1, true, bufferofsonly ); if ( ( gamestate.battlemode == battle_Tag ) || ( gamestate.battlemode == battle_Hunter ) ) { DrawGameString ( LEADER_X + 22, LEADER_Y + 8, "It", bufferofsonly); } if ( gamestate.ShowScores ) { // Draw number of points temp = BATTLE_Points[ playernum ] % 1000; if ( temp < 0 ) { temp = -temp; } ltoa ( temp, KillStr.str, 10); KillStr.length = strlen (KillStr.str); DrawNumber ( LEADER_NUM_X, LEADER_NUM_Y, 3, 4, bufferofsonly); } else { pic = W_CacheLumpName( "minus", PU_CACHE, Cvt_pic_t, 1 ); StatusDrawColoredPic( LEADER_NUM_X, LEADER_NUM_Y, pic, bufferofsonly, playeruniformcolor ); StatusDrawColoredPic( LEADER_NUM_X + 8, LEADER_NUM_Y, pic, bufferofsonly, playeruniformcolor ); } // Draw name if ( gamestate.teamplay ) { DrawGameString ( LEADER_NAME_X, LEADER_NAME_Y - 1, colorname[ playeruniformcolor ], bufferofsonly); } else { GetShortCodeName( codename, PLAYERSTATE[ playerimage ].codename, 42 ); DrawGameString ( LEADER_NAME_X - 1, LEADER_NAME_Y, codename, bufferofsonly); } } // Only draw the rest of the rifraff when the kill count is selected if ( !SHOW_KILLS() ) { return; } // SetTextMode ( ); // Draw all the other losers //#define KILLS_Y 176 iKILLS_Y = iGLOBAL_SCREENHEIGHT - 24; //draw blank status pic->width = 8;pic->height = 24 pic = blankfragpic; for (temp = iGLOBAL_SCREENWIDTH-pic->width-24;temp > pic->width; temp -= pic->width){ DrawPPic( temp, iKILLS_Y, pic->width, pic->height, (byte *)&pic->data, 1, true, bufferofsonly ); } xpos = KILLS_X; for( rank = 0; rank < BATTLE_NumberOfTeams; rank++ ) { playernum = BATTLE_PlayerOrder[ rank ]; playerimage = BATTLE_TeamLeader[ playernum ]; if ( ( playernum == BATTLE_It ) && SHOW_TOP_STATUS_BAR() ) { continue; } // Set uniformcolor playeruniformcolor = PLAYERSTATE[ playerimage ].uniformcolor; // Draw player's point box pic = fragpic[ PLAYERSTATE[ playerimage ].player ]; if ( gamestate.ShowScores ) { if ( BATTLE_Points[ playernum ] < 0 ) { pic = negfragpic[ PLAYERSTATE[ playerimage ].player ]; } else if ( BATTLE_Points[ playernum ] >= 100 ) { pic = frag100pic[ PLAYERSTATE[ playerimage ].player ]; } } DrawPPic( xpos, iKILLS_Y, pic->width, pic->height, (byte *)&pic->data, 1, true, bufferofsonly ); // Draw number of points if ( gamestate.ShowScores ) { temp = BATTLE_Points[ playernum ] % 1000; if ( temp < 0 ) { temp = -temp; } ltoa ( temp, KillStr.str, 10); KillStr.length = strlen (KillStr.str); width = 2; if ( temp > 99 ) { width = 3; } DrawNumber( xpos + KILLS_OFFSET + 16 - ( 8 * width ), iKILLS_Y, width, 4, bufferofsonly); } else { pic = ( pic_t * )W_CacheLumpName( "minus", PU_CACHE, Cvt_pic_t, 1 ); StatusDrawColoredPic( ( xpos + KILLS_OFFSET ), iKILLS_Y, pic, bufferofsonly, playeruniformcolor ); StatusDrawColoredPic( ( xpos + KILLS_OFFSET + 8 ), iKILLS_Y, pic, bufferofsonly, playeruniformcolor ); } // Get codename if ( gamestate.teamplay ) { GetShortCodeName( codename, colorname[ playeruniformcolor ], KILLS_WIDTH - 2 ); } else { GetShortCodeName( codename, PLAYERSTATE[ playerimage ].codename, KILLS_WIDTH - 2 ); } // Draw name DrawGameString (xpos + 1, KILLS_NAME_Y, codename, bufferofsonly); // Advance to next position xpos += KILLS_WIDTH; if ( xpos >= iGLOBAL_SCREENWIDTH ) { break; } } for( rank = BATTLE_NumberOfTeams; rank <= MAXKILLBOXES; rank++ ) { if ( xpos >= iGLOBAL_SCREENWIDTH ) { break; } pic = blankfragpic; DrawPPic( xpos, iKILLS_Y, pic->width, pic->height, (byte *)&pic->data, 1, true, bufferofsonly ); // Advance to next position xpos += KILLS_WIDTH; } } //****************************************************************************** // // DrawPlayers () // //****************************************************************************** void DrawPlayers ( void ) { int num; int xpos; char codename[ MAXCODENAMELENGTH ]; int length; int width; int height; int team; int player; int character; pic_t *pic; pic_t *enemy; pic_t *friend; num = W_GetNumForName( "botpic1" ); scorenums[ 0 ]= ( pic_t * )W_CacheLumpName( "kilnum0", PU_CACHE, Cvt_pic_t, 1 ); friend = ( pic_t * )W_CacheLumpName( "t_friend", PU_CACHE, Cvt_pic_t, 1 ); enemy = ( pic_t * )W_CacheLumpName( "t_enemy", PU_CACHE, Cvt_pic_t, 1 ); // Draw all the losers CurrentFont = tinyfont; xpos = (iGLOBAL_SCREENWIDTH - min( numplayers, MAXKILLBOXES ) * KILLS_WIDTH ) / 2; //SetTextMode ( );//PLAYERSTATE for( team = 0; team < BATTLE_NumberOfTeams; team++ ) { for( player = 0; player < numplayers; player++ ) { if ( BATTLE_Team[ player ] == team ) { character = PLAYERSTATE[ player ].player; fragpic[ character ] = ( pic_t * )W_CacheLumpNum( num + character, PU_CACHE, Cvt_pic_t, 1 ); if ( ( numplayers <= MAXKILLBOXES ) || ( player != consoleplayer ) ) { // Set uniformcolor playeruniformcolor = PLAYERSTATE[ player ].uniformcolor; // Draw player's point box pic = fragpic[ PLAYERSTATE[ player ].player ]; VWB_DrawPic ( xpos, PLAYERS_Y, pic ); if ( gamestate.teamplay ) { if ( BATTLE_Team[ player ] == BATTLE_Team[ consoleplayer ] ) { VWB_DrawPic ( xpos, PLAYERS_TEAM_Y, friend ); } else { VWB_DrawPic ( xpos, PLAYERS_TEAM_Y, enemy ); } } strcpy( KillStr.str, "00" ); KillStr.length = strlen ( KillStr.str ); DrawNumber( xpos + KILLS_OFFSET, PLAYERS_Y, 2, 4, true ); // Get codename strcpy( codename, PLAYERSTATE[ player ].codename ); // Shorten name to fit into point count length = strlen( codename ); US_MeasureStr( &width, &height, "%s", codename ); while( width > KILLS_WIDTH ) { codename[ length ] = 0; length--; US_MeasureStr( &width, &height, "%s", codename ); } // Draw name PrintX = xpos; PrintY = PLAYERS_NAME_Y; US_Print( codename ); // Advance to next position xpos += KILLS_WIDTH; } } if ( xpos >= iGLOBAL_SCREENWIDTH ) { break; } } if ( xpos >= iGLOBAL_SCREENWIDTH ) { break; } } } //****************************************************************************** // // StatusDrawPic () // //****************************************************************************** void StatusDrawPic (unsigned x, unsigned y, pic_t *nums, boolean bufferofsonly) { DrawMPPic (x, y, nums->width, nums->height, 0, (byte *)&nums->data, bufferofsonly); } //****************************************************************************** // // StatusDrawColoredPic () // //****************************************************************************** void StatusDrawColoredPic (unsigned x, unsigned y, pic_t *nums, boolean bufferofsonly, int color) { DrawColoredMPPic (x, y, nums->width, nums->height, 0, (byte *)&nums->data, bufferofsonly, color); } //****************************************************************************** // // DrawGameString () // // draw string to game screen at x,y // //****************************************************************************** void DrawGameString (int x, int y, const char * str, boolean bufferofsonly) { byte *tempbuf; px=x; py=y; if (bufferofsonly==true) VW_DrawPropString (str); else { tempbuf=bufferofs; bufferofs=page1start; VW_DrawPropString (str); bufferofs=tempbuf; } } //****************************************************************************** // // DrawNumber () // // right justifies and pads with zeros // //****************************************************************************** void DrawNumber (int x, int y, int width, int which, boolean bufferofsonly) { unsigned length,c; char *str; byte z; switch (which) { case 1: str = ScoreStr.str; length = ScoreStr.length; break; case 2: str = LivesStr.str; length = LivesStr.length; break; case 3: str = TriadStr.str; length = TriadStr.length; break; case 4: case 5: case 6: str = KillStr.str; length = KillStr.length; break; } z = width - length; // Num zeros while (z) { switch (which) { case 1: StatusDrawPic (x, y, scorenums[0], bufferofsonly); x+=8; break; case 2: StatusDrawPic (x, y, lifenums[0], bufferofsonly); x+=8; break; case 3: StatusDrawPic (x, y, lifeptnums[0], bufferofsonly); x+=6; break; case 4: StatusDrawColoredPic (x, y, scorenums[0], bufferofsonly, playeruniformcolor); x+=8; break; case 5: StatusDrawPic (x, y, lifeptnums[0], bufferofsonly); x+=6; break; case 6: StatusDrawPic (x, y, lifenums[0], bufferofsonly); x+=8; break; } z--; } c = length <= (unsigned)width ? 0 : length-width; while (c < length) { switch (which) { case 1: StatusDrawPic (x, y, scorenums[str[c]-'0'], bufferofsonly); x+=8; break; case 2: StatusDrawPic (x, y, lifenums[str[c]-'0'], bufferofsonly); x+=8; break; case 3: StatusDrawPic (x, y, lifeptnums[str[c]-'0'], bufferofsonly); x+=6; break; case 4: StatusDrawColoredPic (x, y, scorenums[str[c]-'0'], bufferofsonly, playeruniformcolor); x+=8; break; case 5: StatusDrawPic (x, y, lifeptnums[str[c]-'0'], bufferofsonly); x+=6; break; case 6: StatusDrawPic (x, y, lifenums[str[c]-'0'], bufferofsonly); x+=8; break; } c++; } } //****************************************************************************** // // HealPlayer () // //****************************************************************************** void HealPlayer ( int points, objtype *ob ) { playertype *pstate; int maxhitpoints; M_LINKSTATE( ob, pstate ); pstate->health += points; maxhitpoints = MaxHitpointsForCharacter( pstate ); if ( pstate->health > maxhitpoints ) { pstate->health = maxhitpoints; } if ( ( SHOW_BOTTOM_STATUS_BAR() ) && ( ob == player ) ) { DrawBarHealth( false ); } } //****************************************************************************** // // DrawLives () // //****************************************************************************** void DrawLives ( boolean bufferofsonly ) { if ( !SHOW_TOP_STATUS_BAR() ) { return; } if ( !EndLevelStuff ) { DrawNumber( LIVES_X, LIVES_Y, 2, 2, bufferofsonly ); } } //****************************************************************************** // // GiveExtraMan () // //****************************************************************************** void GiveExtraMan (void) { if (locplayerstate->lives < 99) locplayerstate->lives++; UpdateLives (locplayerstate->lives); DrawLives (false); // SD_PlaySound (BONUS1UPSND); } //****************************************************************************** // // DrawScore () // //****************************************************************************** void DrawScore ( boolean bufferofsonly ) { if ( !SHOW_TOP_STATUS_BAR() ) { return; } if ( !BATTLEMODE ) { DrawNumber( SCORE_X, SCORE_Y, 10, 1, bufferofsonly ); } } //****************************************************************************** // // GivePoints () // //****************************************************************************** void GivePoints (long points) { gamestate.score += points; UpdateScore (gamestate.score); if (!EndLevelStuff) DrawScore (false); } //****************************************************************************** // // GiveKey () // //****************************************************************************** void GiveKey (int key) { locplayerstate->keys |= (1<lives + newlives) <= 99) locplayerstate->lives += newlives; else locplayerstate->lives = 99; UpdateLives (locplayerstate->lives); DrawLives (false); } #define EnableOldWeapon(pstate) \ { \ LASTSTAT->flags |= FL_ABP; \ LASTSTAT->flags &= ~FL_RESPAWN; \ MakeStatActive(LASTSTAT); \ pstate->weaponx = ob->tilex; \ pstate->weapony = ob->tiley; \ } //****************************************************************************** // // GiveWeapon () // //****************************************************************************** void GiveWeapon ( objtype *ob, int weapon ) { playertype *pstate; M_LINKSTATE( ob, pstate ); if ( pstate->weapon == weapon ) { return; } pstate->HASBULLETWEAPON[ weapon ] = 1; if ( ( pstate->weapon == pstate->bulletweapon ) && ( pstate->weapon < weapon ) ) { pstate->new_weapon = weapon; pstate->weapondowntics = WEAPONS[ pstate->weapon ].screenheight / GMOVE; if ( ( ob == player ) && ( SHOW_BOTTOM_STATUS_BAR() ) ) { DrawBarAmmo( false ); } } if ( gamestate.BattleOptions.WeaponPersistence ) { SpawnStatic(ob->tilex,ob->tiley,GetItemForWeapon(weapon),9); EnableOldWeapon(pstate); } if ( weapon > pstate->bulletweapon ) { pstate->bulletweapon = weapon; } } //****************************************************************************** // // GiveMissileWeapon () // //****************************************************************************** void GiveMissileWeapon(objtype * ob, int which) { playertype * pstate; //pstate = (ob==player)?(&playerstate):(&remoteplayerstate); M_LINKSTATE(ob,pstate); if (!gamestate.BattleOptions.WeaponPersistence) { if (pstate->ammo && (pstate->missileweapon != -1) && (!(WEAPON_IS_MAGICAL(which))) && (!(WEAPON_IS_MAGICAL(pstate->missileweapon))) ) { int nx,ny; nx = ob->tilex; ny = ob->tiley; //FindEmptyTile(&nx,&ny); if (IsPlatform(nx,ny)) SpawnStatic(nx,ny,GetItemForWeapon(pstate->missileweapon),9); else { int newz = sprites[ob->tilex][ob->tiley]->z; SpawnStatic(nx,ny,GetItemForWeapon(pstate->missileweapon),-1); LASTSTAT->z = newz; } LASTSTAT->ammo = pstate->ammo; EnableOldWeapon(pstate); } } else if (!WEAPON_IS_MAGICAL(which)) { int newz = sprites[ob->tilex][ob->tiley]->z; SpawnStatic(ob->tilex,ob->tiley,GetItemForWeapon(which),9); LASTSTAT->z = newz; EnableOldWeapon(pstate); } pstate->new_weapon = pstate->missileweapon = which; pstate->weapondowntics = WEAPONS[pstate->weapon].screenheight/GMOVE; } //****************************************************************************** // // DrawKeys () // //****************************************************************************** void DrawKeys ( boolean bufferofsonly ) { if ( !SHOW_TOP_STATUS_BAR() ) { return; } if ( locplayerstate->keys & 1 ) { GameMemToScreen( keys[ 0 ], KeyX[ 0 ], KEY_Y, bufferofsonly ); } if ( locplayerstate->keys & 2 ) { GameMemToScreen( keys[ 1 ], KeyX[ 1 ], KEY_Y, bufferofsonly ); } if ( locplayerstate->keys & 4 ) { GameMemToScreen( keys[ 2 ], KeyX[ 2 ], KEY_Y, bufferofsonly ); } if ( locplayerstate->keys & 8 ) { GameMemToScreen( keys[ 3 ], KeyX[ 3 ], KEY_Y, bufferofsonly ); } } //****************************************************************************** // // StatusDrawTime () // //****************************************************************************** void StatusDrawTime ( unsigned x, unsigned y, unsigned num, boolean bufferofsonly ) { DrawMPPic( x, y, timenums[ num ]->width, timenums[ num ]->height, 0, ( byte * )&timenums[ num ]->data, bufferofsonly ); } //****************************************************************************** // // DrawTimeNumber () // // right justifies and pads with blanks // //****************************************************************************** void DrawTimeNumber (int x, int y, int number, boolean seconds, boolean bufferofsonly) { char str[20]; ltoa (number,str,10); if (seconds) { if (number < 10) { StatusDrawTime (x, y, 0, bufferofsonly); StatusDrawTime (x+8, y, str[0]-'0', bufferofsonly); } else { StatusDrawTime (x, y, str[0]-'0', bufferofsonly); StatusDrawTime (x+8, y, str[1]-'0', bufferofsonly); } } else { if (number < 10) StatusDrawTime (x+8, y, str[0]-'0', bufferofsonly); else { StatusDrawTime (x, y, str[0]-'0', bufferofsonly); StatusDrawTime (x+8, y, str[1]-'0', bufferofsonly); } } } //****************************************************************************** // // DrawTimeXY () // //****************************************************************************** void DrawTimeXY ( int x, int y, int sec, boolean bufferofsonly ) { int min; int hour; while (sec > ( ( 9 * 3600 ) + 3599 ) ) { sec -= ( ( 9 * 3600 ) + 3599 ); } hour = sec / 3600; min = ( sec / 60 ) - ( hour * 60 ); sec %= 60; DrawTimeNumber ( x + HOUR_X, y, hour, false, bufferofsonly ); DrawTimeNumber ( x + MIN_X, y, min, true, bufferofsonly ); DrawTimeNumber ( x + SEC_X, y, sec, true, bufferofsonly ); } //****************************************************************************** // // DrawTime () // //****************************************************************************** void DrawTime ( boolean bufferofsonly ) { int sec; if ( !SHOW_TOP_STATUS_BAR() ) { return; } if (timelimitenabled == true) { sec = (timelimit-gamestate.TimeCount) / VBLCOUNTER; } else { sec = gamestate.TimeCount / VBLCOUNTER; } if ( oldsec != sec ) { oldsec = sec; DrawTimeXY( GAMETIME_X, GAMETIME_Y, sec, bufferofsonly) ; } } //****************************************************************************** // // DrawMPPic () // // Purpose // Draws a masked, planer pic at xpos, ypos. // // Parms // xpos - x position. // ypos - y position. // width - width of pic : should be << 2. // height - height of pic. // src - data to draw. // // Returns // Nothing. // //****************************************************************************** void DrawMPPic (int xpos, int ypos, int width, int height, int heightmod, byte *src, boolean bufferofsonly) { int olddest; int dest; int x; int y; int planes; byte pixel; olddest = ylookup[ypos] + xpos; for (planes = 0; planes < 4; planes++) { dest = olddest; dest += planes; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { pixel = *src++; if (pixel != 255) { if (bufferofsonly) *(dest+bufferofs) = pixel; else { *(dest+page1start) = pixel; *(dest+page2start) = pixel; *(dest+page3start) = pixel; } } dest += 4; } dest += (linewidth-width*4); } if (heightmod) src += (heightmod*width); } } //****************************************************************************** // // DrawColoredMPPic () // // Purpose // Draws a masked, planer pic at xpos, ypos. // // Parms // xpos - x position. // ypos - y position. // width - width of pic : should be << 2. // height - height of pic. // src - data to draw. // // Returns // Nothing. // //****************************************************************************** void DrawColoredMPPic (int xpos, int ypos, int width, int height, int heightmod, byte *src, boolean bufferofsonly, int color) { int olddest; int dest; int x; int y; int planes; byte pixel; byte * cmap; cmap=playermaps[color]+(1<<12); olddest = ylookup[ypos] + xpos; for (planes = 0; planes < 4; planes++) { dest = olddest; dest += planes; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { pixel = *src++; pixel = *(cmap+pixel); if (pixel != 255) { if (bufferofsonly) *(dest+bufferofs) = pixel; else { *(dest+page1start) = pixel; *(dest+page2start) = pixel; *(dest+page3start) = pixel; } } dest += 4; } dest += (linewidth-width*4); } if (heightmod) src += (heightmod*width); } } //****************************************************************************** // // UpdateScore () // //****************************************************************************** void UpdateScore (unsigned int num) { if (num > 999999999) { num = 999999999; gamestate.score = 999999999; } ltoa (num, ScoreStr.str, 10); ScoreStr.length = strlen (ScoreStr.str); } //****************************************************************************** // // UpdateLives () // //****************************************************************************** void UpdateLives (int num) { ltoa (num, LivesStr.str, 10); LivesStr.length = strlen (LivesStr.str); } //**************************************************************************** // // ClearTriads () // //**************************************************************************** void ClearTriads (playertype * pstate) { pstate->triads = 0; ltoa (pstate->triads, TriadStr.str, 10); TriadStr.length = strlen (TriadStr.str); } //**************************************************************************** // // UpdateTriads () // //**************************************************************************** void UpdateTriads (objtype * ob, int num) { playertype * pstate; M_LINKSTATE(ob,pstate); pstate->triads += num; if (pstate->triads >= 100) { GiveLives(1); if (ob==player) { AddMessage("100 Life Item Points! Extra Life!",MSG_BONUS); SD_PlaySoundRTP (SD_GET1UPSND, player->x, player->y); } pstate->triads -= 100; } if (ob==player) { ltoa (pstate->triads, TriadStr.str, 10); TriadStr.length = strlen (TriadStr.str); } } //**************************************************************************** // // DrawTriads () // //**************************************************************************** void DrawTriads ( boolean bufferofsonly ) { if ( !SHOW_TOP_STATUS_BAR() ) { return; } if ( !EndLevelStuff ) { DrawNumber( TRIAD_X, TRIAD_Y, 2, 3, bufferofsonly ); } } //****************************************************************************** // // DrawPPic () // //****************************************************************************** void DrawPPic (int xpos, int ypos, int width, int height, byte *src, int num, boolean up, boolean bufferofsonly) { int olddest; int dest; int x; int y; int planes; byte pixel; int k; int amt; if (up) amt = 8; else amt = -8; olddest = ylookup[ypos] + xpos; for (planes = 0; planes < 4; planes++) { dest = olddest; dest += planes; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { pixel = *src++; if (pixel != 255) { for (k = 0; k < num; k++) { if (bufferofsonly) *(dest+bufferofs+(amt*k)) = pixel; else { *(dest+page1start+(amt*k)) = pixel; *(dest+page2start+(amt*k)) = pixel; *(dest+page3start+(amt*k)) = pixel; } } } dest += 4; } dest += (linewidth-width*4); } } } //**************************************************************************** // // DrawBarHealth () // //**************************************************************************** void DrawBarHealth ( boolean bufferofsonly ) { int percenthealth; int health_y; if ( !SHOW_BOTTOM_STATUS_BAR() ) { return; } health_y = iGLOBAL_HEALTH_Y; if ( SHOW_KILLS() ) { health_y -= KILLS_HEIGHT; } percenthealth = ( locplayerstate->health * 10 ) / MaxHitpointsForCharacter( locplayerstate ); oldpercenthealth = percenthealth + 1; if ( playstate == ex_died ) { DrawPPic( iGLOBAL_HEALTH_X, health_y, 8 >> 2, 16, ( byte * )&erase->data, 10, true, bufferofsonly ); return; } if ( locplayerstate->health <= 0 ) { oldpercenthealth = 0; } if ( oldpercenthealth >= 11 ) { oldpercenthealth = 10; } if ( oldpercenthealth < 4 ) { DrawPPic( iGLOBAL_HEALTH_X, health_y, 8 >> 2, 16, ( byte * )&health[ 0 ]->data, oldpercenthealth, true, bufferofsonly ); } else if ( oldpercenthealth < 5 ) { DrawPPic( iGLOBAL_HEALTH_X, health_y, 8 >> 2, 16, (byte *)&health[ 1 ]->data, oldpercenthealth, true, bufferofsonly ); } else { DrawPPic( iGLOBAL_HEALTH_X, health_y, 8 >> 2, 16, ( byte * )&health[ 2 ]->data, oldpercenthealth, true, bufferofsonly ); } if ( oldpercenthealth < 10 ) { DrawPPic( iGLOBAL_HEALTH_X + ( 8 * oldpercenthealth ), health_y, 8 >> 2, 16, ( byte * )&erase->data, 10 - oldpercenthealth, true, bufferofsonly ); } } //**************************************************************************** // // DrawBarAmmo () // //**************************************************************************** void DrawBarAmmo ( boolean bufferofsonly ) { int ammo_y; if ( ( !SHOW_BOTTOM_STATUS_BAR() ) || ( playstate == ex_died ) ) { return; } ammo_y = iGLOBAL_AMMO_Y; if ( SHOW_KILLS() ) { ammo_y -= KILLS_HEIGHT; } DrawPPic ( iGLOBAL_AMMO_X, ammo_y + 1, 8 >> 2, 16, ( byte * )&erase->data, 10, false, bufferofsonly ); if ( !ARMED( player->dirchoosetime ) ) { return; } if ((locplayerstate->new_weapon < wp_bazooka) || (locplayerstate->new_weapon == wp_godhand) || ( gamestate.BattleOptions.Ammo == bo_infinite_shots ) ) { DrawPPic( iGLOBAL_AMMO_X - 16, ammo_y, 24 >> 2, 16, ( byte * )&ammo[ 0 ]->data, 1, true, bufferofsonly); DrawPPic( iGLOBAL_AMMO_X - 32, ammo_y + 1, 8 >> 2, 16, ( byte * )&erase->data, 2, true, bufferofsonly ); } #if (SHAREWARE == 0) else if ( locplayerstate->new_weapon == wp_dog ) { DrawPPic( iGLOBAL_AMMO_X - 16, ammo_y, 24 >> 2, 16, ( byte * )&ammo[12]->data, 1, true, bufferofsonly ); DrawPPic( iGLOBAL_AMMO_X - 32, ammo_y + 1, 8 >> 2, 16, ( byte * )&erase->data, 2, true, bufferofsonly ); } #endif else { DrawPPic( iGLOBAL_AMMO_X, ammo_y + 1, 8 >> 2, 16, ( byte * )&ammo[ locplayerstate->new_weapon]->data, locplayerstate->ammo, false, bufferofsonly ); } } //****************************************************************************** // // SingleDrawPPic () // //****************************************************************************** void SingleDrawPPic (int xpos, int ypos, int width, int height, byte *src, int num, boolean up) { byte *olddest; byte *dest; int x; int y; int planes; byte pixel; int k; int amt; if (up) amt = 8; else amt = -8; olddest = (byte *)(bufferofs - screenofs + ylookup[ypos] + xpos); for (planes = 0; planes < 4; planes++) { dest = olddest; dest += planes; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { pixel = *src++; if (pixel != 255) { for (k = 0; k < num; k++) { *(dest+(amt*k)) = pixel; } } dest += 4; } dest += (linewidth-width*4); } } } //**************************************************************************** // // DrawStats () // //**************************************************************************** void DrawStats ( void ) { int percenthealth; int health_y; int ammo_y; if ( ( !SHOW_PLAYER_STATS() ) || ( playstate == ex_died ) || ( locplayerstate->health <= 0 ) ) { return; } // Uncomment this if we want transparent health only on sizes < 16 // if ( viewsize < 16 ) // { // pic_t *shape; // // shape = W_CacheLumpName( "backtile", PU_CACHE ); // DrawTiledRegion( 0, 160, 320, 24, shape ); // } health_y = iGLOBAL_HEALTH_Y; ammo_y = iGLOBAL_AMMO_Y; if ( SHOW_KILLS() ) { health_y -= KILLS_HEIGHT; ammo_y -= KILLS_HEIGHT; } if ( oldplayerhealth != locplayerstate->health ) { oldplayerhealth = locplayerstate->health; percenthealth = ( locplayerstate->health * 10 ) / MaxHitpointsForCharacter( locplayerstate ); oldpercenthealth = percenthealth + 1; } if ( oldpercenthealth > 10 ) { oldpercenthealth = 10; } if ( oldpercenthealth < 4 ) { SingleDrawPPic( iGLOBAL_HEALTH_X - 16, health_y, 8 >> 2, 16, ( byte * )&health[ 3 ]->data, oldpercenthealth, true); } else if ( oldpercenthealth < 5 ) { SingleDrawPPic( iGLOBAL_HEALTH_X - 16, health_y, 8 >> 2, 16, ( byte * )&health[ 4 ]->data, oldpercenthealth, true ); } else { SingleDrawPPic( iGLOBAL_HEALTH_X - 16, health_y, 8 >> 2, 16, ( byte * )&health[ 5 ]->data, oldpercenthealth, true ); } if ( ARMED( consoleplayer ) ) { if ((locplayerstate->new_weapon < wp_bazooka) || (locplayerstate->new_weapon == wp_godhand) || (gamestate.BattleOptions.Ammo == bo_infinite_shots ) ) { SingleDrawPPic( iGLOBAL_AMMO_X - 16, ammo_y, 24 >> 2, 16, ( byte * )&ammo[13]->data, 1, true ); } #if (SHAREWARE == 0) else if ( locplayerstate->new_weapon == wp_dog ) { SingleDrawPPic( iGLOBAL_AMMO_X - 16, ammo_y + 1, 24 >> 2, 16, ( byte * )&ammo[25]->data, 1, true ); } #endif else { SingleDrawPPic( iGLOBAL_AMMO_X, ammo_y + 1, 8 >> 2, 16, ( byte * )&ammo[13 + locplayerstate->new_weapon]->data, locplayerstate->ammo, false ); } } } //**************************************************************************** // // DrawPauseXY () // //**************************************************************************** void DrawPauseXY (int x, int y) { pic_t *p; byte *buftmp; buftmp = bufferofs; if (GamePaused == true) { p = (pic_t *) W_CacheLumpNum (W_GetNumForName ("paused"), PU_CACHE, Cvt_pic_t, 1); VL_MemToScreen ((byte *)&p->data, p->width, p->height,x, y); //VWB_DrawPic (x, y, p); bufferofs = buftmp; DrawEpisodeLevel (x,y); //VL_MemToScreen ((byte *)&p->data, p->width, p->height,x, y); } else { p = (pic_t *) W_CacheLumpNum (W_GetNumForName ("wait"), PU_CACHE, Cvt_pic_t, 1); VL_MemToScreen ((byte *)&p->data, p->width, p->height,x, y); //VWB_DrawPic (x, y, p); } bufferofs = buftmp; } //**************************************************************************** // // DrawPause () // //**************************************************************************** void DrawPause (void) { pic_t *p; byte *bufftemp = bufferofs; bufferofs -= screenofs; if (GamePaused == true) { bufferofs = bufftemp; p = (pic_t *) W_CacheLumpNum (W_GetNumForName ("paused"), PU_CACHE, Cvt_pic_t, 1); DrawPauseXY( (iGLOBAL_SCREENWIDTH-(p->width<<2) ) >>1, (iGLOBAL_SCREENHEIGHT-p->height)>>1);//bna++ //DrawPauseXY( (320-(p->width<<2) ) >>1, (200-p->height)>>1); /* //buf = (byte *) SafeMalloc (64000); w = p->width; h = p->height; x = (iGLOBAL_SCREENWIDTH-((p->width)<<2) ) >>1; y = (iGLOBAL_SCREENHEIGHT-(p->height))>>1; x1 = (iGLOBAL_SCREENWIDTH-((p->width*2)<<2) ) >>1; y1 = (iGLOBAL_SCREENHEIGHT-(p->height*2))>>1; source = bufferofs + (iGLOBAL_SCREENWIDTH*y)+x; target = bufferofs + (iGLOBAL_SCREENWIDTH*y1)+x1; // memcpy(tmpPICbuf,bufftemp,iGLOBAL_SCREENWIDTH*iGLOBAL_SCREENHEIGHT); bufferofs = bufftemp;//(byte *)tmpPICbuf;//buf;//write picture in tmpbuf VL_MemToScreen ((byte *)&p->data, p->width, p->height,x, y); bufferofs = bufftemp; DrawEpisodeLevel (x,y); //VL_MemStrechedToScreen ((byte *)&p->data, p->width, p->height,(iGLOBAL_SCREENWIDTH-((p->width*2)<<2) ) >>1, (iGLOBAL_SCREENHEIGHT-(p->height*2))>>1); //DrawEpisodeLevel (x,y); //VL_MemToScreen ((byte *)&p->data, p->width, p->height,0, 0); //bufferofs = bufftemp;//move ptr back //write it back to bufferofs while streching //buf = bufftemp; //b = tmpPICbuf ; source = bufferofs + (iGLOBAL_SCREENWIDTH*y)+x+(w*4); target = bufferofs + (iGLOBAL_SCREENWIDTH*y1)+x+(2*w*4); //first strech lines in x direction for (y=0;ywidth<<2) ) >>1, (iGLOBAL_SCREENHEIGHT-p->height)>>1);//bna++ //DrawPauseXY( (320-(p->width<<2) ) >>1, (200-p->height)>>1); } // VH_UpdateScreen () ; bufferofs = bufftemp; } //**************************************************************************** // // GM_DrawBonus () // //**************************************************************************** void GM_DrawBonus ( int which ) { if ( which < stat_gasmask ) { poweruptime = GetBonusTimeForItem(which); poweradjust = (poweruptime >> 4); powerupheight = 0; GM_UpdateBonus(poweruptime-poweradjust - 1,true); } else { protectiontime = GetBonusTimeForItem(which); poweradjust = (protectiontime >> 4); protectionheight = 0; GM_UpdateBonus(protectiontime-poweradjust-1,false); } } //****************************************************************************** // // GM_UpdateBonus () // //****************************************************************************** void GM_UpdateBonus ( int time, int powerup ) { pic_t *shape; int shapenum = 0; if ( powerup ) { if ( time < ( poweruptime - poweradjust ) ) { powerupheight++; if ( !SHOW_TOP_STATUS_BAR() ) { poweruptime = time; } } } else { if ( time < ( protectiontime - poweradjust ) ) { protectionheight++; if ( !SHOW_TOP_STATUS_BAR() ) { protectiontime = time; } } } if ( !SHOW_TOP_STATUS_BAR() ) { return; } if ( !time ) { if ( powerup == 1 ) { shapenum = POWERUP1X; } else { shapenum = POWERUP2X; } GM_MemToScreen( ( byte * )&eraseb->data, eraseb->width, eraseb->height, shapenum, POWERUPY ); return; } if ( powerup ) { if ( time < ( poweruptime - poweradjust ) ) { if ( player->flags & FL_GODMODE ) { shapenum = powerpics; } else if ( player->flags & FL_DOGMODE ) { shapenum = powerpics + 1; } else if ( player->flags & FL_FLEET ) { shapenum = powerpics + 2; } else if ( player->flags & FL_ELASTO ) { shapenum = powerpics + 3; } else if ( player->flags & FL_SHROOMS ) { shapenum = powerpics + 4; } else { GM_MemToScreen( ( byte * )&eraseb->data, eraseb->width, eraseb->height, POWERUP1X, POWERUPY ); return; } poweruptime = time; shape = ( pic_t * )W_CacheLumpNum( shapenum, PU_CACHE, Cvt_pic_t, 1 ); GM_MemToScreen( ( byte * )&eraseb->data, eraseb->width, eraseb->height, POWERUP1X, POWERUPY ); DrawMPPic( POWERUP1X, POWERUPY + powerupheight, shape->width, shape->height - powerupheight, powerupheight, ( byte * )&shape->data, false ); } } else { if ( time < ( protectiontime - poweradjust ) ) { if ( player->flags & FL_BPV ) { shapenum = powerpics + 6; } else if ( player->flags & FL_GASMASK ) { shapenum = powerpics + 5; } else if ( player->flags & FL_AV ) { shapenum = powerpics + 7; } protectiontime = time; shape = ( pic_t * )W_CacheLumpNum( shapenum, PU_CACHE, Cvt_pic_t, 1 ); GM_MemToScreen( ( byte * )&eraseb->data, eraseb->width, eraseb->height, POWERUP2X, POWERUPY ); DrawMPPic( POWERUP2X, POWERUPY + protectionheight, shape->width, shape->height - protectionheight, protectionheight, ( byte * )&shape->data, false ); } } } //****************************************************************************** // // Drawpic () // // Purpose // Draws a masked, planer pic at xpos, ypos. // // Parms // xpos - x position. // ypos - y position. // width - width of pic : should be << 2. // height - height of pic. // src - data to draw. // // Returns // Nothing. // //****************************************************************************** void Drawpic (int xpos, int ypos, int width, int height, byte *src) { byte *olddest; byte *dest; int x; int y; int planes; byte pixel; olddest = (byte *)(bufferofs + ylookup[ypos] + xpos); for (planes = 0; planes < 4; planes++) { dest = olddest; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { pixel = *src++; if (pixel != 255) *(dest) = pixel; dest += 4; } dest += (linewidth-width*4); } } } //****************************************************************************** // // DrawEpisodeLevel () // // right justifies and pads with blanks // //****************************************************************************** void DrawEpisodeLevel (int x, int y) { int level; char str[20]; pic_t *p; if (!BATTLEMODE) { ltoa (gamestate.episode, str, 10); //bna-- Drawpic (x+29, y+16, 8>>2, 16, (byte *)&timenums[str[0]-'0']->data); VL_MemToScreenClipped ((byte *)&timenums[str[0]-'0']->data, 8>>2, 16, x+29, y+16); if ((gamestate.mapon == 6) || (gamestate.mapon == 14) || (gamestate.mapon == 22) || (gamestate.mapon == 32) || (gamestate.mapon == 33)) { p = (pic_t *) W_CacheLumpName ("tnumb", PU_CACHE, Cvt_pic_t, 1); //Drawpic (x+40, y+16, 8>>2, 16, (byte *)&p->data); VL_MemToScreenClipped ((byte *)&p->data, 8>>2, 16, x+40, y+16); if (gamestate.mapon == 6) level = 1; else if (gamestate.mapon == 14) level = 2; else if (gamestate.mapon == 22) level = 3; else if (gamestate.mapon == 32) level = 4; else level = 5; } else level = GetLevel (gamestate.episode, gamestate.mapon); level = abs(level); ltoa (level, str, 10); if (level < 10){ //Drawpic (x+49, y+16, 8>>2, 16, (byte *)&timenums[str[0]-'0']->data); VL_MemToScreenClipped ((byte *)&timenums[str[0]-'0']->data, 8>>2, 16, x+49, y+16); }else{ //Drawpic (x+49, y+16, 8>>2, 16, (byte *)&timenums[str[0]-'0']->data); VL_MemToScreenClipped ((byte *)&timenums[str[0]-'0']->data, 8>>2, 16, x+49, y+16); //Drawpic (x+57, y+16, 8>>2, 16, (byte *)&timenums[str[1]-'0']->data); VL_MemToScreenClipped ((byte *)&timenums[str[1]-'0']->data, 8>>2, 16, x+57, y+16); } } else { p = (pic_t *) W_CacheLumpName ("battp", PU_CACHE, Cvt_pic_t, 1); //Drawpic (x+16, y+15, 32>>2, 16, (byte *)&p->data); VL_MemToScreenClipped ((byte *)&p->data, 32>>2, 16, x+16, y+15); level = abs(gamestate.mapon + 1); ltoa (level, str, 10); if (level < 10){ //Drawpic (x+49, y+16, 8>>2, 16, (byte *)&timenums[str[0]-'0']->data); VL_MemToScreenClipped ((byte *)&timenums[str[0]-'0']->data, 8>>2, 16, x+49, y+16); }else { //Drawpic (x+49, y+16, 8>>2, 16, (byte *)&timenums[str[0]-'0']->data); VL_MemToScreenClipped ((byte *)&timenums[str[0]-'0']->data, 8>>2, 16, x+49, y+16); //Drawpic (x+57, y+16, 8>>2, 16, (byte *)&timenums[str[1]-'0']->data); VL_MemToScreenClipped ((byte *)&timenums[str[1]-'0']->data, 8>>2, 16, x+57, y+16); } } } //****************************************************************************** // // GM_MemToScreen () // //****************************************************************************** void GM_MemToScreen (byte *source, int width, int height, int x, int y) { int dest; byte *dest1, *dest2, *dest3; byte *screen1, *screen2, *screen3; int plane; dest = ylookup[y]+x; dest1 = (byte *)(dest+page1start); dest2 = (byte *)(dest+page2start); dest3 = (byte *)(dest+page3start); for (plane = 0; plane<4; plane++) { screen1 = dest1; screen2 = dest2; screen3 = dest3; for (y = 0; y < height; y++, screen1 += linewidth, screen2 += linewidth, screen3 += linewidth, source+=width) { for (x = 0; x < width; x++) { screen1[x*4+plane] = source[x]; screen2[x*4+plane] = source[x]; screen3[x*4+plane] = source[x]; } } } } //========================================================================== /* ================== = = ScreenShake = ================== */ void ScreenShake (void) { static int which = 0; // SetTextMode ( ); if (SHAKETICS != 0xFFFF) { SHAKETICS -= tics; if (SHAKETICS >= 0xFF00){SHAKETICS = 0xFFFF;}//bna safety val check which = (RandomNumber ("ScreenShake",0) & 3); switch (which) { case 0: displayofs += 1; MoveScreenUpLeft();//SetTextMode ( ); DrawPlayScreen(true);//repaint ammo and life stat break; case 1: displayofs -= 1; MoveScreenUpRight(); DrawPlayScreen(true);//repaint ammo and life stat break; case 2: displayofs += 3*iGLOBAL_SCREENBWIDE; MoveScreenDownLeft(); DrawPlayScreen(true);//repaint ammo and life stat break; case 3: displayofs -= 3*iGLOBAL_SCREENBWIDE; MoveScreenDownRight(); DrawPlayScreen(true);//repaint ammo and life stat break; } } } //****************************************************************************** // // DoBorderShifts () // //****************************************************************************** void DoBorderShifts (void) { if (damagecount) { if (damagecount > 100) damagecount = 100; damagecount -= 6; if (damagecount < 0) damagecount = 0; SetBorderColor (*(colormap+(((100-damagecount)>>2)<<8)+48)); borderset = true; } else if (borderset) { SetBorderColor (0); borderset = false; } } //****************************************************************************** // // DrawHighScores () // //****************************************************************************** void DrawHighScores (void) { char buffer[16]; #if (SHAREWARE == 0) char buffer1[5]; #endif int i, w, h; HighScore *s; for (i = 0, s = Scores; i < MaxScores; i++, s++) { PrintY = 25 + (16 * i); // // name // PrintX = 3*8; DrawMenuBufPropString (PrintX, PrintY, s->name); // // level // ultoa (s->completed, buffer, 10); PrintX = (17 * 8)-10; #if (SHAREWARE == 0) itoa (s->episode, buffer1, 10); DrawMenuBufPropString (PrintX, PrintY, buffer1); #else DrawMenuBufPropString (PrintX, PrintY, "S"); #endif DrawMenuBufPropString (PrintX, PrintY, "-"); #if (SHAREWARE == 0) if (s->completed == 7) DrawMenuBufPropString (PrintX, PrintY, "B"); else if (s->completed == 8) DrawMenuBufPropString (PrintX, PrintY, "S"); else if (s->completed == 9) DrawMenuBufPropString (PrintX, PrintY, "C"); else if (s->completed == 10) DrawMenuBufPropString (PrintX, PrintY, "D"); else DrawMenuBufPropString (PrintX, PrintY, buffer); #else DrawMenuBufPropString (PrintX, PrintY, buffer); #endif // // score // ultoa(s->score,buffer,10); VW_MeasurePropString (buffer, &w, &h); PrintX = (33 * 8) - w; DrawMenuBufPropString (PrintX, PrintY, buffer); } } //****************************************************************************** // // CheckHighScore () // //****************************************************************************** void CheckHighScore (long score, word other, boolean INMENU) { word i,j; int n; HighScore myscore; int level; MenuFadeIn(); if (!INMENU) SetupMenuBuf (); strcpy (myscore.name,""); myscore.score = score; level = GetLevel (gamestate.episode, other-1); myscore.episode = gamestate.episode; myscore.completed = level; CurrentFont = smallfont; for (i = 0, n = -1; i < MaxScores; i++) { if ((myscore.score > Scores[i].score) || ((myscore.score == Scores[i].score) && (myscore.completed > Scores[i].completed))) { for (j = MaxScores; --j > i;) Scores[j] = Scores[j - 1]; Scores[i] = myscore; n = i; break; } } if (INMENU) { SetAlternateMenuBuf(); SetMenuTitle ("High Scores"); ClearMenuBuf(); DrawHighScores (); if (n != -1) DisplayInfo (6); else DisplayInfo (5); FlipMenuBuf (); } else { ClearMenuBuf (); SetMenuTitle ("High Scores"); DrawHighScores (); if (n != -1) DisplayInfo (6); else DisplayInfo (5); RefreshMenuBuf (0); } if (n != -1) { PrintY = 25 + (16 * n); PrintX = 3*8; US_LineInput (PrintX, PrintY, Scores[n].name, NULL, true, 10, 98, 0); } else { IN_ClearKeysDown (); if ( INMENU ) { while( !IN_CheckAck () ) { RefreshMenuBuf (0); } } else { for( i = 0; i <= 150; i += tics ) { RefreshMenuBuf (0); if (IN_CheckAck ()) { break; } } } } if (INMENU) { SD_Play (SD_ESCPRESSEDSND); } else { ShutdownMenuBuf (); } } //=========================================================================== //#define HEADERX 140 //#define BONERNAMEX 170 #define HEADERX 152 #define BONERNAMEX 166 /* ================== = = DrawEOLHeader () = ================== */ void DrawEOLHeader ( int playstate ) { int health; char tempstr[ 15 ]; char *string; int level; int w; int h; VWB_TBar( 30, 5, 250, 75 ); switch( playstate ) { case ex_skiplevel : if ( ( gamestate.violence >= vl_high ) && ( gamestate.difficulty >= gd_hard ) ) { string = "LEVEL WUSSED OUT ON!"; } else { string = "LEVEL SKIPPED."; } break; case ex_secretdone : string = "SECRET LEVEL COMPLETED!"; break; case ex_secretlevel : string = "SECRET EXIT TAKEN!"; break; case ex_gameover : string = "GAME COMPLETED!"; break; case ex_bossdied : string = "BOSS DEFEATED!"; break; default : string = "LEVEL COMPLETED!"; break; } VW_MeasurePropString( string, &w, &h ); px = ( 320 - w ) / 2; py = 10; VWB_DrawPropString( string ); // draw episode number string = "EPISODE"; VW_MeasurePropString( string, &w, &h ); px = HEADERX - w; py = 25; VWB_DrawPropString( string ); itoa( gamestate.episode, tempstr, 10 ); px = BONERNAMEX; VWB_DrawPropString( tempstr ); // draw area number level = GetLevel( gamestate.episode, gamestate.mapon ); itoa( level, tempstr, 10 ); py = 35; if ( playstate == ex_secretdone ) { string = "SECRET AREA"; } else if ( playstate == ex_bossdied ) { string = "BOSS AREA"; } else if ( gamestate.mapon == 32 ) { string = "CHASE AREA"; } else { string = "AREA"; } VW_MeasurePropString( string, &w, &h); px = HEADERX - w; VWB_DrawPropString( string ); if ( gamestate.mapon != 33 ) { px = BONERNAMEX; VWB_DrawPropString( tempstr ); } string = "SCORE"; VW_MeasurePropString( string, &w, &h); px = HEADERX - w; py = 45; VWB_DrawPropString( string ); px = BONERNAMEX; itoa( gamestate.score, tempstr, 10 ); VWB_DrawPropString( tempstr ); string = "HEALTH"; VW_MeasurePropString( string, &w, &h ); px = HEADERX - w; py = 55; VWB_DrawPropString( string ); px = BONERNAMEX; health = ( ( locplayerstate->health * 100 ) / MaxHitpointsForCharacter( locplayerstate ) ); itoa( health, tempstr, 10 ); VWB_DrawPropString( tempstr ); VWB_DrawPropString( "%" ); // // Secret count // { char str1[10]; char str2[10]; itoa(gamestate.secretcount,&(str1[0]),10); strcat(str1," / "); itoa(gamestate.secrettotal,&(str2[0]),10); strcat(str1,str2); string = "SECRET WALLS"; VW_MeasurePropString( string, &w, &h ); px = HEADERX - w; py = 65; VWB_DrawPropString( string ); px = BONERNAMEX; VWB_DrawPropString( str1 ); } VW_UpdateScreen (); } boolean EndBonusFirst; boolean EndBonusSkip; int EndBonusNumBonuses; int EndBonusVoice; int EndBonusStartY; void DrawEndBonus ( char *string, char *bonusstring, int type ) { int w; int h; int health; char tempstr[ 15 ]; if ( EndBonusFirst ) { VWB_TBar( 5, EndBonusStartY - 2, 310, 4 ); EndBonusFirst = false; } VWB_TBar( 5, EndBonusStartY + 2, 310, 10 ); VW_MeasurePropString( string, &w, &h ); py = EndBonusStartY; if ( bonusstring == NULL ) { px = ( 320 - w ) / 2; VWB_DrawPropString( string ); } else { px = BONERNAMEX - w; VWB_DrawPropString( string ); EndBonusNumBonuses++; VW_MeasurePropString( bonusstring, &w, &h ); px = 310 - w; py = EndBonusStartY; VWB_DrawPropString( bonusstring ); } // Update Score py = 45; px = BONERNAMEX; V_ReDrawBkgnd( px, py, 107, 11, false ); VWB_TBar( px, py, 107, 11 ); itoa( gamestate.score, tempstr, 10 ); VWB_DrawPropString( tempstr ); // Update Health py = 55; px = BONERNAMEX; V_ReDrawBkgnd( px, py, 107, 11, false ); VWB_TBar( px, py, 107, 11 ); health = ( ( locplayerstate->health * 100 ) / MaxHitpointsForCharacter( locplayerstate ) ); itoa( health, tempstr, 10 ); VWB_DrawPropString( tempstr ); VWB_DrawPropString( "%" ); switch( type ) { case 0 : EndBonusVoice = SD_Play( SD_ENDBONUS1SND ); break; case 1 : EndBonusVoice = SD_Play( SD_NOBONUSSND ); break; case 2 : VL_FillPalette(255,255,255); //bna--VW_UpdateScreen(); VL_FadeIn(0,255,origpal,10); EndBonusVoice = SD_Play( SD_LIGHTNINGSND ); break; } EndBonusStartY += 10; //bna--VW_UpdateScreen(); while( SD_SoundActive( EndBonusVoice ) && !EndBonusSkip ) { if ( IN_CheckAck() ) { EndBonusSkip = true; } } } /* ================== = = LevelCompleted = = Exit with the screen faded out = ================== */ extern int OLDLMWEAPON; extern int OLDLWEAPON; void LevelCompleted ( exit_t playstate ) { objtype *obj; boolean dobonus; int i; int kr; int sr; int tr; int missileratio; int superratio; int healthratio; int democraticratio; int plantratio; int cnt; pic_t *tmpPic; // byte *picbuf; EndBonusNumBonuses = 0; EndBonusFirst = true; EndBonusSkip = false; EndBonusStartY = 90; EnableScreenStretch(); tmpPic = ( pic_t * )W_CacheLumpName( "mmbk", PU_CACHE, Cvt_pic_t, 1 ); VWB_DrawPic( 0, 0, tmpPic ); VW_UpdateScreen(); // DisableScreenStretch(); IN_StartAck(); EndBonusVoice = 0; if ( playstate != ex_bossdied ) { EndBonusVoice = SD_Play( SD_LEVELDONESND ); VL_FillPalette( 255, 255, 255 ); VL_FadeIn( 0, 255, origpal, 10 ); if ( player->flags & FL_DOGMODE ) { MU_StartSong( song_dogend ); } else { MU_StartSong( song_endlevel ); } } BkPic = ( pic_t * )W_CacheLumpName( "mmbk", PU_CACHE, Cvt_pic_t, 1 ); VWB_DrawPic( 0, 0, BkPic ); CheckHolidays(); CurrentFont = smallfont; // Kill powerups if ( player->flags & FL_ELASTO ) { player->flags &= ~FL_NOFRICTION; } player->flags &= ~( FL_FLEET | FL_SHROOMS | FL_ELASTO | FL_GODMODE | FL_DOGMODE | FL_BPV | FL_AV | FL_GASMASK ); // Turn off quickload for next level pickquick = false; // // FIGURE RATIOS OUT BEFOREHAND // kr = 0; tr = 0; tr = 0; superratio = 0; missileratio = 0; healthratio = 0; democraticratio = 0; plantratio = 0; if ( gamestate.killtotal ) { kr = ( int )( ( ( int )gamestate.killcount ) * 100 ) / ( ( int )gamestate.killtotal ); } if ( gamestate.secrettotal ) { sr = ( int )( ( ( int )gamestate.secretcount ) * 100 ) / ( ( int )gamestate.secrettotal ); } if ( gamestate.treasuretotal ) { tr = ( int )( ( ( int )gamestate.treasurecount ) * 100 ) / ( ( int )gamestate.treasuretotal ); } if ( gamestate.supertotal ) { superratio = ( int )( ( ( int )gamestate.supercount ) * 100 ) / ( ( int )gamestate.supertotal ); } if ( gamestate.missiletotal ) { missileratio = ( int )( ( ( int )gamestate.missilecount ) * 100 ) / ( ( int )gamestate.missiletotal ); } if ( gamestate.healthtotal ) { healthratio = ( int )( ( ( int )gamestate.healthcount ) * 100 ) / ( ( int )gamestate.healthtotal ); } if ( gamestate.democratictotal ) { democraticratio = ( int )( ( ( int )gamestate.democraticcount ) * 100 ) / ( ( int )gamestate.democratictotal ); } if ( gamestate.planttotal ) { plantratio = ( int )( ( ( int )gamestate.plantcount ) * 100 ) / ( ( int )gamestate.planttotal ); } DrawEOLHeader( playstate ); /* //bna section store picture because its written on again // store screen first picbuf = (byte *)SafeMalloc (64000); memcpy(picbuf ,bufferofs ,64000); EnableScreenStretch(); VW_UpdateScreen();//tmpPICbuf is destroyed here DisableScreenStretch(); //copy it back memcpy(bufferofs ,picbuf , 64000); //bna section end */ EndBonusSkip = true; while( SD_SoundActive( EndBonusVoice ) && !EndBonusSkip ) { //bna--VW_UpdateScreen(); if ( IN_CheckAck() ) { EndBonusSkip = true; } } // tmpPic = ( pic_t * )W_CacheLumpName( "mmbk", PU_CACHE, Cvt_pic_t, 1 ); // VWB_DrawPic( 0, 0, tmpPic ); if ( GetNextMap(player->tilex,player->tiley) == -1) { if ( gamestate.dipballs == 3 ) { gamestate.score += 100000; DrawEndBonus( "DIP BONUS", "100000 POINTS", 0 ); EndBonusStartY += 10; } if ( locplayerstate->lives > 0 ) { char str[20]; char str2[60]; DrawEndBonus( "EXTRA LIVES BONUS", "\0", 0 ); itoa(locplayerstate->lives,str,10); strcpy(str2,str); strcat(str2," EXTRA LIVES ="); DrawEndBonus( "\0", str2, 0 ); itoa(locplayerstate->lives,str,10); strcpy(str2,str); strcat(str2," X 10000 = "); itoa(locplayerstate->lives*10000,str,10); strcat(str2,str); strcat(str2," POINTS"); gamestate.score += 10000*locplayerstate->lives; DrawEndBonus( "\0", str2, 0 ); } } else { // // Check for SKIN OF YO TEETH // if ( locplayerstate->health <= 10 ) { locplayerstate->health = MaxHitpointsForCharacter( locplayerstate ); DrawEndBonus( "SKIN OF YOUR TEETH", "100% HEALTH", 0 ); } // BULL IN CHINA SHOP BONUS if ( tr == 100 ) { gamestate.score += 10000; DrawEndBonus( "BULL IN CHINA SHOP", "10000 POINTS", 0 ); } // SUPERCHARE BONUS if ( superratio == 100 ) { gamestate.score += 10000; DrawEndBonus( "SUPERCHARGE BONUS", "10000 POINTS", 0 ); } // BLEEDER BONUS if ( healthratio == 100 ) { gamestate.score += 10000; DrawEndBonus( "BLEEDER BONUS", "10000 POINTS", 0 ); } // ADRENALINE BONUS if ( kr == 100 ) { gamestate.score += 10000; DrawEndBonus( "ADRENALINE BONUS", "10000 POINTS", 0 ); } // CURIOSITY BONUS dobonus = true; // // Check switches cnt = lastswitch - &switches[ 0 ]; if ( cnt != 0 ) { for ( i = 0; i < cnt; i++ ) { if ( ( switches[ i ].flags & FL_S_FLIPPED ) == 0 ) { dobonus = false; break; } } } // // Check pillars for ( obj = FIRSTACTOR; obj != NULL; obj = obj->next ) { if ( ( obj->obclass == pillarobj ) && ( ( obj->flags & FL_FLIPPED ) == 0 ) ) { dobonus = false; } } if ( ( gamestate.secrettotal ) && ( sr != 100 ) ) { dobonus = false; } if ( dobonus ) { gamestate.score += 10000; DrawEndBonus( "CURIOSITY BONUS", "10000 POINTS", 0 ); } // GROUND ZERO BONUS if ( gamestate.DOGROUNDZEROBONUS ) { gamestate.score += 10000; DrawEndBonus( "GROUND ZERO BONUS", "10000 POINTS", 0 ); } // REPUBLICAN BONUS 1 if ( missileratio == 100 ) { gamestate.score += 5000; DrawEndBonus( "REPUBLICAN BONUS 1", " 5000 POINTS", 0 ); } // REPUBLICAN BONUS 2 if (plantratio == 100) { gamestate.score += 5000; DrawEndBonus( "REPUBLICAN BONUS 2", " 5000 POINTS", 0 ); } // DEMOCRATIC BONUS 1 if ( gamestate.DODEMOCRATICBONUS1 ) { gamestate.score += 5000; DrawEndBonus( "DEMOCRATIC BONUS 1", " 5000 POINTS", 0 ); } // DEMOCRATIC BONUS 2 if (democraticratio == 100) { gamestate.score += 5000; DrawEndBonus( "DEMOCRATIC BONUS 2", " 5000 POINTS", 0 ); } } if ( EndBonusNumBonuses == 0 ) { DrawEndBonus( "NO BONUS!", NULL, 1 ); } if ( ( EndBonusNumBonuses != 0 ) || ( playstate == ex_gameover ) ) { SD_Play( PlayerSnds[ locplayerstate->player ] ); // DO BONUS BONUS if ( EndBonusNumBonuses == NUMBONUSES ) { IN_StartAck(); while( !IN_CheckAck() ) { ; } BkPic = ( pic_t * )W_CacheLumpName( "mmbk", PU_CACHE, Cvt_pic_t, 1 ); VWB_DrawPic( 0, 0, BkPic ); gamestate.score += BONUSBONUS; DrawEOLHeader( playstate ); EndBonusFirst = true; EndBonusStartY = 110; EndBonusSkip = true; DrawEndBonus( "BONUS BONUS! 1,000,000 POINTS!", NULL, 2 ); } else if ( ( kr == 100 ) && ( dobonus ) ) { IN_StartAck(); while( !IN_CheckAck() ) { ; } BkPic = ( pic_t * )W_CacheLumpName( "mmbk", PU_CACHE, Cvt_pic_t, 1 ); VWB_DrawPic( 0, 0, BkPic ); DrawEOLHeader( playstate ); EndBonusFirst = true; EndBonusStartY = 110; DrawEndBonus( "You have done well.", NULL, 3 ); #if (SHAREWARE==1) EndBonusVoice = SD_Play( SD_RICOCHET3SND ); #else EndBonusVoice = SD_Play( SD_PERCENT100SND ); #endif EndBonusSkip = false; DrawEndBonus( "This level is toast.", NULL, 3 ); } } //bna section // EnableScreenStretch();//bna++ VW_UpdateScreen();//bna++ // DisableScreenStretch();//bna++ //bna section end IN_StartAck(); while( !IN_CheckAck() ) { ; } EndLevelStuff = false; CurrentFont = smallfont; } void DrawTallyHeader ( int which ) { pic_t *Name; pic_t *KillCount; pic_t *TimesYouKilledPerson; pic_t *TimesPersonKilledYou; pic_t *Suicides; pic_t *Score; pic_t *Blank; pic_t *TopBar; Name = ( pic_t * )W_CacheLumpName( "t_name", PU_CACHE, Cvt_pic_t, 1 ); Blank = ( pic_t * )W_CacheLumpName( "t_blnk", PU_CACHE, Cvt_pic_t, 1 ); KillCount = ( pic_t * )W_CacheLumpName( "t_kcount", PU_CACHE, Cvt_pic_t, 1 ); TimesYouKilledPerson = ( pic_t * )W_CacheLumpName( "t_kilper", PU_CACHE, Cvt_pic_t, 1 ); TimesPersonKilledYou = ( pic_t * )W_CacheLumpName( "t_perkil" , PU_CACHE, Cvt_pic_t, 1 ); Suicides = ( pic_t * )W_CacheLumpName( "t_suicid", PU_CACHE, Cvt_pic_t, 1 ); Score = ( pic_t * )W_CacheLumpName( "t_score", PU_CACHE, Cvt_pic_t, 1 ); TopBar = ( pic_t * )W_CacheLumpName( "t_bar", PU_CACHE, Cvt_pic_t, 1 ); IFont = ( cfont_t * )W_CacheLumpName( "sifont", PU_CACHE, Cvt_cfont_t, 1 ); switch( which ) { case 0 : VWB_DrawPic ( 8, 8, TopBar ); DrawIntensityString( 12, 11, "FINAL SCORE", 20 ); VWB_DrawPic ( 8, 24, Name ); VWB_DrawPic ( 136, 24, KillCount ); VWB_DrawPic ( 184, 24, Suicides ); VWB_DrawPic ( 272, 24, Score ); break; case 1 : VWB_DrawPic ( 8, 8, TopBar ); DrawIntensityString( 12, 11, "FINAL SCORE", 20 ); VWB_DrawPic ( 8, 24, Name ); VWB_DrawPic ( 136, 24, Blank ); VWB_DrawPic ( 272, 24, Score ); break; case 2 : VWB_DrawPic ( 8, 8, TopBar ); DrawIntensityString( 12, 11, "YOUR KILLS", 20 ); VWB_DrawPic ( 8, 24, Name ); VWB_DrawPic ( 136, 24, KillCount ); VWB_DrawPic ( 184, 24, TimesYouKilledPerson ); break; case 3 : VWB_DrawPic ( 8, 8, TopBar ); DrawIntensityString( 12, 11, "YOUR DEATHS", 20 ); VWB_DrawPic ( 8, 24, Name ); VWB_DrawPic ( 136, 24, TimesPersonKilledYou ); break; //bna added case 4 : VWB_DrawPic ( 198+48, 8, Blank ); VWB_DrawPic ( 8, 8, TopBar ); DrawIntensityString( 12, 11, "FINAL SCORE", 20 ); VWB_DrawPic ( 8, 24, TopBar );//used to blank VWB_DrawPic ( 8, 24, Name ); VWB_DrawPic ( 136, 24, KillCount); VWB_DrawPic ( 198, 24, TimesPersonKilledYou); VWB_DrawPic ( 198+48, 24, Blank ); VWB_DrawPic ( 272, 24, Score ); break; //bna added end } DrawTimeXY( TALLYTIME_X, TALLYTIME_Y, gamestate.TimeCount / VBLCOUNTER, true ); } #define BT_RANK_X 23 #define BT_PLAYER_X 30 #define BT_KILLS_X ( 139 + ( ( 40 + 20 ) / 2 ) ) #define BT_DEATHS_X ( 193 + ( ( 56 + 20 ) / 2 ) ) //#define BT_SCORE_X ( 263 + ( ( 46 + 20 ) / 2 ) ) #define BT_SCORE_X ( 273 + ( ( 46 + 20 ) / 2 ) ) void ShowKills( int localplayer ) { int w; int h; int i; int j; int temp; int rank; int player; int killer; int victim; int color; char tempstr[15]; int KillCount[ MAXPLAYERS ]; int Order[ MAXPLAYERS ]; int NumPlayers; // show at the most 11 players NumPlayers = min( numplayers, 11 ); // Count kills for( killer = 0; killer < NumPlayers; killer++ ) { Order[ killer ] = killer; KillCount[ killer ] = 0; for( victim = 0; victim < NumPlayers; victim++ ) { if ( BATTLE_Team[ victim ] != BATTLE_Team[ killer ] ) { KillCount[ killer ] += WhoKilledWho[ killer ][ victim ]; } } } for( i = 0; i < NumPlayers - 1; i++ ) { for( j = i + 1; j < NumPlayers; j++ ) { if ( KillCount[ Order[ i ] ] < KillCount[ Order[ j ] ] ) { temp = Order[ i ]; Order[ i ] = Order[ j ]; Order[ j ] = temp; } } } DrawTallyHeader( 2 ); IFont = (cfont_t * )W_CacheLumpNum (W_GetNumForName ("sifont"), PU_CACHE, Cvt_cfont_t, 1); CurrentFont = smallfont; py = 43; for( rank = 0; rank < NumPlayers; rank++ ) { player = Order[ rank ]; color = 21; // Highlight the your score if ( player == localplayer ) { // Change to Intensity color = 241; } // Draw rank if not tied with previous rank if ( ( rank == 0 ) || ( KillCount[ player ] != KillCount[ Order[ rank - 1 ] ] ) ) { itoa( rank + 1, tempstr, 10 ); } else { strcpy( tempstr, "Tie" ); } VW_MeasureIntensityPropString ( tempstr, &w, &h); DrawIntensityString( BT_RANK_X - w, py, tempstr, color ); // Draw name DrawIntensityString( BT_PLAYER_X, py, PLAYERSTATE[ player ].codename, color ); // Draw kills itoa( KillCount[ player ], tempstr, 10 ); VW_MeasureIntensityPropString ( tempstr, &w, &h); DrawIntensityString( BT_KILLS_X - w, py, tempstr, color ); // Draw times you killed that person if ( player != localplayer ) { itoa( WhoKilledWho[ localplayer ][ player ], tempstr, 10 ); } else { strcpy( tempstr, "-" ); } VW_MeasureIntensityPropString ( tempstr, &w, &h); DrawIntensityString( BT_DEATHS_X - w, py, tempstr, color ); if ( gamestate.teamplay ) { DrawIntensityString( BT_DEATHS_X + 16, py, colorname[ PLAYERSTATE[ player ].uniformcolor ], color ); } py += h; } } void ShowDeaths( int localplayer ) { int w; int h; int i; int j; int temp; int rank; int player; int killer; int victim; int color; char tempstr[15]; int DeathCount[ MAXPLAYERS ]; int Order[ MAXPLAYERS ]; int NumPlayers; // show at the most 11 players NumPlayers = min( numplayers, 11 ); // Count Deaths for( victim = 0; victim < NumPlayers; victim++ ) { Order[ victim ] = victim; DeathCount[ victim ] = 0; for( killer = 0; killer < NumPlayers; killer++ ) { DeathCount[ victim ] += WhoKilledWho[ killer ][ victim ]; } } for( i = 0; i < NumPlayers - 1; i++ ) { for( j = i + 1; j < NumPlayers; j++ ) { if ( DeathCount[ Order[ i ] ] < DeathCount[ Order[ j ] ] ) { temp = Order[ i ]; Order[ i ] = Order[ j ]; Order[ j ] = temp; } } } DrawTallyHeader( 3 ); IFont = (cfont_t * )W_CacheLumpNum (W_GetNumForName ("sifont"), PU_CACHE, Cvt_cfont_t, 1); CurrentFont = smallfont; py = 43; for( rank = 0; rank < NumPlayers; rank++ ) { player = Order[ rank ]; color = 21; // Highlight the your score if ( player == localplayer ) { // Change to Intensity color = 241; } // Draw rank if not tied with previous rank if ( ( rank == 0 ) || ( DeathCount[ player ] != DeathCount[ Order[ rank - 1 ] ] ) ) { itoa( rank + 1, tempstr, 10 ); } else { strcpy( tempstr, "Tie" ); } VW_MeasureIntensityPropString ( tempstr, &w, &h); DrawIntensityString( BT_RANK_X - w, py, tempstr, color ); // Draw name DrawIntensityString( BT_PLAYER_X, py, PLAYERSTATE[ player ].codename, color ); // Draw deaths itoa( DeathCount[ player ], tempstr, 10 ); VW_MeasureIntensityPropString ( tempstr, &w, &h); DrawIntensityString( BT_KILLS_X - w, py, tempstr, color ); // Draw times you were killed by that person itoa( WhoKilledWho[ player ][ localplayer ], tempstr, 10 ); VW_MeasureIntensityPropString ( tempstr, &w, &h); DrawIntensityString( BT_DEATHS_X - w, py, tempstr, color ); if ( gamestate.teamplay ) { DrawIntensityString( BT_DEATHS_X + 16, py, colorname[ PLAYERSTATE[ player ].uniformcolor ], color ); } py += h; } } void ShowEndScore( int localplayer ) { int w; int h; int rank; int leader; int team; int color; int killer; int victim; int killcount; int suicidecount; char tempstr[15]; boolean dofullstats; int NumPlayers; // show at the most 11 players NumPlayers = min( numplayers, 11 ); dofullstats = false; switch( gamestate.battlemode ) { case battle_Normal : case battle_ScoreMore : case battle_Hunter : dofullstats = true; DrawTallyHeader( 0 ); break; case battle_Collector : case battle_Scavenger : case battle_Tag : case battle_Eluder : case battle_Deluder : case battle_CaptureTheTriad : dofullstats = false; DrawTallyHeader( 1 ); break; } IFont = (cfont_t * )W_CacheLumpNum (W_GetNumForName ("sifont"), PU_CACHE, Cvt_cfont_t, 1); CurrentFont = smallfont; py = 43; for( rank = 0; rank < BATTLE_NumberOfTeams; rank++ ) { team = BATTLE_PlayerOrder[ rank ]; color = 21; if ( team == BATTLE_Team[ localplayer ] ) { // Change to Intensity color = 241; } // Draw rank if not tied with previous rank if ( ( rank == 0 ) || ( BATTLE_Points[ team ] != BATTLE_Points[ BATTLE_PlayerOrder[ rank - 1 ] ] ) ) { itoa( rank + 1, tempstr, 10 ); } else { strcpy( tempstr, "Tie" ); } VW_MeasureIntensityPropString ( tempstr, &w, &h); DrawIntensityString( BT_RANK_X - w, py, tempstr, color ); // Draw name of team leader leader = BATTLE_TeamLeader[ team ]; if ( gamestate.teamplay ) { DrawIntensityString( BT_PLAYER_X, py, colorname[ PLAYERSTATE[ leader ].uniformcolor ], color ); } else { DrawIntensityString( BT_PLAYER_X, py, PLAYERSTATE[ leader ].codename, color ); } if ( dofullstats ) { // Count how many kills each person on the team got killcount = 0; suicidecount = 0; for( killer = 0; killer < NumPlayers; killer++ ) { if ( BATTLE_Team[ killer ] == team ) { for( victim = 0; victim < NumPlayers; victim++ ) { if ( BATTLE_Team[ victim ] != team ) { killcount += WhoKilledWho[ killer ][ victim ]; } else { suicidecount += WhoKilledWho[ killer ][ victim ]; } } } } // Draw kills itoa( killcount, tempstr, 10 ); VW_MeasureIntensityPropString ( tempstr, &w, &h); DrawIntensityString( BT_KILLS_X - w, py, tempstr, color ); // Draw suicides itoa( suicidecount, tempstr, 10 ); VW_MeasureIntensityPropString ( tempstr, &w, &h); DrawIntensityString( BT_DEATHS_X - w, py, tempstr, color ); } // Draw Score itoa( BATTLE_Points[ team ], tempstr, 10 ); VW_MeasureIntensityPropString ( tempstr, &w, &h); DrawIntensityString( BT_SCORE_X - w, py, tempstr, color ); py += h; } } void BattleLevelCompleted ( int localplayer ) { ControlInfo ci; int w; int h; int key; int Screen; int LastScreen; int Player; char text[80]; EnableScreenStretch(); IN_ClearKeysDown (); Player = localplayer; Screen = 1; LastScreen = 0; key = -1; while( 1 ) { if ( Screen != LastScreen ) { VL_DrawPostPic (W_GetNumForName("trilogo")); switch( Screen ) { case 1 : ShowEndScore( Player ); break; case 2 : ShowKills( Player ); break; case 3 : ShowDeaths( Player ); break; } CurrentFont = tinyfont; sprintf ( text, "Page %d of 3. Use arrows to switch stats. " "Press Esc to quit.", Screen ); VW_MeasurePropString ( text, &w, &h); py = 192; px = ( 320 - w ) / 2; VWB_DrawPropString ( text ); VW_UpdateScreen (); do { ReadAnyControl (&ci); } while( ci.dir == (Direction)key ); } LastScreen = Screen; ReadAnyControl ( &ci ); key = ci.dir; if ( ( Screen > 1 ) && ( key == dir_West ) ) { Screen--; MN_PlayMenuSnd (SD_MOVECURSORSND); } else if ( ( Screen < 3 ) && ( key == dir_East ) ) { Screen++; MN_PlayMenuSnd (SD_MOVECURSORSND); } // Allow us to select which player to view if ( Keyboard[ sc_RShift ] && ( key == dir_South ) ) { Player++; if ( Player >= numplayers ) { Player = 0; } LastScreen = 0; MN_PlayMenuSnd (SD_SELECTSND); } if ( Keyboard[ sc_RShift ] && ( key == dir_North ) ) { Player--; if ( Player < 0 ) { Player = numplayers - 1; } LastScreen = 0; MN_PlayMenuSnd (SD_SELECTSND); } if ( Keyboard[sc_Escape] ) { break; } } while ( Keyboard[sc_Escape] ) { IN_UpdateKeyboard (); } MN_PlayMenuSnd (SD_ESCPRESSEDSND); CurrentFont = smallfont; } //========================================================================== /* ================== = = FindAngleToWindow = ================== */ int FindAngleToWindow ( int tx, int ty ) { if (!IsWindow(tx+1,ty)) return ANG180; else if (!IsWindow(tx-1,ty)) return 0; else if (!IsWindow(tx,ty+1)) return ANG90; else return ANG270; } #define STARTRADIUS (0xa000) #define STOPRADIUS (0x14000) #define DEATHRADIUS (STOPRADIUS-STARTRADIUS) #define ROTRATE (5) #define TOTALDEATHROT (FINEANGLES<<1) #define RADIUSINC ((DEATHRADIUS)/(TOTALDEATHROT)) /* ================== = = ZoomDeathOkay = ================== */ boolean ZoomDeathOkay ( void ) { int x,y; int radius; if ( !( (player->state==&s_ashwait) || ((player->flags & FL_HBM) && (gamestate.violence >= vl_high)) ) ) return false; radius=STOPRADIUS; x=player->x; y=player->y; while (radius>0) { if (tilemap[x>>16][(y+radius)>>16]) return false; if (tilemap[x>>16][(y-radius)>>16]) return false; if (tilemap[(x-radius)>>16][y>>16]) return false; if (tilemap[(x+radius)>>16][y>>16]) return false; if (tilemap[(x+radius)>>16][(y+radius)>>16]) return false; if (tilemap[(x+radius)>>16][(y-radius)>>16]) return false; if (tilemap[(x-radius)>>16][(y+radius)>>16]) return false; if (tilemap[(x-radius)>>16][(y-radius)>>16]) return false; radius-=0x10000; } return true; } /* ================== = = Died = ================== */ #define DEATHROTATE 6 extern boolean dopefish; void Died (void) { long dx,dy; int iangle,curangle,clockwise,change; int da; int rate; lbm_t *LBM; int slowrate; playertype *pstate; objtype * killerobj=(objtype *)player->target; player->yzangle=0; if (killerobj == NULL) killerobj = player; if (CheckParm("slowdeath")) slowrate=3; else slowrate=0; M_LINKSTATE (player, pstate); if ( (ZoomDeathOkay()==true) && (pstate->falling==false)) { int x,y,z,radius,heightoffset; int endangle,startangle,killangle; boolean deadflagset; objtype * dummy; x=player->x; y=player->y; z=player->z; dummy=player; SpawnPlayerobj (x>>16, y>>16, 0, 0); player=dummy; dummy=new; dummy->x=x; dummy->drawx=x; dummy->y=y; dummy->z=z; dummy->drawy=y; dummy->flags=player->flags; player->momentumx=0; player->momentumy=0; player->speed=0; radius=STARTRADIUS; heightoffset=pstate->heightoffset; deadflagset=false; startangle=(player->angle+ANG180)&(FINEANGLES-1); endangle=startangle+TOTALDEATHROT; killangle=startangle+(TOTALDEATHROT>>1); if (dopefish==true) { AddMessage("Dopefish Death Cam",MSG_SYSTEM); } for (iangle=startangle;;) { if ( iangle > killangle ) { if ( deadflagset==false ) { dummy->hitpoints=0; pstate->health=0; dummy->flags &= ~FL_DYING; dummy->flags |= FL_SHOOTABLE; if (player->state==&s_ashwait) dummy->flags |= FL_SKELETON; Collision(dummy,(objtype*)NULL,0,0); deadflagset=true; if ( ( killerobj==player ) && ( gamestate.violence >= vl_high ) && ( gamestate.difficulty >= gd_hard ) ) { SD_Play( SD_YOUSUCKSND ); } else { SD_Play (SD_PLAYERTCDEATHSND+(pstate->player)); } } } else { dummy->flags &= ~FL_DYING; } if (dopefish==true) { dummy->momentumx+=(RandomNumber("Died",0)<<6)-(256<<5); dummy->momentumy+=(RandomNumber("Died",0)<<6)-(256<<5); } player->x=x+FixedMul(radius,costable[iangle&(FINEANGLES-1)]); player->y=y-FixedMul(radius,sintable[iangle&(FINEANGLES-1)]); player->z=dummy->z; player->angle=(iangle+ANG180)&(FINEANGLES-1); if (dopefish==true) { int dx,dy; dx = dummy->x - player->x; dy = player->y - dummy->y; if (dx && dy) player->angle = atan2_appx (dx,dy); } pstate->heightoffset=heightoffset; player->yzangle=0; UpdateGameObjects(); player->momentumx=0; player->momentumy=0; player->speed=0; ThreeDRefresh (); AnimateWalls(); DoSprites(); DoAnimatedMaskedWalls(); UpdatePlayers(); UpdateLightLevel(player->areanumber); if (ianglestate==dummy->state->next) && (iangle>=endangle) ) break; } } else if (pstate->falling==false) { // // swing around to face attacker // rate=DEATHROTATE-slowrate; { if (killerobj==player) { iangle=player->angle; if ( ( gamestate.violence >= vl_high ) && ( gamestate.difficulty >= gd_hard ) ) { SD_Play( SD_YOUSUCKSND ); } } else { SD_Play (SD_PLAYERTCDEATHSND+(pstate->player)); if (killerobj->which==PWALL) { dx = ((pwallobj_t *)killerobj)->x - player->x; dy = player->y - ((pwallobj_t *)killerobj)->y; } else { dx = killerobj->x - player->x; dy = player->y - killerobj->y; } iangle = atan2_appx (dx,dy); // returns -pi to pi } } da = iangle-player->angle; if (da>0) clockwise=1; else clockwise=0; da=abs(da); if (da>ANG180) { clockwise^=1; da=ANGLES-da; } curangle = player->angle; do { DoBorderShifts (); change = tics<= ANGLES) curangle -= ANGLES; if (curangle < 0) curangle += ANGLES; player->angle = (curangle & (FINEANGLES-1)); ThreeDRefresh (); CalcTics (); } while (da>0); } else { DrawFullSky(); FlipPage(); } while (damagecount) DoBorderShifts (); DoBorderShifts (); locplayerstate->weapon = -1; // take away weapon if ( (tedlevel == false) && // SO'S YA DON'T GET KILLED WHILE LAUNCHING! (timelimitenabled == false) ) locplayerstate->lives--; if (pstate->falling==false) { ThreeDRefresh (); } FlipPage(); FlipPage(); if (locplayerstate->lives > -1) { int rng; rng = RandomNumber ("Died",0); if (pstate->falling==true) { RotateBuffer (0, 0, (FINEANGLES), (FINEANGLES>>6), (VBLCOUNTER*(1+slowrate))); SD_Play (SD_PLAYERTCDEATHSND+(pstate->player)); pstate->falling=false; } else if (rng < 64) RotateBuffer (0, 0, (FINEANGLES), (FINEANGLES*64), (VBLCOUNTER*(2+slowrate))); else if (rng < 128) { RotateBuffer (0, 0, (FINEANGLES), (FINEANGLES>>6), (VBLCOUNTER*(1+slowrate))); } else if (rng < 192) RotateBuffer(0, (FINEANGLES*4), (FINEANGLES), (FINEANGLES*64), (VBLCOUNTER*(3+slowrate))); else VL_FadeToColor (VBLCOUNTER*2, 100, 0, 0); screenfaded=false; VL_FadeOut (0, 255, 0,0,0,VBLCOUNTER>>1); gamestate.episode = 1; player->flags &= ~FL_DONE; InitializeWeapons (locplayerstate); ResetPlayerstate(locplayerstate); UpdateLives (locplayerstate->lives); UpdateScore (gamestate.score); DrawTriads(true); DrawLives (true); DrawKeys (true); DrawScore (true); } else { int rng; SD_Play (SD_GAMEOVERSND); rng=RandomNumber("Died",0); if (rng<64) RotateBuffer(0,(FINEANGLES>>1),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate))); else if (rng<128) VL_FadeToColor (VBLCOUNTER*3, 255, 255, 255); else if (rng<192) RotateBuffer(0,(FINEANGLES*2),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate))); else RotateBuffer(0,(FINEANGLES*2),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate))); screenfaded=false; VL_FadeOut (0, 255, 0,0,0,VBLCOUNTER>>1); MU_StartSong(song_gameover); #if (SHAREWARE==0) if (gamestate.violence==vl_excessive) LBM = (lbm_t *) W_CacheLumpNum (W_GetNumForName ("bootblod"), PU_CACHE, Cvt_lbm_t, 1); else LBM = (lbm_t *) W_CacheLumpNum (W_GetNumForName ("bootnorm"), PU_CACHE, Cvt_lbm_t, 1); #else LBM = (lbm_t *) W_CacheLumpNum (W_GetNumForName ("bootblod"), PU_CACHE, Cvt_lbm_t, 1); #endif VL_DecompressLBM (LBM,true); StopWind(); IN_UserInput (VBLCOUNTER*60); MainMenu[savegame].active = 0; MainMenu[viewscores].routine = (void *)CP_ViewScores; MainMenu[viewscores].texture[6] = '7'; MainMenu[viewscores].texture[7] = '\0'; MainMenu[viewscores].letter = 'V'; } ClearGraphicsScreen(); VL_FadeIn (0, 255, origpal, 15); } //****************************************************************************** // // DoLoadGameAction () // //****************************************************************************** static byte whichstr = 0; void DoLoadGameAction (void) { if ((SaveTime+1) < GetTicCount()) { byte *temp = bufferofs; bufferofs = displayofs; SaveTime = GetTicCount(); CurrentFont=tinyfont; px = 92; py = 152; if (whichstr) { VW_DrawPropString ("."); whichstr = 0; } else { VW_DrawPropString ("."); whichstr = 1; } bufferofs = temp; } } //****************************************************************************** // // DoCheckSum () // //****************************************************************************** long DoCheckSum (byte *source, int size, long csum) { int i; long checksum; checksum = csum; for (i = 0; i < size; i++) checksum=updatecrc(checksum,*(source+i)); return checksum; } //****************************************************************************** // // CaculateSaveGameCheckSum () // //****************************************************************************** #define SAVECHECKSUMSIZE (10000) long CalculateSaveGameCheckSum (char * filename) { int handle; int lengthleft; int length; byte * altbuffer; long checksum; altbuffer=SafeMalloc(SAVECHECKSUMSIZE); checksum = 0; // Open the savegame file handle = SafeOpenRead (filename); lengthleft = filelength (handle); while (lengthleft>0) { length=SAVECHECKSUMSIZE; if (length>lengthleft) length=lengthleft; SafeRead(handle,altbuffer,length); checksum = DoCheckSum (altbuffer, length, checksum); lengthleft-=length; } SafeFree(altbuffer); close (handle); return checksum; } //****************************************************************************** // // StoreBuffer // //****************************************************************************** void StoreBuffer (int handle, byte * src, int size) { SafeWrite(handle,&size,sizeof(size)); SafeWrite(handle,src,size); } //****************************************************************************** // // SaveTag // //****************************************************************************** void SaveTag (int handle, char * tag, int size) { SafeWrite(handle,tag,size); } //****************************************************************************** // // SaveTheGame () // // Expects game to be premalloced // //****************************************************************************** boolean SaveTheGame (int num, gamestorage_t * game) { char loadname[]="rottgam0.rot"; char *filename; byte * altbuffer; int size; int savehandle; int crc; int i; int myticcount; if (num > 15 || num < 0) Error("Illegal Saved game value=%d\n",num); // // Save Alternate Game Level information for reloading game // memset (&game->info, 0, sizeof (game->info)); if (GameLevels.avail == true) { game->info.path = GameLevels.path; game->info.file = GameLevels.file; game->info.avail = true; } game->mapcrc=GetMapCRC (gamestate.mapon); // Create the proper file name itoa(num,&loadname[7],16); loadname[8]='.'; filename = M_StringJoin(ApogeePath, PATH_SEP_STR, loadname, NULL); // Open the savegame file savehandle = SafeOpenWrite (filename); // Save out file tag size=4; SaveTag(savehandle,"ROTT",size); // Save out header size=sizeof(*game); SafeWrite(savehandle,game,size); ///////////////////////////////////////////////////////////////////////////// // Save out rest of save game file beyond this point ///////////////////////////////////////////////////////////////////////////// // Door Tag size=4; SaveTag(savehandle,"DOOR",size); // Doors SaveDoors(&altbuffer,&size); StoreBuffer(savehandle,altbuffer,size); SafeFree(altbuffer); // Elevator Tag size = 9; SaveTag(savehandle,"ELEVATORS",size); // Elevators SaveElevators(&altbuffer,&size); StoreBuffer(savehandle,altbuffer,size); SafeFree(altbuffer); // Pushwall Tag size=5; SaveTag(savehandle,"PWALL",size); // PushWalls SavePushWalls(&altbuffer,&size); StoreBuffer(savehandle,altbuffer,size); SafeFree(altbuffer); // MaskedWalls Tag size=5; SaveTag(savehandle,"MWALL",size); // Masked Walls SaveMaskedWalls(&altbuffer,&size); StoreBuffer(savehandle,altbuffer,size); SafeFree(altbuffer); // Switches Tag size=6; SaveTag(savehandle,"SWITCH",size); // Switches SaveSwitches(&altbuffer,&size); StoreBuffer(savehandle,altbuffer,size); SafeFree(altbuffer); // Statics Tag size=6; SaveTag(savehandle,"STATIC",size); // Statics SaveStatics(&altbuffer,&size); StoreBuffer(savehandle,altbuffer,size); SafeFree(altbuffer); // Actors Tag size=5; SaveTag(savehandle,"ACTOR",size); // Actors SaveActors(&altbuffer,&size); StoreBuffer(savehandle,altbuffer,size); SafeFree(altbuffer); // TouchPlates Tag size=5; SaveTag(savehandle,"TOUCH",size); // TouchPlates SaveTouchPlates(&altbuffer,&size); StoreBuffer(savehandle,altbuffer,size); SafeFree(altbuffer); // GameState Tag size=9; SaveTag(savehandle,"GAMESTATE",size); // GameState size=sizeof(gamestate); SafeWrite(savehandle,&gamestate,size); // PlayerState Tag size=12; SaveTag(savehandle,"PLAYERSTATES",size); // PlayerStates size=sizeof(playertype); for(i=0;i15 || num<0) Error("Illegal Load game value=%d\n",num); // Create the proper file name itoa(num,&loadname[7],16); loadname[8]='.'; filename = M_StringJoin(ApogeePath, PATH_SEP_STR, loadname, NULL); // Load the file totalsize=LoadFile(filename,(void **)&loadbuffer); bufptr=loadbuffer; free(filename); // Calculate checksum checksum = DoCheckSum (loadbuffer, totalsize-sizeof(checksum), 0); // Retrieve saved checksum memcpy (&savedchecksum,loadbuffer+(totalsize-sizeof(savedchecksum)),sizeof(savedchecksum)); // Compare the two checksums; if (checksum!=savedchecksum) { if (CP_DisplayMsg ("Your Saved Game file is\n" "shall we say, \"corrupted\".\n" "Would you like to\n" "continue anyway (Y/N)?\n", 12)==false) { return false; } } // Load in file tag size=4; LoadTag(&bufptr,"ROTT",size); // Load in header size=sizeof(*game); memcpy(game,bufptr,size); bufptr+=size; if (game->version!=ROTTVERSION) return false; memcpy (&GameLevels, &game->info, sizeof (GameLevels)); gamestate.episode=game->episode; gamestate.mapon=game->area; mapcrc=GetMapCRC (gamestate.mapon); if (mapcrc!=game->mapcrc) return false; ///////////////////////////////////////////////////////////////////////////// // Load in rest of saved game file beyond this point ///////////////////////////////////////////////////////////////////////////// // Free up the current level Z_FreeTags (PU_LEVELSTRUCT, PU_LEVELEND); // Free current level // [FG] invalidate linked lists of PU_LEVEL allocated objects InitStaticList(); gamestate.battlemode = battle_StandAloneGame; BATTLE_SetOptions( &BATTLE_Options[ battle_StandAloneGame ] ); BATTLE_Init( gamestate.battlemode, 1 ); DoLoadGameAction (); SetupGameLevel(); // This prevents a nasty glitch when loading some saved games PreCacheGroup(W_GetNumForName("BULLETHO"),W_GetNumForName("ALTBHO"),cache_transpatch_t); // Door Tag size=4; LoadTag(&bufptr,"DOOR",size); // Doors DoLoadGameAction (); size=LoadBuffer(&altbuffer,&bufptr); LoadDoors(altbuffer,size); SafeFree(altbuffer); // Elevator Tag size = 9; LoadTag(&bufptr,"ELEVATORS",size); // Elevators DoLoadGameAction (); size=LoadBuffer(&altbuffer,&bufptr); LoadElevators(altbuffer,size); SafeFree(altbuffer); // Pushwall Tag size=5; LoadTag(&bufptr,"PWALL",size); // PushWalls DoLoadGameAction (); size=LoadBuffer(&altbuffer,&bufptr); LoadPushWalls(altbuffer,size); SafeFree(altbuffer); // MaskedWalls Tag size=5; LoadTag(&bufptr,"MWALL",size); // Masked Walls DoLoadGameAction (); size=LoadBuffer(&altbuffer,&bufptr); LoadMaskedWalls(altbuffer,size); SafeFree(altbuffer); // Switches Tag size=6; LoadTag(&bufptr,"SWITCH",size); // Switches DoLoadGameAction (); size=LoadBuffer(&altbuffer,&bufptr); LoadSwitches(altbuffer,size); SafeFree(altbuffer); // Statics Tag size=6; LoadTag(&bufptr,"STATIC",size); // Statics DoLoadGameAction (); size=LoadBuffer(&altbuffer,&bufptr); LoadStatics(altbuffer,size); SafeFree(altbuffer); // Actors Tag size=5; LoadTag(&bufptr,"ACTOR",size); // Actors DoLoadGameAction (); size=LoadBuffer(&altbuffer,&bufptr); LoadActors(altbuffer,size); SafeFree(altbuffer); // TouchPlates Tag size=5; LoadTag(&bufptr,"TOUCH",size); // TouchPlates DoLoadGameAction (); size=LoadBuffer(&altbuffer,&bufptr); LoadTouchPlates(altbuffer,size); SafeFree(altbuffer); // SetupWindows SetupWindows(); // GameState Tag size=9; LoadTag(&bufptr,"GAMESTATE",size); // GameState DoLoadGameAction (); size=sizeof(gamestate); memcpy(&gamestate,bufptr,size); bufptr+=size; // PlayerState Tag size=12; LoadTag(&bufptr,"PLAYERSTATES",size); // PlayerState DoLoadGameAction (); size=sizeof(playertype); for(i=0;iguntarget=0; locplayerstate->targettime=0; // Mapseen Tag size=7; LoadTag(&bufptr,"MAPSEEN",size); // MapSeen DoLoadGameAction (); size=sizeof(mapseen); memcpy(&mapseen,bufptr,size); bufptr+=size; // Song Tag size=4; LoadTag(&bufptr,"SONG",size); // Song info DoLoadGameAction (); size=LoadBuffer(&altbuffer,&bufptr); MU_LoadMusic(altbuffer,size); SafeFree(altbuffer); // Misc Tag size=4; LoadTag(&bufptr,"MISC",size); // Misc // ticcount DoLoadGameAction (); size=sizeof(myticcount); memcpy((void *)&myticcount,bufptr,size); bufptr+=size; SaveTime = myticcount; ISR_SetTime(myticcount); // shaketics DoLoadGameAction (); size=sizeof(SHAKETICS); memcpy(&SHAKETICS,bufptr,size); bufptr+=size; // damagecount DoLoadGameAction (); size=sizeof(damagecount); memcpy(&damagecount,bufptr,size); bufptr+=size; // viewsize DoLoadGameAction (); size=sizeof(viewsize); memcpy(&viewsize,bufptr,size); bufptr+=size; // powerup times DoLoadGameAction (); size = sizeof (poweruptime); memcpy (&poweruptime, bufptr, size); bufptr += size; size = sizeof (protectiontime); memcpy (&protectiontime, bufptr, size); bufptr += size; size = sizeof (powerupheight); memcpy (&powerupheight, bufptr, size); bufptr += size; size = sizeof (protectionheight); memcpy (&protectionheight, bufptr, size); bufptr += size; size = sizeof (poweradjust); memcpy (&poweradjust, bufptr, size); bufptr += size; // Set the viewsize SetViewSize(viewsize); DoLoadGameAction (); // Connect areas ConnectAreas (); DoLoadGameAction (); // Free up the loadbuffer SafeFree (loadbuffer); DoLoadGameAction (); Illuminate(); IN_UpdateKeyboard (); LoadPlayer (); DoLoadGameAction (); SetupPlayScreen(); UpdateScore (gamestate.score); UpdateLives (locplayerstate->lives); UpdateTriads (player, 0); PreCache (); InitializeMessages(); for (i=0;i<100;i++) UpdateLightLevel(player->areanumber); CalcTics(); CalcTics(); pickquick = true; return (true); } //****************************************************************************** // // GetSavedMessage () // // Expects message to be premalloced // //****************************************************************************** void GetSavedMessage (int num, char * message) { gamestorage_t game; char loadname[]="rottgam0.rot"; char *filename; byte * loadbuffer; byte * bufptr; int size; if (num>15 || num<0) Error("Illegal Load game value=%d\n",num); // Create the proper file name itoa(num,&loadname[7],16); loadname[8]='.'; filename = M_StringJoin(ApogeePath, PATH_SEP_STR, loadname, NULL); // Load the file size=LoadFile(filename,(void **)&loadbuffer); bufptr=loadbuffer; free(filename); size=4; LoadTag(&bufptr,"ROTT",size); // Load in header size=sizeof(game); memcpy(&game,bufptr,size); strcpy(message,game.message); SafeFree(loadbuffer); } //****************************************************************************** // // GetSavedHeader () // // Expects game to be premalloced // //****************************************************************************** void GetSavedHeader (int num, gamestorage_t * game) { char loadname[]="rottgam0.rot"; char *filename; byte * loadbuffer; byte * bufptr; int size; if (num>15 || num<0) Error("Illegal Load game value=%d\n",num); // Create the proper file name itoa(num,&loadname[7],16); loadname[8]='.'; filename = M_StringJoin(ApogeePath, PATH_SEP_STR, loadname, NULL); // Load the file size=LoadFile(filename, (void **)&loadbuffer); bufptr=loadbuffer; free(filename); size=4; LoadTag(&bufptr,"ROTT",size); // Load in header size=sizeof(*game); memcpy(game,bufptr,size); SafeFree(loadbuffer); } //****************************************************************************** // // GetLevel () // //****************************************************************************** int GetLevel (int episode, int mapon) { int level; level = (mapon+1) - ((episode-1) << 3); return (level); } rott-20230810/rott/rt_game.h000066400000000000000000000104731446517470200155410ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_game_public #define _rt_game_public //*************************************************************************** // // Public header for RT_GAME.C // //*************************************************************************** #include "rt_actor.h" #include "lumpy.h" #include "rt_cfg.h" #include "rt_playr.h" //*************************************************************************** // // DEFINES // //*************************************************************************** #define MaxHighName 57 #define MaxScores 7 //*************************************************************************** // // TYPEDEFS // //*************************************************************************** typedef struct { char message[30]; byte episode; byte area; byte version; byte picture[16000]; word mapcrc; AlternateInformation info; } gamestorage_t; typedef struct { char name[MaxHighName + 1]; long score; word completed,episode; } HighScore; //*************************************************************************** // // GLOBALS // //*************************************************************************** extern int PlayerSnds[5]; //extern int SHAKETICS; extern unsigned short SHAKETICS;//bna++ extern int damagecount; extern HighScore Scores[MaxScores]; extern int SaveTime; //*************************************************************************** // // PROTOTYPES // //*************************************************************************** void SetupPlayScreen (void); void SD_PreCache (void); void GameMemToScreen( pic_t *source, int x, int y, int bufferofsonly ); void DrawPlayScreen (boolean bufferofsonly); void DrawKills (boolean bufferofsonly); void DrawPlayers ( void ); void DrawGameString (int x, int y, const char * str, boolean bufferofsonly); void DrawNumber (int x, int y, int width, int which, boolean bufferofsonly); void TakeDamage (int points, objtype *attacker); void HealPlayer (int points, objtype * ob); void DrawLives (boolean bufferofsonly); void GiveExtraMan (void); void DrawScore (boolean bufferofsonly); void GivePoints (long points); void DrawKeys (boolean bufferofsonly); void GiveKey (int key); void GiveWeapon (objtype * ob, int weapon); void GiveMissileWeapon(objtype * ob, int which); void GiveLives (int newlives); void UpdateScore (unsigned int num); void UpdateLives (int num); void DrawTimeXY( int x, int y, int sec, boolean bufferofsonly ); void DrawTime (boolean bufferofsonly); boolean SaveTheGame (int num, gamestorage_t * game); boolean LoadTheGame (int num, gamestorage_t * game); void GetSavedMessage (int num, char * message); void GetSavedHeader (int num, gamestorage_t * game); void DrawHighScores (void); void CheckHighScore (long score, word other, boolean INMENU); void LevelCompleted ( exit_t playstate ); void BattleLevelCompleted ( int localplayer ); void Died (void); void ScreenShake (void); void UpdateTriads (objtype * ob, int num); void DrawTriads (boolean bufferofsonly); void DrawStats (void); void DrawBarHealth (boolean bufferonly); void DrawBarAmmo (boolean bufferonly); void GM_DrawBonus (int which); void DrawEpisodeLevel ( int x, int y ); void DoBorderShifts (void); void GM_UpdateBonus (int time, int powerup); void DoLoadGameAction (void); int GetLevel (int episode, int mapon); void DrawPause (void); void DrawPauseXY (int x, int y); void DrawColoredMPPic (int xpos, int ypos, int width, int height, int heightmod, byte *src, boolean bufferofsonly, int color); void StatusDrawColoredPic (unsigned x, unsigned y, pic_t *nums, boolean bufferofsonly, int color); void ClearTriads (playertype * pstate); #endif rott-20230810/rott/rt_in.c000066400000000000000000001060601446517470200152270ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "SDL.h" #include "modexlib.h" #include "rt_main.h" #include "rt_def.h" #include "rt_in.h" #include "_rt_in.h" #include "isr.h" #include "rt_util.h" #include "rt_vh_a.h" #include "rt_cfg.h" #include "rt_msg.h" #include "rt_playr.h" #include "rt_net.h" #include "rt_com.h" #include "rt_cfg.h" #include "keyb.h" #define MAXMESSAGELENGTH (COM_MAXTEXTSTRINGLENGTH-1) //**************************************************************************** // // GLOBALS // //****************************************************************************] // // Used by menu routines that need to wait for a button release. // Sometimes the mouse driver misses an interrupt, so you can't wait for // a button to be released. Instead, you must ignore any buttons that // are pressed. // int IgnoreMouse = 0; // configuration variables // boolean MousePresent; boolean JoysPresent[MaxJoys]; boolean JoyPadPresent = 0; // Global variables // boolean Paused; char LastASCII; volatile int LastScan; byte Joy_xb, Joy_yb, Joy_xs, Joy_ys; word Joy_x, Joy_y; int LastLetter = 0; char LetterQueue[MAXLETTERS]; ModemMessage MSG; static SDL_Joystick* sdl_joysticks[MaxJoys]; static int sdl_mouse_delta_x = 0; static int sdl_mouse_delta_y = 0; static word sdl_mouse_button_mask = 0; static int sdl_total_sticks = 0; static word *sdl_stick_button_state = NULL; static word sdl_sticks_joybits = 0; static int sdl_mouse_grabbed = 0; extern boolean sdl_fullscreen; // 'q','w','e','r','t','y','u','i','o','p','[',']','\\', 0 ,'a','s', const char ScanChars[128] = // Scan code names with single chars { 0 , 0 ,'1','2','3','4','5','6','7','8','9','0','-','=', 0 , 0 , 'q','w','e','r','t','y','u','i','o','p','[',']', 0 , 0 ,'a','s', 'd','f','g','h','j','k','l',';','\'','`', 0 ,'\\','z','x','c','v', 'b','n','m',',','.','/', 0 , 0 , 0 ,' ', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,'-', 0 ,'5', 0 ,'+', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; const char ShiftedScanChars[128] = // Shifted Scan code names with single chars { 0 , 0 ,'!','@','#','$','%','^','&','*','(',')','_','+', 0 , 0 , 'Q','W','E','R','T','Y','U','I','O','P','{','}', 0 , 0 ,'A','S', 'D','F','G','H','J','K','L',':','"','~', 0 ,'|','Z','X','C','V', 'B','N','M','<','>','?', 0 , 0 , 0 ,' ', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,'-', 0 ,'5', 0 ,'+', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; //**************************************************************************** // // LOCALS // //****************************************************************************] #define SCANCODE_TO_KEYS_ARRAY { \ 0, 0, 0, 0, sc_A, \ sc_B, sc_C, sc_D, sc_E, sc_F, \ sc_G, sc_H, sc_I, sc_J, sc_K, \ sc_L, sc_L, sc_N, sc_O, sc_P, \ sc_Q, sc_R, sc_S, sc_T, sc_U, \ sc_V, sc_W, sc_X, sc_Y, sc_Z, \ sc_1, sc_2, sc_3, sc_4, sc_5, \ sc_6, sc_7, sc_8, sc_9, sc_0, \ sc_Return, sc_Escape, sc_BackSpace, sc_Tab, sc_Space, \ sc_Minus, sc_Equals, sc_OpenBracket, sc_CloseBracket, 0x2B, \ 0, 0x27, 0x28, 0x29, sc_Comma, \ sc_Period, 0x35, sc_CapsLock, sc_F1, sc_F2, \ sc_F3, sc_F4, sc_F5, sc_F6, sc_F7, \ sc_F8, sc_F9, sc_F10, sc_F11, sc_F12, \ sc_PrintScreen, 0x46, 0, sc_Insert, sc_Home, \ sc_PgUp, sc_Delete, sc_End, sc_PgDn, sc_RightArrow, \ sc_LeftArrow, sc_DownArrow, sc_UpArrow, \ 0x45, 0x35, 0x37, sc_Minus, sc_Plus, sc_Return, sc_End, \ sc_DownArrow, sc_PgDn, sc_LeftArrow, 0x4c, sc_RightArrow, \ sc_Home, sc_UpArrow, sc_PgUp, sc_Insert, sc_Period, \ 0, 0, 0, sc_Equals \ } static const int scancode_translate_table[] = SCANCODE_TO_KEYS_ARRAY; static int GetScancode(const int scancode) { switch (scancode) { case SDL_SCANCODE_LCTRL: case SDL_SCANCODE_RCTRL: return sc_Control; case SDL_SCANCODE_LSHIFT: return sc_LShift; case SDL_SCANCODE_RSHIFT: return sc_RShift; case SDL_SCANCODE_LALT: case SDL_SCANCODE_RALT: return sc_Alt; default: if (scancode >= 0 && scancode < arrlen(scancode_translate_table)) { return scancode_translate_table[scancode]; } else { return 0; } } } static KeyboardDef KbdDefs = {0x1d,0x38,0x47,0x48,0x49,0x4b,0x4d,0x4f,0x50,0x51}; static JoystickDef JoyDefs[MaxJoys]; static ControlType Controls[MAXPLAYERS]; static boolean IN_Started; static Direction DirTable[] = // Quick lookup for total direction { dir_NorthWest, dir_North, dir_NorthEast, dir_West, dir_None, dir_East, dir_SouthWest, dir_South, dir_SouthEast }; int (far *function_ptr)(); static char *ParmStrings[] = {"nojoys","nomouse",NULL}; #define sdldebug printf static int sdl_mouse_button_filter(SDL_Event const *event) { /* * What DOS games expect: * 0 left button pressed if 1 * 1 right button pressed if 1 * 2 middle button pressed if 1 * * (That is, this is what Int 33h (AX=0x05) returns...) */ Uint8 bmask = SDL_GetMouseState(NULL, NULL); sdl_mouse_button_mask = 0; /* this is a static var. */ if (bmask & SDL_BUTTON_LMASK) sdl_mouse_button_mask |= 1; if (bmask & SDL_BUTTON_RMASK) sdl_mouse_button_mask |= 2; if (bmask & SDL_BUTTON_MMASK) sdl_mouse_button_mask |= 4; return(0); } /* sdl_mouse_up_filter */ static int sdl_mouse_motion_filter(SDL_Event const *event) { static int mouse_x = 0; static int mouse_y = 0; int mouse_relative_x = 0; int mouse_relative_y = 0; if (event->type == SDL_JOYBALLMOTION) { mouse_relative_x = event->jball.xrel/100; mouse_relative_y = event->jball.yrel/100; mouse_x += mouse_relative_x; mouse_y += mouse_relative_y; } /* if */ else { if (sdl_mouse_grabbed || sdl_fullscreen) { mouse_relative_x = event->motion.xrel; mouse_relative_y = event->motion.yrel; mouse_x += mouse_relative_x; mouse_y += mouse_relative_y; } /* if */ else { mouse_relative_x = event->motion.x - mouse_x; mouse_relative_y = event->motion.y - mouse_y; mouse_x = event->motion.x; mouse_y = event->motion.y; } /* else */ } /* else */ /* set static vars... */ sdl_mouse_delta_x += mouse_relative_x; sdl_mouse_delta_y += mouse_relative_y; return(0); } /* sdl_mouse_motion_filter */ /* * The windib driver can't alert us to the keypad enter key, which * Ken's code depends on heavily. It sends it as the same key as the * regular return key. These users will have to hit SHIFT-ENTER, * which we check for explicitly, and give the engine a keypad enter * enter event. */ static int handle_keypad_enter_hack(const SDL_Event *event) { static int kp_enter_hack = 0; int retval = 0; if (event->key.keysym.scancode == SDL_SCANCODE_RETURN) { if (event->key.state == SDL_PRESSED) { if (event->key.keysym.mod & KMOD_SHIFT) { kp_enter_hack = 1; retval = GetScancode(SDL_SCANCODE_KP_ENTER); } /* if */ } /* if */ else /* key released */ { if (kp_enter_hack) { kp_enter_hack = 0; retval = GetScancode(SDL_SCANCODE_KP_ENTER); } /* if */ } /* if */ } /* if */ return(retval); } /* handle_keypad_enter_hack */ static int sdl_key_filter(const SDL_Event *event) { int k; int keyon; int strippedkey; int grab_mode = 0; int extended; if ( (event->key.keysym.sym == SDLK_g) && (event->key.state == SDL_PRESSED) && (event->key.keysym.mod & KMOD_CTRL) ) { if (!sdl_fullscreen) { sdl_mouse_grabbed = ((sdl_mouse_grabbed) ? 0 : 1); if (sdl_mouse_grabbed) grab_mode = 1; SetShowCursor(!grab_mode); } return(0); } /* if */ else if ( ( (event->key.keysym.sym == SDLK_RETURN) || (event->key.keysym.sym == SDLK_KP_ENTER) ) && (event->key.state == SDL_PRESSED) && (event->key.keysym.mod & KMOD_ALT) ) { ToggleFullScreen(); return(0); } /* if */ /* HDG: put this above the scancode lookup otherwise it is never reached */ if ( (event->key.keysym.sym == SDLK_PAUSE) && (event->key.state == SDL_PRESSED)) { PausePressed = true; return(0); } k = handle_keypad_enter_hack(event); if (!k) { k = GetScancode(event->key.keysym.scancode); if (!k) /* No DOS equivalent defined. */ return(0); } /* if */ /* Fix elweirdo SDL capslock/numlock handling, always treat as press */ if ( (event->key.keysym.sym != SDLK_CAPSLOCK) && (event->key.keysym.sym != SDLK_NUMLOCKCLEAR) && (event->key.state == SDL_RELEASED) ) k += 128; /* +128 signifies that the key is released in DOS. */ if (event->key.keysym.sym == SDLK_SCROLLLOCK) PanicPressed = true; else { extended = ((k & 0xFF00) >> 8); keyon = k & 0x80; strippedkey = k & 0x7f; if (extended != 0) { KeyboardQueue[ Keytail ] = extended; Keytail = ( Keytail + 1 )&( KEYQMAX - 1 ); k = GetScancode(event->key.keysym.scancode) & 0xFF; if (event->key.state == SDL_RELEASED) k += 128; /* +128 signifies that the key is released in DOS. */ } if (keyon) // Up event Keystate[strippedkey]=0; else // Down event { Keystate[strippedkey]=1; LastScan = k; } KeyboardQueue[ Keytail ] = k; Keytail = ( Keytail + 1 )&( KEYQMAX - 1 ); } return(0); } /* sdl_key_filter */ static int root_sdl_event_filter(const SDL_Event *event) { switch (event->type) { case SDL_KEYUP: case SDL_KEYDOWN: return(sdl_key_filter(event)); case SDL_JOYBALLMOTION: case SDL_MOUSEMOTION: return(sdl_mouse_motion_filter(event)); case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONDOWN: return(sdl_mouse_button_filter(event)); case SDL_QUIT: /* !!! rcg TEMP */ fprintf(stderr, "\n\n\nSDL_QUIT!\n\n\n"); SDL_Quit(); exit(42); } /* switch */ return(1); } /* root_sdl_event_filter */ static void sdl_handle_events(void) { SDL_Event event; while (SDL_PollEvent(&event)) root_sdl_event_filter(&event); } /* sdl_handle_events */ //****************************************************************************** // // IN_PumpEvents () - Let platform process an event queue. // //****************************************************************************** void IN_PumpEvents(void) { sdl_handle_events(); } //****************************************************************************** // // INL_GetMouseDelta () - Gets the amount that the mouse has moved from the // mouse driver // //****************************************************************************** void INL_GetMouseDelta(int *x,int *y) { IN_PumpEvents(); *x = sdl_mouse_delta_x; *y = sdl_mouse_delta_y; sdl_mouse_delta_x = sdl_mouse_delta_y = 0; } //****************************************************************************** // // IN_GetMouseButtons () - Gets the status of the mouse buttons from the // mouse driver // //****************************************************************************** word IN_GetMouseButtons ( void ) { word buttons = 0; IN_PumpEvents(); buttons = sdl_mouse_button_mask; // Used by menu routines that need to wait for a button release. // Sometimes the mouse driver misses an interrupt, so you can't wait for // a button to be released. Instead, you must ignore any buttons that // are pressed. IgnoreMouse &= buttons; buttons &= ~IgnoreMouse; return (buttons); } //****************************************************************************** // // IN_IgnoreMouseButtons () - // Tells the mouse to ignore the currently pressed buttons. // //****************************************************************************** void IN_IgnoreMouseButtons ( void ) { IgnoreMouse |= IN_GetMouseButtons(); } //****************************************************************************** // // IN_GetJoyAbs () - Reads the absolute position of the specified joystick // //****************************************************************************** void IN_GetJoyAbs (word joy, word *xp, word *yp) { Joy_x = Joy_y = 0; Joy_xs = joy? 2 : 0; // Find shift value for x axis Joy_xb = 1 << Joy_xs; // Use shift value to get x bit mask Joy_ys = joy? 3 : 1; // Do the same for y axis Joy_yb = 1 << Joy_ys; if (joy < sdl_total_sticks) { Joy_x = SDL_JoystickGetAxis (sdl_joysticks[joy], 0); Joy_y = SDL_JoystickGetAxis (sdl_joysticks[joy], 1); } else { Joy_x = 0; Joy_y = 0; } *xp = Joy_x; *yp = Joy_y; } void JoyStick_Vals (void) { } //****************************************************************************** // // INL_GetJoyDelta () - Returns the relative movement of the specified // joystick (from +/-127) // //****************************************************************************** void INL_GetJoyDelta (word joy, int *dx, int *dy) { word x, y; JoystickDef *def; IN_GetJoyAbs (joy, &x, &y); def = JoyDefs + joy; if (x < def->threshMinX) { if (x < def->joyMinX) x = def->joyMinX; x = -(x - def->threshMinX); x *= def->joyMultXL; x >>= JoyScaleShift; *dx = (x > 127)? -127 : -x; } else if (x > def->threshMaxX) { if (x > def->joyMaxX) x = def->joyMaxX; x = x - def->threshMaxX; x *= def->joyMultXH; x >>= JoyScaleShift; *dx = (x > 127)? 127 : x; } else *dx = 0; if (y < def->threshMinY) { if (y < def->joyMinY) y = def->joyMinY; y = -(y - def->threshMinY); y *= def->joyMultYL; y >>= JoyScaleShift; *dy = (y > 127)? -127 : -y; } else if (y > def->threshMaxY) { if (y > def->joyMaxY) y = def->joyMaxY; y = y - def->threshMaxY; y *= def->joyMultYH; y >>= JoyScaleShift; *dy = (y > 127)? 127 : y; } else *dy = 0; } //****************************************************************************** // // INL_GetJoyButtons () - Returns the button status of the specified // joystick // //****************************************************************************** word INL_GetJoyButtons (word joy) { word result = 0; if (joy < sdl_total_sticks) result = sdl_stick_button_state[joy]; return result; } //****************************************************************************** // // INL_StartMouse () - Detects and sets up the mouse // //****************************************************************************** boolean INL_StartMouse (void) { boolean retval = false; /* no-op. */ retval = true; return (retval); } //****************************************************************************** // // INL_SetJoyScale () - Sets up scaling values for the specified joystick // //****************************************************************************** void INL_SetJoyScale (word joy) { JoystickDef *def; def = &JoyDefs[joy]; def->joyMultXL = JoyScaleMax / (def->threshMinX - def->joyMinX); def->joyMultXH = JoyScaleMax / (def->joyMaxX - def->threshMaxX); def->joyMultYL = JoyScaleMax / (def->threshMinY - def->joyMinY); def->joyMultYH = JoyScaleMax / (def->joyMaxY - def->threshMaxY); } //****************************************************************************** // // IN_SetupJoy () - Sets up thresholding values and calls INL_SetJoyScale() // to set up scaling values // //****************************************************************************** void IN_SetupJoy (word joy, word minx, word maxx, word miny, word maxy) { word d,r; JoystickDef *def; def = &JoyDefs[joy]; def->joyMinX = minx; def->joyMaxX = maxx; r = maxx - minx; d = r / 3; def->threshMinX = ((r / 2) - d) + minx; def->threshMaxX = ((r / 2) + d) + minx; def->joyMinY = miny; def->joyMaxY = maxy; r = maxy - miny; d = r / 3; def->threshMinY = ((r / 2) - d) + miny; def->threshMaxY = ((r / 2) + d) + miny; INL_SetJoyScale (joy); } //****************************************************************************** // // INL_StartJoy () - Detects & auto-configures the specified joystick // The auto-config assumes the joystick is centered // //****************************************************************************** boolean INL_StartJoy (word joy) { word x,y; if (!SDL_WasInit(SDL_INIT_JOYSTICK)) { SDL_Init(SDL_INIT_JOYSTICK); sdl_total_sticks = SDL_NumJoysticks(); if (sdl_total_sticks > MaxJoys) sdl_total_sticks = MaxJoys; if ((sdl_stick_button_state == NULL) && (sdl_total_sticks > 0)) { sdl_stick_button_state = (word *) malloc(sizeof (word) * sdl_total_sticks); if (sdl_stick_button_state == NULL) SDL_QuitSubSystem(SDL_INIT_JOYSTICK); else memset(sdl_stick_button_state, '\0', sizeof (word) * sdl_total_sticks); } SDL_JoystickEventState(SDL_ENABLE); } if (joy >= sdl_total_sticks) return (false); sdl_joysticks[joy] = SDL_JoystickOpen (joy); IN_GetJoyAbs (joy, &x, &y); if ( ((x == 0) || (x > MaxJoyValue - 10)) || ((y == 0) || (y > MaxJoyValue - 10)) ) return(false); else { IN_SetupJoy (joy, 0, x * 2, 0, y * 2); return (true); } } //****************************************************************************** // // INL_ShutJoy() - Cleans up the joystick stuff // //****************************************************************************** void INL_ShutJoy (word joy) { JoysPresent[joy] = false; if (joy < sdl_total_sticks) SDL_JoystickClose (sdl_joysticks[joy]); } //****************************************************************************** // // IN_Startup() - Starts up the Input Mgr // //****************************************************************************** void IN_Startup (void) { boolean checkjoys, checkmouse; word i; if (IN_Started==true) return; #ifdef _WIN32 // fixme: remove this. sdl_mouse_grabbed = 1; #endif checkjoys = true; checkmouse = true; for (i = 1; i < _argc; i++) { switch (US_CheckParm (_argv[i], ParmStrings)) { case 0: checkjoys = false; break; case 1: checkmouse = false; break; } } MousePresent = checkmouse ? INL_StartMouse() : false; if (!MousePresent) mouseenabled = false; else { if (!quiet) printf("IN_Startup: Mouse Present\n"); } for (i = 0;i < MaxJoys;i++) { JoysPresent[i] = checkjoys ? INL_StartJoy(i) : false; if (INL_StartJoy(i)) { if (!quiet) printf("IN_Startup: Joystick Present\n"); } } IN_Started = true; } //****************************************************************************** // // IN_Shutdown() - Shuts down the Input Mgr // //****************************************************************************** void IN_Shutdown (void) { word i; if (IN_Started==false) return; // INL_ShutMouse(); for (i = 0;i < MaxJoys;i++) INL_ShutJoy(i); IN_Started = false; } //****************************************************************************** // // IN_ClearKeysDown() - Clears the keyboard array // //****************************************************************************** void IN_ClearKeysDown (void) { LastScan = sc_None; memset ((void *)Keyboard, 0, sizeof (Keyboard)); } //****************************************************************************** // // IN_ReadControl() - Reads the device associated with the specified // player and fills in the control info struct // //****************************************************************************** void IN_ReadControl (int player, ControlInfo *info) { boolean realdelta = false; word buttons; int dx,dy; Motion mx,my; ControlType type; KeyboardDef *def; dx = dy = 0; mx = my = motion_None; buttons = 0; switch (type = Controls[player]) { case ctrl_Keyboard: def = &KbdDefs; if (Keyboard[sc_UpArrow]) my = motion_Up; else if (Keyboard[sc_DownArrow]) my = motion_Down; if (Keyboard[sc_LeftArrow]) mx = motion_Left; else if (Keyboard[sc_RightArrow]) mx = motion_Right; if (Keyboard[def->button0]) buttons += 1 << 0; if (Keyboard[def->button1]) buttons += 1 << 1; realdelta = false; break; default: ; } if (realdelta) { mx = (dx < 0)? motion_Left : ((dx > 0)? motion_Right : motion_None); my = (dy < 0)? motion_Up : ((dy > 0)? motion_Down : motion_None); } else { dx = mx * 127; dy = my * 127; } info->x = dx; info->xaxis = mx; info->y = dy; info->yaxis = my; info->button0 = buttons & (1 << 0); info->button1 = buttons & (1 << 1); info->button2 = buttons & (1 << 2); info->button3 = buttons & (1 << 3); info->dir = DirTable[((my + 1) * 3) + (mx + 1)]; } //****************************************************************************** // // IN_WaitForKey() - Waits for a scan code, then clears LastScan and // returns the scan code // //****************************************************************************** ScanCode IN_WaitForKey (void) { ScanCode result; while (!(result = LastScan)) IN_PumpEvents(); LastScan = 0; return (result); } //****************************************************************************** // // IN_Ack() - waits for a button or key press. If a button is down, upon // calling, it must be released for it to be recognized // //****************************************************************************** boolean btnstate[8]; void IN_StartAck (void) { unsigned i, buttons = 0; // // get initial state of everything // LastScan = 0; IN_ClearKeysDown (); memset (btnstate, 0, sizeof(btnstate)); IN_PumpEvents(); buttons = IN_JoyButtons () << 4; buttons |= IN_GetMouseButtons(); for (i=0;i<8;i++,buttons>>=1) if (buttons&1) btnstate[i] = true; } //****************************************************************************** // // IN_CheckAck () // //****************************************************************************** boolean IN_CheckAck (void) { unsigned i, buttons = 0; // // see if something has been pressed // if (LastScan) return true; IN_PumpEvents(); buttons = IN_JoyButtons () << 4; buttons |= IN_GetMouseButtons(); for (i=0;i<8;i++,buttons>>=1) if ( buttons&1 ) { if (!btnstate[i]) return true; } else btnstate[i]=false; return false; } //****************************************************************************** // // IN_Ack () // //****************************************************************************** void IN_Ack (void) { IN_StartAck (); while (!IN_CheckAck ()) ; } //****************************************************************************** // // IN_UserInput() - Waits for the specified delay time (in ticks) or the // user pressing a key or a mouse button. If the clear flag is set, it // then either clears the key or waits for the user to let the mouse // button up. // //****************************************************************************** boolean IN_UserInput (long delay) { long lasttime; lasttime = GetTicCount(); IN_StartAck (); do { if (IN_CheckAck()) return true; } while ((GetTicCount() - lasttime) < delay); return (false); } //=========================================================================== /* =================== = = IN_JoyButtons = =================== */ byte IN_JoyButtons (void) { unsigned joybits = 0; joybits = sdl_sticks_joybits; return (byte) joybits; } //****************************************************************************** // // IN_UpdateKeyboard () // //****************************************************************************** /* HACK HACK HACK */ static int queuegotit=0; void IN_UpdateKeyboard (void) { int tail; int key; if (!queuegotit) IN_PumpEvents(); queuegotit=0; if (Keytail != Keyhead) { tail = Keytail; while (Keyhead != tail) { if (KeyboardQueue[Keyhead] & 0x80) // Up event { key = KeyboardQueue[Keyhead] & 0x7F; // AND off high bit // if (keysdown[key]) // { // KeyboardQueue[Keytail] = KeyboardQueue[Keyhead]; // Keytail = (Keytail+1)&(KEYQMAX-1); // } // else Keyboard[key] = 0; } else // Down event { Keyboard[KeyboardQueue[Keyhead]] = 1; // keysdown[KeyboardQueue[Keyhead]] = 1; } Keyhead = (Keyhead+1)&(KEYQMAX-1); } // while } // if // Carry over movement keys from the last refresh // keysdown[sc_RightArrow] = Keyboard[sc_RightArrow]; // keysdown[sc_LeftArrow] = Keyboard[sc_LeftArrow]; // keysdown[sc_UpArrow] = Keyboard[sc_UpArrow]; // keysdown[sc_DownArrow] = Keyboard[sc_DownArrow]; } //****************************************************************************** // // IN_InputUpdateKeyboard () // //****************************************************************************** int IN_InputUpdateKeyboard (void) { int key; int returnval = 0; boolean done = false; // _disable (); if (Keytail != Keyhead) { int tail = Keytail; while (!done && (Keyhead != tail)) { if (KeyboardQueue[Keyhead] & 0x80) // Up event { key = KeyboardQueue[Keyhead] & 0x7F; // AND off high bit Keyboard[key] = 0; } else // Down event { Keyboard[KeyboardQueue[Keyhead]] = 1; returnval = KeyboardQueue[Keyhead]; done = true; } Keyhead = (Keyhead+1)&(KEYQMAX-1); } } // if // _enable (); return (returnval); } //****************************************************************************** // // IN_ClearKeyboardQueue () // //****************************************************************************** void IN_ClearKeyboardQueue (void) { return; // IN_ClearKeysDown (); // Keytail = Keyhead = 0; // memset (KeyboardQueue, 0, sizeof (KeyboardQueue)); // I_SendKeyboardData(0xf6); // I_SendKeyboardData(0xf4); } //****************************************************************************** // // QueueLetterInput () // //****************************************************************************** void QueueLetterInput (void) { int head = Keyhead; int tail = Keytail; char c; int scancode; boolean send = false; /* HACK HACK HACK */ /* OK, we want the new keys NOW, and not when the update gets them. Since this called before IN_UpdateKeyboard in PollKeyboardButtons, we shall update here. The hack is there to prevent IN_UpdateKeyboard from stealing any keys... - SBF */ IN_PumpEvents(); head = Keyhead; tail = Keytail; queuegotit=1; /* HACK HACK HACK */ while (head != tail) { if (!(KeyboardQueue[head] & 0x80)) // Down event { scancode = KeyboardQueue[head]; if (Keyboard[sc_RShift] || Keyboard[sc_LShift]) { c = ShiftedScanChars[scancode]; } else { c = ScanChars[scancode]; } // If "is printable char", queue the character if (c) { LetterQueue[LastLetter] = c; LastLetter = (LastLetter+1)&(MAXLETTERS-1); // If typing a message, update the text with 'c' if ( MSG.messageon ) { Keystate[scancode]=0; KeyboardQueue[head] = 0; if ( MSG.inmenu ) { if ( ( c == 'A' ) || ( c == 'a' ) ) { MSG.towho = MSG_DIRECTED_TO_ALL; send = true; } if ( ( gamestate.teamplay ) && ( ( c == 'T' ) || ( c == 't' ) ) ) { MSG.towho = MSG_DIRECTED_TO_TEAM; send = true; } if ( ( c >= '0' ) && ( c <= '9' ) ) { int who; if ( c == '0' ) { who = 10; } else { who = c - '1'; } // Skip over local player if ( who >= consoleplayer ) { who++; } if ( who < numplayers ) { MSG.towho = who; send = true; } } if ( send ) { MSG.messageon = false; KeyboardQueue[ head ] = 0; Keyboard[ scancode ] = 0; LastScan = 0; FinishModemMessage( MSG.textnum, true ); } } else if ( ( scancode >= sc_1 ) && ( scancode <= sc_0 ) && ( Keyboard[ sc_Alt ] ) ) { int msg; msg = scancode - sc_1; if ( CommbatMacros[ msg ].avail ) { MSG.length = strlen( CommbatMacros[ msg ].macro ) + 1; strcpy( Messages[ MSG.textnum ].text, CommbatMacros[ msg ].macro ); MSG.messageon = false; FinishModemMessage( MSG.textnum, true ); KeyboardQueue[ head ] = 0; Keyboard[ sc_Enter ] = 0; Keyboard[ sc_Escape ] = 0; LastScan = 0; } else { MSG.messageon = false; MSG.directed = false; FinishModemMessage( MSG.textnum, false ); AddMessage( "No macro.", MSG_MACRO ); KeyboardQueue[ head ] = 0; Keyboard[ sc_Enter ] = 0; Keyboard[ sc_Escape ] = 0; LastScan = 0; } } else if ( MSG.length < MAXMESSAGELENGTH ) { UpdateModemMessage (MSG.textnum, c); } } } else { // If typing a message, check for special characters if ( MSG.messageon && MSG.inmenu ) { if ( scancode == sc_Escape ) { MSG.messageon = false; MSG.directed = false; FinishModemMessage( MSG.textnum, false ); KeyboardQueue[head] = 0; Keyboard[sc_Enter] = 0; Keyboard[sc_Escape] = 0; LastScan = 0; } } else if ( MSG.messageon && !MSG.inmenu ) { if ( ( scancode >= sc_F1 ) && ( scancode <= sc_F10 ) ) { MSG.remoteridicule = scancode - sc_F1; MSG.messageon = false; FinishModemMessage(MSG.textnum, true); KeyboardQueue[head] = 0; Keyboard[sc_Enter] = 0; Keyboard[sc_Escape] = 0; LastScan = 0; } switch (scancode) { case sc_BackSpace: KeyboardQueue[head] = 0; if (MSG.length > 1) { ModemMessageDeleteChar (MSG.textnum); } Keystate[scancode]=0; break; case sc_Enter: MSG.messageon = false; FinishModemMessage(MSG.textnum, true); KeyboardQueue[head] = 0; Keyboard[sc_Enter] = 0; Keyboard[sc_Escape] = 0; LastScan = 0; Keystate[scancode]=0; break; case sc_Escape: MSG.messageon = false; MSG.directed = false; FinishModemMessage(MSG.textnum, false); KeyboardQueue[head] = 0; Keyboard[sc_Enter] = 0; Keyboard[sc_Escape] = 0; LastScan = 0; break; } } } } head = (head+1)&(KEYQMAX-1); } // while } rott-20230810/rott/rt_in.h000066400000000000000000000113201446517470200152260ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //*************************************************************************** // // Public header for RT_IN.C. // //*************************************************************************** #ifndef _rt_in_public #define _rt_in_public #include "develop.h" #include "rottnet.h" //*************************************************************************** // // DEFINES // //*************************************************************************** #define MAXLETTERS 32 //*************************************************************************** // // TYPEDEFS // //*************************************************************************** typedef enum { motion_Left = -1, motion_Up = -1, motion_None = 0, motion_Right = 1, motion_Down = 1 } Motion; typedef enum { dir_North, dir_NorthEast, dir_East, dir_SouthEast, dir_South, dir_SouthWest, dir_West, dir_NorthWest, dir_None } Direction; typedef byte ScanCode; typedef enum { ctrl_Keyboard, ctrl_Keyboard1 = ctrl_Keyboard, ctrl_Keyboard2, ctrl_Joystick, ctrl_Joystick1 = ctrl_Joystick, ctrl_Joystick2, ctrl_Mouse } ControlType; typedef struct { boolean button0, button1, button2, button3; int x, y; Motion xaxis, yaxis; Direction dir; } CursorInfo; typedef CursorInfo ControlInfo; typedef struct { ScanCode button0, button1, upleft, up, upright, left, right, downleft, down, downright; } KeyboardDef; typedef struct { word joyMinX,joyMinY, threshMinX,threshMinY, threshMaxX,threshMaxY, joyMaxX,joyMaxY, joyMultXL,joyMultYL, joyMultXH,joyMultYH; } JoystickDef; typedef struct { boolean messageon; boolean directed; boolean inmenu; int remoteridicule; int towho; int textnum; int length; } ModemMessage; //*************************************************************************** // // GLOBALS // //*************************************************************************** extern boolean MousePresent; extern boolean JoysPresent[MaxJoys]; extern boolean JoyPadPresent; extern int mouseadjustment; extern int threshold; extern boolean Paused; extern volatile int LastScan; /* extern KeyboardDef KbdDefs; extern JoystickDef JoyDefs[]; extern ControlType Controls[MAXPLAYERS]; */ extern char LastASCII; extern volatile int LastScan; extern byte Joy_xb, Joy_yb, Joy_xs, Joy_ys; extern word Joy_x, Joy_y; extern int LastLetter; extern char LetterQueue[MAXLETTERS]; extern ModemMessage MSG; extern const char ScanChars[128]; //*************************************************************************** // // PROTOTYPES // //*************************************************************************** void INL_GetMouseDelta(int *x,int *y); word IN_GetMouseButtons (void); void IN_IgnoreMouseButtons( void ); boolean INL_StartMouse (void); void INL_ShutMouse (void); void IN_Startup(void); void IN_Default (boolean gotit, ControlType in); void IN_Shutdown (void); void IN_SetKeyHook(void (*hook)()); void IN_ClearKeysDown (void); void IN_ReadControl (int player, ControlInfo *info); void IN_SetControlType (int player, ControlType type); ScanCode IN_WaitForKey (void); char IN_WaitForASCII (void); void IN_StartAck (void); boolean IN_CheckAck (void); void IN_Ack (void); boolean IN_UserInput (long delay); void IN_GetJoyAbs (word joy, word *xp, word *yp); void INL_GetJoyDelta (word joy, int *dx, int *dy); word INL_GetJoyButtons (word joy); //word IN_GetJoyButtonsDB (word joy); void INL_SetJoyScale (word joy); void IN_SetupJoy (word joy, word minx, word maxx, word miny, word maxy); boolean INL_StartJoy (word joy); void INL_ShutJoy (word joy); byte IN_JoyButtons (void); void IN_UpdateKeyboard (void); void IN_ClearKeyboardQueue (void); int IN_InputUpdateKeyboard (void); void IN_PumpEvents (void); void QueueLetterInput (void); #endif rott-20230810/rott/rt_main.c000066400000000000000000001776061446517470200155630ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "lumpy.h" #include #include #include #include #include #include #include "SDL.h" #include "rt_actor.h" #include "rt_stat.h" #include "rt_vid.h" #include "rt_menu.h" #include "rt_sound.h" #include "watcom.h" #include "scriplib.h" #include "rt_main.h" #include "_rt_main.h" #include "rt_com.h" #include "rt_util.h" #include "z_zone.h" #include "w_wad.h" #include "rt_game.h" #include "rt_floor.h" #include "rt_playr.h" #include "rt_draw.h" #include "rt_str.h" #include "rt_view.h" #include "rt_door.h" #include "rt_ted.h" #include "rt_in.h" #include "rt_map.h" #include "rt_rand.h" #include "rt_debug.h" #include "isr.h" #include "rt_cfg.h" #include "develop.h" #include "version.h" #include "rt_menu.h" #include "rt_dr_a.h" #include "rt_msg.h" #include "rt_build.h" #include "rt_error.h" #include "modexlib.h" #include "rt_net.h" #include "cin_main.h" #include "rottnet.h" #include "rt_scale.h" #include "rt_datadir.h" #include "music.h" #include "fx_man.h" volatile int oldtime; volatile int gametime; boolean tedlevel; int tedlevelnum; int tedx=0; int tedy=0; boolean warp; int warpx=0; int warpy=0; int warpa=0; int NoSound; int polltime; int oldpolltime; boolean fizzlein = false; int pheight; boolean SCREENSHOTS = false; boolean MONOPRESENT = false; boolean MAPSTATS = false; boolean TILESTATS = false; boolean HUD = false; boolean IS8250 = false; boolean dopefish; boolean newlevel = false; boolean infopause; boolean quiet = false; boolean DebugOk = false; #if (WHEREAMI==1) int programlocation=-1; #endif static boolean turbo; static int NoWait; static int startlevel=0; static int demonumber=-1; char CWD[40]; // curent working directory static boolean quitactive = false; int timelimit; int maxtimelimit; boolean timelimitenabled; boolean demoexit; boolean noecho; void CheckCommandLineParameters( void ); void PlayTurboGame( void ); void Init_Tables (void); void CheckRemoteRidicule ( int scancode ); void SetRottScreenRes (int Width, int Height); extern void crash_print (int); //extern int G_argc; //extern char G_argv[30][80]; int G_weaponscale; extern int iDropDemo; extern boolean iG_aimCross; extern boolean sdl_fullscreen; extern void ComSetTime ( void ); extern void VH_UpdateScreen (void); extern void RottConsole ( void ); extern void ReadDelay(long delay); extern void RecordDemoQuery ( void ); int main (int argc, char *argv[]) { extern char *BATTMAPS, *ROTTMAPS; _argc = argc; _argv = argv; signal (11, crash_print); ApogeePath = GetPrefDir(); // Set which release version we're on gamestate.Version = ROTTVERSION; #if ( SHAREWARE == 1 ) BATTMAPS = FindFileByName(STANDARDBATTLELEVELS); gamestate.Product = ROTT_SHAREWARE; #else BATTMAPS = FindFileByName(SITELICENSEBATTLELEVELS); gamestate.Product = ROTT_SITELICENSE; if (!BATTMAPS) { BATTMAPS = FindFileByName(SUPERROTTBATTLELEVELS); gamestate.Product = ROTT_SUPERCD; } if (!BATTMAPS) { BATTMAPS = FindFileByName(STANDARDBATTLELEVELS); gamestate.Product = ROTT_REGISTERED; } #endif if (!BATTMAPS) { Error("Standard battle levels not found: %s!", STANDARDBATTLELEVELS); } else { char *filename; datadir = M_DirName(BATTMAPS); filename = M_StringJoin(datadir, PATH_SEP_STR, STANDARDGAMELEVELS, NULL); ROTTMAPS = M_FileCaseExists(filename); if (!ROTTMAPS) { Error("Standard game levels not found: %s!", filename); } free(filename); } DrawRottTitle (); gamestate.randomseed=-1; gamestate.autorun = 0; StartupSoftError(); // UL_ErrorStartup (); CheckCommandLineParameters(); // Start up Memory manager with a certain amount of reserved memory Z_Init(50000,1000000); IN_Startup (); InitializeGameCommands(); if (standalone==false) { ReadConfig (); ReadSETUPFiles (); doublestep=0; SetupWads(); BuildTables (); GetMenuInfo (); } SetRottScreenRes (iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT); // if (modemgame==true) // { // SCREENSHOTS=true; // if (standalone==false) // { // MenuFixup (); // } // MAPSTATS=true; // } if (standalone==false) { int status2 = 0; if ( !NoSound && !IS8250 ) { if (!quiet) printf( "MU_Startup: " ); MU_Startup(false); if (!quiet) printf( "%s\n", MUSIC_ErrorString( MUSIC_Error ) ); } else if ( IS8250 ) { printf( "==============================================================================\n"); printf( "WARNING: 8250 detected.\n" ); printf( "Music has been disabled. This is necessary to maintain high interrupt\n" ); printf( "rates with the 8250 UART which will improve overall game performance.\n"); printf( " < Press any key to continue >\n"); printf( "==============================================================================\n"); getch(); } if (!NoSound) { int nv, nb, nc; if (!quiet) printf( "SD_SetupFXCard: " ); status2 = SD_SetupFXCard (&nv, &nb, &nc); if (!quiet) printf( "%s\n", FX_ErrorString( FX_Error ) ); if ( !status2 ) { if (!quiet) printf( "SD_Startup: " ); SD_Startup(false); if (!quiet) printf( "%s\n", FX_ErrorString( FX_Error ) ); } } else { if (!quiet) printf( "Sound FX disabled.\n" ); } Init_Tables (); InitializeRNG (); InitializeMessages(); LoadColorMap(); } if (infopause==true) { printf("\n< Press any key to continue >\n"); getch(); } I_StartupTimer(); I_StartupKeyboard(); locplayerstate = &PLAYERSTATE[consoleplayer]; if (standalone==true) ServerLoop(); VL_SetVGAPlaneMode(); VL_SetPalette(origpal); // SetTextMode(); // GraphicsMode(); // SetTextMode(); // VL_SetVGAPlaneMode(); // VL_SetPalette(origpal); // SetBorderColor(155); SetViewSize(8); playstate = ex_titles; // I_SetKeyboardLEDs( caps_lock, 0 ); gamestate.battlemode = battle_StandAloneGame; BATTLE_SetOptions( &BATTLE_Options[ battle_StandAloneGame ] ); if (turbo || tedlevel) { if (modemgame == true) { turbo = false; NoWait = true; } else { PlayTurboGame(); } } else { #if (SHAREWARE == 0) if ( dopefish == true ) { DopefishTitle(); } else if ( NoWait == false ) { ApogeeTitle(); } #else if ( NoWait == false ) { if (W_CheckNumForName("svendor") != -1) { lbm_t * LBM; LBM = (lbm_t *) W_CacheLumpName( "svendor", PU_CACHE, Cvt_lbm_t, 1); VL_DecompressLBM (LBM,true); I_Delay(40); MenuFadeOut(); } // ParticleIntro (); ApogeeTitle(); } #endif } GameLoop(); QuitGame(); return 0; } void DrawRottTitle ( void ) { char title[80]; char buf[5]; SetTextMode(); TurnOffTextCursor (); if (CheckParm("QUIET") == 0) { SetTextMode(); TurnOffTextCursor (); strcpy (title,"Rise of the Triad Startup Version "); strcat (title,itoa(ROTTMAJORVERSION,&buf[0],10)); strcat (title,"."); //MED #if (SHAREWARE==1)||(DOPEFISH==0) strcat (title,itoa(ROTTMINORVERSION,&buf[0],10)); #else strcat (title,"DFISH"); #endif strcat (title,"\n"); px=(80-strlen(title))>>1; py=0; UL_printf(title); memset (title,0,sizeof(title)); if (gamestate.Product == ROTT_SHAREWARE) { #if (DELUXE==1) strcpy(title,"Lasersoft Deluxe Version"); #elif (LOWCOST==1) strcpy(title,"Episode One"); #else strcpy(title,"Shareware Version"); #endif } else if (gamestate.Product == ROTT_SUPERCD) strcpy(title,"CD Version"); else if (gamestate.Product == ROTT_SITELICENSE) strcpy(title,"Site License CD Version"); else strcpy(title,"Commercial Version"); px=(80-strlen(title))>>1; py=1; UL_printf(title); printf ("\n"); printf("User dir: %s\nData dir: %s\n", ApogeePath, datadir); UL_ColorBox (0, 0, 80, 2, 0x1e); } else { TurnOffTextCursor (); } } void CheckCommandLineParameters( void ) { char *PStrings[] = {"TEDLEVEL","NOWAIT","NOSOUND","NOW", "TRANSPORT","DOPEFISH","SCREENSHOTS", "MONO","MAPSTATS","TILESTATS","VER","net", "PAUSE","SOUNDSETUP","WARP","IS8250","ENABLEVR", "TIMELIMIT","MAXTIMELIMIT","NOECHO","DEMOEXIT","QUIET",NULL}; int i,n; infopause=false; tedlevel=false; NoWait=false; NoSound=false; turbo=false; warp=false; dopefish=false; modemgame=false; SCREENSHOTS=false; MONOPRESENT=false; MAPSTATS=false; TILESTATS=false; IS8250 = false; vrenabled = false; demoexit = false; modemgame=false; networkgame=false; consoleplayer=0; numplayers = 1; timelimit=-1; timelimitenabled=false; noecho = false; quiet = false; if ( (CheckParm("?\0")) || (CheckParm("HELP")) || ( (_argc>1) && (_argv[1][0]=='?') ) ) { SetTextMode (); printf ("Rise of the Triad (c) 1995 Apogee Software\n\n"); printf ("COMMAND LINE PARAMETERS\n"); printf (" AIM - Give Aim Crosshair.\n"); printf (" FULLSCREEN - Start in fullscreen mode\n"); printf (" WINDOW - Start in windowed mode\n"); printf (" RESOLUTION - Specify the screen resolution to use\n"); printf (" - next param is , valid resolutions are:\n"); printf (" - 320x200 and 640x480\n"); #if (SHAREWARE==0) printf (" FILERTL - used to load Userlevels (RTL files)\n"); printf (" - next parameter is RTL filename\n"); printf (" FILERTC - used to load Battlelevels (RTC files)\n"); printf (" - next parameter is RTC filename\n"); printf (" FILE - used to load Extern WAD files\n"); printf (" - next parameter is WAD filename\n"); #endif printf (" NOJOYS - Disable check for joystick.\n"); printf (" NOMOUSE - Disable check for mouse.\n"); printf (" VER - Version number.\n"); printf (" MAPSTATS - Dump Map statistics to ERROR.\n"); printf (" TILESTATS - Dump Tile statistics to ERROR.\n"); printf (" MONO - Enable mono-monitor support.\n"); printf (" SCREENSHOTS- Clean screen capture for shots.\n"); printf (" PAUSE - Pauses startup screen information.\n"); printf (" ENABLEVR - Enable VR helmet input devices\n"); printf (" NOECHO - Turn off sound reverb\n"); printf (" DEMOEXIT - Exit program when demo is terminated\n"); printf (" WARP - Warp to specific ROTT level\n"); printf (" next parameter is level to start on\n"); printf (" TIMELIMIT - Play ROTT in time limit mode\n"); printf (" next parameter is time in seconds\n"); printf (" MAXTIMELIMIT - Maximum time to count down from\n"); printf (" next parameter is time in seconds\n"); printf (" DOPEFISH - ?\n"); printf (" \n"); printf ("CONTROLS\n"); printf (" Arrows - Move\n"); printf (" Ctrl - Fire\n"); printf (" Comma/Alt+left - Sidestep Left\n"); printf (" Period/Alt+right - Sidestep Right\n"); printf (" Shift - Run/Turn faster\n"); printf (" Space - Use/Open\n"); printf (" 1-4 - Choose Weapon\n"); printf (" 5-6 - Scale Weapon Up/Down\n"); printf (" Enter - Swap Weapon\n"); printf (" Backspace - Turn 180\n"); printf (" Delete - Drop Weapon\n"); printf (" +/- - Change Viewsize\n"); printf (" PgUp/PgDn - Look Up/Down\n"); printf (" Home/End - Aim Up/Down\n"); printf (" [ ] - Sound Volumen\n"); printf (" ( ) - Music Volumen\n"); printf (" Tab - Enter Automapper\n"); printf (" \n"); printf ("AUTO-MAPPER\n"); printf (" Arrows - Scroll around\n"); printf (" PgUp - Zoom Out\n"); printf (" PgDn - Zoom In\n"); printf (" Tab - Exit Auto-Mapper\n"); printf (" \n"); printf ("HOTKEYS\n"); printf (" F1 - Help\n"); printf (" F2 - Save Game\n"); printf (" F3 - Restore Game\n"); printf (" F4 - Controls/Sound/Music\n"); printf (" F5 - Change Detail Level\n"); printf (" F6 - Quick Save\n"); printf (" F7 - Messages On/Off\n"); printf (" F8 - End Game\n"); printf (" F9 - Quick Load\n"); printf (" F10 - Quit\n"); printf (" F11 - Gamma Correction\n"); printf (" \n"); printf ("COMM-BAT\n"); printf (" F1 - F10 - RemoteRidicule(tm) sounds\n"); printf (" F12 - Live RemoteRidicule\n"); printf (" T - Type message to all\n"); printf (" Z - Type directed message\n"); printf (" Tab - Toggle KillCount display\n"); printf (" \n"); printf ("SCREENSHOT\n"); printf (" Alt+C - Screenshot in BMP format\n"); exit (0); } // Check For command line parameters for (i = 1;i < _argc;i++) { n = US_CheckParm(_argv[i],PStrings); switch(n) { #if (TEDLAUNCH==1) case 0: tedlevelnum = ParseNum(_argv[i + 1]); tedlevel=true; if (i+3>=_argc) { tedx=0; tedy=0; } else { tedx=ParseNum(_argv[i + 2]); tedy=ParseNum(_argv[i + 3]); } MenuFixup (); break; #endif case 1: NoWait = true; break; case 2: NoSound = true; break; case 3: turbo = true; break; case 4: warp = true; warpx=ParseNum(_argv[i + 1]); warpy=ParseNum(_argv[i + 2]); warpa=ParseNum(_argv[i + 3]); break; case 5: dopefish=true; break; case 6: SCREENSHOTS = true; break; case 7: MONOPRESENT = true; break; case 8: MAPSTATS = true; break; case 9: TILESTATS = true; break; case 10: SetTextMode (); printf ("Rise of the Triad (c) 1995 Apogee Software\n"); //MED if (gamestate.Product == ROTT_SHAREWARE) { #if (DELUXE==1) printf("Lasersoft Deluxe "); #elif (LOWCOST==1) printf("Episode One "); #else printf("Shareware "); #endif } else if (gamestate.Product == ROTT_SUPERCD) printf("CD "); else if (gamestate.Product == ROTT_SITELICENSE) printf("Site License "); else printf("Commercial "); printf ("Version %d.%d\n", ROTTMAJORVERSION,ROTTMINORVERSION); exit (0); break; case 11: InitROTTNET(); numplayers = rottcom->numplayers; if (numplayers>MAXPLAYERS) Error("Too many players.\n"); if (!quiet) printf("Playing %ld player ROTT\n",(long int)numplayers); modemgame=true; if (rottcom->gametype==NETWORK_GAME) { if (!quiet) printf("NETWORK GAME\n"); networkgame=true; } else { if (!quiet) printf("MODEM GAME\n"); } break; case 12: infopause=true; break; case 13: break; case 14: startlevel = (ParseNum(_argv[i + 1])-1); break; case 15: IS8250 = true; break; case 16: vrenabled = true; if (!quiet) printf("Virtual Reality Mode enabled\n"); break; case 17: timelimitenabled = true; timelimit = ParseNum(_argv[i + 1]); if (!quiet) printf("Time Limit = %ld Seconds\n",(long int)timelimit); timelimit *= VBLCOUNTER; break; case 18: maxtimelimit = ParseNum(_argv[i + 1]); maxtimelimit *= VBLCOUNTER; break; case 19: noecho = true; break; case 20: demoexit = true; break; case 21: quiet = true; break; } } } void SetupWads( void ) { char *newargs[99]; int i, arg, argnum = 0; char *tempstr = NULL, *filename; char *PStrings[] = {"AIM", "FULLSCREEN", "WINDOW", "RESOLUTION", NULL }; // These must be checked here so that they can override the cfg file for (i = 1;i < _argc;i++) { arg = US_CheckParm(_argv[i],PStrings); switch(arg) { case 0: iG_aimCross = 1; break; case 1: sdl_fullscreen = 1; break; case 2: sdl_fullscreen = 0; break; case 3: i++; if (i < _argc) { int width, height; if ( (sscanf(_argv[i], "%dx%d", &width, &height) == 2) && ( ( (width == 320) && (height == 200) ) || ( (width == 640) && (height == 480) ) ) ) { iGLOBAL_SCREENWIDTH = width; iGLOBAL_SCREENHEIGHT = height; } else printf("Invalid resolution parameter: %s\n", _argv[i]); } else printf("Missing resolution parameter\n"); break; } } #if (SHAREWARE==0) // Check for rtl files arg = CheckParm ("filertl"); if (arg!=0) { FILE *f;char *buf = malloc(32); if (_argv[arg+1] != 0) { //are there a filename included tempstr = safe_realloc(tempstr, 129 + strlen(_argv[arg+1])); strcpy (tempstr,_argv[arg+1]);//copy it to tempstr if (strlen (tempstr) < MAX_PATH) { if (access (tempstr, 0) != 0) { //try open strcat (tempstr,".rtc");//non exists, try add .rtc if (access (tempstr, 0) != 0) { //try open again //stil no useful filename strcat (tempstr," not found, skipping RTL file "); printf("%s", tempstr); goto NoRTL; } } if((f = fopen( tempstr, "r" )) == NULL ){ //try opnong file strcat (tempstr," not could not be opened, skipping RTL file "); printf("%s", tempstr); goto NoRTL; }else{ fread(buf,3,3,f);//is the 3 first letters RTL (RTC) if (((strstr(buf,"RTL") != 0)||strstr(buf,"RTC") != 0)) { GameLevels.file = strdup(tempstr); GameLevels.avail++; buf = safe_realloc(buf, 32 + strlen(tempstr)); strcpy (buf,"Adding "); strcat (buf,tempstr); printf("%s", buf); } fclose(f); } } }else{printf("Missing RTL filename");} free(buf); } NoRTL:; // Check for rtc files arg = CheckParm ("filertc"); if (arg!=0) { FILE *f;char *buf = malloc(32); if (_argv[arg+1] != 0) { //are there a filename included tempstr = safe_realloc(tempstr, 129 + strlen(_argv[arg+1])); strcpy (tempstr,_argv[arg+1]);//copy it to tempstr if (strlen (tempstr) < MAX_PATH) { if (access (tempstr, 0) != 0) { //try open strcat (tempstr,".rtc");//non exists, try add .rtc if (access (tempstr, 0) != 0) { //try open again //stil no useful filename strcat (tempstr," not found, skipping RTC file "); printf("%s", tempstr); goto NoRTC; } } if((f = fopen( tempstr, "r" )) == NULL ){ //try opening file strcat (tempstr," not could not be opened, skipping RTC file "); printf("%s", tempstr); goto NoRTC; }else{ fread(buf,3,3,f);//is the 3 first letters RTL (RTC) if (((strstr(buf,"RTL") != 0)||strstr(buf,"RTC") != 0)) { BattleLevels.file = strdup(tempstr); BattleLevels.avail++; buf = safe_realloc(buf, 32 + strlen(tempstr)); strcpy (buf,"Adding "); strcat (buf,tempstr); printf("%s", buf); } fclose(f); } } }else{printf("Missing RTC filename");} free(buf); } NoRTC:; // Check for User wads arg = CheckParm ("file"); if (arg!=0) { newargs [argnum++] = _argv[arg+1]; } arg = CheckParm ("file1"); if (arg!=0) { newargs [argnum++] = _argv[arg+1]; } arg = CheckParm ("file2"); if (arg!=0) { newargs [argnum++] = _argv[arg+1]; } #else if ( (CheckParm ("file") > 0) || (CheckParm ("file1") > 0) || (CheckParm ("file2") > 0) ) printf("External wads ignored.\n"); #endif // Normal ROTT wads #if (SHAREWARE) filename = M_StringJoin(datadir, PATH_SEP_STR, "HUNTBGIN.WAD", NULL); #else filename = M_StringJoin(datadir, PATH_SEP_STR, "DARKWAR.WAD", NULL); #endif newargs [argnum++] = M_FileCaseExists(filename); free(filename); // newargs [argnum++] = "credits.wad"; // Check for Remote Ridicule WAD if (RemoteSounds.avail == true) { char *src; tempstr = safe_realloc(tempstr, strlen(RemoteSounds.path) + strlen(RemoteSounds.file) + 2); strcpy (tempstr,RemoteSounds.path); src = RemoteSounds.path + strlen(RemoteSounds.path) - 1; if (*src != '\\') strcat (tempstr,"\\\0"); strcat (tempstr,RemoteSounds.file); newargs [argnum++] = strdup(tempstr); } else { filename = M_StringJoin(datadir, PATH_SEP_STR, "REMOTE1.RTS", NULL); newargs [argnum++] = M_FileCaseExists(filename); free(filename); } if (tempstr) free(tempstr); newargs [argnum++] = NULL; W_InitMultipleFiles(newargs); } void PlayTurboGame ( void ) { NewGame = true; locplayerstate->player = DefaultPlayerCharacter; playstate = ex_resetgame; GameLoop(); } //*************************************************************************** // // Init_Tables () - Init tables needed for double buffering // //*************************************************************************** void Init_Tables (void) { int i; int x, y; unsigned *blockstart; byte * shape; memset (&CWD[0], 0, 40); getcwd (CWD, 40); // get the current directory origpal=SafeMalloc(768); memcpy (origpal, W_CacheLumpName("pal",PU_CACHE, CvtNull, 1), 768); FindEGAColors(); for (i=0;i>2; // Cache in fonts shape = W_CacheLumpNum (W_GetNumForName ("smallfont"), PU_STATIC, Cvt_font_t, 1); smallfont = (font_t *)shape; CurrentFont = smallfont; // Cache in tiny font shape = W_CacheLumpNum (W_GetNumForName ("tinyfont"), PU_STATIC, Cvt_font_t, 1); tinyfont = (font_t *)shape; intensitytable=W_CacheLumpNum(W_GetNumForName("menucmap"),PU_STATIC, CvtNull, 1); fontcolor = egacolor[4]; if (!quiet) printf("RT_MAIN: Fonts Initialized\n"); } int NumberOfTeams ( void ) { int index; int team[ MAXPLAYERCOLORS ]; int count; int color; memset( team, 0, sizeof( team ) ); count = 0; for( index = 0; index < numplayers; index++ ) { color = PLAYERSTATE[ index ].uniformcolor; if ( !team[ color ] ) { team[ color ] = true; count++; } } return( count ); } void GameLoop (void) { int NextLevel; wami(1); while (1) { if ( playstate == ex_battledone ) { while( damagecount > 0 ) { DoBorderShifts(); } damagecount = 0; SetBorderColor (0); StopWind(); ShutdownClientControls(); SD_Play (SD_LEVELDONESND); if ( ( player->flags & FL_DOGMODE ) || ( gamestate.battlemode == battle_Eluder ) ) MU_StartSong(song_dogend); else MU_StartSong(song_endlevel); VL_FillPalette(255,255,255); VL_FadeIn(0,255,origpal,10); BattleLevelCompleted( consoleplayer ); BATTLE_Shutdown(); Z_FreeTags (PU_LEVELSTRUCT, PU_LEVELEND); // Free current level ingame = false; if ( networkgame == true ) { AddGameEndCommand (); } AdjustMenuStruct (); CalcTics(); CalcTics(); playstate = ex_titles; } switch (playstate) { case ex_titles: BATTLE_Shutdown(); MU_StartSong(song_title); EnableScreenStretch(); if ((NoWait==false)&&(!modemgame)) { byte dimpal[768]; int i; for (i = 0; i < 0x300; i++) dimpal[i] = origpal[i]>>2; CalcTics(); CalcTics(); IN_ClearKeysDown (); while (IN_GetMouseButtons()) {} while ((!LastScan) && (!IN_GetMouseButtons())) { int i; byte *tempbuf; MenuFadeOut(); ClearGraphicsScreen(); SetPalette(&dimpal[0]); PlayMovie ("shartitl", true); if ( ( LastScan ) || ( IN_GetMouseButtons() ) ) { break; } PlayMovie ("shartit2", true); if ( ( LastScan ) || ( IN_GetMouseButtons() ) ) { break; } SD_Play (SD_LIGHTNINGSND); MenuFadeIn(); I_Delay(30); SD_Play (SD_ACTORSQUISHSND); tempbuf=bufferofs; bufferofs=page1start; // fixed, was displayofs DrawNormalSprite(320-94,200-41,W_GetNumForName("rsac")); VW_UpdateScreen(); // fixed, was missing bufferofs=tempbuf; I_Delay(30); if ( ( LastScan ) || ( IN_GetMouseButtons() ) ) { break; } DoCreditScreen (); if ((!LastScan) && (!IN_GetMouseButtons())) CheckHighScore (0, 0, false); #if (SHAREWARE==0) if ((!LastScan) && (!IN_GetMouseButtons())) { DoMicroStoryScreen (); } #endif if ( (!LastScan) && (!IN_GetMouseButtons()) && (GameLevels.avail==false) ) { if (demonumber==-1) demonumber=RandomNumber("GameLoop",0); for (i=0;i<4;i++) { demonumber=(demonumber+1)%4; if (DemoExists (demonumber+1) == true) break; } if (DemoExists (demonumber+1) == true) { ingame=true; LoadDemo (demonumber+1); break; } } } } if (playstate != ex_demoplayback) { if (demoexit == true) { QuitGame(); } NoWait = false; SwitchPalette(origpal,35); CP_MainMenu(); } break; case ex_resetgame: // SetTextMode ( ); //12345678 EnableScreenStretch();//bna++ shut on streech mode InitCharacter(); InitializeMessages(); fizzlein = true; BATTLE_GetSpecials(); BATTLE_SetOptions( &BATTLE_Options[ gamestate.battlemode ] ); if ( modemgame == true ) { fizzlein = false; if ( consoleplayer == 0 ) { // Setup Master SetupGameMaster(); } else { // Setup slave SetupGamePlayer(); } if ( gamestate.Version < ROTTVERSION ) { Error( "This version of Rise of the Triad (%d.%d) is incompatible with\n" "version %d.%d.", ROTTMAJORVERSION, ROTTMINORVERSION, gamestate.Version / 10, gamestate.Version % 10 ); } if ( gamestate.teamplay ) { int teams; teams = NumberOfTeams(); if ( gamestate.battlemode == battle_CaptureTheTriad ) { if ( teams != 2 ) { CP_CaptureTheTriadError(); playstate = ex_titles; continue; } } else if ( teams < 2 ) { CP_TeamPlayErrorMessage(); playstate = ex_titles; continue; } } } InitCharacter(); BATTLE_Init( gamestate.battlemode, numplayers ); NewGame = true; if ( ( BATTLEMODE ) && ( BATTLE_ShowKillCount ) ) { StatusBar |= STATUS_KILLS; } else { StatusBar &= ~STATUS_KILLS; } if (loadedgame == false) { if ( !BATTLEMODE ) { PlayCinematic(); } SetupGameLevel(); } IN_ClearKeyboardQueue(); SetupScreen (true); MenuFixup (); playstate=ex_stillplaying; DisableScreenStretch();//bna++ shut off streech mode break; case ex_stillplaying: InitializeMessages(); SHAKETICS = 0xFFFF; if (modemgame==true) { ComSetTime(); turbo = false; } else if (turbo==true) turbo=false; else newlevel=true; PlayLoop (); break; case ex_died: Died (); StopWind(); DisableScreenStretch();//bna++ shut off streech mode while (damagecount>0) DoBorderShifts(); damagecount = 0; SetBorderColor (0); if (demorecord) { FreeDemo (); } if (demoplayback) { FreeDemo (); playstate=ex_demodone; } else { ShutdownClientControls(); Z_FreeTags (PU_LEVELSTRUCT, PU_LEVELEND); // Free current level if (CheckForQuickLoad()==false) { if (locplayerstate->lives < 0) { if (timelimitenabled == false) { CheckHighScore (gamestate.score, gamestate.mapon+1, false); playstate = ex_titles; AdjustMenuStruct (); ingame = false; locplayerstate->health = MaxHitpointsForCharacter(locplayerstate); gamestate.score = 0; locplayerstate->lives = 3; locplayerstate->weapon = wp_pistol; locplayerstate->triads = 0; UpdateLives (locplayerstate->lives); UpdateScore (gamestate.score); } else { QuitGame(); } } else { fizzlein = true; SetupGameLevel (); UpdateTriads(player,0); playstate = ex_stillplaying; } } } break; case ex_warped: StopWind(); TurnShakeOff(); SHAKETICS = 0xffff; gamestate.TimeCount = 0; gamestate.frame=0; Z_FreeTags (PU_LEVELSTRUCT, PU_LEVELEND); // Free current level fizzlein = true; SetupGameLevel (); playstate = ex_stillplaying; break; case ex_skiplevel: case ex_secretdone: case ex_secretlevel: case ex_completed: case ex_bossdied: ShutdownClientControls(); TurnShakeOff(); SHAKETICS = 0xffff; if (timelimitenabled == false) { gamestate.TimeCount = 0; gamestate.frame=0; } StopWind(); #if (SHAREWARE==0) if ((playstate==ex_bossdied) && (gamestate.mapon!=30)) { int shape; lbm_t * LBM; byte *s; patch_t *p; char str[50]; int width, height; LBM = (lbm_t *) W_CacheLumpName( "deadboss", PU_CACHE, Cvt_lbm_t, 1); VL_DecompressLBM (LBM,false); MenuFadeOut(); switch (gamestate.mapon) { case 6: shape = W_GetNumForName("deadstev"); break; case 14: shape = W_GetNumForName("deadjoe"); break; case 22: shape = W_GetNumForName("deadrobo"); break; case 33: shape = W_GetNumForName("deadtom"); break; // default: // Error("Boss died on an illegal level\n"); // break; } s = W_CacheLumpNum (shape, PU_CACHE, Cvt_patch_t, 1); p = (patch_t *)s; DrawNormalSprite ((320-p->origsize)>>1, (230-(p->height-p->topoffset))>>1, shape); switch (gamestate.mapon) { case 6: strcpy(&str[0],"\"General\" John Darian"); break; case 14: strcpy(&str[0],"Sebastian \"Doyle\" Krist"); break; case 22: strcpy(&str[0],"the NME"); break; case 33: strcpy(&str[0],"El Oscuro"); break; // default: // Error("Boss died on an illegal level\n"); // break; } CurrentFont=smallfont; US_MeasureStr (&width, &height, "%s", str); US_ClippedPrint ((320-width)>>1, 180, str); VW_UpdateScreen(); MenuFadeIn(); WaitKeyUp(); LastScan = 0; while (!LastScan) IN_UpdateKeyboard(); // Thanks again DrLex LastScan=0; } #endif LevelCompleted ( playstate ); NextLevel = GetNextMap(player->tilex,player->tiley); demoplayback = false; Z_FreeTags (PU_LEVELSTRUCT, PU_LEVELEND); // Free current level if (NextLevel != -1 ) { gamestate.mapon = NextLevel; PlayCinematic(); fizzlein = true; SetupGameLevel (); playstate = ex_stillplaying; } else { playstate = ex_gameover; } break; case ex_demodone: ingame=false; ShutdownClientControls(); TurnShakeOff(); SHAKETICS = 0xffff; gamestate.TimeCount = 0; gamestate.frame=0; demoplayback = false; Z_FreeTags (PU_LEVELSTRUCT, PU_LEVELEND); // Free current level if (predemo_violence != -1) { gamestate.violence = predemo_violence; predemo_violence = -1; } playstate=ex_titles; break; case ex_gameover: StopWind(); DoEndCinematic(); if (playstate==ex_gameover) { CheckHighScore (gamestate.score, gamestate.mapon+1, false); ingame = false; AdjustMenuStruct (); playstate = ex_titles; } break; case ex_demorecord: ShutdownClientControls(); Z_FreeTags (PU_LEVELSTRUCT, PU_LEVELEND); // Free current level RecordDemo(); SetupGameLevel (); fizzlein = true; playstate = ex_stillplaying; break; case ex_demoplayback: ShutdownClientControls(); Z_FreeTags (PU_LEVELSTRUCT, PU_LEVELEND); // Free current level SetupDemo(); SetupGameLevel (); fizzlein = true; playstate = ex_stillplaying; break; default: ; } } waminot(); } boolean CheckForQuickLoad (void ) { EnableScreenStretch();//bna++ if ( pickquick ) { SetupMenuBuf(); pickquick = CP_DisplayMsg( "\nQuick load saved game?\n", 12 ); if ( pickquick ) { AllocateSavedScreenPtr(); CP_LoadGame( 1, 1 ); FreeSavedScreenPtr(); } else { // Erase the quick load message VL_FadeOut( 0, 255, 0, 0, 0, 20 ); } ShutdownMenuBuf(); } return( pickquick ); } //=========================================================================== void ShutDown ( void ) { if ( standalone == false ) { WriteConfig (); } // if ( // (networkgame==false) && // (modemgame==true) // ) // { // ShutdownModemGame (); // } ShutdownClientControls(); I_ShutdownKeyboard(); ShutdownGameCommands(); MU_Shutdown(); I_ShutdownTimer(); SD_Shutdown(); IN_Shutdown (); ShutdownSoftError (); Z_ShutDown(); // _settextcursor (0x0607); } //=========================================================================== void QuitGame ( void ) { MU_FadeOut(200); while (MU_FadeActive()) { int time=GetTicCount(); while (GetTicCount()==time) {} } PrintMapStats(); PrintTileStats(); SetTextMode(); exit(0); } void InitCharacter ( void ) { locplayerstate->health = MaxHitpointsForCharacter( locplayerstate ); if (timelimitenabled == true) { locplayerstate->lives = 1; } else { locplayerstate->lives = 3; } ClearTriads (locplayerstate); locplayerstate->playerheight = characters[ locplayerstate->player ].height; // locplayerstate->stepwhich = 0; // locplayerstate->steptime = 0; gamestate.score = 0; if ( gamestate.battlemode == battle_StandAloneGame ) { gamestate.mapon = startlevel; gamestate.difficulty = DefaultDifficulty; } else { gamestate.difficulty = gd_hard; } gamestate.dipballs = 0; gamestate.TimeCount = 0; godmode = 0; damagecount = 0; UpdateScore( gamestate.score ); } void UpdateGameObjects ( void ) { int j; volatile int atime; objtype * ob,*temp; battle_status BattleStatus; wami(2); if (controlupdatestarted==0) { return; waminot(); } atime=GetFastTics(); UpdateClientControls (); if (demoplayback == false) PollControls (); CalcTics (); UpdateClientControls (); while (oldpolltimenextactive; DoActor (ob); ob = temp; } BattleStatus = BATTLE_CheckGameStatus( battle_refresh, 0 ); if ( BattleStatus != battle_no_event ) { switch( BattleStatus ) { case battle_end_game : case battle_out_of_time : playstate = ex_battledone; break; case battle_end_round : SetWhoHaveWeapons(); break; default: ; } if ( playstate == ex_battledone ) { break; } } if (timelimitenabled == true) { if (timelimit-gamestate.TimeCount>maxtimelimit) timelimit = maxtimelimit+gamestate.TimeCount; if (gamestate.TimeCount == timelimit) { locplayerstate->lives=-1; playstate=ex_died; } } gamestate.TimeCount ++; ResetCurrentCommand(); oldpolltime++; if (GamePaused==true) break; } actortime=GetFastTics()-atime; UpdateClientControls (); if (noecho == false) { if ( player->flags & FL_SHROOMS ) { FX_SetReverb( 230 ); } else if (sky == 0) { FX_SetReverb( min( numareatiles[ player->areanumber ] >> 1, 90 ) ); } } waminot(); } void PauseLoop ( void ) { StopWind(); UpdateClientControls (); while (oldpolltime 320)){ pic_t *shape; shape = ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 ); DrawTiledRegion( 0, 16, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 32, 0, 16, shape ); DisableScreenStretch();//dont strech when we go BACK TO GAME DrawPlayScreen(true);//repaint ammo and life stat VW_UpdateScreen ();//update screen } StartupClientControls(); //bna section end break; } } CalcTics (); if (demoplayback==false) PollControls (); if ((RefreshPause == true) && (GamePaused == true) && ((GetTicCount() - pausedstartedticcount) >= blanktime)) { RefreshPause = false; StartupScreenSaver(); } } void PlayLoop ( void ) { volatile int atime; boolean canquit = true; int quittime = 0; wami(3); if ( (loadedgame == false) && (timelimitenabled == false) ) { gamestate.TimeCount = 0; gamestate.frame = 0; } fromloadedgame: GamePaused = false; if ( loadedgame == false ) { DrawPlayScreen( true ); missobj = NULL; } else { loadedgame = false; DoLoadGameSequence(); } drawtime = 0; actortime = 0; tics = 0; SetFastTics(0); if ( fizzlein == false ) { StartupClientControls(); } else { ShutdownClientControls(); } // set detail level doublestep = 2 - DetailLevel; ResetMessageTime(); DeletePriorityMessage( MSG_SYSTEM ); if ( ( gamestate.battlemode == battle_Normal ) && ( numplayers == 1 ) ) { AddMessage( "Comm-bat is for Modem and Network games.", MSG_GAME ); AddMessage( "You will not be facing any", MSG_GAME ); AddMessage( "opponents. Have fun and explore.", MSG_GAME ); } while( playstate == ex_stillplaying ) { UpdateClientControls(); if ( GamePaused ) { PauseLoop(); atime = GetFastTics(); if ( RefreshPause ) { ThreeDRefresh(); } else { UpdateScreenSaver(); } } else { if (controlupdatestarted == 1) UpdateGameObjects(); atime = GetFastTics(); ThreeDRefresh(); } SyncToServer(); drawtime = GetFastTics() - atime; // Don't allow player to quit if entering message canquit = !MSG.messageon; PollKeyboard(); MISCVARS->madenoise = false; AnimateWalls(); UpdateClientControls(); if ( AutoDetailOn == true ) { AdaptDetail(); } UpdateClientControls(); DoSprites(); DoAnimatedMaskedWalls(); UpdatePlayers(); DrawTime( false ); UpdateClientControls(); if ( ( !BATTLEMODE ) && ( CP_CheckQuick( LastScan ) ) ) { boolean escaped=false; if (LastScan == sc_Escape) { MU_StoreSongPosition(); MU_StartSong(song_menu); escaped = true; } TurnShakeOff(); StopWind(); SetBorderColor( 0 ); ShutdownClientControls(); if (demoplayback==true) { FreeDemo(); playstate = ex_demodone; if (demoexit==true) { QuitGame(); } return; } ControlPanel( LastScan ); // set detail level doublestep = 2 - DetailLevel; inmenu = false; if ( playstate == ex_titles ) { return; } if ( playstate == ex_stillplaying ) { SetupScreen( false ); } if ( loadedgame == true ) { goto fromloadedgame; } if ( ( playstate == ex_stillplaying ) && ( ( fizzlein == false ) || ( GamePaused ) ) ) { StartupClientControls(); } if ( (playstate == ex_stillplaying) && (GamePaused == false) && (escaped == true) ) { MU_StartSong(song_level); MU_RestoreSongPosition(); } } if ( BATTLEMODE ) { if ( MSG.messageon == false ) { CheckRemoteRidicule( LastScan ); } if ( quitactive == false ) { if ( ( LastScan == sc_Escape ) && ( canquit ) ) { quitactive = true; quittime = GetTicCount() + QUITTIMEINTERVAL; if ( (consoleplayer == 0) || (networkgame == false) ) { AddMessage( "Do you want to end this game? " "(\\FY\\O/\\FN\\O)", MSG_QUIT ); } else { AddMessage( "Do you want to exit to DOS? " "(\\FY\\O/\\EN\\O)", MSG_QUIT ); } } } else { if ( GetTicCount() > quittime ) { quitactive = false; } else if ( LastScan == sc_N ) { DeletePriorityMessage( MSG_QUIT ); quitactive = false; } else if ( LastScan == sc_Y ) { DeletePriorityMessage( MSG_QUIT ); if ( (consoleplayer == 0) || (networkgame==false) ) { AddEndGameCommand(); } else { AddQuitCommand(); } } } } } waminot(); } //****************************************************************************** // // CheckRemoteRidicule () // //****************************************************************************** void CheckRemoteRidicule ( int scancode ) { int num=-1; wami(4); switch (scancode) { case sc_F1: num=0; break; case sc_F2: num=1; break; case sc_F3: num=2; break; case sc_F4: num=3; break; case sc_F5: if ( !Keyboard[ sc_RShift ] ) { num=4; } break; case sc_F6: num=5; break; case sc_F7: if ( !Keyboard[ sc_RShift ] ) { num=6; } break; case sc_F8: num=7; break; case sc_F9: num=8; break; case sc_F10: num=9; break; } if (num>=0) { AddRemoteRidiculeCommand ( consoleplayer, MSG_DIRECTED_TO_ALL, num ); LastScan=0; } waminot(); } //****************************************************************************** // // DoBossKey () // //****************************************************************************** void DoBossKey ( void ) { STUB_FUNCTION; } //****************************************************************************** // // PollKeyboard () // //****************************************************************************** void PollKeyboard ( void ) { static char autopressed = false; wami(5); if (demoplayback==true) { IN_UpdateKeyboard(); } if ( !BATTLEMODE ) { CheckDebug (); if ( ( Keyboard[ sc_CapsLock ] ) && ( DebugOk ) ) { DebugKeys (); } } if ( locplayerstate->buttonstate[ bt_autorun ] ) { if ( !autopressed ) { autopressed = true; gamestate.autorun ^= 1; if ( gamestate.autorun == 0 ) { AddMessage( "AutoRun is \\cOFF", MSG_SYSTEM ); } else { AddMessage( "AutoRun is \\cON", MSG_SYSTEM ); } } } else { autopressed = false; } if ( ( MSG.messageon == false ) && ( !quitactive ) ) { if ( ( Keyboard[ buttonscan[ bt_message ] ] ) && ( BATTLEMODE ) ) { // Send message to all MSG.messageon = true; MSG.directed = false; MSG.inmenu = false; MSG.remoteridicule = -1; MSG.towho = MSG_DIRECTED_TO_ALL; MSG.textnum = AddMessage( "_", MSG_MODEM ); MSG.length = 1; DeletePriorityMessage( MSG_MACRO ); } else if ( ( Keyboard[ buttonscan[ bt_directmsg ] ] ) && ( BATTLEMODE ) ) { // Send directed message MSG.messageon = true; MSG.directed = true; MSG.inmenu = false; MSG.remoteridicule = -1; MSG.towho = 0; MSG.textnum = AddMessage( "_", MSG_MODEM ); MSG.length = 1; DeletePriorityMessage( MSG_MACRO ); } if ( buttonpoll[ bt_map ] ) { if ( !BATTLEMODE ) { // Automap StopWind(); DoMap( player->tilex, player->tiley ); } else { // Show kill counts if ( SHOW_KILLS() ) { BATTLE_ShowKillCount = false; StatusBar &= ~STATUS_KILLS; } else { StatusBar |= STATUS_KILLS; BATTLE_ShowKillCount = true; } SetupScreen( true ); } } // Shrink screen if ( Keyboard[ sc_Minus ] ) { Keyboard[ sc_Minus ] = false; // HDG debounce if ( viewsize > 0 ) { viewsize--; SetupScreen( true ); } } // Expand screen if ( Keyboard[ sc_Plus ] ) { Keyboard[ sc_Plus ] = false; // HDG debounce if ( viewsize < MAXVIEWSIZES - 1 ) { viewsize++; SetupScreen( true ); } } // Set detail if ( ( Keyboard[ sc_F5 ] ) && ( ( !BATTLEMODE ) || ( Keyboard[ sc_RShift ] ) ) ) { Keyboard[ sc_F5 ] = false; LastScan = 0; DetailLevel++; if ( DetailLevel > 2 ) { DetailLevel = 0; } switch( DetailLevel ) { case 0 : AddMessage( "Low detail", MSG_SYSTEM ); break; case 1 : AddMessage( "Medium detail", MSG_SYSTEM ); break; case 2 : AddMessage( "High detail", MSG_SYSTEM ); break; } doublestep = 2 - DetailLevel; } // Turn messages on/off if ( ( Keyboard[ sc_F7 ] ) && ( ( !BATTLEMODE ) || ( Keyboard[ sc_RShift ] ) ) ) { Keyboard[ sc_F7 ] = false; LastScan = 0; MessagesEnabled = !MessagesEnabled; if ( !MessagesEnabled ) { AddMessage( "Messages disabled.", MSG_MSGSYSTEM ); } else { AddMessage( "Messages enabled.", MSG_MSGSYSTEM ); } } if ( ( Keyboard[ sc_F6 ] ) && ( !BATTLEMODE ) ) { Keyboard[ sc_F6 ] = false; if (Keyboard[sc_RShift]) { ShutdownClientControls(); UndoQuickSaveGame(); StartupClientControls(); } else if (quicksaveslot==-1) { ShutdownClientControls(); LastScan=sc_F2; inmenu = true; ControlPanel( LastScan ); StartupClientControls(); } else { LastScan = 0; ShutdownClientControls(); ThreeDRefresh(); QuickSaveGame(); StartupClientControls(); } } //#if 0 if ( ( Keyboard[ sc_F12 ] ) && ( !BATTLEMODE ) ) { Keyboard[ sc_F12 ] = false; LastScan = 0; DoBossKey(); } //#endif // Gamma correction if ( Keyboard[ sc_F11 ] ) { char str[ 50 ] = "Gamma Correction Level "; char str2[ 10 ]; gammaindex++; if ( gammaindex == NUMGAMMALEVELS ) { gammaindex = 0; } VL_SetPalette( origpal ); itoa( gammaindex, str2, 10 ); strcat( str, str2 ); AddMessage( str, MSG_SYSTEM ); while( Keyboard[ sc_F11 ] ) { IN_UpdateKeyboard(); } } // Increase volume if ( Keyboard[ sc_CloseBracket ] ) { if ( Keyboard[ sc_RShift ] ) { char str[ 50 ] = "Music Volume Level "; char str2[ 10 ]; if ( MUvolume < 255 ) { MUvolume++; } MU_SetVolume( MUvolume ); itoa( MUvolume, str2, 10 ); strcat( str, str2 ); AddMessage( str, MSG_SYSTEM ); } else { char str[ 50 ] = "Sound FX Volume Level "; char str2[ 10 ]; if ( FXvolume < 255 ) { FXvolume++; } FX_SetVolume( FXvolume ); itoa( FXvolume, str2, 10 ); strcat( str, str2 ); AddMessage( str, MSG_SYSTEM ); } } // Decrease volume if ( Keyboard[ sc_OpenBracket ] ) { if ( Keyboard[ sc_RShift ] ) { char str[ 50 ] = "Music Volume Level "; char str2[ 10 ]; if ( MUvolume > 0 ) { MUvolume--; } MU_SetVolume( MUvolume ); itoa( MUvolume, str2, 10 ); strcat( str, str2 ); AddMessage( str, MSG_SYSTEM ); } else { char str[ 50 ] = "Sound FX Volume Level "; char str2[ 10 ]; if ( FXvolume > 0 ) { FXvolume--; } FX_SetVolume( FXvolume ); itoa( FXvolume, str2, 10 ); strcat( str, str2 ); AddMessage( str, MSG_SYSTEM ); } } else if ( Keyboard[ sc_Alt] && Keyboard[ sc_C ] ) { SaveScreen(false); } } /* SDL doesn't send proper release events for these */ if (Keystate[sc_CapsLock]) { Keystate[sc_CapsLock]++; if (Keystate[sc_CapsLock] == 3) Keystate[sc_CapsLock] = 0; } if (Keystate[0x45]) /* numlock */ { Keystate[0x45]++; if (Keystate[0x45] == 3) Keystate[0x45] = 0; } waminot(); } //**************************************************************************** // // SaveScreen () // //**************************************************************************** void SaveScreen (boolean inhmenu) { static int shot; char filename[16] = {0}; int tries = 10000; char *screenshotname = NULL; const boolean oldHUD = HUD; int err = 1; extern int VL_SaveBMP (const char *file); HUD = false; if (inhmenu == false) { ThreeDRefresh(); } do { M_snprintf(filename, sizeof(filename), "rott%04d.bmp", shot++); if (screenshotname) { free(screenshotname); } screenshotname = M_StringJoin(ApogeePath, PATH_SEP_STR, filename, NULL); } while (!access(screenshotname, F_OK) && --tries); if (tries) { err = VL_SaveBMP(screenshotname); } if (err == 0) { char str[50]; M_snprintf(str, sizeof(str), "Screenshot \\c%s saved.", filename); AddMessage(str, MSG_SYSTEM); } else { unlink(screenshotname); AddMessage("Could not take screenshot.", MSG_SYSTEM); } if (screenshotname) { free(screenshotname); } HUD = oldHUD; } //**************************************************************************** // // PlayCinematic () - Play intro cinematics // //**************************************************************************** void PlayCinematic (void) { if ((tedlevel == true) || (turbo == true)) return; switch (gamestate.mapon) { #if (SHAREWARE == 0) byte pal[768]; case 0: // Start of EPISODE 1 MU_StartSong ( song_cinematic1 ); VL_FadeOut (0, 255, 0, 0, 0, 20); VL_ClearBuffer (bufferofs, 0); DrawNormalSprite(0,30,W_GetNumForName("nicolas")); DrawNormalSprite(0,168,W_GetNumForName("oneyear")); FlipPage(); memcpy(&pal[0],W_CacheLumpName("nicpal",PU_CACHE, CvtNull, 1),768); VL_NormalizePalette(&pal[0]); VL_FadeIn(0,255,pal,20); I_Delay (60); VL_FadeOut (0, 255, 0, 0, 0, 20); IN_UpdateKeyboard(); if (LastScan!=0) { LastScan=0; return; } SD_PlayPitchedSound(SD_LIGHTNINGSND,255,-1500); DoInBetweenCinematic (20, W_GetNumForName("binoculr"), 80, "The HUNT cases an\n" "ancient monastery." ); IN_UpdateKeyboard(); if (LastScan!=0) { LastScan=0; return; } SD_Play(SD_NMESEESND); DoInBetweenCinematic (20, W_GetNumForName("binosee"), 80, "\"There they are,\" says\n" "Cassatt. \"Let's get back\n" "to the boat and inform HQ.\"" ); IN_UpdateKeyboard(); if (LastScan!=0) { LastScan=0; return; } SD_Play(SD_HIGHGUARD1SEESND); DoInBetweenCinematic (20, W_GetNumForName("boatgard"), 80, "\"The intruders, on that hill!\"" ); IN_UpdateKeyboard(); if (LastScan!=0) { LastScan=0; return; } SD_Play(SD_EXPLODESND); DoInBetweenCinematic (20, W_GetNumForName("boatblow"), 80, "\"There goes our ride home,\"\n" "says Barrett. \"Looks like\n" "the only way out is in....\"" ); IN_UpdateKeyboard(); LastScan=0; break; case 8: // Start of EPISODE 2 MU_StartSong ( song_cinematic2 ); DoInBetweenCinematic (0, W_GetNumForName("epi12"), 1200, "The HUNT makes their way\n" "into the main keep." ); IN_UpdateKeyboard(); LastScan=0; break; case 16: // Start of EPISODE 3 MU_StartSong ( song_cinematic1 ); DoInBetweenCinematic (20, W_GetNumForName("epi23"), 1200, "The HUNT stands before a pair\n" "of ominous wooden doors.\n" "The sounds of machinery and\n" "servomotors fill the air.\n" ); IN_UpdateKeyboard(); LastScan=0; break; case 24: // Start of EPISODE 4 MU_StartSong ( song_cinematic2 ); DoInBetweenCinematic (0, W_GetNumForName("epi34"), 1200, "Stairs lead down beneath the\n" "keep. From behind the doors\n" "come the moans of the undead." ); IN_UpdateKeyboard(); LastScan=0; break; #endif } } rott-20230810/rott/rt_main.h000066400000000000000000000075671446517470200155660ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //*************************************************************************** // // RT_MAIN.H // //*************************************************************************** #ifndef _rt_main_public #define _rt_main_public #include "develop.h" #include "rt_def.h" #include "rottnet.h" #include "rt_battl.h" #if (SHAREWARE==0) #define STANDARDGAMELEVELS "DARKWAR.RTL" #define STANDARDBATTLELEVELS "DARKWAR.RTC" #define SUPERROTTBATTLELEVELS "ROTTCD.RTC" #define SITELICENSEBATTLELEVELS "ROTTSITE.RTC" #else #define STANDARDGAMELEVELS "HUNTBGIN.RTL" #define STANDARDBATTLELEVELS "HUNTBGIN.RTC" #endif enum {vl_low, vl_medium, vl_high, vl_excessive }; // Enum for each version of the game typedef enum { ROTT_SHAREWARE, ROTT_REGISTERED, ROTT_SUPERCD, ROTT_SITELICENSE } version_type; typedef struct { int GodModeTime; int DogModeTime; int ShroomsModeTime; int ElastoModeTime; int AsbestosVestTime; int BulletProofVestTime; int GasMaskTime; int MercuryModeTime; int GodModeRespawnTime; int DogModeRespawnTime; int ShroomsModeRespawnTime; int ElastoModeRespawnTime; int AsbestosVestRespawnTime; int BulletProofVestRespawnTime; int GasMaskRespawnTime; int MercuryModeRespawnTime; }specials; typedef struct { unsigned Version; // Variable for which version of the game can be played version_type Product; int TimeCount; int frame; int secrettotal,treasuretotal,killtotal; int secretcount,treasurecount,killcount; int supertotal,healthtotal,missiletotal; int supercount,healthcount,missilecount; int democratictotal,planttotal; int democraticcount,plantcount; int dipballs; int difficulty; int violence; int mapon; int score; int episode; int battlemode; int battleoption; int randomseed; boolean teamplay; boolean DODEMOCRATICBONUS1; boolean DOGROUNDZEROBONUS; int autorun; // Battle Options battle_type BattleOptions; boolean SpawnCollectItems; boolean SpawnEluder; boolean SpawnDeluder; boolean ShowScores; boolean PlayerHasGun[ MAXPLAYERS ]; specials SpecialsTimes; } gametype; extern int doublestep; extern boolean tedlevel; extern int tedlevelnum; extern int tedx; extern int tedy; extern boolean fizzlein; extern int pheight; extern int NoSound; extern int timelimit; extern boolean timelimitenabled; extern boolean noecho; extern boolean demoexit; extern boolean quiet; extern gametype gamestate; extern boolean DebugOk; extern boolean newlevel; void QuitGame( void ); void PlayCinematic (void); void InitCharacter(void); void ShutDown ( void ); void UpdateGameObjects ( void ); #if (WHEREAMI==1) extern int programlocation; #endif extern int polltime; extern int oldpolltime; extern volatile int oldtime; void PauseLoop ( void ); void SaveScreen (boolean inhmenu); void SetupWads( void ); extern boolean SCREENSHOTS; extern boolean COMPUTELEVELSIZE; extern boolean MONOPRESENT; extern boolean MAPSTATS; extern boolean TILESTATS; extern boolean HUD; extern char CWD[40]; #endif rott-20230810/rott/rt_map.c000066400000000000000000000507521446517470200154040ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include #include "sprites.h" #include "rt_map.h" #include "rt_dr_a.h" #include "_rt_map.h" #include "isr.h" #include "rt_util.h" #include "modexlib.h" #include "rt_draw.h" #include "rt_stat.h" #include "z_zone.h" #include "w_wad.h" #include "rt_main.h" #include "rt_playr.h" #include "lumpy.h" #include "rt_door.h" #include "rt_scale.h" #include "rt_vid.h" #include "rt_in.h" #include "rt_ted.h" #include "rt_game.h" #include "rt_rand.h" #include "rt_view.h" #include "rt_floor.h" #include "engine.h" #include "develop.h" #include "rt_menu.h" #include "rt_net.h" #include "rt_str.h" #include "watcom.h" //=========================================================================== static int tilesize; static fixed xscale; static fixed yscale; static int mapscale=2; static int oldw,oldh; static byte * skytile; static int mapcolor=8; typedef struct PType { int x; int y; } Ptype; static Ptype arrows[8][7]= { { {4,2}, {2,4}, {2,3}, {0,3}, {0,1}, {2,1}, {2,0} }, { {4,0}, {4,3}, {3,2}, {1,4}, {0,3}, {2,1}, {1,0} }, { {2,0}, {4,2}, {3,2}, {3,4}, {1,4}, {1,2}, {0,2} }, { {0,0}, {3,0}, {2,1}, {4,3}, {3,4}, {1,2}, {0,3} }, { {0,2}, {2,0}, {2,1}, {4,1}, {4,3}, {2,3}, {2,4} }, { {0,4}, {0,1}, {1,2}, {3,0}, {4,1}, {2,3}, {3,4} }, { {2,4}, {0,2}, {1,2}, {1,0}, {3,0}, {3,2}, {4,2} }, { {4,4}, {1,4}, {2,3}, {0,1}, {1,0}, {3,2}, {4,1} }, }; void DrawMap_MaskedShape (int x, int y, int lump, int type); void CheatMap( void ) { int i; int j; statobj_t * temp; objtype * a; for(temp=FIRSTSTAT;temp;temp=temp->statnext) temp->flags|=FL_SEEN; for(a=FIRSTACTOR;a;a=a->next) a->flags|=FL_SEEN; for (j=0;j0)) && mapseen[i+1][j]) mapseen[i][j]=1; else if (i==MAPSIZE-1 && mapseen[i-1][j] && ((mapseen[i][j+1] && j0))) mapseen[i][j]=1; else if (j==0 && ((mapseen[i+1][j] && i0)) && mapseen[i][j+1]) mapseen[i][j]=1; else if (j==MAPSIZE-1 && mapseen[i][j-1] && ((mapseen[i+1][j] && i0))) mapseen[i][j]=1; else if ( ( ((mapseen[i-1][j]) && (mapseen[i][j+1]) && (!(tilemap[i-1][j+1]))) || ((mapseen[i-1][j]) && (mapseen[i][j-1]) && (!(tilemap[i-1][j-1]))) || ((mapseen[i+1][j]) && (mapseen[i][j+1]) && (!(tilemap[i+1][j+1]))) || ((mapseen[i+1][j]) && (mapseen[i][j-1]) && (!(tilemap[i+1][j-1]))) ) && tilemap[i][j]) mapseen[i][j]=1; } } /* ======================= = = DrawMap_Wall = ======================= */ void DrawMap_Wall (int x, int y, int tile) { byte * buf; byte * b; byte * source; byte * s; int i; x*=tilesize; y*=tilesize; buf=(byte *)bufferofs+ylookup[y]+x; source=W_CacheLumpNum(tile,PU_CACHE, CvtNull, 1); { s=source; b=buf; for (i=0;i>10); } } } /* ======================= = = DrawMap_AnimatedWall = ======================= */ void DrawMap_AnimatedWall (int x, int y, int tile) { DrawMap_Wall(x,y,animwalls[tile].texture); } /* ======================= = = DrawMap_SkyTile = ======================= */ void DrawMap_SkyTile (int x, int y) { byte * buf; byte * b; byte * s; int i; x*=tilesize; y*=tilesize; buf=(byte *)bufferofs+ylookup[y]+x; { s=skytile; b=buf; for (i=0;i>10); } } } /* ======================= = = DrawMap_MaskedWall = ======================= */ void DrawMap_MaskedWall (int x, int y, int tile) { if (IsPlatform(maskobjlist[tile]->tilex,maskobjlist[tile]->tiley)) { if (!(maskobjlist[tile]->flags&MW_ABOVEPASSABLE)) DrawMap_MaskedShape(x,y,maskobjlist[tile]->toptexture,0); else if (!(maskobjlist[tile]->flags&MW_BOTTOMPASSABLE)) DrawMap_MaskedShape(x,y,maskobjlist[tile]->bottomtexture,1); else DrawMap_MaskedShape(x,y,maskobjlist[tile]->midtexture,0); } else { DrawMap_MaskedShape(x,y,maskobjlist[tile]->bottomtexture,1); } } /* ======================= = = DrawMap_Door = ======================= */ void DrawMap_Door (int x, int y, int tile) { if ( (doorobjlist[tile]->lock > 0) && (doorobjlist[tile]->lock <= 4) ) DrawMap_Wall(x,y,W_GetNumForName("lock1")+doorobjlist[tile]->lock-1); else if (doorobjlist[tile]->texture==doorobjlist[tile]->basetexture) DrawMap_Wall(x,y,doorobjlist[tile]->texture); else DrawMap_MaskedShape(x,y,doorobjlist[tile]->texture,0); } /* ======================= = = DrawMap_PushWall = ======================= */ void DrawMap_PushWall (int x, int y, pwallobj_t * pw) { if (pw->texture&0x1000) DrawMap_AnimatedWall(x,y,pw->texture&0x3ff); else DrawMap_Wall(x,y,pw->texture&0x3ff); } /* ======================= = = DrawMap_Actor = ======================= */ void DrawMap_Actor (int x, int y, objtype * a) { int translucent; if (!(a->flags&FL_SEEN)) return; translucent=0; if (a->flags&FL_TRANSLUCENT) translucent=1; DrawMap_MaskedShape(x,y,a->shapenum+shapestart,translucent); } /* ======================= = = DrawMap_Sprite = ======================= */ void DrawMap_Sprite (int x, int y, statobj_t * s) { int translucent; if (!(s->flags&FL_SEEN)) return; translucent=0; if (s->flags&FL_TRANSLUCENT) translucent=1; DrawMap_MaskedShape(x,y,s->shapenum+shapestart,translucent); } /* ======================= = = DrawMap_MaskedShape = ======================= */ void DrawMap_MaskedShape (int x, int y, int lump, int type) { // Calculate center coordinates for sprites x*=tilesize; y*=tilesize; x+=tilesize>>1; y+=tilesize>>1; DrawPositionedScaledSprite(x,y,lump,tilesize,type); } /* ======================= = = DrawMap_PlayerArrow = ======================= */ /* Indices: mapscale, reduced coordinate */ static const int arrowscale[4][5] = {{ 1,17,32,47,63}, /* Mapscale 0: 64 pixels/sprite */ { 1, 9,16,23,31}, /* Mapscale 1: 32 pixels/sprite */ { 1, 5, 8,11,15}, /* Mapscale 2: 16 pixels/sprite */ { 1, 3, 4, 5, 7}}; /* Mapscale 3: 8 pixels/sprite */ void DrawMap_PlayerArrow (int x, int y, int dir) { int i; x*=tilesize; y*=tilesize; /* You can't draw a 4x4 arrow */ if(mapscale == 4) { VL_Bar(x+1,y+1,2,2,244); return; } for (i=0;i<6;i++) { VL_DrawLine (arrowscale[mapscale][arrows[dir][i].x]+x, arrowscale[mapscale][arrows[dir][i].y]+y, arrowscale[mapscale][arrows[dir][i+1].x]+x, arrowscale[mapscale][arrows[dir][i+1].y]+y, 244 ); } VL_DrawLine ( arrowscale[mapscale][arrows[dir][6].x]+x, arrowscale[mapscale][arrows[dir][6].y]+y, arrowscale[mapscale][arrows[dir][0].x]+x, arrowscale[mapscale][arrows[dir][0].y]+y, 244 ); } /* ======================= = = DrawMap_Player = ======================= */ void DrawMap_Player (int x, int y) { if (player->flags&FL_SHROOMS) DrawMap_PlayerArrow(x,y,( RandomNumber("DrawMap_PLAYER",0)>>5) ); else DrawMap_PlayerArrow(x,y,( ( (player->angle+(FINEANGLES/16)) & (FINEANGLES-1) ) >>8) ); DrawMap_MaskedShape(x,y,player->shapenum+shapestart,0); } /* ======================= = = DrawMap = ======================= */ void DrawMap( int cx, int cy ) { fixed x,y; statobj_t * s; objtype * a; int i,j; int mapx,mapy; int wall; // Clear buffer VL_ClearBuffer (bufferofs, egacolor[mapcolor]); x=cx>>16; y=cy>>16; // Draw Walls,Doors,maskedwalls,animatingwalls for (j=0;j127) break; for (i=0;i127) break; if ((mapx==player->tilex ) && (mapy==player->tiley)) { DrawMap_Player(i,j); continue; } wall=tilemap[mapx][mapy]; // Check for absence of wall if (wall) { if (!mapseen[mapx][mapy]) continue; // Check to see if it is a door or masked wall if (wall&0x8000) { if (wall&0x4000) { // Must be a masked wall DrawMap_MaskedWall(i,j,wall&0x3ff); } else { // Must be a door DrawMap_Door(i,j,wall&0x3ff); } } // Check to see if it is an animating wall else if (wall&0x1000) { DrawMap_AnimatedWall(i,j,wall&0x3ff); } else if (IsWindow(mapx,mapy)) { if (sky!=0) DrawMap_SkyTile(i,j); else Error("Trying to draw a sky on a level without sky\n"); } else { // Must be a normal wall or a wall with something above DrawMap_Wall(i,j,wall&0x3ff); } } else { a=actorat[mapx][mapy]; // Check for absence of actor if (a) { switch(a->which) { case PWALL: if (!mapseen[mapx][mapy]) continue; DrawMap_PushWall(i,j,(pwallobj_t *)a); break; case ACTOR: DrawMap_Actor(i,j,a); break; case SPRITE: DrawMap_Actor(i,j,a); break; default: SoftError("Unable to resolve actorat at x=%d y=%d which=%d\n",mapx,mapy,a->which); break; } } else { s=sprites[mapx][mapy]; // Check for absence of sprite if (s) { DrawMap_Sprite(i,j,s); } } } } } } /* ======================= = = SetupFullMap = ======================= */ void SetupFullMap( void ) { int ty; pic_t *pic; // Fill in backgrounds pic = (pic_t *) W_CacheLumpNum (W_GetNumForName ("mmbk"), PU_CACHE, Cvt_pic_t, 1); VWB_DrawPic (0, 0, pic); CheckHolidays(); // Clear area for map for (ty=37;ty<37+127;ty++) memset((byte *)bufferofs+ylookup[ty]+96,0,128); } /* ======================= = = DrawFullMap = ======================= */ void DrawFullMap( void ) { statobj_t * s; objtype * a; int mapx,mapy; int wall; byte * buf; SetupFullMap(); // Draw Walls,Doors,maskedwalls,animatingwalls for (mapx=0;mapxtilex ) && (mapy==player->tiley)) { *buf=egacolor[MAP_PLAYERCOLOR]; continue; } wall=tilemap[mapx][mapy]; // Check for absence of wall if (wall) { if (!mapseen[mapx][mapy]) continue; // Check to see if it is a door or masked wall if (wall&0x8000) { if (wall&0x4000) { // Must be a maskedwall *(buf)=egacolor[MAP_MWALLCOLOR]; } else { // Must be a door *(buf)=egacolor[MAP_DOORCOLOR]; } } // Check to see if it is an animating wall else if (wall&0x1000) { *(buf)=egacolor[MAP_AWALLCOLOR]; } else if (IsWindow(mapx,mapy)) { if (sky!=0) *(buf)=egacolor[MAP_SKYCOLOR]; else Error("Trying to draw a sky on a level without sky\n"); } else { // Must be a normal wall or a wall with something above *(buf)=egacolor[MAP_WALLCOLOR]; } } else { a=actorat[mapx][mapy]; // Check for absence of actor if (a) { switch(a->which) { case PWALL: if (!mapseen[mapx][mapy]) continue; *(buf)=egacolor[MAP_PWALLCOLOR]; break; case ACTOR: if (a->flags&FL_SEEN) { if (a->obclass==inertobj) *(buf)=egacolor[MAP_SPRITECOLOR]; else *(buf)=egacolor[MAP_ACTORCOLOR]; } break; case SPRITE: if (a->flags&FL_SEEN) *(buf)=egacolor[MAP_SPRITECOLOR]; break; default: SoftError("Unable to resolve actorat at x=%d y=%d which=%d\n",mapx,mapy,a->which); break; } } else { s=sprites[mapx][mapy]; // Check for absence of sprite if (s && (s->flags&FL_SEEN)) { *(buf)=egacolor[MAP_SPRITECOLOR]; } } } } } FlipPage(); } /* ======================= = = DrawMapInfo = ======================= */ void DrawMapInfo ( void ) { char temp[80]; int width,height; CurrentFont=tinyfont; PrintX = 2; PrintY = 2; strcpy (&temp[0], &(LevelName[0])); US_MeasureStr (&width, &height, "%s", &temp[0]); VWB_TBar (0, 0, 320, height+4); US_BufPrint (&temp[0]); strcpy (&temp[0], "TAB=EXIT"); US_MeasureStr (&width, &height, "%s", &temp[0]); PrintX = 316-width; PrintY = 2; US_BufPrint (&temp[0]); strcpy (&temp[0], "< > CHANGE BACKGROUND COLOR"); US_MeasureStr (&width, &height, "%s", &temp[0]); PrintX = (320-width)>>1; PrintY = 2; US_BufPrint (&temp[0]); } /* ======================= = = SetupMapScale = ======================= */ void SetupMapScale( int s ) { mapscale=s; tilesize=64>>mapscale; xscale=320/tilesize; yscale=200/tilesize; hp_srcstep=0x10000<FULLMAP_SCALE) return; if (newmapscale==FULLMAP_SCALE) DrawFullMap(); *newx=*newx+(xscale<<15); *newy=*newy+(yscale<<15); SetupMapScale(newmapscale); *newx=*newx-(xscale<<15); *newy=*newy-(yscale<<15); } /* ======================= = = SetupMapper = ======================= */ void SetupMapper ( void ) { FixMapSeen(); tics=0; oldw=viewwidth; oldh=viewheight; viewwidth=320; viewheight=200; if (sky!=0) { skytile=SafeMalloc(64*64); MakeSkyTile(skytile); } } /* ======================= = = ShutdownMapper = ======================= */ void ShutdownMapper ( void ) { VL_ClearVideo (0); viewwidth=oldw; viewheight=oldh; SetupScreen (true); if (sky!=0) SafeFree(skytile); if (mouseenabled && MousePresent) PollMouseMove(); } /* ======================= = = DoMap = ======================= */ void DoMap (int cx, int cy) { int x,y; int dx; int dy; boolean done; int quitkey=sc_Escape; ControlInfo control; EnableScreenStretch();//bna++ ShutdownClientControls(); done=false; while (Keyboard[sc_Tab]) IN_UpdateKeyboard (); x=(cx-(xscale>>1))<<16; y=(cy-(yscale>>1))<<16; SetupMapper(); transparentlevel=25; ChangeMapScale(&x, &y, mapscale); while (done==false) { IN_UpdateKeyboard (); if ((Keyboard[sc_Tab]) || (Keyboard[sc_Escape])) { if (Keyboard[sc_Tab]) quitkey=sc_Tab; else quitkey=sc_Escape; done=true; } if ( Keyboard[ sc_Home ] ) { x=(cx-(xscale>>1))<<16; y=(cy-(yscale>>1))<<16; } dx=0; dy=0; if (mapscale==FULLMAP_SCALE) CalcTics(); else { DrawMap(x,y); DrawMapInfo (); FlipPage(); CalcTics(); DoSprites(); AnimateWalls(); } ReadAnyControl (&control); if ((Keyboard[sc_PgUp]) || (Keyboard[sc_Plus]) || (control.button1)) { ChangeMapScale(&x, &y, mapscale+1); while(Keyboard[sc_PgUp]) IN_UpdateKeyboard (); while(Keyboard[sc_Plus]) IN_UpdateKeyboard (); while(control.button1) ReadAnyControl (&control); } if ((Keyboard[sc_PgDn]) || (Keyboard[sc_Minus]) || (control.button0)) { ChangeMapScale(&x, &y, mapscale-1); while(Keyboard[sc_PgDn]) IN_UpdateKeyboard (); while(Keyboard[sc_Minus]) IN_UpdateKeyboard (); while(control.button0) ReadAnyControl (&control); } if (Keyboard[sc_CapsLock] && Keyboard[sc_X]) { SaveScreen(true); } if (Keyboard[sc_Comma]) { if (mapcolor>0) mapcolor--; while(Keyboard[sc_Comma]) IN_UpdateKeyboard (); } if (Keyboard[sc_Period]) { if (mapcolor<15) mapcolor++; while(Keyboard[sc_Period]) IN_UpdateKeyboard (); } if (mapscale!=FULLMAP_SCALE) { if (control.dir==dir_East) dx=(tics<<17)/(5-mapscale); if (control.dir==dir_West) dx=-(tics<<17)/(5-mapscale); if (control.dir==dir_South) dy=(tics<<17)/(5-mapscale); if (control.dir==dir_North) dy=-(tics<<17)/(5-mapscale); } x+=dx; y+=dy; if (x>0x7effff) x=0x7effff; else if (x<-(xscale<<15)) x=-(xscale<<15); if (y>0x7effff) y=0x7effff; else if (y<-(yscale<<15)) y=-(yscale<<15); } if ( playstate == ex_stillplaying ) {//bna++ pic_t *shape; shape = ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 ); DrawTiledRegion( 0, 16, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 32, 0, 16, shape );//bna++ DisableScreenStretch();//dont strech when we go BACK TO GAME VW_UpdateScreen (); DrawPlayScreen(true);//repaint ammo and life stat } while (Keyboard[quitkey]) IN_UpdateKeyboard (); LastScan=0; Keyboard[sc_Escape]=0; Keyboard[sc_Tab]=0; ShutdownMapper(); StartupClientControls(); } rott-20230810/rott/rt_map.h000066400000000000000000000017631446517470200154070ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //*************************************************************************** // // RT_MAP.C // //*************************************************************************** #ifndef _rt_map_public #define _rt_map_public void DoMap(int x, int y); void CheatMap( void ); #endif rott-20230810/rott/rt_menu.c000066400000000000000000006000121446517470200155610ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //****************************************************************************** // // RT_MENU.C // Contains the menu stuff! // //****************************************************************************** #include #include #include #include #include #include #ifndef _WIN32 #include #include "SDL.h" #endif #include #include #include "rt_def.h" #include "_rt_menu.h" #include "rt_menu.h" #include "rt_sound.h" #include "fx_man.h" #include "rt_build.h" #include "rt_in.h" #include "isr.h" #include "z_zone.h" #include "w_wad.h" #include "rt_util.h" #include "rt_main.h" #include "rt_playr.h" #include "rt_rand.h" #include "rt_game.h" #include "rt_floor.h" #include "rt_draw.h" #include "rt_view.h" #include "rt_str.h" #include "rt_vid.h" #include "rt_ted.h" #include "rt_com.h" #include "lumpy.h" #include "rt_cfg.h" #include "version.h" #include "modexlib.h" #include "rt_msg.h" #include "rt_net.h" #include "rt_scale.h" #include "rt_battl.h" #include "develop.h" #include "m_misc2.h" //****************************************************************************** // // GLOBALS // //****************************************************************************** #define DELAYAMT 2 #define SNDCARDS 12 #define CP_NO 0 #define CP_ESC -1 #define CP_YES 1 int CP_Acknowledge; boolean POK = false; char pword[ 13 ]; boolean ingame = false; boolean inmenu = false; boolean pickquick = false; boolean NewGame = false; // // Global window coords // int PrintX; int PrintY; int WindowX; int WindowY; int WindowH = 160; int WindowW; int px; int py; int bufferheight; int bufferwidth; cfont_t *IFont; font_t *CurrentFont; font_t *newfont1; font_t *smallfont; font_t *bigfont; font_t *tinyfont; boolean loadedgame = false; battle_type BATTLE_Options[ battle_NumBattleModes ]; int quicksaveslot=-1; //****************************************************************************** // // LOCALS // //****************************************************************************** char order[ 21 ] = { di_west, di_east, di_north, di_south, bt_run, bt_use, bt_attack, bt_strafe, bt_strafeleft, bt_straferight, bt_lookup, bt_lookdown, bt_aimbutton, bt_horizonup, bt_horizondown, bt_swapweapon, bt_dropweapon, bt_turnaround, bt_autorun, bt_message, bt_directmsg }; // bt_pistol, bt_dualpistol, bt_mp40, bt_missileweapon, bt_recordsound, #define RETURNVAL 100 static boolean loadsavesound = false; static int numdone; static char *endStrings[ 7 ] = { "Press Y to reformat \nand install Windows.\0\0", "Press Y to activate \nguillotine.\0\0", "Press Y to release \nthe cyanide gas.\0\0", "Press Y to open \ntrap door.\0\0", "Press Y to drive your \ncar off the cliff.\0\0", "Press Y to pull \nyour plug.\0\0", "Press Y to activate \nelectric chair.\0\0" }; static char *BattleModeDescriptions[ battle_NumBattleModes - 1 ] = { "Kill your enemies! Don't get killed! Kill some more!", "Score more points for more difficult kills.", "Collect the most triads to win the game. Whoopee!", "Collect triads to win the game--this time with weapons!", "Armed hunters vs. unarmed prey--then the tables are turned!", "Tag your enemies. Run away. Lowest points wins.", "Chase roving 'Eluders'--tag them for points.", "Use weapons to destroy roving Eluder triads for points.", "Capture the opposing team's triad while guarding your own." }; static char *BattleOptionDescriptions[ 9 ] = { "Adjust the Gravitational Constant of the game universe!", "Adjust the top speed for all players in the game", "Adjust the amount of ammo in all missile weapons", "Adjust the hit points of all players in the game", "Radically change the way the game plays", "Adjust the light characteristics of the game", "Adjust the point goal of the game", "Adjust the damage done by environment dangers", "Adjust the time limit for the game" }; static char *GravityOptionDescriptions[ 3 ] = { "Similar to gravity on the moon", "Normal Gravity (9.81 m/s^2 !)", "Similar to gravity on Jupiter" }; static char *SpeedOptionDescriptions[ 2 ] = { "Player speeds are determined by character", "All players can move at the fastest possible speed" }; static char *AmmoOptionDescriptions[ 3 ] = { "One piece of ammo per missile weapon", "Normal ammo for all missile weapons", "Infinite ammo for all missile weapons" }; static char *HitPointsOptionDescriptions[ 7 ] = { "One hit point for each player", "25 hit points for each player", "Hit points determined by character", "100 hit points for each player", "250 hit points for each player (default)", "500 hit points for each player", "4000 hit points for each player", }; static char *RadicalOptionDescriptions[ 8 ] = { "Control spawning of environment dangers", "Control spawning of health items", "Control spawning of missile weapons", "Spawn mines instead of health items", "Objects reappear a short time after being picked up", "Missile weapons remain when picked up", "Weapons are chosen randomly at the start of the game", "Killing yourself or a team member counts as a suicide" }; static char *LightLevelOptionDescriptions[ 6 ] = { "Very dark, cave-like", "Lighting determined by level design", "Full brightness", "Bright with fog", "Periodic lighting (voobing)", "Dark with lightning" }; static char *PointGoalOptionDescriptions[ 9 ] = { "One Point/Kill", "5 Points/Kills", "11 Points/Kills", "21 Points/Kills", "50 Points/Kills", "100 Points/Kills", "Random Points/Kills", "Random Points/Kills but goal is not revealed", "Infinite Points/Kills" }; static char *DangerDamageOptionDescriptions[ 3 ] = { "Environmental dangers' damage is relatively low", "Environmental dangers' damage normal", "One touch and you are dead!" }; static char *TimeLimitOptionDescriptions[ 8 ] = { "One Minute", "2 Minutes", "5 Minutes", "10 Minutes", "21 Minutes", "30 Minutes", "99 Minutes", "No Time Limit" }; static char *BattleModeNames[ battle_NumBattleModes - 1 ] = { "NORMAL COMM-BAT", "SCORE MORE", "COLLECTOR", "SCAVENGER", "HUNTER", "TAG", "ELUDER", "DELUDER", "CAPTURE THE TRIAD" }; static int OptionNums[ 12 ] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; static int HitPointNums[ 7 ] = { 1, 25, bo_character_hitpoints, 100, 250, 500, 4000 }; static int KillNums[ 9 ] = { 1, 5, 11, 21, 50, 100, bo_kills_random, bo_kills_blind, bo_kills_infinite }; static int GravityNums[ 3 ] = { LOW_GRAVITY, NORMAL_GRAVITY, HIGH_GRAVITY }; static int TimeLimitNums[ 8 ] = { 1, 2, 5, 10, 21, 30, 99, bo_time_infinite }; static int DangerNums[ 3 ] = { bo_danger_low, bo_danger_normal, bo_danger_kill }; static int MenuNum = 0; static int handlewhich; static int CSTactive = 0; static boolean INFXSETUP = false; // // MENU CURSOR SHAPES // #define MAXCURSORNUM 24 static int cursorwidth; static int cursorheight; static int yinc; static char *FontNames[] = { "itnyfont", "ifnt", "sifont", "lifont" }; static int FontSize[] = { 6, 7, 9, 14 }; static char *SmallCursor = "smallc01"; static char *LargeCursor = "cursor01"; static char *CursorLump = "cursor01"; static int CursorNum = 0; static int CursorFrame[ MAXCURSORNUM ] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1 }; typedef enum { MOUSEENABLE, JOYENABLE, USEPORT2, PADENABLE, THRESSENS, MOUSESENS, CUSTOMIZE } controltypes; static char *playerwadname[] = { "cass1", "bars1", "wens1", "lnis1", "ipfs1" }; char *colorname[] = { "Gray", "Brown", "Black", "Tan", "Red", "Olive", "Blue", "White", "Green", "Purple", "Orange" }; // // MENU ITEMS // CP_MenuNames MainMenuNames[] = { "NEW GAME", "COMM-BAT\x81 GAME", "RESTORE GAME", "SAVE GAME", "OPTIONS", "ORDERING INFO", "VIEW SCORES", //"END GAME" "BACK TO DEMO", //"BACK TO GAME" "QUIT" }; CP_iteminfo MainItems = { MENU_X, MENU_Y + 1, 9, STARTITEM, 32, MainMenuNames, mn_largefont }; CP_itemtype MainMenu[] = { { CP_CursorLocation, "mm_opt1\0", 'N', (menuptr)CP_NewGame }, { CP_Active, "battle\0", 'C', (menuptr)CP_BattleModes }, { CP_Active, "mm_opt2\0", 'R', (menuptr)CP_LoadGame }, { CP_Inactive, "mm_opt3\0", 'S', (menuptr)CP_SaveGame }, { CP_Active, "mm_opt5\0", 'O', (menuptr)CP_ControlMenu }, { CP_Active, "ordrinfo\0", 'O', (menuptr)CP_OrderInfo }, { CP_Active, "mm_opt7\0", 'V', (menuptr)CP_ViewScores }, { CP_Active, "mm_opt8\0", 'B', (menuptr)NULL }, { CP_Active, "mm_opt9\0", 'Q', (menuptr)CP_Quit } }; CP_iteminfo LSItems = { LSM_X, LSM_Y, NUMSAVEGAMES, 0, 10, NULL, mn_largefont }; CP_itemtype LSMenu[] = { { CP_Active, "", 'a', NULL }, { CP_Active, "", 'b', NULL }, { CP_Active, "", 'c', NULL }, { CP_Active, "", 'd', NULL }, { CP_Active, "", 'e', NULL }, { CP_Active, "", 'f', NULL }, { CP_Active, "", 'g', NULL }, { CP_Active, "", 'h', NULL }, { CP_Active, "", 'i', NULL }, { CP_Active, "", 'j', NULL }, { CP_Active, "", 'k', NULL }, { CP_Active, "", 'l', NULL }, { CP_Active, "", 'm', NULL }, { CP_Active, "", 'n', NULL }, { CP_Active, "", 'o', NULL } }; CP_MenuNames CtlMenuNames[] = { "MOUSE ENABLED", "JOYSTICK ENABLED", "USE JOYSTICK PORT 2", "GAMEPAD ENABLED", "ADJUST THRESHOLD", "MOUSE SENSITIVITY", "CUSTOMIZE CONTROLS" }; CP_iteminfo CtlItems = { CTL_X, MENU_Y, 7, -1, 36, CtlMenuNames, mn_largefont }; CP_itemtype CtlMenu[] = { { CP_Inactive, "ctl_mic\0", 'M', NULL }, { CP_Inactive, "ctl_jen\0", 'J', NULL }, { CP_Inactive, "ctl_jp2\0", 'U', NULL }, { CP_Inactive, "ctl_gpd\0", 'G', NULL }, { CP_Inactive, "ctl_thr\0", 'A', (menuptr)DoThreshold }, { CP_Inactive, "ctl_mse\0", 'M', (menuptr)MouseSensitivity }, { CP_Active, "ctl_cus\0", 'C', (menuptr)CP_Custom } }; CP_iteminfo CusItems = { 32, CST_Y + 13 * 2, 9, -1, 0, NULL, mn_largefont }; CP_itemtype CusMenu[] = { { CP_Active, "ctl_mic\0", 'a', NULL }, { CP_Inactive, "ctl_mic\0", 'a', NULL }, { CP_Inactive, "ctl_mic\0", 'a', NULL }, { CP_Active, "ctl_mic\0", 'a', NULL }, { CP_Inactive, "ctl_mic\0", 'a', NULL }, { CP_Inactive, "ctl_mic\0", 'a', NULL }, { CP_Active, "ctl_mic\0", 'a', NULL }, { CP_Inactive, "ctl_mic\0", 'a', NULL }, { CP_Active, "ctl_mic\0", 'a', NULL } }; CP_iteminfo TufItems = { TUF_X, TUF_Y, 7, 0, 80, NULL, mn_largefont }; CP_itemtype TufMenu[ 4 ][ 7 ] = { { { 2, "new11\0", 'a', NULL }, { 3, "new11\0", 'a', NULL }, { 1, "new12\0", 'a', NULL }, { 3, "new12\0", 'a', NULL }, { 1, "new13\0", 'a', NULL }, { 3, "new13\0", 'a', NULL }, { 1, "new14\0", 'a', NULL }, }, { { 2, "new21\0", 'a', NULL }, { 3, "new21\0", 'a', NULL }, { 1, "new22\0", 'a', NULL }, { 3, "new22\0", 'a', NULL }, { 1, "new23\0", 'a', NULL }, { 3, "new23\0", 'a', NULL }, { 1, "new24\0", 'a', NULL }, }, { { 2, "new31\0", 'a', NULL }, { 3, "new31\0", 'a', NULL }, { 1, "new32\0", 'a', NULL }, { 3, "new32\0", 'a', NULL }, { 1, "new33\0", 'a', NULL }, { 3, "new33\0", 'a', NULL }, { 1, "new34\0", 'a', NULL }, }, { { 2, "stk_1\0", 'a', NULL }, { 3, "stk_1\0", 'a', NULL }, { 1, "stk_2\0", 'a', NULL }, { 3, "stk_2\0", 'a', NULL }, { 1, "stk_3\0", 'a', NULL }, { 3, "stk_3\0", 'a', NULL }, { 1, "stk_4\0", 'a', NULL }, } }; CP_MenuNames CustomMenuNames[] = { "CUSTOMIZE KEYBOARD", "CUSTOMIZE MOUSE", "CUSTOMIZE JOYSTICK" }; CP_iteminfo CustomItems = {32, 64, 3, 0, 24, CustomMenuNames, mn_largefont }; CP_itemtype CustomMenu[] = { {2, "custom1\0", 'C', (menuptr)CP_Keyboard}, {1, "custom2\0", 'C', (menuptr)CP_Mouse}, {1, "custom3\0", 'C', (menuptr)CP_Joystick} }; #define KEYNAMEINDEX 21 CP_MenuNames NormalKeyNames[] = { "LEFT \x9 ", "RIGHT \x9 ", "FORWARD \x9 ", "BACKWARD \x9 ", "RUN \x9 ", "OPEN \x9 ", "FIRE \x9 ", "STRAFE \x9 ", "STRAFE LEFT \x9 ", "STRAFE RIGHT \x9 ", "LOOK/FLY UP \x9 ", "LOOK/FLY DOWN \x9 ", "AIM \x9 ", "AIM UP \x9 ", "AIM DOWN \x9 ", "TOGGLE WEAPON \x9 ", "DROP WEAPON \x9 ", "VOLTE-FACE \x9 ", "AUTORUN \x9 ", "SEND MESSAGE \x9 ", "DIRECT MESSAGE \x9 " }; #define NORMALKEY_X 74 #define NORMALKEY_Y 16 CP_iteminfo NormalKeyItems = { NORMALKEY_X, 17, 21, 0, 16, NormalKeyNames, mn_tinyfont }; CP_itemtype NormalKeyMenu[] = { { 2, "\0", 'L', (menuptr)DefineKey }, { 1, "\0", 'R', (menuptr)DefineKey }, { 1, "\0", 'F', (menuptr)DefineKey }, { 1, "\0", 'B', (menuptr)DefineKey }, { 1, "\0", 'R', (menuptr)DefineKey }, { 1, "\0", 'O', (menuptr)DefineKey }, { 1, "\0", 'F', (menuptr)DefineKey }, { 1, "\0", 'S', (menuptr)DefineKey }, { 1, "\0", 'S', (menuptr)DefineKey }, { 1, "\0", 'S', (menuptr)DefineKey }, { 1, "\0", 'L', (menuptr)DefineKey }, { 1, "\0", 'L', (menuptr)DefineKey }, { 1, "\0", 'A', (menuptr)DefineKey }, { 1, "\0", 'A', (menuptr)DefineKey }, { 1, "\0", 'T', (menuptr)DefineKey }, { 1, "\0", 'D', (menuptr)DefineKey }, { 1, "\0", 'V', (menuptr)DefineKey }, { 1, "\0", 'A', (menuptr)DefineKey }, { 1, "\0", 'A', (menuptr)DefineKey }, { 1, "\0", 'S', (menuptr)DefineKey }, { 1, "\0", 'D', (menuptr)DefineKey } }; #define NUMCONTROLNAMES 21 CP_MenuNames ControlNames[] = { "NONE", "LEFT", "RIGHT", "FORWARD", "BACKWARD", "RUN", "OPEN", "FIRE", "STRAFE", "STRAFE LEFT", "STRAFE RIGHT", "LOOK/FLY UP", "LOOK/FLY DOWN", "AIM", "AIM UP", "AIM DOWN", "TOGGLE WEAPON", "DROP WEAPON", "VOLTE-FACE", "AUTORUN", "MAP" }; int controlorder[ NUMCONTROLNAMES ] = { bt_nobutton, di_west, di_east, di_north, di_south, bt_run, bt_use, bt_attack, bt_strafe, bt_strafeleft, bt_straferight, bt_lookup, bt_lookdown, bt_aimbutton, bt_horizonup, bt_horizondown, bt_swapweapon, bt_dropweapon, bt_turnaround, bt_autorun, bt_map }; #define CONTROLSELECT_X 106 CP_iteminfo ControlSelectItems = { CONTROLSELECT_X, 17, NUMCONTROLNAMES, 0, 16, ControlNames, mn_tinyfont }; CP_itemtype ControlSelectMenu[] = { { 2, "\0", 'N', NULL }, { 1, "\0", 'L', NULL }, { 1, "\0", 'R', NULL }, { 1, "\0", 'F', NULL }, { 1, "\0", 'B', NULL }, { 1, "\0", 'R', NULL }, { 1, "\0", 'O', NULL }, { 1, "\0", 'F', NULL }, { 1, "\0", 'S', NULL }, { 1, "\0", 'S', NULL }, { 1, "\0", 'S', NULL }, { 1, "\0", 'L', NULL }, { 1, "\0", 'L', NULL }, { 1, "\0", 'A', NULL }, { 1, "\0", 'A', NULL }, { 1, "\0", 'A', NULL }, { 1, "\0", 'T', NULL }, { 1, "\0", 'D', NULL }, { 1, "\0", 'V', NULL }, { 1, "\0", 'A', NULL }, { 1, "\0", 'M', NULL } }; #define MOUSEBTNINDEX 17 CP_MenuNames MouseBtnNames[] = { " B0 \x9 ", " B1 \x9 ", " B2 \x9 ", "DOUBLE-CLICK B0 \x9 ", "DOUBLE-CLICK B1 \x9 ", "DOUBLE-CLICK B2 \x9 " }; CP_iteminfo MouseBtnItems = { 19, 52, 6, 0, 11, MouseBtnNames, mn_8x8font }; CP_itemtype MouseBtnMenu[] = { { 2, "\0", 'B', (menuptr)DefineMouseBtn }, { 1, "\0", 'B', (menuptr)DefineMouseBtn }, { 1, "\0", 'B', (menuptr)DefineMouseBtn }, { 1, "\0", 'D', (menuptr)DefineMouseBtn }, { 1, "\0", 'D', (menuptr)DefineMouseBtn }, { 1, "\0", 'D', (menuptr)DefineMouseBtn } }; #define JOYBTNINDEX 17 CP_MenuNames JoyBtnNames[] = { " B0 \x9 ", " B1 \x9 ", " B2 \x9 ", " B3 \x9 ", "DOUBLE-CLICK B0 \x9 ", "DOUBLE-CLICK B1 \x9 ", "DOUBLE-CLICK B2 \x9 ", "DOUBLE-CLICK B3 \x9 " }; CP_iteminfo JoyBtnItems = { 19, 48, 8, 0, 11, JoyBtnNames, mn_8x8font }; CP_itemtype JoyBtnMenu[] = { { 2, "\0", 'B', (menuptr)DefineJoyBtn }, { 1, "\0", 'B', (menuptr)DefineJoyBtn }, { 1, "\0", 'B', (menuptr)DefineJoyBtn }, { 1, "\0", 'B', (menuptr)DefineJoyBtn }, { 1, "\0", 'D', (menuptr)DefineJoyBtn }, { 1, "\0", 'D', (menuptr)DefineJoyBtn }, { 1, "\0", 'D', (menuptr)DefineJoyBtn }, { 1, "\0", 'D', (menuptr)DefineJoyBtn } }; CP_MenuNames PlayerMenuNames[] = { "TARADINO CASSATT", "THI BARRETT", "DOUG WENDT", "LORELEI NI", "IAN PAUL FREELEY" }; CP_iteminfo PlayerItems = {TUF_X, 48, 5, 0, 80, PlayerMenuNames, mn_largefont }; CP_itemtype PlayerMenu[] = { {2, "name1\0", 'T', NULL}, {1, "name2\0", 'T', NULL}, {1, "name3\0", 'D', NULL}, {1, "name4\0", 'L', NULL}, {1, "name5\0", 'I', NULL}, }; CP_MenuNames ControlMMenuNames[] = { "CONTROLS", "USER OPTIONS", "EXT USER OPTIONS",//bna added "MUSIC VOLUME", "SOUND FX VOLUME" }; CP_iteminfo ControlMItems = {32, 48-8, 5, 0, 32, ControlMMenuNames, mn_largefont };//bna added //CP_iteminfo ControlMItems = {32, 48, 4, 0, 32, ControlMMenuNames, mn_largefont }; CP_itemtype ControlMMenu[] = { {2, "cntl\0", 'C', (menuptr)CP_Control}, {1, "uopt\0", 'U', (menuptr)CP_OptionsMenu}, {1, "euopt\0", 'E', (menuptr)CP_ExtOptionsMenu},//bna added {1, "muvolumn\0", 'M', (menuptr)MusicVolume}, {1, "fxvolumn\0", 'S', (menuptr)FXVolume} }; CP_MenuNames OptionsNames[] = { "AUTO DETAIL ADJUST", "LIGHT DIMINISHING", "BOBBIN'", "FLOOR AND CEILING", "DOUBLE-CLICK SPEED", "MENU FLIP SPEED", "DETAIL LEVELS", "VIOLENCE LEVEL", "SCREEN SIZE" }; //bna added CP_MenuNames ExtOptionsNames[] = { "MOUSELOOK", "INVERSE MOUSE", "CROSS HAIR", "FULLSCREEN" }; CP_iteminfo ExtOptionsItems = { 20, MENU_Y, 4, 0, 43, ExtOptionsNames, mn_largefont }; CP_itemtype ExtOptionsMenu[] = { {1, "", 'M', NULL}, {1, "", 'I', NULL}, {1, "", 'C', NULL}, {1, "", 'J', NULL}, {1, "", 'F', NULL} }; //bna added end CP_iteminfo OptionsItems = { 20, MENU_Y, 9, 0, 43, OptionsNames, mn_largefont }; CP_itemtype OptionsMenu[] = { {2, "autoadj\0", 'A', NULL}, {1, "lightdim\0",'L', NULL}, {1, "bobbin\0", 'B', NULL}, {1, "fandc\0", 'F', NULL}, {1, "double\0", 'D', (menuptr)CP_DoubleClickSpeed}, {1, "menuspd\0", 'M', (menuptr)MenuFlipSpeed}, {1, "detail\0", 'D', (menuptr)CP_DetailMenu}, {1, "vlevel\0", 'V', (menuptr)CP_ViolenceMenu}, {1, "\0", 'S', (menuptr)CP_ScreenSize} }; CP_MenuNames DetailMenuNames[] = { "LOW DETAIL", "MEDIUM DETAIL", "HIGH DETAIL" }; CP_iteminfo DetailItems = { 32, 64, 3, 0, 43, DetailMenuNames, mn_largefont }; CP_itemtype DetailMenu[] = { {2, "lowdtl\0", 'L', NULL}, {1, "meddtl\0", 'M', NULL}, {1, "hidtl\0", 'H', NULL} }; CP_MenuNames BattleMenuNames[] = { "PLAY GAME", "PLAY TEAM GAME", "COMM-BAT OPTIONS" }; CP_iteminfo BattleItems = { 32, 19, 3, 0, 24, BattleMenuNames, mn_largefont }; CP_itemtype BattleMenu[] = { {2, "bplay\0", 'P', (menuptr)BattleNoTeams}, {1, "playteam\0", 'P', (menuptr)BattleTeams}, {1, "comopt\0", 'C', (menuptr)CP_BattleOptions} }; CP_MenuNames ViolenceMenuNames[] = { "NONE", "SOME", "A LOT", "EXCESSIVE" }; CP_iteminfo ViolenceItems = { 32, 64, 4, 0, 45, ViolenceMenuNames, mn_largefont }; CP_itemtype ViolenceMenu[] = { {2, "vnone\0", 'N', NULL}, {1, "vsome\0", 'S', NULL}, {1, "valot\0", 'A', NULL}, {1, "vexcess\0", 'E', NULL} }; CP_MenuNames VMenuNames[] = { "SET VIOLENCE LEVEL", "" // "ENTER PASSWORD" // "CHANGE PASSWORD" }; CP_iteminfo VItems = { 32, MP_Y, 2, 0, 24, VMenuNames, mn_largefont }; CP_itemtype VMenu[] = { {2, "msetv\0", 'S', (menuptr)CP_ViolenceLevel}, {1, "mepass\0", 'E', (menuptr)CP_PWMenu} }; CP_MenuNames ModeMenuNames[] = { "NORMAL", "SCORE MORE", "COLLECTOR", "SCAVENGER", "HUNTER", "TAG", "ELUDER", "DELUDER", "CAPTURE THE TRIAD" }; CP_iteminfo ModeItems = { MENU_X, MENU_Y + 1, 9, 0, 24, ModeMenuNames, mn_largefont }; CP_itemtype ModeMenu[] = { {CP_CursorLocation, "normal\0", 'N', (menuptr)CP_BattleMenu}, {CP_Active, "scorem\0", 'S', (menuptr)CP_BattleMenu}, {CP_Active, "collect\0", 'C', (menuptr)CP_BattleMenu}, {CP_Active, "scaven\0", 'S', (menuptr)CP_BattleMenu}, {CP_Active, "hunter\0", 'H', (menuptr)CP_BattleMenu}, {CP_Active, "tag\0", 'T', (menuptr)CP_BattleMenu}, {CP_Active, "eluder\0", 'E', (menuptr)CP_BattleMenu}, {CP_Active, "deluder\0", 'D', (menuptr)CP_BattleMenu}, {CP_Active, "captriad\0", 'C', (menuptr)CP_BattleMenu} }; CP_MenuNames BOptNames[] = { "GRAVITY", "SPEED", "AMMO PER WEAPON", "HIT POINTS", "RADICAL OPTIONS", "LIGHT LEVELS", "POINT GOAL", "DANGER DAMAGE", "TIME LIMIT" }; CP_iteminfo BOptItems = { MENU_X, MENU_Y + 1, 9, 0, 24, BOptNames, mn_largefont }; CP_itemtype BOptMenu[] = { {2, "gravity\0", 'G', (menuptr)CP_GravityOptions}, {1, "speed\0", 'S', (menuptr)CP_SpeedOptions}, {1, "ammoper\0", 'A', (menuptr)CP_AmmoPerWeaponOptions}, {1, "hitp\0", 'H', (menuptr)CP_HitPointsOptions}, {1, "radical\0", 'R', (menuptr)CP_SpawnControlOptions}, {1, "lightl\0", 'L', (menuptr)CP_LightLevelOptions}, {1, "pntgoal\0", 'P', (menuptr)CP_PointGoalOptions}, {1, "danger\0", 'D', (menuptr)CP_DangerOptions}, {1, "timel\0", 'T', (menuptr)CP_TimeLimitOptions} }; CP_MenuNames GravityMenuNames[] = { "LOW", "NORMAL", "HIGH" }; CP_iteminfo GravityItems = { 32, 26, 3, 0, 45, GravityMenuNames, mn_largefont }; CP_itemtype GravityMenu[] = { {2, "b_low\0", 'L', NULL}, {1, "b_normal\0", 'N', NULL}, {1, "b_high\0", 'H', NULL} }; CP_MenuNames SpeedMenuNames[] = { "NORMAL", "FAST" }; CP_iteminfo SpeedItems = { 32, MP_Y, 2, 0, 45, SpeedMenuNames, mn_largefont }; CP_itemtype SpeedMenu[] = { {2, "b_normal\0", 'N', NULL}, {1, "b_fast\0", 'F', NULL} }; CP_MenuNames AmmoPerWeaponMenuNames[] = { "ONE", "NORMAL", "GUNFINITY" }; CP_iteminfo AmmoPerWeaponItems = { 32, 26, 3, 0, 45, AmmoPerWeaponMenuNames, mn_largefont }; CP_itemtype AmmoPerWeaponMenu[] = { {2, "b_one\0", 'O', NULL}, {1, "b_normal\0", 'N', NULL}, {1, "b_gunf\0", 'G', NULL} }; CP_MenuNames HitPointMenuNames[] = { "ONE", "25", "BY CHARACTER", "100", "250", "500", "4000" }; CP_iteminfo HitPointItems = { 32, 32, 7, 0, 45, HitPointMenuNames, mn_largefont }; CP_itemtype HitPointMenu[] = { {2, "b_one\0", 'O', NULL}, {1, "b_25\0", 'a', NULL}, {1, "b_char\0", 'C', NULL}, {1, "b_100\0", 'a', NULL}, {1, "b_250\0", 'a', NULL}, {1, "b_500\0", 'a', NULL}, {1, "b_4000\0", 'a', NULL} }; CP_MenuNames SpawnMenuNames[] = { "SPAWN DANGERS", "SPAWN HEALTH", "SPAWN WEAPONS", "SPAWN MINES", "RESPAWN ITEMS", "WEAPON PERSISTENCE", "RANDOM WEAPONS", "FRIENDLY FIRE" }; CP_iteminfo SpawnItems = { 20, 24, 8, 0, 35, SpawnMenuNames, mn_largefont }; CP_itemtype SpawnMenu[] = { {2, "b_danger\0", 'S', NULL}, {1, "b_health\0", 'S', NULL}, {1, "b_weap\0", 'S', NULL}, {1, "b_mines\0", 'S', NULL}, {1, "b_rpawn\0", 'R', NULL}, {1, "b_persis\0", 'W', NULL}, {1, "b_rndwpn\0", 'R', NULL}, {1, "b_friend\0", 'F', NULL} }; CP_MenuNames LightLevelMenuNames[] = { "DARK", "NORMAL", "BRIGHT", "FOG", "PERIODIC", "LIGHTNING" }; CP_iteminfo LightLevelItems = { 32, 40, 6, 0, 45, LightLevelMenuNames, mn_largefont }; CP_itemtype LightLevelMenu[] = { {2, "b_dark\0", 'D', NULL}, {1, "b_normal\0", 'N', NULL}, {1, "b_bright\0", 'B', NULL}, {1, "b_fog\0", 'F', NULL}, {1, "b_period\0", 'P', NULL}, {1, "b_light\0", 'L', NULL} }; CP_MenuNames PointGoalMenuNames[] = { "1", "5", "11", "21", "50", "100", "RANDOM", "RANDOM BLIND", "INFINITE" }; CP_iteminfo PointGoalItems = { 32, 16, 9, 0, 45, PointGoalMenuNames, mn_largefont }; CP_itemtype PointGoalMenu[] = { {2, "b_1\0", 'a', NULL}, {1, "b_5\0", 'a', NULL}, {1, "b_11\0", 'a', NULL}, {1, "b_21\0", 'a', NULL}, {1, "b_50\0", 'a', NULL}, {1, "b_100\0", 'a', NULL}, {1, "b_random\0", 'R', NULL}, {1, "b_randb\0", 'R', NULL}, {1, "b_inf\0", 'I', NULL} }; CP_MenuNames DangerMenuNames[] = { "LOW", "NORMAL", "KILL" }; CP_iteminfo DangerItems = { 32, 56, 3, 0, 45, DangerMenuNames, mn_largefont }; CP_itemtype DangerMenu[] = { {2, "b_low\0", 'L', NULL}, {1, "b_normal\0", 'N', NULL}, {1, "b_kill\0", 'K', NULL} }; CP_MenuNames TimeLimitMenuNames[] = { "1", "2", "5", "10", "21", "30", "99", "NONE" }; CP_iteminfo TimeLimitItems = { 32, 24, 8, 0, 45, TimeLimitMenuNames, mn_largefont }; CP_itemtype TimeLimitMenu[] = { {2, "b_1\0", 'a', NULL}, {1, "b_2\0", 'a', NULL}, {1, "b_5\0", 'a', NULL}, {1, "b_10\0", 'a', NULL}, {1, "b_21\0", 'a', NULL}, {1, "b_30\0", 'a', NULL}, {1, "b_99\0", 'a', NULL}, {1, "vnone\0", 'N', NULL} }; CP_MenuNames MultiPageCustomNames[ MAXCUSTOM + 2 ] = { "NEXT PAGE", "PREVIOUS PAGE" }; CP_iteminfo MultiPageCustomItems = { 18, 17, 0, 0, 12, MultiPageCustomNames, mn_smallfont }; CP_itemtype MultiPageCustomMenu[] = { {1, "", 'N', NULL}, {1, "", 'P', NULL}, {1, "", 'a', NULL}, {1, "", 'a', NULL}, {1, "", 'a', NULL}, {1, "", 'a', NULL}, {1, "", 'a', NULL}, {1, "", 'a', NULL}, {1, "", 'a', NULL}, {1, "", 'a', NULL}, {1, "", 'a', NULL}, {1, "", 'a', NULL}, {1, "", 'a', NULL}, {1, "", 'a', NULL}, }; #define COLORX 113 #define COLORY 43 #define COLORW 60 #define COLORH 96 // Custom menu stuff static int CUSTOM_y[ 7 ] = { 31, 0, 63, 0, 94, 0, 126 }; // // Save globals // static boolean StartGame = false; static int SaveGamesAvail[ NUMSAVEGAMES ]; static char SaveGameNames[ NUMSAVEGAMES ][ 32 ]; static byte *savedscreen; static mapfileinfo_t * mapinfo; static void HideCursor ( CP_iteminfo *item_i, CP_itemtype *items, int x, int y, int which ); static void ShowCursor ( CP_iteminfo *item_i, CP_itemtype *items, int x, int *y, int which, int basey ); void CP_DrawSelectedGame (int w); int HandleMenu (CP_iteminfo *item_i, CP_itemtype *items, void (*routine)(int w)); void DrawStoredGame ( byte * pic, int episode, int area ); void DrawCustomKeyboard (void); void DrawBattleModeName( int which ); void DrawBattleModeDescription( int w ); void DrawSoundSetupMainMenu( void ); int ColorMenu(void); //****************************************************************************** // // MN_DrawButtons // //****************************************************************************** void MN_DrawButtons ( CP_iteminfo *item_i, CP_itemtype *items, int check, int *nums ) { int i; int button_on; int button_off; button_on = W_GetNumForName( "snd_on" ); button_off = W_GetNumForName( "snd_off" ); for( i = 0; i < item_i->amount; i++ ) { if ( items[ i ].active != CP_Active3 ) { if ( nums[ i ] == check ) { DrawMenuBufItem( item_i->x + 27, item_i->y + i * FontSize[ item_i->fontsize ] - 1, button_on); } else { DrawMenuBufItem( item_i->x + 27, item_i->y + i * FontSize[ item_i->fontsize ] - 1, button_off); } } } } //**************************************************************************** // // MN_GetCursorLocation() // //**************************************************************************** void MN_GetCursorLocation ( CP_iteminfo *item_i, CP_itemtype *items ) { int i; int position; position = -1; for( i = 0; i < item_i->amount; i++ ) { if ( items[ i ].active == CP_CursorLocation ) { position = i; break; } if ( ( items[ i ].active == CP_Active ) && ( position == -1 ) ) { position = i; } } if ( position != -1 ) { item_i->curpos = position; items[ position ].active = CP_CursorLocation; } } //**************************************************************************** // // MN_GetActive () // //**************************************************************************** int MN_GetActive ( CP_iteminfo *item_i, CP_itemtype *items, int check, int *nums ) { int i; int returnval; returnval = 0; for( i = 0; i < item_i->amount; i++ ) { items[ i ].active = CP_Active; if ( nums[ i ] == check ) { item_i->curpos = i; items[ i ].active = CP_CursorLocation; returnval = i; } } return( returnval ); } //**************************************************************************** // // MN_MakeActive () // //**************************************************************************** void MN_MakeActive ( CP_iteminfo *item_i, CP_itemtype *items, int which ) { int i; for( i = 0; i < item_i->amount; i++ ) if (i == which) { items[i].active = CP_CursorLocation; item_i->curpos = i; } else items[i].active = CP_Active; } //****************************************************************************** // // DrawMenu () // // Purpose - Draws a menu // //****************************************************************************** void DrawMenu ( CP_iteminfo *item_i, CP_itemtype *items ) { int i; int active; int color; int posx; int posy; posx = item_i->x + item_i->indent; posy = item_i->y; WindowX = posx; WindowY = posy; WindowW = 320; WindowH = 200; for ( i = 0; i < item_i->amount; i++ ) { posy = item_i->y + i * FontSize[ item_i->fontsize ]; active = items[ i ].active; color = -1; switch( active ) { case CP_CursorLocation : color = ACTIVECOLOR; break; case CP_Inactive : color = NOTAVAILABLECOLOR; break; case CP_Active : color = NORMALCOLOR; break; case CP_SemiActive : color = DIMMEDCOLOR; break; case CP_Highlight : color = HIGHLIGHTCOLOR; break; } if ( color != -1 ) { if ( item_i->names == NULL ) { DrawIMenuBufItem( posx, posy, W_GetNumForName( items[ i ].texture ), color ); } else { IFont = ( cfont_t * )W_CacheLumpName( FontNames[ item_i->fontsize ], PU_CACHE, Cvt_cfont_t, 1 ); if ( item_i->fontsize == mn_tinyfont ) { DrawMenuBufIString( posx + 1, posy, item_i->names[ i ], 0 ); } DrawMenuBufIString( posx, posy - 1, item_i->names[ i ], color ); } } } } //****************************************************************************** // // getASCII () - Gets info from Keyboard. // //****************************************************************************** int getASCII ( void ) { int i; int LS; int RS; int returnvalue = 0; int scancode = 0; IN_UpdateKeyboard (); LS = Keyboard[sc_LShift]; RS = Keyboard[sc_RShift]; Keyboard[sc_LShift] = Keyboard[sc_RShift] = 0; scancode = 0; for (i = 0; i < 127; i++) if (Keyboard[i]) { scancode = i; break; } if (scancode) { if (LS || RS) returnvalue = ShiftNames[scancode]; else returnvalue = ASCIINames[scancode]; } Keyboard[sc_LShift] = LS; Keyboard[sc_RShift] = RS; return (returnvalue); } //****************************************************************************** // // ScanForSavedGames () // //****************************************************************************** void ScanForSavedGames () { char *path, *qm; int which; boolean found = false; // // SEE WHICH SAVE GAME FILES ARE AVAILABLE & READ STRING IN // memset (&SaveGamesAvail[0], 0, sizeof (SaveGamesAvail)); path = M_StringJoin(ApogeePath, PATH_SEP_STR, "rottgam?.rot", NULL); qm = strrchr(path, '?'); for (which = 0; which < NUMSAVEGAMES; which++) { char *file; *qm = (char)('0' + which); file = M_FileCaseExists(path); if (file) { found = true; SaveGamesAvail[which] = 1; GetSavedMessage (which, &SaveGameNames[which][0]); free(file); } } free(path); if (found) { if (MainMenu[loadgame].active == CP_Inactive) MainMenu[loadgame].active = CP_Active; } else MainMenu[loadgame].active = CP_Inactive; } //****************************************************************************** // // SetUpControlPanel () // //****************************************************************************** void SetUpControlPanel (void) { int i; int j; byte * b; byte * s; int Xres = 640; int Yres = 400; // Save the current game screen //bna--savedscreen = SafeMalloc (16000); savedscreen = SafeMalloc (16000*8); // Copy the current save game screen (\xBD size) to this buffer if (RefreshPause==false) { GamePaused=false; ThreeDRefresh(); FlipPage(); FlipPage(); GamePaused=true; } s=savedscreen; if (iGLOBAL_SCREENWIDTH == 320) { for (i=0;i= 640) { for (i=0;icurpos; x = item_i->x; if ((MenuNum == 4) || (MenuNum == 6) || ( item_i->fontsize == mn_smallfont ) ) { basey = item_i->y; CursorLump = SmallCursor; yinc = 9; cursorwidth = cursorheight = 8; } else if ( item_i->fontsize == mn_8x8font ) { basey = item_i->y - 1; CursorLump = SmallCursor; yinc = 7; cursorwidth = cursorheight = 8; } else if ( item_i->fontsize == mn_tinyfont ) { basey = item_i->y - 2; CursorLump = SmallCursor; yinc = 6; cursorwidth = cursorheight = 8; } else { basey = item_i->y-2; CursorLump = LargeCursor; yinc = 14; cursorwidth = cursorheight = 16; } if (MenuNum) y = basey + handlewhich*yinc; else y = CUSTOM_y[handlewhich]; if (MenuNum != 5) DrawMenuBufItem (x, y, W_GetNumForName( CursorLump ) + CursorFrame[ CursorNum ] ); if (routine) routine (handlewhich); count = 2; exit = 0; timer = GetTicCount(); IN_ClearKeysDown (); numactive = GetNumActive (item_i, items); do { ReadAnyControl (&ci); RefreshMenuBuf (0); // Change Cursor Shape if ((GetTicCount() > (timer+count)) && (MenuNum != 5)) { timer = GetTicCount(); CursorNum++; if (CursorNum > (MAXCURSORNUM-1)) CursorNum = 0; EraseMenuBufRegion(x, y, cursorwidth, cursorheight); DrawMenuBufItem (x, y, W_GetNumForName( CursorLump ) + CursorFrame[ CursorNum ] ); } // Initial char - pass 1 key = getASCII (); if (key) { int ok = 0; key = toupper (key); for (i = (handlewhich + 1); i < item_i->amount; i++) if ((items+i)->active && (items+i)->letter == key) { HideCursor (item_i, items, x, y, handlewhich); MN_PlayMenuSnd (SD_MOVECURSORSND); handlewhich = i; if (routine) routine (handlewhich); ShowCursor (item_i, items, x, &y, handlewhich, basey); ok = 1; IN_ClearKeysDown(); break; } // Initial char - pass 2 if (!ok) { for (i = 0; i < handlewhich; i++) if ((items+i)->active && (items+i)->letter == key) { HideCursor (item_i, items, x, y, handlewhich); MN_PlayMenuSnd (SD_MOVECURSORSND); handlewhich = i; if (routine) routine (handlewhich); ShowCursor (item_i, items, x,& y, handlewhich, basey); IN_ClearKeysDown (); break; } } } ReadAnyControl (&ci); if (numactive > 1) { switch (ci.dir) { case dir_North: HideCursor (item_i, items, x, y, handlewhich); CursorNum++; if (CursorNum > (MAXCURSORNUM-1)) CursorNum = 0; // Do a half step if possible if ((handlewhich) && (((items+handlewhich-1)->active == CP_CursorLocation) || ((items+handlewhich-1)->active == CP_Active))) { y -= 6; DrawHalfStep (x, y); playsnd = false; RefreshMenuBuf (0); CursorNum++; if (CursorNum > (MAXCURSORNUM-1)) CursorNum = 0; } else { playsnd = true; RefreshMenuBuf (0); } do { if (!handlewhich) handlewhich = item_i->amount-1; else handlewhich--; } while (((items+handlewhich)->active == CP_Inactive) || ((items+handlewhich)->active == CP_Active3)); if (playsnd) MN_PlayMenuSnd (SD_MOVECURSORSND); ShowCursor (item_i, items, x, &y, handlewhich, basey); if (routine) routine (handlewhich); RefreshMenuBuf(0); break; case dir_South: HideCursor (item_i, items, x, y, handlewhich); CursorNum++; if (CursorNum > (MAXCURSORNUM-1)) CursorNum = 0; // Do a half step if possible if ((handlewhich != item_i->amount-1) && (((items+handlewhich+1)->active == CP_CursorLocation) || ((items+handlewhich+1)->active == CP_Active))) { y += 6; DrawHalfStep(x,y); playsnd = false; RefreshMenuBuf (0); CursorNum++; if (CursorNum > (MAXCURSORNUM-1)) CursorNum = 0; } else { playsnd = true; RefreshMenuBuf (0); } do { if (handlewhich==item_i->amount-1) handlewhich=0; else handlewhich++; } while (((items+handlewhich)->active == CP_Inactive) || ((items+handlewhich)->active == CP_Active3)); if (playsnd) MN_PlayMenuSnd (SD_MOVECURSORSND); ShowCursor(item_i,items,x,&y,handlewhich,basey); if (routine) routine (handlewhich); RefreshMenuBuf (0); break; default: ; } } ReadAnyControl (&ci); if (ci.button0 || Keyboard[sc_Space] || Keyboard[sc_Enter]) { exit = 1; WaitKeyUp (); MN_PlayMenuSnd (SD_SELECTSND); } if (ci.button1 || Keyboard[sc_Escape]) { WaitKeyUp (); exit = 2; } if ( ( Keyboard[ sc_Home ] ) && ( numactive > 1 ) ) { newpos = 0; while( ( items[ newpos ].active == CP_Inactive ) || ( items[ newpos ].active == CP_Active3 ) ) { newpos++; } if ( newpos != handlewhich ) { HideCursor( item_i, items, x, y, handlewhich ); CursorNum++; if ( CursorNum > ( MAXCURSORNUM - 1 ) ) { CursorNum = 0; } RefreshMenuBuf( 0 ); handlewhich = newpos; MN_PlayMenuSnd( SD_MOVECURSORSND ); ShowCursor( item_i, items, x, &y, handlewhich, basey ); if ( routine ) { routine( handlewhich ); } RefreshMenuBuf( 0 ); } } else if ( ( Keyboard[ sc_End ] ) && ( numactive > 1 ) ) { newpos = item_i->amount - 1; while( ( items[ newpos ].active == CP_Inactive ) || ( items[ newpos ].active == CP_Active3 ) ) { newpos--; } if ( newpos != handlewhich ) { HideCursor( item_i, items, x, y, handlewhich ); CursorNum++; if ( CursorNum > ( MAXCURSORNUM - 1 ) ) { CursorNum = 0; } RefreshMenuBuf( 0 ); handlewhich = newpos; MN_PlayMenuSnd( SD_MOVECURSORSND ); ShowCursor( item_i, items, x, &y, handlewhich, basey ); if ( routine ) { routine( handlewhich ); } RefreshMenuBuf( 0 ); } } // Page Up/Down if ( MenuNum == 11 ) { if ( ( Keyboard[ sc_PgUp ] ) && ( ( items + 1 )->active != CP_Inactive ) ) { item_i->curpos = handlewhich; handlewhich = PAGEUP; exit = 3; MN_PlayMenuSnd( SD_SELECTSND ); } else if ( ( Keyboard[ sc_PgDn ] ) && ( ( items + 0 )->active != CP_Inactive ) ) { item_i->curpos = handlewhich; handlewhich = PAGEDOWN; exit = 3; MN_PlayMenuSnd( SD_SELECTSND ); } } // Delete save games if ((MenuNum == 4) || (MenuNum == 6)) { if (Keyboard[sc_Delete] && SaveGamesAvail[handlewhich]) { if (CP_DisplayMsg ("Delete saved game?\nAre you sure?", 12) == true) { char loadname[] = "rottgam0.rot"; char *filename; // Create the proper file name itoa (handlewhich, &loadname[7], 16); loadname[8]='.'; filename = M_StringJoin(ApogeePath, PATH_SEP_STR, loadname, NULL); // Delete the file unlink (filename); free(filename); memset (&SaveGameNames[handlewhich][0], 0, 32); SaveGamesAvail[handlewhich] = 0; if (handlewhich==quicksaveslot) quicksaveslot=-1; PrintX = LSM_X+LSItems.indent+2; PrintY = LSM_Y+handlewhich*9+2; } ScanForSavedGames (); LSItems.curpos = handlewhich; if (MenuNum == 4) DrawLoadSaveScreenAlt (1); else DrawLoadSaveScreenAlt (0); CP_DrawSelectedGame (handlewhich); } } if (Keyboard[sc_CapsLock] && Keyboard[sc_X]) { SaveScreen(true); } else if (Keyboard[sc_CapsLock] && Keyboard[sc_Q]) Error ("Insta-Menu Quit!\n"); } while (!exit); IN_ClearKeysDown(); if (routine) routine (handlewhich); if ( exit != 3 ) { item_i->curpos = handlewhich; } if (MenuNum == 3) { if (exit != 2) CSTactive = handlewhich; else CSTactive = -1; } switch (exit) { case 1: if ((items+handlewhich)->routine!=NULL) (items+handlewhich)->routine(0); return (handlewhich); case 2: MN_PlayMenuSnd (SD_ESCPRESSEDSND); return (-1); case 3: return( handlewhich ); } return (0); } //****************************************************************************** // // HideCursor // //****************************************************************************** void HideCursor ( CP_iteminfo *item_i, CP_itemtype *items, int x, int y, int which ) { int time = GetTicCount(); int color; int delay; int posx; int posy; if ( MenuNum != 5 ) { EraseMenuBufRegion( x, y, cursorwidth, cursorheight ); } if ( MenuNum && ( MenuNum != 4 ) && ( MenuNum != 6 ) ) { posx = item_i->x + item_i->indent; posy = item_i->y + ( which * yinc ); color = -1; switch( items[ which ].active ) { case CP_Inactive : color = NOTAVAILABLECOLOR; break; case CP_CursorLocation : case CP_Active : color = NORMALCOLOR; break; case CP_SemiActive : color = DIMMEDCOLOR; break; case CP_Highlight : color = HIGHLIGHTCOLOR; break; } if ( color != -1 ) { if ( item_i->names == NULL ) { DrawIMenuBufItem( posx, posy, W_GetNumForName( items[ which ].texture ), color ); } else { IFont = ( cfont_t * )W_CacheLumpName( FontNames[ item_i->fontsize ], PU_CACHE, Cvt_cfont_t, 1 ); if ( item_i->fontsize == mn_tinyfont ) { DrawMenuBufIString( posx + 1, posy, item_i->names[ which ], 0 ); } DrawMenuBufIString( posx, posy - 1, item_i->names[ which ], color ); } } } if ( ( items[ which ].active != CP_Inactive ) && ( items[ which ].active != CP_SemiActive ) ) { items[ which ].active = CP_Active; } delay = DELAYAMT - tics; while( ( time + delay ) > GetTicCount() ) { RefreshMenuBuf (0); } } //****************************************************************************** // // DrawHalfStep // //****************************************************************************** void DrawHalfStep (int x, int y) { MN_PlayMenuSnd (SD_MOVECURSORSND); if (MenuNum == 5) return; DrawMenuBufItem (x, y, W_GetNumForName( CursorLump ) + CursorFrame[ CursorNum ] ); } //****************************************************************************** // // GetNumActive () // //****************************************************************************** int GetNumActive (CP_iteminfo *item_i, CP_itemtype *items) { int cnt; int num = 0; for (cnt = 0; cnt < item_i->amount; cnt ++) { if ((items+cnt)->active != CP_Inactive) num++; } return (num); } //****************************************************************************** // // ShowCursor // Draw triad at new position. // //****************************************************************************** void ShowCursor ( CP_iteminfo *item_i, CP_itemtype *items, int x, int *y, int which, int basey ) { int time = GetTicCount(); int delay; int posx; int posy; if ( MenuNum ) { EraseMenuBufRegion( x, *y, cursorwidth, cursorheight ); *y = basey + which * yinc; } else { *y = CUSTOM_y[ which ]; } if ( MenuNum != 5 ) { DrawMenuBufItem( x, *y, W_GetNumForName( CursorLump ) + CursorFrame[ CursorNum ] ); } if ( items[ which ].active != CP_SemiActive ) { if ( MenuNum && ( MenuNum != 4 ) && ( MenuNum != 6 ) ) { posx = item_i->x + item_i->indent; posy = item_i->y + which * yinc; if ( item_i->names == NULL ) { DrawIMenuBufItem( posx, posy, W_GetNumForName( items[ which ].texture ), ACTIVECOLOR); } else { IFont = ( cfont_t * )W_CacheLumpName( FontNames[ item_i->fontsize ], PU_CACHE, Cvt_cfont_t, 1 ); if ( item_i->fontsize == mn_tinyfont ) { DrawMenuBufIString( posx + 1, posy, item_i->names[ which ], 0 ); } DrawMenuBufIString( posx, posy - 1, item_i->names[ which ], ACTIVECOLOR ); } } items[ which ].active = CP_CursorLocation; } delay = DELAYAMT - tics; while( ( time + delay ) > GetTicCount() ) { RefreshMenuBuf( 0 ); } } //****************************************************************************** // // DrawOrderInfo() // //****************************************************************************** void DrawOrderInfo ( int which ) { int start; char *lumpname; start = W_GetNumForName( "ORDRSTRT" ) + 1; lumpname = W_GetNameForNum( start + which ); // Screen shots are grabbed as pics if ( lumpname[ 0 ] == 'S' ) { VWB_DrawPic( 0, 0, ( pic_t * )W_CacheLumpNum( start + which, PU_CACHE, Cvt_pic_t, 1 ) ); } else { VL_DrawPostPic( W_GetNumForName( "trilogo" ) ); DrawNormalSprite( 0, 0, start ); DrawNormalSprite( 0, 0, start + which ); } VW_UpdateScreen(); } //****************************************************************************** // // CP_OrderInfo() // //****************************************************************************** void CP_OrderInfo ( void ) { int maxpage; int page; int key; boolean newpage; maxpage = W_GetNumForName( "ORDRSTOP" ) - W_GetNumForName( "ORDRSTRT" ) - 2; newpage = false; page = 1; do { EnableScreenStretch();//bna++ DrawOrderInfo( page ); DisableScreenStretch();//bna++ turn off or screen will be strected every time it passes VW_UpdateScreen if ( newpage ) { while( Keyboard[ key ] ) { VW_UpdateScreen(); IN_UpdateKeyboard (); } } LastScan=0; while( LastScan == 0 ) { VW_UpdateScreen(); IN_UpdateKeyboard (); } key = LastScan; switch( key ) { case sc_Home : if ( page != 1 ) { page = 1; newpage = true; MN_PlayMenuSnd( SD_MOVECURSORSND ); } break; case sc_End : if ( page != maxpage ) { page = maxpage; newpage = true; MN_PlayMenuSnd( SD_MOVECURSORSND ); } break; case sc_PgUp : case sc_UpArrow : case sc_LeftArrow : if ( page > 1 ) { page--; newpage = true; MN_PlayMenuSnd( SD_MOVECURSORSND ); } break; case sc_PgDn : case sc_DownArrow : case sc_RightArrow : if ( page < maxpage ) { page++; newpage = true; MN_PlayMenuSnd( SD_MOVECURSORSND ); } break; } } while( key != sc_Escape ); Keyboard[ key ] = 0; LastScan = 0; EnableScreenStretch();//bna++ MN_PlayMenuSnd( SD_ESCPRESSEDSND ); } //****************************************************************************** // // CP_ViewScores () // //****************************************************************************** void CP_ViewScores (void) { CheckHighScore (0, 0, true); } //****************************************************************************** // // CP_Quit () - QUIT THIS INFERNAL GAME! // //****************************************************************************** void CP_Quit ( int which ) { int num = 100; static int oldnum; while ((num >= 7) || (oldnum == num)) num = (RandomNumber ("CP_QUIT", 0) & 7); oldnum = num; if (CP_DisplayMsg (endStrings[num], num)) { int handle; MU_FadeOut(310); handle=SD_Play(SD_QUIT1SND+num); VL_FadeOut (0, 255, 0, 0, 0, 10); CleanUpControlPanel(); SD_WaitSound (handle); QuitGame (); } if ( which != -1 ) { ClearMenuBuf(); DrawMainMenu(); DrawMenuBufItem (MainItems.x, ((MainItems.curpos*14)+(MainItems.y-2)), W_GetNumForName ( LargeCursor ) + CursorFrame[ CursorNum ] ); RefreshMenuBuf (0); } } //****************************************************************************** // // CP_DisplayMsg () // //****************************************************************************** boolean CP_DisplayMsg ( char *s, int number ) { #define Q_W 184 #define Q_H 72 #define Q_X ((320-Q_W)/2)-18 #define Q_Y ((200-Q_H)/2)-33 #define Q_b1X (Q_X+85) #define Q_b2X (Q_X+135) #define Q_bY (Q_Y+45) #define Q_bW 33 #define Q_bH 10 #define W_X 72 #define W_Y 11 #define W_W 102 #define YES "q_yes\0" #define NO "q_no\0" ControlInfo ci; boolean retval; boolean done; boolean YESON; boolean redraw; boolean blowout; char *temp; char *active; char *inactive; int activex; int inactivex; int W_H = 0; int L_Y = 0; int tri; int QUITPIC; int t; W_H = 1; retval = false; done = false; YESON = true; redraw = false; blowout = false; IN_ClearKeysDown(); IN_IgnoreMouseButtons(); QUITPIC = W_GetNumForName( "quitpic" ); if ( number < 11 ) { tri = W_GetNumForName( "QUIT01" ) + number; MN_PlayMenuSnd( SD_WARNINGBOXSND ); } else { if ( number == 11 ) { tri = W_GetNumForName( "tri1pic" ); MN_PlayMenuSnd( SD_INFOBOXSND ); } else { if ( number == 12 ) { tri = W_GetNumForName( "tri2pic" ); MN_PlayMenuSnd( SD_QUESTIONBOXSND ); } if ( number == 13 ) { tri = W_GetNumForName( "tri1pic" ); MN_PlayMenuSnd( SD_WARNINGBOXSND ); } } } DrawMenuBufPic( Q_X, Q_Y, QUITPIC ); DrawMenuBufPic( Q_X + 12, Q_Y + 11, tri ); temp = s; while( *temp ) { if ( *temp == '\n' ) { W_H++; } temp++; } CurrentFont = tinyfont; W_H = ( W_H * CurrentFont->height ) + 3; WindowX = Q_X + W_X; WindowY = L_Y + 2; L_Y = Q_Y + W_Y; PrintX = WindowX; PrintY = WindowY; WindowW = W_W; WindowH = W_H; redraw = true; IFont = ( cfont_t * )W_CacheLumpName( FontNames[ mn_smallfont ], PU_CACHE, Cvt_cfont_t, 1 ); /* DrawSTMenuBuf( WindowX, L_Y, W_W, W_H, false ); MenuBufCPrint( s ); DrawSTMenuBuf( Q_b1X, Q_bY, Q_bW, Q_bH, false ); DrawMenuBufIString( Q_b1X + 3, Q_Y + 46, "YES", NORMALCOLOR ); // DrawIMenuBufItem (PrintX, PrintY, W_GetNumForName (YES), NORMALCOLOR); DrawSTMenuBuf( Q_b2X, Q_bY, Q_bW, Q_bH, true ); DrawMenuBufIString( Q_b2X + 2, Q_Y + 45, "NO", ACTIVECOLOR ); // DrawIMenuBufItem (PrintX, PrintY, W_GetNumForName (NO), ACTIVECOLOR); */ if (number != 13) { while ( !done ) { RefreshMenuBuf( 0 ); ReadAnyControl( &ci ); if ( ( ci.dir == dir_West ) && ( !YESON ) ) { MN_PlayMenuSnd( SD_MOVECURSORSND ); YESON = 1; redraw = true; } else if ( ( ci.dir == dir_East ) && ( YESON ) ) { MN_PlayMenuSnd( SD_MOVECURSORSND ); YESON = 0; redraw = true; } if ( Keyboard[ sc_Y ] ) { YESON = 1; redraw = true; Keyboard[ sc_Enter ] = true; blowout = true; } else if ( Keyboard[ sc_N ] ) { YESON = 0; redraw = true; Keyboard[ sc_Enter ] = true; blowout = true; } if ( redraw ) { redraw = false; DrawMenuBufPic( Q_X, Q_Y, QUITPIC ); DrawMenuBufPic( Q_X + 12, Q_Y + 11, tri ); PrintX = Q_X + W_X; PrintY = Q_Y + W_Y + 2; DrawSTMenuBuf( WindowX, L_Y, W_W, W_H, false ); CurrentFont = tinyfont; MenuBufCPrint( s ); if ( YESON ) { active = "YES"; inactive = "NO"; activex = Q_b1X; inactivex = Q_b2X; } else { active = "NO"; inactive = "YES"; activex = Q_b2X; inactivex = Q_b1X; } DrawSTMenuBuf( activex, Q_bY, Q_bW, Q_bH, false ); DrawMenuBufIString( activex + 3, Q_Y + 46, active, ACTIVECOLOR ); // DrawIMenuBufItem (PrintX, PrintY, W_GetNumForName (YES), NORMALCOLOR); DrawSTMenuBuf( inactivex, Q_bY, Q_bW, Q_bH, true ); DrawMenuBufIString( inactivex + 2, Q_Y + 45, inactive, NORMALCOLOR ); // DrawIMenuBufItem (PrintX, PrintY, W_GetNumForName (NO), ACTIVECOLOR); for( t = 0; t < 5; t++ ) { RefreshMenuBuf( 0 ); } } if ( ( Keyboard[ sc_Space ] || Keyboard[ sc_Enter ] || ci.button0 ) && YESON ) { done = true; retval = true; MN_PlayMenuSnd( SD_SELECTSND ); CP_Acknowledge = CP_YES; } else if ( Keyboard[ sc_Escape ] || ci.button1 ) { done = true; retval = false; CP_Acknowledge = CP_ESC; MN_PlayMenuSnd( SD_ESCPRESSEDSND ); } else if ( ( Keyboard[ sc_Space ] || Keyboard[ sc_Enter ] || ci.button0 ) && !YESON ) { done = true; retval = false; CP_Acknowledge = CP_NO; if ( Keyboard[ sc_N ] ) { MN_PlayMenuSnd( SD_SELECTSND ); } else { MN_PlayMenuSnd( SD_ESCPRESSEDSND ); } } } while( ( Keyboard[ sc_Enter ] || Keyboard[ sc_Space ] || Keyboard[ sc_Escape ] ) && !blowout ) { IN_UpdateKeyboard(); RefreshMenuBuf( 0 ); } } else { PrintX = Q_X + W_X; PrintY = Q_Y + W_Y + 2; DrawSTMenuBuf( WindowX, L_Y, W_W, W_H, false ); CurrentFont = tinyfont; MenuBufCPrint( s ); LastScan=0; while (LastScan == 0) { IN_UpdateKeyboard(); RefreshMenuBuf( 0 ); } LastScan = 0; } IN_ClearKeysDown(); return( retval ); } //****************************************************************************** // // EndGameStuff () // //****************************************************************************** void EndGameStuff (void) { Z_FreeTags( PU_LEVELSTRUCT, PU_LEVELEND ); pickquick = false; CheckHighScore (gamestate.score, gamestate.mapon+1, true); locplayerstate->lives = 0; playstate = ex_died; damagecount = 0; SetBorderColor (0); AdjustMenuStruct (); ingame = false; GamePaused = false; } //****************************************************************************** // // START A NEW GAME // //****************************************************************************** #define CURGAME "You are currently in\n"\ "a game. Continuing will\n"\ "erase old game. Ok?\0" int ToughMenuNum; void CP_NewGame ( void ) { int which; #if ( SHAREWARE == 1 ) ToughMenuNum = 0; #else int temp; temp = ToughMenuNum; while( ToughMenuNum == temp ) { temp = ( ( RandomNumber( "TOUGH MENU", 0 ) ) & 3 ); if ( temp == 3 ) { temp = 1; } } ToughMenuNum = temp; #endif // // ALREADY IN A GAME? // if ( ingame ) { if ( !CP_DisplayMsg( CURGAME, 12 ) ) { return; } else { EndGameStuff(); } } else { handlewhich = 100; } if ( CP_PlayerSelection() == 0 ) { return; } TufMenu[ ToughMenuNum ][ 0 ].active = CP_Active; TufMenu[ ToughMenuNum ][ 2 ].active = CP_Active; TufMenu[ ToughMenuNum ][ 4 ].active = CP_Active; TufMenu[ ToughMenuNum ][ 6 ].active = CP_Active; switch( DefaultDifficulty ) { case gd_baby : TufItems.curpos = 0; break; case gd_easy : TufItems.curpos = 2; break; case gd_medium : TufItems.curpos = 4; break; case gd_hard : TufItems.curpos = 6; break; default : TufItems.curpos = 0; break; } TufMenu[ ToughMenuNum ][ TufItems.curpos ].active = CP_CursorLocation; DrawNewGame(); which = HandleMenu( &TufItems, &TufMenu[ ToughMenuNum ][ 0 ], DrawNewGameDiff ); if ( which < 0 ) { handlewhich = 1; return; } handlewhich = 0; switch( which ) { case 0 : DefaultDifficulty = gd_baby; break; case 2 : DefaultDifficulty = gd_easy; break; case 4 : DefaultDifficulty = gd_medium; break; case 6 : DefaultDifficulty = gd_hard; break; } MainMenu[ savegame ].active = CP_Active; gamestate.battlemode = battle_StandAloneGame; StartGame = true; DisableScreenStretch(); playstate = ex_resetgame; } //****************************************************************************** // // CP_EndGame () // //****************************************************************************** #define ENDGAMESTR "Are you sure you want\n"\ "to end the game you\n"\ "are playing? (Y or N):" void CP_EndGame ( void ) { boolean action; SetMenuTitle( "End Game" ); action = CP_DisplayMsg( ENDGAMESTR, 12 ); StartGame = false; EnableScreenStretch(); if ( action ) { EndGameStuff (); pickquick = false; } } //****************************************************************************** // // AdjustMenuStruct () // //****************************************************************************** void AdjustMenuStruct ( void ) { MainMenu[ savegame ].active = CP_Inactive; MainMenu[ viewscores ].routine = ( void * )CP_ViewScores; MainMenu[ viewscores ].texture[ 6 ] = '7'; MainMenu[ viewscores ].texture[ 7 ] = '\0'; MainMenu[ viewscores ].letter = 'V'; strcpy (MainMenuNames[ viewscores ] , "VIEW SCORES"); } //****************************************************************************** // // CP_DrawSelectedGame // //****************************************************************************** void CP_DrawSelectedGame (int w) { gamestorage_t game; if (SaveGamesAvail[w]) { GetSavedHeader(w,&game); DrawStoredGame(&game.picture[0],game.episode,game.area); } else EraseMenuBufRegion(SaveGamePicX,SaveGamePicY,160,124); } //****************************************************************************** // // DrawStoredGame // //****************************************************************************** void DrawStoredGame ( byte * pic, int episode, int area ) { char str[3]; int level; byte *shape; shape = W_CacheLumpNum (W_GetNumForName ("newfnt1"), PU_CACHE, Cvt_font_t, 1); newfont1 = (font_t *)shape; CurrentFont = newfont1; EraseMenuBufRegion (74, 128, 85, 14); DrawMenuBufPropString (74, 128, "E"); itoa (episode, str, 10); DrawMenuBufPropString (87, 128, str); DrawMenuBufPropString (103, 128, "A"); if (episode > 1) level = (area+1) - ((episode-1) << 3); else level = area+1; ltoa (level, str, 10); DrawMenuBufPropString (117, 128, str); CurrentFont = tinyfont; DrawMenuBufPicture(SaveGamePicX,SaveGamePicY,pic,160,100); } //****************************************************************************** // // DoLoad () // //****************************************************************************** int DoLoad (int which) { gamestorage_t game; int exit = 0; if ((which >= 0) && SaveGamesAvail[which]) { loadedgame = true; if (loadsavesound) MN_PlayMenuSnd (SD_SELECTSND); if (LoadTheGame (which, &game) == true) { MenuFixup (); DisableScreenStretch(); StartGame = true; exit = 1; } else { if (CP_DisplayMsg ("Saved Game is\n old or incompatible\nDelete it?", 12)==true) { char loadname[] = "rottgam0.rot"; char *filename; // Create the proper file name itoa (which, &loadname[7], 16); loadname[8]='.'; filename = M_StringJoin(ApogeePath, PATH_SEP_STR, loadname, NULL); // Delete the file unlink (filename); free(filename); memset (&SaveGameNames[which][0], 0, 32); SaveGamesAvail[which] = 0; } loadedgame = false; DrawLoadSaveScreenAlt (0); } } return (exit); } //****************************************************************************** // // LOAD SAVED GAMES // //****************************************************************************** int CP_LoadGame (int quick, int dieload) { int which, exit = 0; MenuNum = 6; SaveTime = GetTicCount(); // // QUICKLOAD? // if (quick) { which = LSItems.curpos; if (SaveGamesAvail[which]) { if (dieload) { DrawLoadSaveScreenAlt (0); CP_DrawSelectedGame (which); RefreshMenuBuf (0); DoLoad (which); return (1); } else { DrawLoadSaveScreen (0); if (CP_DisplayMsg ("Quick load saved game?\nAre you sure?", 12) == true) { DrawLoadSaveScreen (0); CP_DrawSelectedGame (which); RefreshMenuBuf (0); DoLoad (which); return (1); } else { return (0); } } } } DrawLoadSaveScreen (0); do { which = HandleMenu (&LSItems, &LSMenu[0], CP_DrawSelectedGame); if ((exit = DoLoad (which))) break; } while (which >= 0); handlewhich = OUTOFRANGE; if (MainMenu[loadgame].active == CP_Inactive) // If all the saved games have been { MainItems.curpos = 0; // deleted dehighlight LOADGAME MainMenu[newgame].active = CP_CursorLocation; } return exit; } //****************************************************************************** // // QuickSaveGame () // //****************************************************************************** void QuickSaveGame (void) { int i; int j; byte * b; byte * s; int which; gamestorage_t game; byte * buf; int length; char loadname[]="rottgam0.rot"; char *filename; // Create the proper file name itoa(quicksaveslot,&loadname[7],16); loadname[8]='.'; filename = M_StringJoin(ApogeePath, PATH_SEP_STR, loadname, NULL); length=LoadFile(filename,(void **)&buf); free(filename); filename = M_StringJoin(ApogeePath, PATH_SEP_STR, QUICKSAVEBACKUP, NULL); SaveFile(filename,buf,length); free(filename); SafeFree(buf); s=&game.picture[0]; for (i=0;i<320;i+=2) { b=(byte *)bufferofs+i; for (j=0;j<100;j++,s++,b+=(iGLOBAL_SCREENWIDTH<<1)) *s=*b; } ScanForSavedGames (); which = quicksaveslot; if (SaveGamesAvail[which]) { game.episode = gamestate.episode; game.area = gamestate.mapon; game.version = ROTTVERSION; strcpy (game.message, &SaveGameNames[which][0]); if (SaveTheGame (which, &game) == true) { char str[50]; strcpy (str, "Game Saved: "); strcat (str, &SaveGameNames[which][0]); AddMessage(str,MSG_SYSTEM); } else { AddMessage("Game Not Saved.",MSG_SYSTEM); } } else { AddMessage("No Quick Save Slot.",MSG_SYSTEM); } } //****************************************************************************** // // UndoQuickSaveGame () // //****************************************************************************** void UndoQuickSaveGame (void) { byte * buf; char loadname[]="rottgam0.rot"; char *filename; int length; if (quicksaveslot!=-1) { // Create the proper file name itoa(quicksaveslot,&loadname[7],16); loadname[8]='.'; filename = M_StringJoin(ApogeePath, PATH_SEP_STR, QUICKSAVEBACKUP, NULL); length=LoadFile(filename,(void **)&buf); free(filename); filename = M_StringJoin(ApogeePath, PATH_SEP_STR, loadname, NULL); SaveFile(filename,buf,length); free(filename); SafeFree(buf); AddMessage("Previous Quicksave Game Restored.",MSG_SYSTEM); } else { AddMessage("No Quick Save Slot Selected.",MSG_SYSTEM); } } //****************************************************************************** // // SAVE CURRENT GAME // //****************************************************************************** int CP_SaveGame ( void ) { int which, exit=0; char input[32]; gamestorage_t game; MenuNum = 4; DrawLoadSaveScreen (1); do { which = HandleMenu (&LSItems, &LSMenu[0], CP_DrawSelectedGame); if (which >= 0) { // // OVERWRITE EXISTING SAVEGAME? // if (SaveGamesAvail[which]) { if (!CP_DisplayMsg (GAMESVD, 12)) { DrawLoadSaveScreenAlt (1); continue; } else { DrawLoadSaveScreenAlt (1); EraseMenuBufRegion (LSM_X+LSItems.indent, LSM_Y+1+which*9, 80, 8); PrintLSEntry (which); } } quicksaveslot=which; DrawStoredGame (savedscreen, gamestate.episode, gamestate.mapon); strcpy (input, &SaveGameNames[which][0]); if (!SaveGamesAvail[which]) EraseMenuBufRegion (LSM_X+LSItems.indent+1, LSM_Y+which*9+2, 77, 6); if (US_LineInput (LSM_X+LSItems.indent+2, LSM_Y+which*9+2, input, input, true, 22, 75, 0)) { SaveGamesAvail[which] = 1; memcpy(&game.picture[0],savedscreen,16000); game.episode=gamestate.episode; game.area=gamestate.mapon; game.version=ROTTVERSION; strcpy (game.message, input); strcpy (&SaveGameNames[which][0], input); if (SaveTheGame(which,&game)==true) { MainMenu[loadgame].active=CP_Active; // MN_PlayMenuSnd (SD_SELECTSND); exit = 1; } WaitKeyUp (); } else { EraseMenuBufRegion (LSM_X+LSItems.indent+1, LSM_Y+which*9+2, 77, 6); PrintX = LSM_X+LSItems.indent+2; PrintY = LSM_Y+which*9+2; if (SaveGamesAvail[which]) DrawMenuBufPropString (PrintX, PrintY, SaveGameNames[which]); else DrawMenuBufPropString (PrintX, PrintY, " - \x81 -"); // MN_PlayMenuSnd (SD_ESCPRESSEDSND); continue; } break; } } while (which >= 0); handlewhich = OUTOFRANGE; return (exit); } //****************************************************************************** // // DEFINE CONTROLS // //****************************************************************************** void CP_Control (void) { #define CTL_SPC 70 int which; DrawCtlScreen (); WaitKeyUp (); do { which = HandleMenu (&CtlItems, &CtlMenu[0], NULL); switch (CSTactive) { case MOUSEENABLE: if (MousePresent) { mouseenabled^=1; DrawCtlButtons (); CusItems.curpos=-1; } else mouseenabled = 0; break; case JOYENABLE: joystickenabled^=1; if ( joystickenabled ) { if ( !CalibrateJoystick() ) { joystickenabled = 0; joypadenabled = 0; } } else { joypadenabled = 0; } DrawCtlScreen(); break; case USEPORT2: joystickport^=1; if ( joystickport ) { joypadenabled = 0; } joystickenabled = 1; if ( !CalibrateJoystick() ) { joystickenabled = 0; joystickport = 0; } if ( joystickport ) { CtlMenu[ 3 ].active = CP_Inactive; joypadenabled = 0; } else { CtlMenu[ 3 ].active = CP_Active; } DrawCtlScreen(); break; case PADENABLE: joypadenabled^=1; if ( ( joypadenabled ) && ( !joystickenabled ) ) { joystickenabled=1; if ( !CalibrateJoystick() ) { joystickenabled = 0; joypadenabled = 0; } DrawCtlScreen(); } else { DrawCtlButtons (); } break; case THRESSENS: case MOUSESENS: case CUSTOMIZE: DrawCtlScreen (); break; } } while (which >= 0); DrawControlMenu (); if (which < 0) { handlewhich = 1; return; } } //**************************************************************************** // // CP_Custom () // //**************************************************************************** void CP_Custom (void) { int which; DrawCustomMenu(); do { which = HandleMenu (&CustomItems, &CustomMenu[0], NULL); } while (which >= 0); DrawCtlScreen (); } //****************************************************************************** // // CUSTOMIZE CONTROLS // //****************************************************************************** //**************************************************************************** // // CP_Keyboard () // //**************************************************************************** void CP_Keyboard ( void ) { int which; MenuNum = 1; DrawCustomKeyboard (); do { which = HandleMenu( &NormalKeyItems, &NormalKeyMenu[ 0 ], NULL ); } while( which >= 0 ); DrawCustomMenu(); } //****************************************************************************** // // DEFINE THE KEYBOARD BUTTONS // //****************************************************************************** void DefineKey ( void ) { boolean tick; boolean picked; int timer; int x; int y; tick = false; picked = false; timer = GetTicCount(); x = NORMALKEY_X + 97; y = NORMALKEY_Y + ( handlewhich * FontSize[ NormalKeyItems.fontsize ] ); strcpy( &NormalKeyNames[ handlewhich ][ KEYNAMEINDEX ], " " ); // SetMenuTitle ( "Select which key to use" ); ClearMenuBuf(); DrawMenu( &NormalKeyItems, &NormalKeyMenu[ 0 ] ); DisplayInfo( 0 ); DrawMenuBufIString( x + 3, y, "?", 0 ); DrawMenuBufIString( x + 2, y - 1, "?", HIGHLIGHTCOLOR ); RefreshMenuBuf( 0 ); do { IN_PumpEvents(); // // FLASH CURSOR // if ( ( GetTicCount() - timer ) > 10 ) { int color; if ( tick ) { color = HIGHLIGHTCOLOR; } else { color = DIMMEDCOLOR; } DrawMenuBufIString( x + 3, y, "?", 0 ); DrawMenuBufIString( x + 2, y - 1, "?", color ); tick = !tick; timer = GetTicCount(); } RefreshMenuBuf( 0 ); if ( LastScan ) { int key; key = LastScan; LastScan = 0; buttonscan[ (unsigned int)order[ handlewhich ] ] = key; strcpy( &NormalKeyNames[ handlewhich ][ KEYNAMEINDEX ], IN_GetScanName( key ) ); picked = true; WaitKeyUp(); Keyboard[ key ] = 0; IN_ClearKeysDown(); } } while( !picked ); ClearMenuBuf(); SetMenuTitle( "Customize Keyboard" ); DrawMenu( &NormalKeyItems, &NormalKeyMenu[ 0 ] ); DisplayInfo( 0 ); RefreshMenuBuf (0); } //**************************************************************************** // // DrawControlSelect () // //**************************************************************************** void DrawControlSelect ( void ) { MenuNum = 1; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Select Button Function"); MN_GetCursorLocation( &ControlSelectItems, &ControlSelectMenu[ 0 ] ); DrawMenu( &ControlSelectItems, &ControlSelectMenu[ 0 ] ); DisplayInfo( 0 ); FlipMenuBuf(); } //**************************************************************************** // // DefineMouseBtn() // //**************************************************************************** void DefineMouseBtn ( void ) { int button; int which; button = handlewhich; MN_GetActive( &ControlSelectItems, &ControlSelectMenu[ 0 ], buttonmouse[ button ], controlorder ); DrawControlSelect(); which = HandleMenu( &ControlSelectItems, &ControlSelectMenu[ 0 ], NULL ); if ( which != -1 ) { buttonmouse[ button ] = controlorder[ which ]; } handlewhich = OUTOFRANGE; } //**************************************************************************** // // CP_Mouse () // //**************************************************************************** void CP_Mouse ( void ) { int which; MenuNum = 1; do { DrawCustomMouse(); which = HandleMenu( &MouseBtnItems, &MouseBtnMenu[ 0 ], NULL ); } while( which >= 0 ); handlewhich = OUTOFRANGE; DrawCustomMenu(); } //**************************************************************************** // // DrawCustomMouse () // //**************************************************************************** void DrawCustomMouse ( void ) { int i; int j; int num; int button; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Customize Mouse"); for( i = 0; i < 6; i++ ) { num = 0; button = buttonmouse[ i ]; buttonmouse[ i ] = bt_nobutton; MouseBtnNames[ i ][ MOUSEBTNINDEX ] = 0; for( j = 0; j < NUMCONTROLNAMES; j++ ) { if ( button == controlorder[ j ] ) { buttonmouse[ i ] = button; num = j; break; } } strcpy( &MouseBtnNames[ i ][ MOUSEBTNINDEX ], ControlNames[ num ] ); } MN_GetCursorLocation( &MouseBtnItems, &MouseBtnMenu[ 0 ] ); DrawMenu( &MouseBtnItems, &MouseBtnMenu[ 0 ] ); DisplayInfo( 0 ); FlipMenuBuf(); } //**************************************************************************** // // DefineJoyBtn() // //**************************************************************************** void DefineJoyBtn ( void ) { int button; int which; button = handlewhich; MN_GetActive( &ControlSelectItems, &ControlSelectMenu[ 0 ], buttonjoy[ button ], controlorder ); DrawControlSelect(); which = HandleMenu( &ControlSelectItems, &ControlSelectMenu[ 0 ], NULL ); if ( which != -1 ) { buttonjoy[ button ] = controlorder[ which ]; } handlewhich = OUTOFRANGE; } //**************************************************************************** // // DrawCustomJoystick () // //**************************************************************************** void DrawCustomJoystick ( void ) { int i; int j; int num; int button; int active; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Customize Joystick"); for( i = 0; i < 8; i++ ) { num = 0; button = buttonjoy[ i ]; buttonjoy[ i ] = bt_nobutton; JoyBtnNames[ i ][ JOYBTNINDEX ] = 0; for( j = 0; j < NUMCONTROLNAMES; j++ ) { if ( button == controlorder[ j ] ) { buttonjoy[ i ] = button; num = j; break; } } strcpy( &JoyBtnNames[ i ][ JOYBTNINDEX ], ControlNames[ num ] ); } JoyBtnMenu[ 0 ].active = CP_Active; JoyBtnMenu[ 1 ].active = CP_Active; JoyBtnMenu[ 4 ].active = CP_Active; JoyBtnMenu[ 5 ].active = CP_Active; if ( joypadenabled ) { active = CP_Active; } else { active = CP_Inactive; } JoyBtnMenu[ 2 ].active = active; JoyBtnMenu[ 3 ].active = active; JoyBtnMenu[ 6 ].active = active; JoyBtnMenu[ 7 ].active = active; if ( JoyBtnMenu[ JoyBtnItems.curpos ].active == CP_Inactive ) { MN_GetCursorLocation( &JoyBtnItems, &JoyBtnMenu[ 0 ] ); } else { JoyBtnMenu[ JoyBtnItems.curpos ].active = CP_CursorLocation; } DrawMenu( &JoyBtnItems, &JoyBtnMenu[ 0 ] ); DisplayInfo( 0 ); FlipMenuBuf(); } //**************************************************************************** // // CP_Joystick () // //**************************************************************************** void CP_Joystick ( void ) { int which; MenuNum = 1; do { DrawCustomJoystick(); which = HandleMenu( &JoyBtnItems, &JoyBtnMenu[ 0 ], NULL ); } while( which >= 0 ); handlewhich = OUTOFRANGE; DrawCustomMenu(); } //****************************************************************************** // // PRINT A MESSAGE IN A WINDOW // //****************************************************************************** void Message (char *string) { int h = 0, w = 0, mw = 0, i; byte *shape; shape = W_CacheLumpNum (W_GetNumForName ("newfnt1"), PU_CACHE, Cvt_font_t, 1); newfont1 = (font_t *)shape; CurrentFont = newfont1; h = CurrentFont->height; for (i = 0; i < (int)strlen (string); i++) if (string[i] == '\n') { if (w > mw) mw = w; w = 0; h += CurrentFont->height; } else w += CurrentFont->width[string[i]-31]; if ((w + 10) > mw) mw = w+10; PrintY = 78 - (h / 2); PrintX = WindowX = 143 - (mw / 2); WindowW = mw; EraseMenuBufRegion (WindowX-5, PrintY-5, (mw+14)&0xFFFC, h+10); DrawSTMenuBuf (WindowX-5, PrintY-5, (mw+14)&0xFFFC, h+10, true); MenuBufCPrint (string); RefreshMenuBuf (0); } //****************************************************************************** // // DRAW NEW GAME MENU // //****************************************************************************** void DrawNewGame (void) { MenuNum = 5; SetAlternateMenuBuf (); ClearMenuBuf (); SetMenuTitle ("Choose Difficulty"); DrawMenu (&TufItems, &TufMenu[ToughMenuNum][0]); DrawNewGameDiff (TufItems.curpos); DisplayInfo (0); FlipMenuBuf(); } //****************************************************************************** // // DRAW NEW GAME GRAPHIC // //****************************************************************************** int newgameY[7] = {19, 0, 42, 0, 74, 0, 93}; char *DifficultyStrings[ 4 ] = { "Easy", "Medium", "Hard", "Crezzy Man" }; void DrawNewGameDiff ( int w ) { int x; switch ( w ) { case 0: x = 0; break; case 2: x = 1; break; case 4: x = 2; break; case 6: x = 3; break; } EraseMenuBufRegion( 25, 18, 52, 125 ); DrawMenuBufPic( 25, newgameY[ w ], W_GetNumForName( "NEWG1" ) + ( ToughMenuNum * 4 ) + x ); EraseMenuBufRegion( 25, 149, 64, 8 ); // DrawMenuBufPic (25, 149, W_GetNumForName( "O_EASY" ) + x ); CurrentFont = tinyfont; DrawMenuBufPropString( 25, 149, DifficultyStrings[ x ] ); } //****************************************************************************** // // DRAW THE LOAD/SAVE SCREEN // //****************************************************************************** void DrawLoadSaveScreen (int loadsave) { int i; byte *shape; shape = W_CacheLumpNum (W_GetNumForName ("newfnt1"), PU_CACHE, Cvt_font_t, 1); newfont1 = (font_t *)shape; CurrentFont = newfont1; if (numdone || (!ingame) || (!inmenu)) SetAlternateMenuBuf(); ClearMenuBuf(); if (loadsave) { SetMenuTitle ("Save Game"); } else { SetMenuTitle ("Load Game"); } for (i = 0; i < NUMSAVEGAMES; i++) PrintLSEntry (i); DrawMenuBufItem (LSItems.x, ((LSItems.curpos*9)+(LSItems.y)), W_GetNumForName( SmallCursor ) + CursorFrame[ CursorNum ] ); DisplayInfo (7); if ((!numdone) && ingame && inmenu) RefreshMenuBuf (0); else FlipMenuBuf(); WaitKeyUp (); numdone++; } //****************************************************************************** // // DRAW THE LOAD/SAVE SCREEN - no flip // //****************************************************************************** void DrawLoadSaveScreenAlt (int loadsave) { int i; byte *shape; shape = W_CacheLumpNum (W_GetNumForName ("newfnt1"), PU_CACHE, Cvt_font_t, 1); newfont1 = (font_t *)shape; CurrentFont = newfont1; ClearMenuBuf(); if (loadsave) { SetMenuTitle ("Save Game"); } else { SetMenuTitle ("Load Game"); } for (i = 0; i < NUMSAVEGAMES; i++) PrintLSEntry (i); DrawMenuBufItem (LSItems.x, ((LSItems.curpos*9)+(LSItems.y)), W_GetNumForName( SmallCursor ) + CursorFrame[ CursorNum ] ); DisplayInfo (7); RefreshMenuBuf (0); WaitKeyUp (); numdone++; } //****************************************************************************** // // PRINT LOAD/SAVE GAME ENTRY W/BOX OUTLINE // //****************************************************************************** void PrintLSEntry (int w) { DrawSTMenuBuf (LSM_X+LSItems.indent, LSM_Y+1+w*9, 80, 7, false); PrintX = LSM_X+LSItems.indent+2; PrintY = LSM_Y+(w*9)+2; CurrentFont = tinyfont; if (SaveGamesAvail[w]) DrawMenuBufPropString (PrintX, PrintY, SaveGameNames[w]); else DrawMenuBufPropString (PrintX, PrintY, " - \x81 -"); } //****************************************************************************** // // CALIBRATE JOYSTICK // //****************************************************************************** int CalibrateJoystick ( void ) { #define CALX 45 #define CALY 22 word xmax, ymax, xmin, ymin, jb; int checkbits; int status; boolean done; if ( joypadenabled ) { // Gravis GamePad : Check all buttons checkbits = ( 1 << 0 ) + ( 1 << 1 ) + ( 1 << 2 ) + ( 1 << 3 ); } else if ( joystickport ) { // Joystick port 2 : check only buttons 2 and 3 checkbits = ( 1 << 2 ) + ( 1 << 3 ); } else { // Joystick port 1 : check only buttons 0 and 1 checkbits = ( 1 << 0 ) + ( 1 << 1 ); } status = 0; done = false; while( !done ) { SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Calibrate Joystick"); //DrawMenuBufItem( CALX, CALY, W_GetNumForName( "joystk2" ) ); WindowW = 288; WindowH = 158; PrintX = WindowX = 0; PrintY = WindowY = 50; newfont1 = (font_t *)W_CacheLumpName( "newfnt1", PU_CACHE, Cvt_font_t, 1 ); CurrentFont = newfont1; MenuBufCPrint( "MOVE JOYSTICK TO\nUPPER LEFT AND\nPRESS A BUTTON." ); DisplayInfo( 2 ); FlipMenuBuf(); do { RefreshMenuBuf( 0 ); jb = IN_JoyButtons(); IN_UpdateKeyboard(); if ( Keyboard[ sc_Escape ] ) { return( 0 ); } } while( !( jb & checkbits ) ); IN_GetJoyAbs( joystickport, &xmin, &ymin ); MN_PlayMenuSnd( SD_SELECTSND ); while( IN_JoyButtons() & checkbits ) { IN_UpdateKeyboard(); if ( Keyboard[ sc_Escape ] ) { return( 0 ); } } ClearMenuBuf(); // DrawMenuBufItem( CALX, CALY, W_GetNumForName( "joystk1" ) ); WindowW = 288; WindowH = 158; PrintX = WindowX = 0; PrintY = WindowY = 50; newfont1 = (font_t *)W_CacheLumpName( "newfnt1", PU_CACHE, Cvt_font_t, 1 ); CurrentFont = newfont1; MenuBufCPrint( "MOVE JOYSTICK TO\nLOWER RIGHT AND\nPRESS A BUTTON." ); DisplayInfo( 2 ); do { RefreshMenuBuf( 0 ); jb = IN_JoyButtons(); IN_UpdateKeyboard(); if ( Keyboard[ sc_Escape ] ) { return( 0 ); } } while( !( jb & checkbits ) ); IN_GetJoyAbs( joystickport, &xmax, &ymax ); MN_PlayMenuSnd( SD_SELECTSND ); while( IN_JoyButtons() & checkbits ) { IN_UpdateKeyboard(); if ( Keyboard[ sc_Escape ] ) { return( 0 ); } } // // ASSIGN ACTUAL VALUES HERE // if ( ( xmin < xmax ) && ( ymin < ymax ) ) { IN_SetupJoy( joystickport, xmin, xmax, ymin, ymax ); joyxmin = xmin; joyxmax = xmax; joyymin = ymin; joyymax = ymax; status = 1; done = true; } else { CP_ErrorMsg( "Joystick Error", "Calibration failed. The joystick must be moved " "to the upper-left first and then the lower-right.", mn_smallfont ); } } return( status ); } //****************************************************************************** // // ADJUST MOUSE SENSITIVITY // //****************************************************************************** void MouseSensitivity ( void ) { SliderMenu( &mouseadjustment, 11, 0, 21, 81, 240, 1, "block1", NULL, "Mouse Sensitivity", "Slow", "Fast" ); } //****************************************************************************** // // ADJUST MOUSE AND JOYSTICK THRESHOLD // //****************************************************************************** void DoThreshold ( void ) { SliderMenu (&threshold, 15, 1, 44, 81, 194, 1, "block2", NULL, "Adjust Threshold", "Small", "Large" ); } //****************************************************************************** // // DRAW CONTROL MENU SCREEN // //****************************************************************************** void DrawCtlScreen (void) { MenuNum = 3; if (numdone || (!ingame) || (!inmenu)) SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Options"); DrawCtlButtons (); DisplayInfo (0); DrawMenu (&CtlItems, &CtlMenu[0]); DrawMenuBufItem (CtlItems.x, ((CtlItems.curpos*14)+(CtlItems.y-2)), W_GetNumForName( LargeCursor ) + CursorFrame[ CursorNum ] ); if (ingame && inmenu && (!numdone)) RefreshMenuBuf (0); else FlipMenuBuf(); numdone++; } //****************************************************************************** // // DrawCtlButtons () // //****************************************************************************** void DrawCtlButtons (void) { int i, x, y; static boolean first = true; int button_on; int button_off; button_on = W_GetNumForName ("snd_on"); button_off = W_GetNumForName ("snd_off"); WindowX = 0; WindowW = 320; if (first) { if (JoysPresent[0] || JoysPresent[1]) { CtlMenu[JOYENABLE].active = CP_Active; CtlMenu[USEPORT2].active = CP_Active; CtlMenu[PADENABLE].active = CP_Active; CtlMenu[THRESSENS].active = CP_Active; } else { joystickenabled = 0; joypadenabled = 0; joystickport = 0; } if (MousePresent) { CtlMenu[THRESSENS].active = CP_Active; CtlMenu[MOUSESENS].active = CP_Active; CtlMenu[MOUSEENABLE].active = CP_Active; } else { CtlMenu[0].active = CP_Inactive; mouseenabled = 0; } for (x = 0; x < CtlItems.amount; x++) { if (CtlMenu[x].active) { CtlMenu[x].active = CP_CursorLocation; break; } } first = false; } x = CTL_X+CtlItems.indent-18; y = MENU_Y-1; if (mouseenabled) DrawMenuBufItem (x, y, button_on); else { EraseMenuBufRegion (x, y, 16, 16); DrawMenuBufItem (x, y, button_off); } y += 14; if (joystickenabled) DrawMenuBufItem (x, y, button_on); else { EraseMenuBufRegion (x, y, 16, 16); DrawMenuBufItem (x, y, button_off); } y += 14; if (joystickport) DrawMenuBufItem (x, y, button_on); else { EraseMenuBufRegion (x, y, 16, 16); DrawMenuBufItem (x, y, button_off); } y += 14; if (joypadenabled) DrawMenuBufItem (x, y, button_on); else { EraseMenuBufRegion (x, y, 16, 16); DrawMenuBufItem (x, y, button_off); } if ((CtlItems.curpos < 0) || (!CtlMenu[CtlItems.curpos].active)) for (i = 0; i < CtlItems.amount; i++) if (CtlMenu[i].active) { CtlItems.curpos = i; break; } } //****************************************************************************** // // WAIT FOR CTRLKEY-UP OR BUTTON-UP // //****************************************************************************** void WaitKeyUp (void) { ControlInfo ci; IN_IgnoreMouseButtons(); ReadAnyControl (&ci); while (ci.button0 || ci.button1 || ci.button2 || ci.button3 || Keyboard[sc_Space] || Keyboard[sc_Enter] || Keyboard[sc_Escape]) { ReadAnyControl (&ci); RefreshMenuBuf (0); if (Keystate[sc_CapsLock] && Keystate[sc_Q]) Error("Stuck in WaitKeyUp\n"); } } #define PMOUSE 3 #define SMOUSE 4 //****************************************************************************** // // READ KEYBOARD, JOYSTICK AND MOUSE FOR INPUT // //****************************************************************************** void ReadAnyControl (ControlInfo *ci) { int mouseactive = 0; word buttons = 0; // struct Spw_IntPacket packet; IN_UpdateKeyboard (); /* implies IN_PumpEvents() ... */ IN_ReadControl (0, ci); if (MousePresent && mouseenabled) { int mousey, mousex; INL_GetMouseDelta(&mousex, &mousey); if (mousex >= SENSITIVE) { ci->dir = dir_East; mouseactive = 1; } else if (mousex <= -SENSITIVE) { ci->dir = dir_West; mouseactive = 1; } if (mousey >= SENSITIVE) { ci->dir = dir_South; mouseactive = 1; } else if (mousey <= -SENSITIVE) { ci->dir = dir_North; mouseactive = 1; } buttons = IN_GetMouseButtons(); if ( buttons ) { ci->button0 = buttons & 1; ci->button1 = buttons & 2; ci->button2 = buttons & 4; ci->button3 = false; mouseactive = 1; } } if (joystickenabled && !mouseactive) { int jx,jy,jb; INL_GetJoyDelta (joystickport, &jx, &jy); if (jy<-SENSITIVE) ci->dir=dir_North; else if (jy>SENSITIVE) ci->dir=dir_South; if (jx<-SENSITIVE) ci->dir=dir_West; else if (jx>SENSITIVE) ci->dir=dir_East; jb = IN_JoyButtons(); if (jb) { ci->button0=jb&1; ci->button1=jb&2; if (joypadenabled) { ci->button2=jb&4; ci->button3=jb&8; } else ci->button2=ci->button3=false; } } } //****************************************************************************** // // IN_GetScanName () - Returns a string containing the name of the // specified scan code // //****************************************************************************** char * IN_GetScanName (ScanCode scan) { char **p; ScanCode *s; for (s = ExtScanCodes, p = ExtScanNames; *s; p++, s++) if (*s == scan) return (*p); return(ScanNames[scan]); } //****************************************************************************** // // DisplayInfo () // //****************************************************************************** void DisplayInfo (int which) { patch_t *p; int x; int num; num = W_GetNumForName ( "info1" ) + which; p = (patch_t *) W_CacheLumpNum (num, PU_CACHE, Cvt_patch_t, 1); x = (288 - p->width) >> 1; DrawMenuBufItem (x, 149, num); } //****************************************************************************** // // DrawSTMenuBuf() // //****************************************************************************** void DrawSTMenuBuf (int x, int y, int w, int h, boolean up) { if (!up) { DrawTMenuBufHLine (x, y, w+1, false); DrawTMenuBufVLine (x, y+1, h-1, false); DrawTMenuBufHLine (x, y+h, w+1, true); DrawTMenuBufVLine (x+w, y+1, h-1, true); } else { DrawTMenuBufHLine (x, y, w+1, true); DrawTMenuBufVLine (x, y+1, h-1, true); DrawTMenuBufHLine (x, y+h, w+1, false); DrawTMenuBufVLine (x+w, y+1, h-1, false); } } //**************************************************************************** // // DoMainMenu () // //**************************************************************************** void DoMainMenu (void) { EnableScreenStretch();//bna++ shut on streech mode SetAlternateMenuBuf(); ClearMenuBuf(); DrawMainMenu(); DrawMenuBufItem (MainItems.x, ((MainItems.curpos*14)+(MainItems.y-2)), W_GetNumForName( LargeCursor ) + CursorFrame[ CursorNum ] ); FlipMenuBuf(); } //**************************************************************************** // // DrawCustomMenu () // //**************************************************************************** void DrawCustomMenu (void) { MenuNum = 3; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Customize Menu"); MN_GetCursorLocation( &CustomItems, &CustomMenu[ 0 ] ); DrawMenu (&CustomItems, &CustomMenu[0]); DrawMenuBufItem (CustomItems.x, ((CustomItems.curpos*14)+(CustomItems.y-2)), W_GetNumForName( LargeCursor ) + CursorFrame[ CursorNum ] ); DisplayInfo (0); FlipMenuBuf(); } //**************************************************************************** // // DrawCustomKeyboard () // //**************************************************************************** void DrawCustomKeyboard (void) { int i; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Customize Keyboard"); for( i = 0; i < NormalKeyItems.amount; i++ ) { strcpy( &NormalKeyNames[ i ][ KEYNAMEINDEX ], IN_GetScanName( buttonscan[ (unsigned int)order[ i ] ] ) ); } MN_GetCursorLocation( &NormalKeyItems, &NormalKeyMenu[ 0 ] ); DrawMenu( &NormalKeyItems, &NormalKeyMenu[ 0 ] ); DisplayInfo( 0 ); FlipMenuBuf(); } //**************************************************************************** // // MusicVolume () // //**************************************************************************** void MusicVolume ( void ) { SliderMenu( &MUvolume, 254, 0, 33, 81, 225, 8, "block3", MUSIC_SetVolume, "Music Volume", "Low", "High" ); DrawControlMenu(); } //**************************************************************************** // // FXVolume () // //**************************************************************************** void FXVolume ( void ) { SliderMenu( &FXvolume, 254, 0, 33, 81, 225, 8, "block3", FX_SetVolume, "Sound Volume", "Low", "High" ); DrawControlMenu(); } //**************************************************************************** // // DrawPlayerMenu () // //**************************************************************************** void DrawPlayerMenu (void) { MenuNum = 5; MN_MakeActive( &PlayerItems, &PlayerMenu[0], DefaultPlayerCharacter ); #if ( SHAREWARE == 1 ) PlayerMenu[ 1 ].active = CP_SemiActive; // Thi Barrett PlayerMenu[ 2 ].active = CP_SemiActive; // Doug Wendt PlayerMenu[ 3 ].active = CP_SemiActive; // Lorelei Ni PlayerMenu[ 4 ].active = CP_SemiActive; // Ian Paul Freeley #endif if (numdone || (!ingame) || (!inmenu)) SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Choose Player"); DrawMenu (&PlayerItems, &PlayerMenu[0]); DrawNewPlayerDiff (PlayerItems.curpos); DisplayInfo (0); if ( ( gamestate.battlemode != battle_StandAloneGame ) && ( consoleplayer == 0 ) ) { DrawBattleModeName( gamestate.battlemode ); } if (ingame && inmenu && (!numdone)) RefreshMenuBuf (0); else FlipMenuBuf(); } //****************************************************************************** // // DRAW NEW PLAYER GRAPHIC // //****************************************************************************** int newplayerY[5] = {28, 42, 56, 70, 84}; void DrawNewPlayerDiff (int w) { EraseMenuBufRegion (25, 18, 52, 125); DrawMenuBufPic (25, newplayerY[w], W_GetNumForName( "PLAYER1" ) + w ); } //****************************************************************************** // // MenuFixup () // //****************************************************************************** void MenuFixup ( void ) { MainMenu[ viewscores ].texture[ 6 ] = '1'; MainMenu[ viewscores ].texture[ 7 ] = '0'; MainMenu[ viewscores ].texture[ 8 ] = '\0'; MainMenu[ viewscores ].routine = ( void * )CP_EndGame; MainMenu[ viewscores ].letter = 'E'; strcpy (MainMenuNames[ viewscores ] , "END GAME"); MainMenu[ savegame ].active = CP_Active; ingame = true; } //****************************************************************************** // // GetEpisode () // //****************************************************************************** void GetEpisode (int level) { if (level < 8) gamestate.episode = 1; else if (level < 16) gamestate.episode = 2; else if (level < 24) gamestate.episode = 3; else gamestate.episode = 4; } //**************************************************************************** // // DrawControlMenu () // //**************************************************************************** void DrawControlMenu (void) { MenuNum = 1; if (numdone || (!ingame) || (!inmenu)) SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Options"); MN_GetCursorLocation( &ControlMItems, &ControlMMenu[ 0 ] ); DrawMenu (&ControlMItems, &ControlMMenu[0]); DisplayInfo (0); if (ingame && inmenu && (!numdone)) RefreshMenuBuf (0); else FlipMenuBuf(); numdone ++; } //**************************************************************************** // // CP_ControlMenu () // //**************************************************************************** void CP_ControlMenu (void) { int which; DrawControlMenu(); do { which = HandleMenu (&ControlMItems, &ControlMMenu[0], NULL); } while (which >= 0); handlewhich = OUTOFRANGE; } //**************************************************************************** // // DrawOptionsMenu () // //**************************************************************************** void DrawOptionsMenu (void) { MenuNum = 1; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("User Options"); MN_GetCursorLocation( &OptionsItems, &OptionsMenu[ 0 ] ); DrawMenu (&OptionsItems, &OptionsMenu[0]); DrawOptionsButtons (); DisplayInfo (0); FlipMenuBuf(); } //**************************************************************************** // // DrawExtOptionsMenu () () bna added // //**************************************************************************** void DrawExtOptionsMenu (void) { MenuNum = 1; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Extended User Options"); MN_GetCursorLocation( &ExtOptionsItems, &ExtOptionsMenu[ 0 ] ); DrawMenu (&ExtOptionsItems, &ExtOptionsMenu[0]); DrawExtOptionsButtons (); DisplayInfo (0); FlipMenuBuf(); } extern int inverse_mouse; extern boolean usemouselook; extern boolean iG_aimCross; extern boolean sdl_fullscreen; void CP_ExtOptionsMenu (void) { int which; DrawExtOptionsMenu(); do { which = HandleMenu (&ExtOptionsItems, &ExtOptionsMenu[0], NULL); switch (which) { case 0: usemouselook ^= 1; DrawExtOptionsButtons (); break; case 1: if (inverse_mouse == 1){ inverse_mouse = -1; }else{ inverse_mouse = 1; } DrawExtOptionsButtons (); break; case 2: iG_aimCross ^= 1; DrawExtOptionsButtons (); break; case 3: { ToggleFullScreen(); DrawExtOptionsButtons (); } break; } } while (which >= 0); DrawControlMenu(); } void DrawExtOptionsButtons (void) { int i, on; int button_on; int button_off; button_on = W_GetNumForName ("snd_on"); button_off = W_GetNumForName ("snd_off"); for (i = 0; i < ExtOptionsItems.amount; i++) if (ExtOptionsMenu[i].active != CP_Active3) { // // DRAW SELECTED/NOT SELECTED GRAPHIC BUTTONS // on = 0; switch (i) { case 0: if (usemouselook == 1) on = 1; break; case 1: if (inverse_mouse == -1)on = 1; break; case 2: if (iG_aimCross == 1) on = 1; break; case 3: if (sdl_fullscreen== 1) on = 1; break; } if (on) DrawMenuBufItem (20+22, ExtOptionsItems.y+i*14-1, button_on); else DrawMenuBufItem (20+22, ExtOptionsItems.y+i*14-1, button_off); } } //**************************************************************************** // // CP_OptionsMenu () // //**************************************************************************** void CP_OptionsMenu (void) { int which; DrawOptionsMenu(); do { which = HandleMenu (&OptionsItems, &OptionsMenu[0], NULL); switch (which) { case 0: AutoDetailOn ^= 1; DrawOptionsButtons (); break; case 1: fulllight ^= 1; DrawOptionsButtons (); break; case 2: BobbinOn ^= 1; DrawOptionsButtons (); break; case 3: fandc ^= 1; DrawOptionsButtons (); break; } } while (which >= 0); DrawControlMenu(); } //**************************************************************************** // // DrawOptionsButtons // //**************************************************************************** void DrawOptionsButtons (void) { int i, on; int button_on; int button_off; button_on = W_GetNumForName ("snd_on"); button_off = W_GetNumForName ("snd_off"); for (i = 0; i < OptionsItems.amount-5; i++) if (OptionsMenu[i].active != CP_Active3) { // // DRAW SELECTED/NOT SELECTED GRAPHIC BUTTONS // on = 0; switch (i) { case 0: if (AutoDetailOn == 1) on = 1; break; case 1: if (fulllight == 0) on = 1; break; case 2: if (BobbinOn == 1) on = 1; break; case 3: if (fandc == 1) on = 1; break; } if (on) DrawMenuBufItem (20+22, OptionsItems.y+i*14-1, button_on); else DrawMenuBufItem (20+22, OptionsItems.y+i*14-1, button_off); } } //**************************************************************************** // // CP_DoubleClickSpeed() // //**************************************************************************** void CP_DoubleClickSpeed ( void ) { int temp; temp = 50 - ( DoubleClickSpeed - 5 ); SliderMenu( &temp, 50, 5, 31, 81, 225, 3, "block1", NULL, "Double-Click Speed", "Slow", "Fast" ); DoubleClickSpeed = 50 - ( temp - 5 ); handlewhich = 100; DrawOptionsMenu(); } //**************************************************************************** // // MenuFlipSpeed () // //**************************************************************************** void MenuFlipSpeed ( void ) { int temp; temp = 50 - ( Menuflipspeed - 5 ); SliderMenu( &temp, 50, 5, 31, 81, 225, 3, "block1", NULL, "Menu Flip Speed", "Slow", "Fast" ); Menuflipspeed = 50 - ( temp - 5 ); DrawOptionsMenu (); handlewhich = 10; } //**************************************************************************** // // DrawDetailMenu () // //**************************************************************************** void DrawDetailMenu (void) { MenuNum = 1; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Detail Menu"); MN_DrawButtons (&DetailItems, &DetailMenu[0], DetailLevel, OptionNums); MN_GetCursorLocation( &DetailItems, &DetailMenu[ 0 ] ); DrawMenu (&DetailItems, &DetailMenu[0]); DisplayInfo (0); FlipMenuBuf(); } //**************************************************************************** // // CP_DetailMenu () // //**************************************************************************** void CP_DetailMenu (void) { int which; DrawDetailMenu(); do { which = HandleMenu (&DetailItems, &DetailMenu[0], NULL); switch (which) { case 0: DetailLevel = 0; MN_DrawButtons (&DetailItems, &DetailMenu[0], DetailLevel, OptionNums); break; case 1: DetailLevel = 1; MN_DrawButtons (&DetailItems, &DetailMenu[0], DetailLevel, OptionNums); break; case 2: DetailLevel = 2; MN_DrawButtons (&DetailItems, &DetailMenu[0], DetailLevel, OptionNums); break; } } while (which >= 0); handlewhich = 10; DrawOptionsMenu(); } //**************************************************************************** // // DrawBattleMenu () // //**************************************************************************** void DrawBattleMenu (void) { MenuNum = 1; if (numdone || (!ingame) || (!inmenu)) SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Battle Menu"); DrawBattleModeName( gamestate.battlemode ); MN_GetCursorLocation( &BattleItems, &BattleMenu[ 0 ] ); DrawMenu (&BattleItems, &BattleMenu[0]); DisplayInfo (0); BATTLE_SetOptions( &BATTLE_Options[ gamestate.battlemode ] ); ShowBattleOptions( true, MENU_X, MENU_Y + 49 ); if (ingame && inmenu && (!numdone)) RefreshMenuBuf (0); else FlipMenuBuf(); } //**************************************************************************** // // BattleGamePlayerSetup() // //**************************************************************************** void BattleGamePlayerSetup( void ) { int status; int pos; pos = 1; if ( consoleplayer == 0 ) { pos = 0; } while( 1 ) { switch( pos ) { case 0 : // Select level to play on status = CP_LevelSelectionMenu (); if ( status >= 0 ) { gamestate.mapon=status; pos = 1; } else { DrawBattleMenu(); return; } break; case 1 : // Select CodeName status = CP_EnterCodeNameMenu(); pos = 2; if ( !status ) { if ( consoleplayer == 0 ) { pos = 0; } else { return; } } break; case 2 : // Select character status = CP_PlayerSelection (); pos = 1; if ( status ) { pos = 3; } break; case 3 : // Select color/team status = CP_ColorSelection(); pos = 2; if ( status ) { StartGame = true; DisableScreenStretch(); handlewhich = -2; playstate = ex_resetgame; BATTLEMODE = true; // Show please wait CP_ModemGameMessage( consoleplayer ); return; } break; } } } //**************************************************************************** // // BattleNoTeams() // //**************************************************************************** void BattleNoTeams( void ) { BattleGamePlayerSetup(); if ( StartGame ) { gamestate.teamplay = false; } } //**************************************************************************** // // BattleTeams() // //**************************************************************************** void BattleTeams( void ) { BattleGamePlayerSetup(); if ( StartGame ) { gamestate.teamplay = true; } } //**************************************************************************** // // CP_BattleMenu () // //**************************************************************************** void CP_BattleMenu (void) { int which; gamestate.battlemode = handlewhich + battle_Normal; BattleMenu[0].active = CP_Active; BattleMenu[1].active = CP_Active; // Tag can't be played in team mode // Also, can't play teams if only 1 person is playing if ( ( gamestate.battlemode == battle_Tag ) || ( numplayers < 2 ) ) { BattleMenu[1].active = CP_Inactive; if ( BattleItems.curpos == 1 ) { BattleItems.curpos = 0; } } // Capture the Triad can only be played in team mode if ( gamestate.battlemode == battle_CaptureTheTriad ) { BattleMenu[0].active = CP_Inactive; if ( BattleItems.curpos == 0 ) { BattleItems.curpos = 1; } } BattleMenu[ BattleItems.curpos ].active = CP_CursorLocation; DrawBattleMenu(); do { which = HandleMenu (&BattleItems, &BattleMenu[0], NULL); } while (which >= 0); if ( which == -1 ) { DrawBattleModes (); handlewhich = OUTOFRANGE; } } //**************************************************************************** // // MN_PlayMenuSnd () // //**************************************************************************** extern boolean dopefish; void MN_PlayMenuSnd (int which) { if (INFXSETUP || (SD_Started == false)) return; #if (SHAREWARE==0) if (dopefish==true) { switch (which) { case SD_ESCPRESSEDSND: which = SD_SOUNDESCSND; break; case SD_MOVECURSORSND: which = SD_SILLYMOVESND; break; case SD_SELECTSND: which = SD_SOUNDSELECTSND; break; } } #endif SD_Play (which); } //****************************************************************************** // // SliderMenu () // //****************************************************************************** boolean SliderMenu ( int *number, int upperbound, int lowerbound, int erasex, int erasey, int erasew, int numadjust, char *blockname, void ( *routine )( int w ), char *title, char *left, char *right ) { ControlInfo ci; Direction lastdir; patch_t *shape; boolean returnval; boolean moved; unsigned long scale; int exit; int range; int timer; int width; int height; int blkx; int eraseh; int block; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle( title ); newfont1 = (font_t *)W_CacheLumpName( "newfnt1", PU_CACHE, Cvt_font_t, 1); CurrentFont = newfont1; PrintX = 25; PrintY = 62; DrawMenuBufPropString( PrintX, PrintY, left ); VW_MeasurePropString( right, &width, &height ); DrawMenuBufPropString( 263 - width, PrintY, right ); block = W_GetNumForName( blockname ); shape = ( patch_t * )W_CacheLumpNum( block, PU_CACHE, Cvt_patch_t, 1 ); blkx = erasex - shape->leftoffset; eraseh = shape->height; scale = ( erasew + shape->leftoffset - shape->width ) << 16; range = upperbound - lowerbound; DrawSTMenuBuf( erasex - 1, erasey - 1, erasew + 1, eraseh + 1, false ); DrawMenuBufItem( blkx + ( ( ( ( *number - lowerbound ) * scale ) / range ) >> 16 ), erasey, block ); DisplayInfo( 1 ); FlipMenuBuf(); exit = 0; moved = false; timer = GetTicCount(); lastdir = dir_None; do { RefreshMenuBuf( 0 ); ReadAnyControl( &ci ); if ( ( ( GetTicCount() - timer ) > 5 ) || ( ci.dir != lastdir ) ) { timer = GetTicCount(); switch( ci.dir ) { case dir_North: case dir_West: if ( *number > lowerbound ) { *number = *number - numadjust; if ( *number < lowerbound ) { *number = lowerbound; } moved = true; } break; case dir_South: case dir_East: if ( *number < upperbound ) { *number = *number + numadjust; if ( *number > upperbound ) { *number = upperbound; } moved = true; } break; default: ; } lastdir = ci.dir; } if ( moved ) { moved = false; EraseMenuBufRegion( erasex, erasey, erasew, eraseh ); DrawMenuBufItem( blkx + ( ( ( ( *number - lowerbound ) * scale ) / range ) >> 16 ), erasey, block ); if ( routine ) { routine( *number ); } MN_PlayMenuSnd( SD_MOVECURSORSND ); } if ( ci.button0 || Keyboard[ sc_Space ] || Keyboard[ sc_Enter ] ) { exit = 1; } else if ( ci.button1 || Keyboard[ sc_Escape ] ) { exit = 2; } } while( !exit ); if ( exit == 2 ) { MN_PlayMenuSnd( SD_ESCPRESSEDSND ); returnval = false; } else { MN_PlayMenuSnd( SD_SELECTSND ); returnval = true; } WaitKeyUp (); return( returnval ); } //****************************************************************************** // // DrawF1Help () // //****************************************************************************** void DrawF1Help (void) { VL_DrawPostPic (W_GetNumForName("trilogo")); DrawNormalSprite (0, 0, W_GetNumForName("help")); VW_UpdateScreen (); } //****************************************************************************** // // CP_F1Help () // //****************************************************************************** void CP_F1Help (void) { LastScan=0; DrawF1Help (); while (LastScan == 0) { IN_UpdateKeyboard (); } LastScan=0; #if (SHAREWARE==1) { DrawOrderInfo( 2 ); while (LastScan == 0) { IN_UpdateKeyboard (); } LastScan=0; } #endif } //**************************************************************************** // // CP_ScreenSize() // //**************************************************************************** void CP_ScreenSize ( void ) { SliderMenu( &viewsize, MAXVIEWSIZES - 1, 0, 33, 81, 225, 1, "block1", NULL, "Screen Size", "Small", "Large" ); handlewhich = 100; DrawOptionsMenu(); } //**************************************************************************** // // DrawViolenceMenu () // //**************************************************************************** void DrawViolenceMenu (void) { MenuNum = 1; if ( POK ) { memcpy( &VMenu[ 1 ].texture, "mcpass\0", 7 ); VMenu[ 1 ].letter = 'C'; strcpy (VMenuNames[ 1 ] , "CHANGE PASSWORD"); } else { memcpy( &VMenu[ 1 ].texture, "mepass\0", 7 ); VMenu[ 1 ].letter = 'E'; strcpy (VMenuNames[ 1 ] , "ENTER PASSWORD"); } if (VMenu[0].active != CP_CursorLocation) VMenu[0].active = CP_Active; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Violence Level"); MN_GetCursorLocation( &VItems, &VMenu[ 0 ] ); DrawMenu (&VItems, &VMenu[0]); DisplayInfo (0); FlipMenuBuf(); } //**************************************************************************** // // CP_ViolenceMenu () // //**************************************************************************** void CP_ViolenceMenu (void) { int which; CurrentFont = smallfont; DrawViolenceMenu (); do { which = HandleMenu (&VItems, &VMenu[0], NULL); } while (which >= 0); handlewhich = 100; DrawOptionsMenu(); } //**************************************************************************** // // DrawViolenceLevel () // //**************************************************************************** void DrawViolenceLevel (void) { MenuNum = 1; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Change Violence Level"); MN_DrawButtons (&ViolenceItems, &ViolenceMenu[0], gamestate.violence, OptionNums); MN_GetActive (&ViolenceItems, &ViolenceMenu[0], gamestate.violence, OptionNums); // DrawMenuBufItem (58, 24, W_GetNumForName ("blood")); IFont = ( cfont_t * )W_CacheLumpName( FontNames[ mn_largefont ], PU_CACHE, Cvt_cfont_t, 1 ); DrawMenuBufIString( 58, 24, "HOW MUCH ", NORMALCOLOR ); DrawMenuBufIString( PrintX, PrintY, "BLOOD", 51 ); DrawMenuBufIString( 71, 37, "DO YOU WANT?", NORMALCOLOR ); DrawMenu (&ViolenceItems, &ViolenceMenu[0]); DisplayInfo (0); FlipMenuBuf(); } //**************************************************************************** // // CP_ViolenceLevel () // //**************************************************************************** void CP_ViolenceLevel (void) { int which; char p1[13]; boolean passok=false; if (ingame) { CP_ErrorMsg( "Change Violence Level", "The current game must be ended to change the Violence Level.", mn_largefont ); } else if ( POK ) { memset (p1, 0, 13); CurrentFont = smallfont; DrawViolenceLevelPWord (); if (US_lineinput (PBOXX+2, PBOXY+1, p1, NULL, true, 12, 110, 0)) { //compare user entered to password if (StringsNotEqual (p1, pword, StringLength (p1)) == false) passok=true; else { CP_ErrorMsg( "Violence Password", "Incorrect Password.", mn_largefont ); } } } else passok=true; if (passok==true) { DrawViolenceLevel (); do { which = HandleMenu (&ViolenceItems, &ViolenceMenu[0], NULL); if (which >= 0) gamestate.violence = which; MN_DrawButtons (&ViolenceItems, &ViolenceMenu[0], gamestate.violence, OptionNums); } while (which >= 0); WriteMenuInfo (); } handlewhich = 100; DrawViolenceMenu(); } //**************************************************************************** // // DrawViolenceLevelPWord (); // //**************************************************************************** void DrawViolenceLevelPWord ( void ) { MenuNum = 1; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle( "Violence Password" ); // CurrentFont = newfont1; // DrawMenuBufPropString( PWORDX, PWORDY, "ENTER PASSWORD" ); IFont = ( cfont_t * )W_CacheLumpName( FontNames[ mn_largefont ], PU_CACHE, Cvt_cfont_t, 1 ); DrawMenuBufIString( PWORDX, PWORDY, "ENTER PASSWORD", NORMALCOLOR ); DrawSTMenuBuf( PBOXX, PBOXY, PBOXW, PBOXH, false ); FlipMenuBuf(); } //**************************************************************************** // // DrawPWMenu () // //**************************************************************************** void DrawPWMenu ( void ) { MenuNum = 1; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle( "Violence Password" ); // CurrentFont = newfont1; IFont = ( cfont_t * )W_CacheLumpName( FontNames[ mn_largefont ], PU_CACHE, Cvt_cfont_t, 1 ); if ( POK ) { // DrawMenuBufPropString( PWORDX - 24, PWORDY, "ENTER OLD PASSWORD" ); DrawMenuBufIString( PWORDX - 24, PWORDY, "ENTER OLD PASSWORD", NORMALCOLOR ); } else { // DrawMenuBufPropString( PWORDX - 24, PWORDY, "ENTER PASSWORD" ); DrawMenuBufIString( PWORDX - 24, PWORDY, "ENTER PASSWORD", NORMALCOLOR ); } DrawSTMenuBuf( PBOXX, PBOXY, PBOXW, PBOXH, false ); FlipMenuBuf(); } //**************************************************************************** // // CP_PWMenu () // //**************************************************************************** void CP_PWMenu (void) { char p1[13]; char p2[13]; boolean EnterNewPassword; boolean AskForNew; boolean RetypePassword; memset (p1, 0, 13); memset (p2, 0, 13); CurrentFont = smallfont; EnterNewPassword = true; if ( POK ) { DrawPWMenu (); // get old password // EnterNewPassword = false; if (US_lineinput (PBOXX+2, PBOXY+1, p1, NULL, true, 12, PSTRW, 0)) { //compare user entered to old // if (StringsNotEqual (p1, pword, StringLength (p1))==false) { // Password was correct so they may change it. EnterNewPassword = true; } else { CP_ErrorMsg( "Violence Password", "Incorrect Password.", mn_largefont ); } } } if ( EnterNewPassword ) { MenuNum = 1; // get new password // AskForNew = true; RetypePassword = false; while( AskForNew ) { CurrentFont = smallfont; SetAlternateMenuBuf (); ClearMenuBuf(); SetMenuTitle ("Violence Password"); IFont = ( cfont_t * )W_CacheLumpName( FontNames[ mn_largefont ], PU_CACHE, Cvt_cfont_t, 1 ); DrawMenuBufIString( PWORDX - 24, PWORDY, "ENTER NEW PASSWORD", NORMALCOLOR ); // CurrentFont = newfont1; // DrawMenuBufPropString( PWORDX - 24, PWORDY, "ENTER NEW PASSWORD" ); // DrawMenuBufItem (PWORDX-24, PWORDY, W_GetNumForName ("mnewpass")); DrawSTMenuBuf (PBOXX, PBOXY, PBOXW, PBOXH, false); FlipMenuBuf(); memset (p1, 0, 13); AskForNew = false; if (US_lineinput (PBOXX+2, PBOXY+1, p1, NULL, true, 12, PSTRW, 0)) { // Check for blank password if ( p1[ 0 ] == 0 ) { if ( CP_DisplayMsg ( "Clear Password?\nAre you sure?", 12 ) ) { AskForNew = false; memset (pword, 0, 13); WriteMenuInfo (); POK = false; } else { AskForNew = true; } } else { RetypePassword = true; } } } if ( RetypePassword ) { SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Violence Password"); // CurrentFont = newfont1; // DrawMenuBufPropString( PWORDX, PWORDY, "RETYPE PASSWORD" ); IFont = ( cfont_t * )W_CacheLumpName( FontNames[ mn_largefont ], PU_CACHE, Cvt_cfont_t, 1 ); DrawMenuBufIString( PWORDX, PWORDY, "RETYPE PASSWORD", NORMALCOLOR ); DrawSTMenuBuf (PBOXX, PBOXY, PBOXW, PBOXH, false); FlipMenuBuf(); // reenter password // if ( US_lineinput (PBOXX+2, PBOXY+1, p2, NULL, true, 12, PSTRW, 0) ) { // compare password and retyped password // if (stricmp (p1, p2) == 0) { memset (pword, 0, 13); strcpy (pword, p1); WriteMenuInfo (); // If we have a null password, then we don't need to // ask for one. POK = true; if ( pword[ 0 ] == 0 ) { POK = false; } } else { CP_ErrorMsg( "Violence Password", "Passwords did not match.", mn_largefont ); } } } } DrawViolenceMenu (); } //**************************************************************************** // // DrawOptionDescription() // //**************************************************************************** void DrawOptionDescription( char ** options, int w ) { int width; int height; char *string; font_t *temp; EraseMenuBufRegion (25, 4, 287 - 25, 10 ); temp = CurrentFont; CurrentFont = tinyfont; string = options[ w ]; VW_MeasurePropString ( string, &width, &height ); DrawMenuBufPropString ( ( 288 - width) / 2, 4, string ); CurrentFont = temp; } //**************************************************************************** // // DrawBattleOptionDescription() // //**************************************************************************** void DrawBattleOptionDescription( int w ) { DrawOptionDescription( BattleOptionDescriptions, w ); } //**************************************************************************** // // DrawGravityOptionDescription() // //**************************************************************************** void DrawGravityOptionDescription( int w ) { DrawOptionDescription( GravityOptionDescriptions, w ); } //**************************************************************************** // // DrawSpeedOptionDescription() // //**************************************************************************** void DrawSpeedOptionDescription( int w ) { DrawOptionDescription( SpeedOptionDescriptions, w ); } //**************************************************************************** // // DrawAmmoOptionDescription() // //**************************************************************************** void DrawAmmoOptionDescription( int w ) { DrawOptionDescription( AmmoOptionDescriptions, w ); } //**************************************************************************** // // DrawHitPointsOptionDescription() // //**************************************************************************** void DrawHitPointsOptionDescription( int w ) { DrawOptionDescription( HitPointsOptionDescriptions, w ); } //**************************************************************************** // // DrawRadicalOptionDescription() // //**************************************************************************** void DrawRadicalOptionDescription( int w ) { DrawOptionDescription( RadicalOptionDescriptions, w ); } //**************************************************************************** // // DrawLightLevelOptionDescription() // //**************************************************************************** void DrawLightLevelOptionDescription( int w ) { DrawOptionDescription( LightLevelOptionDescriptions, w ); } //**************************************************************************** // // DrawPointGoalOptionDescription() // //**************************************************************************** void DrawPointGoalOptionDescription( int w ) { DrawOptionDescription( PointGoalOptionDescriptions, w ); } //**************************************************************************** // // DrawDangerDamageOptionDescription() // //**************************************************************************** void DrawDangerDamageOptionDescription( int w ) { DrawOptionDescription( DangerDamageOptionDescriptions, w ); } //**************************************************************************** // // DrawTimeLimitOptionDescription() // //**************************************************************************** void DrawTimeLimitOptionDescription( int w ) { DrawOptionDescription( TimeLimitOptionDescriptions, w ); } #define TURN_OFF_BATTLE_MODE( x ) \ ModeMenu[ ( x ) - 1 ].active = CP_SemiActive; \ ModeMenu[ ( x ) - 1 ].routine = NULL; //**************************************************************************** // // DrawBattleModes () // //**************************************************************************** void DrawBattleModes ( void ) { int i; MenuNum = 1; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Battle Modes"); MN_GetActive( &ModeItems, &ModeMenu[ 0 ], gamestate.battlemode - battle_Normal, OptionNums ); #if ( SHAREWARE == 1 ) TURN_OFF_BATTLE_MODE( battle_ScoreMore ); TURN_OFF_BATTLE_MODE( battle_Scavenger ); TURN_OFF_BATTLE_MODE( battle_Tag ); TURN_OFF_BATTLE_MODE( battle_Eluder ); TURN_OFF_BATTLE_MODE( battle_Deluder ); TURN_OFF_BATTLE_MODE( battle_CaptureTheTriad ); #endif // Capture the Triad, Tag, ScoreMore, and Hunter can only be // played with 2 or more players if ( numplayers < 2 ) { TURN_OFF_BATTLE_MODE( battle_ScoreMore ); TURN_OFF_BATTLE_MODE( battle_Tag ); TURN_OFF_BATTLE_MODE( battle_Hunter ); TURN_OFF_BATTLE_MODE( battle_CaptureTheTriad ); } if ( ModeMenu[ ModeItems.curpos ].active != CP_CursorLocation ) { for( i = 0; i < ModeItems.amount; i++ ) { if ( ModeMenu[ i ].active == CP_Active ) { ModeItems.curpos = i; ModeMenu[ i ].active = CP_CursorLocation; break; } } } DrawMenu( &ModeItems, &ModeMenu[ 0 ] ); DisplayInfo( 0 ); DrawBattleModeDescription( ModeItems.curpos ); FlipMenuBuf(); } //**************************************************************************** // // DrawBattleModeName() // //**************************************************************************** void DrawBattleModeName( int which ) { int width; int height; char *string; font_t *temp; if ( ( which < battle_Normal ) || ( which > battle_CaptureTheTriad ) ) { return; } string = BattleModeNames[ which - battle_Normal ]; temp = CurrentFont; CurrentFont = tinyfont; VW_MeasurePropString ( string, &width, &height ); DrawMenuBufPropString ( ( 288 - width ) / 2, 4, string ); // DrawMenuBufPropString ( 270-width, 4, string ); CurrentFont = temp; } //**************************************************************************** // // DrawBattleModeDescription() // //**************************************************************************** void DrawBattleModeDescription( int w ) { int width; int height; char *string; font_t *temp; EraseMenuBufRegion (25, 4, 287 - 25, 10 ); temp = CurrentFont; CurrentFont = tinyfont; string = BattleModeDescriptions[ w ]; // Capture the Triad, Tag, ScoreMore, and Hunter can only be // played with 2 or more players if ( numplayers < 2 ) { switch( w + 1 ) { case battle_ScoreMore : case battle_Tag : case battle_Hunter : case battle_CaptureTheTriad : string = "This mode can only be played with 2 or more players."; break; } } #if ( SHAREWARE == 1 ) switch( w + 1 ) { case battle_ScoreMore : case battle_Scavenger : case battle_Tag : case battle_Eluder : case battle_Deluder : case battle_CaptureTheTriad : string = "See Ordering Info to find out how to get this game."; break; } #endif VW_MeasurePropString ( string, &width, &height ); DrawMenuBufPropString ( ( 288 - width ) / 2, 4, string ); CurrentFont = temp; } //**************************************************************************** // // CP_BattleModes () // //**************************************************************************** void CP_BattleModes ( void ) { int which; static char Warning = 0; // // ALREADY IN A GAME? // if ( ingame ) { if ( !CP_DisplayMsg( CURGAME, 12 ) ) { return; } else { EndGameStuff(); } } if ( ( numplayers==1 ) && ( Warning == 0 ) ) { Warning = 1; CP_OnePlayerWarningMessage(); } DrawBattleModes (); damagecount = 0; BATTLEMODE = true; do { which = HandleMenu( &ModeItems, &ModeMenu[ 0 ], DrawBattleModeDescription ); } while ( which >= 0 ); handlewhich = 100; if ( !StartGame ) { BATTLEMODE = false; gamestate.battlemode = battle_StandAloneGame; } } //**************************************************************************** // // DrawBattleOptions () // //**************************************************************************** void DrawBattleOptions (void) { int i; MenuNum = 1; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Battle Mode Options"); MN_MakeActive ( &BOptItems, &BOptMenu[0], BOptItems.curpos ); switch( gamestate.battlemode ) { case battle_Collector : BOptMenu[2].active = CP_Inactive; // Ammo BOptMenu[6].active = CP_Inactive; // Point Goal break; case battle_Scavenger : BOptMenu[6].active = CP_Inactive; // Point Goal break; case battle_Tag : BOptMenu[2].active = CP_Inactive; // Ammo break; case battle_Eluder : BOptMenu[2].active = CP_Inactive; // Ammo BOptMenu[3].active = CP_Inactive; // Hit points BOptMenu[7].active = CP_Inactive; // Danger damage break; } if ( BOptMenu[ BOptItems.curpos ].active == CP_Inactive ) { // Find an available cursor position for( i = 0; i < BOptItems.amount; i++ ) { if ( BOptMenu[ i ].active == CP_Active ) { BOptMenu[ i ].active = CP_CursorLocation; BOptItems.curpos = i; break; } } } DrawBattleModeName( gamestate.battlemode ); DrawBattleOptionDescription( BOptItems.curpos ); DrawMenu (&BOptItems, &BOptMenu[0]); DisplayInfo (0); FlipMenuBuf(); } //**************************************************************************** // // CP_BattleOptions () // //**************************************************************************** void CP_BattleOptions (void) { int which; DrawBattleOptions (); do { which = HandleMenu (&BOptItems, &BOptMenu[0], DrawBattleOptionDescription); } while (which >= 0); handlewhich = 100; // WriteBattleConfig(); CalcTics(); DrawBattleMenu (); } //**************************************************************************** // // DrawColorMenu () // //**************************************************************************** void DrawColorMenu( void ) { int width; int height; char *text; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Uniform Color"); CurrentFont = smallfont; text = colorname[ locplayerstate->uniformcolor ]; VW_MeasurePropString ( text, &width, &height ); DrawMenuBufPropString ( ( 320 - width ) / 2 - 16, MENU_Y + 5, text ); DisplayInfo( 8 ); EraseMenuBufRegion( COLORX, COLORY, COLORW, COLORH ); DrawTMenuBufBox( COLORX, COLORY, COLORW, COLORH ); DrawColoredMenuBufItem( COLORX - 36, COLORY - 33, W_GetNumForName( playerwadname[ locplayerstate->player ] ), locplayerstate->uniformcolor); if ( ( gamestate.battlemode != battle_StandAloneGame ) && ( consoleplayer == 0 ) ) { DrawBattleModeName( gamestate.battlemode ); } FlipMenuBuf(); } //**************************************************************************** // // CP_ColorSelection () // //**************************************************************************** int CP_ColorSelection (void) { int status; locplayerstate->uniformcolor = DefaultPlayerColor; DrawColorMenu (); status = ColorMenu(); return( status ); } int ColorMenu ( void ) { ControlInfo ci; int colorindex; char *text; int width; int height; int timer; int baseshape; int status = 0; boolean update; boolean done; colorindex = DefaultPlayerColor; timer = GetTicCount(); baseshape = W_GetNumForName( playerwadname[ locplayerstate->player ] ); update = false; done = false; while( !done ) { ReadAnyControl( &ci ); if ( ( ci.dir == dir_East ) && ( ( GetTicCount() - timer ) > 5 ) ) { update = true; timer = GetTicCount(); colorindex++; if ( colorindex >= MAXPLAYERCOLORS ) { colorindex = 0; } MN_PlayMenuSnd( SD_MOVECURSORSND ); } if ( ( ci.dir == dir_West ) && ( ( GetTicCount() - timer ) > 5 ) ) { update = true; timer = GetTicCount(); colorindex--; if ( colorindex < 0 ) { colorindex = MAXPLAYERCOLORS - 1; } MN_PlayMenuSnd( SD_MOVECURSORSND ); } if ( update ) { update = false; DefaultPlayerColor = colorindex; locplayerstate->uniformcolor = colorindex; text = colorname[ locplayerstate->uniformcolor ]; EraseMenuBufRegion( 0, MENU_Y + 5, 200, 10 ); EraseMenuBufRegion( COLORX, COLORY, COLORW, COLORH ); VW_MeasurePropString( text, &width, &height ); DrawMenuBufPropString( ( 320 - width ) / 2 - 16, MENU_Y + 5, text ); DrawTMenuBufBox( COLORX, COLORY, COLORW, COLORH ); DrawColoredMenuBufItem( COLORX - 36, COLORY - 33, baseshape, locplayerstate->uniformcolor ); } if ( ci.button0 || Keyboard[ sc_Space ] || Keyboard[sc_Enter ] ) { Keyboard[ sc_Space ] = 0; Keyboard[ sc_Enter ] = 0; MN_PlayMenuSnd( SD_SELECTSND ); status = 1; done = true; } else if ( ci.button1 || Keyboard[ sc_Escape ] ) { MN_PlayMenuSnd( SD_ESCPRESSEDSND ); status = 0; done = true; } RefreshMenuBuf( 0 ); } IN_ClearKeysDown(); return( status ); } //**************************************************************************** // // CP_PlayerSelection () // //**************************************************************************** int CP_PlayerSelection ( void ) { int which; // Do Pick-A-Player menu DrawPlayerMenu(); do { which = HandleMenu( &PlayerItems, &PlayerMenu[ 0 ], DrawNewPlayerDiff ); if ( which < 0 ) { handlewhich = 1; return( 0 ); } #if ( SHAREWARE == 1 ) if ( PlayerMenu[ which ].active == CP_SemiActive ) { CP_ErrorMsg( "Choose Player", "Read the Ordering Info section from the Main Menu to " "find out how to get the other characters.", mn_smallfont ); DrawPlayerMenu(); } #endif } while( PlayerMenu[ which ].active == CP_SemiActive ); #if ( SHAREWARE == 1 ) DefaultPlayerCharacter = 0; locplayerstate->player = 0; #else DefaultPlayerCharacter = which; locplayerstate->player = which; #endif return (1); } //**************************************************************************** // // CP_OnePlayerWarningMessage () // //**************************************************************************** void CP_OnePlayerWarningMessage ( void ) { CP_ErrorMsg( "Comm-bat Warning", "Comm-bat is designed for modem and network play. " "One player mode is provided for exploration. The " "Collector battle mode is still fun on your own.", mn_smallfont ); } //**************************************************************************** // // CP_CaptureTheTriadError() // //**************************************************************************** void CP_CaptureTheTriadError ( void ) { SetupMenuBuf(); SetUpControlPanel(); CP_ErrorMsg( "Comm-bat Warning", "Capture the Traid can only be played with 2 teams." " All players must return to the menu to choose their " "team colors.", mn_largefont ); CleanUpControlPanel(); ShutdownMenuBuf(); } //**************************************************************************** // // CP_TeamPlayErrorMessage() // //**************************************************************************** void CP_TeamPlayErrorMessage ( void ) { SetupMenuBuf(); SetUpControlPanel(); CP_ErrorMsg( "Comm-bat Warning", "Team play can only be played with 2 or more teams." " All players must return to the menu to choose their " "team colors.", mn_largefont ); CleanUpControlPanel(); ShutdownMenuBuf(); } //**************************************************************************** // // CP_ModemGameMessage () // //**************************************************************************** #define SITELINES 8 char *sitemessage[] = { "HEY! ARE YOU PLAYING ON AN ILLEGAL COPY?", "Network players: it's easy to play legally!", "Just get a site license. For a little over", "the price of two games, you get 10 more battle", "levels, 11 command cards, and a signed Site", "License. We don't charge you for 11 copies--", "just for two! Call 1-800-APOGEE1 to order.", "For more on site licenses, see ORDERING INFO." }; void CP_ModemGameMessage (int player ) { int i; EnableScreenStretch(); // SetTextMode ( ); SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Game Message"); newfont1 = (font_t *)W_CacheLumpName( "newfnt1", PU_CACHE, Cvt_font_t, 1); CurrentFont = newfont1; if ( modemgame == false ) { WindowW = 288; WindowH = 158; PrintX = WindowX = 0; PrintY = WindowY = 60; MenuBufCPrint ("Please wait.\nLoading game."); } else { WindowW = 288; WindowH = 158; PrintX = WindowX = 0; PrintY = WindowY = 50; if (networkgame==true) { PrintY = WindowY = 28; } if ( player == 0 ) { MenuBufCPrint ("Please wait for\nplayers to choose\ntheir characters."); } else { MenuBufCPrint ("Please wait while\nMaster selects\nCOMM-BAT options."); } if (gamestate.Product != ROTT_SITELICENSE) { if (networkgame==true) { for( i = 0; i < SITELINES; i++ ) { PrintBattleOption( true, 68, 77 + i * 8, sitemessage[ i ] ); } } } } FlipMenuBuf(); RefreshMenuBuf (0); DisableScreenStretch(); } //**************************************************************************** // // DrawGravityMenu () // //**************************************************************************** void DrawGravityMenu (void) { MenuNum = 1; SetAlternateMenuBuf (); ClearMenuBuf(); SetMenuTitle ("Gravity"); if ( ( gamestate.battlemode != battle_StandAloneGame ) && ( consoleplayer == 0 ) ) { DrawBattleModeName( gamestate.battlemode ); } MN_DrawButtons (&GravityItems, &GravityMenu[0], BATTLE_Options[gamestate.battlemode].Gravity, GravityNums); MN_GetActive (&GravityItems, &GravityMenu[0], BATTLE_Options[gamestate.battlemode].Gravity, GravityNums); DrawMenu (&GravityItems, &GravityMenu[0]); DrawGravityOptionDescription( GravityItems.curpos ); PrintBattleOption( true, 32, 79, "WARNING: High gravity has an unfortunate side effect in" ); PrintBattleOption( true, 32, 87, "some levels. It is possible to jump into an area that is" ); PrintBattleOption( true, 32, 95, "impossible, or at least extremely difficult to get out" ); PrintBattleOption( true, 32, 103, "of. In these situations, the only thing you can do is" ); PrintBattleOption( true, 32, 111, "kill your character, or find some kindly soul to do it" ); PrintBattleOption( true, 32, 119, "for you. If this fails, you'll just have to end your game." ); DisplayInfo( 0 ); FlipMenuBuf(); } //**************************************************************************** // // CP_GravityOptions () // //**************************************************************************** void CP_GravityOptions (void) { int which; DrawGravityMenu (); do { which = HandleMenu (&GravityItems, &GravityMenu[0], DrawGravityOptionDescription); if (which >= 0) BATTLE_Options[gamestate.battlemode].Gravity = GravityNums[ which ]; MN_DrawButtons (&GravityItems, &GravityMenu[0], BATTLE_Options[gamestate.battlemode].Gravity, GravityNums); } while (which >= 0); handlewhich = 100; DrawBattleOptions (); } //**************************************************************************** // // DrawSpeedMenu () // //**************************************************************************** void DrawSpeedMenu (void) { MenuNum = 1; SetAlternateMenuBuf (); ClearMenuBuf(); SetMenuTitle ("Speed"); if ( ( gamestate.battlemode != battle_StandAloneGame ) && ( consoleplayer == 0 ) ) { DrawBattleModeName( gamestate.battlemode ); } MN_DrawButtons (&SpeedItems, &SpeedMenu[0], BATTLE_Options[gamestate.battlemode].Speed, OptionNums ); MN_GetActive (&SpeedItems, &SpeedMenu[0], BATTLE_Options[gamestate.battlemode].Speed, OptionNums ); DrawMenu (&SpeedItems, &SpeedMenu[0]); DrawSpeedOptionDescription( SpeedItems.curpos ); DisplayInfo (0); FlipMenuBuf(); } //**************************************************************************** // // CP_SpeedOptions () // //**************************************************************************** void CP_SpeedOptions (void) { int which; DrawSpeedMenu (); do { which = HandleMenu (&SpeedItems, &SpeedMenu[0], DrawSpeedOptionDescription); if (which >= 0) BATTLE_Options[gamestate.battlemode].Speed = which; MN_DrawButtons (&SpeedItems, &SpeedMenu[0], BATTLE_Options[gamestate.battlemode].Speed, OptionNums ); } while (which >= 0); handlewhich = 100; DrawBattleOptions (); } //**************************************************************************** // // DrawAmmoPerWeaponMenu () // //**************************************************************************** void DrawAmmoPerWeaponMenu ( void ) { MenuNum = 1; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Ammo Per Weapon"); if ( ( gamestate.battlemode != battle_StandAloneGame ) && ( consoleplayer == 0 ) ) { DrawBattleModeName( gamestate.battlemode ); } MN_DrawButtons( &AmmoPerWeaponItems, &AmmoPerWeaponMenu[ 0 ], BATTLE_Options[ gamestate.battlemode ].Ammo, OptionNums ); MN_GetActive( &AmmoPerWeaponItems, &AmmoPerWeaponMenu[ 0 ], BATTLE_Options[ gamestate.battlemode ].Ammo, OptionNums ); DrawMenu( &AmmoPerWeaponItems, &AmmoPerWeaponMenu[ 0 ] ); PrintBattleOption( true, 32, 79, "WARNING: Infinite ammo can seriously alter the balance of" ); PrintBattleOption( true, 32, 87, "the game. We recommend that you only use it occasionally." ); PrintBattleOption( true, 32, 95, "It tends to only work well on small levels with lots of" ); PrintBattleOption( true, 32, 103, "weapons, where the action is far more intense. On large" ); PrintBattleOption( true, 32, 111, "levels, you may find it causes people to wait in easily" ); PrintBattleOption( true, 32, 119, "guardable areas and pick off anyone that comes in the room" ); PrintBattleOption( true, 32, 127, "(creating an unfair advantage)." ); if ( AmmoPerWeaponItems.curpos == 2 ) { PrintBattleOption( true, 102, 136, "You have been warned." ); } DrawAmmoOptionDescription( AmmoPerWeaponItems.curpos ); DisplayInfo( 0 ); FlipMenuBuf(); } //**************************************************************************** // // CP_AmmoPerWeaponOptions () // //**************************************************************************** void CP_AmmoPerWeaponOptions ( void ) { int which; DrawAmmoPerWeaponMenu(); do { which = HandleMenu( &AmmoPerWeaponItems, &AmmoPerWeaponMenu[ 0 ], DrawAmmoOptionDescription); if (which >= 0) { if ( AmmoPerWeaponItems.curpos == 2 ) { MN_PlayMenuSnd( SD_LIGHTNINGSND ); PrintBattleOption( true, 102, 136, "You have been warned." ); VL_FillPalette(255,255,255); VL_FadeIn(0,255,origpal,10); } else if ( BATTLE_Options[ gamestate.battlemode ].Ammo == 2 ) { EraseMenuBufRegion( 102, 136, 84, 8 ); MN_PlayMenuSnd( SD_PLAYERTCSND ); } BATTLE_Options[ gamestate.battlemode ].Ammo = which; } MN_DrawButtons( &AmmoPerWeaponItems, &AmmoPerWeaponMenu[ 0 ], BATTLE_Options[ gamestate.battlemode ].Ammo, OptionNums ); } while( which >= 0 ); handlewhich = 100; DrawBattleOptions(); } //**************************************************************************** // // DrawHitPointsMenu () // //**************************************************************************** void DrawHitPointsMenu ( void ) { MenuNum = 1; SetAlternateMenuBuf (); ClearMenuBuf(); SetMenuTitle ("Player Hitpoints"); if ( ( gamestate.battlemode != battle_StandAloneGame ) && ( consoleplayer == 0 ) ) { DrawBattleModeName( gamestate.battlemode ); } MN_DrawButtons( &HitPointItems, &HitPointMenu[ 0 ], BATTLE_Options[ gamestate.battlemode ].HitPoints, HitPointNums ); MN_GetActive( &HitPointItems, &HitPointMenu[ 0 ], BATTLE_Options[ gamestate.battlemode ].HitPoints, HitPointNums ); DrawMenu( &HitPointItems, &HitPointMenu[ 0 ] ); DrawHitPointsOptionDescription( HitPointItems.curpos ); DisplayInfo( 0 ); FlipMenuBuf(); } //**************************************************************************** // // CP_HitPointsOptions () // //**************************************************************************** void CP_HitPointsOptions (void) { int which; DrawHitPointsMenu (); do { which = HandleMenu (&HitPointItems, &HitPointMenu[0], DrawHitPointsOptionDescription); if (which >= 0) BATTLE_Options[gamestate.battlemode].HitPoints = HitPointNums[ which ]; MN_DrawButtons (&HitPointItems, &HitPointMenu[0], BATTLE_Options[gamestate.battlemode].HitPoints, HitPointNums); } while (which >= 0); handlewhich = 100; DrawBattleOptions (); } //**************************************************************************** // // DrawSpawnControlMenu () // //**************************************************************************** void DrawSpawnControlMenu ( void ) { int i; MenuNum = 1; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Radical Options"); MN_MakeActive( &SpawnItems, &SpawnMenu[ 0 ], SpawnItems.curpos ); #if ( SHAREWARE == 1 ) BATTLE_Options[ gamestate.battlemode ].SpawnMines = false; SpawnMenu[ 3 ].active = CP_Inactive; // Mines #endif switch( gamestate.battlemode ) { case battle_Normal : break; case battle_ScoreMore : break; case battle_Collector : SpawnMenu[ 2 ].active = CP_Inactive; // Weapons SpawnMenu[ 5 ].active = CP_Inactive; // Persistence SpawnMenu[ 6 ].active = CP_Inactive; // Random Weapons SpawnMenu[ 7 ].active = CP_Inactive; // Friendly Fire break; case battle_Scavenger : SpawnMenu[ 7 ].active = CP_Inactive; // Friendly Fire break; case battle_Hunter : break; case battle_Tag : SpawnMenu[ 2 ].active = CP_Inactive; // Weapons SpawnMenu[ 5 ].active = CP_Inactive; // Persistence SpawnMenu[ 6 ].active = CP_Inactive; // Random Weapons break; case battle_Eluder : SpawnMenu[ 1 ].active = CP_Inactive; // Health SpawnMenu[ 2 ].active = CP_Inactive; // Weapons SpawnMenu[ 4 ].active = CP_Inactive; // Respawn SpawnMenu[ 5 ].active = CP_Inactive; // Persistence SpawnMenu[ 6 ].active = CP_Inactive; // Random Weapons SpawnMenu[ 7 ].active = CP_Inactive; // Friendly Fire break; case battle_Deluder : SpawnMenu[ 7 ].active = CP_Inactive; // Friendly Fire break; case battle_CaptureTheTriad : SpawnMenu[ 7 ].active = CP_Inactive; // Friendly Fire break; } if ( SpawnMenu[ SpawnItems.curpos ].active == CP_Inactive ) { // Find an available cursor position for( i = 0; i < SpawnItems.amount; i++ ) { if ( SpawnMenu[ i ].active == CP_Active ) { SpawnMenu[ i ].active = CP_CursorLocation; SpawnItems.curpos = i; break; } } } if ( ( gamestate.battlemode != battle_StandAloneGame ) && ( consoleplayer == 0 ) ) { DrawBattleModeName( gamestate.battlemode ); } DrawSpawnControlButtons(); MN_GetCursorLocation( &SpawnItems, &SpawnMenu[ 0 ] ); DrawMenu( &SpawnItems, &SpawnMenu[ 0 ] ); DrawRadicalOptionDescription( SpawnItems.curpos ); DisplayInfo( 0 ); FlipMenuBuf(); } //**************************************************************************** // // DrawSpawnControlButtons () // //**************************************************************************** void DrawSpawnControlButtons ( void ) { int x; int y; int button_on; int button_off; button_on = W_GetNumForName( "snd_on" ); button_off = W_GetNumForName( "snd_off" ); x = SpawnItems.x + 18; y = SpawnItems.y - 1; if ( BATTLE_Options[ gamestate.battlemode ].SpawnDangers ) { DrawMenuBufItem( x, y, button_on ); } else { EraseMenuBufRegion( x, y, 16, 16 ); DrawMenuBufItem( x, y, button_off ); } y += 14; if ( BATTLE_Options[ gamestate.battlemode ].SpawnHealth ) { DrawMenuBufItem( x, y, button_on ); } else { EraseMenuBufRegion( x, y, 16, 16 ); DrawMenuBufItem( x, y, button_off ); } y += 14; if ( BATTLE_Options[ gamestate.battlemode ].SpawnWeapons ) { DrawMenuBufItem( x, y, button_on ); } else { EraseMenuBufRegion( x, y, 16, 16 ); DrawMenuBufItem( x, y, button_off ); } y += 14; if ( BATTLE_Options[ gamestate.battlemode ].SpawnMines ) { DrawMenuBufItem( x, y, button_on ); } else { EraseMenuBufRegion( x, y, 16, 16 ); DrawMenuBufItem( x, y, button_off ); } y += 14; if ( BATTLE_Options[ gamestate.battlemode ].RespawnItems ) { DrawMenuBufItem( x, y, button_on ); } else { EraseMenuBufRegion( x, y, 16, 16 ); DrawMenuBufItem( x, y, button_off ); } y += 14; if ( BATTLE_Options[ gamestate.battlemode ].WeaponPersistence ) { DrawMenuBufItem( x, y, button_on ); } else { EraseMenuBufRegion( x, y, 16, 16 ); DrawMenuBufItem( x, y, button_off ); } y += 14; if ( BATTLE_Options[ gamestate.battlemode ].RandomWeapons ) { DrawMenuBufItem( x, y, button_on ); } else { EraseMenuBufRegion( x, y, 16, 16 ); DrawMenuBufItem( x, y, button_off ); } y += 14; if ( BATTLE_Options[ gamestate.battlemode ].FriendlyFire ) { DrawMenuBufItem( x, y, button_on ); } else { EraseMenuBufRegion( x, y, 16, 16 ); DrawMenuBufItem( x, y, button_off ); } } //**************************************************************************** // // CP_SpawnControlOptions () // //**************************************************************************** void CP_SpawnControlOptions ( void ) { int which; DrawSpawnControlMenu(); do { which = HandleMenu( &SpawnItems, &SpawnMenu[ 0 ], DrawRadicalOptionDescription ); switch( which ) { case 0 : BATTLE_Options[ gamestate.battlemode ].SpawnDangers = !BATTLE_Options[ gamestate.battlemode ].SpawnDangers; break; case 1 : BATTLE_Options[ gamestate.battlemode ].SpawnHealth = !BATTLE_Options[ gamestate.battlemode ].SpawnHealth; break; case 2 : BATTLE_Options[ gamestate.battlemode ].SpawnWeapons = !BATTLE_Options[ gamestate.battlemode ].SpawnWeapons; break; case 3 : BATTLE_Options[ gamestate.battlemode ].SpawnMines = !BATTLE_Options[ gamestate.battlemode ].SpawnMines; break; case 4 : BATTLE_Options[ gamestate.battlemode ].RespawnItems = !BATTLE_Options[ gamestate.battlemode ].RespawnItems; break; case 5 : BATTLE_Options[ gamestate.battlemode ].WeaponPersistence = !BATTLE_Options[ gamestate.battlemode ].WeaponPersistence; break; case 6 : BATTLE_Options[ gamestate.battlemode ].RandomWeapons = !BATTLE_Options[ gamestate.battlemode ].RandomWeapons; break; case 7 : BATTLE_Options[ gamestate.battlemode ].FriendlyFire = !BATTLE_Options[ gamestate.battlemode ].FriendlyFire; break; } DrawSpawnControlButtons(); } while( which >= 0 ); handlewhich = 100; DrawBattleOptions(); } //**************************************************************************** // // DrawLightLevelMenu () // //**************************************************************************** void DrawLightLevelMenu (void) { MenuNum = 1; SetAlternateMenuBuf (); ClearMenuBuf(); SetMenuTitle ("Light Levels"); if ( ( gamestate.battlemode != battle_StandAloneGame ) && ( consoleplayer == 0 ) ) { DrawBattleModeName( gamestate.battlemode ); } MN_DrawButtons (&LightLevelItems, &LightLevelMenu[0], BATTLE_Options[gamestate.battlemode].LightLevel, OptionNums ); MN_GetActive (&LightLevelItems, &LightLevelMenu[0], BATTLE_Options[gamestate.battlemode].LightLevel, OptionNums ); DrawMenu (&LightLevelItems, &LightLevelMenu[0]); DrawLightLevelOptionDescription( LightLevelItems.curpos ); DisplayInfo (0); FlipMenuBuf(); } //**************************************************************************** // // CP_LightLevelOptions () // //**************************************************************************** void CP_LightLevelOptions (void) { int which; DrawLightLevelMenu (); do { which = HandleMenu (&LightLevelItems, &LightLevelMenu[0], DrawLightLevelOptionDescription); if (which >= 0) BATTLE_Options[gamestate.battlemode].LightLevel = which; MN_DrawButtons (&LightLevelItems, &LightLevelMenu[0], BATTLE_Options[gamestate.battlemode].LightLevel, OptionNums ); } while (which >= 0); handlewhich = 100; DrawBattleOptions (); } //**************************************************************************** // // DrawPointGoalMenu() // //**************************************************************************** void DrawPointGoalMenu ( void ) { MenuNum = 1; SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Point Goal"); if ( ( gamestate.battlemode != battle_StandAloneGame ) && ( consoleplayer == 0 ) ) { DrawBattleModeName( gamestate.battlemode ); } MN_DrawButtons( &PointGoalItems, &PointGoalMenu[ 0 ], BATTLE_Options[ gamestate.battlemode ].Kills, KillNums ); MN_GetActive( &PointGoalItems, &PointGoalMenu[ 0 ], BATTLE_Options[ gamestate.battlemode ].Kills, KillNums ); DrawMenu( &PointGoalItems, &PointGoalMenu[ 0 ] ); DrawPointGoalOptionDescription( PointGoalItems.curpos ); DisplayInfo( 0 ); FlipMenuBuf(); } //**************************************************************************** // // CP_PointGoalOptions() // //**************************************************************************** void CP_PointGoalOptions ( void ) { int which; DrawPointGoalMenu(); do { which = HandleMenu( &PointGoalItems, &PointGoalMenu[ 0 ], DrawPointGoalOptionDescription ); if ( which >= 0 ) { BATTLE_Options[ gamestate.battlemode ].Kills = KillNums[ which ]; MN_DrawButtons( &PointGoalItems, &PointGoalMenu[ 0 ], BATTLE_Options[ gamestate.battlemode ].Kills, KillNums ); } } while( which >= 0 ); handlewhich = 100; DrawBattleOptions(); } //**************************************************************************** // // DrawDangerMenu () // //**************************************************************************** void DrawDangerMenu (void) { MenuNum = 1; SetAlternateMenuBuf (); ClearMenuBuf(); SetMenuTitle ("Danger Damage"); if ( ( gamestate.battlemode != battle_StandAloneGame ) && ( consoleplayer == 0 ) ) { DrawBattleModeName( gamestate.battlemode ); } MN_DrawButtons (&DangerItems, &DangerMenu[0], BATTLE_Options[gamestate.battlemode].DangerDamage, DangerNums); MN_GetActive (&DangerItems, &DangerMenu[0], BATTLE_Options[gamestate.battlemode].DangerDamage, DangerNums); DrawMenu (&DangerItems, &DangerMenu[0]); DrawDangerDamageOptionDescription( DangerItems.curpos ); DisplayInfo (0); FlipMenuBuf(); } //**************************************************************************** // // CP_DangerOptions () // //**************************************************************************** void CP_DangerOptions (void) { int which; DrawDangerMenu (); do { which = HandleMenu (&DangerItems, &DangerMenu[0], DrawDangerDamageOptionDescription); if (which >= 0) BATTLE_Options[gamestate.battlemode].DangerDamage = DangerNums[which]; MN_DrawButtons (&DangerItems, &DangerMenu[0], BATTLE_Options[gamestate.battlemode].DangerDamage, DangerNums); } while (which >= 0); handlewhich = 100; DrawBattleOptions (); } //**************************************************************************** // // DrawTimeLimitMenu () // //**************************************************************************** void DrawTimeLimitMenu (void) { MenuNum = 1; SetAlternateMenuBuf (); ClearMenuBuf(); SetMenuTitle ("Time Limit"); if ( ( gamestate.battlemode != battle_StandAloneGame ) && ( consoleplayer == 0 ) ) { DrawBattleModeName( gamestate.battlemode ); } MN_DrawButtons (&TimeLimitItems, &TimeLimitMenu[0], BATTLE_Options[gamestate.battlemode].TimeLimit, TimeLimitNums); MN_GetActive (&TimeLimitItems, &TimeLimitMenu[0], BATTLE_Options[gamestate.battlemode].TimeLimit, TimeLimitNums); if ( gamestate.battlemode == battle_Hunter ) { TimeLimitMenu[7].active = CP_Inactive; // No time limit if ( TimeLimitItems.curpos == 7 ) { TimeLimitMenu[0].active = CP_CursorLocation; TimeLimitItems.curpos = 0; } } DrawMenu (&TimeLimitItems, &TimeLimitMenu[0]); DrawTimeLimitOptionDescription( TimeLimitItems.curpos ); DisplayInfo (0); FlipMenuBuf(); } //**************************************************************************** // // CP_TimeLimitOptions () // //**************************************************************************** void CP_TimeLimitOptions (void) { int which; DrawTimeLimitMenu (); do { which = HandleMenu (&TimeLimitItems, &TimeLimitMenu[0], DrawTimeLimitOptionDescription); if (which >= 0) BATTLE_Options[gamestate.battlemode].TimeLimit = TimeLimitNums[which]; MN_DrawButtons (&TimeLimitItems, &TimeLimitMenu[0], BATTLE_Options[gamestate.battlemode].TimeLimit, TimeLimitNums); } while (which >= 0); handlewhich = 100; DrawBattleOptions (); } void PrintBattleOption ( boolean inmenu, int x, int y, char *text ) { if ( inmenu ) { IFont = ( cfont_t * )W_CacheLumpName( "itnyfont", PU_CACHE, Cvt_cfont_t, 1 ); DrawMenuBufIString( x + 1, y + 1, text, 0 ); DrawMenuBufIString( x, y, text, ACTIVECOLOR ); } else { PrintX = x; PrintY = y; US_BufPrint( text ); } } void ShowBattleOption ( boolean inmenu, int PosX, int PosY, int column, int Line, char *text1, char *text2 ) { char text[ 80 ]; int x; int y; y = PosY + ( Line * 7 ); x = PosX + column * 120; PrintBattleOption( inmenu, x, y, text1 ); strcpy( text, ": " ); strcat( text, text2 ); PrintBattleOption( inmenu, x + 60, y, text ); } void ShowBattleOptions ( boolean inmenu, int PosX, int PosY ) { battle_type *options; battle_type BatOps; char *string; char text[ 80 ]; int width; int height; int temp; CurrentFont = tinyfont; strcpy( text, "CURRENT OPTIONS FOR " ); strcat( text, BattleModeNames[ gamestate.battlemode - battle_Normal ] ); VW_MeasurePropString ( text, &width, &height ); if ( inmenu ) { temp = 288; } else { temp = 320; } PrintBattleOption( inmenu, (temp - width)/2, PosY, text ); PosY++; BATTLE_GetOptions( &BatOps ); options = &BatOps; ShowBattleOption( inmenu, PosX, PosY, 0, 1, "Friendly Fire", ( options->FriendlyFire ) ? "On" : "Off" ); ShowBattleOption( inmenu, PosX, PosY, 0, 2, "Weapon Persist", ( options->WeaponPersistence ) ? "On" : "Off" ); ShowBattleOption( inmenu, PosX, PosY, 0, 3, "Random Weapons", ( options->RandomWeapons ) ? "On" : "Off" ); ShowBattleOption( inmenu, PosX, PosY, 0, 4, "Respawn Items", ( options->RespawnItems ) ? "On" : "Off" ); ShowBattleOption( inmenu, PosX, PosY, 0, 5, "Spawn Health", ( options->SpawnHealth ) ? "On" : "Off" ); ShowBattleOption( inmenu, PosX, PosY, 0, 6, "Spawn Weapons", ( options->SpawnWeapons ) ? "On" : "Off" ); ShowBattleOption( inmenu, PosX, PosY, 0, 7, "Spawn Mines", ( options->SpawnMines ) ? "On" : "Off" ); ShowBattleOption( inmenu, PosX, PosY, 0, 8, "Spawn Dangers", ( options->SpawnDangers ) ? "On" : "Off" ); switch( options->DangerDamage ) { case bo_danger_low : string = "Low"; break; case bo_danger_normal : string = "Normal"; break; case bo_danger_kill : string = "Kill"; break; default : itoa( options->DangerDamage, text, 10 ); string = text; } ShowBattleOption( inmenu, PosX, PosY, 0, 9, "Danger Damage", string ); GetMapFileName ( text ); ShowBattleOption( inmenu, PosX, PosY, 0, 10, "Filename", text ); itoa( numplayers, text, 10 ); ShowBattleOption( inmenu, PosX, PosY, 1, 1, "Players", text ); if ( options->TimeLimit == bo_time_infinite ) { string = "None"; } else { itoa( options->TimeLimit, text, 10 ); string = text; } ShowBattleOption( inmenu, PosX, PosY, 1, 2, "Time Limit", string ); if ( ( gamestate.battlemode == battle_Collector ) || ( gamestate.battlemode == battle_Scavenger ) ) { string = "?"; } else { switch( options->Kills ) { case bo_kills_random : string = "Random"; break; case bo_kills_blind : string = "Blind"; break; case bo_kills_infinite : string = "Infinite"; break; default : itoa( options->Kills, text, 10 ); string = text; } } ShowBattleOption( inmenu, PosX, PosY, 1, 3, "Point Goal", string ); switch( options->Ammo ) { case bo_one_shot : string = "One shot"; break; case bo_normal_shots : string = "Normal"; break; case bo_infinite_shots : string = "Gunfinity"; break; } ShowBattleOption( inmenu, PosX, PosY, 1, 4, "Ammo", string ); if ( options->HitPoints == bo_character_hitpoints ) { string = "Character"; } else { itoa( options->HitPoints, text, 10 ); string = text; } ShowBattleOption( inmenu, PosX, PosY, 1, 5, "Hit Points", string ); itoa( options->RespawnTime, text, 10 ); ShowBattleOption( inmenu, PosX, PosY, 1, 6, "Respawn Time", text ); switch( options->Speed ) { case bo_normal_speed : string = "Normal"; break; case bo_fast_speed : string = "Fast"; break; } ShowBattleOption( inmenu, PosX, PosY, 1, 7, "Speed", string ); switch( options->LightLevel ) { case bo_light_dark : string = "Dark"; break; case bo_light_normal : string = "Normal"; break; case bo_light_bright : string = "Bright"; break; case bo_light_fog : string = "Fog"; break; case bo_light_periodic : string = "Periodic"; break; case bo_light_lightning : string = "Lightning"; break; } ShowBattleOption( inmenu, PosX, PosY, 1, 8, "Light", string ); if ( options->Gravity == NORMAL_GRAVITY ) { string = "Normal"; temp = NORMAL_GRAVITY; } else if ( options->Gravity < NORMAL_GRAVITY ) { string = "Low"; temp = LOW_GRAVITY; } else { string = "High"; temp = HIGH_GRAVITY; } strcpy( text, string ); if ( options->Gravity < (unsigned int)temp ) { strcat( text, "-" ); } if ( options->Gravity > (unsigned int)temp ) { strcat( text, "+" ); } ShowBattleOption( inmenu, PosX, PosY, 1, 9, "Gravity", text ); } //**************************************************************************** // // SetMenuHeader() // //**************************************************************************** void SetMenuHeader ( char *header ) { int width; int height; EraseMenuBufRegion( 16, 0, 256, 16 ); CurrentFont = tinyfont; VW_MeasurePropString ( header, &width, &height ); DrawMenuBufPropString ( ( 288 - width ) / 2, 4, header ); RefreshMenuBuf( 0 ); } //**************************************************************************** // // DrawMultiPageCustomMenu() // //**************************************************************************** void DrawMultiPageCustomMenu ( char *title, void ( *redrawfunc )( void ) ) { SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle( title ); DrawMenu( &MultiPageCustomItems, &MultiPageCustomMenu[ 0 ] ); DisplayInfo( 0 ); if ( redrawfunc != NULL ) { redrawfunc(); } CalcTics(); FlipMenuBuf(); RefreshMenuBuf( 0 ); } //**************************************************************************** // // HandleMultiPageCustomMenu() // //**************************************************************************** int HandleMultiPageCustomMenu ( char **names, int amount, int curpos, char *title, void ( *routine )( int w ), void ( *redrawfunc )( void ), boolean exitonselect ) { boolean redraw; int page; int cursorpos; int maxpos; int numpos; int which; int selection; int i; char letter; MenuNum = 11; cursorpos = curpos % MAXCUSTOM; page = curpos - cursorpos; MultiPageCustomItems.curpos = cursorpos + 2; redraw = true; do { if ( redraw ) { redraw = false; MultiPageCustomMenu[ 0 ].active = CP_Active; MultiPageCustomMenu[ 1 ].active = CP_Active; if ( page == 0 ) { MultiPageCustomMenu[ 1 ].active = CP_Inactive; } maxpos = page + MAXCUSTOM; if ( maxpos >= amount ) { MultiPageCustomMenu[ 0 ].active = CP_Inactive; maxpos = amount; } numpos = maxpos - page + 2; MultiPageCustomItems.amount = numpos; for( i = 2; i < numpos; i++ ) { MultiPageCustomMenu[ i ].active = CP_Active; // Set the name of the level strcpy (MultiPageCustomNames[ i ] , names[ page + i - 2 ]); // Set the quick key letter = *names[ page + i - 2 ]; // Force it to upper case if ( ( letter >= 'a' ) && ( letter <= 'z' ) ) { letter = letter - 'a' + 'A'; } // Only use letters if ( ( letter < 'A' ) || ( letter > 'Z' ) ) { letter = 'a'; } MultiPageCustomMenu[ i ].letter = letter; } // If the cursor is at an invalid position, find a valid one cursorpos = MultiPageCustomItems.curpos; if ( cursorpos >= numpos ) { cursorpos = numpos - 1; } else { while( MultiPageCustomMenu[ cursorpos ].active == CP_Inactive ) { cursorpos++; } } MultiPageCustomItems.curpos = cursorpos; MultiPageCustomMenu[ cursorpos ].active = CP_CursorLocation; DrawMultiPageCustomMenu( title, redrawfunc ); } which = HandleMenu( &MultiPageCustomItems, &MultiPageCustomMenu[ 0 ], NULL ); switch( which ) { case ESCPRESSED : selection = -1; break; case PAGEDOWN : case 0 : page += MAXCUSTOM; which = 0; redraw = true; break; case PAGEUP : case 1 : page -= MAXCUSTOM; which = 0; redraw = true; break; default : selection = page + which - 2; if ( routine ) { routine( selection ); } if ( exitonselect ) { which = -1; } break; } } while( which >= 0 ); return( selection ); } //**************************************************************************** // // CP_LevelSelectionRedraw() // //**************************************************************************** void CP_LevelSelectionRedraw ( void ) { if ( gamestate.battlemode >= battle_Normal ) { SetMenuHeader( BattleModeNames[ gamestate.battlemode - battle_Normal ] ); } } //**************************************************************************** // // CP_LevelSelectionMenu () // //**************************************************************************** int CP_LevelSelectionMenu ( void ) { static char levelcursorpos[ 2 ] = { 0 }; char *LevelNames[ 100 ]; int whichlevels; int numlevels; int level; int i; whichlevels = 0; if ( BATTLEMODE ) { whichlevels = 1; } mapinfo = ( mapfileinfo_t * )SafeMalloc( sizeof( mapfileinfo_t ) ); GetMapInfo( mapinfo ); numlevels = mapinfo->nummaps; if ( numlevels <= 0 ) { Error( "CP_LevelSelectionMenu : No maps found in RTL/RTC file." ); } for( i = 0; i < numlevels; i++ ) { LevelNames[ i ] = mapinfo->maps[ i ].mapname; } level = HandleMultiPageCustomMenu( LevelNames, numlevels, levelcursorpos[ whichlevels ], "Level Selection", NULL, CP_LevelSelectionRedraw, true ); SafeFree( mapinfo ); if ( level >= 0 ) { levelcursorpos[ whichlevels ] = level; } return( level ); } //**************************************************************************** // // DrawEnterCodeNameMenu () // //**************************************************************************** void DrawEnterCodeNameMenu ( void ) { SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle ("Enter CodeName"); if ( consoleplayer == 0 ) { DrawBattleModeName( gamestate.battlemode ); } WindowW = 288; WindowH = 158; WindowX = 0; WindowY = 50; PrintX = 0; PrintY = 50; CurrentFont = smallfont; MenuBufCPrint( "Enter CodeName\n" ); MenuBufCPrint( "maximum 8 letters\n" ); DrawSTMenuBuf( ( 288 - 92 ) / 2 - 2, 80 - 2, 92 + 4, 10 + 4, false ); DrawMenuBufPropString( ( 288 - 92 ) / 2, 80, CodeName ); WindowX = 144 - ( 9 * 4 ); PrintX = WindowX; FlipMenuBuf(); RefreshMenuBuf( 0 ); } //**************************************************************************** // // CP_EnterCodeNameMenu () // //**************************************************************************** int CP_EnterCodeNameMenu ( void ) { char input[10]; DrawEnterCodeNameMenu(); memset(input,0,sizeof(input)); strcpy(input,CodeName); if (US_LineInput ((288-92)/2, 80, input, input, true, 8, 92, 0)) { strcpy (&locplayerstate->codename[0], input); strcpy (CodeName, input); WaitKeyUp(); return 1; } else { WaitKeyUp(); return 0; } } //****************************************************************************** // // GetNextWord() // //****************************************************************************** char *GetNextWord ( char *dest, char *source, int length ) { while( ( *source != 0 ) && ( isspace( *source ) ) && ( length > 0 ) ) { *dest = *source; length--; dest++; source++; } while( ( *source != 0 ) && ( !isspace( *source ) ) && ( length > 0 ) ) { *dest = *source; length--; dest++; source++; } *dest = 0; return( source ); } //****************************************************************************** // // CP_ErrorMsg() // //****************************************************************************** void CP_ErrorMsg ( char *title, char *error, int font ) { char wordtext[ 80 ]; char text[ 10 ][ 80 ]; int pos; int length; int line; int w; int h; int y; extern void VWL_MeasureIntensityString (char *s, int *width, int *height, cfont_t *font); SetAlternateMenuBuf(); ClearMenuBuf(); SetMenuTitle( title ); WindowW = 288; WindowH = 158; WindowX = 0; WindowY = 40; IFont = ( cfont_t * )W_CacheLumpName( FontNames[ font ], PU_CACHE, Cvt_cfont_t, 1 ); pos = 0; line = 0; text[ 0 ][ 0 ] = 0; while( *error != 0 ) { error = GetNextWord( wordtext, error, 79 ); pos = 0; while( ( wordtext[ pos ] != 0 ) && ( isspace( wordtext[ pos ] ) ) ) { pos++; } length = strlen( text[ line ] ); if ( length == 0 ) { strcat( text[ line ], &wordtext[ pos ] ); } else { strcat( text[ line ], wordtext ); } VWL_MeasureIntensityString( text[ line ], &w, &h, IFont ); if ( w > WindowW - 32 ) { text[ line ][ length ] = 0; if ( line >= 10 ) { break; } line++; strcpy( text[ line ], &wordtext[ pos ] ); } } if ( strlen( text[ line ] ) == 0 ) { line--; } VWL_MeasureIntensityString( text[ 0 ], &w, &h, IFont ); y = ( WindowH - ( line + 1 ) * h ) / 2; for( pos = 0; pos <= line; pos++ ) { VWL_MeasureIntensityString( text[ pos ], &w, &h, IFont ); DrawMenuBufIString( ( 288 - w ) / 2, y, text[ pos ], ACTIVECOLOR ); y += h; } DisplayInfo( 5 ); FlipMenuBuf(); RefreshMenuBuf( 0 ); IN_Ack(); WaitKeyUp(); MN_PlayMenuSnd( SD_ESCPRESSEDSND ); } rott-20230810/rott/rt_menu.h000066400000000000000000000120231446517470200155650ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_menu_public #define _rt_menu_public //****************************************************************************** // // Public header for RT_MENU.C. // //****************************************************************************** #include "lumpy.h" #include "rt_in.h" #define MaxX 320 #define MaxY 200 #define MaxString 128 #define SaveGamePicX 18 #define SaveGamePicY 18 //****************************************************************************** // // TYPEDEFS // //****************************************************************************** typedef enum { mn_tinyfont, mn_8x8font, mn_smallfont, mn_largefont } mn_fontsize; typedef char CP_MenuNames[64]; typedef struct { int x; int y; int amount; int curpos; int indent; CP_MenuNames *names; mn_fontsize fontsize; } CP_iteminfo; typedef void (*menuptr)(int); typedef struct { int active; char texture[9]; char letter; void (* routine)(int temp1); } CP_itemtype; enum { CP_Inactive, CP_Active, CP_CursorLocation, CP_Active3 }; //****************************************************************************** // // GLOBALS // //****************************************************************************** extern char*colorname[]; extern boolean NewGame; extern CP_itemtype MainMenu[]; extern boolean pickquick; extern cfont_t *IFont; extern font_t *CurrentFont; extern font_t *tinyfont; // // Global window coords // extern int PrintX; extern int PrintY; extern int WindowX; extern int WindowY; extern int WindowH; extern int WindowW; extern int px; extern int py; extern int bufferheight; extern int bufferwidth; extern boolean loadedgame; extern int FXMode; extern int MusicMode; extern font_t *newfont1; extern font_t *smallfont; extern font_t *bigfont; extern boolean AutoDetailOn; extern boolean DoubleClickOn; extern boolean BobbinOn; extern int Menuflipspeed; extern int DetailLevel; extern boolean ingame; extern boolean inmenu; extern int scancode; extern int quicksaveslot; //**************************************************************************** // // TYPEDEFS // //**************************************************************************** typedef enum { newgame, battlemode, loadgame, savegame, control, orderinfo, viewscores, backtodemo, quit } menuitems; //**************************************************************************** // // PROTOTYPES // //**************************************************************************** int CP_ColorSelection(void); void CP_BattleMode(void); void DisplayInfo (int which); boolean CP_DisplayMsg (char *s, int number); void Message (char *string); void DrawMenu (CP_iteminfo *item_i, CP_itemtype *items); void DrawMainMenu(void); void AllocateSavedScreenPtr (void); void FreeSavedScreenPtr (void); void CleanUpControlPanel (void); void SetUpControlPanel (void); void ControlPanel (byte scancode); menuitems CP_MainMenu( void ); int getASCII ( void ); void DoMainMenu (void); boolean CP_CheckQuick (byte scancode); void AdjustMenuStruct (void); void MenuFixup (void); void GetEpisode (int level); void MN_PlayMenuSnd (int which); void CP_ViewScores (void); void ReadAnyControl (ControlInfo *ci); void WaitKeyUp (void); void GetMenuInfo (void); void WriteMenuInfo (void); int GetNumActive (CP_iteminfo *item_i, CP_itemtype *items); int MN_GetActive (CP_iteminfo *item_i, CP_itemtype *items, int check, int *nums); void MN_MakeActive (CP_iteminfo *item_i, CP_itemtype *items, int which); void MN_PlayMenuSnd (int which); int CP_LoadGame (int quick, int dieload); int CP_PlayerSelection (void); void BattleGamePlayerSetup( void ); void BattleNoTeams( void ); void BattleTeams( void ); void CP_BattleMenu (void); void CP_BattleModes (void); void CP_ModemGameMessage ( int player ); void ShowBattleOptions( boolean inmenu, int PosX, int PosY ); void SetMenuHeader( char *header ); int HandleMultiPageCustomMenu( char **names, int amount, int curpos, char *title, void ( *routine )( int w ), void ( *redrawfunc )( void ), boolean exitonselect ); int CP_LevelSelectionMenu ( void ); int CP_EnterCodeNameMenu ( void ); void QuickSaveGame (void); void UndoQuickSaveGame (void); void CP_CaptureTheTriadError( void ); void CP_TeamPlayErrorMessage( void ); #endif rott-20230810/rott/rt_msg.c000066400000000000000000000344601446517470200154130ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "rt_view.h" #include "z_zone.h" #include "w_wad.h" #include "lumpy.h" #include "rt_util.h" #include "rt_vid.h" #include "rt_str.h" #include "rt_menu.h" #include "_rt_msg.h" #include "rt_msg.h" #include "rt_playr.h" #include "isr.h" #include "rt_main.h" #include "rt_net.h" #include "rt_com.h" #include /* ============================================================================= GLOBALS ============================================================================= */ messagetype Messages[MAXMSGS]; /* ============================================================================= LOCAL ============================================================================= */ static int UpdateMessageBackground; static int MessageSystemStarted=0; static int LastMessageTime; static boolean EraseMessage[ MAXMSGS ]; static int MessageOrder[ MAXMSGS ]; static int TotalMessages = 0; static int MsgPos = 0; boolean MessagesEnabled = true; int StringLength (char *string) { int length=0; while ((*string)!=0) { length++; string++; } length++; return length; } /* ==================== = = ResetMessageTime = ==================== */ void ResetMessageTime ( void ) { LastMessageTime=GetTicCount(); } /* ==================== = = InitializeMessages = ==================== */ void InitializeMessages ( void ) { int i; boolean start; start = false; if ( MessageSystemStarted == 0 ) { start = true; MessageSystemStarted = 1; memset( Messages, 0, sizeof( Messages ) ); } for ( i = 0; i < MAXMSGS; i++ ) { if ( Messages[ i ].active == 1 ) { SafeFree( Messages[ i ].text ); Messages[ i ].active = 0; Messages[ i ].tictime = 0; Messages[ i ].flags = 0; Messages[ i ].text = NULL; } } MSG.messageon = false; LastMessageTime = 0; UpdateMessageBackground = 0; TotalMessages = 0; memset( EraseMessage, 0, sizeof( EraseMessage ) ); memset( MessageOrder, -1, sizeof( MessageOrder ) ); // Only print startup message if it's the first time in if ( start && !quiet ) { printf( "RT_MSG: Message System Started\n" ); } } /* ==================== = = GetMessageOrder = ==================== */ void GetMessageOrder ( void ) { int i; int lowest; int lowesttime; byte done[ MAXMSGS ]; boolean found; memset( &done[ 0 ], 0, sizeof( done ) ); memset( MessageOrder, -1, sizeof( MessageOrder ) ); for( TotalMessages = 0; TotalMessages < MAXMSGS; TotalMessages++ ) { found = false; lowesttime = 1000; lowest = 0; for( i = 0; i < MAXMSGS; i++ ) { if ( ( Messages[ i ].active == 1 ) && ( done[ i ] == 0 ) && ( Messages[ i ].tictime < lowesttime ) ) { lowesttime = Messages[ i ].tictime; lowest = i; found = true; } } if ( !found ) { break; } done[ lowest ] = 1; MessageOrder[ TotalMessages ] = lowest; } } /* ==================== = = DeleteMessage = ==================== */ void DeleteMessage ( int num ) { int i; int msg; boolean found; found = false; for( i = 0; i < TotalMessages; i++ ) { msg = MessageOrder[ i ]; if ( msg == num ) { found = true; } if ( found ) { UpdateMessageBackground -= EraseMessage[ i ]; UpdateMessageBackground += 3; EraseMessage[ i ] = 3; } } SafeFree( Messages[ num ].text ); memset( &Messages[ num ], 0, sizeof( messagetype ) ); GetMessageOrder(); } /* ==================== = = DeletePriorityMessage = ==================== */ void DeletePriorityMessage ( int flags ) { int i; for (i=0;i= 0 ) { if ( found == -1 ) { found = i; } else { if ( Messages[ i ].tictime < Messages[ found ].tictime ) { found = i; } } } } DeleteMessage( found ); return( found ); } /* ==================== = = SetMessage = ==================== */ void SetMessage ( int num, char *text, int flags ) { int i; int msg; int length; boolean found; if (iGLOBAL_SCREENWIDTH >= 640){ CurrentFont = newfont1;//smallfont; }else{ CurrentFont = smallfont; } length = StringLength( text ); Messages[ num ].active = 1; Messages[ num ].flags = flags; if ( PERMANENT_MSG( flags ) ) { int l; l = COM_MAXTEXTSTRINGLENGTH + 1; Messages[ num ].text = SafeMalloc( l ); memset( Messages[ num ].text, 0, l ); // Hack so that we can place menu in certain order Messages[ num ].tictime = -100 + MsgPos; } else { Messages[ num ].text = SafeMalloc( length ); memset( Messages[ num ].text, 0, length ); Messages[ num ].tictime = MESSAGETIME; } memcpy( Messages[ num ].text, text, length ); GetMessageOrder(); found = false; for( i = 0; i < TotalMessages; i++ ) { msg = MessageOrder[ i ]; if ( msg == num ) { found = true; } else if ( found ) { UpdateMessageBackground -= EraseMessage[ i - 1 ]; UpdateMessageBackground += 3; EraseMessage[ i - 1 ] = 3; } } } /* ==================== = = AddMessage = ==================== */ int AddMessage ( char *text, int flags ) { int new; if ( MessageSystemStarted == 0 ) { Error( "Called AddMessage without starting Message system\n" ); } if ( !( flags & MSG_NODELETE ) ) { DeletePriorityMessage( flags ); } new = GetFreeMessage(); SetMessage( new, text, flags ); return( new ); } /* ==================== = = UpdateMessages = ==================== */ void UpdateMessages ( void ) { int messagetics; int i; messagetics = GetTicCount() - LastMessageTime; LastMessageTime = GetTicCount(); if ( GamePaused == true ) { return; } for( i = 0; i < MAXMSGS; i++ ) { if ( ( Messages[ i ].active == 1 ) && ( !PERMANENT_MSG( Messages[ i ].flags ) ) ) { Messages[ i ].tictime -= messagetics; if ( Messages[ i ].tictime <= 0 ) { DeleteMessage( i ); } } } } /* ==================== = = DisplayMessage = ==================== */ void DisplayMessage (int num,int position) { PrintX = 1; if (iGLOBAL_SCREENWIDTH > 320){ PrintY = 2 + ( position * (9*2) ); }else{ PrintY = 2 + ( position * (9*1) ); } if ( SHOW_TOP_STATUS_BAR() ) { PrintY += 16; } if ( !MessagesEnabled ) { switch ( Messages[ num ].flags ) { case MSG_QUIT: case MSG_MACRO: case MSG_MODEM: case MSG_NAMEMENU: case MSG_MSGSYSTEM: break; case MSG_REMOTERIDICULE: case MSG_REMOTE: case MSG_GAME: case MSG_DOOR: case MSG_BONUS: case MSG_BONUS1: case MSG_CHEAT: case MSG_SYSTEM: default : DeleteMessage( num ); return; } } switch ( Messages[ num ].flags ) { case MSG_REMOTERIDICULE: case MSG_REMOTE: fontcolor = egacolor[ WHITE ]; break; case MSG_MODEM: fontcolor = egacolor[ LIGHTBLUE ]; DrawIString( PrintX, PrintY, "Message>", Messages[ num ].flags ); if ( iGLOBAL_SCREENWIDTH == 320) { PrintX += 8 * 8; }else if ( iGLOBAL_SCREENWIDTH == 640) { PrintX += 8 * 8*2; } fontcolor = egacolor[ LIGHTGRAY ]; break; case MSG_GAME: case MSG_DOOR: case MSG_BONUS: case MSG_BONUS1: case MSG_NAMEMENU: fontcolor = egacolor[ GREEN ]; break; case MSG_CHEAT: fontcolor = egacolor[ YELLOW ]; break; case MSG_MSGSYSTEM: case MSG_SYSTEM: case MSG_QUIT: case MSG_MACRO: fontcolor = egacolor[ RED ]; break; default : fontcolor = egacolor[ LIGHTGREEN ]; } DrawIString( PrintX, PrintY, Messages[ num ].text, Messages[ num ].flags ); } /* ==================== = = RestoreMessageBackground = ==================== */ void RestoreMessageBackground ( void ) { pic_t *shape; int i; int y; if ( UpdateMessageBackground > 0 ) { y = 18; for( i = 0; i < MAXMSGS; i++ ) { if ( EraseMessage[ i ] ) { UpdateMessageBackground--; EraseMessage[ i ]--; if ( viewsize < 15 ) { shape = ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );//w=32 h=8 //SetTextMode ( ); //DrawTiledRegion( 0, y, 320, 9, 0, y, shape );KILLS_HEIGHT bna-- DrawTiledRegion( 0, y, iGLOBAL_SCREENWIDTH, 9, 0, y, shape ); DrawTiledRegion( 0, y+8, iGLOBAL_SCREENWIDTH, 9, 0, y, shape ); DrawTiledRegion( 0, y+16, iGLOBAL_SCREENWIDTH, 9, 0, y, shape ); //DrawTiledRegion( 0, y, iGLOBAL_SCREENWIDTH, 212, 0, y, shape ); } if ( viewsize == 0 ) { if ( ( y + 9 > YOURCPUSUCKS_Y ) && ( y < ( YOURCPUSUCKS_Y + YOURCPUSUCKS_HEIGHT ) ) ) { DrawCPUJape(); } } } y += 9; } } } /* ==================== = = DrawMessages = ==================== */ void DrawMessages ( void ) { int i; if ( TotalMessages > 0 ) { IFont = ( cfont_t * )W_CacheLumpName( "ifnt", PU_CACHE, Cvt_cfont_t, 1 ); for( i = 0; i < TotalMessages; i++ ) { DisplayMessage( MessageOrder[ i ], i ); } } UpdateMessages(); } /* ==================== = = UpdateModemMessage = ==================== */ void UpdateModemMessage ( int num, char c ) { int i; Messages[ num ].text[ MSG.length - 1 ] = ( byte )c; Messages[ num ].text[ MSG.length ] = ( byte )'_'; MSG.length++; for( i = 0; i < TotalMessages; i++ ) { if ( MessageOrder[ i ] == num ) { UpdateMessageBackground -= EraseMessage[ i ]; UpdateMessageBackground += 3; EraseMessage[ i ] = 3; break; } } } /* ==================== = = ModemMessageDeleteChar = ==================== */ void ModemMessageDeleteChar ( int num ) { int i; MSG.length--; Messages[ num ].text[ MSG.length ] = ( byte )0; Messages[ num ].text[ MSG.length - 1 ] = ( byte )'_'; for( i = 0; i < TotalMessages; i++ ) { if ( MessageOrder[ i ] == num ) { UpdateMessageBackground -= EraseMessage[ i ]; UpdateMessageBackground += 3; EraseMessage[ i ] = 3; break; } } } /* ==================== = = DrawPlayerSelectionMenu = ==================== */ void DrawPlayerSelectionMenu ( void ) { int i; int p; char str[ 20 ]; p = 1; MsgPos = 1; AddMessage( "Press a key from 0 to 9 to select", MSG_NAMEMENU ); MsgPos++; AddMessage( "who to send your message to:", MSG_NAMEMENU ); MsgPos++; for( i = 0; i < numplayers; i++ ) { if ( i != consoleplayer ) { strcpy( str, "0 - " ); strcat( str, PLAYERSTATE[ i ].codename ); str[ 0 ] = '0' + p; p++; if ( p > 9 ) { p = 0; } AddMessage( str, MSG_NAMEMENU ); MsgPos++; } } if ( ( MsgPos < MAXMSGS - 1 ) && ( gamestate.teamplay ) ) { AddMessage( "T - All team members", MSG_NAMEMENU ); MsgPos++; } if ( MsgPos < MAXMSGS - 1 ) { AddMessage( "A - All players", MSG_NAMEMENU ); } MsgPos = 0; } /* ==================== = = FinishModemMessage = ==================== */ void FinishModemMessage ( int num, boolean send ) { if ( ( !MSG.inmenu ) && ( MSG.length > 0 ) ) { Messages[ num ].text[ MSG.length - 1 ] = ( byte )0; MSG.length--; } if ( ( send == true ) && ( ( MSG.length > 0 ) || ( MSG.remoteridicule != -1 ) ) ) { if ( ( MSG.directed ) && ( !MSG.inmenu ) ) { DrawPlayerSelectionMenu(); MSG.messageon = true; MSG.inmenu = true; return; } MSG.messageon = false; if ( MSG.remoteridicule != -1 ) { AddRemoteRidiculeCommand( consoleplayer, MSG.towho, MSG.remoteridicule ); } if ( MSG.length > 0 ) { AddTextMessage( Messages[ num ].text, MSG.length, MSG.towho ); } } if ( MSG.inmenu ) { DeletePriorityMessage( MSG_NAMEMENU ); } DeleteMessage( num ); } rott-20230810/rott/rt_msg.h000066400000000000000000000041011446517470200154050ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_msg_public #define _rt_msg_public #define MSG_PERMANENT 0x80 #define MSG_NODELETE 0x40 #define MSG_PRIORITY( x ) ( ( x ) & 0x3f ) #define PERMANENT_MSG( x ) ( ( x ) & MSG_PERMANENT ) #define DELETABLE_MSG( x ) ( ( x ) & MSG_NODELETE ) #define MSG_MODEM ( 1 | MSG_PERMANENT ) #define MSG_SYSTEM ( 2 ) #define MSG_REMOTERIDICULE ( 3 ) #define MSG_REMOTE ( 4 | MSG_NODELETE ) #define MSG_GAME ( 5 | MSG_NODELETE ) #define MSG_DOOR ( 6 ) #define MSG_CHEAT ( 7 ) #define MSG_NAMEMENU ( 8 | MSG_PERMANENT | MSG_NODELETE ) #define MSG_QUIT ( 9 ) #define MSG_MACRO ( 10 ) #define MSG_BONUS1 ( 11 ) #define MSG_BONUS ( 12 ) #define MSG_MSGSYSTEM ( 13 ) #define MAXMSGS 15 typedef struct msgt { byte active; byte flags; int tictime; char * text; } messagetype; extern messagetype Messages[MAXMSGS]; extern boolean MessagesEnabled; void RestoreMessageBackground( void ); void DrawMessages ( void ); int AddMessage (char * text, int flags); void InitializeMessages ( void ); void ResetMessageTime ( void ); int StringLength (char *string); void UpdateModemMessage (int num, char c); void ModemMessageDeleteChar (int num); void DeleteMessage ( int num ); void FinishModemMessage( int num, boolean send ); void DeletePriorityMessage( int flags ); #endif rott-20230810/rott/rt_net.c000066400000000000000000002217471446517470200154210ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "rt_main.h" #include "rt_net.h" #include "rt_com.h" #include "_rt_net.h" #include "rt_actor.h" #include "rt_playr.h" #include "isr.h" #include "z_zone.h" #include "develop.h" #include "rottnet.h" #include "rt_msg.h" #include "rt_sound.h" #include "rt_menu.h" #include "rt_util.h" #include "rt_rand.h" #include "rt_game.h" #include "rt_draw.h" #include "myprint.h" #include "rt_debug.h" #include "rt_view.h" #include "rt_battl.h" #include "rt_dmand.h" #include "rt_datadir.h" CommandType * LocalCmds; CommandType * ServerCmds; int controlupdatestartedtime=-1; int controlupdatetime=-1; int serverupdatetime=-1; int controlupdatestarted=0; boolean GamePaused=false; boolean modemgame; boolean networkgame; int numplayers; int server; boolean IsServer; boolean standalone; boolean restartgame=false; boolean respawnactive=false; boolean playerdead=false; boolean controlschanged=true; boolean battlegibs=false; boolean remoteridicule = false; /* ============================================================================= LOCAL FUNCTION PROTOTYPES and VARIABLES ============================================================================= */ boolean demorecord, demoplayback; byte *demoptr, *lastdemoptr, *demobuffer=NULL; boolean demodone = false; int predemo_violence = -1; int oldmomx; int oldmomy; int oldspdang; static boolean GameCommandsStarted=false; static int oldcontrolbuf[3]; static int oldbuttonbits; static CommandType * PlayerCmds[MAXPLAYERS]; static CommandType * ClientCmds[MAXPLAYERS]; static boolean GotPlayersDesc[MAXPLAYERS]; static boolean PlayersReady[MAXPLAYERS]; static int LastCommandTime[MAXPLAYERS]; static CommandStatusType * CommandState[MAXPLAYERS+1]; static boolean InProcessServer=false; static int lastcontrolupdatetime; static int largesttime; static int PlayerStatus[MAXPLAYERS]; //static int syncservertime; //static boolean FixingPackets; static int controldivisor=1; static int nextupdatetime; static boolean UpdateServer=true; void CheckForPacket ( void ); void PrepareLocalPacket ( void ); void SendSyncCheckPacket ( void ); void AddModemSubPacket(void * incoming); void SetPlayerDescription( void * pkt ); void UpdateDemoPlayback (int time); int GetTypeSize (int type); int MaxSpeedForCharacter(playertype *pstate); /* ============================================================================= Game Command Section ============================================================================= */ //**************************************************************************** // // ComError () // //**************************************************************************** #define ComError SoftError //**************************************************************************** // // ConsoleIsServer() // //**************************************************************************** boolean ConsoleIsServer ( void ) { if (modemgame==true) { if (networkgame==true) { if (rottcom->client==0) { return true; } } } return false; } //**************************************************************************** // // GamePacketSize() // //**************************************************************************** int GamePacketSize( void ) { if ((remoteridicule == true) || (ConsoleIsServer() == true)) { return GetTypeSize(COM_SOUNDANDDELTA); } else return GetTypeSize(COM_TEXT); } //**************************************************************************** // // InitializeGameCommands() // //**************************************************************************** void InitializeGameCommands( void ) { int i; int j; // default to player 0 if (GameCommandsStarted==true) return; GameCommandsStarted=true; if (modemgame==true) controldivisor=rottcom->ticstep; standalone=false; IsServer=false; if (modemgame==true) { consoleplayer=rottcom->consoleplayer; if (networkgame==true) { if (rottcom->client==0) { IsServer=true; // turn it on absolutely for the server remoteridicule = true; if (consoleplayer==0) standalone=true; } if (consoleplayer>0) consoleplayer--; // playernumber fixup } } if (standalone==false) { int size; size = GamePacketSize (); for (i=0;idmomx = 0; locplayerstate->dmomy = 0; locplayerstate->angle = 0; locplayerstate->topspeed=MaxSpeedForCharacter(locplayerstate); CalcTics(); CalcTics(); // FixingPackets=false; memset (controlbuf, 0, sizeof (controlbuf)); buttonbits = 0; lastpolltime=-1; IN_ClearKeyboardQueue (); if (modemgame==true) { controlupdatetime=controlsynctime+(VBLCOUNTER*2); SoftError("Controls started at %d\n",controlupdatetime); } else if (demoplayback || demorecord) { ISR_SetTime(20); oldtime = 20; controlupdatetime=20; } else controlupdatetime=GetTicCount(); controlupdatetime-=(controlupdatetime%controldivisor); serverupdatetime=controlupdatetime; oldpolltime=controlupdatetime; nextupdatetime=oldpolltime; controlupdatestartedtime=controlupdatetime; for( j = 0; j < numplayers; j++ ) { memset( PLAYERSTATE[ j ].buttonheld, 0, sizeof( PLAYERSTATE[ j ].buttonheld ) ); memset( PLAYERSTATE[ j ].buttonstate, 0, sizeof( PLAYERSTATE[ j ].buttonstate ) ); } for (i=0;i=controlupdatetime) { MoveType * Delta; boolean soundready; soundready = SD_SoundDataReady(); if (demoplayback==true) { UpdateDemoPlayback(controlupdatetime); } // else // { // PollControls(); // } if ( (memcmp(&controlbuf[0],&oldcontrolbuf[0],sizeof(controlbuf))!=0) || (buttonbits!=oldbuttonbits) ) { controlschanged=true; memcpy(&oldcontrolbuf[0],&controlbuf[0],sizeof(controlbuf)); oldbuttonbits=buttonbits; } else { controlschanged=false; } if ((controlschanged==false) && (soundready==false)) { NullMoveType * NullDelta; NullDelta=(NullMoveType *)NextLocalCommand(); NullDelta->type=COM_DELTANULL; } else { Delta=(MoveType *)NextLocalCommand(); Delta->type=COM_DELTA; Delta->momx=(controlbuf[0]>>1); Delta->momy=(controlbuf[1]>>1); Delta->dangle=controlbuf[2]>>11; Delta->buttons=buttonbits; // See if we need to update sound packet if (soundready==true) { COM_SoundType * sndpkt; recordstate status; if (remoteridicule == false) Error("Attempt to record Remote Ridicule without adequate storage"); sndpkt=(COM_SoundType *)Delta->Sounddata; // Turn the packet into a COM_SOUNDANDDELTA packet Delta->type=COM_SOUNDANDDELTA; status = SD_GetSoundData ( &(sndpkt->data[0]), COM_SOUND_BUFFERSIZE ); switch (status) { case rs_nodata: Delta->type=COM_DELTA; break; case rs_newsound: sndpkt->type=COM_SOUND_START_TRANSMISSION; break; case rs_endsound: sndpkt->type=COM_SOUND_END_TRANSMISSION; break; case rs_data: sndpkt->type=COM_SOUND_NORMAL_TRANSMISSION; break; default: Error("Illegal return value for SD_GetSoundData"); break; } } if (demorecord==true) RecordDemoCmd(); } PrepareLocalPacket(); if ( (controlupdatetime != -1) && (controlupdatetime > (lastpolltime+MAXPOLLTICS)) && (demoplayback==false) ) { controlbuf[0] = controlbuf[1] = controlbuf[2] = 0; } } } if (modemgame==true) { CheckForPacket (); } if ((standalone == false) && (IsServer==true) && (UpdateServer==true)) ProcessServer(); // take out if (modemgame==true) { //TODO: Not sure if that's DEVELOPMENT code or not. //#if (DEVELOPMENT == 1) if (PanicPressed==true) { Error("Game Aborted. Scroll Lock pressed\n"); } //#endif if (Keyboard[sc_Insert] && Keyboard[sc_Q]) Error("Game Aborted. Insert->Q pressed\n"); } InUCC = false; waminot(); } //**************************************************************************** // // PlayerInGame() // //**************************************************************************** boolean PlayerInGame ( int p ) { if (PlayerStatus[p]!=player_ingame) return false; return true; } /* ============================================================================= Packet Section ============================================================================= */ //**************************************************************************** // // CheckForPacket() // //**************************************************************************** void CheckForPacket ( void ) { wami(7); while (ReadPacket()==true) { if (badpacket==0) { ProcessPacket(&ROTTpacket[0], rottcom->remotenode); } else RequestPacket (LastCommandTime[rottcom->remotenode]+controldivisor, rottcom->remotenode, controldivisor); } waminot(); } //**************************************************************************** // // AddRemoteRidiculeCommand() // //**************************************************************************** void AddRemoteRidiculeCommand ( int player, int towho, int num ) { ((COM_RemoteRidiculeType *)NextLocalCommand())->type=COM_REMRID; ((COM_RemoteRidiculeType *)NextLocalCommand())->num=num; ((COM_RemoteRidiculeType *)NextLocalCommand())->player=player; ((COM_RemoteRidiculeType *)NextLocalCommand())->towho=towho; PrepareLocalPacket(); } //**************************************************************************** // // ProcessRemoteRidicule() // //**************************************************************************** void ProcessRemoteRidicule ( void * pkt ) { COM_RemoteRidiculeType * remrot; char name[ 50 ]; int from; int who; remrot = (COM_RemoteRidiculeType *)pkt; from = remrot->player; who = remrot->towho; if ( ( who == consoleplayer ) || ( who == MSG_DIRECTED_TO_ALL ) || ( ( who == MSG_DIRECTED_TO_TEAM ) && ( BATTLE_Team[ from ] == BATTLE_Team[ consoleplayer ] ) ) ) { strcpy( name, "(\x81 RR from " ); strcat( name, PLAYERSTATE[from].codename ); strcat( name, ")" ); AddMessage( name, MSG_REMOTERIDICULE ); SD_Play( SD_REMOTEM1SND + remrot->num ); } } //**************************************************************************** // // AddEndGameCommand() // //**************************************************************************** void AddEndGameCommand ( void ) { ((COM_EndGameType *)NextLocalCommand())->type=COM_ENDGAME; PrepareLocalPacket(); } //**************************************************************************** // // AddGameEndCommand() // //**************************************************************************** void AddGameEndCommand ( void ) { ((COM_GameEndType *)NextLocalCommand())->type=COM_GAMEEND; PrepareLocalPacket(); } //**************************************************************************** // // AddQuitCommand() // //**************************************************************************** void AddQuitCommand ( void ) { ((COM_QuitType *)NextLocalCommand())->type=COM_QUIT; PrepareLocalPacket(); } //**************************************************************************** // // AddExitCommand() // //**************************************************************************** void AddExitCommand ( void ) { ((COM_ExitType *)NextLocalCommand())->type=COM_EXIT; PrepareLocalPacket(); } //**************************************************************************** // // AddPauseStateCommand() // //**************************************************************************** void AddPauseStateCommand ( int type ) { ((COM_PauseType *)NextLocalCommand())->type=type; PrepareLocalPacket(); } //**************************************************************************** // // AddRespawnCommand() // //**************************************************************************** void AddRespawnCommand ( void ) { if (respawnactive==true) return; respawnactive=true; ((COM_RespawnType *)NextLocalCommand())->type=COM_RESPAWN; PrepareLocalPacket(); } //**************************************************************************** // // AddTextMessage() // //**************************************************************************** void AddTextMessage ( char *message, int length, int towho ) { COM_TextType *Text; Text = ( COM_TextType * )NextLocalCommand(); Text->type = COM_TEXT; memset( &Text->string[ 0 ], 0, COM_MAXTEXTSTRINGLENGTH ); if ( length >= COM_MAXTEXTSTRINGLENGTH ) { length = COM_MAXTEXTSTRINGLENGTH - 1; } memcpy( &Text->string[ 0 ], message, length ); Text->towho = towho; PrepareLocalPacket(); } //**************************************************************************** // // PrepareLocalPacket // //**************************************************************************** void PrepareLocalPacket ( void ) { MoveType * pkt; wami(8); pkt=(MoveType *)NextLocalCommand(); pkt->time=controlupdatetime; if (networkgame==false) // Whether it is a modem game or not we do this { AddClientPacket (pkt, consoleplayer); if (modemgame==false) { ServerCommandStatus ( controlupdatetime ) = cs_ready; } } if (modemgame==true) SendPacket (pkt, server); controlupdatetime+=controldivisor; waminot(); } //**************************************************************************** // // GetPacketSize () // //**************************************************************************** int GetPacketSize (void * pkt) { int size; switch (((MoveType *)pkt)->type) { case COM_DELTA: size=sizeof(MoveType); break; case COM_DELTANULL: size=sizeof(NullMoveType); break; case COM_REQUEST: size=sizeof(COM_RequestType); break; case COM_FIXUP: size=sizeof(COM_FixupType); break; case COM_TEXT: size=sizeof(COM_TextType); break; case COM_PAUSE: size=sizeof(COM_PauseType); break; case COM_QUIT: size=sizeof(COM_QuitType); break; case COM_EXIT: size=sizeof(COM_ExitType); break; case COM_REMRID: size=sizeof(COM_RemoteRidiculeType); break; case COM_RESPAWN: size=sizeof(COM_RespawnType); break; case COM_UNPAUSE: size=sizeof(COM_UnPauseType); break; case COM_SERVER: size=sizeof(COM_ServerHeaderType); size-=sizeof(byte); break; case COM_GAMEDESC: size=sizeof(COM_GamePlayerType); break; case COM_GAMEEND: size=sizeof(COM_GameEndType); break; case COM_GAMEPLAY: size=DUMMYPACKETSIZE; break; case COM_GAMEACK: size=sizeof(COM_GameAckType); break; case COM_GAMEMASTER: size=sizeof(COM_GameMasterType); break; case COM_ENDGAME: size=sizeof(COM_EndGameType); break; case COM_SYNCTIME: size=sizeof(COM_SyncType); break; case COM_SOUNDANDDELTA: size=sizeof(MoveType)+sizeof(COM_SoundType); break; default: Error("Unhandled packet type in GetPacketSize type=%d",((MoveType *)pkt)->type); break; } return size; } //**************************************************************************** // // GetTypeSize () // //**************************************************************************** int GetTypeSize (int type) { byte pkt[2]; pkt[0]=(byte)type; return ( GetPacketSize(&(pkt[0])) ); } //**************************************************************************** // // GetServerPacketSize () // //**************************************************************************** int GetServerPacketSize (void * pkt) { int i; byte * ptr; COM_ServerHeaderType * serverpkt; serverpkt=(COM_ServerHeaderType *)pkt; if (serverpkt->type==COM_SERVER) { ptr=&serverpkt->data; for (i=0;inumpackets;i++) { ptr+=GetPacketSize(ptr); } return ((byte *)ptr-(byte *)pkt); } else return GetPacketSize(pkt); } //**************************************************************************** // // SendPacket () // //**************************************************************************** void SendPacket (void * pkt, int dest) { if ((networkgame==false) && (PlayerStatus[dest]!=player_ingame)) return; if ((IsServer==true) && (dest==server) && (standalone==false)) // must be client on top of server ProcessPacket(pkt,dest); else if ((IsServer==false) && (dest!=server) && (standalone==false)) // We shouldn't be sending as client to anyone else ComError("SendPacket:Problems\n"); else WritePacket(pkt,GetPacketSize(pkt),dest); } //**************************************************************************** // // ResetCurrentCommand () // //**************************************************************************** void ResetCurrentCommand ( void ) { ServerCommandStatus(oldpolltime)=cs_notarrived; } //**************************************************************************** // // BroadcastServerPacket () // //**************************************************************************** void BroadcastServerPacket (void * pkt, int size) { int i; for (i=0;itime!=time) { Error( "CLIENT: Could not find packet to resend\ntime=%d packettime=%d controlupdatetime=%d\n", time, pkt->time, controlupdatetime); } else { byte * tempbuf; byte * tempptr; byte * tempstart; COM_FixupType * fixup; int i; int starti; int size; boolean done; // allocate some space tempbuf=SafeMalloc(MAXCOMBUFFERSIZE); fixup=(COM_FixupType *)tempbuf; fixup->type=COM_FIXUP; tempstart=&(fixup->data); done=false; i=0; while (done==false) { tempptr=tempstart; starti=i; fixup->time=( (MoveType *)LocalCommand(cmd) )->time; for (;iMAXCOMBUFFERSIZE) { break; } memcpy(tempptr,pkt,size); tempptr+=size; cmd = (cmd + controldivisor) & (MAXCMDS-1); } fixup->numpackets=i-starti; WritePacket(tempbuf,tempptr-tempbuf,dest); if (i==numpackets) done=true; } SafeFree(tempbuf); } } //**************************************************************************** // // ResendServerPackets () // //**************************************************************************** void ResendServerPackets (int time, int dest, int numpackets) { int cmd; COM_ServerHeaderType * serverpkt; cmd = CommandAddress(time); if (serverupdatetime<=time) return; serverpkt = (COM_ServerHeaderType *)ServerCommand(cmd); if (serverpkt->time!=time) { Error( "SERVER: Could not find packet to resend\ntime=%d packettime=%d serverupdatetime=%d\n", time, serverpkt->time,serverupdatetime); } else { byte * tempbuf; byte * tempptr; byte * tempstart; COM_FixupType * fixup; int i; int starti; int size; boolean done; // allocate some space tempbuf=SafeMalloc(MAXCOMBUFFERSIZE); fixup=(COM_FixupType *)tempbuf; fixup->type=COM_FIXUP; tempstart=&(fixup->data); done=false; i=0; while (done==false) { tempptr=tempstart; starti=i; fixup->time=( (MoveType *)ServerCommand(cmd) )->time; for (;iMAXCOMBUFFERSIZE) { break; } memcpy(tempptr,serverpkt,size); tempptr+=size; cmd = (cmd + controldivisor) & (MAXCMDS-1); } fixup->numpackets=i-starti; WritePacket(tempbuf,tempptr-tempbuf,dest); if (i==numpackets) done=true; } SafeFree(tempbuf); } } //**************************************************************************** // // ResendPacket (incoming packet, whoever requested it) // //**************************************************************************** void ResendPacket (void * pkt, int dest) { int time; COM_RequestType * request; if ((networkgame==false) && (PlayerStatus[dest]!=player_ingame)) return; request=(COM_RequestType * )pkt; time=request->time; ComError( "RESEND request received at %d\n packet time=%d dest=%d numpackets=%d\n", GetTicCount(), time, dest, request->numpackets); if (IsServer==true) { if ((dest==server) && (standalone==false)) Error("Trying to resend packets to client on top of server\n"); ComError( "RESEND SERVER serverupdatetime=%d\n",serverupdatetime); if (IsServerCommandReady ( time ) == true) ResendServerPackets(time,dest,request->numpackets); else ComError( "RESEND SERVER time=%d is not ready\n",time); } else { ResendLocalPackets(time,dest,request->numpackets); } } //**************************************************************************** // // FixupPacket () // //**************************************************************************** void FixupPacket (void * pkt, int src) { COM_FixupType * fix; int i; int time; byte * ptr; fix=(COM_FixupType *)pkt; ComError( "Fixup received at %d, time=%d numpackets=%d\n", GetTicCount(), fix->time, fix->numpackets); time=fix->time; ptr=&(fix->data); for (i=0;inumpackets;i++,time+=controldivisor) { if (time == (LastCommandTime[src]+controldivisor)) LastCommandTime[src]=time; if (IsServer==true) { if (ClientCommandStatus(src, time)!=cs_fixing) { ComError("Server Received fixup with no bad packet time=%d from %d\n",time,src); } else { AddSubPacket(ptr, src); } ptr+=GetPacketSize(ptr); } else { if (ServerCommandStatus(time)!=cs_fixing) { ComError("Client Received fixup with no bad packet time=%d from %d\n",time,src); } else { if (networkgame==true) { AddServerSubPacket( (COM_ServerHeaderType *)ptr ); } else { AddModemSubPacket(ptr); } } ptr+=GetServerPacketSize(ptr); } } } //**************************************************************************** // // ProcessSyncTimePacket // //**************************************************************************** void ProcessSyncTimePacket (void * pkt) { COM_SyncType * sync; sync=(COM_SyncType *)pkt; ISR_SetTime(sync->synctime); } //**************************************************************************** // // ProcessSoundAndDeltaPacket // //**************************************************************************** void ProcessSoundAndDeltaPacket (void * pkt, int src) { MoveType * packet; COM_SoundType * sndpkt; byte oldtype; packet = (MoveType *)pkt; // Trick packet into being a normal delta packet oldtype=packet->type; packet->type=COM_DELTA; AddClientPacket (pkt,src); packet->type=oldtype; // Don't process sound if it is from us if (src==consoleplayer) return; sndpkt = (COM_SoundType *) (packet->Sounddata); if (sndpkt->type==COM_SOUND_START_TRANSMISSION) { SD_StartIncomingSound (); } if (sndpkt->type==COM_SOUND_END_TRANSMISSION) { SD_StopIncomingSound(); } else { SD_UpdateIncomingSound (&(sndpkt->data[0]), COM_SOUND_BUFFERSIZE); } } //**************************************************************************** // // SyncToServer // //**************************************************************************** #define NETWORKTIMEAHEADOFSERVER (1) #define MODEMTIMEAHEADOFSERVER (2) void SyncToServer( void ) { int diff; if ((networkgame==false) && (consoleplayer==0)) return; if (IsServer==true) return; // if (networkgame==true) // { // diff = (GetTicCount()-controldivisor-LastCommandTime[0])/controldivisor; // SoftError("diff=%ld\n",diff); // if (abs(diff)>1) // ISR_SetTime(GetTicCount()-diff); // } // else // { diff = (GetTicCount()-controldivisor-LastCommandTime[server])/controldivisor; if (abs(diff)>0) ISR_SetTime(GetTicCount()-diff); // } } //**************************************************************************** // // ProcessPacket // //**************************************************************************** void ProcessPacket (void * pkt, int src) { switch (((MoveType *)pkt)->type) { case COM_DELTA: case COM_DELTANULL: case COM_TEXT: case COM_PAUSE: case COM_QUIT: case COM_EXIT: case COM_REMRID: case COM_RESPAWN: case COM_UNPAUSE: case COM_ENDGAME: // if (FixingPackets==false) AddPacket(pkt,src); break; case COM_SOUNDANDDELTA: if (remoteridicule == false ) { ((MoveType *)pkt)->type = COM_DELTA; } AddPacket(pkt,src); break; case COM_SERVER: AddServerPacket(pkt,src); break; case COM_REQUEST: ResendPacket(pkt, src); break; case COM_FIXUP: FixupPacket(pkt, src); break; case COM_SYNCTIME: ProcessSyncTimePacket(pkt); break; case COM_GAMEEND: case COM_GAMEDESC: case COM_GAMEACK: case COM_GAMEMASTER: if (standalone==true) restartgame=true; break; case COM_START: break; default: Error("ProcessPacket: Unknown packet type=%d\n",((MoveType *)pkt)->type); } } //**************************************************************************** // // AddServerSubPacket // //**************************************************************************** void AddServerSubPacket(COM_ServerHeaderType * serverpkt) { byte * pkt; int i; ServerCommandStatus(serverpkt->time)=cs_ready; pkt=&serverpkt->data; for (i=0;inumpackets;i++) { AddClientPacket(pkt,i); pkt+=GetPacketSize(pkt); } } //**************************************************************************** // // AddModemSubPacket // //**************************************************************************** void AddModemSubPacket(void * incoming) { MoveType * pkt; pkt=(MoveType *)incoming; ServerCommandStatus(pkt->time)=cs_ready; AddClientPacket(incoming,server); } //**************************************************************************** // // AddServerPacket // //**************************************************************************** void AddServerPacket(void * pkt, int src) { COM_ServerHeaderType * serverpkt; // The server uses the client's lgts for communicating // Last good time can be set even for the client/server combo if (standalone==true) { Error("standalone should not be here\n"); } if (src!=server) { Error("Received server packet from non-server src=%d\n",src); } serverpkt=(COM_ServerHeaderType *)pkt; // if (networkgame==false) // SyncToServer(serverpkt->time); LastCommandTime[src]+=controldivisor; if (serverpkt->time != LastCommandTime[src]) { int numpackets; numpackets=serverpkt->time-LastCommandTime[src]; if (ServerCommandStatus(LastCommandTime[src])!=cs_fixing) { RequestPacket ( LastCommandTime[src] , src , numpackets ); ComError("AddServerPacket: Request packet time=%d lct=%d numpackets=%d\n", serverpkt->time, LastCommandTime[src], numpackets ); } LastCommandTime[src]+=numpackets; } AddServerSubPacket( serverpkt ); } //**************************************************************************** // // AddClientPacket // //**************************************************************************** void AddClientPacket (void * pkt, int src) { int size; MoveType * packet; packet=(MoveType *)pkt; switch (packet->type) { case COM_DELTA: case COM_DELTANULL: case COM_TEXT: case COM_REMRID: case COM_PAUSE: case COM_QUIT: case COM_EXIT: case COM_RESPAWN: case COM_UNPAUSE: case COM_ENDGAME: size=GetPacketSize(packet); memcpy(PlayerCommand(src,CommandAddress(packet->time)),packet,size); break; case COM_SOUNDANDDELTA: ProcessSoundAndDeltaPacket(packet, src); break; default: Error("AddClientPacket: Unknown packet type = %d\n",packet->type); } } //**************************************************************************** // // AddSubPacket // //**************************************************************************** void AddSubPacket (void * pkt, int src) { MoveType * packet; if (networkgame==false) Error("Modem game should not be here in AddSubPacket\n"); packet = (MoveType *) pkt; ClientCommandStatus(src, packet->time)=cs_ready; memcpy ( ClientTimeCommand(src,packet->time), pkt, GetPacketSize(packet) ); } //**************************************************************************** // // AddPacket // //**************************************************************************** void AddPacket (void * pkt, int src) { MoveType * packet; // should only be called by server in network game // in modem game we fall through the first condition // all packets should be sequential if ((IsServer==true) && (PlayerStatus[src]!=player_ingame)) return; packet = (MoveType *) pkt; // if ((networkgame==false) && (consoleplayer!=0)) // SyncToServer(); if (!((src==server) && (standalone==false) && (IsServer==true))) { LastCommandTime[src]+=controldivisor; if (packet->time != LastCommandTime[src]) { int numpackets; numpackets=packet->time-LastCommandTime[src]; if ( ( (networkgame==false) && (ServerCommandStatus(LastCommandTime[src])!=cs_fixing) ) || ( (networkgame==true) && (ClientCommandStatus(src,LastCommandTime[src])!=cs_fixing) ) ) { RequestPacket ( LastCommandTime[src] , src , numpackets ); ComError("AddPacket: Request packet time=%d lct=%d numpackets=%d\n", packet->time, LastCommandTime[src], numpackets ); } LastCommandTime[src]+=numpackets; } } if (networkgame==true) { AddSubPacket ( packet, src ); } else { AddModemSubPacket(packet); } } //**************************************************************************** // // RequestPacket ( int time, int dest ) // //**************************************************************************** void RequestPacket (int time, int dest, int numpackets) { COM_RequestType request; int i; request.type=COM_REQUEST; request.time=time; request.numpackets=numpackets/controldivisor; if (IsServer==true) { if ((dest==server) && (standalone==false)) { Error("Requesting packet from client on top of server\n"); } if (PlayerStatus[dest]!=player_ingame) return; for (i=0;itime==time) return true; else { return false; } } //**************************************************************************** // // AreClientsReady () // //**************************************************************************** boolean AreClientsReady ( void ) { int i; int timeindex; int status; timeindex=CommandAddress(serverupdatetime); for (i=0;itime != serverupdatetime) return false; } return true; } //**************************************************************************** // // IsPlayerCommandReady () // //**************************************************************************** boolean IsPlayerCommandReady (int num, int time) { MoveType * cmd; cmd=(MoveType *)PlayerCommand(num,CommandAddress(time)); if (cmd->time==time) return true; else return false; } //**************************************************************************** // // ResetClientCommands () // //**************************************************************************** void ResetClientCommands ( int player ) { int j; for (j=0;jdata; spkt->time=serverupdatetime; spkt->type=COM_SERVER; spkt->numpackets=numplayers; memset(playerstatus,-1,sizeof(playerstatus)); for (i=0;itype == COM_QUIT) { playerstatus[i]=player_quitgame; } if (((MoveType *)ClientCommand(i,timeindex))->type == COM_ENDGAME) { playerstatus[i]=player_leftgame; } memcpy(pkt, ClientCommand(i,timeindex), size ); pkt+=size; ClientCommandNumberStatus(i,timeindex)=cs_notarrived; } BroadcastServerPacket((void *)spkt,(pkt-(byte *)spkt)); serverupdatetime+=controldivisor; for (i=0;i=serverupdatetime) { int savetime; savetime=GetTicCount()+NETWORKTIMEOUT; done = false; while (done == false) { if (standalone==true) AbortCheck("GameServer aborted\n"); done = AreClientsReady (); if ( (standalone==false) && (serverupdatetime>=(controlupdatetime-controldivisor)) && (done==false) ) break; CheckForPacket (); if (standalone==false) UpdateClientControls(); if (restartgame==true) break; if (GetTicCount()>savetime) { for (i=0;i=(controlupdatetime-controldivisor)) && (standalone==false)) break; if (restartgame==true) break; SendFullServerPacket(); } exitProcessServer: InProcessServer=false; } //**************************************************************************** // // SetupCheckForPacket() // //**************************************************************************** int SetupCheckForPacket ( void ) { int retval=scfp_nodata; if ((ReadPacket()==true) && (badpacket==0)) { MoveType * pkt; retval=scfp_data; pkt=(MoveType *)&ROTTpacket[0]; if ((IsServer==true) && (standalone==true)) { switch (pkt->type) { case COM_GAMEEND: break; case COM_GAMEDESC: if (standalone==true) printf("Received GameDescription from player#%ld\n",(long int)rottcom->remotenode); WritePacket(&ROTTpacket[0],GetPacketSize(pkt),0); // Send to player 0 break; case COM_GAMEACK: if (standalone==true) printf("Received GameAcknowledgement from player#%ld\n",(long int)rottcom->remotenode); WritePacket(&ROTTpacket[0],GetPacketSize(pkt),0); // Send to player 0 break; case COM_GAMEMASTER: if (standalone==true) printf("Received GameMasterPacket from player#%ld\n",(long int)rottcom->remotenode); BroadcastServerPacket(&ROTTpacket[0],GetPacketSize(pkt)); // Send to all break; case COM_GAMEPLAY: if (standalone==true) printf("Received StartGamePacket from player#%ld\n",(long int)rottcom->remotenode); BroadcastServerPacket(&ROTTpacket[0],GetPacketSize(pkt)); // Send to all retval=scfp_done; break; default: ComError("Server received unknown packet in Game preamble\n"); break; } } else { switch (pkt->type) { case COM_GAMEPLAY: retval=scfp_done; break; case COM_GAMEMASTER: SetGameDescription(pkt); retval=scfp_gameready; break; case COM_GAMEACK: PlayersReady[((COM_GameAckType *)pkt)->player]=true; break; case COM_GAMEDESC: GotPlayersDesc[((COM_GamePlayerType *)pkt)->player]=true; SetPlayerDescription(pkt); break; } } } return retval; } //**************************************************************************** // // ServerLoop () // //**************************************************************************** void ServerLoop( void ) { boolean done; while (1) { ShutdownClientControls(); restartgame=false; done=false; while (done==false) { AbortCheck("SetupGameServer aborted\n"); if (SetupCheckForPacket()==scfp_done) done=true; } ComSetTime(); StartupClientControls(); while(1) { ProcessServer(); CalcTics(); if (restartgame==true) break; } } } //**************************************************************************** // // ProcessPlayerCommand() // //**************************************************************************** void ProcessPlayerCommand( int player ) { MoveType * cmd; cmd=(MoveType *)PlayerCommand(player,CommandAddress(oldpolltime)); if (cmd->type==COM_DELTA) { UpdatePlayerObj(player); } else if (cmd->type==COM_RESPAWN) { if (player==consoleplayer) // reset spawn state respawnactive=false; RespawnPlayerobj(PLAYER[player]); } else if (cmd->type==COM_ENDGAME) { playstate = ex_battledone; } else if (cmd->type==COM_QUIT) { if (player==consoleplayer) QuitGame(); else { char str[50]="Player #"; char str2[10]; strcat(str,itoa(player+1,str2,10)); strcat(str,", "); strcat(str,PLAYERSTATE[player].codename); strcat(str," has left the game."); AddMessage(str,MSG_REMOTE); PlayerStatus[player]=player_quitgame; } } else if (cmd->type==COM_EXIT) { QuitGame(); } else if (cmd->type==COM_REMRID) { ProcessRemoteRidicule (cmd); } else if (cmd->type==COM_TEXT) { int who; who = ( ( COM_TextType * )cmd )->towho; if ( ( who == consoleplayer ) || ( who == MSG_DIRECTED_TO_ALL ) || ( ( who == MSG_DIRECTED_TO_TEAM ) && ( BATTLE_Team[ player ] == BATTLE_Team[ consoleplayer ] ) ) ) { char string[ 50 ]; strcpy( string, "\\N9" ); strcat( string, PLAYERSTATE[player].codename ); strcat( string, ":\\NF" ); strcat( string, ((COM_TextType *)cmd)->string ); SD_PlayPitchedSound ( SD_ENDBONUS1SND, 255, 1200 ); AddMessage( string, MSG_REMOTE ); } } else if (cmd->type==COM_PAUSE) { MUSIC_Pause(); GamePaused=true; pausedstartedticcount = oldpolltime; } else if (cmd->type==COM_UNPAUSE) { GamePaused=false; MUSIC_Continue (); if (RefreshPause == false) // screen is blanked { ShutdownScreenSaver(); SetupScreen (true); RefreshPause = true; } } } //**************************************************************************** // // CheckUnPause () // //**************************************************************************** void CheckUnPause ( void ) { if (oldpolltime==nextupdatetime) { nextupdatetime=oldpolltime+controldivisor; while (1) { if (ServerCommandStatus(oldpolltime)==cs_ready) { int j; for (j=0;jdirchoosetime; memcpy (pstate->buttonheld, pstate->buttonstate, sizeof(pstate->buttonstate)); if (oldpolltime==nextupdatetime) { if (num==numplayers-1) nextupdatetime=oldpolltime+controldivisor; if (networkgame==true) savetime=GetTicCount()+NETWORKTIMEOUT; else savetime=GetTicCount()+MODEMTIMEOUT; if (PlayerStatus[num]!=player_ingame) return; // asked=false; // copy previous state of buttons while (1) { if (ServerCommandStatus(oldpolltime)==cs_ready) { ProcessPlayerCommand (num); if (demoplayback||demorecord) { SoftError("x=%4x y=%4x a=%4x time=%5d\n",player->x,player->y,player->angle,oldpolltime); } break; } // else if ((ServerCommandStatus(oldpolltime)==cs_fixing) && // (networkgame==false) && // (asked==false) // ) // { // asked=true; // RequestPacket(oldpolltime, server, controldivisor); // } else { UpdateClientControls(); } if (GetTicCount()>savetime) { SoftError("Client timeout oldpolltime=%d\n",oldpolltime); if (IsServer==false) RequestPacket(oldpolltime, server, controldivisor); if (networkgame==true) savetime=GetTicCount()+NETWORKTIMEOUT; else savetime=GetTicCount()+MODEMTIMEOUT; } } } if (!(ob->flags&FL_DYING)) { if (ob->flags&FL_PUSHED) { ob->flags&=~FL_PUSHED; if (abs(ob->momentumx+pstate->dmomx)>=abs(ob->momentumx)) { ob->momentumx += pstate->dmomx; } if (abs(ob->momentumy+pstate->dmomy)>=abs(ob->momentumy)) { ob->momentumy += pstate->dmomy; } } else { ob->momentumx += pstate->dmomx; ob->momentumy += pstate->dmomy; } } } //**************************************************************************** // // MaxSpeedForCharacter () // //**************************************************************************** int MaxSpeedForCharacter(playertype*pstate) { if (BATTLEMODE && (gamestate.BattleOptions.Speed == bo_fast_speed)) { return( FASTSPEED ); } else { if (pstate->buttonstate[bt_run]) return (characters[pstate->player].toprunspeed); else return (characters[pstate->player].topspeed); } } //**************************************************************************** // // UpdatePlayerObj () // //**************************************************************************** void UpdatePlayerObj ( int player ) { int i, buttonbits; playertype * pstate; MoveType * MoveCmd; MoveCmd=(MoveType *)PlayerCommand(player,CommandAddress(oldpolltime)); pstate=&PLAYERSTATE[player]; buttonbits = MoveCmd->buttons; for (i = 0; i < NUMTXBUTTONS; i++) { pstate->buttonstate[i] = buttonbits & 1; buttonbits >>= 1; } pstate->dmomx = (int)(MoveCmd->momx)<<1; pstate->dmomy = (int)(MoveCmd->momy)<<1; pstate->angle = MoveCmd->dangle; pstate->angle <<= 11; pstate->topspeed=MaxSpeedForCharacter(pstate); if (demoplayback||demorecord) { SoftError(" dmx=%4x dmy=%4x da=%4x time=%5d\n",pstate->dmomx,pstate->dmomy,pstate->angle>>11,oldpolltime); } } //**************************************************************************** // // SendPlayerDescription () // //**************************************************************************** void SendPlayerDescription( void ) { byte * temp; COM_GamePlayerType * desc; int length; length=sizeof(COM_GamePlayerType); temp=SafeMalloc(length); memset(temp,0,length); desc=(COM_GamePlayerType *)temp; desc->type=(byte)COM_GAMEDESC; desc->player=consoleplayer; desc->violence=gamestate.violence; desc->Version = gamestate.Version; desc->Product = gamestate.Product; desc->playerdescription.character=locplayerstate->player; desc->playerdescription.uniformcolor=locplayerstate->uniformcolor; strcpy(&(desc->playerdescription.codename[0]), &locplayerstate->codename[0]); WritePacket(temp,length,server); SafeFree(temp); } //**************************************************************************** // // SendGameDescription () // //**************************************************************************** void SendGameDescription( void ) { byte * temp; COM_GameMasterType * desc; int length; int i; length=sizeof(COM_GameMasterType); temp=SafeMalloc(length); memset(temp,0,length); desc=(COM_GameMasterType *)temp; desc->type=(byte)COM_GAMEMASTER; desc->level=gamestate.mapon; desc->mapcrc=GetMapCRC (gamestate.mapon); desc->mode=gamestate.battlemode; desc->violence=gamestate.violence; desc->Version = gamestate.Version; desc->Product = gamestate.Product; desc->teamplay = gamestate.teamplay; memcpy( &desc->SpecialsTimes, &gamestate.SpecialsTimes, sizeof( specials ) ); BATTLE_GetOptions( &( desc->options ) ); GetMapFileName( &(desc->battlefilename[0]) ); desc->randomseed=GetRNGindex ( ); gamestate.randomseed=desc->randomseed; desc->ludicrousgibs=battlegibs; ludicrousgibs=battlegibs; // SetRNGindex ( gamestate.randomseed ); for (i=0;iplayers[i].character =PLAYERSTATE[i].player; desc->players[i].uniformcolor =PLAYERSTATE[i].uniformcolor; strcpy ( &(desc->players[i].codename[0]),&(PLAYERSTATE[i].codename[0])); } if (!networkgame) AssignTeams(); if (IsServer==false) { WritePacket(temp,length,server); } else { BroadcastServerPacket(temp,length); // Send to all } SafeFree(temp); } //**************************************************************************** // // SetGameDescription () // //**************************************************************************** void SetGameDescription( void * pkt ) { COM_GameMasterType * desc; word localcrc; int i; desc=(COM_GameMasterType *)pkt; gamestate.mapon=desc->level; gamestate.battlemode=desc->mode; gamestate.violence=desc->violence; gamestate.Version = desc->Version; gamestate.Product = desc->Product; gamestate.teamplay = desc->teamplay; memcpy( &gamestate.SpecialsTimes, &desc->SpecialsTimes, sizeof( specials ) ); BATTLE_SetOptions( &( desc->options ) ); gamestate.randomseed=desc->randomseed; SetRNGindex ( gamestate.randomseed ); SetBattleMapFileName( &(desc->battlefilename[0]) ); localcrc=GetMapCRC (gamestate.mapon); ludicrousgibs=desc->ludicrousgibs; if (localcrc!=desc->mapcrc) Error("You have different maps on your system\n"); for (i=0;iplayers[i].character; PLAYERSTATE[i].uniformcolor=desc->players[i].uniformcolor; strcpy ( &(PLAYERSTATE[i].codename[0]), &(desc->players[i].codename[0]) ); } AssignTeams(); } //**************************************************************************** // // SetPlayerDescription () // //**************************************************************************** void SetPlayerDescription( void * pkt ) { COM_GamePlayerType * desc; desc=(COM_GamePlayerType *)pkt; PLAYERSTATE[desc->player].player=desc->playerdescription.character; PLAYERSTATE[desc->player].uniformcolor=desc->playerdescription.uniformcolor; strcpy ( &(PLAYERSTATE[desc->player].codename[0]), &(desc->playerdescription.codename[0]) ); if ( gamestate.Version != desc->Version ) { Error("Player %s is using a different version of ROTT\n",PLAYERSTATE[desc->player].codename); // gamestate.Version = desc->Version; } if ( gamestate.violence > desc->violence ) { gamestate.violence = desc->violence; } if ( gamestate.Product > desc->Product ) { gamestate.Product = desc->Product; } } //**************************************************************************** // // SendGameAck () // //**************************************************************************** void SendGameAck( void ) { byte * temp; int length; COM_GameAckType * desc; length=sizeof(COM_GameAckType); temp=SafeMalloc(length); desc=(COM_GameAckType *)temp; desc->type=COM_GAMEACK; desc->player=consoleplayer; WritePacket(temp,length,server); SafeFree(temp); } //**************************************************************************** // // SendGameStart () // //**************************************************************************** void SendGameStart( void ) { byte * temp; int length; length=DUMMYPACKETSIZE; temp=SafeMalloc(length); *(temp)=(byte)COM_GAMEPLAY; if (IsServer==false) { WritePacket(temp,length,server); } else { BroadcastServerPacket(temp,length); // Send to all } SafeFree(temp); } //**************************************************************************** // // SetupGamePlayer () // //**************************************************************************** void SetupGamePlayer ( void ) { int savetime; boolean done; boolean gameready; savetime=GetTicCount(); done=false; gameready=false; while (done==false) { // Setup individual player AbortCheck("SetupGamePlayer aborted\n"); // send Player Description if (GetTicCount() >= savetime) { savetime=GetTicCount()+SETUPTIME; if (gameready==false) SendPlayerDescription(); else SendGameAck(); } switch (SetupCheckForPacket()) { case scfp_done: done=true; break; case scfp_gameready: gameready=true; break; } } savetime=GetTicCount()+(VBLCOUNTER/2); while (GetTicCount()= savetime) { savetime=GetTicCount()+SETUPTIME; if (GotAllPlayerDescriptions()==true) SendGameDescription(); } if (AllPlayersReady ()==true) { SendGameStart(); SendGameStart(); done=true; } SetupCheckForPacket(); } savetime=GetTicCount()+(VBLCOUNTER/2); while (GetTicCount()player=0; InitializeWeapons(locplayerstate); ResetPlayerstate(locplayerstate); InitCharacter(); free(demo); } //**************************************************************************** // // RecordDemo () // //**************************************************************************** void RecordDemo ( void ) { DemoHeaderType * DemoHeader; int level; if (demobuffer!=NULL) FreeDemo(); godmode=0; demobuffer = SafeMalloc (DEMOBUFFSIZE); demoptr = demobuffer; lastdemoptr = demobuffer+DEMOBUFFSIZE; // Save off level number DemoHeader=(DemoHeaderType *)demoptr; demoptr+=sizeof(gamestate); memcpy(&(DemoHeader->demostate),&gamestate,sizeof(gamestate)); demorecord = true; locplayerstate->player=0; InitializeWeapons(locplayerstate); ResetPlayerstate(locplayerstate); level=gamestate.mapon; InitCharacter(); gamestate.mapon=level; SoftError(">>>>>>>>>>>>Start demo record\n"); } //**************************************************************************** // // SetupDemo () // //**************************************************************************** void SetupDemo ( void ) { DemoHeaderType * DemoHeader; demoplayback = true; godmode=0; DemoHeader=(DemoHeaderType *)demoptr; demoptr+=sizeof(gamestate); // if (gamestate.violence!=DemoHeader->demostate.violence) // Error ("This demo has a different difficulty level than your current settings\n"); memcpy(&gamestate,&(DemoHeader->demostate),sizeof(gamestate)); SoftError(">>>>>>>>>>>>Start demo playback\n"); } //**************************************************************************** // // FreeDemo () // //**************************************************************************** void FreeDemo ( void ) { demoplayback = false; demorecord = false; SafeFree (demobuffer); demobuffer=NULL; } //**************************************************************************** // // CheckForDemoDone () // //**************************************************************************** void CheckForDemoDone ( void ) { if ((demoplayback==true) && (demoptr >= lastdemoptr)) { FreeDemo(); playstate = ex_demodone; } } //**************************************************************************** // // CheckForDemoOverflowed () // //**************************************************************************** void CheckForDemoOverflowed ( void ) { if (demoptr >= (lastdemoptr-sizeof(DemoType))) { playstate = ex_completed; // demo is done EndDemo(); } } //**************************************************************************** // // RecordDemoCmd () // //**************************************************************************** void RecordDemoCmd (void) { DemoType * dtime; SoftError("Demo command recorded at %d\n",controlupdatetime); dtime=(DemoType *)demoptr; dtime->time = controlupdatetime; dtime->momx = (controlbuf[0]>>1); dtime->momy = (controlbuf[1]>>1); dtime->dangle = controlbuf[2]>>11; dtime->buttons = buttonbits; demoptr+=sizeof(DemoType); CheckForDemoOverflowed(); } //**************************************************************************** // // AddDemoCmd () // //**************************************************************************** void AddDemoCmd (void) { DemoType * dtime; // // get info from demo buffer // SoftError("Demo command played at %d\n",controlupdatetime); if (demoplayback==true) { dtime=(DemoType *)demoptr; controlbuf[0]=dtime->momx<<1; controlbuf[1]=dtime->momy<<1; controlbuf[2]=dtime->dangle<<11; buttonbits =dtime->buttons; demoptr+=sizeof(DemoType); } } //**************************************************************************** // // GetNextDemoTime () // //**************************************************************************** int GetNextDemoTime (void) { DemoType * dtime; CheckForDemoDone(); dtime=(DemoType *)demoptr; if (demoplayback) return dtime->time; else return -1; } //**************************************************************************** // // UpdateDemoPlayback () // //**************************************************************************** void UpdateDemoPlayback (int time) { if (demoplayback) { if (GetNextDemoTime()==time) AddDemoCmd(); } } rott-20230810/rott/rt_net.h000066400000000000000000000151731446517470200154200ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //*************************************************************************** // // RT_NET.H - Network stuff // //*************************************************************************** #ifndef _rt_net_public #define _rt_net_public #include "develop.h" #include "rottnet.h" #include "rt_actor.h" #include "rt_battl.h" #include "rt_playr.h" #include "rt_main.h" #define MAXCMDS 256 #define COM_DELTA 1 #define COM_REQUEST 2 #define COM_FIXUP 3 #define COM_TEXT 4 #define COM_PAUSE 5 #define COM_QUIT 6 #define COM_SYNC 7 #define COM_REMRID 8 #define COM_RESPAWN 10 #define COM_UNPAUSE 11 #define COM_SERVER 12 #define COM_START 13 #define COM_GAMEDESC 15 #define COM_GAMEPLAY 16 #define COM_GAMEMASTER 17 #define COM_GAMEACK 18 #define COM_ENDGAME 19 #define COM_SYNCTIME 20 #define COM_SOUNDANDDELTA 22 #define COM_EXIT 23 #define COM_GAMEEND 24 #define COM_DELTANULL 25 #define CHECKSYNCTIME (VBLCOUNTER<<2) #define NETSYNCSERVERTIME (VBLCOUNTER) #define MODEMSYNCSERVERTIME (VBLCOUNTER/4) #define DUMMYPACKETSIZE 20 #define COM_MAXTEXTSTRINGLENGTH 33 // Sound defines for Remote ridicule #define COM_SOUND_START_TRANSMISSION (0xff) #define COM_SOUND_END_TRANSMISSION (0xfe) #define COM_SOUND_NORMAL_TRANSMISSION (0xfd) #define COM_SOUND_BUFFERSIZE 256 // Demo Delta Structure typedef struct DemoType { int time; short momx; short momy; word dangle; word buttons; } DemoType; // Demo Header Structure typedef struct DemoHeaderType { gametype demostate; } DemoHeaderType; // Movement Queue Structure typedef struct MoveType { byte type; int time; short momx; short momy; word dangle; word buttons; char Sounddata[0]; } MoveType; typedef struct NullMoveType { byte type; int time; } NullMoveType; typedef struct { void * Commands[MAXCMDS]; } CommandType; typedef struct { byte CommandStates[MAXCMDS]; } CommandStatusType; typedef MoveType COM_SoundAndDeltaType; // uncomment for live remote ridicule typedef struct { byte type; byte data[COM_SOUND_BUFFERSIZE]; // char data[COM_MAXTEXTSTRINGLENGTH]; } COM_SoundType; typedef struct { byte type; int synctime; } COM_SyncType; typedef struct { byte type; int time; int synctime; int x; int y; int z; word angle; word randomindex; } COM_CheckSyncType; typedef struct { byte type; int time; byte numpackets; byte data; } COM_ServerHeaderType; typedef struct { byte type; int time; byte numpackets; } COM_RequestType; typedef struct { byte type; int time; byte towho; char string[COM_MAXTEXTSTRINGLENGTH]; } COM_TextType; #define MSG_DIRECTED_TO_ALL 255 #define MSG_DIRECTED_TO_TEAM 254 typedef struct { byte type; int time; byte player; byte num; byte towho; } COM_RemoteRidiculeType; typedef struct { byte type; int time; byte numpackets; byte data; } COM_FixupType; typedef struct { byte type; int time; } COM_QuitType; typedef struct { byte type; int time; } COM_ExitType; typedef struct { byte type; int time; } COM_GameEndType; typedef struct { byte character; // which character byte uniformcolor; // which color char codename[MAXCODENAMELENGTH]; // codename } COM_PlayerDescriptionType; typedef struct { byte type; byte player; // which player byte violence; byte Product; unsigned Version; COM_PlayerDescriptionType playerdescription; } COM_GamePlayerType; typedef struct { byte type; byte level; word mapcrc; byte violence; byte Product; byte mode; unsigned Version; boolean teamplay; specials SpecialsTimes; battle_type options; char battlefilename[20]; int randomseed; boolean ludicrousgibs; COM_PlayerDescriptionType players[MAXPLAYERS]; } COM_GameMasterType; typedef struct { byte type; byte player; // which player } COM_GameAckType; typedef struct { byte type; int time; } COM_EndGameType; typedef struct { byte type; int time; } COM_RespawnType; typedef struct { byte type; int time; } COM_PauseType; typedef struct { byte type; int time; } COM_UnPauseType; extern boolean demorecord, demoplayback; extern byte *demoptr, *lastdemoptr, *demobuffer; extern boolean demodone; extern int predemo_violence; void ControlPlayer (void); void ControlRemote (objtype * ob); void ControlPlayerObj (objtype * ob); void InitializeGameCommands( void ); void ShutdownGameCommands( void ); void UpdateClientControls ( void ); void StartupClientControls ( void ); void ShutdownClientControls ( void ); void ProcessServer ( void ); void ServerLoop( void ); void SendPlayerDescription( void ); void SetGameDescription( void * pkt ); void SendGameDescription( void ); void SendGameAck( void ); void SendGameStart( void ); void SetupGamePlayer ( void ); void SetupGameMaster ( void ); void SetNormalHorizon (objtype * ob); void SaveDemo (int demonumber); void LoadDemo (int demonumber); void RecordDemo ( void ); void SetupDemo ( void ); void FreeDemo ( void ); boolean DemoExists (int demonumber); void AddEndGameCommand ( void ); void AddTextMessage ( char * message, int length, int towho ); void AddEndGameCommand ( void ); void AddPauseStateCommand ( int type ); void AddRespawnCommand ( void ); void RecordDemoCmd (void); void ResetCurrentCommand ( void ); void AddRemoteRidiculeCommand ( int player, int towho, int num ); void ProcessRemoteRidicule ( void * pkt ); void SyncToServer( void ); void AddQuitCommand ( void ); void AddExitCommand ( void ); void AddGameEndCommand ( void ); boolean PlayerInGame ( int p ); boolean ConsoleIsServer ( void ); extern boolean IsServer; extern boolean standalone; extern boolean playerdead; extern boolean modemgame; extern boolean networkgame; extern int numplayers; extern int server; extern boolean GamePaused; extern boolean battlegibs; extern boolean remoteridicule; int GamePacketSize( void ); #endif rott-20230810/rott/rt_playr.c000066400000000000000000004240761446517470200157620ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "watcom.h" #include "rt_sound.h" #include "gmove.h" #include "states.h" #include "rt_sqrt.h" #include "rt_actor.h" #include "rt_main.h" #include "rt_playr.h" #include "isr.h" #include "rt_draw.h" #include "rt_ted.h" #include "rt_door.h" #include "rt_menu.h" #include "rt_view.h" #include "rt_com.h" #include "rt_in.h" #include "rt_util.h" #include "rt_game.h" #include "rt_rand.h" #include "z_zone.h" #include "engine.h" #include "_rt_play.h" #include "rt_cfg.h" #include "rt_floor.h" #include "develop.h" #include "rt_msg.h" #include "rt_debug.h" #include "sprites.h" #include "rt_net.h" #include "rt_dmand.h" #define FLYINGZMOM 350000 specials CurrentSpecialsTimes = { 60*VBLCOUNTER, // god 60*VBLCOUNTER, // dog 20*VBLCOUNTER, // shrooms 20*VBLCOUNTER, // elasto 60*VBLCOUNTER, // asbestos vest 60*VBLCOUNTER, // bullet proof vest GASTICS, // gas mask 60*VBLCOUNTER, // mercury mode 300*VBLCOUNTER, // god respawn 60*VBLCOUNTER, // dog respawn 60*VBLCOUNTER, // shrooms respawn 60*VBLCOUNTER, // elasto respawn 60*VBLCOUNTER, // asbestos vest respawn 60*VBLCOUNTER, // bullet proof vest respawn 60*VBLCOUNTER, // gas mask respawn 60*VBLCOUNTER // mercury mode respawn }; int GRAVITY = NORMAL_GRAVITY; ROTTCHARS characters[5]={ {0x2100,0x4800,100,2,25}, // Taradino Cassatt {0x2200,0x5200,85,3,32}, // Thi Barrett {0x1f00,0x4000,150,3,20}, // Doug Wendt {0x2300,0x5500,70,2,33}, // Lorelei Ni {0x2000,0x4400,120,3,25}}; // Ian Paul Freeley static const int TD = MINACTORDIST+0x1000; static const int STRAFEAMOUNT = ((KEYBOARDNORMALTURNAMOUNT >> 10) + (KEYBOARDNORMALTURNAMOUNT >> 12)); static const int GODYZANGLE = -(9*FINEANGLES/360); static const int DOGYZANGLE = (4*FINEANGLES/360); static const int SHROOMYZANGLE = (15*FINEANGLES/360); static const int FALLINGYZANGLE = -(15*FINEANGLES/360); static const int NORMALYZANGLE = 0; /* ============================================================================= GLOBAL VARIABLES ============================================================================= */ int controlbuf[3]; int buttonbits; extern _2Dpoint LASTSOUND; // // player state info // statobj_t *DEADPLAYER[MAXDEAD]; int NUMDEAD; int lastpolltime; statobj_t *BulletHoles[MAXBULLETS]; int BulletHoleNum; objtype *PLAYER[MAXPLAYERS],*player; playertype PLAYERSTATE[MAXPLAYERS],*locplayerstate; gametype gamestate; boolean godmode = false; boolean missilecam=false; objtype * missobj=NULL; // Player control variables int KX = 0; int KY = 0; int MX = 0; int MY = 0; int JX = 0; int JY = 0; int CX = 0; int CY = 0; boolean vrenabled = false; int VX = 0; int VY = 0; int oldcyberx = 0; int oldcybery = 0; int CYBERDEADRANGE = 6000; boolean CYBERLOOKUP,CYBERLOOKDOWN; int leftmom = 0; int rightmom = 0; int lastmom = 0; int first = 1; int pausedstartedticcount; boolean RefreshPause = true; boolean buttonpoll[NUMBUTTONS]; int buttonscan[NUMBUTTONS] = {sc_Control, sc_Alt, sc_RShift, sc_Space, sc_PgUp,sc_PgDn,sc_Enter,sc_Delete, sc_Home,sc_End,sc_1,sc_2,sc_3,sc_4, sc_CapsLock, sc_F12, sc_Comma,sc_Period,sc_BackSpace,sc_A, sc_UpArrow, sc_RightArrow, sc_DownArrow, sc_LeftArrow, sc_Tab, sc_T, sc_Z }; int joyxmax = 0, joyymax = 0, joyxmin = 0, joyymin = 0; int buttonmouse[6] = {bt_attack, bt_strafe, di_north, bt_nobutton, bt_use, bt_nobutton }; int buttonjoy[8] = {bt_attack, bt_strafe, bt_run, bt_use, bt_nobutton, bt_nobutton, bt_nobutton, bt_nobutton }; williamdidthis FREE = {84,5,0,0,9,{{done,2,1},{done,2,2},{done,2,3}, {done,2,4},{done,2,5},{done,2,6},{done,2,7},{done,2,8}, {reset,2,9}}}; williamdidthis DOGSCRATCH = {128,5,0,0,4,{{done,2,8},{at_pulltrigger,2,9},{done,2,10}, {reset,2,11}}}; williamdidthis DOGLICK = {128,5,0,0,4,{{done,2,4},{done,2,5},{done,2,6}, {reset,2,7}}}; williamdidthis WEAPONS[MAXWEAPONS] = { {100,-1,10,0x2000l,3,{{at_pulltrigger,4,1},{done,4,2},{reset,4,0}}}, //single pistol {100,-1,10,0x2000l,6,{{at_pulltrigger,2,1},{done,2,2},{done,2,3}, {at_pulltrigger,2,4},{done,2,5},{reset,2,3}}}, // double pistol {70,-1,10,0x2000l,2,{{at_pulltrigger,2,1},{reset,1,2}}}, //mp 40 {80,5,10,0x50000l,4,{{at_missileweapon,2,1},{done,2,2},{reset,2,3},{reset2,6,0}}}, //bazooka {80,5,10,0x10000l,4,{{at_missileweapon,2,1},{done,2,2},{reset,2,3},{reset2,6,0}}}, //firebomb {80,5,10,0x50000l,4,{{at_missileweapon,2,1},{done,2,2},{reset,2,3},{reset2,6,0}}}, //heatseeker {80,5,10,0x10000l,4,{{at_missileweapon,2,1},{done,2,2},{reset,2,3},{reset2,6,0}}}, //drunk {80,5,7,0x10000l,4,{{at_missileweapon,2,1},{done,2,2},{reset,2,2},{reset2,6,0}}}, // firewall {125,5,7,0x10000l,7,{{done,3,1},{done,3,2},{done,3,3},{done,3,4}, {at_missileweapon,3,5},{done,3,6},{reset,3,7}}}, //GODHAND #if (SHAREWARE == 0) {80,5,7,0x10000l,4,{{at_missileweapon,2,1},{done,2,2},{reset,2,3},{reset2,6,0}}}, //split {80,5,7,0x10000l,9,{{done,5,1},{done,5,2},{done,5,3},{done,5,4}, {at_missileweapon,10,5},{done,5,4},{done,5,3}, // kes {done,5,2},{reset,5,1}}}, {200,5,7,0x10000l,6,{{done,1,1},{done,1,2},{at_pulltrigger,1,3},{at_pulltrigger,1,4}, {at_pulltrigger,1,5},{reset,1,6}}}, //BAT {128,5,7,0x10000l,3,{{done,2,1},{at_pulltrigger,2,2},{reset,2,3}}} #endif }; /* ============================================================================= LOCAL FUNCTION PROTOTYPES and VARIABLES ============================================================================= */ void CheckPlayerSpecials(objtype * ob); void CheckWeaponStates(objtype * ob); boolean CheckSprite (statobj_t* ,int *); void T_Tag (objtype *ob); void T_Player (objtype *ob); void T_BatBlast(objtype*ob); void T_Attack (objtype *ob); void T_Free (objtype *ob); void T_DogUse (objtype *ob); void PlayerMove(objtype * ob); void Thrust (objtype * ob); void CheckWeaponChange (objtype * ob); void PlayerMissileAttack(objtype* ); void Cmd_Use(objtype*); //void ComError (char *error, ...); int FinddTopYZANGLELIMITvalue(objtype *ob); statetype s_free = {false,0,0,T_Free,0,&s_free}; statetype s_inelevator = {false,0,420,T_Player,0,&s_player}; #if (SHAREWARE == 0) statetype s_dogwait = {true,SERIALDOG_W11,50,T_Player,SF_DOGSTATE,&s_serialdog}; statetype s_doguse = {true,SERIALDOG_W11,140,T_DogUse,SF_DOGSTATE,&s_serialdog}; statetype s_doglick = {true,SERIALDOG_W11,0,T_DogLick,SF_DOGSTATE,&s_doglick}; #endif statetype s_tag = {false,CASSATT_S1,20,T_Tag,0,&s_player}; // // curent user input // static int turnheldtime; static int turnaround = 0; static int turnaroundtime; // // Double Click variables // static int DoubleClickTimer[ 3 ] = { 0 }; static byte DoubleClickCount[ 3 ] = { 0 }; static byte DoubleClickPressed[ 3 ] = { false }; static int JoyDblClickTimer[ 4 ] = { 0 }; static byte JoyDblClickCount[ 4 ] = { 0 }; static byte JoyDblClickPressed[ 4 ] = { false }; static int PlayerRecording=-1; static int nettics; void Move_Player_From_Exit_To_Start(objtype *ob); void CheckTagGame(objtype *actor1,objtype*actor2); void CheckFlying(objtype*ob,playertype *pstate); /* =============== = = LoadPlayer = =============== */ void LoadPlayer ( void ) { memset (locplayerstate->buttonstate, 0, sizeof(locplayerstate->buttonstate)); locplayerstate->anglefrac=player->angle<areanumber]=true; ConnectAreas(); } int MaxHitpointsForCharacter(playertype*pstate) { if (BATTLEMODE && (gamestate.BattleOptions.HitPoints != bo_character_hitpoints)) { return( gamestate.BattleOptions.HitPoints ); } return characters[pstate->player].hitpoints; } void InitializeWeapons(playertype*pstate) { #if (SHAREWARE == 0) if (gamestate.SpawnEluder) {pstate->new_weapon = pstate->weapon = pstate->missileweapon = wp_dog; pstate->oldweapon = pstate->oldmissileweapon = wp_dog; pstate->bulletweapon = -1; pstate->HASBULLETWEAPON[wp_pistol] = 0; pstate->HASBULLETWEAPON[wp_twopistol] = 0; pstate->HASBULLETWEAPON[wp_mp40] = 0; } else #endif {if (gamestate.PlayerHasGun[pstate-&PLAYERSTATE[0]]) {pstate->new_weapon = pstate->weapon = pstate->oldweapon = pstate->bulletweapon = wp_pistol; pstate->HASBULLETWEAPON[wp_pistol] = 1; pstate->HASBULLETWEAPON[wp_twopistol] = 0; pstate->HASBULLETWEAPON[wp_mp40] = 0; pstate->missileweapon = pstate->oldmissileweapon = -1; } else {pstate->new_weapon = pstate->weapon = pstate->oldweapon = pstate->bulletweapon = -1; pstate->HASBULLETWEAPON[wp_pistol] = 0; pstate->HASBULLETWEAPON[wp_twopistol] = 0; pstate->HASBULLETWEAPON[wp_mp40] = 0; pstate->missileweapon = pstate->oldmissileweapon = -1; } } pstate->ammo = -1; } void ResetPlayerstate(playertype*pstate) { pstate->batblast = 0; pstate->poweruptime = pstate->protectiontime = 0; pstate->NETCAPTURED = 0; MISCVARS->NET_IN_FLIGHT = 0; pstate->weaponuptics = 0; pstate->weapondowntics = 0; if ((insetupgame==false) || NewGame) pstate->health = MaxHitpointsForCharacter(pstate); pstate->keys = 0; // Give players all the keys in battle game if ( BATTLEMODE ) { pstate->keys = 0x0f; } pstate->attackframe = pstate->attackcount = pstate->weaponframe = 0; if (gamestate.battlemode == battle_Tag) pstate->weaponheight = TAGHANDHEIGHT; else pstate->weaponheight = 0; pstate->heightoffset = pstate->oldheightoffset = 0; if (gamestate.SpawnEluder) pstate->playerheight = 40; else pstate->playerheight = characters[pstate->player].height; pstate->falling = false; memset (pstate->buttonstate, 0, sizeof(pstate->buttonstate)); SetPlayerHorizon(pstate,NORMALYZANGLE); } /* =============== = = SetupPlayerobj = =============== */ void SetupPlayerobj (int tilex, int tiley, int dir, objtype * ob) { playertype *pstate; M_LINKSTATE(ob,pstate); ob->obclass = playerobj; ob->tilex = tilex; ob->tiley = tiley; actorat[tilex][tiley] = ob; ob->areanumber = MAPSPOT(tilex,tiley,0)-AREATILE; MakeLastInArea(ob); ob->x = ((long)tilex<y = ((long)tiley<z = PlatformHeight(tilex,tiley); if ((ob->z == -10) || DiskAt(tilex,tiley)) ob->z = 0; ob->angle = (1-dir)*ANG90; ob->which = ACTOR; Fix(ob->angle); ob->yzangle = 0; ob->dir = angletodir[ob->angle]; ob->flags = (FL_SHOOTABLE|FL_ABP|FL_BLOCK|FL_COLORED); ob->drawx=ob->x; ob->drawy=ob->y; ob->hitpoints = pstate->health; pstate->anglefrac= (ob->angle<angle=0; areabyplayer[ob->areanumber]=true; if (ob == player) { playerdead=false; // local player dead flag } if (!gamestate.SpawnEluder) ob->shapeoffset = pstate->player*REMOTEOFFSET; memset (pstate->buttonstate, 0, sizeof(pstate->buttonstate)); if (SCREENEYE != NULL) { NewState(SCREENEYE,&s_megaremove); SCREENEYE = NULL; } } void SetShapeoffset(objtype*ob) {playertype *pstate; M_LINKSTATE(ob,pstate); ob->shapeoffset = pstate->player*REMOTEOFFSET; ob->flags |= FL_COLORED; ob->flags &= ~FL_DYING; } /* =============== = = RevivePlayerobj = =============== */ void RevivePlayerobj (int tilex, int tiley, int dir, objtype*ob) { playertype *pstate; statetype *tstate; M_LINKSTATE(ob,pstate); tstate = ob->state; RemoveFromArea(ob); TurnActorIntoSprite(ob); if ((LASTSTAT->z < nominalheight) && (!IsPlatform(LASTSTAT->tilex,LASTSTAT->tiley))) { SpawnParticles(ob,GUTS,10 + gamestate.difficulty); RemoveStatic(LASTSTAT); } else {if (DEADPLAYER[NUMDEAD]) RemoveStatic(DEADPLAYER[NUMDEAD]); DEADPLAYER[NUMDEAD] = LASTSTAT; LASTSTAT->linked_to = NUMDEAD; NUMDEAD = (NUMDEAD+1)&(MAXDEAD-1); } ob->state = tstate; SetupPlayerobj (tilex, tiley, dir, ob); ConnectAreas(); ResetPlayerstate(pstate); InitializeWeapons(pstate); SD_PlaySoundRTP(SD_PLAYERSPAWNSND,ob->x,ob->y); if (!gamestate.SpawnEluder) { ob->shapeoffset = 0; ob->flags &= ~FL_COLORED; ob->flags |= FL_DYING; NewState(ob,&s_respawn1); if (gamestate.battlemode == battle_Tag) { if (BATTLE_Team[ob->dirchoosetime] == BATTLE_It) { pstate->missileweapon = pstate->oldweapon = pstate->new_weapon = pstate->oldmissileweapon = pstate->weapon = wp_godhand; pstate->bulletweapon = -1; ob->flags |= FL_DESIGNATED; } else { pstate->weaponheight = 0; } } } #if (SHAREWARE == 0) else NewState(ob,&s_serialdog); #endif if (ob==player) DrawPlayScreen(false); ob->momentumx = ob->momentumy = ob->momentumz = 0; } /* =============== = = SpawnPlayerobj = =============== */ void SpawnPlayerobj (int tilex, int tiley, int dir, int playerindex) { GetNewActor(); MakeActive(new); // Set player number new->dirchoosetime = playerindex; // Save off if local player if (playerindex==consoleplayer) player=new; PLAYER[playerindex] = new; SetupPlayerobj (tilex, tiley, dir, new); if (!gamestate.SpawnEluder) NewState(new,&s_player); #if (SHAREWARE == 0) else NewState(new,&s_serialdog); #endif } /* =============== = = SetupBulletHoleLink = =============== */ void SetupBulletHoleLink (int num, statobj_t * item) { BulletHoles[num] = item; } /* =============== = = SpawnBulletHole = =============== */ void SpawnBulletHole (int x, int y, int z) { if (M_ISDOOR(x>>16,y>>16)) return; if (BulletHoles[MISCVARS->BulletHoleNum]) RemoveStatic(BulletHoles[MISCVARS->BulletHoleNum]); SpawnInertStatic(x,y,z,stat_bullethole); BulletHoles[MISCVARS->BulletHoleNum]=LASTSTAT; LASTSTAT->linked_to=MISCVARS->BulletHoleNum; MISCVARS->BulletHoleNum = (MISCVARS->BulletHoleNum+1)&(MAXBULLETS-1); } void SpawnGunSmoke(int x, int y, int z, int angle, int bullethole) { int chance; if ((x<=0) || (y<=0)) { SoftError("SpawnGunSmoke: xy below angle=%d\n",angle); return; } if ((bullethole!=0) && (z>=-32) && (z<=maxheight)) switch (bullethole) { case 1: SpawnBulletHole(x-BULLETHOLEOFFSET,y,z); break; case 2: SpawnBulletHole(x+BULLETHOLEOFFSET,y,z); break; case 3: SpawnBulletHole(x,y-BULLETHOLEOFFSET,z); break; case 4: SpawnBulletHole(x,y+BULLETHOLEOFFSET,z); break; case 5: SpawnBulletHole(x,y,z); break; default: Error("Invalid bullethole value\n"); break; } SpawnInertActor(x,y,z); NewState(new,&s_gunsmoke1); if (angle < ANGLES/4) {if ((angle < (3*ANGLES/16)) && (angle > (ANGLES/16))) chance = 128; else chance = 20; } else if (angle < ANGLES/2) {if ((angle < (7*ANGLES/16)) && (angle > (5*ANGLES/16))) chance = 128; else chance = 20; } else if (angle < 3*ANGLES/4) {if ((angle < (11*ANGLES/16)) && (angle > (9*ANGLES/16))) chance = 128; else chance = 20; } else {if ((angle < (15*ANGLES/16)) && (angle > (13*ANGLES/16))) chance = 128; else chance = 20; } if (RandomNumber("Wall ricochet check",0)x,new->y); else if (rand < 160) SD_PlaySoundRTP(SD_RICOCHET2SND,new->x,new->y); else SD_PlaySoundRTP(SD_RICOCHET3SND,new->x,new->y); } } void SpawnBlood(objtype * ob, int angle) { SpawnInertActor(ob->x-(costable[angle]>>5), ob->y+(sintable[angle]>>5),ob->z); NewState(new,&s_bloodspurt1); if ((new->x<=0) || (new->y<=0)) Error("SpawnBlood: bad x,y obj->obclass=%d\n",ob->obclass); } void SpawnMetalSparks(objtype * ob, int angle) { int rand,dispx=0,dispy=0; if (ob->which == ACTOR) { dispx = ob->momentumx; dispy = ob->momentumy; } SpawnInertActor(ob->x-(costable[angle]>>3)+dispx, ob->y+(sintable[angle]>>3)+dispy,ob->z); if (GameRandomNumber("Spawn Metal Sparks",0)<128) NewState(new,&s_hitmetalactor1); else NewState(new,&s_hitmetalwall1); rand = RandomNumber("Spawn Ricochet Sound",0); if (rand < 80) SD_PlaySoundRTP(SD_RICOCHET1SND,new->x,new->y); else if (rand < 160) SD_PlaySoundRTP(SD_RICOCHET2SND,new->x,new->y); else SD_PlaySoundRTP(SD_RICOCHET3SND,new->x,new->y); if ((new->x<=0) || (new->y<=0)) Error("SpawnMetalSparks: bad x,y obj->obclass=%d\n",ob->obclass); } /* =============== = = UnTargetActor ( objtype * target ) = =============== */ void UnTargetActor ( objtype * target ) { int i; for (i=0;inextactive) { if (temp == ob) continue; if ((!(temp->flags & FL_SHOOTABLE)) || (temp->flags & FL_DYING)) continue; if (!CheckLine(ob,temp,SHOOT)) continue; dx = temp->x-ob->x; dy = ob->y-temp->y; dz = ob->z-temp->z; xydist = FindDistance(dx,dy); yzangle = atan2_appx(xydist,dz<<10); angle = atan2_appx(dx,dy); magangle = abs(ob->angle - angle); if (magangle > VANG180) magangle = ANGLES - magangle; if (magangle > ANGLESDIV8) continue; currdist = FindDistance(ob->x-temp->x,ob->y-temp->y); if (currdist < mindist) { mindist = currdist; target = temp; saveangle = angle; saveyzangle = yzangle; } } if (target) { oldyzangle = ob->yzangle; ob->yzangle = saveyzangle; SpawnMissile(ob,mdata->obclass,mdata->speed,saveangle, mdata->state,mdata->offset); ob->yzangle = oldyzangle; } else if (ob->flags&FL_GODMODE) { int saveangle; saveangle=ob->yzangle; ob->yzangle -= GODYZANGLE; Fix(ob->yzangle); SpawnMissile(ob,mdata->obclass,mdata->speed, ob->angle,mdata->state,mdata->offset); ob->yzangle=saveangle; } else SpawnMissile(ob,mdata->obclass,mdata->speed,ob->angle, mdata->state,mdata->offset); } void PlayerMissileAttack(objtype*ob) { playertype * pstate; missile_stats *newmissiledata; M_LINKSTATE(ob,pstate); MISCVARS->madenoise = true; newmissiledata = &PlayerMissileData[pstate->missileweapon]; // ready to annihilate this poor bastard if ((newmissiledata->obclass == p_godballobj) || (newmissiledata->obclass == p_kesobj)) MissileAutoTarget(ob,newmissiledata); else { SpawnMissile(ob,newmissiledata->obclass,newmissiledata->speed,ob->angle, newmissiledata->state,newmissiledata->offset); if (newmissiledata->obclass == p_drunkmissileobj) { int i; for(i=0;i<4;i++) { if (!MissileTryMove(new,new->x+new->momentumx,new->y+new->momentumy,new->z)) { new->x = new->drawx = ob->x + (costable[new->angle]>>3); new->y = new->drawy = ob->y - (sintable[new->angle]>>3); ob->momentumx = -FixedMul(0x5000l,costable[ob->angle]); ob->momentumy = FixedMul(0x5000l,sintable[ob->angle]); } SpawnMissile(ob,newmissiledata->obclass,newmissiledata->speed,ob->angle, newmissiledata->state,newmissiledata->offset); } } } if (newmissiledata->flags & MF_SINGULAR) PLAYER0MISSILE = new; SD_PlaySoundRTP(BAS[new->obclass].fire,ob->x,ob->y); // if (new->obclass == p_godballobj) // new->z += 10; new->dirchoosetime = 5; if (missilecam==true) missobj=new; if (!MissileTryMove(new,new->x+new->momentumx,new->y+new->momentumy,new->z)) { new->x = new->drawx = ob->x + (costable[new->angle]>>3); new->y = new->drawy = ob->y - (sintable[new->angle]>>3); ob->momentumx = -FixedMul(0x5000l,costable[ob->angle]); ob->momentumy = FixedMul(0x5000l,sintable[ob->angle]); } } //==================================================================== boolean InRange (objtype *p, objtype *victim, int distance) { int dx,dy; int angle; int magangle; if (victim->which==SPRITE) { dx = ((statobj_t *)victim)->x - p->x; dy = p->y - ((statobj_t *)victim)->y; } else { dx = victim->x - p->x; dy = p->y - victim->y; } angle = atan2_appx (dx,dy); magangle = abs(p->angle - angle); if (magangle > VANG180) magangle = ANGLES - magangle; if (magangle<(75-(distance>>16))) return true; else return false; } void DogAttack(objtype*ob) { objtype *temp; int dx,dy,dz; SD_PlaySoundRTP(SD_DOGMODEBITE1SND+(RandomNumber("DogAttack",0)>>7),ob->x,ob->y); for(temp=firstareaactor[ob->areanumber];temp;temp=temp->nextinarea) { if (temp->obclass > b_heinrichobj) continue; if ((temp == ob) || (temp->obclass == roboguardobj)) continue; if ((!(temp->flags & FL_SHOOTABLE)) || (temp->flags & FL_DYING)) continue; if (temp->obclass == collectorobj) continue; dx = abs(temp->x - ob->x); if (dx > 0xc000) continue; dy = abs(temp->y - ob->y); if (dy > 0xc000) continue; dz = abs(temp->z - ob->z); if (dz > (0xc000>>10)) continue; DamageThing(temp,30); if (gamestate.violence == vl_excessive) SpawnParticles(temp,GUTS,15); Collision(temp,ob,-temp->momentumx,-temp->momentumy); if ((temp->obclass == playerobj) && (temp->flags & FL_DYING)) BATTLE_PlayerKilledPlayer(battle_kill_with_missile,ob->dirchoosetime,temp->dirchoosetime); return; } } void DogBlast(objtype*ob) { int txl,txh,tyl,tyh,radius = 0x70000,x,y,tile; objtype*temp; statobj_t*tstat; txl = ((ob->x - radius)>>TILESHIFT); tyl = ((ob->y - radius)>>TILESHIFT); txh = ((ob->x + radius)>>TILESHIFT); tyh = ((ob->y + radius)>>TILESHIFT); if (txl < 1) txl = 1; if (txh > MAPSIZE-1) txh = MAPSIZE-1; if (tyl < 1) tyl = 1; if (tyh > MAPSIZE-1) tyh = MAPSIZE-1; for(x=txl;x<=txh;x++) for(y=tyl;y<=tyh;y++) { temp = (objtype*)actorat[x][y]; if (temp && (temp->which == ACTOR) && (temp->flags & FL_SHOOTABLE) && (temp != ob) && (temp->obclass < roboguardobj) && (temp->flags & FL_ABP) ) { DamageThing(temp,100); if ((temp->hitpoints<=0) && (temp->obclass < roboguardobj)) { MISCVARS->supergibflag = true; temp->flags |= FL_HBM; } Collision(temp,ob,0,0); MISCVARS->supergibflag = false; if ((temp->obclass == playerobj) && (temp->flags & FL_DYING)) BATTLE_PlayerKilledPlayer(battle_kill_with_missile,ob->dirchoosetime,temp->dirchoosetime); } tile = tilemap[x][y]; if ((tile & 0x4000) && (tile & 0x8000)) { maskedwallobj_t * mw; mw=maskobjlist[tile&0x3ff]; if ((mw->flags & MW_SHOOTABLE) && (mw->flags & MW_ABP)) UpdateMaskedWall(tile&0x3ff); } tstat = sprites[x][y]; if (tstat && (tstat->flags & FL_SHOOTABLE) && (tstat->flags & FL_ABP)) DamageThing(tstat,50); } } /* void DogBlast(objtype*ob) { int txl,txh,tyl,tyh,radius = 0x70000,x,y,tile; objtype*temp; statobj_t*tstat; txl = ((ob->x - radius)>>TILESHIFT); tyl = ((ob->y - radius)>>TILESHIFT); txh = ((ob->x + radius)>>TILESHIFT); tyh = ((ob->y + radius)>>TILESHIFT); if (txl < 1) txl = 1; if (txh > MAPSIZE-1) txh = MAPSIZE-1; if (tyl < 1) tyl = 1; if (tyh > MAPSIZE-1) tyh = MAPSIZE-1; for(x=txl;x<=txh;x++) for(y=tyl;y<=tyh;y++) { temp = (objtype*)actorat[x][y]; if (temp && (temp->which == ACTOR) && (temp->flags & FL_SHOOTABLE) && (temp != ob) && (temp->obclass < roboguardobj)) { DamageThing(temp,100); if ((temp->hitpoints<=0) && (temp->obclass < roboguardobj)) { MISCVARS->supergibflag = true; temp->flags |= FL_HBM; } Collision(temp,ob,0,0); MISCVARS->supergibflag = false; if ((temp->obclass == playerobj) && (temp->flags & FL_DYING)) BATTLE_PlayerKilledPlayer(battle_kill_with_missile,ob->dirchoosetime,temp->dirchoosetime); } tile = tilemap[x][y]; if ((tile & 0x4000) && (tile & 0x8000)) { maskedwallobj_t * mw; mw=maskobjlist[tile&0x3ff]; if (mw->flags & MW_SHOOTABLE) UpdateMaskedWall(tile&0x3ff); } tstat = sprites[x][y]; if (tstat && (tstat->flags & FL_SHOOTABLE)) DamageThing(tstat,50); } } */ void BatBlast(objtype*ob) {int angle; playertype *pstate; M_LINKSTATE(ob,pstate); angle = ob->angle - ANGLES/8 + ((++pstate->batblast)*ANGLES/48); Fix(angle); #if (SHAREWARE == 0) SpawnMissile(ob,p_bazookaobj,0x6000,angle,&s_batblast1,0xa000); #endif } void BatAttack(objtype*ob) {objtype *temp,*temp2; objtype *grenadetarget; statobj_t*tstat; int dx,dy,dz,angle,momx,momy,op,magangle; int tilexlow,tilexhigh; int tileylow,tileyhigh; int radius =0x10000; int x,y; SD_PlaySoundRTP(SD_EXCALISWINGSND,ob->x,ob->y); for(temp=firstareaactor[ob->areanumber];temp;temp=temp->nextinarea) {if (temp == ob) continue; if (temp->flags & FL_DYING) continue; if ((temp->obclass != grenadeobj) && (!((temp->obclass >= grenadeobj) && (temp->obclass <= p_godballobj))) && (!(temp->flags & FL_SHOOTABLE) || (temp->obclass >= roboguardobj)) ) continue; dx = abs(temp->x - ob->x); dy = abs(temp->y - ob->y); dz = abs(temp->z - ob->z); if ((dx > 0x10000) || (dy > 0x10000) || (dz > 20)) continue; magangle = abs(ob->angle - AngleBetween(ob,temp)); if (magangle > VANG180) magangle = ANGLES - magangle; if (magangle > ANGLES/8) continue; angle= ob->angle+ANGLES/16; Fix(angle); if ((temp->obclass >= grenadeobj) && (temp->obclass <= p_godballobj)) { temp->angle += ANGLES/2; Fix(temp->angle); temp->momentumx = temp->momentumy = temp->momentumz = 0; ParseMomentum(temp,temp->angle); temp->whatever = ob; temp->target = NULL; continue; } else if (temp->obclass != grenadeobj) {momx = FixedMul(0x3000l,costable[angle]); momy = -FixedMul(0x3000l,sintable[angle]); if (levelheight > 2) {op = FixedMul(GRAVITY,(maxheight-100)<<16) << 1; temp->momentumz = -FixedSqrtHP(op); } temp->flags |= FL_NOFRICTION; SD_PlaySoundRTP(SD_EXCALIHITSND,ob->x,ob->y); if ((gamestate.violence == vl_excessive) && (GameRandomNumber("Bat Gibs",0) < 150)) {temp->flags |= FL_HBM; DamageThing(temp,50); } else DamageThing(temp,10); if ((temp->flags & FL_HBM) && (temp->hitpoints > 0)) temp->flags &= ~FL_HBM; Collision(temp,ob,momx,momy); if ((temp->obclass == blitzguardobj) && (temp->state == &s_blitzplead7)) {temp->shapeoffset += deathshapeoffset[temp->obclass]; temp->flags |= FL_ALTERNATE; NewState(temp,&s_blitzdie3); temp->momentumx = temp->momentumy = 0; } } else // find target to hit grenade back at {int rand; rand = GameRandomNumber("bat/grenade target",0); if (rand < 80) {grenadetarget = (objtype*)(temp->whatever); // hit back at george GetMomenta(grenadetarget,ob,&(temp->momentumx),&(temp->momentumy),&(temp->momentumz),0x3000); } else if (rand < 160) // hit back at first eligible { for(temp2 = firstareaactor[ob->areanumber];temp2;temp2 = temp2->nextinarea) {magangle = abs(ob->angle-AngleBetween(ob,temp2)); if (magangle > VANG180) magangle = ANGLES - magangle; if (magangle > ANGLES/8) continue; GetMomenta(temp2,ob,&(temp->momentumx),&(temp->momentumy),&(temp->momentumz),0x3000); break; } } else // hit wherever {ob->angle += (rand >> 1); Fix(ob->angle); ob->momentumx = ob->momentumy = 0; ParseMomentum(ob,ob->angle); } temp->temp1 = 0x70000; NewState(temp,&s_grenade1); } break; } for(tstat=firstactivestat;tstat;tstat=tstat->statnext) { if (!(tstat->flags & FL_SHOOTABLE)) continue; dx = abs(tstat->x - ob->x); dy = abs(tstat->y - ob->y); dz = abs(tstat->z - ob->z); if ((dx > 0xc000) || (dy > 0xc000) || (dz > 20)) continue; magangle = abs(ob->angle - AngleBetween(ob,(objtype*)tstat)); if (magangle > VANG180) magangle = ANGLES - magangle; if (magangle > ANGLES/8) continue; DamageThing(tstat,50); } tilexlow = (int)((ob->x-radius) >>TILESHIFT); tileylow = (int)((ob->y-radius) >>TILESHIFT); tilexhigh = (int)((ob->x+radius) >>TILESHIFT); tileyhigh = (int)((ob->y+radius) >>TILESHIFT); for (y=tileylow;y<=tileyhigh;y++) for (x=tilexlow;x<=tilexhigh;x++) {if ((tilemap[x][y]&0x8000) && (tilemap[x][y]&0x4000)) {maskedwallobj_t * mw; mw=maskobjlist[tilemap[x][y]&0x3ff]; if (mw->flags&MW_SHOOTABLE) UpdateMaskedWall(tilemap[x][y]&0x3ff); } } } void AutoTargetHorizon(objtype *ob) { int dx,dy,angle,mindist,magangle, xydist,dz; objtype *temp; playertype * pstate; M_LINKSTATE(ob,pstate); mindist = 0x7fffffff; for(temp = firstactive;temp;temp=temp->nextactive) { if (temp == ob) continue; if ((!(temp->flags & FL_SHOOTABLE)) || (temp->flags & FL_DYING)) continue; if (!CheckLine(ob,temp,SHOOT)) continue; dx = temp->x-ob->x; dy = ob->y-temp->y; dz = ob->z-temp->z;//-pstate->playerheight+32; xydist = FindDistance(dx,dy); if (abs(dz<<10)>xydist) continue; angle = atan2_appx(dx,dy); magangle = ob->angle - angle; Fix(magangle); if ( (magangle>=(ANGLESDIV8/4)) && (magangle<=(FINEANGLES-(ANGLESDIV8/4))) ) { continue; } if (xydist < mindist) { mindist = xydist; pstate->guntarget=temp; temp->flags |= FL_TARGET; pstate->targettime=oldpolltime+(VBLCOUNTER); } } } void GunAttack (objtype *ob) { playertype * pstate; int damage; M_LINKSTATE(ob,pstate); MISCVARS->madenoise = true; switch (pstate->weapon) { case wp_pistol: SD_PlaySoundRTP(SD_ATKPISTOLSND,ob->x,ob->y); damage=DMG_PISTOL; break; case wp_mp40: SD_PlaySoundRTP(SD_ATKMP40SND,ob->x,ob->y); damage=DMG_MP40; break; case wp_twopistol: SD_PlaySoundRTP(SD_ATKTWOPISTOLSND,ob->x,ob->y); damage=DMG_PISTOL; break; } AutoTargetHorizon(ob); RayShoot (ob, damage, (characters[pstate->player].accuracy+gamestate.difficulty)<<3); } /* =============== = = Cmd_Fire = =============== */ void Cmd_Fire (objtype*ob) { playertype *pstate; M_LINKSTATE(ob,pstate); // pstate->buttonheld[bt_attack] = true; if (pstate->NETCAPTURED && (!pstate->HASKNIFE)) return; if (W_CHANGE(pstate)) return; pstate->attackframe = 0; if ((ob==player) && (pstate->weapon < wp_mp40) && (!pstate->NETCAPTURED)) gamestate.DODEMOCRATICBONUS1 = false; if (!pstate->NETCAPTURED) { if (pstate->weapon <= wp_mp40) NewState(ob,&s_pgunattack1); #if (SHAREWARE == 0) else if ((pstate->weapon == wp_bat) && (pstate->batblast >= BBTIME)) { pstate->batblast = 0; NewState(ob,&s_pbatblast); } else if (pstate->weapon == wp_dog) NewState(ob,&s_serialdogattack); #endif else NewState(ob,&s_pmissattack1); #if (SHAREWARE == 0) if ((pstate->weapon == wp_dog) && (!ob->momentumz)) ob->momentumz = -0x50000; #endif pstate->attackcount = WEAPONS[pstate->weapon].attackinfo[0].mtics; pstate->weaponframe = WEAPONS[pstate->weapon].attackinfo[0].frame; } else if (pstate->NETCAPTURED == 1) { NewState(player,&s_free); pstate->attackcount = FREE.attackinfo[0].mtics; pstate->weaponframe = FREE.attackinfo[0].frame; } } void PlayNoWaySound ( void ) { if (player->flags & FL_DOGMODE) SD_Play(SD_DOGMODEBITE2SND); else if ((locplayerstate->player == 1) || (locplayerstate->player == 3)) SD_Play(SD_PLAYERTBHURTSND); else SD_Play(SD_NOWAYSND); } /* =============== = = Cmd_Use = =============== */ void Cmd_Use (objtype*ob) { int checkx,checky,doorn, /*newtilex,newtiley,oldtilex,oldtiley,*/elevnum, wallx,wally; // statobj_t* tempsprite=NULL; objtype* tempactor= NULL; doorobj_t* tempdoor=NULL; pwallobj_t* temppwall=NULL; wall_t* tempwall=NULL; int index; playertype * pstate; M_LINKSTATE(ob,pstate); #if (SHAREWARE == 0) if ((pstate->weapon == wp_dog) && (ob->state != &s_doguse) && (ob->state != &s_dogwait) && (!W_CHANGE(pstate)) ) { pstate->attackframe = 0; NewState(ob,&s_doguse); pstate->attackcount = DOGSCRATCH.attackinfo[0].mtics; pstate->weaponframe = DOGSCRATCH.attackinfo[0].frame; ob->momentumz = -0x40000; return; } else #endif if ((ob->flags & FL_DESIGNATED) && (BATTLEMODE) && (gamestate.battlemode == battle_Tag)) { NewState(ob,&s_tag); //return; } // // find which cardinal direction the player is facing // if (ob->angle < FINEANGLES/8 || ob->angle > 7*FINEANGLES/8) { checkx = ob->tilex + 1; checky = ob->tiley; ob->dir = east; wallx = (checkx << TILESHIFT); wally = (checky << TILESHIFT) + TILEGLOBAL/2; } else if (ob->angle < 3*FINEANGLES/8) { checkx = ob->tilex; checky = ob->tiley-1; ob->dir = north; wally = (checky << TILESHIFT) + TILEGLOBAL; wallx = (checkx << TILESHIFT) + TILEGLOBAL/2; } else if (ob->angle < 5*FINEANGLES/8) { checkx = ob->tilex - 1; checky = ob->tiley; ob->dir = west; wallx = (checkx << TILESHIFT) + TILEGLOBAL; wally = (checky << TILESHIFT) + TILEGLOBAL/2; } else { checkx = ob->tilex; checky = ob->tiley + 1; ob->dir = south; wally = (checky << TILESHIFT); wallx = (checkx << TILESHIFT) + TILEGLOBAL/2; } if (actorat[checkx][checky]) { tempdoor=(doorobj_t*)actorat[checkx][checky]; tempactor = (objtype*)actorat[checkx][checky]; tempwall = (wall_t*)actorat[checkx][checky]; } doorn = tilemap[checkx][checky] & ~0x2000; // if (sprites[checkx][checky]) // tempsprite = sprites[checkx][checky]; if (doorn == (elevatorstart + 6)) return; if (pstate->buttonheld[bt_use]) return; if (doorn == (elevatorstart + 1)) { tilemap[checkx][checky]++; // flip switch if (MAPSPOT(ob->tilex,ob->tiley,1) == ALTELEVATORTILE); // playstate = ex_secretlevel; else if (ob==player) playstate = ex_completed; } else if (doorn == (elevatorstart + 5)) { elevnum = MAPSPOT(ob->tilex,ob->tiley,1) - 90; tempwall->flags |= FL_S_FLIPPED; OperateElevatorSwitch(ob,elevnum,checkx,checky); } else if (tempdoor && tempdoor->which==PWALL) { temppwall=(pwallobj_t *)tempdoor; OperatePushWall (temppwall->num,ob->dir, ob == player ); } else if ((doorn&0x8000) && (!(doorn&0x4000))) { doorobj_t* dptr = doorobjlist[doorn&0x3ff]; int dnum = doorn&0x3ff; int lock; OperateDoor (pstate->keys, dnum, (ob == player)); if (dptr->eindex != -1) { elevator_t*eptr; lock = dptr->lock; if ( lock && !( pstate->keys & ( 1 << ( lock - 1 ) ) ) ) { if (ob==player) { // locked switch (lock) { case 1: AddMessage("You need the \\EGOLD key",MSG_DOOR); break; case 2: AddMessage("You need the \\FSILVER key",MSG_DOOR); break; case 3: AddMessage("You need the \\8IRON key",MSG_DOOR); break; case 4: AddMessage("You need the \\AOSCURO key",MSG_DOOR); break; default: AddMessage("This door appears to be locked",MSG_DOOR); break; } SD_Play( SD_NOITEMSND ); } return; } eptr = &ELEVATOR[dptr->eindex]; if (((dnum == eptr->door1) && (eptr->state == ev_rad)) || ((dnum == eptr->door2) && (eptr->state == ev_ras)) ) if (ob == player) AddMessage("Elevator is on the way.",MSG_GAME); OperateElevatorDoor(dnum); } } else if ((tempactor) && (tempactor->which == ACTOR) && (tempactor->obclass == pillarobj) && DISTOK(ob->x,tempactor->x,TD) && DISTOK(ob->y,tempactor->y,TD) && (!(tempactor->flags & FL_DONE)) && (!MAPSPOT(tempactor->tilex,tempactor->tiley,2)) ) {if ((tempactor->dir == nodir) || (tempactor->dir == ob->dir)) {if (tempactor->dir == nodir) { tempactor->dir = ob->dir; ParseMomentum(tempactor,dirangle8[tempactor->dir]); } SD_PlaySoundRTP ( SD_PUSHWALLSND, tempactor->x, tempactor->y ); tempactor->flags |= FL_ACTIVE; tempactor->flags |= FL_FLIPPED; // MakeActive(tempactor); tempactor->whatever = ob; gamestate.secretcount++; } } else if ((tempwall) && (tempwall->which == WALL) && (tempwall->flags & FL_SWITCH) ) { tempwall->flags |= FL_S_FLIPPED; if ((tempwall->flags & FL_W_INVERTED) && DISTOK(ob->x,wallx,TD) && DISTOK(ob->y,wally,TD) && DISTOK(ob->z,0,32) ) { index = touchindices[checkx][checky]-1; if (!(tempwall->flags & FL_ON)) { maskobjlist[tilemap[checkx][checky]&0x3ff]->toptexture++; tempwall->flags |= FL_ON; TRIGGER[index] = 1; SD_PlaySoundRTP(SD_TOUCHPLATESND,ob->x,ob->y); if (ob==player) AddMessage("Switch turned on.",MSG_GAME); } else if (tempwall->flags & FL_REVERSIBLE) { maskobjlist[tilemap[checkx][checky]&0x3ff]->toptexture--; tempwall->flags &= ~FL_ON; TRIGGER[index] = 1; SD_PlaySoundRTP(SD_TOUCHPLATESND,ob->x,ob->y); if (ob==player) AddMessage("Switch turned off.",MSG_GAME); } } else if (DISTOK(ob->x,wallx,TD) && DISTOK(ob->y,wally,TD) && !(tempwall->flags & FL_W_INVERTED) ) { index = touchindices[checkx][checky]-1; if (!(tempwall->flags & FL_ON)) { tilemap[checkx][checky]++; tempwall->flags |= FL_ON; TRIGGER[index] = 1; SD_PlaySoundRTP(SD_TOUCHPLATESND,ob->x,ob->y); if (ob==player) AddMessage("Switch turned on.",MSG_GAME); } else if (tempwall->flags & FL_REVERSIBLE) { tilemap[checkx][checky]--; tempwall->flags &= ~FL_ON; TRIGGER[index] = 1; SD_PlaySoundRTP(SD_TOUCHPLATESND,ob->x,ob->y); if (ob==player) AddMessage("Switch turned off.",MSG_GAME); } } } else if ((tempwall) && (tempwall->which == WALL) && (ob==player)){ PlayNoWaySound(); } // else // SD_PlaySoundRTP (SD_NOWAYSND,ob->x,ob->y); // pstate->buttonheld[bt_use] = true; } /* ============================================================================= USER CONTROL ============================================================================= */ //****************************************************************************** // // PollKeyboardButtons // //****************************************************************************** void PollKeyboardButtons (void) { int i; QueueLetterInput (); IN_UpdateKeyboard(); for (i = 0; i < NUMBUTTONS; i++) { if (Keystate[buttonscan[i]]) { buttonpoll[i] = true; } } } //****************************************************************************** // // PollMouseButtons // //****************************************************************************** extern boolean usemouselook; void PollMouseButtons (void) { int i; int buttons; int mask; int press; buttons = IN_GetMouseButtons(); mask = 1; for( i = 0; i < 3; i++, mask <<= 1 ) { press = buttons & mask; if ( press ) {//SetTextMode ( ); // if ( ( buttonmouse[ i ] != bt_nobutton ) && // ( DoubleClickCount[ i ] != 2 ) ) if ( buttonmouse[ i ] != bt_nobutton ) { buttonpoll[ buttonmouse[ i ] ] = true; //bna added if ((i == 1)&&(usemouselook == true)){ //if rightclick set horizon to 512 (normall) playertype * pstate; pstate=&PLAYERSTATE[consoleplayer]; pstate->horizon = 512; // SetNormalHorizon(PLAYER[0]); } //bna added } } // Check double-click if ( buttonmouse[ i + 3 ] != bt_nobutton ) { if ( press ) { // Was the button pressed last tic? if ( !DoubleClickPressed[ i ] ) { // Yes, take note of it DoubleClickPressed[ i ] = true; // Is this the first click, or a really late click? if ( ( DoubleClickCount[ i ] == 0 ) || ( GetTicCount() >= DoubleClickTimer[ i ] ) ) { // Yes, now wait for a second click DoubleClickTimer[ i ] = GetTicCount() + DoubleClickSpeed; //( tics << 5 ); DoubleClickCount[ i ] = 1; } else { // Second click buttonpoll[ buttonmouse[ i + 3 ] ] = true; DoubleClickTimer[ i ] = 0; DoubleClickCount[ i ] = 2; } } else { // After second click, button remains pressed // until user releases it if ( DoubleClickCount[ i ] == 2 ) { buttonpoll[ buttonmouse[ i + 3 ] ] = true; } } } else { if ( DoubleClickCount[ i ] == 2 ) { DoubleClickCount[ i ] = 0; } DoubleClickPressed[ i ] = false; } } } } //****************************************************************************** // // PollJoystickButtons // //****************************************************************************** void PollJoystickButtons ( void ) { int i; int buttons; int mask; int num; int press; buttons = IN_JoyButtons (); if ( joypadenabled ) { num = 4; mask = 1; } else { num = 2; if ( joystickport ) { mask = 4; } else { mask = 1; } } for( i = 0; i < num; i++, mask <<= 1 ) { press = buttons & mask; if ( press ) { // if ( ( buttonjoy[ i ] != bt_nobutton ) && // ( JoyDblClickCount[ i ] != 2 ) ) if ( buttonjoy[ i ] != bt_nobutton ) { buttonpoll[ buttonjoy[ i ] ] = true; } } // Check double-click if ( buttonjoy[ i + 4 ] != bt_nobutton ) { if ( press ) { // Was the button pressed last tic? if ( !JoyDblClickPressed[ i ] ) { // Yes, take note of it JoyDblClickPressed[ i ] = true; // Is this the first click, or a really late click? if ( ( JoyDblClickCount[ i ] == 0 ) || ( GetTicCount() >= JoyDblClickTimer[ i ] ) ) { // Yes, now wait for a second click JoyDblClickTimer[ i ] = GetTicCount() + DoubleClickSpeed; //( tics << 5 ); JoyDblClickCount[ i ] = 1; } else { // Second click buttonpoll[ buttonjoy[ i + 4 ] ] = true; JoyDblClickTimer[ i ] = 0; JoyDblClickCount[ i ] = 2; } } else { // After second click, button remains pressed // until user releases it if ( JoyDblClickCount[ i ] == 2 ) { buttonpoll[ buttonjoy[ i + 4 ] ] = true; } } } else { if ( JoyDblClickCount[ i ] == 2 ) { JoyDblClickCount[ i ] = 0; } JoyDblClickPressed[ i ] = false; } } } } //=========================================================================== //****************************************************************************** // // PollKeyboardMove // //****************************************************************************** void PollKeyboardMove ( void ) { if ( ( buttonpoll[ bt_turnaround ] ) && ( turnaround == 0 ) ) { turnaround = 1; turnaroundtime = 15 + tics; turnheldtime = 0; } if ( turnaround == 0 ) { if ( buttonpoll[ di_east ] ) { turnheldtime+=tics; if (turnheldtime>=TURBOTURNTIME) { KX = -KEYBOARDNORMALTURNAMOUNT; } else { KX = -KEYBOARDPREAMBLETURNAMOUNT; } } else if ( buttonpoll[ di_west ] ) { turnheldtime+=tics; if (turnheldtime>=TURBOTURNTIME) { KX = KEYBOARDNORMALTURNAMOUNT; } else { KX = KEYBOARDPREAMBLETURNAMOUNT; } } else { KX = 0; turnheldtime=0; } if ( (buttonpoll[bt_run]) && ( (turnheldtime>=TURBOTURNTIME) || (turnheldtime==0) ) ) KX = FixedMul(KX,TURBOTURNAMOUNT); } else { KX=TURNAROUNDSPEED; turnaroundtime-=tics; if (turnaroundtime<=0) { turnaround=0; KX=((turnaroundtime*TURNAROUNDSPEED)>>1); } } if ( buttonpoll[ di_north ] ) { KY = -BASEMOVE; } else if ( buttonpoll[ di_south ] ) { KY = BASEMOVE; } else KY = 0; if (buttonpoll[bt_run]) { KY <<= 1; } } //****************************************************************************** // // PollMouseMove // //****************************************************************************** //#define MOUSE_RY_SHIFT 12 //#define MOUSE_TZ_SHIFT 3 #define MOUSE_TZ_SENSITIVITY_SCALE 65535 #define MOUSE_RY_SENSITIVITY_SCALE 18725*2 //#define MOUSE_RY_INPUT_SCALE 6000 #define MOUSE_TZ_INPUT_SCALE 20 int mouse_ry_input_scale = 5000; int sensitivity_scalar[15] = { 0,1,2,3,4,5,6,8,11,13,15,18,12,13,14 }; //#define MOUSE_RY_SCALE 65535 //#define MOUSE_TZ_SCALE 65535 #define MAXMOUSETURN 7000000 /* use SDL mouse */ #define USESDLMOUSE 1 extern int inverse_mouse; double Y_MouseSpeed=70; void PollMouseMove (void) { int mousexmove, mouseymove; double Ys; //SetTextMode(); Ys=(Y_MouseSpeed/100); // // const long inverse_mouse = 1; //set to -1 to invert mouse // inverse_mouse def moved to RT_CFG.C #ifdef USESDLMOUSE INL_GetMouseDelta(&mousexmove, &mouseymove); #else PollMouse();//Uses DirectInput mouse in DInput.cpp mousexmove=MX; mouseymove=MY; #endif if (abs(mousexmove)>abs(mouseymove)) mouseymove/=2; else mousexmove/=2; MX = 0; MY = 0; if ((abs (mouseymove)) >= threshold) {// MY = MOUSE_TZ_INPUT_SCALE*mouseymove; MY *= inverse_mouse; if (usemouselook == true){ if (MY > 0){ playertype * pstate; pstate=&PLAYERSTATE[consoleplayer]; //if (pstate->horizon > 512){ pstate->horizon -= Ys * (2*sensitivity_scalar[mouseadjustment]); //} } else if (MY < 0){ playertype * pstate; pstate=&PLAYERSTATE[consoleplayer]; //SetTextMode ( ); pstate->horizon += Ys * (2*sensitivity_scalar[mouseadjustment]); //buttonpoll[ bt_horizonup ] = true; } MY = 0; }else{ // MY += FixedMul(MY,mouseadjustment*MOUSE_TZ_SENSITIVITY_SCALE); if (abs(mouseymove)>200) { buttonpoll[bt_run]=true; // buttonpoll[ bt_lookup ] = true; } } } if ((abs (mousexmove)) >= threshold) { //MX = -MOUSE_RY_INPUT_SCALE*mousexmove; MX = -mouse_ry_input_scale*mousexmove; MX += FixedMul(MX,sensitivity_scalar[mouseadjustment]*MOUSE_RY_SENSITIVITY_SCALE); // if (abs(MX) > MAXMOUSETURN) // MX = MAXMOUSETURN*SGN(MX); if (usemouselook == true){ if (abs(mouseymove)>10) { buttonpoll[bt_run]=true; //buttonpoll[ bt_lookdown ] = true; } } } // if (MY > 0) // MX -= (MX/2); // MX=0; // MY=0; } //****************************************************************************** // // PollJoystickMove // //****************************************************************************** void PollJoystickMove (void) { int joyx,joyy; INL_GetJoyDelta (joystickport, &joyx, &joyy); if ( joypadenabled ) { if (joyx >= threshold) { buttonpoll[ di_east ] = true; } if (-joyx >= threshold) { buttonpoll[ di_west ] = true; } if ( joyy >= threshold ) { buttonpoll[ di_south ] = true; } if ( -joyy >= threshold ) { buttonpoll[ di_north ] = true; } } else { if ((abs (joyx)) >= threshold) { JX = ((-joyx)<<13)+((-joyx)<<11); turnheldtime += tics; } else JX = 0; if ((abs (joyy)) >= threshold) { JY = joyy<<4; } else JY = 0; if (buttonpoll[bt_run]) { JX <<= 1; JY <<= 1; } } } //****************************************************************************** // // StartVRFeedback // //****************************************************************************** void StartVRFeedback (int guntype) { STUB_FUNCTION; } //****************************************************************************** // // StopVRFeedback // //****************************************************************************** void StopVRFeedback (void) { STUB_FUNCTION; } //****************************************************************************** // // PollVirtualReality // //****************************************************************************** #define VR_BUTTON(x) ((vr_buttons>>x) & 1) void PollVirtualReality (void) { STUB_FUNCTION; } //****************************************************************************** // // PollMove () // //****************************************************************************** boolean aimbuttonpressed=false; void PollMove (void) { int angle; int x, y; x = KX + MX + JX + CX + VX; y = KY + MY + JY + CY + VY; if (buttonpoll[bt_aimbutton]) { if (y>0) { buttonpoll[bt_horizonup]=1; y=0; aimbuttonpressed=true; } else if (y<0) { buttonpoll[bt_horizondown]=1; y=0; aimbuttonpressed=true; } else if (aimbuttonpressed==false) { buttonpoll[bt_lookup]=1; buttonpoll[bt_lookdown]=1; } } else { aimbuttonpressed=false; } if (player->flags & FL_FLEET) y += y>>1; if ((locplayerstate->NETCAPTURED == 1) && (!locplayerstate->HASKNIFE)) { if (first) { nettics = GetTicCount() + (VBLCOUNTER * 4); first = 0; } if (x > 0) { rightmom += NETMOM; if (lastmom!=0) controlbuf[2]=x<<1; lastmom=0; } else if (x < 0) { leftmom += NETMOM; if (lastmom!=1) controlbuf[2]=x<<1; lastmom=1; } else { rightmom -= (NETMOM >> 2); if (rightmom < 0) rightmom = 0; leftmom -= (NETMOM >> 2); if (leftmom < 0) leftmom = 0; } if ((GetTicCount() > nettics) && (rightmom > (NETMOM * 2)) && (leftmom > (NETMOM * 2))) { rightmom = 0; leftmom = 0; first = 1; lastmom^=1; locplayerstate->NETCAPTURED = 0; MISCVARS->NET_IN_FLIGHT = false; NewState(player, &s_player); locplayerstate->weaponuptics = WEAPONS[locplayerstate->weapon].screenheight/GMOVE; locplayerstate->weaponheight = locplayerstate->weaponuptics*GMOVE ; } } else if ((buttonpoll[bt_strafe]) && (turnaround==0)) { // strafing if (x < 0) { angle = (player->angle - FINEANGLES/4)&(FINEANGLES-1); x = (x>>10) + (x >> 11); controlbuf[0] = -(FixedMul (x, costable[angle])); controlbuf[1] = FixedMul (x, sintable[angle]); } else if (x > 0) { angle = (player->angle + FINEANGLES/4)&(FINEANGLES-1); x = (x>>10) + (x >> 11); controlbuf[0] = FixedMul (x, costable[angle]); controlbuf[1] = -(FixedMul (x, sintable[angle])); } if (y != 0) { controlbuf[0] += -(FixedMul (y, viewcos)); controlbuf[1] += (FixedMul (y, viewsin)); } } else { if (y != 0) { controlbuf[0] = -FixedMul (y, viewcos); controlbuf[1] = FixedMul (y, viewsin); } if (x != 0) controlbuf[2] = x; } if (buttonpoll[bt_strafeleft]) { angle = (player->angle - FINEANGLES/4)&(FINEANGLES-1); controlbuf[0] += -(FixedMul (STRAFEAMOUNT, costable[angle])); controlbuf[1] += FixedMul (STRAFEAMOUNT, sintable[angle]); } else if (buttonpoll[bt_straferight]) { angle = (player->angle + FINEANGLES/4)&(FINEANGLES-1); controlbuf[0] += -(FixedMul (STRAFEAMOUNT, costable[angle])); controlbuf[1] += FixedMul (STRAFEAMOUNT, sintable[angle]); } } //****************************************************************************** // // PollControls // // Gets user or demo input, call once each frame // // controlx set between -100 and 100 per tic // controly // //****************************************************************************** void PollControls (void) { int i; if (standalone==true) return; lastpolltime=controlupdatetime; memset (buttonpoll, 0, sizeof(buttonpoll)); controlbuf[0] = controlbuf[1] = controlbuf[2] = 0; CYBERLOOKUP = CYBERLOOKDOWN = false; if (gamestate.autorun==1) buttonpoll[bt_run] = true; // // get button states // PollKeyboardButtons (); if (mouseenabled) PollMouseButtons (); if (joystickenabled) PollJoystickButtons (); // // get movements // if (joystickenabled) PollJoystickMove (); else if (mouseenabled && MousePresent) PollMouseMove (); PollKeyboardMove (); if (vrenabled) PollVirtualReality (); PollMove (); buttonbits = 0; if (player->flags & FL_DYING) // Player has died { if ((playerdead==true) && ( buttonpoll[ bt_strafe ] || buttonpoll[ bt_attack ] || buttonpoll[ bt_use ] || ((gamestate.battlemode == battle_Hunter) && (BATTLE_Team[player->dirchoosetime] == BATTLE_It) ) ) ) { AddRespawnCommand(); } memset (buttonpoll, 0, sizeof(buttonpoll)); controlbuf[0] = controlbuf[1] = controlbuf[2] = 0; } if ((PausePressed==true) && (modemgame==false)) { PausePressed=false; if (GamePaused==true) AddPauseStateCommand(COM_UNPAUSE); else { AddPauseStateCommand(COM_PAUSE); } } if (Keyboard[sc_Insert] && Keyboard[sc_X]){ AddExitCommand(); } //bna section if (Keyboard[sc_5]){ // SetTextMode ( ); weaponscale += 1000; //testval++; } if (Keyboard[sc_6]){ // SetTextMode ( ); weaponscale -= 1000; // testval--; } //bna section end for (i = (NUMTXBUTTONS-1); i >= 0; i--) { buttonbits <<= 1; if (buttonpoll[i]) buttonbits |= 1; } UpdateClientControls(); } void ResetWeapons(objtype *ob) {playertype *pstate; M_LINKSTATE(ob,pstate); pstate->weapondowntics = WEAPONS[pstate->weapon].screenheight/GMOVE; pstate->new_weapon = pstate->oldweapon; pstate->missileweapon = pstate->oldmissileweapon; ob->shapeoffset = pstate->oldshapeoffset; pstate->attackframe = pstate->weaponframe = 0; if ((ob==player) && SHOW_BOTTOM_STATUS_BAR() ) DrawBarAmmo (false); } void SaveWeapons(objtype*ob) {playertype *pstate; if ((ob->flags&FL_DOGMODE) || (ob->flags&FL_GODMODE)) return; //pstate = (ob==player)?(&playerstate):(&remoteplayerstate); M_LINKSTATE(ob,pstate); pstate->weapondowntics = WEAPONS[pstate->weapon].screenheight/GMOVE; pstate->oldweapon = pstate->new_weapon; pstate->oldmissileweapon = pstate->missileweapon; pstate->oldshapeoffset = ob->shapeoffset; } /* void SaveWeapons(objtype*ob) {playertype *pstate; if ((ob->flags&FL_DOGMODE) || (ob->flags&FL_GODMODE)) return; //pstate = (ob==player)?(&playerstate):(&remoteplayerstate); M_LINKSTATE(ob,pstate); pstate->weapondowntics = WEAPONS[pstate->weapon].screenheight/GMOVE; pstate->oldweapon = pstate->weapon; pstate->oldmissileweapon = pstate->missileweapon; pstate->oldshapeoffset = ob->shapeoffset; } */ #define GiveProtection(flag,time,sound) \ { \ if ((ob->flags & flag) || (ob->flags & FL_GODMODE) || \ (ob->flags & FL_DOGMODE)) \ return; \ ob->flags &= ~(FL_BPV|FL_GASMASK|FL_AV); \ ob->flags |= flag; \ SD_PlaySoundRTP(sound,ob->x, ob->y); \ pstate->protectiontime = time; \ gamestate.supercount ++; \ } boolean GivePowerup(objtype *ob,int flag,int time,int sound) { playertype *pstate; if ((ob->flags & flag) || (ob->flags & FL_GODMODE) || (ob->flags & FL_DOGMODE) ) return false; M_LINKSTATE(ob,pstate); /* if (ob->flags & FL_DOGMODE) { ob->temp2 = DOGMODERISE; ResetWeapons(ob); if (ob->state->condition & SF_DOGSTATE) NewState(ob,&s_player); } else if (ob->flags & FL_GODMODE) { ob->temp2 = GODMODEFALL; ResetWeapons(ob); } */ ob->flags &= ~(FL_SHROOMS|FL_FLEET|FL_ELASTO|FL_GODMODE|FL_DOGMODE); ob->flags |= flag; pstate->poweruptime = time; pstate->soundtime = 0; SD_PlaySoundRTP(sound,ob->x, ob->y); gamestate.supercount ++; return true; } void GiveLifePoints(objtype *ob,int points) { SD_PlaySoundRTP(SD_GETBONUSSND,ob->x, ob->y); UpdateTriads (ob,points); if (ob==player) DrawTriads (false); } boolean GiveBulletWeapon(objtype *ob,int bulletweapon,statobj_t*check) { playertype *pstate; M_LINKSTATE(ob,pstate); if ((ob->flags & FL_DOGMODE) || (ob->flags & FL_GODMODE)) return false; if (!ARMED(ob->dirchoosetime)) return false; if (pstate->HASBULLETWEAPON[bulletweapon]) return false; GiveWeapon(ob,bulletweapon); if ( gamestate.BattleOptions.WeaponPersistence ) { LASTSTAT->z = check->z; } SD_PlaySoundRTP(SD_GETWEAPONSND,ob->x, ob->y); return true; } boolean GivePlayerMissileWeapon(objtype *ob, playertype *pstate, statobj_t *check) { if ((ob->flags & FL_DOGMODE) || (ob->flags & FL_GODMODE)) return false; if (!ARMED(ob->dirchoosetime)) return false; if ((GetWeaponForItem(check->itemnumber) == pstate->missileweapon) && (check->ammo == stats[check->itemnumber].ammo) && (pstate->ammo == stats[check->itemnumber].ammo) ) return false; SD_PlaySoundRTP(SD_GETWEAPONSND,ob->x, ob->y); GiveMissileWeapon(ob,GetWeaponForItem(check->itemnumber)); if (gamestate.BattleOptions.WeaponPersistence) LASTSTAT->z = check->z; gamestate.missilecount ++; if (BATTLEMODE && (gamestate.BattleOptions.Ammo != bo_normal_shots)) {if (gamestate.BattleOptions.Ammo == bo_one_shot) pstate->ammo = 1; else pstate->ammo = -1; } else pstate->ammo = check->ammo; if ((ob==player) && SHOW_BOTTOM_STATUS_BAR() ) DrawBarAmmo (false); return true; } #define LocalBonusMessage(string) \ { \ if (ob == player) \ AddMessage(string,MSG_BONUS); \ } #define LocalBonus1Message(string) \ { \ if (ob == player) \ AddMessage(string,MSG_BONUS1); \ } /* ================================= = = GetBonusTimeForItem = ================================= */ int GetBonusTimeForItem(int itemnumber) { specials *which; if ( BATTLEMODE ) { which = &gamestate.SpecialsTimes; } else { which = &CurrentSpecialsTimes; } switch(itemnumber) { case stat_godmode: return which->GodModeTime; case stat_dogmode: return which->DogModeTime; case stat_mushroom: return which->ShroomsModeTime; case stat_elastic: return which->ElastoModeTime; case stat_asbesto: return which->AsbestosVestTime; case stat_bulletproof: return which->BulletProofVestTime; case stat_gasmask: return which->GasMaskTime; case stat_fleetfeet: return which->MercuryModeTime; } return -1; } /* ================================= = = GetRespawnTimeForItem = ================================= */ int GetRespawnTimeForItem(int itemnumber) { switch(itemnumber) { case stat_godmode: return gamestate.SpecialsTimes.GodModeRespawnTime; case stat_dogmode: return gamestate.SpecialsTimes.DogModeRespawnTime; case stat_mushroom: return gamestate.SpecialsTimes.ShroomsModeRespawnTime; case stat_elastic: return gamestate.SpecialsTimes.ElastoModeRespawnTime; case stat_asbesto: return gamestate.SpecialsTimes.AsbestosVestRespawnTime; case stat_bulletproof: return gamestate.SpecialsTimes.BulletProofVestRespawnTime; case stat_gasmask: return gamestate.SpecialsTimes.GasMaskRespawnTime; case stat_fleetfeet: return gamestate.SpecialsTimes.MercuryModeRespawnTime; } return gamestate.BattleOptions.RespawnTime * VBLCOUNTER; } /* =================== = = GetBonus = =================== */ void GetBonus (objtype*ob,statobj_t *check) { int heal; playertype * pstate; boolean randompowerup; M_LINKSTATE(ob,pstate); randompowerup=false; randomlabel: switch (check->itemnumber) { case stat_knifestatue: SD_PlaySoundRTP(SD_GETKNIFESND,ob->x, ob->y); if (ob==player) locplayerstate->HASKNIFE = 1; SD_PlaySoundRTP(PlayerSnds[locplayerstate->player], ob->x, ob->y); LocalBonusMessage("You found a knife."); break; case stat_pedgoldkey: LocalBonusMessage("You found the \\EGold key."); goto keys; case stat_pedsilverkey: LocalBonusMessage("You got the \\FSilver key."); goto keys; case stat_pedironkey: LocalBonusMessage("You got the \\8Iron key."); goto keys; case stat_pedcrystalkey: LocalBonusMessage("You got the \\4Oscuro key."); keys: GiveKey (check->itemnumber - stat_pedgoldkey); SD_PlaySoundRTP (SD_GETKEYSND,ob->x, ob->y); break; case stat_monkmeal: if (pstate->health == MaxHitpointsForCharacter(pstate)) return; SD_PlaySoundRTP (SD_GETHEALTH1SND,ob->x, ob->y); LocalBonusMessage("You ate some Monk Meal."); HealPlayer (10,ob); gamestate.healthcount ++; break; case stat_monkcrystal1: if (pstate->health == MaxHitpointsForCharacter(pstate)) return; SD_PlaySoundRTP (SD_GETHEALTH2SND,ob->x, ob->y); LocalBonusMessage("You picked up a small Monk Crystal."); HealPlayer (10,ob); gamestate.healthcount ++; break; case stat_monkcrystal2: if (pstate->health == MaxHitpointsForCharacter(pstate)) return; SD_PlaySoundRTP (SD_GETHEALTH2SND,ob->x, ob->y); LocalBonusMessage("You picked up a large Monk Crystal."); HealPlayer (50,ob); gamestate.healthcount ++; break; case stat_priestporridge: if (pstate->health == MaxHitpointsForCharacter(pstate)) return; SD_PlaySoundRTP (SD_GETHEALTH1SND,ob->x, ob->y); if (check->flags & FL_ACTIVE) { HealPlayer (50,ob); LocalBonusMessage("You ate some Priest Porridge Hot."); } else { HealPlayer (20,ob); LocalBonusMessage("You ate some Priest Porridge."); } gamestate.healthcount ++; break; case stat_healingbasin: if (pstate->health == MaxHitpointsForCharacter(pstate)) return; SD_PlaySoundRTP (SD_GETHEALTH2SND,ob->x, ob->y); heal = 25 + (GameRandomNumber("GetBonus",0) >> 2); HealPlayer (heal,ob); LocalBonusMessage("You drank from the healing basin."); gamestate.healthcount ++; gamestate.democraticcount ++; break; case stat_oneup: if (abs(pstate->health - MaxHitpointsForCharacter(pstate)) < (MaxHitpointsForCharacter(pstate)>>2) ) { GiveLives(1); LocalBonusMessage("Extra Life!"); } else { HealPlayer(MaxHitpointsForCharacter(pstate),ob); LocalBonusMessage("Full Health!"); } SD_PlaySoundRTP(SD_GET1UPSND,ob->x, ob->y); break; case stat_threeup: if (abs(pstate->health - MaxHitpointsForCharacter(pstate)) < (MaxHitpointsForCharacter(pstate)>>2) ) { GiveLives(3); LocalBonusMessage("Three Extra Lives!"); } else { HealPlayer(MaxHitpointsForCharacter(pstate),ob); GiveLives(2); LocalBonusMessage("Full Health AND Two Extra Lives!"); } SD_PlaySoundRTP(SD_GET3UPSND,ob->x, ob->y); break; case stat_scotthead: // Give Apogee's phone number as points GivePoints( 2764331 ); LocalBonusMessage( "Whoa...Scott's Mystical Head!"); LocalBonus1Message( "You get 2,764,331 points!"); SD_PlaySoundRTP(SD_GETHEADSND,ob->x, ob->y); break; case stat_twopistol: if (GiveBulletWeapon(ob,wp_twopistol,check)==false) return; LocalBonusMessage("You got an extra pistol."); break; case stat_mp40: if (GiveBulletWeapon(ob,wp_mp40,check)==false) return; LocalBonusMessage("You picked up an MP40."); break; case stat_bazooka: if (GivePlayerMissileWeapon(ob,pstate,check)==false) return; LocalBonusMessage("You bagged a bazooka!"); break; case stat_firebomb: if (GivePlayerMissileWeapon(ob,pstate,check)==false) return; LocalBonusMessage("You found a Firebomb!"); break; case stat_heatseeker: if (GivePlayerMissileWeapon(ob,pstate,check)==false) return; LocalBonusMessage("You have a Heat-seeker!"); break; case stat_drunkmissile: if (GivePlayerMissileWeapon(ob,pstate,check)==false) return; LocalBonusMessage("You recovered a Drunk Missile!"); break; case stat_firewall: if (GivePlayerMissileWeapon(ob,pstate,check)==false) return; LocalBonusMessage("You filched a FlameWall!"); break; case stat_splitmissile: if (GivePlayerMissileWeapon(ob,pstate,check)==false) return; LocalBonusMessage("You snagged a Split Missile!"); break; case stat_kes: if (GivePlayerMissileWeapon(ob,pstate,check)==false) return; LocalBonusMessage("You wield the Dark Staff!"); break; case stat_bat: if (GivePlayerMissileWeapon(ob,pstate,check)==false) return; LocalBonusMessage("You picked up the Excalibat."); break; case stat_lifeitem1: GiveLifePoints(ob,1); if (timelimitenabled) timelimit+=(VBLCOUNTER); break; case stat_lifeitem2: GiveLifePoints(ob,5); if (timelimitenabled) timelimit+=(2*VBLCOUNTER); break; case stat_lifeitem3: GiveLifePoints(ob,10); if (timelimitenabled) timelimit+=(5*VBLCOUNTER); break; case stat_lifeitem4: GiveLifePoints(ob,25); if (timelimitenabled) timelimit+=(10*VBLCOUNTER); break; case stat_random: switch (GameRandomNumber("GetBonus",0)>>6) { case 0: check->itemnumber=stat_godmode; break; case 1: check->itemnumber=stat_elastic; break; case 2: check->itemnumber=stat_dogmode; break; case 3: check->itemnumber=stat_mushroom; break; } randompowerup=true; LocalBonus1Message("Random powerup gives you . . ."); goto randomlabel; break; case stat_bulletproof: GiveProtection(FL_BPV, GetBonusTimeForItem(stat_bulletproof), SD_GETBVESTSND); LocalBonusMessage("Bulletproof Armor!"); goto drw; case stat_gasmask: GiveProtection(FL_GASMASK, GetBonusTimeForItem(stat_gasmask), SD_GETMASKSND); LocalBonusMessage("You put on a Gas Mask."); goto drw; case stat_asbesto: GiveProtection(FL_AV,GetBonusTimeForItem(stat_asbesto), SD_GETAVESTSND); LocalBonusMessage("Asbestos Armor! Oh so itchy!"); goto drw; case stat_elastic: if (GivePowerup(ob,FL_ELASTO,GetBonusTimeForItem(stat_elastic), SD_GETELASTSND) == false) return; LocalBonusMessage("Elasto Mode!"); ob->flags |= FL_NOFRICTION; goto drw; case stat_fleetfeet: if (GivePowerup(ob,FL_FLEET,GetBonusTimeForItem(stat_fleetfeet), SD_GETFLEETSND) == false) return; LocalBonus1Message("Mercury Mode!"); LocalBonusMessage("Press Look Up and Down to fly."); ob->flags &= ~FL_NOFRICTION; goto drw; case stat_mushroom: if (GivePowerup(ob,FL_SHROOMS,GetBonusTimeForItem(stat_mushroom), SD_GETSHROOMSSND) == false) return; LocalBonusMessage("Shrooms Mode!"); ob->flags &= ~FL_NOFRICTION; gamestate.democraticcount ++; goto drw; case stat_godmode: if (ob->flags & FL_GODMODE) return; if (!ARMED(ob->dirchoosetime)) return; ob->flags &= ~FL_NOFRICTION; if (ob->flags & FL_DOGMODE) { ob->temp2 = DOGMODERISE; ResetWeapons(ob); if (ob->state->condition & SF_DOGSTATE) NewState(ob,&s_player); } SaveWeapons(ob); SpawnNewObj(ob->tilex,ob->tiley,&s_flash1,inertobj); new->flags |= FL_ABP; new->x = new->drawx = ob->x; new->y = new->drawy = ob->y; MakeActive(new); new->z = ob->z; SetPlayerHorizon(pstate,GODYZANGLE); ob->flags &= ~(FL_GODMODE|FL_SHROOMS|FL_ELASTO|FL_FLEET|FL_DOGMODE); ob->flags |= FL_GODMODE; ob->temp2 = GODMODERISE; pstate->poweruptime = GetBonusTimeForItem(stat_godmode); pstate->soundtime = 0; GiveMissileWeapon(ob,wp_godhand); SD_PlaySoundRTP(SD_GETGODSND,ob->x, ob->y); gamestate.supercount ++; LocalBonusMessage("God Mode!"); goto drw; #if (SHAREWARE == 0) case stat_dogmode: if (ob->flags & FL_DOGMODE) return; if (!ARMED(ob->dirchoosetime)) return; ob->flags &= ~FL_NOFRICTION; if (ob->flags & FL_GODMODE) { ob->temp2 = GODMODEFALL; ResetWeapons(ob); } SaveWeapons(ob); ob->shapeoffset = 0; NewState(ob,&s_serialdog); SpawnNewObj(ob->tilex,ob->tiley,&s_flash1,inertobj); new->flags |= FL_ABP; new->x = new->drawx = ob->x; new->y = new->drawy = ob->y; MakeActive(new); new->z = ob->z; SetPlayerHorizon(pstate,DOGYZANGLE); ob->flags &= ~(FL_DOGMODE|FL_SHROOMS|FL_ELASTO|FL_FLEET|FL_GODMODE); ob->flags |= FL_DOGMODE; ob->temp2 = DOGMODEFALL; pstate->poweruptime = GetBonusTimeForItem(stat_dogmode); pstate->soundtime = 0; GiveMissileWeapon(ob,wp_dog); SD_PlaySoundRTP(SD_GETDOGSND,ob->x, ob->y); gamestate.supercount ++; LocalBonusMessage("Dog Mode!"); goto drw; #endif drw: if (ob==player) GM_DrawBonus (check->itemnumber); break; case stat_dipball1: case stat_dipball2: case stat_dipball3: SD_PlaySoundRTP(SD_GETBONUSSND,ob->x, ob->y); gamestate.dipballs++; LocalBonusMessage("You discovered a Developer Ball!"); break; case stat_collector: if (gamestate.battlemode==battle_CaptureTheTriad) {if (pstate->team == check->hitpoints) return; ob->flags |= FL_DESIGNATED; UpdateKills = true; LocalBonusMessage( "You picked up a triad! RUN!!!"); } else BATTLE_CheckGameStatus(battle_get_collector_item,ob->dirchoosetime); SD_PlaySoundRTP(SD_GETBONUSSND,ob->x, ob->y); break; #if (SHAREWARE == 0) case stat_mine: SpawnNewObj(check->tilex,check->tiley,&s_grexplosion1,inertobj); new->flags |= FL_ABP; new->whatever = check; new->temp2 = 100; MakeActive(new); SD_PlaySoundRTP(SD_EXPLODESND,check->x,check->y); break; #endif default: SD_PlaySoundRTP(SD_GETHEADSND,ob->x, ob->y); break; } //StartBonusFlash (); if (check->flags & FL_CHANGES) { switch (check->itemnumber) { case stat_pedgoldkey: case stat_pedsilverkey: case stat_pedironkey: case stat_pedcrystalkey: check->itemnumber = stat_emptypedestal; check->shapenum = stats[stat_emptypedestal].picnum; check->flags = stats[stat_emptypedestal].flags|FL_ABP; check->count = 0; check->numanims = 0; break; case stat_healingbasin: check->itemnumber = stat_emptybasin; check->shapenum = stats[stat_emptybasin].picnum; check->flags = stats[stat_emptybasin].flags|FL_ABP; check->count = 0; check->numanims = 0; break; /* case stat_tablebullets: check->itemnumber = stat_emptytable; check->shapenum = stats[stat_emptytable].picnum; check->flags = stats[stat_emptytable].flags|FL_ABP; break; case stat_statuewithpole: check->itemnumber = stat_armornopole; check->shapenum = stats[stat_armornopole].picnum; check->flags = stats[stat_armornopole].flags|FL_ABP; break; */ case stat_pit: check->shapenum ++; check->flags &= ~FL_CHANGES; check->flags &= ~FL_BONUS; break; case stat_knifestatue: check->itemnumber = stat_emptystatue; check->shapenum = stats[stat_emptystatue].picnum; check->flags = stats[stat_emptystatue].flags|FL_ABP; break; default: ; } } else {if (check == sprites[check->tilex][check->tiley]) { statobj_t *checkstat; checkstat = (statobj_t*)DiskAt(check->tilex,check->tiley); if (checkstat && (checkstat->which == SPRITE)) sprites[check->tilex][check->tiley] = checkstat; else sprites[check->tilex][check->tiley] = NULL; } if (randompowerup==true) check->itemnumber = stat_random; RemoveStatic(check); } } /* =================== = = DropWeapon = =================== */ void DropWeapon(objtype *ob) {playertype *pstate; int dtilex,dtiley; M_LINKSTATE(ob,pstate); if ((pstate->missileweapon == -1) || (pstate->missileweapon == wp_godhand) #if (SHAREWARE == 0) || (pstate->missileweapon == wp_dog) #endif ) return; pstate->weapondowntics = WEAPONS[pstate->weapon].screenheight/3; pstate->new_weapon = pstate->bulletweapon; dtilex = ob->tilex; dtiley = ob->tiley; FindEmptyTile(&dtilex, &dtiley); SpawnStatic(dtilex,dtiley,GetItemForWeapon(pstate->missileweapon),9); gamestate.missiletotal ++; LASTSTAT->ammo = pstate->ammo; LASTSTAT->flags |= FL_ABP; LASTSTAT->flags &= ~FL_RESPAWN; MakeStatActive(LASTSTAT); pstate->weaponx = ob->tilex; pstate->weapony = ob->tiley; pstate->ammo = -1; pstate->missileweapon = -1; if ((ob==player) && SHOW_BOTTOM_STATUS_BAR() ) DrawBarAmmo (false); } /* =================== = = Thrust = =================== */ void Thrust ( objtype * ob ) {statobj_t *tstat; int dx,dy,dz,rad,index,otherteam; objtype*temp; playertype * pstate; PlayerMove(ob); M_LINKSTATE(ob,pstate); if ((gamestate.battlemode == battle_CaptureTheTriad) && (ob->flags & FL_DESIGNATED) && (ob->tilex == TEAM[pstate->team].tilex) && (ob->tiley == TEAM[pstate->team].tiley)) {if (ob == player) SD_Play(PlayerSnds[locplayerstate->player]); if (BATTLE_CheckGameStatus(battle_captured_triad,ob->dirchoosetime)== battle_no_event) { ob->flags &= ~FL_DESIGNATED; UpdateKills = true; otherteam = (pstate->team ^ 1); SpawnStatic(TEAM[otherteam].tilex,TEAM[otherteam].tiley,stat_collector,9); LASTSTAT->flags |= FL_COLORED; LASTSTAT->hitpoints = otherteam; LASTSTAT->flags |= FL_ABP; MakeStatActive(LASTSTAT); } return; } if ((ob->tilex != pstate->weaponx) || (ob->tiley != pstate->weapony)) pstate->weaponx = pstate->weapony = 0; index = touchindices[ob->tilex][ob->tiley]; if (index && (abs(ob->z - nominalheight) < 5)) {if (!TRIGGER[index-1]){ #if (BNACRASHPREVENT == 1) if (touchplate[index-1] != 0) { // CRASH IN SHAREWARE 'ride em cowboy' BNA FIX //SetTextMode ( ); qwert // DONT ALLOW BAD touchplate ( == 0 ) see rt_door.c #endif if (touchplate[index-1]->complete) SD_PlaySoundRTP(SD_BADTOUCHSND,ob->x,ob->y); else { SD_PlaySoundRTP(SD_TOUCHPLATESND,ob->x,ob->y); if (ob == player) AddMessage("Touchplate triggered.",MSG_GAME); } #if (BNACRASHPREVENT == 1) }else{SD_PlaySoundRTP(SD_BADTOUCHSND,ob->x,ob->y);} // CRASH IN SHAREWARE 'ride em cowboy' BNA FIX #endif } TRIGGER[index-1] = 1; } tstat = sprites[ob->tilex][ob->tiley]; if (tstat) {dx = abs(ob->x - tstat->x); dy = abs(ob->y - tstat->y); dz = abs(ob->z - tstat->z); if ((dx < 0x8000) && (dy < 0x8000) && (dz<=35)) { #define OBJECT_IS_BONUS( tstat ) ( ( tstat )->flags & FL_BONUS ) #define PLAYER_IS_SWITCHING_WEAPONS( pstate ) ( W_CHANGE( pstate ) ) //#define IS_ATTACKING( ob ) ( ( ( ob )->state->think == T_Attack ) || ( ( ob )->state->think == T_BatBlast ) ) #define IS_WEAPON( tstat ) ( ( tstat )->flags & FL_WEAPON ) #define PLAYER_MAY_NOT_GET_WEAPON( pstate, ob ) ( PLAYER_IS_SWITCHING_WEAPONS( pstate ))// || IS_ATTACKING( ob ) ) #define OK_TO_PICK_UP( tstat, pstate, ob ) ( !( IS_WEAPON( tstat ) && PLAYER_MAY_NOT_GET_WEAPON( pstate, ob ) ) ) #define WHERE_PLAYER_DROPPED_WEAPON( ob, pstate ) ( ( ( ob )->tilex == ( pstate )->weaponx ) && ( ( ob )->tiley == ( pstate )->weapony ) ) if ( OBJECT_IS_BONUS( tstat ) && OK_TO_PICK_UP( tstat, pstate, ob ) && (!WHERE_PLAYER_DROPPED_WEAPON( ob, pstate )) ) { GetBonus(ob,tstat); if (PLAYER_IS_SWITCHING_WEAPONS( pstate )) {statetype *nstate; #if (SHAREWARE == 0) if (ob->state->condition & SF_DOGSTATE) nstate = &s_serialdog; else #endif nstate = &s_player; pstate->attackframe = pstate->weaponframe = pstate->batblast = 0; NewState(ob,nstate); } } else if ((tstat->itemnumber == stat_pit) && (ob->temp2 != PITFALL) && (!(ob->flags & FL_FLEET)) ) {ob->temp2 = PITFALL; ob->momentumx = ob->momentumy = 0; //ob->momentumz = 4; ob->momentumz = GRAVITY; if (ob->whatever == NULL) {ob->whatever = tstat; SD_PlaySoundRTP(SD_PITTRAPSND,ob->x,ob->y); tstat->shapenum = stats[tstat->itemnumber].picnum + 1; MakeStatInactive(tstat); //tstat->flags &= ~FL_ABP; } } else if ((tstat->itemnumber == stat_heatgrate) && (!(ob->flags & FL_DYING)) && (!(ob->flags & FL_AV)) ) {DamageThing(ob,1); Collision(ob,(objtype*)tstat,0,0); M_CheckPlayerKilled(ob); } } } //================ Check special player/actor links ====================== if (ob->whatever) {temp = (objtype*)(ob->whatever); dx = abs(ob->x - temp->x); dy = abs(ob->y - temp->y); dz = abs(ob->z - temp->z); if (ob->flags & FL_RIDING) rad = MINACTORDIST; else rad = 0x8000; if ((dx >rad) || (dy > rad) || (dz > 64)) { if ((temp->obclass == bladeobj) || (temp->obclass == diskobj)) {temp->whatever = NULL; ob->flags &= ~FL_RIDING; } else if (ob->temp2 == COLUMNCRUSH) ob->temp2 = RENORMALIZE; else if (ob->z < nominalheight) ob->momentumz = 40000; else if (temp->which == SPRITE) {tstat = (statobj_t*)(ob->whatever); MakeStatActive(tstat); SetNormalHorizon(ob); } ob->whatever = NULL; } } //========================================================================= if (BATTLEMODE && (MAPSPOT(ob->tilex,ob->tiley,1) == EXITTILE)) { Move_Player_From_Exit_To_Start(ob); return; } if (ob==player) { if (MAPSPOT(ob->tilex,ob->tiley,1) == EXITTILE) playstate=ex_completed; else if ( ( MAPSPOT( ob->tilex, ob->tiley, 2 ) & 0xff00 ) == 0xe400 ) playstate = ex_secretdone; else if (MAPSPOT(ob->tilex,ob->tiley,1) == SECRETEXITTILE) playstate=ex_secretlevel; } } void Move_Player_From_Exit_To_Start(objtype *ob) { int i = 0,oldarea,newarea; objtype *tplayer; int travelangle,dangle; playertype *pstate; M_LINKSTATE(ob,pstate); oldarea = ob->areanumber; newarea = AREANUMBER(FIRST.x,FIRST.y); if (oldarea != newarea) { RemoveFromArea(ob); ob->areanumber = newarea; MakeLastInArea(ob); } SetTilePosition(ob,FIRST.x,FIRST.y); ob->z = PlatformHeight(ob->tilex,ob->tiley); if ((ob->z == -10) || DiskAt(ob->tilex,ob->tiley)) ob->z = 0; ConnectAreas(); travelangle = atan2_appx(ob->momentumx,ob->momentumy); dangle = ob->angle - travelangle; ob->angle = (1-FIRST.dir)*ANG90 + dangle; Fix(ob->angle); ob->dir = angletodir[ob->angle]; pstate->anglefrac= (ob->angle<angle=0; for(i=0;itilex == FIRST.x) && (tplayer->tiley == FIRST.y) && (!(tplayer->flags & FL_DYING)) ) { playertype *pstate; M_LINKSTATE(tplayer,pstate); pstate->health = tplayer->hitpoints = 0; tplayer->flags |= FL_HBM; Collision(tplayer,ob,0,0); BATTLE_PlayerKilledPlayer(battle_kill_by_crushing,ob->dirchoosetime,tplayer->dirchoosetime);\ } } } void PlayerSlideMove(objtype * ob) {int tryx, tryy, tryz; tryx = ob->x + ob->momentumx; tryy = ob->y + ob->momentumy; tryz = ob->z + (ob->momentumz >> 16); if (ActorTryMove(ob,ob->x,tryy,tryz)) { if (ob->momentumx>HITWALLSPEED) SD_PlaySoundRTP(SD_HITWALLSND,ob->x,ob->y); ob->momentumx=0; } else if (ActorTryMove(ob,tryx,ob->y,tryz)) { if (ob->momentumy>HITWALLSPEED) SD_PlaySoundRTP(SD_HITWALLSND,ob->x,ob->y); ob->momentumy=0; } else { if (FindDistance(ob->momentumx,ob->momentumy)>(HITWALLSPEED*3/2)) SD_PlaySoundRTP(SD_HITWALLSND,ob->x,ob->y); ob->momentumx=0; ob->momentumy=0; } } /* =================== = = SetNormalHorizon = =================== */ void SetNormalHorizon (objtype * ob) { playertype * pstate; M_LINKSTATE(ob,pstate); if (ob->flags&FL_DOGMODE) { SetPlayerHorizon(pstate,DOGYZANGLE); } else if (ob->flags&FL_GODMODE) { SetPlayerHorizon(pstate,GODYZANGLE); } else { SetPlayerHorizon(pstate,NORMALYZANGLE); } } /* =================== = = PlayerTiltHead = =================== */ extern int iG_playerTilt; extern double dTopYZANGLELIMIT; void PlayerTiltHead (objtype * ob) { playertype * pstate; int dyz=0; int yzangle; M_LINKSTATE(ob,pstate); yzangle=ob->yzangle+HORIZONYZOFFSET; Fix(yzangle); if ( (pstate->lastmomz!=ob->momentumz) && (ob->momentumz==0) && ( (!(ob->flags&FL_FLEET)) || ( (ob->flags&FL_FLEET) && (ob->z==nominalheight) ) ) ) SetNormalHorizon(ob); pstate->lastmomz=ob->momentumz; if (ob->flags&FL_SHROOMS) { ob->yzangle = FixedMulShift(SHROOMYZANGLE,sintable[(oldpolltime<<6)&(FINEANGLES-1)],16); Fix(ob->yzangle); return; } else if (pstate->guntarget) { int dx,dy,dz; int xydist; int yzangle; dx = ob->x - pstate->guntarget->x; dy = ob->y - pstate->guntarget->y; xydist = FindDistance(dx,dy)-0x8000; if (ob->z==pstate->guntarget->z) dz = 0; else { dz = (ob->z-pstate->guntarget->z)<<10; } yzangle = atan2_appx(xydist,dz); yzangle += HORIZONYZOFFSET; Fix(yzangle); SetPlayerHorizon(pstate,yzangle-HORIZONYZOFFSET); if (oldpolltime>pstate->targettime) { if (pstate->guntarget) pstate->guntarget->flags &= ~FL_TARGET; pstate->guntarget=NULL; SetNormalHorizon(ob); } } else { if (pstate->buttonstate[bt_horizonup]) { if (yzangle!=pstate->horizon) { SetPlayerHorizon(pstate,yzangle-HORIZONYZOFFSET); } else { SetPlayerHorizon(pstate,(pstate->horizon-HORIZONYZOFFSET+YZHORIZONSPEED)); } } else if (pstate->buttonstate[bt_horizondown]) { if (yzangle!=pstate->horizon) { SetPlayerHorizon(pstate,yzangle-HORIZONYZOFFSET); } else { SetPlayerHorizon(pstate,(pstate->horizon-HORIZONYZOFFSET-YZHORIZONSPEED)); } } if (pstate->buttonstate[bt_lookup] || CYBERLOOKUP) { if (!(ob->flags & FL_FLEET)) { dyz=YZTILTSPEED; if (pstate->buttonstate[bt_lookdown] || CYBERLOOKDOWN) { dyz=0; } SetNormalHorizon(ob); } } if (pstate->buttonstate[bt_lookdown] || CYBERLOOKDOWN) { if (!(ob->flags & FL_FLEET)) { dyz=-YZTILTSPEED; if (pstate->buttonstate[bt_lookup] || CYBERLOOKUP) { dyz=0; } SetNormalHorizon(ob); } } if (!(ob->flags&FL_DOGMODE) && !(ob->flags&FL_GODMODE) && !(ob->flags&FL_FLEET) && !(ob->flags&FL_RIDING) && (ob->momentumz > (GRAVITY<<1))//(ob->momentumz>0x1000) ) { SetPlayerHorizon(pstate,FALLINGYZANGLE); } } if ((yzangle!=pstate->horizon) && (dyz==0)) { int speed; speed=SNAPBACKSPEED; if (yzanglehorizon) yzangle+=speed; else yzangle-=speed; if ((abs(yzangle-pstate->horizon))horizon; } //SetTextMode(); if (yzangle != 512){ FinddTopYZANGLELIMITvalue(ob); } yzangle+=dyz; if (yzangle-HORIZONYZOFFSET>YZANGLELIMIT) yzangle=HORIZONYZOFFSET+YZANGLELIMIT; /* else if (yzangle-HORIZONYZOFFSET<-TopYZANGLELIMIT)//bnafix yzangle=HORIZONYZOFFSET-TopYZANGLELIMIT;//bnafix dTopYZANGLELIMIT*/ else if (yzangle-HORIZONYZOFFSET<-dTopYZANGLELIMIT)//bnafix yzangle=HORIZONYZOFFSET-dTopYZANGLELIMIT;//bnafix ob->yzangle=yzangle-HORIZONYZOFFSET; Fix(ob->yzangle); iG_playerTilt = ob->yzangle; } //---------------------------------------------------------------------- // bna added function // if a player is to close to wall, looking down max //,this func limit the dTopYZANGLELIMIT value when // facing a wall #define SMALLANGLE 90 //there is small angles where didnt work //so we check for them to = 90/2048 = aprox, 15 degrees int FinddTopYZANGLELIMITvalue(objtype *ob) {/* checkx = ob->tilex + 1; checky = ob->tiley + 1; if (actorat[checkx][checky]){ return 0; } return 1; checkx = ob->tilex ; checky = ob->tiley; // find which direction the player is facing //and check if it is a wall */ //use lowest down angle dTopYZANGLELIMIT = (26*FINEANGLES/360); if (ob->angle < 256 || ob->angle > 1792) { if ((tilemap[ob->tilex + 1][ob->tiley])!=0){ return 0; } //ob->dir = east; }else if (ob->angle < 768) { if ((tilemap[ob->tilex][ob->tiley-1])!=0){ return 0; } }else if (ob->angle < 1280) { if ((tilemap[ob->tilex-1][ob->tiley])!=0){ return 0; } }else{ if ((tilemap[ob->tilex][ob->tiley+1])!=0){ return 0; } } //use middle down angle dTopYZANGLELIMIT = (42*FINEANGLES/360); if ((ob->angle > 768-SMALLANGLE)&&(ob->angle <= 768)) { if ((tilemap[ob->tilex -1][ob->tiley])!=0){//ob->tiley-1 return 0; } } if ((ob->angle < 1280+SMALLANGLE)&&(ob->angle >= 1280)) { if ((tilemap[ob->tilex - 1][ob->tiley])!=0){//ob->tiley+1 return 0; } } if ((ob->angle > 256)&&(ob->angle <= 256+SMALLANGLE)) { if ((tilemap[ob->tilex + 1][ob->tiley])!=0){//ob->tiley-1 return 0; } } if ((ob->angle < 1792)&&(ob->angle >= 1792-SMALLANGLE)) { if ((tilemap[ob->tilex + 1][ob->tiley])!=0){//ob->tiley+1 return 0; } } if ((ob->angle < 1280)&&(ob->angle >= 1280-SMALLANGLE)) { if ((tilemap[ob->tilex ][ob->tiley+1])!=0){//ob->tilex-1 return 0; } } if ((ob->angle > 1792)&&(ob->angle <= 1792+SMALLANGLE)) { if ((tilemap[ob->tilex ][ob->tiley+1])!=0){//ob->tiley+1 return 0; } } if ((ob->angle > 768)&&(ob->angle <= 768+SMALLANGLE)) { if ((tilemap[ob->tilex][ob->tiley-1])!=0){//ob->tiley-1 return 0; } } if ((ob->angle < 256)&&(ob->angle >= 256-SMALLANGLE)) { if ((tilemap[ob->tilex][ob->tiley-1])!=0){//ob->tiley-1 return 0; } } //use max down angle dTopYZANGLELIMIT = (90*FINEANGLES/360); return 1; } // bna added function end //---------------------------------------------------------------------- /* =================== = = UpdatePlayers = =================== QWERTYU */ void UpdatePlayers ( void ) { objtype * obj; // playertype * pstate; for (obj = FIRSTACTOR; obj->obclass==playerobj; obj = obj->next) { //ErrorDontQuit("obj->next = ",obj->next); #if (BNACRASHPREVENT == 1)//crashed here when oscuro and larves were all killed if (obj->next == 0){return;} #endif obj->speed=FindDistance(obj->momentumx, obj->momentumy); // M_LINKSTATE(obj,pstate); // pstate->steptime-=obj->speed; // if (pstate->steptime<0) // { // while (pstate->steptime<0) // pstate->steptime+=PLAYERSTEPTIME; // pstate->stepwhich^=1; // SD_PlaySoundRTP(SD_WALK1SND+pstate->stepwhich,obj->x,obj->y); // } } } /* =================== = = PlayerMove = =================== */ void PlayerMove ( objtype * ob ) {playertype *pstate; M_LINKSTATE(ob,pstate); if (ob->flags & FL_FLEET) CheckFlying(ob,pstate); ActorMovement(ob); pstate->anglefrac = (pstate->anglefrac+pstate->angle)&((FINEANGLES<angle = (pstate->anglefrac >> ANGLEBITS); ob->dir = angletodir[ob->angle]; if (ob==player) UpdateLightLevel(player->areanumber); PlayerTiltHead(ob); if (IsWindow(ob->tilex,ob->tiley)) { if (!(ob->flags & FL_DYING)) { pstate->health = 0; pstate->falling=true; if ((ob->flags & FL_GODMODE) || (ob->flags & FL_DOGMODE) || (gamestate.battlemode == battle_Eluder) || (godmode==true)) { KillActor(ob); NewState(ob,&s_remotedie1); } else Collision(ob,(objtype*)NULL,0,0); ob->flags |= FL_DYING; M_CheckPlayerKilled(ob); } } } /* =============== = = T_Tag = =============== */ void T_Tag (objtype *ob) { playertype *pstate; CheckPlayerSpecials(ob); //CheckWeaponStates(ob); M_LINKSTATE(ob,pstate); Thrust(ob); if (ob->ticcount > 4) pstate->weaponheight -= GMOVE; else pstate->weaponheight += GMOVE; if ((ob->ticcount > 1) && (ob->ticcount < 8) && (!(ob->flags & FL_DIDTAG))) {int i,dx,dy,magangle; for(i=0;ix - ob->x); dy = abs(PLAYER[i]->y - ob->y); if ((dx > 0xc000) || (dy > 0xc000)) continue; magangle = abs(ob->angle - AngleBetween(ob,PLAYER[i])); if (magangle > VANG180) magangle = ANGLES - magangle; if (magangle > ANGLES/8) continue; CheckTagGame(ob,PLAYER[i]); break; } } //Commented out until we find if it's valid /* if (!ob->ticcount) {if ( pstate->buttonstate[bt_use] && !pstate->buttonheld[bt_use] ) pstate->buttonstate[bt_use] = false; if ( pstate->buttonstate[bt_attack] && !pstate->buttonheld[bt_attack]) pstate->buttonstate[bt_attack] = false; } */ } #if (SHAREWARE == 0) #define GET_RESETSTATE(ob,resetstate) \ { \ if (ob->state->condition & SF_DOGSTATE) \ resetstate = &s_serialdog; \ else \ resetstate = &s_player; \ } #else #define GET_RESETSTATE(ob,resetstate) \ { \ resetstate = &s_player; \ } #endif /* =============== = = T_Attack = =============== */ void T_Attack (objtype *ob) { attack_t *cur; playertype *pstate; statetype *resetstate; Thrust(ob); if (ob->flags & FL_DYING) return; resetstate = ob->state; CheckPlayerSpecials(ob); if (resetstate != ob->state) { return; } if ((ob->flags & FL_PAIN) && (!ob->ticcount)) ob->flags &= ~FL_PAIN; CheckWeaponStates(ob); M_LINKSTATE(ob,pstate); GET_RESETSTATE(ob,resetstate); if (ARMED(ob->dirchoosetime) //(gamestate.battlemode != battle_Tag) ) { if (pstate->weapondowntics == 1) // change to up; during change, up and down // are never zero at the same time { #if (SHAREWARE == 0) if (pstate->weapon == wp_kes) { pstate->weapondowntics = 0; pstate->weaponuptics = KESTICS/(2*GMOVE); } else #endif { pstate->weapondowntics = 0; pstate->weaponframe = pstate->attackframe = 0; if (pstate->NETCAPTURED == -1) { pstate->weaponuptics = FREE.screenheight/GMOVE; pstate->weaponheight = pstate->weaponuptics*GMOVE ; pstate->NETCAPTURED = 1; // return; } else if (pstate->NETCAPTURED == -2) { pstate->weaponuptics = WEAPONS[pstate->weapon].screenheight/GMOVE; pstate->weaponheight = pstate->weaponuptics*GMOVE ; pstate->NETCAPTURED = 0; //return; } else { pstate->weaponuptics = WEAPONS[pstate->new_weapon].screenheight/GMOVE; pstate->weapon = pstate->new_weapon; pstate->weaponheight = pstate->weaponuptics*GMOVE ; } } } } else if (gamestate.battlemode == battle_Hunter) { if (pstate->weapondowntics == 1) { pstate->weapondowntics = 0; pstate->weaponframe = pstate->attackframe = pstate->batblast = 0; pstate->weapon = pstate->new_weapon; NewState(ob,resetstate); return; } } #if (SHAREWARE==0) if ((pstate->buttonstate[bt_use]) && (pstate->weapon != wp_dog) ) #else if (pstate->buttonstate[bt_use]) #endif Cmd_Use (ob); if (pstate->attackframe >= WEAPONS[pstate->weapon].numattacks) Error("\n attackframe %d for weapon %d gt numattacks %d", pstate->attackframe,pstate->weapon, WEAPONS[pstate->weapon].numattacks ); cur = &(WEAPONS[pstate->weapon].attackinfo[pstate->attackframe]); if (! pstate->attackcount) { switch (cur->attack) { case reset: if (vrenabled && (ob==player)) { StopVRFeedback(); } ob->flags &= ~FL_FULLLIGHT; if (pstate->ammo) { if (BATTLEMODE && (pstate->weapon == wp_firewall)) break; if (BATTLEMODE && (pstate->weapon == wp_firebomb)) break; if ((pstate->buttonstate[bt_attack]) && (pstate->weapon <= wp_firewall)) { if (pstate->weapon <= wp_mp40) { if (pstate->weapon == wp_twopistol) pstate->attackframe -= 6; else if (pstate->weapon == wp_pistol) pstate->attackframe -= 3; else if (pstate->weapon == wp_mp40) pstate->attackframe -= 2; if (ob->state == &s_pmissattack2) NewState(ob,&s_pmissattack1); else if (ob->state == &s_pgunattack2) NewState(ob,&s_pgunattack1); } } else { NewState(ob,resetstate); pstate->attackframe = pstate->weaponframe = 0; pstate->batblast = 0; return; } } else { NewState(ob,resetstate); pstate->attackframe = pstate->weaponframe = 0; pstate->new_weapon = pstate->bulletweapon; pstate->batblast = 0; pstate->ammo = -1; pstate->missileweapon = -1; pstate->weapondowntics = WEAPONS[pstate->weapon].screenheight/GMOVE; if ((ob==player) && SHOW_BOTTOM_STATUS_BAR() ) DrawBarAmmo (false); return; } break; case reset2: if (vrenabled && (ob==player)) { StopVRFeedback(); } ob->flags &= ~FL_FULLLIGHT; if (pstate->buttonstate[bt_attack] && pstate->ammo) { pstate->attackframe -= 4; if (ob->state == &s_pmissattack2) NewState(ob,&s_pmissattack1); else if (ob->state == &s_pgunattack2) NewState(ob,&s_pgunattack1); } else { NewState(ob,resetstate); pstate->attackframe = pstate->weaponframe = 0; pstate->batblast = 0; return; } break; case at_pulltrigger: if (vrenabled && (ob==player)) { StartVRFeedback(1); } ob->flags |= FL_FULLLIGHT; #if (SHAREWARE == 0) if (pstate->batblast >= BBTIME) DogBlast(ob); else if (pstate->weapon == wp_dog) DogAttack(ob); else if (pstate->weapon == wp_bat) BatAttack (ob); else #endif GunAttack(ob); break; case at_missileweapon: if (!pstate->ammo) { pstate->attackframe = pstate->weaponframe = 0; pstate->batblast = 0; return; } if (vrenabled && (ob==player)) { StartVRFeedback(1); } ob->flags |= FL_FULLLIGHT; if (ob==player) SetIllumination(2); PlayerMissileAttack(ob); if (!(ob->flags & FL_GODMODE) && !godmode) { if (!BATTLEMODE || (gamestate.BattleOptions.Ammo != bo_infinite_shots)) pstate->ammo--; if ((ob==player) && SHOW_BOTTOM_STATUS_BAR() ) DrawBarAmmo (false); } #if (SHAREWARE == 0) if (pstate->weapon == wp_kes) pstate->weapondowntics = KESTICS/(2*GMOVE); #endif break; default: ; } pstate->attackframe++; cur = &(WEAPONS[pstate->weapon].attackinfo[pstate->attackframe]); pstate->weaponframe = cur->frame; pstate->attackcount = cur->mtics; } else pstate->attackcount --; } /* =============== = = T_BatBlast = =============== */ void T_BatBlast (objtype *ob) { attack_t *cur; playertype *pstate; Thrust(ob); CheckPlayerSpecials(ob); M_LINKSTATE(ob,pstate); //Commented out until we find if it's valid /* if (!ob->ticcount) {if ( pstate->buttonstate[bt_use] && !pstate->buttonheld[bt_use] ) pstate->buttonstate[bt_use] = false; if ( pstate->buttonstate[bt_attack] && !pstate->buttonheld[bt_attack]) pstate->buttonstate[bt_attack] = false; } */ // // change frame and fire // BatBlast(ob); if (pstate->attackframe >= WEAPONS[pstate->weapon].numattacks) Error("\n attackframe %d for weapon %d gt numattacks %d", pstate->attackframe,pstate->weapon, WEAPONS[pstate->weapon].numattacks ); cur = &(WEAPONS[pstate->weapon].attackinfo[pstate->attackframe]); if (! pstate->attackcount) {if (cur->attack == reset) { if (!(ob->flags & FL_GODMODE) && (!godmode)) {pstate->ammo --; if ((ob==player) && SHOW_BOTTOM_STATUS_BAR() ) DrawBarAmmo (false); } if (!pstate->ammo) {pstate->new_weapon = pstate->bulletweapon; pstate->ammo = -1; pstate->missileweapon = -1; pstate->weapondowntics = WEAPONS[pstate->weapon].screenheight/GMOVE; } NewState(ob,&s_player); pstate->attackframe = pstate->weaponframe = 0; pstate->batblast = 0; return; } pstate->attackframe++; pstate->weaponframe = WEAPONS[pstate->weapon].attackinfo[pstate->attackframe].frame; cur = &(WEAPONS[pstate->weapon].attackinfo[pstate->attackframe]); pstate->attackcount = cur->mtics; } else pstate->attackcount --; } void T_Free (objtype *ob) { attack_t *cur; if (!ob->ticcount) { //Commented out until we find if it's valid /* if ( locplayerstate->buttonstate[bt_use] && !locplayerstate->buttonheld[bt_use] ) locplayerstate->buttonstate[bt_use] = false; if ( locplayerstate->buttonstate[bt_attack] && !locplayerstate->buttonheld[bt_attack]) locplayerstate->buttonstate[bt_attack] = false; */ Thrust(ob); } CheckPlayerSpecials(ob); cur = &(FREE.attackinfo[locplayerstate->attackframe]); if (!locplayerstate->attackcount) { if ((locplayerstate->weaponframe > 3) && (locplayerstate->weaponframe < 8)) locplayerstate->NETCAPTURED ++; else if (locplayerstate->weaponframe == 8) { locplayerstate->NETCAPTURED = -2; MISCVARS->NET_IN_FLIGHT = false; NewState(ob,&s_player); locplayerstate->weapondowntics = FREE.screenheight/GMOVE; return; } locplayerstate->attackframe++; cur = &(FREE.attackinfo[locplayerstate->attackframe]); locplayerstate->weaponframe = cur->frame; locplayerstate->attackcount = cur->mtics; } else locplayerstate->attackcount --; } void Switch_Who_Is_It_For_Tag(objtype *actor1,objtype *actor2) { playertype *pstate; M_LINKSTATE(actor1,pstate); if (pstate->buttonstate[bt_use]) {playertype *pstate2; M_LINKSTATE(actor2,pstate2); pstate2->oldmissileweapon = pstate2->oldweapon = pstate2->new_weapon = pstate2->missileweapon = pstate2->weapon = wp_godhand; pstate2->weaponheight = 144; pstate2->weaponuptics = (144 - TAGHANDHEIGHT)/GMOVE; pstate2->weapondowntics = 0; actor1->flags |= FL_DIDTAG; actor2->flags |= FL_DESIGNATED; UpdateKills = true; actor1->flags &= ~FL_DESIGNATED; BATTLE_PlayerKilledPlayer(battle_player_tagged, actor1->dirchoosetime, actor2->dirchoosetime); } } void CheckTagGame(objtype *actor1,objtype*actor2) { //if ((actor1->obclass != playerobj) || (actor2->obclass != playerobj)) //return; if (!BATTLEMODE) return; if (gamestate.battlemode != battle_Tag) return; SD_PlaySoundRTP(SD_GETBONUSSND,actor1->x,actor1->y); if (actor1->flags & FL_DESIGNATED) Switch_Who_Is_It_For_Tag(actor1,actor2); else if (actor2->flags & FL_DESIGNATED) Switch_Who_Is_It_For_Tag(actor2,actor1); } /* ====================== = = CheckWeaponChange = = Keys 1-4 change weapons = ====================== */ void CheckWeaponChange (objtype * ob) { // int i; playertype * pstate; M_LINKSTATE(ob,pstate); //pstate = (ob == player)?(&playerstate):(&remoteplayerstate); if (W_CHANGE(pstate)) return; if (!ARMED(ob->dirchoosetime)) return; if ((ob->flags & FL_DOGMODE) || (ob->flags & FL_GODMODE)) return; #if (WEAPONCHEAT==1) if (godmode && Keyboard[sc_Insert]) { SD_Play(SD_SELECTWPNSND); // FOR DEBUG only /* if (pstate->buttonstate[bt_run]) { if (pstate->weapon == 0) pstate->new_weapon = wp_bat; else pstate->new_weapon --; } else {*/ if (pstate->weapon == MAXWEAPONS-1) pstate->new_weapon = 0; else pstate->new_weapon ++; //} if (pstate->new_weapon <= wp_mp40) {pstate->bulletweapon = pstate->new_weapon; pstate->HASBULLETWEAPON[pstate->new_weapon] = 1; } else pstate->missileweapon = pstate->new_weapon; pstate->ammo = stats[GetItemForWeapon(pstate->missileweapon)].ammo; if (pstate->ammo<1) pstate->ammo=5; StartWeaponChange; //pstate->weapondowntics = WEAPONS[pstate->weapon].screenheight/GMOVE; //if ((ob==player) && SHOW_BOTTOM_STATUS_BAR() ) // DrawBarAmmo (false); } else if (pstate->buttonstate[bt_swapweapon]) #else if (pstate->buttonstate[bt_swapweapon]) #endif { if ((pstate->weapon == pstate->bulletweapon) && (pstate->missileweapon != -1)) {pstate->new_weapon = pstate->missileweapon; StartWeaponChange; } else if (pstate->weapon != pstate->bulletweapon) {pstate->new_weapon = pstate->bulletweapon; StartWeaponChange; } } else if ((pstate->buttonstate[bt_dropweapon]) && (!gamestate.BattleOptions.WeaponPersistence)) { if (pstate->weapon==pstate->bulletweapon) { if ((ob==player) && (!(pstate->buttonheld[bt_dropweapon]))) PlayNoWaySound(); } else { if (sprites[ob->tilex][ob->tiley]) { if ((ob==player) && (!(pstate->buttonheld[bt_dropweapon]))) PlayNoWaySound(); } else { DropWeapon(ob); } } } if (pstate->buttonstate[bt_pistol]) {if (pstate->weapon != wp_pistol) {pstate->new_weapon = pstate->bulletweapon = wp_pistol; StartWeaponChange; } } else if (pstate->buttonstate[bt_dualpistol]) {if ((pstate->weapon != wp_twopistol) && pstate->HASBULLETWEAPON[wp_twopistol]) {pstate->new_weapon = pstate->bulletweapon = wp_twopistol; StartWeaponChange; } } else if (pstate->buttonstate[bt_mp40]) {if ((pstate->weapon != wp_mp40) && pstate->HASBULLETWEAPON[wp_mp40]) {pstate->new_weapon = pstate->bulletweapon = wp_mp40; StartWeaponChange; } } else if (pstate->buttonstate[bt_missileweapon]) {if ((pstate->weapon != pstate->missileweapon) && (pstate->missileweapon != -1)) {pstate->new_weapon = pstate->missileweapon; StartWeaponChange; } } } void SetWhoHaveWeapons(void) { playertype *pstate; objtype *ob; int i; for ( i = 0; i < numplayers; i++ ) { ob = PLAYER[ i ]; M_LINKSTATE( ob, pstate ); if ( ARMED( ob->dirchoosetime )) { if (pstate->weapon == -1) { if (( pstate->missileweapon != -1 ) && (pstate->ammo>0)) pstate->new_weapon = pstate->missileweapon; else { if ( pstate->bulletweapon == -1 ) { pstate->HASBULLETWEAPON[ wp_pistol ] = 1; pstate->bulletweapon = wp_pistol; } pstate->new_weapon = pstate->bulletweapon; pstate->ammo = -1; } pstate->weapon = pstate->new_weapon; pstate->weapondowntics = 0; pstate->weaponuptics = WEAPONS[pstate->new_weapon].screenheight/GMOVE; pstate->weaponheight = pstate->weaponuptics*GMOVE ; pstate->attackframe = pstate->weaponframe = pstate->batblast = 0; if (i == consoleplayer) DrawBarAmmo(false); } } else { if (ob->flags & FL_DOGMODE) { ob->temp2 = DOGMODERISE; pstate->oldweapon = -1; ResetWeapons(ob); if (ob->state->condition & SF_DOGSTATE) NewState(ob,&s_player); } else if (ob->flags & FL_GODMODE) { ob->temp2 = GODMODEFALL; pstate->oldweapon = -1; ResetWeapons(ob); } else { pstate->new_weapon = -1; StartWeaponChange; } pstate->attackframe = pstate->weaponframe = pstate->batblast = 0; } } } void CheckWeaponStates(objtype*ob) {playertype *pstate; M_LINKSTATE(ob,pstate); if (gamestate.battlemode == battle_Tag) {if (pstate->weapondowntics) {pstate->weaponheight += GMOVE; pstate->weapondowntics --; if (!pstate->weapondowntics) pstate->weapon = pstate->missileweapon = pstate->bulletweapon = pstate->new_weapon = pstate->oldweapon = pstate->oldmissileweapon = -1; } if (pstate->weaponuptics) {pstate->weaponheight -= GMOVE; pstate->weaponuptics --; } return; } if (pstate->weapondowntics) {pstate->weaponheight += GMOVE; #if (SHAREWARE == 0) if ((pstate->weapon == wp_kes) && pstate->attackframe) pstate->weaponheight += GMOVE; #endif pstate->weapondowntics --; } else if (pstate->weaponuptics) {pstate->weaponheight -= GMOVE; #if (SHAREWARE == 0) if ((pstate->weapon == wp_kes) && pstate->attackframe) pstate->weaponheight -= GMOVE; #endif pstate->weaponuptics --; } else if ((pstate->weapon == pstate->new_weapon) && (!pstate->NETCAPTURED)) pstate->weaponheight = 0; } /* ============================= = = CheckSpecialSounds = ============================= */ #define REGDOGSTATE(ob) \ ((ob->state == &s_serialdog) || (ob->state == &s_serialdog2) || \ (ob->state == &s_serialdog3) || (ob->state == &s_serialdog4) \ ) static int dyingvolume=255; void CheckSpecialSounds(objtype *ob, playertype *pstate) { int shift; if ((!BATTLEMODE) && (ob == player)) { if (pstate->health < MaxHitpointsForCharacter(locplayerstate)/5) { pstate->healthtime ++; if (pstate->healthtime > 2*VBLCOUNTER) { pstate->healthtime = 0; SD_PlayPitchedSound ( SD_PLAYERDYINGSND, dyingvolume, 0 ); if (dyingvolume>80) dyingvolume-=40; } } else { dyingvolume=255; } } if (((ob->flags & FL_GODMODE) || (ob->flags & FL_DOGMODE)) && (!W_CHANGE(pstate)) ) { pstate->soundtime++; if (pstate->soundtime > (2*VBLCOUNTER)) { int rand; rand = GameRandomNumber("player special sound",0); shift = (pstate->soundtime>>5); if ((rand << shift) > 3500) { int sound; pstate->soundtime = 0; rand = GameRandomNumber("player god scare",0); if (ob->flags & FL_GODMODE) { sound = SD_GODMODE1SND; if (rand < 160) sound++; if (rand < 80) sound ++; SD_PlaySoundRTP(sound,ob->x,ob->y); } #if (SHAREWARE == 0) else if ((!pstate->batblast) && (!ob->momentumz) && (REGDOGSTATE(ob)) ) { sound = SD_DOGMODEPANTSND; if (rand < 128) sound += 2; NewState(ob,&s_doglick); pstate->attackframe = pstate->weaponframe = pstate->batblast = 0; SD_PlaySoundRTP(sound,ob->x,ob->y); } #endif } } } else if (ob->flags & FL_GASMASK) { pstate->soundtime ++; if (pstate->soundtime > (3*VBLCOUNTER)) { pstate->soundtime = 0; SD_PlaySoundRTP(SD_GASMASKSND,ob->x,ob->y); } } else if (MISCVARS->GASON) { pstate->soundtime ++; if (pstate->soundtime > (2*VBLCOUNTER)) { int rand; rand = GameRandomNumber("player cough sound",0); shift = (pstate->soundtime>>5); if ((rand << shift) > 2000) { pstate->soundtime = 0; if ((pstate->player == 1) || (pstate->player == 3)) SD_PlaySoundRTP(SD_PLAYERCOUGHFSND,ob->x,ob->y); else SD_PlaySoundRTP(SD_PLAYERCOUGHMSND,ob->x,ob->y); } } } } /* static int dyingvolume=255; void CheckSpecialSounds(objtype *ob, playertype *pstate) { int shift; if ((!BATTLEMODE) && (ob == player)) { if (pstate->health < MaxHitpointsForCharacter(locplayerstate)/5) { pstate->healthtime ++; if (pstate->healthtime > 2*VBLCOUNTER) { pstate->healthtime = 0; SD_PlayPitchedSound ( SD_PLAYERDYINGSND, dyingvolume, 0 ); if (dyingvolume>80) dyingvolume-=40; } } else { dyingvolume=255; } } if (((ob->flags & FL_GODMODE) || (ob->flags & FL_DOGMODE)) && (!W_CHANGE(pstate)) ) { pstate->soundtime++; if (pstate->soundtime > (2*VBLCOUNTER)) { int rand; rand = GameRandomNumber("player special sound",0); shift = (pstate->soundtime>>5); if ((rand << shift) > 3500) { int sound; pstate->soundtime = 0; rand = GameRandomNumber("player god scare",0); if (ob->flags & FL_GODMODE) { sound = SD_GODMODE1SND; if (rand < 160) sound++; if (rand < 80) sound ++; SD_PlaySoundRTP(sound,ob->x,ob->y); } #if (SHAREWARE == 0) else if (!pstate->batblast) { sound = SD_DOGMODEPANTSND; if (rand < 128) sound += 2; NewState(ob,&s_doglick); pstate->attackframe = pstate->weaponframe = pstate->batblast = 0; SD_PlaySoundRTP(sound,ob->x,ob->y); } #endif } } } else if (ob->flags & FL_GASMASK) { pstate->soundtime ++; if (pstate->soundtime > (3*VBLCOUNTER)) { pstate->soundtime = 0; SD_PlaySoundRTP(SD_GASMASKSND,ob->x,ob->y); } } else if (MISCVARS->GASON) { pstate->soundtime ++; if (pstate->soundtime > (2*VBLCOUNTER)) { int rand; rand = GameRandomNumber("player cough sound",0); shift = (pstate->soundtime>>5); if ((rand << shift) > 2000) { pstate->soundtime = 0; if ((pstate->player == 1) || (pstate->player == 3)) SD_PlaySoundRTP(SD_PLAYERCOUGHFSND,ob->x,ob->y); else SD_PlaySoundRTP(SD_PLAYERCOUGHMSND,ob->x,ob->y); } } } } */ /* ============================= = = CheckProtectionsAndPowerups = ============================= */ void CheckProtectionsAndPowerups(objtype *ob, playertype *pstate) { if (pstate->poweruptime) { pstate->poweruptime --; if (pstate->poweruptime < 0) pstate->poweruptime = 0; if (ob==player) GM_UpdateBonus (pstate->poweruptime, true); } else { if (ob->flags & FL_ELASTO) { ob->flags &= ~FL_NOFRICTION; if (ob==player) GM_UpdateBonus (pstate->poweruptime, true); SD_PlaySoundRTP(SD_LOSEMODESND,ob->x, ob->y); } else if (ob->flags & FL_GODMODE) {ob->temp2 = GODMODEFALL; if ((pstate->player == 1) || (pstate->player == 3)) SD_PlaySoundRTP(SD_GODWOMANSND,ob->x, ob->y); else SD_PlaySoundRTP(SD_GODMANSND,ob->x, ob->y); ResetWeapons(ob); } else if (ob->flags & FL_DOGMODE) {int wall; wall = tilemap[ob->tilex][ob->tiley]; if ((wall & 0x4000) && (wall & 0x8000)) {maskedwallobj_t * mw; mw=maskobjlist[wall&0x3ff]; if (mw->flags&MW_NONDOGBLOCKING) return; } ob->temp2 = DOGMODERISE; if ((pstate->player == 1) || (pstate->player == 3)) SD_PlaySoundRTP(SD_DOGWOMANSND,ob->x, ob->y); else SD_PlaySoundRTP(SD_DOGMANSND,ob->x, ob->y); ResetWeapons(ob); if (ob->state->condition & SF_DOGSTATE) { NewState(ob,&s_player); pstate->attackframe = pstate->weaponframe = pstate->batblast = 0; } } else if (ob->flags & FL_SHROOMS) { ResetFocalWidth (); SD_PlaySoundRTP(SD_LOSEMODESND,ob->x, ob->y); } else if (ob->flags & FL_FLEET) SD_PlaySoundRTP(SD_LOSEMODESND,ob->x, ob->y); ob->flags &= ~(FL_SHROOMS|FL_ELASTO|FL_FLEET|FL_GODMODE|FL_DOGMODE); } if (pstate->protectiontime) { pstate->protectiontime --; if (pstate->protectiontime <= 0) { SD_PlaySoundRTP(SD_LOSEMODESND,ob->x, ob->y); pstate->protectiontime = 0; } if (ob==player) GM_UpdateBonus (pstate->protectiontime, false); } else ob->flags &= ~(FL_BPV|FL_AV|FL_GASMASK); } /* ============================= = = CheckFlying = ============================= */ void CheckFlying(objtype*ob,playertype *pstate) { if (pstate->buttonstate[bt_lookup] || CYBERLOOKUP) { ob->momentumz = -FLYINGZMOM; } if (pstate->buttonstate[bt_lookdown] || CYBERLOOKDOWN) { ob->momentumz = FLYINGZMOM; } /* if (!M_ISDOOR(((ob->x + costable[ob->angle])>>16), ((ob->y - sintable[ob->angle])>>16)) && (pstate->buttonstate[bt_use]) && (!pstate->buttonheld[bt_use]) ) { int op; int dist; dist=JETPACKTHRUST; if (ob->z-dist<-15) dist=ob->z+15; if (dist>0) { op = FixedMul(GRAVITY,(dist<<16)) << 1; ob->momentumz = -FixedSqrtHP(op); SD_PlaySoundRTP(SD_FLYINGSND,ob->x,ob->y); } } */ } /* ============================= = = CheckTemp2Codes = ============================= */ #define IN_AIR(ob) \ (!((ob->z == nominalheight) || \ (IsPlatform(ob->tilex,ob->tiley)) || \ (DiskAt(ob->tilex,ob->tiley)) \ ) \ ) \ void CheckTemp2Codes(objtype *ob,playertype *pstate) { int pitheight; int godheight; int height; int oldz; int destheightoffset; pitheight = maxheight - 8; height = ob->z + pstate->playerheight; godheight = ob->z + GODOFFSET; //SoftError("\nheightoffset: %d, temp2: %d",pstate->heightoffset,ob->temp2); if (!((ob->temp2 == PITFALL) || (ob->temp2 == PITRISE))) { oldz = ob->z; //SoftError("\n zmom %d, oldz %d, newz %d",ob->momentumz,oldz,ob->z); if (ob->flags & FL_FLEET) { if (IN_AIR(ob)) pstate->heightoffset = FixedMulShift(0x4000,sintable[(oldpolltime<<6)&2047],28); ob->z += ((ob->momentumz+0x8000)>>16); ob->momentumz = 0; } else { ob->z += (ob->momentumz>>16); ob->momentumz += GRAVITY; } if (ob->z >= nominalheight) { ob->z = nominalheight; ob->momentumz = 0; //if (platform == nominalheight) //{//ob->temp2 = 0; //ob->momentumz = 0; if ((oldz < nominalheight) && (!(ob->flags & FL_RIDING))) { SD_PlaySoundRTP(SD_PLAYERLANDSND,ob->x,ob->y); } if (!(ob->flags & FL_ELASTO)) ob->flags &= ~FL_NOFRICTION; // } } else if (height < 1) { ob->momentumz = 0; ob->z = 1-pstate->playerheight; } switch (ob->temp2) {case RENORMALIZE: pstate->heightoffset --; if (ob->flags & FL_DOGMODE) destheightoffset = DOGOFFSET-pstate->playerheight; else destheightoffset = 0; if (pstate->heightoffset <= destheightoffset) { ob->temp2 = 0; pstate->heightoffset = 0; } pstate->oldheightoffset = pstate->heightoffset; break; case COLUMNCRUSH: pstate->heightoffset += 4; if (pstate->heightoffset >= 30) pstate->heightoffset = 30; pstate->oldheightoffset = pstate->heightoffset; break; case GODMODERISE: pstate->heightoffset --; pstate->oldheightoffset = pstate->heightoffset; if ((height+pstate->heightoffset) <= godheight) { ob->temp2 = 0; pstate->poweruptime = POWERUPTICS; } break; case GODMODEFALL: pstate->heightoffset ++; pstate->oldheightoffset = pstate->heightoffset; SetPlayerHorizon(pstate,NORMALYZANGLE); if (pstate->heightoffset >= 0) { ob->temp2 = 0; ob->flags &= ~FL_GODMODE; SetNormalHorizon(ob); } break; case DOGMODERISE: pstate->heightoffset --; pstate->oldheightoffset = pstate->heightoffset; SetPlayerHorizon(pstate,NORMALYZANGLE); if (pstate->heightoffset <= 0) { ob->temp2 = 0; ob->flags &= ~FL_DOGMODE; SetNormalHorizon(ob); } break; case DOGMODEFALL: pstate->heightoffset ++; pstate->oldheightoffset = pstate->heightoffset; if (pstate->heightoffset >= (DOGOFFSET-pstate->playerheight)) { ob->temp2 = 0; pstate->poweruptime = POWERUPTICS; } break; case STEPUP: //Debug("\n\n heightoffset adjusted from %d to %d", // pstate->heightoffset,pstate->heightoffset - STEPADJUST); pstate->heightoffset -= STEPADJUST; if (pstate->heightoffset <= pstate->oldheightoffset) {ob->temp2 = 0; //Debug("\n done adjusting heightoffset"); pstate->heightoffset = pstate->oldheightoffset; } break; case STEPDOWN: pstate->heightoffset += STEPADJUST; if (pstate->heightoffset >= pstate->oldheightoffset) {ob->temp2 = 0; pstate->heightoffset = pstate->oldheightoffset; } break; case 0: if (!((ob->flags & FL_FLEET) || (ob->flags & FL_DOGMODE) || (ob->flags & FL_GODMODE) ) ) pstate->heightoffset = 0; break; } } else if (ob->temp2 == PITFALL) { if (ob->z != pitheight) { ob->z += (ob->momentumz>>16); ob->momentumz += GRAVITY; if (ob->z >= pitheight) { ob->z = pitheight; ob->momentumz = 0; if (!(ob->flags & FL_DYING)) {DamageThing(ob,10); Collision(ob,(objtype*)NULL,0,0); M_CheckPlayerKilled(ob); } } } else if (ob->momentumx || ob->momentumy) { ob->temp2 = PITRISE; ob->momentumz = -2; } } else if (ob->temp2 == PITRISE) {ob->z += ob->momentumz; if (ob->z <= nominalheight) {ob->z = nominalheight; ob->temp2 = 0; ob->momentumz = 0; if (pstate->heightoffset) ob->temp2 = RENORMALIZE; } } } /* ============================= = = CheckRemoteRecording = ============================= */ void CheckRemoteRecording(objtype *ob,playertype *pstate) { if (networkgame==true) { if ( (pstate->buttonstate[bt_recordsound]) && (!pstate->buttonheld[bt_recordsound]) ) { if (SD_RecordingActive()==false) { SD_SetRecordingActive (); PlayerRecording=ob->dirchoosetime; if (ob==player) { SD_StartRecordingSound(); UpdateClientControls(); } } } else if ( (pstate->buttonheld[bt_recordsound]) && (!pstate->buttonstate[bt_recordsound]) ) { if (SD_RecordingActive()==true) { if (ob->dirchoosetime==PlayerRecording) { if (ob==player) SD_StopRecordingSound(); SD_ClearRecordingActive(); PlayerRecording=-1; UpdateClientControls(); } } } } } /* ============================= = = CheckPlayerSpecials = ============================= */ void CheckPlayerSpecials(objtype * ob) { playertype * pstate; M_LINKSTATE(ob,pstate); // Check for recording of sound CheckRemoteRecording(ob,pstate); CheckTemp2Codes(ob,pstate); if (ob->flags & FL_DYING) return; CheckSpecialSounds(ob,pstate); CheckProtectionsAndPowerups(ob,pstate); } #if (SHAREWARE == 0) /* =============== = = T_DogUse = =============== */ void T_DogUse (objtype *ob) { attack_t *cur; playertype *pstate; statetype *oldstate; M_LINKSTATE(ob,pstate); Thrust(ob); oldstate = ob->state; CheckPlayerSpecials(ob); if (ob->state != oldstate) { return; } //Commented out until we find if it's valid /* if (!ob->ticcount) {if ( pstate->buttonstate[bt_use] && !pstate->buttonheld[bt_use] ) pstate->buttonstate[bt_use] = false; } */ if (pstate->attackframe >= DOGSCRATCH.numattacks) Error("\n attackframe %d for DOGSCRATCH gt numattacks %d", pstate->attackframe,DOGSCRATCH.numattacks ); cur = &(DOGSCRATCH.attackinfo[pstate->attackframe]); if (! pstate->attackcount) {switch (cur->attack) {case reset: { NewState(ob,&s_dogwait); pstate->attackframe = pstate->weaponframe = pstate->batblast = 0; return; } break; case at_pulltrigger: pstate->buttonheld[bt_use]=false; Cmd_Use(ob); break; default: break; } pstate->attackframe++; cur = &(DOGSCRATCH.attackinfo[pstate->attackframe]); pstate->weaponframe = cur->frame; pstate->attackcount = cur->mtics; } else pstate->attackcount --; } /* =============== = = T_DogLick = =============== */ void T_DogLick (objtype *ob) { attack_t *cur; playertype *pstate; statetype *oldstate; M_LINKSTATE(ob,pstate); Thrust(ob); oldstate = ob->state; CheckPlayerSpecials(ob); if (ob->state != oldstate) { return; } //Commented out until we find if it's valid /* if (!ob->ticcount) {if ( pstate->buttonstate[bt_use] && !pstate->buttonheld[bt_use] ) pstate->buttonstate[bt_use] = false; } */ if (pstate->attackframe >= DOGLICK.numattacks) Error("\n attackframe %d for DOGLICK gt numattacks %d", pstate->attackframe,DOGLICK.numattacks ); cur = &(DOGLICK.attackinfo[pstate->attackframe]); if (! pstate->attackcount) {if (cur->attack == reset) { NewState(ob,&s_serialdog); pstate->attackframe = pstate->weaponframe = 0; return; } pstate->attackframe++; cur = &(DOGLICK.attackinfo[pstate->attackframe]); pstate->weaponframe = cur->frame; pstate->attackcount = cur->mtics; } else pstate->attackcount --; // if ( playerstate.buttonstate[bt_attack] && (!playerstate.buttonheld[bt_attack]) && (!W_CHANGE)) // Cmd_Fire (ob); } #endif void T_DeadWait(objtype*ob) { playertype *pstate; M_LINKSTATE(ob,pstate); if ((ob->flags & FL_DESIGNATED) && (gamestate.battlemode == battle_CaptureTheTriad)) {int otherteam = (pstate->team ^ 1); ob->flags &= ~FL_DESIGNATED; UpdateKills = true; SpawnStatic(TEAM[otherteam].tilex,TEAM[otherteam].tiley,stat_collector,9); LASTSTAT->flags |= FL_COLORED; LASTSTAT->hitpoints = otherteam; LASTSTAT->flags |= FL_ABP; MakeStatActive(LASTSTAT); } //ob->momentumx=0; //ob->momentumy=0; if (pstate->heightoffset<36) {pstate->heightoffset++; pstate->oldheightoffset = pstate->heightoffset; } if (ob==player) { UpdateLightLevel(player->areanumber); if ((pstate->falling==true) || (ob->momentumz==0)) { if (BATTLEMODE) playerdead=true; else playstate = ex_died; } } /* if (BATTLEMODE) { objtype * killer=(objtype *)ob->target; dx = killer->x - ob->x; dy = ob->y - killer->y; if (dx && dy) ob->angle = atan2_appx (dx,dy); } */ //CheckPlayerSpecials(ob); } /* =============== = = T_Player = =============== */ void T_Player (objtype *ob) { playertype *pstate; statetype *oldstate; #if (SHAREWARE == 0) int eluder; #endif M_LINKSTATE(ob,pstate); #if (SHAREWARE == 0) eluder = ((pstate->weapon == wp_dog) && gamestate.SpawnEluder); #endif oldstate = ob->state; if (ob->flags&FL_DYING) { CheckPlayerSpecials(ob); PlayerMove(ob); if ( (pstate->falling==true) || ( (!ob->momentumx) && (!ob->momentumy) && (!ob->momentumz) && (!ob->state->tictime) ) ) { KillActor(ob); if (ob->state == &s_remoteguts12) NewState(ob,&s_gutwait); else NewState(ob,&s_deadwait); } return; } Thrust(ob); if (ob->flags & FL_DYING) return; oldstate = ob->state; CheckPlayerSpecials(ob); if (ob->state != oldstate) { if (ob->flags & FL_DYING) return; } if (!(ob->flags & FL_PAIN)) {if (!(ob->state->condition & SF_DOGSTATE)) {if ((ob->momentumx || ob->momentumy) && (ob->state->condition != SF_DOWN)) NewState(ob,&s_remotemove1); else if (NOMOM && (ob->state != &s_player)) NewState(ob,&s_player); } else if (NOMOM #if (SHAREWARE == 0) && (ob->state != &s_dogwait) #endif ) NewState(ob,ob->state); } else if (!ob->ticcount) {if (!(ob->state->condition & SF_DOGSTATE)) NewState(ob,&s_player); ob->flags &= ~FL_PAIN; } if (ob->flags & FL_DIDTAG) {ob->flags &= ~FL_DIDTAG; pstate->weapondowntics = (144 - TAGHANDHEIGHT)/GMOVE; } CheckWeaponStates(ob); if (ARMED(ob->dirchoosetime) //(gamestate.battlemode != battle_Tag) ) { if (pstate->weapondowntics == 1) // change to up; during change, up and down // are never zero at the same time { pstate->weapondowntics = 0; pstate->weaponframe = pstate->attackframe = 0; if (pstate->NETCAPTURED == -1) { pstate->weaponuptics = FREE.screenheight/GMOVE; pstate->weaponheight = pstate->weaponuptics*GMOVE ; pstate->NETCAPTURED = 1; // return; } else if (pstate->NETCAPTURED == -2) { pstate->weaponuptics = WEAPONS[pstate->weapon].screenheight/GMOVE; pstate->weaponheight = pstate->weaponuptics*GMOVE ; pstate->NETCAPTURED = 0; //return; } else { pstate->weaponuptics = WEAPONS[pstate->new_weapon].screenheight/GMOVE; pstate->weapon = pstate->new_weapon; pstate->weaponheight = pstate->weaponuptics*GMOVE ; } } else CheckWeaponChange (ob); } else if (gamestate.battlemode == battle_Hunter) { if (pstate->weapondowntics == 1) { pstate->weapondowntics = 0; pstate->weaponframe = pstate->attackframe = pstate->batblast = 0; pstate->weapon = pstate->new_weapon; } } // if ( pstate->buttonstate[bt_use] && (!W_CHANGE(pstate)) ) if ( pstate->buttonstate[bt_use] ) Cmd_Use (ob); if (W_CHANGE(pstate)) return; if ((!ARMED(ob->dirchoosetime)) #if (SHAREWARE == 0) && (pstate->weapon != wp_dog) #endif ) return; if (pstate->buttonstate[bt_attack]) { #if (SHAREWARE == 0) if (eluder) Cmd_Fire(ob); else if ((pstate->weapon == wp_bat) || (pstate->weapon == wp_dog) ) { int oldblast=pstate->batblast; pstate->batblast ++; if (pstate->weapon==wp_bat) { if (pstate->batblast == 20) SD_PlaySoundRTP(SD_EXCALIBUILDSND,ob->x,ob->y); } else { if ((pstate->batblast>>4)!=(oldblast>>4)) { int handle; handle=SD_PlaySoundRTP(SD_DOGMODEPREPBLASTSND,ob->x,ob->y); SD_SetSoundPitch(handle,-(BBTIME<<3)+(pstate->batblast<<3)); } } if (pstate->batblast < BBTIME) return; if (pstate->weapon == wp_bat) SD_PlaySoundRTP(SD_EXCALIBLASTSND,ob->x,ob->y); else SD_PlaySoundRTP(SD_DOGMODEBLASTSND,ob->x,ob->y); } if ((pstate->weapon != wp_split) || (!pstate->buttonheld[bt_attack])) #endif // if (!pstate->buttonheld[bt_attack]) //#endif { #if (SHAREWARE == 0) if (pstate->weapon == wp_kes) SD_PlaySoundRTP(SD_GRAVBUILDSND,ob->x,ob->y); #endif Cmd_Fire (ob); } } #if (SHAREWARE == 0) else if ( ((pstate->weapon == wp_bat) || ((pstate->weapon == wp_dog) && (!eluder)) ) && (pstate->buttonheld[bt_attack]) ) { if (pstate->weapon == wp_bat) SD_StopSound(SD_EXCALIBUILDSND); pstate->batblast = 0; Cmd_Fire(ob); } #endif } rott-20230810/rott/rt_playr.h000066400000000000000000000156161446517470200157630ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //*************************************************************************** // // RT_PLAYR.C - Player movement and stuff // //*************************************************************************** #ifndef _rt_playr_public #define _rt_playr_public #include "rt_actor.h" #include "rt_stat.h" #include "states.h" #include "rottnet.h" #include "rt_battl.h" #include "develop.h" extern int mouse_ry_input_scale; #define LOW_GRAVITY 10000 #define NORMAL_GRAVITY 30000 #define HIGH_GRAVITY 250000 #define TAGHANDHEIGHT 40 #define MAXDEAD 32 #define MAXBULLETS 64 #define MAXCODENAMELENGTH 9 #define ARMED(x) ( \ (gamestate.PlayerHasGun[x]) || \ (!BATTLEMODE) \ ) typedef struct { statetype *state; int speed; classtype obclass; int offset; int flags; }missile_stats; extern missile_stats PlayerMissileData[13]; extern int GetWeaponForItem(int itemnumber); extern int GetItemForWeapon(int weapon); typedef enum {reset, reset2, done, at_knife, at_pulltrigger, at_automatic, at_dryheaving, at_missileweapon } attack_action; typedef struct atkinf { attack_action attack; char mtics,frame; // attack is 1 for gun, 2 for knife, 3 for machine guns, // 4 for chaingun (orig. game) } attack_t; typedef struct weaptype {const int screenheight; int startammo; int base_damage; int impulse; int numattacks; attack_t attackinfo[14]; }williamdidthis; typedef struct { int lives; int health; int triads; signed char ammo; short poweruptime; short protectiontime; int new_weapon; int keys; int weapon; int missileweapon; int bulletweapon; signed char HASBULLETWEAPON[3]; int attackframe,attackcount,weaponframe; byte player; int topspeed; int dmomx; int dmomy; int angle; int anglefrac; boolean buttonheld[NUMBUTTONS]; boolean buttonstate[NUMBUTTONS]; int horizon; int lastmomz; signed short playerheight; signed short heightoffset; signed short weaponheight; byte weaponx,weapony; word batblast; signed char NETCAPTURED; signed char HASKNIFE; int oldweapon, oldmissileweapon; signed short weapondowntics,weaponuptics; int soundtime; int healthtime; objtype* guntarget; int targettime; // int steptime; // int stepwhich; boolean falling; int oldshapeoffset; int uniformcolor; char codename[MAXCODENAMELENGTH]; int oldheightoffset; int team; } playertype; typedef struct { int topspeed; int toprunspeed; int hitpoints; int accuracy; int height; } ROTTCHARS; #define M_LINKSTATE(x,y) \ { y = &PLAYERSTATE[x->dirchoosetime];\ } extern williamdidthis DOGSCRATCH; extern int GRAVITY; extern int controlupdatetime; extern int controlupdatestarted; extern statobj_t *DEADPLAYER[MAXDEAD]; extern int NUMDEAD; extern objtype *PLAYER[MAXPLAYERS]; extern objtype *player; extern playertype PLAYERSTATE[MAXPLAYERS],*locplayerstate; extern ROTTCHARS characters[5]; extern williamdidthis FREE; extern statetype s_player; extern williamdidthis WEAPONS[MAXWEAPONS]; extern boolean mouseenabled; extern boolean joystickenabled; extern boolean joypadenabled; extern boolean joystickprogressive; extern int joystickport; extern int joyxmax, joyymax, joyxmin, joyymin; extern int buttonscan[NUMBUTTONS]; extern int buttonmouse[6]; extern int buttonjoy[8]; extern boolean buttonpoll[NUMBUTTONS]; extern boolean godmode; extern boolean missilecam; extern objtype * missobj; extern int lastpolltime; extern int controlbuf[3]; extern int buttonbits; extern int pausedstartedticcount; extern boolean RefreshPause; void PlayNoWaySound(void); int GetBonusTimeForItem(int); int GetRespawnTimeForItem(int); int GetItemForWeapon(int); void SetWhoHaveWeapons(void); int MaxHitpointsForCharacter(playertype*); void RespawnPlayerobj(objtype*); void RevivePlayerobj(int,int,int,objtype*); void OperateElevatorSwitch(objtype*,int,int,int); void ResetPlayerstate(playertype*); void InitializeWeapons(playertype*); void DropWeapon(objtype*ob); void PollKeyboardButtons (void); void PollMouseButtons (void); void PollJoystickButtons (void); void PollKeyboardMove (void); void PollMouseMove (void); void PollJoystickMove (void); void PollControls (void); void AddDemoCmd (void); void AddRemoteCmd (void); void PlayerSlideMove(objtype * ob); void SpawnSmoke(objtype*); void GetBonus(objtype*,statobj_t*); void SpawnPlayerobj(int,int,int,int); void ClipPlayer(void); void PlayerMove ( objtype * ob ); void Cmd_Use(objtype*); void Cmd_Fire (objtype*ob); void SpawnGunSmoke(int x, int y, int z, int angle, int bullethole); void SpawnBlood(objtype * ob, int angle); void SpawnMetalSparks(objtype * ob, int angle); void CheckPlayerSpecials(objtype * ob); void LoadPlayer ( void ); void PlayerTiltHead (objtype * ob); boolean InRange (objtype *p, objtype *victim, int distance); void CheckUnPause ( void ); void UpdatePlayers ( void ); void UnTargetActor ( objtype * target ); enum { RENORMALIZE = 1, PITFALL, PITRISE, COLUMNCRUSH, GODMODERISE, GODMODEFALL, DOGMODEFALL, DOGMODERISE, STEPUP, STEPDOWN }; extern void ResetWeapons(objtype *); extern void SaveWeapons(objtype*); extern int whichpath; extern statobj_t *BulletHoles[MAXBULLETS]; extern boolean vrenabled; void SetupBulletHoleLink (int num, statobj_t * item); #endif rott-20230810/rott/rt_rand.c000066400000000000000000000054041446517470200155450ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "_rt_rand.h" #include "rt_rand.h" #include "develop.h" #include "rt_util.h" #include //**************************************************************************** // // GLOBALS // //**************************************************************************** static int rndindex; static int sndindex = 0; //**************************************************************************** // // GetRandomSeed () // //**************************************************************************** int GetRandomSeed ( void ) { return ( time (NULL) % (SIZE_OF_RANDOM_TABLE) ); } //**************************************************************************** // // InitializeRNG () // //**************************************************************************** void InitializeRNG ( void ) { SetRNGindex(GetRandomSeed()); sndindex=GetRandomSeed(); } //**************************************************************************** // // SetRNGindex () // //**************************************************************************** void SetRNGindex ( int i ) { rndindex=i; //TODO: Not sure if this is DEVELOPMENT code or not. //#if (DEVELOPMENT == 1) SoftError("RNG index set at %d\n",i); //#endif } //**************************************************************************** // // GetRNGindex () // //**************************************************************************** int GetRNGindex ( void ) { return rndindex; } //**************************************************************************** // // int GameRNG (void) // //**************************************************************************** int GameRNG ( void ) { rndindex = (rndindex+1)&(SIZE_OF_RANDOM_TABLE-1); return RandomTable[rndindex]; } //**************************************************************************** // // int RNG (void) // //**************************************************************************** int RNG( void ) { sndindex = (sndindex+1)&(SIZE_OF_RANDOM_TABLE-1); return RandomTable[sndindex]; } rott-20230810/rott/rt_rand.h000066400000000000000000000020501446517470200155440ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_rand_public #define _rt_rand_public #include "develop.h" void InitializeRNG ( void ); int GetRandomSeed ( void ); int GameRNG ( void ); #define GameRandomNumber(string,val) GameRNG() int RNG ( void ); #define RandomNumber(string,val) RNG() void SetRNGindex ( int i ); int GetRNGindex ( void ); #endif rott-20230810/rott/rt_sc_a.h000066400000000000000000000022111446517470200155240ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //*************************************************************************** // // RT_SC_A.ASM - Low level DrawColumn for masked post // //*************************************************************************** #ifndef _rt_sc_a_public #define _rt_sc_a_public void R_DrawColumn (byte * buf); void R_DrawSolidColumn (int color, byte * buf); void R_TransColumn (byte * buf); void R_DrawClippedColumn (byte * buf); #endif rott-20230810/rott/rt_scale.c000066400000000000000000000641011446517470200157070ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "watcom.h" #include #include #include "modexlib.h" #include "rt_util.h" #include "rt_draw.h" #include "rt_scale.h" #include "_rt_scal.h" #include "rt_sc_a.h" #include "engine.h" #include "w_wad.h" #include "z_zone.h" #include "lumpy.h" #include "rt_main.h" #include "rt_ted.h" #include "rt_vid.h" #include "rt_view.h" #include "rt_playr.h" /* ============================================================================= GLOBALS ============================================================================= */ // Draw Column vars int dc_texturemid; int dc_iscale; int dc_invscale; int sprtopoffset; int dc_yl; int dc_yh; //byte * dc_firstsource; byte * dc_source; int centeryclipped; int transparentlevel=0; /* ========================== = = SetPlayerLightLevel = ========================== */ void SetPlayerLightLevel (void) { int i; int lv; int intercept; int height; whereami=23; if (MISCVARS->GASON==1) { shadingtable=greenmap+(MISCVARS->gasindex<<8); return; } if (fulllight || fog) { shadingtable=colormap+(1<<12); return; } height=PLAYERHEIGHT; if (player->angle < FINEANGLES/8 || player->angle > 7*FINEANGLES/8) intercept=(player->x>>11)&0x1c; else if (player->angle < 3*FINEANGLES/8) intercept=(player->y>>11)&0x1c; else if (player->angle < 5*FINEANGLES/8) intercept=(player->x>>11)&0x1c; else intercept=(player->y>>11)&0x1c; if (lightsource) { lv=(((LightSourceAt(player->x>>16,player->y>>16)>>intercept)&0xf)>>1); i=maxshade-(height>>normalshade)-lv; if (i>normalshade); if (iGASON==1) { shadingtable=greenmap+(MISCVARS->gasindex<<8); return; } if (fulllight) { shadingtable=colormap+(1<<12); return; } if (fog) { i=((height*200/iGLOBAL_SCREENHEIGHT)>>normalshade)+minshade; if (i>maxshade) i=maxshade; shadingtable=colormap+(i<<8); } else { i=maxshade-(height>>normalshade); if (i>2)<<8); oldlevel=shadingtable; offset=*(src++); for (;offset!=255;) { length=*(src++); topscreen = sprtopoffset + (dc_invscale*offset); bottomscreen = topscreen + (dc_invscale*length); dc_yl = (topscreen+SFRACUNIT)>>SFRACBITS; dc_yh = ((bottomscreen-1)>>SFRACBITS); if (dc_yh >= viewheight) dc_yh = viewheight-1; if (dc_yl < 0) dc_yl = 0; if ((*src)==254) { shadingtable=seelevel; if (dc_yl <= dc_yh) R_TransColumn (buf); src++; offset=*(src++); shadingtable=oldlevel; } else { if (dc_yl <= dc_yh) { dc_source=src-offset; R_DrawColumn (buf); } src+=length; offset=*(src++); } } whereami=-2; } void ScaleMaskedPost (byte * src, byte * buf) { int offset; int length; int topscreen; int bottomscreen; whereami=26; offset=*(src++); for (;offset!=255;) { length=*(src++); topscreen = sprtopoffset + (dc_invscale*offset); bottomscreen = topscreen + (dc_invscale*length); dc_yl = (topscreen+SFRACUNIT)>>SFRACBITS; dc_yh = ((bottomscreen-1)>>SFRACBITS); if (dc_yh >= viewheight) dc_yh = viewheight-1; if (dc_yl < 0) dc_yl = 0; if (dc_yl <= dc_yh) { dc_source=src-offset; R_DrawColumn (buf); } src+=length; offset=*(src++); } } void ScaleClippedPost (byte * src, byte * buf) { int offset; int length; int topscreen; int bottomscreen; whereami=27; offset=*(src++); for (;offset!=255;) { length=*(src++); topscreen = sprtopoffset + (dc_invscale*offset); bottomscreen = topscreen + (dc_invscale*length); dc_yl = (topscreen+SFRACUNIT-1)>>SFRACBITS; dc_yh = ((bottomscreen-1)>>SFRACBITS); if (dc_yh >= viewheight) dc_yh = viewheight-1; if (dc_yl < 0) dc_yl = 0; if (dc_yl <= dc_yh) { dc_source=src-offset; R_DrawClippedColumn (buf); } src+=length; offset=*(src++); } } void ScaleSolidMaskedPost (int color, byte * src, byte * buf) { int offset; int length; int topscreen; int bottomscreen; whereami=28; offset=*(src++); for (;offset!=255;) { length=*(src++); topscreen = sprtopoffset + (dc_invscale*offset); bottomscreen = topscreen + (dc_invscale*length); dc_yl = (topscreen+SFRACUNIT)>>SFRACBITS; dc_yh = ((bottomscreen-1)>>SFRACBITS); if (dc_yh >= viewheight) dc_yh = viewheight-1; if (dc_yl < 0) dc_yl = 0; if (dc_yl <= dc_yh) { dc_source=src-offset; R_DrawSolidColumn (color, buf); } src+=length; offset=*(src++); } } void ScaleTransparentClippedPost (byte * src, byte * buf, int level) { int offset; int length; int topscreen; int bottomscreen; byte * oldlevel; byte * seelevel; whereami=29; seelevel=colormap+(((level+64)>>2)<<8); oldlevel=shadingtable; offset=*(src++); for (;offset!=255;) { length=*(src++); topscreen = sprtopoffset + (dc_invscale*offset); bottomscreen = topscreen + (dc_invscale*length); dc_yl = (topscreen+SFRACUNIT)>>SFRACBITS; dc_yh = ((bottomscreen-1)>>SFRACBITS); if (dc_yh >= viewheight) dc_yh = viewheight-1; if (dc_yl < 0) dc_yl = 0; if ((*src)==254) { shadingtable=seelevel; if (dc_yl <= dc_yh) R_TransColumn (buf); src++; offset=*(src++); shadingtable=oldlevel; } else { if (dc_yl <= dc_yh) { dc_source=src-offset; R_DrawClippedColumn (buf); } src+=length; offset=*(src++); } } } void ScaleMaskedWidePost (byte * src, byte * buf, int x, int width) { buf += x; while (width--) { ScaleMaskedPost(src,buf); buf++; } } void ScaleClippedWidePost (byte * src, byte * buf, int x, int width) { buf += x; while (width--) { ScaleClippedPost(src,buf); buf++; } } /* ======================= = = ScaleShape = ======================= */ void ScaleShape (visobj_t * sprite) { byte *shape; int frac; patch_t *p; int x1,x2; int tx; int size; whereami=32; shape=W_CacheLumpNum(sprite->shapenum,PU_CACHE, Cvt_patch_t, 1); p=(patch_t *)shape; size=p->origsize>>7; // sprite->viewheight<<=1; dc_invscale=sprite->viewheight<<((10-HEIGHTFRACTION)-size); tx=-p->leftoffset; sprite->viewx=(sprite->viewx<viewheight<<(SFRACBITS-HEIGHTFRACTION-1))+(SFRACUNIT>>1); // // calculate edges of the shape // x1 = (sprite->viewx+(tx*dc_invscale))>>SFRACBITS; if (x1 >= viewwidth) { return; // off the right side } tx+=p->width; x2 = ((sprite->viewx+(tx*dc_invscale)) >>SFRACBITS) - 1 ; if (x2 < 0) { return; // off the left side } // dc_iscale=(1<<(16+6+HEIGHTFRACTION+size))/sprite->viewheight; dc_iscale=0xffffffffu/(unsigned)dc_invscale; dc_texturemid=(((sprite->h1<topoffset)<>1); sprtopoffset=centeryfrac - FixedMul(dc_texturemid,dc_invscale); shadingtable=sprite->colormap; if (x1<0) { frac=dc_iscale*(-x1); x1=0; } else frac=0; x2 = x2 >= viewwidth ? viewwidth-1 : x2; if (sprite->viewheight>((1<<(HEIGHTFRACTION+6))<sprite->viewheight) { if (lastcolumn>=0) { ScaleMaskedWidePost(((p->collumnofs[lastcolumn])+shape),(byte *)bufferofs,startx,width); width=1; lastcolumn=-1; } continue; } texturecolumn = frac>>SFRACBITS; if ((texturecolumn==lastcolumn)&&(width<9)) { width++; continue; } else { if (lastcolumn>=0) { ScaleMaskedWidePost(((p->collumnofs[lastcolumn])+shape),(byte *)bufferofs,startx,width); width=1; startx=x1; lastcolumn=texturecolumn; } else { startx=x1; lastcolumn=texturecolumn; } } } if (lastcolumn!=-1) ScaleMaskedWidePost(((p->collumnofs[lastcolumn])+shape),(byte *)bufferofs,startx,width); } else { byte * b; int startfrac; int startx; startx=x1; startfrac=frac; if (doublestep>1) { { frac=startfrac; for (x1=startx;x1<=x2;x1+=2, frac += (dc_iscale<<1)) { if ( (posts[x1].wallheight>sprite->viewheight) && (posts[x1+1].wallheight>sprite->viewheight) ) continue; if (x1==viewwidth-1) ScaleMaskedWidePost(((p->collumnofs[frac>>SFRACBITS])+shape),(byte *)bufferofs,x1,1); else ScaleMaskedWidePost(((p->collumnofs[frac>>SFRACBITS])+shape),(byte *)bufferofs,x1,2); } } } else { { frac=startfrac; b=(byte *)bufferofs+startx; for (x1=startx;x1<=x2;x1++, frac += dc_iscale,b++) { if (posts[x1].wallheight>sprite->viewheight) continue; ScaleMaskedPost(((p->collumnofs[frac>>SFRACBITS])+shape),b); } } } } } /* ======================= = = ScaleTranparentShape = ======================= */ void ScaleTransparentShape (visobj_t * sprite) { byte *shape; int frac; transpatch_t *p; int x1,x2; int tx; int size; byte * b; int startfrac; int startx; whereami=33; shape=W_CacheLumpNum(sprite->shapenum,PU_CACHE, Cvt_transpatch_t, 1); p=(transpatch_t *)shape; size=p->origsize>>7; dc_invscale=sprite->viewheight<<((10-HEIGHTFRACTION)-size); tx=-p->leftoffset; sprite->viewx=(sprite->viewx<viewheight<<(SFRACBITS-HEIGHTFRACTION-1)); // // calculate edges of the shape // x1 = (sprite->viewx+(tx*dc_invscale))>>SFRACBITS; if (x1 >= viewwidth) { return; // off the right side } tx+=p->width; x2 = ((sprite->viewx+(tx*dc_invscale)) >>SFRACBITS) - 1 ; if (x2 < 0) { return; // off the left side } // dc_iscale=(1<<(16+6+HEIGHTFRACTION+size))/sprite->viewheight; dc_iscale=0xffffffffu/(unsigned)dc_invscale; dc_texturemid=(((sprite->h1<topoffset)<>1); sprtopoffset=centeryfrac - FixedMul(dc_texturemid,dc_invscale); shadingtable=sprite->colormap; if (x1<0) { frac=dc_iscale*(-x1); x1=0; } else frac=0; x2 = x2 >= viewwidth ? viewwidth-1 : x2; startx=x1; startfrac=frac; { frac=startfrac; b=(byte *)bufferofs+startx; for (x1=startx;x1<=x2;x1++, frac += dc_iscale,b++) { if (posts[x1].wallheight>sprite->viewheight) continue; ScaleTransparentPost(((p->collumnofs[frac>>SFRACBITS])+shape),b,sprite->h2); } } } /* ======================= = = ScaleSolidShape = ======================= */ void ScaleSolidShape (visobj_t * sprite) { byte *shape; int frac; patch_t *p; int x1,x2; int tx; int size; byte * b; int startfrac; int startx; whereami=34; shape=W_CacheLumpNum(sprite->shapenum,PU_CACHE, Cvt_patch_t, 1); p=(patch_t *)shape; size=p->origsize>>7; dc_invscale=sprite->viewheight<<((10-HEIGHTFRACTION)-size); tx=-p->leftoffset; sprite->viewx=(sprite->viewx<viewheight<<(SFRACBITS-HEIGHTFRACTION-1))+(SFRACUNIT>>1); // // calculate edges of the shape // x1 = (sprite->viewx+(tx*dc_invscale))>>SFRACBITS; if (x1 >= viewwidth) { return; // off the right side } tx+=p->width; x2 = ((sprite->viewx+(tx*dc_invscale)) >>SFRACBITS) - 1 ; if (x2 < 0) { return; // off the left side } // dc_iscale=(1<<(16+6+HEIGHTFRACTION+size))/sprite->viewheight; dc_iscale=0xffffffffu/(unsigned)dc_invscale; dc_texturemid=(((sprite->h1<topoffset)<>1); sprtopoffset=centeryfrac - FixedMul(dc_texturemid,dc_invscale); shadingtable=sprite->colormap; if (x1<0) { frac=dc_iscale*(-x1); x1=0; } else frac=0; x2 = x2 >= viewwidth ? viewwidth-1 : x2; startx=x1; startfrac=frac; { frac=startfrac; b=(byte *)bufferofs+startx; for (x1=startx;x1<=x2;x1++, frac += dc_iscale,b++) { if (posts[x1].wallheight>sprite->viewheight) continue; ScaleSolidMaskedPost(sprite->h2,((p->collumnofs[frac>>SFRACBITS])+shape),b); } } } /* ======================= = = ScaleWeapon = ======================= */ void ScaleWeapon (int xoff, int y, int shapenum) { byte *shape; int frac; int h; patch_t *p; int x1,x2; int tx; int xcent; byte * b; int startfrac; int startx; whereami=35; SetPlayerLightLevel(); shape=W_CacheLumpNum(shapenum,PU_CACHE, Cvt_patch_t, 1); p=(patch_t *)shape; h=((p->origsize*weaponscale)>>17); centeryclipped=(viewheight-h)+FixedMul(y,weaponscale); xcent=centerx+FixedMul(xoff,weaponscale); dc_invscale=(h<<17)/p->origsize; tx=-p->leftoffset; xcent=(xcent<>SFRACBITS; if (x1 >= viewwidth) return; // off the right side tx+=p->width; x2 = ((xcent+(tx*dc_invscale)) >>SFRACBITS) - 1 ; if (x2 < 0) return; // off the left side dc_iscale=0xffffffffu/(unsigned)dc_invscale; dc_texturemid=(((p->origsize>>1)+p->topoffset)<>2); sprtopoffset=(centeryclipped<<16) - FixedMul(dc_texturemid,dc_invscale); // // store information in a vissprite // if (x1<0) { frac=dc_iscale*(-x1); x1=0; } else frac=0; x2 = x2 >= viewwidth ? viewwidth-1 : x2; startx=x1; startfrac=frac; { frac=startfrac; b=(byte *)bufferofs+startx; for (x1=startx; x1<=x2 ; x1++, frac += dc_iscale,b++) ScaleClippedPost(((p->collumnofs[frac>>SFRACBITS])+shape),b); } } /* ======================= = = DrawUnScaledSprite = ======================= */ void DrawUnScaledSprite (int x, int y, int shapenum, int shade) { byte *shape; int frac; patch_t *p; int x1,x2; int tx; int xcent; byte * b; int startfrac; int startx; whereami=36; shadingtable=colormap+(shade<<8); centeryclipped=y; xcent=x; shape=W_CacheLumpNum(shapenum,PU_CACHE, Cvt_patch_t, 1); p=(patch_t *)shape; dc_invscale=0x10000; tx=-p->leftoffset; xcent-=p->origsize>>1; // // calculate edges of the shape // x1 = xcent+tx; if (x1 >= viewwidth) return; // off the right side tx+=p->width; x2 = xcent+tx - 1; if (x2 < 0) return; // off the left side dc_iscale=0x10000; dc_texturemid=(((p->height>>1)+p->topoffset)<>1); sprtopoffset=(centeryclipped<<16) - dc_texturemid; // // store information in a vissprite // if (x1<0) { frac=dc_iscale*(-x1); x1=0; } else frac = 0; x2 = x2 >= viewwidth ? viewwidth-1 : x2; startx=x1; startfrac=frac; { frac=startfrac; b=(byte *)bufferofs+startx; for (x1=startx; x1<=x2 ; x1++, frac += dc_iscale,b++) ScaleClippedPost(((p->collumnofs[frac>>SFRACBITS])+shape),b); } } /* ======================= = = DrawScreenSprite = ======================= */ void DrawScreenSprite (int x, int y, int shapenum) { whereami=37; ScaleWeapon (x-160, y-200, shapenum); } /* ======================= = = DrawPositionedScaledSprite = ======================= */ void DrawPositionedScaledSprite (int x, int y, int shapenum, int height, int type) { byte *shape; int frac; patch_t *p; transpatch_t *tp; int x1,x2; int tx; int xcent; byte * b; int startfrac; int startx; int size; whereami=38; shadingtable=colormap+(1<<12); centeryclipped=y; xcent=x; shape=W_CacheLumpNum(shapenum,PU_CACHE, Cvt_patch_t, 1); // was transpatch, fixed p=(patch_t *)shape; tp=(transpatch_t *)shape; size=p->origsize>>7; dc_invscale=height<<(10-size); tx=-p->leftoffset; xcent=(xcent<>SFRACBITS; if (x1 >= viewwidth) return; // off the right side tx+=p->width; x2 = ((xcent+(tx*dc_invscale)) >>SFRACBITS) - 1 ; if (x2 < 0) return; // off the left side dc_iscale=0xffffffffu/(unsigned)dc_invscale; // dc_iscale=(1<<(16+6+size))/height; dc_texturemid=(((32<topoffset)<>1); sprtopoffset=(centeryclipped<<16) - FixedMul(dc_texturemid,dc_invscale); // // store information in a vissprite // if (x1<0) { frac=dc_iscale*(-x1); x1=0; } else frac=0; x2 = x2 >= viewwidth ? viewwidth-1 : x2; startx=x1; startfrac=frac; { frac=startfrac; b=(byte *)bufferofs+startx; for (x1=startx; x1<=x2 ; x1++, frac += dc_iscale,b++) if (type==0) ScaleClippedPost(((p->collumnofs[frac>>SFRACBITS])+shape),b); else ScaleTransparentClippedPost(((tp->collumnofs[frac>>SFRACBITS])+shape),b,transparentlevel); } } /* ================= = = DrawScreenSizedSprite = ================= */ extern int G_gmasklump; void DrawScreenSizedSprite (int lump) { //draws gasmask among other things zxcv byte *shape,*src; int frac; patch_t *p; int x1,x2; int tx; byte * b; int startfrac; int offset; int length; int topscreen; int bottomscreen; byte *cnt,*Ycnt; // SetTextMode ( ); whereami=39; shadingtable=colormap+(1<<12); shape=W_CacheLumpNum(lump,PU_CACHE, Cvt_patch_t, 1); p=(patch_t *)shape; dc_invscale=(viewwidth<<16)/p->origsize; tx=-p->leftoffset; centeryclipped=viewheight>>1; //centeryclipped=(viewheight>>1)+43; // // calculate edges of the shape // x1 = (tx*dc_invscale)>>SFRACBITS; if (x1 >= viewwidth) { return; // off the right side } tx+=p->width; x2 = ((tx*dc_invscale) >>SFRACBITS) - 1 ; if (x2 < 0) { return; // off the left side } dc_iscale=0xffffffffu/(unsigned)dc_invscale; dc_texturemid=(((p->origsize>>1) + p->topoffset)<>1); sprtopoffset=(centeryclipped<<16) - FixedMul(dc_texturemid,dc_invscale); x2 = (viewwidth-1); startfrac=0; { frac=startfrac; b=(byte *)bufferofs; ///////////// BNA PATCH ////////////////////////////////////////////////////////// //gmasklump=W_GetNumForName("p_gmask"); //=783 //perhaps I should have painted the mask in a seperate buffer //and streched it and copyet it back, but that would demand //a new buffer (size=800x600) and slowed the game down so ? // if its the gasmask, paint black patches at hires if ((lump == G_gmasklump)&&(iGLOBAL_SCREENWIDTH>320)) { src = ((p->collumnofs[frac>>SFRACBITS])+shape); offset=*(src++); length=*(src++); topscreen = sprtopoffset + (dc_invscale*offset); bottomscreen = topscreen + (dc_invscale*length); dc_yl = (topscreen+SFRACUNIT-1)>>SFRACBITS;//=41 viewheight=584 dc_yh = ((bottomscreen-1)>>SFRACBITS);//=540 viewwidth =800 //paint upper black patch in gasmask for (cnt=b;cntcollumnofs[frac>>SFRACBITS])+shape),b); } } } //****************************************************************************** // // DrawNormalPost // //****************************************************************************** void DrawNormalPost (byte * src, byte * buf) { int offset; int length; int s; whereami=40; while (1) { offset=*(src++); if (offset==0xff) return; else { length=*(src++); for (s=0;sleftoffset)<0) || ((x-p->leftoffset+p->width)>iGLOBAL_SCREENWIDTH)) Error ("DrawNormalSprite: x is out of range x=%d\n",x-p->leftoffset+p->width); if (((y-p->topoffset)<0) || ((y-p->topoffset+p->height)>iGLOBAL_SCREENHEIGHT)) Error ("DrawNormalSprite: y is out of range y=%d\n",y-p->topoffset+p->height); startx=x-p->leftoffset; buffer = (byte*)bufferofs+ylookup[y-p->topoffset]; { b=buffer+startx; for (cnt = 0; cnt < p->width; cnt++,b++) DrawNormalPost ((byte *)(p->collumnofs[cnt]+shape), b); } } void R_DrawColumn (byte * buf) { // This is *NOT* 100% correct - DDOI int count; int frac, fracstep; byte *dest; count = dc_yh - dc_yl + 1; if (count < 0) return; dest = buf + ylookup[dc_yl]; fracstep = dc_iscale; frac = dc_texturemid + (dc_yl-centery)*fracstep; while (count--) { //*dest = test++; *dest = shadingtable[dc_source[(frac>>SFRACBITS)]]; dest += iGLOBAL_SCREENWIDTH; frac += fracstep; } } void R_TransColumn (byte * buf) { int count; byte *dest; count = dc_yh - dc_yl + 1; if (count < 0) return; dest = buf + ylookup[dc_yl]; while (count--) { *dest = shadingtable[*dest]; dest += iGLOBAL_SCREENWIDTH; } } void R_DrawWallColumn (byte * buf) { // This is *NOT* 100% correct - DDOI int count; int frac, fracstep; byte *dest; count = dc_yh - dc_yl; if (count < 0) return; dest = buf + ylookup[dc_yl]; fracstep = dc_iscale; frac = dc_texturemid + (dc_yl-centery)*fracstep; frac <<= 10; fracstep <<= 10; while (count--) { //*dest = 6; *dest = shadingtable[dc_source[(((unsigned)frac)>>26)]]; dest += iGLOBAL_SCREENWIDTH; frac += fracstep; } } void R_DrawClippedColumn (byte * buf) { // This is *NOT* 100% correct - DDOI zxcv int count; int frac, fracstep; byte *dest; // byte *b;int y; count = dc_yh - dc_yl + 1; if (count < 0) return; dest = buf + ylookup[dc_yl]; fracstep = dc_iscale; frac = dc_texturemid + (dc_yl-centeryclipped)*fracstep; while (count--) { *dest = shadingtable[dc_source[(((unsigned)frac)>>SFRACBITS)]]; dest += iGLOBAL_SCREENWIDTH; frac += fracstep; } } void R_DrawSolidColumn (int color, byte * buf) { int count; byte *dest; count = dc_yh - dc_yl + 1; if (count < 0) return; dest = buf + ylookup[dc_yl]; while (count--) { *dest = (byte)color; dest += iGLOBAL_SCREENWIDTH; } } rott-20230810/rott/rt_scale.h000066400000000000000000000034671446517470200157240ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //*************************************************************************** // // RT_SCALE.H - Scale-o-rama // //*************************************************************************** #ifndef _rt_scale_public #define _rt_scale_public #include "rt_draw.h" extern int dc_texturemid; extern int dc_iscale; extern int dc_invscale; extern int centeryclipped; extern int sprtopoffset; extern int dc_yl; extern int dc_yh; extern byte * dc_source; extern int transparentlevel; void ScaleShape (visobj_t * vis); void ScaleWeapon (int xcent, int yoffset, int shapenum); void DrawScreenSprite (int x, int y, int shapenum); void SetLightLevel (int height); void ScaleMaskedPost (byte * src, byte * buf); void DrawScreenSizedSprite (int lump); void ScaleTransparentPost (byte * src, byte * buf, int level); void ScaleTransparentShape (visobj_t * sprite); void ScaleSolidShape (visobj_t * sprite); void DrawUnScaledSprite (int x, int y, int shapenum, int shade); void DrawPositionedScaledSprite (int x, int y, int shapenum, int height, int type); void DrawNormalSprite (int x, int y, int shapenum); #endif rott-20230810/rott/rt_sound.c000066400000000000000000000743161446517470200157610ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "rt_sound.h" #include "_rt_soun.h" #include "fx_man.h" #include "music.h" #include "z_zone.h" #include "w_wad.h" #include "rt_main.h" #include "rt_ted.h" #include "rt_menu.h" #include "rt_playr.h" #include "rt_util.h" #include "rt_rand.h" #include "watcom.h" #include #include #include #include "rt_cfg.h" #include "isr.h" #include "develop.h" #include "rt_net.h" #include "rt_str.h" #if (SHAREWARE==0) #include "snd_reg.h" #else #include "snd_shar.h" #endif // Local Variables static int soundstart; static int soundtype; int SD_Started=false; static boolean PositionStored=false; static int NumBadSounds=0; static int remotestart; static boolean SoundsRemapped = false; int musicnums[ 11 ] = { -1, -1, -1, -1, -1, -1, SoundScape, -1, -1, -1, -1 }; int fxnums[ 11 ] = { -1, -1, -1, -1, -1, -1, SoundScape, -1, -1, -1, -1 }; int MUSIC_GetPosition( void ) { songposition pos; MUSIC_GetSongPosition( &pos ); return pos.milliseconds; } void MUSIC_SetPosition( int time ) { MUSIC_SetSongTime( ( unsigned long )time ); } //*************************************************************************** // // SoundNumber // //*************************************************************************** int SoundNumber ( int x ) { if ((x>=SD_REMOTEM1SND) && (x<=SD_REMOTEM10SND)) return remotestart + x - SD_REMOTEM1SND; // sounds[x].snds[soundtype]+remotestart; else return sounds[x].snds[soundtype]+soundstart; } //*************************************************************************** // // SD_MakeCacheable - Make a sound that has just finished playing cacheable again // //*************************************************************************** void SD_MakeCacheable( unsigned long sndnum ) { if (sndnum == (unsigned long) -1) { return; } if (sndnum>=MAXSOUNDS) { SoftError ("Illegal sound value in SD_MakeCacheable value=%ld\n",sndnum); return; } sounds[sndnum].count--; if (sounds[sndnum].count>0) return; else W_CacheLumpNum(SoundNumber(sndnum),PU_CACHE, CvtNull, 1); } //*************************************************************************** // // SD_SetupFXCard - Initialize sound Tables and start up sound card // //*************************************************************************** int SD_SetupFXCard ( int * numvoices, int * numbits, int * numchannels) { fx_device device; int status; int card; if (SD_Started==true) SD_Shutdown(); if ( ( FXMode < 0 ) || ( FXMode >= 11 ) ) { return( 0 ); } card = fxnums[ FXMode ]; if (card==-1) // Check if it is off return (0); status=FX_SetupCard( card, &device ); if ( status == FX_Ok ) { *numvoices=device.MaxVoices; *numbits=device.MaxSampleBits; *numchannels=device.MaxChannels; } return (status); } //*************************************************************************** // // SD_Startup - Initialize sound Tables and start up sound card // //*************************************************************************** int SD_Startup ( boolean bombonerror ) { int status; int card; int voices; int channels; int bits; int i; extern boolean IS8250; if (SD_Started==true) SD_Shutdown(); if ( ( FXMode < 0 ) || ( FXMode >= 11 ) ) { return( 0 ); } card = fxnums[ FXMode ]; if (card==-1) // Check if it is off return (0); switch (card) { case SoundScape: soundstart=W_GetNumForName("digistrt")+1; soundtype=fx_digital; break; default: Error("FX: Unsupported Card number %d",FXMode); break; } if ( soundtype == fx_digital ) { if ( SoundsRemapped == false ) { for( i = 0; i < SD_LASTSOUND; i++ ) { int snd; snd = sounds[ i ].snds[ fx_digital ]; if ( snd >= 0) { sounds[ i ].snds[ fx_digital ] = W_GetNumForName( W_GetNameForNum( snd + soundstart ) ); } } SoundsRemapped = true; } soundstart = 0; } voices = NumVoices; channels = NumChannels; bits = NumBits; if ( IS8250 ) { voices = max( voices, 4 ); channels = 1; bits = 8; } status=FX_Init( card, voices, channels, bits, 11025 ); if (status != FX_Ok) { if (bombonerror) { DeleteSoundFile (); Error( "%s\n", FX_ErrorString( status ) ); } return (status); } if (stereoreversed == true) { FX_SetReverseStereo(!FX_GetReverseStereo()); } FX_SetCallBack( SD_MakeCacheable ); remotestart=W_GetNumForName("remostrt")+1; SD_Started=true; FX_SetVolume (FXvolume); return (0); } //*************************************************************************** // // SD_SoundOkay - checks to see if the sound is okay // //*************************************************************************** boolean SD_SoundOkay ( int sndnum ) { if (SD_Started==false) return false; if (sndnum>=MAXSOUNDS) Error ("Illegal sound number, sound number = %d\n",sndnum); if (SoundOffset(sndnum)==-1) return false; if ( ( sounds[ sndnum ].flags & SD_PLAYONCE ) && ( SD_SoundActive( sounds[ sndnum ].prevhandle ) ) ) { return false; } return true; } //*************************************************************************** // // SD_PlayIt - Play a pre-setup sound // //*************************************************************************** int SD_PlayIt ( int sndnum, int angle, int distance, int pitch ) { int voice; char * snd; if (!(sounds[sndnum].flags & SD_WRITE)) { if (sounds[sndnum].count) { if (distance<=sounds[sndnum].prevdistance) FX_StopSound(sounds[sndnum].prevhandle); else return 0; } } if ( !FX_VoiceAvailable( sounds[sndnum].priority ) ) { return( 0 ); } sounds[sndnum].count++; snd=W_CacheLumpNum(SoundNumber(sndnum),PU_STATIC, CvtNull, 1); if ( *snd == 'C' ) { voice = FX_PlayVOC3D( snd, pitch, angle, distance, sounds[sndnum].priority, (unsigned long) sndnum ); } else { voice = FX_PlayWAV3D( snd, pitch, angle, distance, sounds[sndnum].priority, (unsigned long) sndnum ); } if ( voice < FX_Ok ) { SD_MakeCacheable( sndnum ); return 0; } NumBadSounds=0; if (!(sounds[sndnum].flags & SD_WRITE)) { sounds[sndnum].prevhandle=voice; sounds[sndnum].prevdistance=distance; } return voice; } //*************************************************************************** // // SD_Play - Play a sample // //*************************************************************************** int SD_Play ( int sndnum ) { int voice; int pitch; if ( SD_SoundOkay ( sndnum ) == false ) return 0; pitch = 0; if ( !( sounds[ sndnum ].flags & SD_PITCHSHIFTOFF ) ) { pitch = PitchOffset(); } voice = SD_PlayIt ( sndnum, 0, 0, pitch ); return voice; } //*************************************************************************** // // SD_Play3D - Play a positioned sample // //*************************************************************************** int SD_Play3D ( int sndnum, int angle, int distance ) { int voice; int pitch; if ( SD_SoundOkay ( sndnum ) == false ) return 0; pitch = 0; if ( !( sounds[ sndnum ].flags & SD_PITCHSHIFTOFF ) ) { pitch = PitchOffset(); } voice = SD_PlayIt ( sndnum, angle, distance, pitch ); return voice; } //*************************************************************************** // // SD_PlayPositionedSound - Play a positioned sample // //*************************************************************************** int SD_PlayPositionedSound ( int sndnum, int px, int py, int x, int y ) { int voice; int angle; int distance; int dx; int dy; int pitch; if ( SD_SoundOkay ( sndnum ) == false ) return 0; dx=(x-px); dy=(py-y); distance=FindDistance(dx,dy) >> SD_DISTANCESHIFT; if (distance>255) return 0; if (distance!=0) { angle = ( atan2_appx(dx,dy) & (FINEANGLES-1) ) >> 6; } else { angle=0; } pitch = 0; if ( !( sounds[ sndnum ].flags & SD_PITCHSHIFTOFF ) ) { pitch = PitchOffset(); } voice = SD_PlayIt ( sndnum, angle, distance, pitch ); return voice; } //*************************************************************************** // // SD_PlaySoundRTP - Play a positioned sample relative to the player // //*************************************************************************** int SD_PlaySoundRTP ( int sndnum, int x, int y ) { int voice; int angle; int distance; int dx; int dy; int pitch; if ( SD_SoundOkay ( sndnum ) == false ) return 0; dx=(x-player->x); dy=(player->y-y); distance=FindDistance(dx,dy) >> SD_DISTANCESHIFT; if (distance>255) return 0; if (distance!=0) { angle = ( (player->angle - atan2_appx(dx,dy)) & (FINEANGLES-1) ) >> 6; } else { angle=0; } pitch = 0; if ( !( sounds[ sndnum ].flags & SD_PITCHSHIFTOFF ) ) { pitch = PitchOffset(); } voice = SD_PlayIt ( sndnum, angle, distance, pitch ); return voice; } //*************************************************************************** // // SD_PlayPitchedSound - Play a pitched sample // //*************************************************************************** int SD_PlayPitchedSound ( int sndnum, int volume, int pitch ) { int voice; int distance; if ( SD_SoundOkay ( sndnum ) == false ) return 0; distance = 255 - volume; voice = SD_PlayIt ( sndnum, 0, distance, pitch ); return voice; } //*************************************************************************** // // SD_SetSoundPitch - sets the pitch of a sound // //*************************************************************************** void SD_SetSoundPitch ( int sndnum, int pitch ) { int status; if (SD_Started==false) return; if (!FX_SoundActive(sndnum)) return; status=FX_SetPitch( sndnum, pitch ); if (status != FX_Ok) { //TODO: This code does nothing. } } //*************************************************************************** // // SD_PanRTP Sound - pan a positioned sample relative to the player // //*************************************************************************** void SD_PanRTP ( int handle, int x, int y ) { int angle; int distance; int dx; int dy; int status; if (SD_Started==false) return; if (!FX_SoundActive(handle)) return; dx=(x-player->x); dy=(player->y-y); distance=FindDistance(dx,dy) >> SD_DISTANCESHIFT; if (distance>255) return; if (distance!=0) { angle = ( (player->angle - atan2_appx(dx,dy)) & (FINEANGLES-1) ) >> 6; } else { angle = 0; } status = FX_Pan3D ( handle, angle, distance ); if (status != FX_Ok) { //TODO: This code does nothing. } } //*************************************************************************** // // SD_SetPan - set the pan of a sample // //*************************************************************************** void SD_SetPan ( int handle, int vol, int left, int right ) { int status; if (SD_Started==false) return; if (!FX_SoundActive(handle)) return; status=FX_SetPan( handle, vol, left, right ); if (status != FX_Ok) { //TODO: This code does nothing. } } //*************************************************************************** // // SD_PanPositioned Sound - pan a positioned sample // //*************************************************************************** void SD_PanPositionedSound ( int handle, int px, int py, int x, int y ) { int angle; int distance; int dx; int dy; int status; if (SD_Started==false) return; if (!FX_SoundActive(handle)) return; dx=(x-px); dy=(py-y); distance=FindDistance(dx,dy) >> SD_DISTANCESHIFT; if (distance>255) return; if (distance!=0) { angle = ( atan2_appx(dx,dy) & (FINEANGLES-1) ) >> 6; } else { angle = 0; } status=FX_Pan3D( handle, angle, distance ); if (status != FX_Ok) { //TODO: This code does nothing. } } //*************************************************************************** // // SD_StopSound - Stop the current sound from playing // //*************************************************************************** void SD_StopSound ( int handle ) { int status; if (SD_Started==false) return; status=FX_StopSound( handle); if (status != FX_Ok) { //TODO: This code does nothing. } } //*************************************************************************** // // SD_StopAllSounds - Stop All the sounds currently playing // //*************************************************************************** void SD_StopAllSounds ( void ) { int status; if (SD_Started==false) return; status=FX_StopAllSounds(); if (status != FX_Ok) { //TODO: This code does nothing. } } //*************************************************************************** // // SD_SoundActive - See if a sound is active // //*************************************************************************** int SD_SoundActive ( int handle ) { if (SD_Started==false) { return false; } else { return (FX_SoundActive(handle)); } } //*************************************************************************** // // SD_WaitSound - wait until a sound has finished // //*************************************************************************** void SD_WaitSound ( int handle ) { int time; IN_ClearKeysDown(); while (FX_SoundActive(handle)!=0) { time=GetTicCount()+1; while (time>GetTicCount()) {} if ((LastScan) || IN_GetMouseButtons()) break; } } //*************************************************************************** // // SD_Shutdown - Shutdown the sound system // //*************************************************************************** void SD_Shutdown (void) { if (SD_Started==false) return; FX_Shutdown(); SD_Started=false; } //*************************************************************************** // // SD_PreCacheSound - PreCache sound // //*************************************************************************** void SD_PreCacheSound ( int num ) { if ( SD_SoundOkay ( num ) == false ) return; PreCacheLump(SoundNumber(num),PU_CACHESOUNDS/*+sounds[num].priority*/,cache_other); } //*************************************************************************** // // SD_PreCacheSoundGroup - PreCache sound group // //*************************************************************************** void SD_PreCacheSoundGroup ( int lo, int hi ) { int i; if (SD_Started==false) return; for (i=lo;i<=hi;i++) SD_PreCacheSound(i); } #if (SHAREWARE == 1) #define MAXSONGS 18 static song_t rottsongs[MAXSONGS] = { { loop_no, song_apogee ,"FANFARE2","Apogee Fanfare"}, { loop_yes, song_title ,"RISE", "Rise"}, { loop_yes, song_menu ,"MMMENU", "MMMenu"}, { loop_yes, song_christmas,"DEADLY", "Deadly Gentlemen"}, { loop_yes, song_elevator,"GOINGUP", "Going up?"}, { loop_yes, song_endlevel,"HOWDIDO", "How'd I do?"}, { loop_yes, song_secretmenu,"FISHPOLK","Fish Polka"}, { loop_yes, song_gameover,"YOUSUCK", "You Suck"}, { loop_yes, song_youwin ,"WATZNEXT","Watz Next?"}, { loop_no, song_gason ,"GAZZ!", "Gazz!"}, { loop_yes, song_level ,"FASTWAY", "Goin' Down The Fast Way"}, { loop_yes, song_level ,"MISTACHE","Mist Ache"}, { loop_yes, song_level ,"OWW", "Oww!!!"}, { loop_yes, song_level ,"SMOKE", "Smoke And Mirrors"}, { loop_yes, song_level ,"SPRAY", "Spray"}, { loop_yes, song_level ,"RUNLIKE", "Run Like Smeg"}, { loop_yes, song_level ,"SMOOTH", "Havana Smooth"}, { loop_yes, song_level ,"CHANT", "Chant"}, }; #else #define MAXSONGS 34 static song_t rottsongs[MAXSONGS] = { { loop_no, song_apogee ,"FANFARE2","Apogee Fanfare"}, { loop_yes, song_title ,"RISE", "Rise"}, { loop_yes, song_menu ,"MMMENU", "MMMenu"}, { loop_yes, song_christmas,"DEADLY", "Deadly Gentlemen"}, { loop_yes, song_elevator,"GOINGUP", "Going up?"}, { loop_yes, song_secretmenu,"FISHPOLK","Fish Polka"}, { loop_yes, song_endlevel,"HOWDIDO", "How'd I do?"}, { loop_yes, song_gameover,"YOUSUCK", "You Suck"}, { loop_yes, song_cinematic2,"WATZNEXT","Watz Next?"}, { loop_no, song_gason ,"GAZZ!", "Gazz!"}, { loop_yes, song_level ,"FASTWAY", "Goin' Down The Fast Way"}, { loop_yes, song_level ,"MISTACHE","Mist Ache"}, { loop_yes, song_level ,"OWW", "Oww!!!"}, { loop_yes, song_level ,"SMOKE", "Smoke And Mirrors"}, { loop_yes, song_level ,"SPRAY", "Spray"}, { loop_yes, song_level ,"RUNLIKE", "Run Like Smeg"}, { loop_yes, song_level ,"SMOOTH", "Havana Smooth"}, { loop_yes, song_level ,"CHANT", "Chant"}, { loop_yes, song_level ,"MEDIEV1A","Funeral of Queen Mary"}, { loop_yes, song_level ,"TASKFORC","Task Force"}, { loop_yes, song_level ,"KISSOFF", "KISS Off"}, { loop_yes, song_level ,"RADAGIO", "Adagio For Strings"}, { loop_yes, song_level ,"SHARDS", "Shards"}, { loop_yes, song_level ,"STAIRS", "I Choose the Stairs"}, { loop_yes, song_level ,"SUCKTHIS","Suck This"}, { loop_yes, song_level ,"EXCALIBR","Excalibur"}, { loop_yes, song_level ,"CCCOOL", "CCCool"}, { loop_yes, song_level ,"WORK_DAY","Work Day"}, { loop_yes, song_level ,"WHERIZIT","Where Iz It?"}, { loop_no, song_bossdie,"BOSSBLOW", "Boss Blow"}, { loop_yes, song_bosssee ,"HELLERO", "Hellero"}, { loop_yes, song_cinematic1,"EVINRUDE","Evin Rude"}, { loop_yes, song_youwin ,"VICTORY", "Victory!"}, { loop_yes, song_dogend ,"HERE_BOY","Here Boy"} }; #endif static byte * currentsong; static int MU_Started=false; static int lastsongnumber=-1; int storedposition=0; //**************************************************************************** // // MU_JukeBoxMenu() // //**************************************************************************** void MU_PlayJukeBoxSong ( int which ) { if ( ( MusicMode > 0 ) && ( MU_Started == true ) ) { SetMenuHeader( rottsongs[ which ].songname ); MU_PlaySong( which ); } } //**************************************************************************** // // MU_JukeBoxMenu() // //**************************************************************************** void MU_JukeBoxRedraw ( void ) { if ( ( MusicMode > 0 ) && ( MU_Started == true ) ) { SetMenuHeader( rottsongs[ lastsongnumber ].songname ); } } //**************************************************************************** // // MU_JukeBoxMenu() // //**************************************************************************** void MU_JukeBoxMenu ( void ) { char *SongNames[ MAXSONGS ]; int i; for( i = 0; i < MAXSONGS; i++ ) { SongNames[ i ] = rottsongs[ i ].songname; } HandleMultiPageCustomMenu( SongNames, MAXSONGS, lastsongnumber, "Jukebox", MU_PlayJukeBoxSong, MU_JukeBoxRedraw, false ); if ( rottsongs[ lastsongnumber ].loopflag == loop_no ) { MU_StartSong(song_level); } } //*************************************************************************** // // MusicStarted - see if the music is started // //*************************************************************************** boolean MusicStarted( void ) { return MU_Started; } //*************************************************************************** // // MU_Startup - Initialize music stuff // //*************************************************************************** int MU_Startup ( boolean bombonerror ) { int status; int card; if (MU_Started==true) { MU_StopSong(); MU_Shutdown(); } if ( ( MusicMode < 0 ) || ( MusicMode >= 11 ) ) { return( 0 ); } card = musicnums[ MusicMode ]; if (card==-1) // Check if it is off return (0); /* Not DOS, no address config needed */ status=MUSIC_Init( card, 0 ); if (status != MUSIC_Ok) { if (bombonerror) { DeleteSoundFile (); Error( "%s\n", MUSIC_ErrorString( status ) ); } else return (status); } currentsong=0; MU_Started=true; MU_SetVolume (MUvolume); return (0); } //*************************************************************************** // // MU_Shutdown - Shutdown the music system // //*************************************************************************** void MU_Shutdown (void) { if (MU_Started==false) return; MUSIC_Shutdown(); MU_Started=false; } //*************************************************************************** // // MU_GetNumForType - returns number of song in rottsongs of specific type // //*************************************************************************** int MU_GetNumForType ( int type ) { int i; for (i=0;i=MAXSONGS) Error("Song number out of range\n"); MU_StopSong(); lastsongnumber=num; lump = W_GetNumForName(rottsongs[num].lumpname); size = W_LumpLength(lump); currentsong=W_CacheLumpNum(lump,PU_STATIC, CvtNull, 1); if (rottsongs[num].loopflag == loop_yes) MUSIC_PlaySongROTT(currentsong,size,MUSIC_LoopSong); else MUSIC_PlaySongROTT(currentsong,size,MUSIC_PlayOnce); MU_SetVolume (MUvolume); } //*************************************************************************** // // MU_StopSong - Play a specific song number // //*************************************************************************** void MU_StopSong ( void ) { if (MU_Started==false) return; MUSIC_StopSong (); if (currentsong) { W_CacheLumpName(rottsongs[lastsongnumber].lumpname,PU_CACHE, CvtNull, 1); currentsong=0; } } //*************************************************************************** // // MU_GetSongNumber - get current song number // //*************************************************************************** int MU_GetSongNumber ( void ) { return lastsongnumber; } //*************************************************************************** // // MU_FadeToSong - Fade to a specific song in a certain time // //*************************************************************************** void MU_FadeToSong ( int num, int time ) { int t; if (MU_Started==false) return; MU_FadeOut(time>>1); while (MU_FadeActive()) { t=GetTicCount(); while (GetTicCount()==t) {} } MU_FadeIn (num,time>>1); } //*************************************************************************** // // MU_FadeIn - Fade in // //*************************************************************************** void MU_FadeIn ( int num, int time ) { if (MU_Started==false) return; MUSIC_SetVolume(0); MU_PlaySong ( num ); MUSIC_FadeVolume (MUvolume, time); } //*************************************************************************** // // MU_FadeOut - Fade out // //*************************************************************************** void MU_FadeOut ( int time ) { if (MU_Started==false) return; if (!MUSIC_SongPlaying()) { return; } MUSIC_FadeVolume(0,time); } //*************************************************************************** // // MU_StartSong - Start a context sensitive song // //*************************************************************************** void MU_StartSong ( int songtype ) { int songnum; if (MU_Started==false) return; MU_StopSong(); songnum = MU_GetNumForType ( songtype ); switch (songtype) { case song_level: if (IsChristmas()) { songnum = MU_GetNumForType ( song_christmas ); } else { songnum += GetSongForLevel (); } break; } MU_PlaySong (songnum); } //*************************************************************************** // // MU_StoreSongPostition - Save off Song Position // //*************************************************************************** void MU_StoreSongPosition ( void ) { if (MU_Started==false) return; PositionStored=true; storedposition=MUSIC_GetPosition(); } //*************************************************************************** // // MU_RestoreSongPostition - Save off Song Position // //*************************************************************************** void MU_RestoreSongPosition ( void ) { if (MU_Started==false) return; if (PositionStored==false) return; PositionStored=false; MUSIC_SetPosition(storedposition); } //*************************************************************************** // // MU_GetStoredPostition - Get Stored song Position // //*************************************************************************** int MU_GetStoredPosition ( void ) { if (PositionStored) return storedposition; else return -1; } //*************************************************************************** // // MU_SetStoredPostition - Get Stored song Position // //*************************************************************************** void MU_SetStoredPosition ( int position ) { if (MU_Started==false) return; if (position==-1) return; PositionStored=true; storedposition=position; } //*************************************************************************** // // MU_GetSongPostition - Get Song Position // //*************************************************************************** int MU_GetSongPosition ( void ) { if (MU_Started==false) return 0; return MUSIC_GetPosition(); } //*************************************************************************** // // MU_SetSongPostition - Set Song Position // //*************************************************************************** void MU_SetSongPosition ( int position ) { if (MU_Started==false) return; MUSIC_SetPosition(position); } //*************************************************************************** // // MU_SaveMusic // //*************************************************************************** void MU_SaveMusic (byte ** buf, int * size) { int unitsize; byte *ptr; int vsize; int i; // // Size // unitsize=0; unitsize+=sizeof(i); unitsize+=sizeof(i); unitsize+=sizeof(i); *size = unitsize; *buf = (byte *) SafeMalloc (*size); ptr = *buf; i=MU_GetSongNumber(); if (rottsongs[i].songtype == song_menu) { i = MU_GetNumForType ( song_level ); if (IsChristmas()) { i = MU_GetNumForType ( song_christmas ); } else { i += GetSongForLevel (); } vsize=sizeof(i); memcpy(ptr,&i,vsize); ptr+=vsize; i=MU_GetStoredPosition(); vsize=sizeof(i); memcpy(ptr,&i,vsize); ptr+=vsize; i=-1; vsize=sizeof(i); memcpy(ptr,&i,vsize); ptr+=vsize; } else { vsize=sizeof(i); memcpy(ptr,&i,vsize); ptr+=vsize; i=MU_GetSongPosition(); vsize=sizeof(i); memcpy(ptr,&i,vsize); ptr+=vsize; i=MU_GetStoredPosition(); vsize=sizeof(i); memcpy(ptr,&i,vsize); ptr+=vsize; } } //*************************************************************************** // // MU_LoadMusic // //*************************************************************************** void MU_LoadMusic (byte * buf, int size) { int unitsize; byte *ptr; int i; int songnumber; boolean differentsong=false; int vsize; // // Size // unitsize=0; unitsize+=sizeof(i); unitsize+=sizeof(i); unitsize+=sizeof(i); if (size!=unitsize) Error("LoadMusic: Different number of parameters\n"); ptr = buf; vsize=sizeof(songnumber); memcpy(&songnumber,ptr,vsize); ptr+=vsize; if (MU_GetSongNumber () != songnumber) { MU_PlaySong(songnumber); differentsong=true; } vsize=sizeof(i); memcpy(&i,ptr,vsize); ptr+=vsize; if (differentsong==true) { MU_SetSongPosition(i); } vsize=sizeof(i); memcpy(&i,ptr,vsize); ptr+=vsize; MU_SetStoredPosition(i); // Check if game was saved with NOSOUND if (MU_GetSongNumber () != songnumber) { MU_StartSong ( song_level ); } } rott-20230810/rott/rt_sound.h000066400000000000000000000412021446517470200157520ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_sound_public #define _rt_sound_public #include "music.h" #include "develop.h" typedef enum { // MENU SOUNDS SD_MENUFLIP, SD_ESCPRESSEDSND, SD_MOVECURSORSND, SD_SELECTSND, SD_WARNINGBOXSND, SD_INFOBOXSND, SD_QUESTIONBOXSND, SD_NOPESND, SD_QUIT1SND, SD_QUIT2SND, SD_QUIT3SND, SD_QUIT4SND, SD_QUIT5SND, SD_QUIT6SND, SD_QUIT7SND, // GAME SOUNDS SD_LEVELSTARTSND, SD_LEVELDONESND, SD_GAMEOVERSND, // LEVEL END SCREEN SD_ENDBONUS1SND, SD_NOBONUSSND, SD_PERCENT100SND, // PLAYER SOUNDS SD_HITWALLSND, SD_SELECTWPNSND, SD_NOWAYSND, SD_DONOTHINGSND, SD_NOITEMSND, SD_PLAYERDYINGSND, SD_PLAYERTCDEATHSND, SD_PLAYERTBDEATHSND, SD_PLAYERDWDEATHSND, SD_PLAYERLNDEATHSND, SD_PLAYERIPFDEATHSND, SD_PLAYERTCHURTSND, SD_PLAYERTBHURTSND, SD_PLAYERDWHURTSND, SD_PLAYERLNHURTSND, SD_PLAYERIPFHURTSND, SD_PLAYERTCSND, SD_PLAYERTBSND, SD_PLAYERDWSND, SD_PLAYERLNSND, SD_PLAYERIPFSND, // SD_WALK1SND, // SD_WALK2SND, SD_PLAYERBURNEDSND, SD_PLAYERLANDSND, SD_PLAYERCOUGHMSND, SD_PLAYERCOUGHFSND, SD_NETWIGGLESND, SD_NETFALLSND, // PLAYER WEAPONS SD_ATKPISTOLSND, SD_ATKTWOPISTOLSND, SD_ATKMP40SND, SD_RICOCHET1SND, SD_RICOCHET2SND, SD_RICOCHET3SND, SD_BAZOOKAFIRESND, SD_FIREBOMBFIRESND, SD_HEATSEEKFIRESND, SD_DRUNKFIRESND, SD_FLAMEWALLFIRESND, SD_FLAMEWALLSND, SD_SPLITFIRESND, SD_SPLITSND, SD_GRAVBUILDSND, SD_GRAVFIRESND, SD_GRAVSND, SD_GRAVHITSND, SD_FIREHITSND, SD_MISSILEFLYSND, SD_MISSILEHITSND, SD_EXCALIBOUNCESND, SD_EXCALISWINGSND, SD_EXCALIHITSND, SD_EXCALIBUILDSND, SD_EXCALIBLASTSND, SD_GODMODEFIRESND, SD_GODMODE1SND, SD_GODMODE2SND, SD_GODMODE3SND, SD_LOSEMODESND, SD_DOGMODEPANTSND, SD_DOGMODEBITE1SND, SD_DOGMODEBITE2SND, SD_DOGMODELICKSND, SD_DOGMODEBLASTSND, SD_DOGMODEPREPBLASTSND, SD_DOGMANSND, SD_DOGWOMANSND, SD_GODMANSND, SD_GODWOMANSND, SD_FLYINGSND, // PLAYER-CAUSED SOUNDS SD_GLASSBREAKSND, SD_ITEMBLOWSND, SD_BONUSBARRELSND, SD_TOUCHPLATESND, SD_BADTOUCHSND, SD_EXPLODEFLOORSND, SD_EXPLODESND, SD_GASSTARTSND, SD_GASHISSSND, SD_GASENDSND, SD_GASMASKSND, // GET ITEM SOUNDS SD_GETKEYSND, SD_GETBONUSSND, SD_GETHEALTH1SND, SD_GETHEALTH2SND, SD_COOKHEALTHSND, SD_GETWEAPONSND, SD_GETKNIFESND, SD_GETGODSND, SD_GETDOGSND, SD_GETFLEETSND, SD_GETELASTSND, SD_GETSHROOMSSND, SD_GETBVESTSND, SD_GETAVESTSND, SD_GETMASKSND, SD_GETBATSND, SD_GETHEADSND, SD_GET1UPSND, SD_GET3UPSND, SD_RESPAWNSND, SD_PLAYERSPAWNSND, // ACTOR SOUNDS SD_LOWGUARD1SEESND, SD_LOWGUARD1ASEESND, SD_LOWGUARD1SEE3SND, SD_LOWGUARD2SEESND, SD_LOWGUARD2ASEESND, SD_LOWGUARD2SEE3SND, SD_LOWGUARDFIRESND, SD_LOWGUARDOUCHSND, SD_LOWGUARD1DIESND, SD_LOWGUARD2DIESND, SD_SNEAKYSPRINGMSND, SD_SNEAKYSPRINGFSND, SD_HIGHGUARD1SEESND, SD_HIGHGUARD2SEESND, SD_HIGHGUARDFIRESND, SD_HIGHGUARDOUCHSND, SD_HIGHGUARDDIESND, SD_OVERP1SEESND, SD_OVERP2SEESND, SD_OVERPFIRESND, SD_OVERPNETSND, SD_OVERPOUCHSND, SD_OVERPDIESND, SD_STRIKE1SEESND, SD_STRIKE2SEESND, SD_STRIKEFIRESND, SD_STRIKEROLLSND, SD_STRIKEOUCHSND, SD_STRIKEDIESND, SD_BLITZ1SEESND, SD_BLITZ2SEESND, SD_BLITZFIRESND, SD_BLITZSTEALSND, SD_BLITZOUCHSND, SD_BLITZDIESND, SD_BLITZPLEADSND, SD_BLITZPLEAD1SND, SD_BLITZPLEAD2SND, SD_ENFORCERSEESND, SD_ENFORCERFIRESND, SD_ENFORCERTHROWSND, SD_ENFORCEROUCHSND, SD_ENFORCERDIESND, SD_MONKSEESND, SD_MONKGRABSND, SD_MONKOUCHSND, SD_MONKDIESND, SD_FIREMONKSEESND, SD_FIREMONKFIRESND, SD_FIREMONKOUCHSND, SD_FIREMONKDIESND, SD_ROBOTSEESND, SD_ROBOTFIRESND, SD_ROBOTDIESND, SD_ROBOTMOVESND, SD_BALLISTIKRAFTSEESND, SD_BALLISTIKRAFTFIRESND, SD_DARIANSEESND, SD_DARIANFIRESND, SD_DARIANGONNAUSESND, SD_DARIANUSESND, SD_DARIANHIDESND, SD_DARIANDIESND, SD_DARIANSAY1, SD_DARIANSAY2, SD_DARIANSAY3, SD_KRISTSEESND, SD_KRISTFIRESND, SD_KRISTMOTORSND, SD_KRISTTURNSND, SD_KRISTDROPSND, SD_KRISTMINEBEEPSND, SD_KRISTMINEHITSND, SD_KRISTDIESND, SD_KRISTSAY1, SD_KRISTSAY2, SD_KRISTSAY3, SD_NMESEESND, SD_NMEREADYSND, SD_NMEFIRE1SND, SD_NMEAPARTSND, SD_NMEUFOSND, SD_NMEDIESND, SD_DARKMONKSEESND, SD_DARKMONKFIRE1SND, SD_DARKMONKFIRE2SND, SD_DARKMONKFIRE3SND, SD_DARKMONKFIRE4SND, SD_DARKMONKRECHARGESND, SD_DARKMONKFLOATSND, SD_DARKMONKDIESND, SD_DARKMONKSAY1, SD_DARKMONKSAY2, SD_DARKMONKSAY3, SD_SNAKESEESND, SD_SNAKEREADYSND, SD_SNAKECHARGESND, SD_SNAKEOUCHSND, SD_SNAKEDIESND, SD_SNAKESPITSND, SD_SNAKESAY1, SD_SNAKESAY2, SD_SNAKESAY3, SD_EMPLACEMENTSEESND, SD_EMPLACEMENTFIRESND, SD_BIGEMPLACEFIRESND, // ENVIRONMENT SOUNDS SD_OPENDOORSND, SD_CLOSEDOORSND, SD_DOORHITSND, SD_FIRECHUTESND, SD_FIREBALLSND, SD_FIREBALLHITSND, SD_BLADESPINSND, SD_PUSHWALLSND, SD_PUSHWALLHITSND, SD_GOWALLSND, SD_TURBOWALLSND, SD_BOULDERHITSND, SD_BOULDERROLLSND, SD_BOULDERFALLSND, SD_PITTRAPSND, SD_FIREJETSND, SD_ACTORSQUISHSND, SD_ACTORBURNEDSND, SD_ACTORSKELETONSND, SD_SPEARSTABSND, SD_CYLINDERMOVESND, SD_ELEVATORONSND, SD_ELEVATORENDSND, SD_SPRINGBOARDSND, SD_LIGHTNINGSND, SD_WINDSND, SD_WATERSND, SD_BODYLANDSND, SD_GIBSPLASHSND, SD_ACTORLANDSND, // SECRET SOUNDS SD_DOPEFISHSND, SD_YOUSUCKSND, SD_SILLYMOVESND, SD_SOUNDSELECTSND, SD_SOUNDESCSND, // REMOTE SOUNDS (shift number row) SD_REMOTEM1SND, SD_REMOTEM2SND, SD_REMOTEM3SND, SD_REMOTEM4SND, SD_REMOTEM5SND, SD_REMOTEM6SND, SD_REMOTEM7SND, SD_REMOTEM8SND, SD_REMOTEM9SND, SD_REMOTEM10SND, SD_LASTSOUND, MAXSOUNDS } game_sounds; typedef enum { // REMOTE SOUNDS (shift number row) D_REMOTEM1SND, D_REMOTEM2SND, D_REMOTEM3SND, D_REMOTEM4SND, D_REMOTEM5SND, D_REMOTEM6SND, D_REMOTEM7SND, D_REMOTEM8SND, D_REMOTEM9SND, D_REMOTEM10SND, } remotesounds; typedef enum { MUSE_MENUFLIPSND, // 0 MUSE_ESCPRESSEDSND, // 1 MUSE_MOVECURSORSND, // 2 MUSE_SELECTSND, // 3 MUSE_WARNINGBOXSND, // 4 MUSE_INFOBOXSND, // 5 MUSE_QUESTIONBOXSND, // 6 MUSE_NOPESND, // 7 MUSE_LEVELSTARTSND, // 8 MUSE_LEVELENDSND, // 9 MUSE_GAMEOVERSND, // 10 MUSE_ENDBONUS1SND, // 11 MUSE_ENDBONUS2SND, // 12 MUSE_NOBONUSSND, // 13 MUSE_PERCENT100SND, // 14 MUSE_HITWALLSND, // 15 MUSE_SELECTWPNSND, // 16 MUSE_NOWAYSND, // 17 MUSE_DONOTHINGSND, // 18 MUSE_NOITEMSND, // 19 MUSE_PLAYERDYINGSND, // 20 MUSE_PLAYERDEATHSND, // 21 MUSE_PLAYERHURTSND, // 22 MUSE_PLAYERYESSND, // 23 MUSE_WALK1SND, // 24 MUSE_WALK2SND, // 25 MUSE_PLAYERLANDSND, // 26 MUSE_NETFALLSND, // 27 MUSE_ATKKNIFESND, // 28 MUSE_ATKPISTOLSND, // 29 MUSE_ATKMP40SND, // 30 MUSE_RICOCHETSND, // 31 MUSE_MISSILEFIRESND, // 32 MUSE_FLAMEWALLSND, // 33 MUSE_MISSILEHITSND, // 34 MUSE_WEAPONBUILDSND, // 35 MUSE_STABBERSND, // 36 MUSE_ENERGYFIRESND, // 37 MUSE_GAINMODESND, // 38 MUSE_LOSEMODESND, // 39 MUSE_DOGLICKSND, // 40 MUSE_DOGBITESND, // 41 MUSE_GLASSBREAKSND, // 42 MUSE_EXPLOSIONSND, // 43 MUSE_TOUCHPLATESND, // 44 MUSE_BADTOUCHSND, // 45 MUSE_SWITCHSND, // 46 MUSE_GETKEYSND, // 47 MUSE_GETBONUSSND, // 48 MUSE_GETHEALTHSND, // 49 MUSE_GETWEAPONSND, // 50 MUSE_GETMWEAPONSND, // 51 MUSE_GETPOWERUPSND, // 52 MUSE_GETPOWERDOWNSND, // 53 MUSE_GETARMORSND, // 54 MUSE_GETWEIRDSND, // 55 MUSE_GETLIFESND, // 56 MUSE_ACTORSEESND, // 57 MUSE_ACTORFIRESND, // 58 MUSE_ACTOROUCHSND, // 59 MUSE_ACTORDIESND, // 60 MUSE_ACTORTHROWSND, // 61 MUSE_ACTORROLLSND, // 62 MUSE_ACTORDOITSND, // 63 MUSE_ACTORUSESND, // 64 MUSE_BOSSSEESND, // 65 MUSE_BOSSOUCHSND, // 66 MUSE_BOSSDIESND, // 67 MUSE_BOSSDOSND, // 68 MUSE_BOSSBEEPSND, // 69 MUSE_BOSSHEYSND, // 70 MUSE_BOSSFIRESND, // 71 MUSE_BOSSWARNSND, // 72 MUSE_BOSSFIRE2SND, // 73 MUSE_EMPFIRESND, // 74 MUSE_OPENDOORSND, // 75 MUSE_CLOSEDOORSND, // 76 MUSE_SPINBLADESND, // 77 MUSE_PUSHWALLSND, // 78 MUSE_BOULDERSND, // 79 MUSE_PITTRAPSND, // 80 MUSE_FIREJETSND, // 81 MUSE_ACTORSQUISHSND, // 82 MUSE_CYLINDERHITSND, // 83 MUSE_ELEVATORSND, // 84 MUSE_SPRINGBOARDSND, // 85 MUSE_LASTSOUND=-1 } musesounds; #define NUMCARDS 6 typedef enum { fx_digital, fx_muse } fxtypes; typedef enum { ASS_UltraSound, ASS_SoundBlaster, ASS_SoundMan16, ASS_PAS, ASS_AWE32, ASS_SoundScape, ASS_WaveBlaster, ASS_Adlib, ASS_GeneralMidi, ASS_SoundCanvas, ASS_SoundSource, ASS_TandySoundSource, ASS_PCSpeaker, ASS_Off } ASSTypes; extern int SD_Started; int SD_SetupFXCard ( int * numvoices, int * numbits, int * numchannels); int SD_Startup ( boolean bombonerror ); int SD_Play ( int sndnum ); void SD_Shutdown (void); int SD_PlayPositionedSound ( int sndnum, int px, int py, int x, int y ); int SD_PlaySoundRTP ( int sndnum, int x, int y ); void SD_PanPositionedSound ( int handle, int px, int py, int x, int y ); void SD_PanRTP ( int handle, int x, int y ); void SD_SetPan ( int handle, int vol, int left, int right ); int SD_Play3D ( int sndnum, int angle, int distance ); int SD_PlayPitchedSound ( int sndnum, int volume, int pitch ); void SD_SetSoundPitch ( int sndnum, int pitch ); boolean SD_SoundOkay ( int sndnum ); //*************************************************************************** // // SD_WaitSound - wait until a sound has finished // //*************************************************************************** void SD_WaitSound ( int handle ); //*************************************************************************** // // SD_StopSound // //*************************************************************************** void SD_StopSound ( int handle ); //*************************************************************************** // // SD_SoundActive // //*************************************************************************** int SD_SoundActive ( int handle ); //*************************************************************************** // // SD_StopAllSounds // //*************************************************************************** void SD_StopAllSounds ( void ); typedef enum { song_gason, song_bosssee, song_bossdie, song_endlevel, song_dogend, song_title, song_apogee, song_youwin, song_level, song_elevator, song_secretmenu, song_cinematic1, song_cinematic2, song_cinematic3, song_gameover, song_christmas, song_snakechase, song_menu } songtypes; void MU_Shutdown ( void ); int MU_Startup ( boolean bombonerror ); void MU_PlaySong ( int num ); void MU_StopSong ( void ); //*************************************************************************** // // MU_Continue // //*************************************************************************** #define MU_Continue() MUSIC_Continue() //*************************************************************************** // // MU_Pause // //*************************************************************************** #define MU_Pause() MUSIC_Pause() //*************************************************************************** // // MU_GetVolume // //*************************************************************************** #define MU_GetVolume() MUSIC_GetVolume() //*************************************************************************** // // MU_SetVolume // //*************************************************************************** #define MU_SetVolume(x) MUSIC_SetVolume(x) //*************************************************************************** // // MU_SongPlaying // //*************************************************************************** #define MU_SongPlaying() MUSIC_SongPlaying() //*************************************************************************** // // MU_FadeVolume // //*************************************************************************** #define MU_FadeVolume(v,m) MUSIC_FadeVolume(v,m) //*************************************************************************** // // MU_FadeActive // //*************************************************************************** #define MU_FadeActive() MUSIC_FadeActive() //*************************************************************************** // // MU_StopFade // //*************************************************************************** #define MU_StopFade() MUSIC_StopFade() //*************************************************************************** // // MU_FadeIn // //*************************************************************************** void MU_FadeIn ( int num, int time ); //*************************************************************************** // // MU_FadeOut // //*************************************************************************** void MU_FadeOut ( int time ); //*************************************************************************** // // MU_FadeToSong // //*************************************************************************** void MU_FadeToSong ( int num, int time ); //*************************************************************************** // // SD_PreCacheSoundGroup // //*************************************************************************** void SD_PreCacheSoundGroup ( int lo, int hi ); //*************************************************************************** // // SD_PreCacheSound // //*************************************************************************** void SD_PreCacheSound ( int num ); void MU_StartSong ( int songtype ); void MU_JukeBoxMenu( void ); void MU_StoreSongPosition ( void ); void MU_RestoreSongPosition ( void ); int MU_GetSongPosition ( void ); void MU_SetSongPosition ( int position ); int MU_GetSongNumber ( void ); int MU_GetNumForType ( int songtype ); int MU_GetStoredPosition ( void ); void MU_SetStoredPosition ( int position ); void MU_LoadMusic (byte * buf, int size); void MU_SaveMusic (byte ** buf, int * size); boolean MusicStarted( void ); #endif rott-20230810/rott/rt_sqrt.c000066400000000000000000000025161446517470200156130ustar00rootroot00000000000000#include "rt_def.h" #include "rt_sqrt.h" /* C version of fixed-point Square Root functions */ long FixedSqrtLP(long n) // Low Precision (8.8) { /* Not used, so unimplemented. If it matters, just copy the first half of the HP version, and multiply the answer by 256. */ STUB_FUNCTION; return 0; } long FixedSqrtHP(long n) // High Precision (8.16) { /* This is more or less a direct C transliteration of the asm code. I've replaced right shifting with division, since right shifting signed values is undefined in ANSI C (though it usually works). ROTT does not use this routine heavily. */ unsigned long root, mask, val; signed long d; root = 0; mask = 0x40000000; val = (unsigned long)n; hp1: d = val; d -= mask; if (d < 0) goto hp2; d -= root; if (d < 0) goto hp2; val = d; root /= 2; root |= mask; mask /= 4; if (mask != 0) goto hp1; else goto hp5; hp2: root /= 2; mask /= 4; if (mask != 0) goto hp1; hp5: mask = 0x00004000; root <<= 16; val <<= 16; hp3: /* use add here to properly emulate the asm - SBF */ if ((root+mask) > val) goto hp4; val -= (root+mask); root /= 2; root |= mask; mask /= 4; if (mask != 0) goto hp3; else goto hp6; hp4: root /= 2; mask /= 4; if (mask != 0) goto hp3; hp6: return (long)root; } rott-20230810/rott/rt_sqrt.h000066400000000000000000000023641446517470200156210ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_sqrt_public #define _rt_sqrt_public /* FUNCTION: Fixed32 FixedSqrtHP(Fixed32 n); DESCRIPTION: This does a high-precision square root of a Fixed32. It has 8.16 bit accuracy. For more speed use FixedSqrtLP(). FUNCTION: Fixed32 FixedSqrtLP(Fixed32 n); DESCRIPTION: This does a low-precision square root of a Fixed32. It has 8.8 bit accuracy. For more accuracy use FixedSqrtHP(). */ long FixedSqrtLP(long n); // Low Precision (8.8) long FixedSqrtHP(long n); // High Precision (8.16) #endif rott-20230810/rott/rt_stat.c000066400000000000000000001323651446517470200156030ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include #include "sprites.h" #include #include #include "rt_stat.h" #include "z_zone.h" #include "lumpy.h" #include "rt_util.h" #include "rt_draw.h" #include "rt_ted.h" #include "rt_door.h" #include "rt_main.h" #include "w_wad.h" #include "rt_main.h" #include "rt_rand.h" #include "rt_menu.h" #include "rt_sound.h" #include "_rt_stat.h" #include "rt_net.h" #include "rt_view.h" #include "isr.h" /* ============================================================================= Global Variables GLOBAL VARIABLES ============================================================================= */ statobj_t *firstactivestat,*lastactivestat; statobj_t *firstemptystat,*lastemptystat; wall_t switches[MAXSWITCHES],*lastswitch; respawn_t *firstrespawn,*lastrespawn; statobj_t *FIRSTSTAT,*LASTSTAT,*sprites[MAPSIZE][MAPSIZE]; animwall_t animwalls[MAXANIMWALLS]; dirtype opposite[9] = {west,southwest,south,southeast,east,northeast,north,northwest,nodir}; statinfo stats[NUMSTATS] = { {0,SPR0_YLIGHT, stat_ylight,FL_LIGHT|FL_SHOOTABLE,0,0,2,0,0}, {0,SPR1_RLIGHT, stat_rlight,FL_LIGHT|FL_SHOOTABLE,0,0,2,0,0}, {0,SPR2_GLIGHT, stat_glight,FL_LIGHT|FL_SHOOTABLE,0,0,2,0,0}, {0,SPR3_BLIGHT, stat_blight,FL_LIGHT|FL_SHOOTABLE,0,0,2,0,0}, {0,SPR4_CHAND, stat_chandelier,FL_LIGHT|FL_SHOOTABLE,0,0,2,0,0}, {0,SPR5_LAMPOFF, stat_lamp,FL_LIGHT|FL_BLOCK|FL_SHOOTABLE,0,0,2,0,0}, {0,SPR73_GKEY1, stat_pedgoldkey,FL_COLORED|FL_BONUS|FL_CHANGES|FL_BLOCK|FL_ACTIVE,2,16,pc_orange,0,0}, {0,SPR73_GKEY1,stat_pedsilverkey,FL_COLORED|FL_BONUS|FL_CHANGES|FL_BLOCK|FL_ACTIVE,2,16,pc_gray,0,0}, {0,SPR73_GKEY1, stat_pedironkey,FL_COLORED|FL_BONUS|FL_CHANGES|FL_BLOCK|FL_ACTIVE,2,16,pc_olive,0,0}, {0,SPR73_GKEY1,stat_pedcrystalkey,FL_COLORED|FL_BONUS|FL_CHANGES|FL_BLOCK|FL_ACTIVE,2,16,pc_red,0,0}, {0,SPR6_GIBS1, stat_gibs1,0,0,0,0,0,0}, {0,SPR7_GIBS2, stat_gibs2,0,0,0,0,0,0}, {0,SPR8_GIBS3, stat_gibs3,0,0,0,0,0,0}, {0,SPR9_MONKMEAL, stat_monkmeal,FL_BONUS|FL_RESPAWN,0,0,0,0,0}, {0,PORRIDGE1, stat_priestporridge,FL_BONUS|FL_RESPAWN,2,6,0,0,0}, {0,MONKCRYSTAL11,stat_monkcrystal1,FL_BONUS|FL_ACTIVE|FL_RESPAWN,2,6,0,0,0}, {0,MONKCRYSTAL21,stat_monkcrystal2,FL_BONUS|FL_ACTIVE|FL_RESPAWN,2,7,0,0,0}, {0,ONEUP01,stat_oneup,FL_BONUS|FL_ACTIVE|FL_FULLLIGHT,2,8,0,0,0}, {0,THREEUP01,stat_threeup,FL_BONUS|FL_ACTIVE|FL_FULLLIGHT,2,8,0,0,0}, {0,TORCH1,stat_altbrazier1,FL_HEAT|FL_BLOCK|FL_ACTIVE|FL_LIGHT|FL_SHOOTABLE,2,15,2,0,0}, {0,SPR_ABRAZIER2,stat_altbrazier2,FL_HEAT|FL_BLOCK|FL_LIGHT|FL_SHOOTABLE,0,0,2,0,0}, {0,FBASIN1,stat_healingbasin,FL_BONUS|FL_CHANGES|FL_ACTIVE|FL_BLOCK,2,3,0,0,0}, {20,EBASIN,stat_emptybasin,FL_BLOCK|FL_SHOOTABLE,0,0,0,0,0}, {0,BAT1,stat_bat,FL_BONUS|FL_ACTIVE|FL_RESPAWN|FL_WEAPON,1,16,0,0,10}, {0,KNIFE_STATUE1,stat_knifestatue,FL_BONUS|FL_CHANGES|FL_BLOCK,0,0,0,0,0}, {0,SPR_TWOPIST,stat_twopistol,FL_BONUS|FL_RESPAWN|FL_WEAPON,0,0,0,0,5}, {0,SPR_MP40,stat_mp40,FL_BONUS|FL_RESPAWN|FL_WEAPON,0,0,0,0,5}, {0,SPR_BAZOOKA,stat_bazooka,FL_BONUS|FL_RESPAWN|FL_WEAPON,0,0,0,0,10}, {0,SPR_FIREBOMB,stat_firebomb,FL_BONUS|FL_RESPAWN|FL_WEAPON,0,0,0,0,5}, {0,SPR_HEATSEEK,stat_heatseeker,FL_BONUS|FL_RESPAWN|FL_WEAPON,0,0,0,0,7}, {0,SPR_DRUNK,stat_drunkmissile,FL_BONUS|FL_RESPAWN|FL_WEAPON,0,0,0,0,7}, {0,SPR_FIREWALL,stat_firewall,FL_BONUS|FL_RESPAWN|FL_WEAPON,0,0,0,0,5}, {0,SPR_SPLIT,stat_splitmissile,FL_BONUS|FL_RESPAWN|FL_WEAPON,0,0,0,0,7}, {0,SPR_KES,stat_kes,FL_BONUS|FL_RESPAWN|FL_WEAPON,0,0,0,0,7}, {0,LIFEITEMA01,stat_lifeitem1,FL_BONUS|FL_ACTIVE|FL_SHOOTABLE|FL_FULLLIGHT,2,8, 2,0,0}, {0,LIFEITEMB01,stat_lifeitem2,FL_BONUS|FL_ACTIVE|FL_SHOOTABLE|FL_FULLLIGHT,2,8, 2,0,0}, {0,LIFEITEMD01,stat_lifeitem3,FL_BONUS|FL_ACTIVE|FL_SHOOTABLE|FL_FULLLIGHT,2,8, 2,0,0}, {0,LIFEITEMC01,stat_lifeitem4,FL_BONUS|FL_ACTIVE|FL_SHOOTABLE|FL_FULLLIGHT,2,15, 2,0,0}, {24,SPR32_EXPLOS,stat_tntcrate,FL_SHOOTABLE|FL_BLOCK|FL_WOODEN,0,0,3,10,0}, {12,SPR33_CBARREL,stat_bonusbarrel,FL_METALLIC|FL_SHOOTABLE|FL_BLOCK,0,0,3,10,0}, {0,TORCH1,stat_torch,FL_BLOCK|FL_LIGHT|FL_ACTIVE|FL_HEAT|FL_SHOOTABLE,2,15,2,0,0}, {30,FFLAME1,stat_floorfire,FL_HEAT|FL_BLOCK|FL_LIGHT|FL_ACTIVE|FL_SHOOTABLE,2,7,30,0,0}, {0,DIP11,stat_dipball1,FL_BONUS|FL_FULLLIGHT,0,0,0,0,0}, {0,DIP21,stat_dipball2,FL_BONUS|FL_FULLLIGHT,0,0,0,0,0}, {0,DIP31,stat_dipball3,FL_BONUS|FL_FULLLIGHT,0,0,0,0,0}, {0,SPR34_TOUCH1,stat_touch1,0|FL_TRANSLUCENT|FL_FADING,0,0,0,0,0}, {0,SPR35_TOUCH2,stat_touch2,0|FL_TRANSLUCENT|FL_FADING,0,0,0,0,0}, {0,SPR36_TOUCH3,stat_touch3,0|FL_TRANSLUCENT|FL_FADING,0,0,0,0,0}, {0,SPR37_TOUCH4,stat_touch4,0|FL_TRANSLUCENT|FL_FADING,0,0,0,0,0}, {20,SPR62_ETOUCH1,stat_dariantouch,FL_METALLIC|FL_BANDF|FL_SHOOTABLE|FL_BLOCK,10,3,50,0,0}, {0,SCOTHEAD1, stat_scotthead,FL_BONUS|FL_ACTIVE|FL_FULLLIGHT,4,7,0,0,0}, {0,SPR38_GARBAGE1,stat_garb1,0,0,0,0,0,0}, {0,SPR39_GARBAGE2,stat_garb2,0,0,0,0,0,0}, {0,SPR40_GARBAGE3,stat_garb3,0,0,0,0,0,0}, {0,SPR41_SHIT,stat_shit,0,0,0,0,0,0}, {0,SPR42_GRATE,stat_grate,0,0,0,0,0,0}, {0,SPR43_MSHARDS,stat_metalshards,0,0,0,0,0,0}, {20,SPR44_PEDESTAL,stat_emptypedestal,FL_BLOCK|FL_SHOOTABLE|FL_WOODEN,0,0,60,0,0}, {20,SPR45_ETABLE,stat_emptytable,FL_BLOCK|FL_SHOOTABLE|FL_WOODEN,0,0,100,0,0}, {16,SPR46_STOOL,stat_stool,FL_BLOCK|FL_SHOOTABLE|FL_WOODEN,0,0,25,0,0}, {0,SPR_PUSHCOLUMN1,stat_bcolumn,FL_BLOCK|FL_HEIGHTFLIPPABLE,0,0,0,0,0}, {0,SPR_PUSHCOLUMN1,stat_gcolumn,FL_BLOCK|FL_HEIGHTFLIPPABLE,0,0,0,0,0}, {0,SPR_PUSHCOLUMN1,stat_icolumn,FL_BLOCK|FL_HEIGHTFLIPPABLE,0,0,0,0,0}, {20,SPR50_TREE,stat_tree,FL_SHOOTABLE|FL_BLOCK,0,0,0,0,0}, {20,SPR51_PLANT,stat_plant,FL_SHOOTABLE|FL_BLOCK,0,0,0,0,0}, {20,BLUEVASE,stat_urn,FL_SHOOTABLE|FL_BLOCK,0,0,0,0,0}, {0,SPR54_HAY,stat_haystack,FL_SHOOTABLE|FL_BLOCK,0,0,20,0,0}, {12,SPR55_IBARREL,stat_ironbarrel,FL_METALLIC|FL_BLOCK|FL_SHOOTABLE,0,0,50,0,0}, {0,HGRATE1,stat_heatgrate,FL_LIGHT|FL_ACTIVE,2,4,0,5,0}, {-10,STNPOLE1,stat_standardpole,FL_SHOOTABLE|FL_BLOCK,0,0,25,0,0}, {0,PREPIT,stat_pit,FL_CHANGES,0,0,0,0,0}, {0,GODPOWERUP1,stat_godmode,FL_WEAPON|FL_BONUS|FL_ACTIVE|FL_RESPAWN|FL_FULLLIGHT,2,8,0,0,0}, {0,DOGPOWERUP1,stat_dogmode,FL_WEAPON|FL_BONUS|FL_ACTIVE|FL_RESPAWN|FL_FULLLIGHT,2,8,0,0,0}, {0,FLEETFEETPOWERUP1,stat_fleetfeet,FL_BONUS|FL_ACTIVE|FL_RESPAWN|FL_FULLLIGHT,2,8,0,0,0}, {0,ELASTICPOWERUP1, stat_elastic, FL_BONUS|FL_ACTIVE|FL_RESPAWN|FL_FULLLIGHT,2,8,0,0,0}, {0,MUSHROOMPOWERUP1, stat_mushroom, FL_BONUS|FL_ACTIVE|FL_RESPAWN|FL_FULLLIGHT,2,8,0,0,0}, {0,GASMASKPOWERUP, stat_gasmask, FL_BONUS|FL_RESPAWN,0,0,0,0,0}, {0,BULLETPROOFPOWERUP, stat_bulletproof, FL_BONUS|FL_RESPAWN,0,0,0,0,0}, {0,ASBESTOSPOWERUP, stat_asbesto, FL_BONUS|FL_RESPAWN,0,0,0,0,0}, {0,RANDOMPOWERUP1, stat_random, FL_BONUS|FL_ACTIVE|FL_RESPAWN,2,8,0,0,0}, {0,RUBBLE1, stat_rubble, FL_ACTIVE,2,10,0,0,0}, {0,WOODFRAG1, stat_woodfrag, FL_ACTIVE,2,14,0,0,0}, {0,ROBOGRDDIE1, stat_metalfrag, FL_ACTIVE,2,10,0,0,0}, {0,EMPTY_STATUE1,stat_emptystatue,FL_BLOCK|FL_SHOOTABLE,0,0,50,0,0}, {16,TOMLARVA1,stat_tomlarva,FL_ACTIVE|FL_SHOOTABLE|FL_BLOCK,2,4,150,0,0}, {0,BULLETHOLE,stat_bullethole,FL_TRANSLUCENT,0,0,0,0,0}, //MED #if (SHAREWARE == 1) {0,COLLECTOR1,stat_collector,FL_ACTIVE|FL_BONUS,2,8,-1,0,0}, #else {0,DOPE1,stat_collector,FL_ACTIVE|FL_BONUS,2,8,-1,0,0}, #endif {0,SPR_MINE1,stat_mine,FL_BONUS|FL_SHOOTABLE|FL_RESPAWN,0,0,10,0,0}, {0,MISSMOKE1,stat_missmoke,FL_ACTIVE,6,4,0,0,0}, {0,PLATFORM1,stat_disk,FL_BLOCK|FL_HEIGHTFLIPPABLE,0,0,0,0,0}, {-1,0,0,0,0,0,0,0,0} }; dirtype diagonal[9][9] = { /* east */ {nodir,nodir,northeast,nodir,nodir,nodir,southeast,nodir,nodir}, {nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir}, /* north */ {northeast,nodir,nodir,nodir,northwest,nodir,nodir,nodir,nodir}, {nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir}, /* west */ {nodir,nodir,northwest,nodir,nodir,nodir,southwest,nodir,nodir}, {nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir}, /* south */ {southeast,nodir,nodir,nodir,southwest,nodir,nodir,nodir,nodir}, {nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir}, {nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir,nodir} }; /* ============================================================================= Local Variables GLOBAL VARIABLES ============================================================================= */ static awallinfo_t animwallsinfo[MAXANIMWALLS] = {{3,4,"FPLACE1\0"}, //lava wall {3,6,"ANIMY1\0"}, //anim red {3,6,"ANIMR1\0"}, //anim yellow {40,4,"ANIMFAC1\0"}, //anim face {3,4,"ANIMONE1\0"}, //anim one {3,4,"ANIMTWO1\0"}, //anim two {3,4,"ANIMTHR1\0"}, //anim three {3,4,"ANIMFOR1\0"}, //anim four {3,6,"ANIMGW1\0"}, //anim grey water {3,6,"ANIMYOU1\0"}, //anim you do not belong {3,6,"ANIMBW1\0"}, //anim brown water {3,6,"ANIMBP1\0"}, //anim brown piston {3,6,"ANIMCHN1\0"}, //anim chain {3,6,"ANIMFW1\0"}, //anim firewall {3,6,"ANIMLAT1\0"}, //anim little blips {3,6,"ANIMST1\0"}, //anim light streams left {3,6,"ANIMRP1\0"}};//anim light streams right int statcount; void AddRespawnStatic(respawn_t*stat); void DoLights (int tilex, int tiley); void AddToFreeStaticList(statobj_t*stat) { if (!firstemptystat) firstemptystat = stat; else {stat->statprev = lastemptystat; lastemptystat->statnext = stat; } lastemptystat = stat; } void RemoveFromFreeStaticList(statobj_t*stat) { if (stat == lastemptystat) lastemptystat = stat->statprev; else stat->statnext->statprev = stat->statprev; if (stat == firstemptystat) firstemptystat = stat->statnext; else stat->statprev->statnext = stat->statnext; stat->statprev = NULL; stat->statnext = NULL; } /* =============== = = MakeStatActive = =============== */ void MakeStatActive(statobj_t*x) {if (!firstactivestat) firstactivestat = x; else {x->prevactive = lastactivestat; lastactivestat->nextactive = x; } lastactivestat = x; } /* =============== = = MakeStatInactive = =============== */ void MakeStatInactive(statobj_t*stat) { if (stat == lastactivestat) lastactivestat = stat->prevactive; else stat->nextactive->prevactive = stat->prevactive; if (stat == firstactivestat) firstactivestat = stat->nextactive; else stat->prevactive->nextactive = stat->nextactive; stat->prevactive = NULL; stat->nextactive = NULL; } /* =============== = = AddStatic = =============== */ void AddStatic(statobj_t *stat) {if (FIRSTSTAT) {stat->statprev = LASTSTAT; LASTSTAT->statnext = stat; } else FIRSTSTAT = stat; LASTSTAT = stat; } void RemoveStatic(statobj_t*stat) { if (stat->flags & FL_ABP) //remove from active list MakeStatInactive(stat); if (stat == LASTSTAT) // remove from master list LASTSTAT = stat->statprev; else stat->statnext->statprev = stat->statprev; if (stat == FIRSTSTAT) FIRSTSTAT = stat->statnext; else stat->statprev->statnext = stat->statnext; stat->statprev = NULL; stat->statnext = NULL; if (stat->flags & FL_WEAPON) MISCVARS->NUMWEAPONS --; if ((stat->flags & FL_RESPAWN) && gamestate.BattleOptions.RespawnItems && (!((stat->flags & FL_WEAPON ) && (gamestate.BattleOptions.WeaponPersistence) ) ) ) { respawn_t*temp; // if ( !( (stat->flags & FL_WEAPON) && // (MISCVARS->NUMWEAPONS >= (numplayers+10)) // ) // ) { temp = (respawn_t*)Z_LevelMalloc(sizeof(respawn_t),PU_LEVELSTRUCT,NULL); memset (temp,0,sizeof(*temp)); temp->ticcount = GetRespawnTimeForItem(stat->itemnumber); temp->tilex = stat->tilex; temp->tiley = stat->tiley; temp->itemnumber = stat->itemnumber; temp->spawnz = stat->z; temp->linked_to = stat->linked_to; //SoftError("\nrespawn obj created for stattype %d with z = %d",stat->itemnumber,temp->spawnz); AddRespawnStatic(temp); } } //Z_Free(stat); AddToFreeStaticList(stat); //Add_To_Delete_Array(stat); statcount --; } void RemoveRespawnStatic(respawn_t*stat) { if (stat == lastrespawn) lastrespawn = stat->prev; else stat->next->prev = stat->prev; if (stat == firstrespawn) firstrespawn = stat->next; else stat->prev->next = stat->next; stat->prev = NULL; stat->next = NULL; Z_Free(stat); } void TurnOffLight(int tilex,int tiley) { DoLights(tilex,tiley); LightsInArea[MAPSPOT(tilex,tiley,0)-AREATILE]--; } void ActivateLight(intptr_t light) {statobj_t*tstat; tstat = (statobj_t*)light; tstat->shapenum ++; tstat->flags |= FL_LIGHTON; TurnOnLight(tstat->tilex,tstat->tiley); } void DeactivateLight(intptr_t light) {statobj_t*tstat; tstat = (statobj_t*)light; tstat->shapenum --; tstat->flags &= ~(FL_LIGHTON); TurnOffLight(tstat->tilex,tstat->tiley); } void TurnOnLight(int i,int j) { LightsInArea[MAPSPOT(i,j,0)-AREATILE]++; if (lightsource==0) return; if ((!(tilemap[i+1][j])) && (!(tilemap[i-1][j]))) { SetLight(i,j,0xcdeffedc); SetLight(i+1,j,0x135789ab); SetLight(i-1,j,0xba987351); SetLight(i,j+1,0xcdeffedc); SetLight(i,j-1,0xcdeffedc); SetLight(i-1,j-1,0xba987351); SetLight(i+1,j+1,0xba987351); SetLight(i+1,j-1,0x135789ab); SetLight(i-1,j+1,0x135789ab); } else if ((!(tilemap[i][j+1])) && (!(tilemap[i][j-1]))) { SetLight(i,j,0xcdeffedc); SetLight(i+1,j,0xcdeffedc); SetLight(i-1,j,0xcdeffedc); SetLight(i,j+1,0x135789ab); SetLight(i,j-1,0xba987531); SetLight(i-1,j-1,0x135789ab); SetLight(i+1,j-1,0xba987531); SetLight(i+1,j+1,0x135789ab); SetLight(i-1,j+1,0xba987531); } // | //__| else if ((tilemap[i][j+1]) && (tilemap[i+1][j])) { SetLight(i,j,0xcdeffedc); SetLight(i+1,j,0xcdeffedc); SetLight(i-1,j,0xcdeffedc); SetLight(i,j+1,0xcdeffedc); SetLight(i,j-1,0xcdeffedc); SetLight(i-1,j-1,0xba987351); SetLight(i+1,j-1,0xba987351); SetLight(i+1,j+1,0xba987351); SetLight(i-1,j+1,0x135789ab); } //| //|_ else if ((tilemap[i][j+1]) && (tilemap[i-1][j])) { SetLight(i,j,0xcdeffedc); SetLight(i+1,j,0xcdeffedc); SetLight(i-1,j,0xcdeffedc); SetLight(i,j+1,0xcdeffedc); SetLight(i,j-1,0xcdeffedc); SetLight(i-1,j-1,0x135789ab); SetLight(i+1,j-1,0xba987531); SetLight(i+1,j+1,0xba987531); SetLight(i-1,j+1,0xba987531); } //_ // | else if ((tilemap[i][j-1]) && (tilemap[i+1][j])) { SetLight(i,j,0xcdeffedc); SetLight(i+1,j,0xcdeffedc); SetLight(i-1,j,0xcdeffedc); SetLight(i,j+1,0xcdeffedc); SetLight(i,j-1,0xcdeffedc); SetLight(i-1,j-1,0xba987531); SetLight(i+1,j-1,0x135789ab); SetLight(i+1,j+1,0x135789ab); SetLight(i-1,j+1,0xba987531); } //__ //| else if ((tilemap[i][j-1]) && (tilemap[i-1][j])) { SetLight(i,j,0xcdeffedc); SetLight(i+1,j,0xcdeffedc); SetLight(i-1,j,0xcdeffedc); SetLight(i,j+1,0xcdeffedc); SetLight(i,j-1,0xcdeffedc); SetLight(i-1,j-1,0x135789ab); SetLight(i+1,j-1,0x135789ab); SetLight(i+1,j+1,0xba987531); SetLight(i-1,j+1,0xba987531); } else if (tilemap[i][j]) { SetLight(i,j,0x58bffb85); } else { SetLight(i,j,0xcdeffedc); SetLight(i+1,j,0xba987654); SetLight(i-1,j,0x456789ab); SetLight(i,j+1,0xba987654); SetLight(i,j-1,0x456789ab); SetLight(i-1,j+1,0x33322211); SetLight(i+1,j+1,0x33322211); SetLight(i+1,j-1,0x11222333); SetLight(i-1,j-1,0x11222333); } } /*=============== = = AddRespawnStatic = =============== */ void AddRespawnStatic(respawn_t*stat) { if (firstrespawn) {stat->prev = lastrespawn; lastrespawn->next = stat; } else firstrespawn = stat; lastrespawn = stat; } /* =============== = = InitStaticList = =============== */ void InitStaticList (void) { FIRSTSTAT = NULL; LASTSTAT = NULL; lastactivestat = NULL; firstactivestat = NULL; firstrespawn = NULL; lastrespawn = NULL; lastemptystat = NULL; firstemptystat = NULL; memset(&BulletHoles[0],0,sizeof(BulletHoles)); MISCVARS->BulletHoleNum = 0; memset(sprites,0,sizeof(sprites)); if (loadedgame==false) { memset(switches,0,sizeof(switches)); lastswitch = &switches[0]; } statcount = 0; } /* =============== = = InitAnimatedWallList = =============== */ void InitAnimatedWallList(void) { int i; for (i=0;iactive=1; aw->ticcount=animwallsinfo[which].tictime; aw->count = 1; texture=W_GetNumForName(animwallsinfo[which].firstlump); aw->basetexture=texture; aw->texture=texture; for (i=aw->basetexture;ibasetexture+animwallsinfo[which].numanims;i++) PreCacheLump(i,PU_CACHEWALLS,cache_pic_t); } /* =============== = = SaveStatics = =============== */ void SaveStatics (byte **buffer, int * size) {statobj_t * temp; saved_stat_type dummy; byte * tptr; int count; if (statcount==0) { *size=0; *buffer=SafeMalloc(16); return; } *size = statcount*sizeof(saved_stat_type); *buffer = (byte *)SafeMalloc(*size); tptr = *buffer; for(count=0,temp=FIRSTSTAT;temp;temp=temp->statnext) {dummy.x = temp->x; dummy.y = temp->y; dummy.z = temp->z; dummy.flags = temp->flags; dummy.ticcount = temp->ticcount; dummy.hitpoints = temp->hitpoints; dummy.shapenum = temp->shapenum; dummy.ammo = temp->ammo; dummy.count = temp->count; dummy.numanims = temp->numanims; dummy.itemnumber = temp->itemnumber; dummy.areanumber = temp->areanumber; temp->whichstat = count; dummy.whichstat = count++; dummy.linked_to = temp->linked_to; memcpy(tptr,&(dummy.x),sizeof(saved_stat_type)); tptr += sizeof(saved_stat_type); } } /* =============== = = DoLights = =============== */ void DoLights (int tilex, int tiley) { if (lightsource==0) return; if (TurnOffLight0 (tilex, tiley)) LightSourceAt(tilex,tiley) = 0; if (TurnOffLight1 (tilex, tiley, -1, -1)) LightSourceAt(tilex-1,tiley-1) = 0; if (TurnOffLight2 (tilex, tiley, -1)) LightSourceAt(tilex,tiley-1) = 0; if (TurnOffLight1 (tilex, tiley, 1, -1)) LightSourceAt(tilex+1,tiley-1) = 0; if (TurnOffLight3 (tilex, tiley, 1)) LightSourceAt(tilex+1,tiley) = 0; if (TurnOffLight1 (tilex, tiley, 1, 1)) LightSourceAt(tilex+1,tiley+1) = 0; if (TurnOffLight2 (tilex, tiley, 1)) LightSourceAt(tilex,tiley+1) = 0; if (TurnOffLight1 (tilex, tiley, -1, 1)) LightSourceAt(tilex-1,tiley+1) = 0; if (TurnOffLight3 (tilex, tiley, -1)) LightSourceAt(tilex-1,tiley) = 0; } /* =============== = = TurnOffLight0 = =============== */ boolean TurnOffLight0 (int tilex, int tiley) { if ( IsLight(tilex-1,tiley ) || IsLight(tilex-1,tiley-1) || IsLight(tilex ,tiley-1) || IsLight(tilex+1,tiley-1) || IsLight(tilex+1,tiley ) || IsLight(tilex+1,tiley+1) || IsLight(tilex ,tiley+1) || IsLight(tilex-1,tiley+1) ) return (false); else return (true); } /* =============== = = TurnOffLight1 = =============== */ boolean TurnOffLight1 (int tilex, int tiley, int i, int j) { int tempi = 2*i; int tempy = 2*j; if ( IsLight(tilex+i ,tiley ) || IsLight(tilex+i ,tiley+j) || IsLight(tilex ,tiley+j) || IsLight(tilex ,tiley+tempy) || IsLight(tilex+i ,tiley+tempy) || IsLight(tilex+tempi,tiley+tempy) || IsLight(tilex+tempi,tiley+j) || IsLight(tilex+tempi,tiley)) return (false); else return (true); } /* =============== = = TurnOffLight2 = =============== */ boolean TurnOffLight2 (int tilex, int tiley, int j) { int tempy = 2*j; if ( IsLight(tilex-1 ,tiley ) || IsLight(tilex-1 ,tiley+j) || IsLight(tilex-1 ,tiley+tempy) || IsLight(tilex ,tiley+j) || IsLight(tilex ,tiley+tempy) || IsLight(tilex+1 ,tiley) || IsLight(tilex+1 ,tiley+j) || IsLight(tilex+1 ,tiley+tempy)) return (false); else return (true); } /* =============== = = TurnOffLight3 = =============== */ boolean TurnOffLight3 (int tilex, int tiley, int i) { int tempx = 2*i; if ( IsLight(tilex ,tiley-1) || IsLight(tilex+1 ,tiley-1) || IsLight(tilex+tempx,tiley-1) || IsLight(tilex+i ,tiley) || IsLight(tilex+tempx,tiley) || IsLight(tilex ,tiley+1) || IsLight(tilex+i ,tiley+1) || IsLight(tilex+tempx,tiley+1)) return (false); else return (true); } /* ====================== = = PreCacheStaticFrames = ====================== */ void PreCacheStaticFrames(statobj_t*temp) { int z,start,stop; int female=0,black=0; if (temp->itemnumber != stat_bullethole && ((temp->itemnumber < stat_touch1) || (temp->itemnumber > stat_touch4))) PreCacheLump(temp->shapenum+shapestart,PU_CACHESPRITES,cache_patch_t); else PreCacheLump(temp->shapenum+shapestart,PU_CACHESPRITES,cache_transpatch_t); for (z=0;znumanims;z++) PreCacheLump(temp->shapenum+shapestart+z,PU_CACHESPRITES,cache_patch_t); if (temp->flags & FL_ROTATING) { for (z=1;z<8;z++) PreCacheLump(temp->shapenum+shapestart+z,PU_CACHESPRITES,cache_patch_t); } if (temp->flags & FL_WOODEN) { start = W_GetNumForName("WFRAG1"); stop = W_GetNumForName("WFRAG14"); PreCacheGroup(start,stop,cache_patch_t); } if (temp->flags & FL_METALLIC) { PreCacheLump(W_GetNumForName("MSHARDS"),PU_CACHESPRITES,cache_patch_t); start = W_GetNumForName("ROBODIE1"); stop = W_GetNumForName("ROBODEAD"); PreCacheGroup(start,stop,cache_patch_t); } female = ((locplayerstate->player == 1) || (locplayerstate->player == 3)); black = (locplayerstate->player == 2); if (female) { start = W_GetNumForName("FPIST11"); stop = W_GetNumForName("FPIST13"); } else if (black) { start = W_GetNumForName("BMPIST1"); stop = W_GetNumForName("BMPIST3"); } else { start = W_GetNumForName("MPIST11"); stop = W_GetNumForName("MPIST13"); } PreCacheGroup(start,stop,cache_patch_t); switch (temp->itemnumber) { case stat_pedgoldkey: case stat_pedsilverkey: case stat_pedironkey: case stat_pedcrystalkey: PreCacheLump(W_GetNumForName("PEDESTA"),PU_CACHESPRITES,cache_patch_t); break; case stat_bat: start = W_GetNumForName("EXBAT1"); stop = W_GetNumForName("EXBAT7"); PreCacheGroup(start,stop,cache_patch_t); break; case stat_knifestatue: start = W_GetNumForName("KNIFE1"); stop = W_GetNumForName("KNIFE10"); PreCacheGroup(start,stop,cache_patch_t); break; case stat_twopistol: if (female) { start = W_GetNumForName("RFPIST1"); stop = W_GetNumForName("LFPIST3"); } else if (black) { start = W_GetNumForName("RBMPIST1"); stop = W_GetNumForName("LBMPIST3"); } else { start = W_GetNumForName("RMPIST1"); stop = W_GetNumForName("LMPIST3"); } PreCacheGroup(start,stop,cache_patch_t); break; case stat_mp40: start = W_GetNumForName("MP401"); stop = W_GetNumForName("MP403"); PreCacheGroup(start,stop,cache_patch_t); break; case stat_bazooka: start = W_GetNumForName("BAZOOKA1"); stop = W_GetNumForName("BAZOOKA4"); PreCacheGroup(start,stop,cache_patch_t); break; case stat_firebomb: start = W_GetNumForName("FBOMB1"); stop = W_GetNumForName("FBOMB4"); PreCacheGroup(start,stop,cache_patch_t); break; case stat_heatseeker: start = W_GetNumForName("HSEEK1"); stop = W_GetNumForName("HSEEK4"); PreCacheGroup(start,stop,cache_patch_t); break; case stat_drunkmissile: start = W_GetNumForName("DRUNK1"); stop = W_GetNumForName("DRUNK4"); PreCacheGroup(start,stop,cache_patch_t); break; case stat_firewall: start = W_GetNumForName("FIREW1"); stop = W_GetNumForName("FIREW3"); PreCacheGroup(start,stop,cache_patch_t); break; case stat_splitmissile: start = W_GetNumForName("SPLIT1"); stop = W_GetNumForName("SPLIT4"); PreCacheGroup(start,stop,cache_patch_t); break; case stat_kes: start = W_GetNumForName("KES1"); stop = W_GetNumForName("KES6"); PreCacheGroup(start,stop,cache_patch_t); break; case stat_godmode: start = W_GetNumForName("GODHAND1"); stop = W_GetNumForName("GODHAND8"); PreCacheGroup(start,stop,cache_patch_t); PreCacheGroup(W_GetNumForName("VAPO1"), W_GetNumForName("LITSOUL"), cache_patch_t); PreCacheGroup(W_GetNumForName("GODFIRE1"), W_GetNumForName("GODFIRE4"), cache_patch_t); break; case stat_dogmode: start = W_GetNumForName("DOGNOSE1"); stop = W_GetNumForName("DOGPAW4"); PreCacheGroup(start,stop,cache_patch_t); break; default: ; } } /* =============== = = LoadStatics = =============== */ void LoadStatics( byte * buffer, int size) {saved_stat_type dummy = {0}; int stcount,i; statobj_t*temp; stcount = size/sizeof(saved_stat_type); InitStaticList(); for(i=0;iwhichstat = statcount++; temp->x = dummy.x; temp->y = dummy.y; temp->z = dummy.z; temp->flags = dummy.flags; temp->ticcount = dummy.ticcount; temp->hitpoints = dummy.hitpoints; temp->shapenum = dummy.shapenum; temp->ammo = dummy.ammo; temp->count = dummy.count; temp->numanims = dummy.numanims; temp->itemnumber = dummy.itemnumber; temp->areanumber = dummy.areanumber; temp->linked_to = dummy.linked_to; temp->which = SPRITE; temp->tilex = temp->x >> TILESHIFT; temp->tiley = temp->y >> TILESHIFT; temp->flags &= ~FL_ABP; temp->visspot = &spotvis[temp->tilex][temp->tiley]; if ((temp->itemnumber >= stat_touch1) && (temp->itemnumber <= stat_touch4)) {touchindices[temp->tilex][temp->tiley] = lasttouch + 1; lasttouch ++; SD_PreCacheSoundGroup(SD_TOUCHPLATESND,SD_BADTOUCHSND); } AddStatic(temp); if (temp->shapenum != -1) { if (temp->itemnumber == stat_bullethole) { SetupBulletHoleLink(temp->linked_to,temp); } else if (temp->flags & FL_DEADBODY) { if ( actorat[temp->tilex][temp->tiley] == NULL ) actorat[temp->tilex][temp->tiley] = temp; } else if (!(temp->flags & FL_NONMARK)) { sprites[temp->tilex][temp->tiley] = temp; } PreCacheStaticFrames(temp); } PreCacheStaticSounds(temp->itemnumber); buffer += sizeof(saved_stat_type); } } void Set_NewZ_to_MapValue(fixed *newz,int zoffset,const char*errorstr,int tilex,int tiley) { int zf,z; zoffset&=0xff; z=zoffset>>4; zf=zoffset&0xf; if (z==0xf) *newz = nominalheight+64-(zf<<2); else { if (z>levelheight) Error ("You specified a height of %x for the %s at tilex=%d tiley=%d when\n the level is only %d high\n", zoffset,errorstr,tilex,tiley,levelheight); else *newz = nominalheight-(z<<6)-(zf<<2); } } /* =============== = = SpawnStatic = =============== */ int BaseMarkerZ;//bna++ void SpawnStatic (int tilex, int tiley, int mtype, int zoffset) {statobj_t * temp; boolean onetimer; #if (SHAREWARE == 1) switch(mtype) { case stat_rlight: case stat_glight: case stat_ylight: case stat_chandelier: mtype = stat_blight; break; case stat_garb1: case stat_garb2: case stat_garb3: case stat_shit: mtype = stat_metalshards; break; case stat_lamp: mtype = stat_altbrazier2; break; } #endif if ( BATTLEMODE ) { if ( !gamestate.BattleOptions.SpawnWeapons ) { if ( stats[ mtype ].flags & FL_WEAPON ) { return; } } if (mtype == stat_pit) return; // Change lifeitems and extra lives to health switch( mtype ) { case stat_lifeitem1 : case stat_lifeitem2 : mtype = stat_monkcrystal1; break; case stat_lifeitem3 : case stat_lifeitem4 : case stat_oneup : case stat_threeup : mtype = stat_monkcrystal2; break; } switch( mtype ) { case stat_monkmeal : case stat_priestporridge : case stat_monkcrystal1 : case stat_monkcrystal2 : case stat_healingbasin : if ( ( gamestate.Product != ROTT_SHAREWARE ) && ( gamestate.BattleOptions.SpawnMines ) && ( !IsPlatform( tilex, tiley ) && ( ( zoffset & 0xff00 ) != 0xb000 ) ) && ( zoffset == -1 ) ) { mtype = stat_mine; } else if ( !gamestate.BattleOptions.SpawnHealth ) { return; } break; } } if (!firstemptystat) {temp = (statobj_t*)Z_LevelMalloc(sizeof(statobj_t),PU_LEVELSTRUCT,NULL); //SoftError("\nMalloc-ing actor"); //if (insetupgame) // SoftError("in setup"); } else {temp = lastemptystat; //SoftError("\nfree actor available"); RemoveFromFreeStaticList(lastemptystat); } // Standard pole hack if ((zoffset>=14) && (zoffset<=17)) zoffset=-1; if (temp) { memset(temp,0,sizeof(*temp)); temp->shapenum = stats[mtype].picnum; temp->whichstat = statcount ++; temp->tilex = tilex; temp->tiley = tiley; temp->x = ((long)tilex << TILESHIFT) + 0x8000; temp->y = ((long)tiley << TILESHIFT) + 0x8000; temp->areanumber = MAPSPOT(tilex,tiley,0)-AREATILE; temp->linked_to = -1; if ((temp->areanumber<=0) || (temp->areanumber>NUMAREAS)) Error ("Sprite at x=%d y=%d type=%d has an illegal areanumber\n",tilex,tiley,mtype); if ( mtype == stat_mine ) { temp->z = nominalheight; } else if (zoffset!=-1) { if ((zoffset&0xff00)==0xb000) Set_NewZ_to_MapValue(&(temp->z),zoffset,"static",tilex,tiley); else if (IsPlatform(tilex,tiley)) temp->z = PlatformHeight(tilex,tiley); else if (zoffset==11) temp->z=-65; else if (zoffset==12) temp->z=-66; else temp->z = nominalheight; // Error ("You didn't specify a valid height over the sprite at tilex=%ld tiley=%ld\n",tilex,tiley); } else if (mtype>stat_chandelier) temp->z = nominalheight; temp->visspot = &spotvis[tilex][tiley]; temp->which = SPRITE; temp->ticcount = stats[mtype].tictime; temp->hitpoints = stats[mtype].hitpoints; temp->itemnumber = stats[mtype].type; temp->flags = stats[mtype].flags; temp->ammo = stats[mtype].ammo; temp->numanims = stats[mtype].numanims; if (temp->flags & FL_BONUS) switch (stats[mtype].type) {case stat_lifeitem1: case stat_lifeitem2: case stat_lifeitem3: case stat_lifeitem4: gamestate.treasuretotal++; break; default: ; } AddStatic(temp); onetimer = ((mtype == stat_rubble) || (mtype == stat_woodfrag) || (mtype == stat_metalfrag) || (mtype == stat_missmoke) ); if (temp->numanims) { if (!onetimer) temp->count = (int)(((int)GameRandomNumber("SpawnStatic",mtype) % stats[mtype].numanims) + 1); else temp->count = 0; } else if (temp->itemnumber == stat_standardpole) { if (MAPSPOT(temp->tilex,temp->tiley,2)) temp->count = 2*(MAPSPOT(temp->tilex,temp->tiley,2)-14); else temp->count = 0; } if ((temp->itemnumber == stat_knifestatue) || (temp->itemnumber == stat_emptystatue) || (temp->itemnumber == stat_standardpole)) temp->flags|=FL_ROTATING; if (mtype != stat_missmoke) sprites[tilex][tiley] = temp; else temp->flags |= FL_NONMARK; //================ check special junk ==================================// if (temp->itemnumber == stat_dariantouch) {_2Dpoint *tdptr; tdptr = &(MISCVARS->ETOUCH[MISCVARS->nexttouch]); tdptr->x = tilex; tdptr->y = tiley; sprites[tilex][tiley]->linked_to = MISCVARS->nexttouch; MISCVARS->nexttouch ++; } else if ((temp->itemnumber >= stat_touch1) && (temp->itemnumber <= stat_touch4)) {touchindices[tilex][tiley] = lasttouch + 1; SD_PreCacheSoundGroup(SD_TOUCHPLATESND,SD_BADTOUCHSND); lasttouch ++; } //=====================================================================// //bna added // BaseMarkerZ used to adjust height in s_basemarker1 // in SpawnNewObj(i,j,&s_basemarker1,inertobj); BaseMarkerZ=temp->z;//bna++ BaseMarkerZ = spawnz; PreCacheStaticFrames(temp); PreCacheStaticSounds(temp->itemnumber); if (temp->flags & FL_WEAPON) MISCVARS->NUMWEAPONS ++; } else Error("Z_LevelMalloc failed in SpawnStatic!"); } /* =============== = = SpawnInertStatic = =============== */ void SpawnInertStatic (int x, int y, int z, int mtype) {statobj_t * temp; if (!firstemptystat) {temp = (statobj_t*)Z_LevelMalloc(sizeof(statobj_t),PU_LEVELSTRUCT,NULL); //SoftError("\nMalloc-ing actor"); //if (insetupgame) // SoftError("in setup"); } else {temp = lastemptystat; //SoftError("\nfree actor available"); RemoveFromFreeStaticList(lastemptystat); } if (temp) { memset(temp,0,sizeof(*temp)); temp->shapenum = stats[mtype].picnum; temp->whichstat = statcount ++; temp->tilex = x>>16; temp->tiley = y>>16; temp->x = x; temp->y = y; temp->areanumber = MAPSPOT(temp->tilex,temp->tiley,0)-AREATILE; temp->linked_to = -1; if ((temp->areanumber<=0) || (temp->areanumber>NUMAREAS)) { int tilex=temp->tilex; int tiley=temp->tiley; FindEmptyTile(&tilex,&tiley); temp->areanumber = MAPSPOT(tilex,tiley,0)-AREATILE; } temp->z=z; temp->visspot = &spotvis[temp->tilex][temp->tiley]; temp->which = SPRITE; temp->ticcount = stats[mtype].tictime; temp->hitpoints = stats[mtype].hitpoints; temp->itemnumber = stats[mtype].type; temp->flags = (stats[mtype].flags|FL_ABP|FL_NONMARK); if (fog) {temp->shapenum++; temp->flags &= ~FL_TRANSLUCENT; } temp->ammo = stats[mtype].ammo; temp->numanims = stats[mtype].numanims; AddStatic(temp); MakeStatActive(temp); } else Error("Z_LevelMalloc failed in SpawnStatic!"); } /* =============== = = SpawnSolidStatic = =============== */ void SpawnSolidStatic (statobj_t * temp) { if (temp->flags & FL_ACTIVE) temp->flags &= ~FL_ACTIVE; temp->hitpoints = INITIALFIRECOLOR; temp->flags = FL_SOLIDCOLOR|FL_SEEN|FL_ABP; if ((gamestate.BattleOptions.RespawnItems) && (temp->itemnumber == stat_tntcrate) ) temp->flags |= FL_RESPAWN; temp->ticcount = SOLIDCOLORTICTIME; } /* ====================== = = PreCacheStaticSounds = ====================== */ void PreCacheStaticSounds (int itemnumber) { if (stats[itemnumber].flags & FL_SHOOTABLE) SD_PreCacheSound(SD_ITEMBLOWSND); switch(itemnumber) { case stat_pit: SD_PreCacheSound(SD_PITTRAPSND); break; case stat_bonusbarrel: SD_PreCacheSound(SD_BONUSBARRELSND); break; case stat_knifestatue: SD_PreCacheSound(SD_GETKNIFESND); break; case stat_gibs1: case stat_gibs2: case stat_gibs3: SD_PreCacheSound (SD_ACTORSQUISHSND); break; case stat_pedgoldkey: case stat_pedsilverkey: case stat_pedironkey: case stat_pedcrystalkey: SD_PreCacheSound (SD_GETKEYSND); break; case stat_monkmeal: SD_PreCacheSound (SD_GETHEALTH1SND); break; case stat_monkcrystal1: SD_PreCacheSound (SD_GETHEALTH2SND); break; case stat_monkcrystal2: SD_PreCacheSound (SD_GETHEALTH2SND); break; case stat_priestporridge: SD_PreCacheSound (SD_GETHEALTH1SND); SD_PreCacheSound(SD_COOKHEALTHSND); break; case stat_healingbasin: SD_PreCacheSound (SD_GETHEALTH2SND); break; case stat_oneup: SD_PreCacheSound(SD_GET1UPSND); break; case stat_threeup: SD_PreCacheSound(SD_GET3UPSND); break; case stat_scotthead: SD_PreCacheSound(SD_GETHEADSND); break; case stat_twopistol: case stat_mp40: case stat_bazooka: case stat_firebomb: case stat_heatseeker: case stat_drunkmissile: case stat_firewall: case stat_splitmissile: case stat_kes: SD_PreCacheSound(SD_GETWEAPONSND); break; case stat_bat: SD_PreCacheSound(SD_GETBATSND); break; case stat_lifeitem1: case stat_lifeitem2: case stat_lifeitem3: case stat_lifeitem4: SD_PreCacheSound(SD_GETBONUSSND); break; case stat_random: SD_PreCacheSound(SD_GETGODSND); SD_PreCacheSound(SD_GETDOGSND); SD_PreCacheSound(SD_GETELASTSND); SD_PreCacheSound(SD_GETSHROOMSSND); SD_PreCacheSound(SD_LOSEMODESND); break; case stat_bulletproof: SD_PreCacheSound(SD_GETBVESTSND); SD_PreCacheSound(SD_LOSEMODESND); break; case stat_gasmask: SD_PreCacheSound(SD_GETMASKSND); SD_PreCacheSound(SD_LOSEMODESND); break; case stat_asbesto: SD_PreCacheSound(SD_GETAVESTSND); SD_PreCacheSound(SD_LOSEMODESND); break; case stat_elastic: SD_PreCacheSound(SD_GETELASTSND); SD_PreCacheSound(SD_LOSEMODESND); break; case stat_fleetfeet: SD_PreCacheSound(SD_GETFLEETSND); SD_PreCacheSound(SD_LOSEMODESND); break; case stat_godmode: SD_PreCacheSound(SD_GETGODSND); SD_PreCacheSound(SD_GODMODE1SND); break; case stat_dogmode: SD_PreCacheSound(SD_GETDOGSND); break; case stat_mushroom: SD_PreCacheSound(SD_GETSHROOMSSND); SD_PreCacheSound(SD_LOSEMODESND); break; case stat_dipball1: case stat_dipball2: case stat_dipball3: SD_PreCacheSound(SD_GETBONUSSND); break; default: SD_PreCacheSound(SD_GETBONUSSND); break; } } /* =============== = = SaveSwitches = =============== */ void SaveSwitches(byte ** buffer, int * size) {int numswitches,i; byte * tptr; numswitches = lastswitch-&switches[0]; if (numswitches==0) { *size=0; *buffer=SafeMalloc(16); return; } *size = numswitches*sizeof(wall_t); *buffer = (byte *)SafeMalloc(*size); tptr = *buffer; for(i=0;itoptexture++; } else if (switches[i].flags & FL_ON) tilemap[tilex][tiley]++; buffer += sizeof(wall_t); touchindices[tilex][tiley] = lasttouch + 1; lasttouch ++; } lastswitch=&switches[numswitches]; } /* =============== = = SpawnSwitchThingy = =============== */ void SpawnSwitchThingy(int tilex, int tiley) { lastswitch->flags |= FL_SWITCH; lastswitch->which = WALL; lastswitch->tilex = tilex; lastswitch->tiley = tiley; touchindices[tilex][tiley] = lasttouch + 1; lasttouch ++; actorat[tilex][tiley] = lastswitch; lastswitch ++; } /* =============== = = AnimateWalls = =============== */ void AnimateWalls(void) { int i; animwall_t * aw; for(i=0;iactive==0) continue; if (aw->ticcount <= 0) { if (aw->count < animwallsinfo[i].numanims) { aw->texture = aw->basetexture + aw->count; aw->count++; } else { aw->texture = aw->basetexture; aw->count = 1; } while (aw->ticcount<=0) aw->ticcount+=animwallsinfo[i].tictime; } else aw->ticcount -= tics; } } #define M_ResetSprites(x) \ { if ((index == stat_dariantouch) && (!x->count))\ {x->shapenum = stats[index].picnum; \ x->count = 1; \ x->ticcount = stats[index].tictime; \ x->flags &= ~FL_BACKWARDS; \ x->flags &= ~FL_ACTIVE; \ } \ } void CheckCriticalStatics(void) {respawn_t *rtemp,*ddt; int i,stilex,stiley; statobj_t*temp,*stat; for(rtemp = firstrespawn;rtemp;) {rtemp->ticcount --; ddt = rtemp->next; if (rtemp->ticcount <=0) {int stype = 0; stilex = rtemp->tilex; stiley = rtemp->tiley; // if another weapon is there, nuke it if (sprites[stilex][stiley]) {RemoveStatic(sprites[stilex][stiley]); sprites[stilex][stiley] = NULL; } if (rtemp->itemnumber == stat_tntcrate) { RemoveStatic((statobj_t*)(rtemp->linked_to)); stype = stat_tntcrate; } else { for(i=0;iitemnumber == stats[i].type) { stype = i; break; } } } SpawnStatic(stilex,stiley,stype,-1); LASTSTAT->z = rtemp->spawnz; LASTSTAT->flags |= FL_ABP; MakeStatActive(LASTSTAT); SpawnNewObj(stilex,stiley,&s_itemspawn1,inertobj); SD_PlaySoundRTP(SD_RESPAWNSND,new->x,new->y); new->flags |= FL_ABP; MakeActive(new); new->z = LASTSTAT->z; RemoveRespawnStatic(rtemp); } rtemp = ddt; } for (temp = firstactivestat ; temp; ) {stat = temp->nextactive; if (temp->flags & FL_SOLIDCOLOR) {temp->ticcount--; if (temp->ticcount<=0) {temp->hitpoints+=SOLIDCOLORINCREMENT; if (temp->hitpoints>MAXFIRECOLOR) RemoveStatic(temp); else temp->ticcount = SOLIDCOLORTICTIME; } } temp = stat; } } /* =============== = = DoSprites = =============== */ void DoSprites(void) {int index; statobj_t *temp,*tempnext; for(temp = firstactivestat;temp;) {tempnext = temp->nextactive; if ((temp->shapenum != NOTHING) && (temp->flags & FL_ACTIVE)) {index = temp->itemnumber; temp->ticcount -= tics; while (temp->ticcount <= 0) {if (temp->count < temp->numanims) {temp->shapenum = stats[index].picnum + temp->count; if (index == stat_missmoke) {RemoveStatic(temp); break; } if (((index == stat_rubble) && (temp->count == 9)) || ((index == stat_woodfrag) && (temp->count == 13)) || ((index == stat_metalfrag) && (temp->count == 9))) {temp->flags &= ~FL_ACTIVE; break; } if (temp->flags & FL_BACKWARDS) {temp->count--; M_ResetSprites(temp); } else temp->count ++; } else if (!(temp->flags & FL_BANDF)) {temp->shapenum = stats[index].picnum; temp->count=1; } else {temp->flags |= FL_BACKWARDS; temp->count --; } temp->ticcount += stats[index].tictime; } } temp = tempnext; } } void SpawnStaticDamage(statobj_t * stat, int angle) { GetNewActor (); MakeActive(new); NewState(new,&s_gunsmoke1); new->obclass = inertobj; new->which = ACTOR; new->x = (stat->x)-(costable[angle]>>4); new->y = (stat->y)+(sintable[angle]>>4); new->z = (stat->z)+stats[stat->itemnumber].heightoffset; new->drawx = new->x; new->drawy = new->y; new->tilex = (new->x >> TILESHIFT); new->tiley = (new->y >> TILESHIFT); new->dir = 0; new->speed = 0; new->flags = (FL_NEVERMARK|FL_ABP); if ((new->x<=0) || (new->y<=0)) Error("SpawnStaticDamage: bad x,y itemnumber=%d\n",stat->itemnumber); } rott-20230810/rott/rt_stat.h000066400000000000000000000132501446517470200155770ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //*************************************************************************** // // RT_STAT.C (static object functions) // //*************************************************************************** #ifndef _rt_stat_public #define _rt_stat_public #include "rt_ted.h" #define MAXSWITCHES 64 #define MAXANIMWALLS 17 #define NUMSTATS 91 typedef enum { stat_ylight, stat_rlight, stat_glight, stat_blight, stat_chandelier, stat_lamp, stat_pedgoldkey, stat_pedsilverkey, stat_pedironkey, stat_pedcrystalkey, stat_gibs1, stat_gibs2, stat_gibs3, stat_monkmeal, stat_priestporridge, stat_monkcrystal1, stat_monkcrystal2, stat_oneup, stat_threeup, stat_altbrazier1, stat_altbrazier2, stat_healingbasin, stat_emptybasin, stat_bat, stat_knifestatue, stat_twopistol, stat_mp40, stat_bazooka, stat_firebomb, stat_heatseeker, stat_drunkmissile, stat_firewall, stat_splitmissile, stat_kes, stat_lifeitem1, stat_lifeitem2, stat_lifeitem3, stat_lifeitem4, stat_tntcrate, stat_bonusbarrel, stat_torch, stat_floorfire, stat_dipball1, stat_dipball2, stat_dipball3, stat_touch1, stat_touch2, stat_touch3, stat_touch4, stat_dariantouch, stat_scotthead, stat_garb1, stat_garb2, stat_garb3, stat_shit, stat_grate, stat_metalshards, stat_emptypedestal, stat_emptytable, stat_stool, stat_bcolumn, stat_gcolumn, stat_icolumn, stat_tree, stat_plant, stat_urn, stat_haystack, stat_ironbarrel, stat_heatgrate, stat_standardpole, stat_pit, stat_godmode, stat_dogmode, stat_fleetfeet, stat_elastic, stat_mushroom, stat_gasmask, stat_bulletproof, stat_asbesto, stat_random, stat_rubble, stat_woodfrag, stat_metalfrag, stat_emptystatue, stat_tomlarva, stat_bullethole, stat_collector, stat_mine, stat_missmoke, stat_disk, stat_badstatic } stat_t; typedef struct awall { byte active; byte count; signed char ticcount; int texture; int basetexture; } animwall_t; typedef struct statstruct { thingtype which; byte tilex,tiley; fixed x,y,z; int shapenum; unsigned flags; signed char ticcount; signed char ammo; byte *visspot; signed char count; byte numanims; stat_t itemnumber; short int hitpoints; short int whichstat; short int areanumber; intptr_t linked_to; struct statstruct *statnext; struct statstruct *statprev; struct statstruct *nextactive; struct statstruct *prevactive; } statobj_t; typedef struct respstruct { byte tilex,tiley; int ticcount; stat_t itemnumber; int spawnz; struct respstruct *next; struct respstruct *prev; intptr_t linked_to; } respawn_t; typedef struct { short heightoffset; int picnum; stat_t type; unsigned flags; byte tictime; byte numanims; byte hitpoints; byte damage; signed char ammo; } statinfo; extern statobj_t *lastactivestat,*firstactivestat; extern statobj_t *firstemptystat,*lastemptystat; extern int spritestart; extern wall_t switches[MAXSWITCHES],*lastswitch; extern respawn_t *firstrespawn,*lastrespawn; extern statobj_t *FIRSTSTAT,*LASTSTAT,*sprites[MAPSIZE][MAPSIZE]; extern statinfo stats[NUMSTATS]; extern dirtype diagonal[9][9]; extern dirtype opposite[9]; extern int statcount; extern int animwallstart; extern animwall_t animwalls[MAXANIMWALLS]; void Set_NewZ_to_MapValue(fixed*,int,const char*,int,int); void RemoveFromFreeStaticList(statobj_t*); void CheckCriticalStatics(void); void ActivateLight(intptr_t); void DeactivateLight(intptr_t); void TurnOnLight(int,int); void TurnOffLight(int,int); void MakeStatActive(statobj_t*); void MakeStatInactive(statobj_t*); void AddStatic(statobj_t *); void RemoveStatic(statobj_t *); void SpawnSwitchThingy(int,int); void InitStaticList (void); void InitAnimatedWallList(void); void SetupAnimatedWall(int which); void SpawnStatic (int tilex, int tiley, int mtype, int zoffset); void SpawnSolidStatic (statobj_t * temp); void AnimateWalls(void); void DoSprites(void); void SaveAnimWalls(byte ** buf, int * size); void SaveStatics(byte ** buf, int * size); void LoadAnimWalls(byte * buf, int size); void LoadStatics(byte * buf, int size); void SaveSwitches(byte ** buf, int * size); void LoadSwitches(byte * buf, int size); void SpawnInertStatic (int x, int y, int z, int mtype); void SpawnStaticDamage(statobj_t * stat, int angle); #endif rott-20230810/rott/rt_state.c000066400000000000000000003157121446517470200157470ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "sprites.h" #include "states.h" #include "rt_actor.h" #include "develop.h" #define SPRINGDELAY 3 /* ============================================================================= LOW GUARD (includes sneaky) ============================================================================= */ extern void T_ReallyDead(objtype*ob); extern void T_PlayDead(objtype*ob); extern void T_Xylophone(objtype*ob); extern void T_BloodFall(objtype*ob); extern void SetShapeoffset(objtype*ob); extern void RespawnPlayerobj(objtype*ob); extern void T_ElevDisk(objtype*ob); extern void T_Plead(objtype*ob); extern void T_Blood(objtype*ob); extern void T_Convert(objtype*ob); extern void T_SlideDownScreen(objtype*ob); extern void T_End(objtype*ob); extern void T_Reset(objtype*ob); extern void T_CollectorWander(objtype*ob); extern void T_CollectorFindDoor(objtype*ob); extern void T_AutoPath(objtype*); extern void T_AutoRealign(objtype*); extern void T_AutoShootAlign(objtype*); extern void T_NME_SpinFire(objtype*); extern void MissileMovement(objtype*); extern void T_BatBlast(objtype*); extern void T_DeadWait(objtype*); extern void ActorMovement(objtype*); extern void T_Spring(objtype*); extern void T_SnakeFinale(objtype*); extern void T_Special(objtype*); extern void T_NME_Explode(objtype*); extern void T_Guts(objtype*); extern void T_Player(objtype*); extern void T_ParticleGenerate(objtype*); extern void T_Particle(objtype*); extern void T_SpawnSoul(objtype*); extern void T_NME_WindUp(objtype*); extern void T_NME_Attack(objtype*); extern void T_Saucer(objtype*); extern void T_NMErocket(objtype*); extern void T_NME_SpinAttack(objtype*); extern void T_NME_HeadShoot(objtype*); extern void T_CrushUp(objtype*); extern void T_CrushDown(objtype*); extern void T_HeinrichChase(objtype*); extern void T_KristLeft(objtype*); extern void T_KristRight(objtype*); extern void T_KristCheckFire(objtype*); extern void T_BoulderSpawn(objtype*); extern void T_BoulderDrop(objtype*); extern void T_BoulderMove(objtype*); extern void T_DarkmonkChase(objtype*); extern void T_DarkSnakeChase(objtype*); extern void T_DarkSnakeSpawn(objtype*); extern void A_DmonkAttack(objtype*); extern void T_GenericMove(objtype*); extern void T_Count(objtype*); extern void T_Spears(objtype*); extern void T_EsauSpears(objtype*); extern void T_Spring(objtype*); extern void T_4WayGunStand(objtype*); extern void A_GunShoot(objtype*); extern void A_4WayGunShoot(objtype*); extern void T_Attack(objtype*); extern void T_SnakePath(objtype*); extern void T_SnakeFindPath(objtype*); extern void T_DarkmonkLandAndFire(objtype*ob); extern void T_DarkmonkCharge(objtype*ob); extern void T_DarkmonkReact(objtype*ob); extern void T_BossExplosions(objtype*ob); statetype s_lowgrdstand = {true,SPR_LOWGRD_S1,0,T_Stand,0,&s_lowgrdstand}; statetype s_lowgrdpath4 = {true,SPR_LOWGRD_W41,12,T_Path,0,&s_lowgrdpath1}; statetype s_lowgrdpath3 = {true,SPR_LOWGRD_W31,12,T_Path,SF_CLOSE,&s_lowgrdpath4}; statetype s_lowgrdpath2 = {true,SPR_LOWGRD_W21,12,T_Path,0,&s_lowgrdpath3}; statetype s_lowgrdpath1 = {true,SPR_LOWGRD_W11,12,T_Path,SF_CLOSE,&s_lowgrdpath2}; statetype s_lowgrdcollide = {false,SPR_LOWGRD_PAIN1,0,T_Collide,0,&s_lowgrdcollide}; statetype s_lowgrdcollide2 = {false,SPR_LOWGRD_PAIN2,0,T_Collide,0,&s_lowgrdcollide2}; //statetype s_lowgrduse2 = {true,SPR_LOWGRD_USE21,5,T_Use,0,&s_lowgrdpath1}; //statetype s_lowgrduse1 = {true,SPR_LOWGRD_USE11,5,T_Use,0,&s_lowgrduse2}; statetype s_lowgrdshoot4 = {false,SPR_LOWGRD_SHOOT4,8,ActorMovement,0,&s_lowgrdchase1}; statetype s_lowgrdshoot3 = {false,SPR_LOWGRD_SHOOT3,5,A_Shoot,0,&s_lowgrdshoot4}; statetype s_lowgrdshoot2 = {false,SPR_LOWGRD_SHOOT2,20,ActorMovement,0,&s_lowgrdshoot3}; statetype s_lowgrdshoot1 = {false,SPR_LOWGRD_SHOOT1,6,ActorMovement,0,&s_lowgrdshoot2}; statetype s_lowgrdchase4 = {true,SPR_LOWGRD_W41,12,T_Chase,0,&s_lowgrdchase1}; statetype s_lowgrdchase3 = {true,SPR_LOWGRD_W31,12,T_Chase,SF_CLOSE,&s_lowgrdchase4}; statetype s_lowgrdchase2 = {true,SPR_LOWGRD_W21,12,T_Chase,0,&s_lowgrdchase3}; statetype s_lowgrdchase1 = {true,SPR_LOWGRD_W11,12,T_Chase,SF_CLOSE,&s_lowgrdchase2}; statetype s_lowgrddead = {false,SPR_LOWGRD_DEAD,0,T_Collide,0,&s_lowgrddead}; statetype s_lowgrddie4 = {false,SPR_LOWGRD_DIE4,8,T_Collide,0,&s_lowgrddead}; statetype s_lowgrddie3 = {false,SPR_LOWGRD_DIE3,8,T_Collide,0,&s_lowgrddie4}; statetype s_lowgrddie2 = {false,SPR_LOWGRD_DIE2,8,T_Collide,0,&s_lowgrddie3}; statetype s_lowgrddie1 = {false,SPR_LOWGRD_DIE1,15,T_Collide,0,&s_lowgrddie2}; statetype s_lowgrdcrushed2 = {false,SPR_LOWGRD_DIE3,2,NULL,0,&s_lowgrddead}; statetype s_lowgrdcrushed1 = {false,SPR_LOWGRD_DIE1,2,NULL,0,&s_lowgrdcrushed2}; /************** Sneaky stuff *******************************************/ statetype s_sneakydown = {false,SPR_SNEAKY_DEAD,0,T_Stand,0,&s_sneakydown}; statetype s_sneakyrise4 = {false,SPR_RISE4,6,ActorMovement,0,&s_lowgrdchase1}; statetype s_sneakyrise3 = {false,SPR_RISE3,6,ActorMovement,0,&s_sneakyrise4}; statetype s_sneakyrise2 = {false,SPR_RISE2,6,ActorMovement,0,&s_sneakyrise3}; statetype s_sneakyrise1 = {false,SPR_RISE1,6,ActorMovement,0,&s_sneakyrise2}; /* ============================================================================= HIGH GUARD ============================================================================= */ statetype s_highgrdstand = {true,SPR_HIGHGRD_S1,0,T_Stand,0,&s_highgrdstand}; statetype s_highgrdpath4 = {true,SPR_HIGHGRD_W41,12,T_Path,0,&s_highgrdpath1}; statetype s_highgrdpath3 = {true,SPR_HIGHGRD_W31,12,T_Path,SF_CLOSE,&s_highgrdpath4}; statetype s_highgrdpath2 = {true,SPR_HIGHGRD_W21,12,T_Path,0,&s_highgrdpath3}; statetype s_highgrdpath1 = {true,SPR_HIGHGRD_W11,12,T_Path,SF_CLOSE,&s_highgrdpath2}; //statetype s_highgrdpain1 = {2,SPR_HIGHGRD_PAIN1,10,T_Collide,0,&s_highgrdchase1}; //statetype s_highgrdpain2 = {2,SPR_HIGHGRD_PAIN2,10,T_Collide,0,&s_highgrdchase1}; statetype s_highgrdcollide = {false,SPR_HIGHGRD_PAIN1,0,T_Collide,0,&s_highgrdcollide}; statetype s_highgrdcollide2 = {false,SPR_HIGHGRD_PAIN2,0,T_Collide,0,&s_highgrdcollide2}; //statetype s_highgrduse2 = {true,SPR_HIGHGRD_USE21,10,T_Use,0,&s_highgrdpath1}; //statetype s_highgrduse1 = {true,SPR_HIGHGRD_USE11,10,T_Use,0,&s_highgrduse2}; statetype s_highgrdshoot4 = {false,SPR_HIGHGRD_SHOOT4,3,A_Repeat,0,&s_highgrdshoot3}; statetype s_highgrdshoot3 = {false,SPR_HIGHGRD_SHOOT3,5,A_Shoot,0,&s_highgrdshoot4}; statetype s_highgrdshoot2 = {false,SPR_HIGHGRD_SHOOT2,6,ActorMovement,0,&s_highgrdshoot3}; statetype s_highgrdshoot1 = {false,SPR_HIGHGRD_SHOOT1,6,ActorMovement,0,&s_highgrdshoot2}; statetype s_highgrdchase4 = {true,SPR_HIGHGRD_W41,12,T_Chase,0,&s_highgrdchase1}; statetype s_highgrdchase3 = {true,SPR_HIGHGRD_W31,12,T_Chase,SF_CLOSE,&s_highgrdchase4}; statetype s_highgrdchase2 = {true,SPR_HIGHGRD_W21,12,T_Chase,0,&s_highgrdchase3}; statetype s_highgrdchase1 = {true,SPR_HIGHGRD_W11,12,T_Chase,SF_CLOSE,&s_highgrdchase2}; statetype s_highgrddead = {false,SPR_HIGHGRD_DEAD,0,T_Collide,0,&s_highgrddead}; statetype s_highgrddie5 = {false,SPR_HIGHGRD_DIE5,0,T_Collide,0,&s_highgrddead}; statetype s_highgrddie4 = {false,SPR_HIGHGRD_DIE4,8,T_Collide,0,&s_highgrddie5}; statetype s_highgrddie3 = {false,SPR_HIGHGRD_DIE3,8,T_Collide,0,&s_highgrddie4}; statetype s_highgrddie2 = {false,SPR_HIGHGRD_DIE2,8,T_Collide,0,&s_highgrddie3}; statetype s_highgrddie1 = {false,SPR_HIGHGRD_DIE1,8,T_Collide,0,&s_highgrddie2}; statetype s_highgrdcrushed2 = {false,SPR_HIGHGRD_DIE3,2,NULL,0,&s_highgrddead}; statetype s_highgrdcrushed1 = {false,SPR_HIGHGRD_DIE1,2,NULL,0,&s_highgrdcrushed2}; /* =========================================================================== STRIKEGUARD =========================================================================== */ statetype s_strikestand = {true,SPR_STRIKE_S1,0,T_Stand,0,&s_strikestand}; statetype s_strikepath4 = {true,SPR_STRIKE_W41,12,T_Path,0,&s_strikepath1}; statetype s_strikepath3 = {true,SPR_STRIKE_W31,12,T_Path,SF_CLOSE,&s_strikepath4}; statetype s_strikepath2 = {true,SPR_STRIKE_W21,12,T_Path,0,&s_strikepath3}; statetype s_strikepath1 = {true,SPR_STRIKE_W11,12,T_Path,SF_CLOSE,&s_strikepath2}; statetype s_strikecollide = {false,SPR_STRIKE_PAIN1,0,T_Collide,0,&s_strikecollide}; statetype s_strikecollide2 = {false,SPR_STRIKE_PAIN2,0,T_Collide,0,&s_strikecollide2}; statetype s_strikeshoot4 = {false,SPR_STRIKE_SHOOT4,6,ActorMovement,0,&s_strikechase1}; statetype s_strikeshoot3 = {false,SPR_STRIKE_SHOOT3,6,ActorMovement,0,&s_strikeshoot4}; statetype s_strikeshoot2 = {false,SPR_STRIKE_SHOOT2,5,A_Shoot,0,&s_strikeshoot3}; statetype s_strikeshoot1 = {false,SPR_STRIKE_SHOOT1,20,ActorMovement,0,&s_strikeshoot2}; //statetype s_strikeuse2 = {true,SPR_STRIKE_USE21,10,T_Use,0,&s_strikechase1}; //statetype s_strikeuse1 = {true,SPR_STRIKE_USE11,10,NULL,0,&s_strikeuse2}; statetype s_strikewait = {true,SPR_STRIKE_S1,35,NULL,0,&s_strikechase1}; statetype s_strikerollright6 = {false,SPR_STRIKE_LROLL6,8,T_Roll,0,&s_strikeshoot1}; statetype s_strikerollright5 = {false,SPR_STRIKE_LROLL5,8,T_Roll,0,&s_strikerollright6}; statetype s_strikerollright4 = {false,SPR_STRIKE_LROLL4,7,T_Reset,0,&s_strikerollright5}; statetype s_strikerollright3 = {false,SPR_STRIKE_LROLL3,7,T_Roll,0,&s_strikerollright4}; statetype s_strikerollright2 = {false,SPR_STRIKE_LROLL2,7,T_Roll,0,&s_strikerollright3}; statetype s_strikerollright1 = {false,SPR_STRIKE_LROLL1,5,T_Roll,0,&s_strikerollright2}; statetype s_strikerollleft6 = {false,SPR_STRIKE_RROLL6,8,T_Roll,0,&s_strikeshoot1}; statetype s_strikerollleft5 = {false,SPR_STRIKE_RROLL5,8,T_Roll,0,&s_strikerollleft6}; statetype s_strikerollleft4 = {false,SPR_STRIKE_RROLL4,7,T_Reset,0,&s_strikerollleft5}; statetype s_strikerollleft3 = {false,SPR_STRIKE_RROLL3,7,T_Roll,0,&s_strikerollleft4}; statetype s_strikerollleft2 = {false,SPR_STRIKE_RROLL2,7,T_Roll,0,&s_strikerollleft3}; statetype s_strikerollleft1 = {false,SPR_STRIKE_RROLL1,5,T_Roll,0,&s_strikerollleft2}; statetype s_strikechase4 = {true,SPR_STRIKE_W41,12,T_Chase,0,&s_strikechase1}; statetype s_strikechase3 = {true,SPR_STRIKE_W31,12,T_Chase,SF_CLOSE,&s_strikechase4}; statetype s_strikechase2 = {true,SPR_STRIKE_W21,12,T_Chase,0,&s_strikechase3}; statetype s_strikechase1 = {true,SPR_STRIKE_W11,12,T_Chase,SF_CLOSE,&s_strikechase2}; statetype s_strikedead3 = {false,SPR_STRIKE_DEAD3,0,T_Collide,0,&s_strikedead3}; statetype s_strikedead2 = {false,SPR_STRIKE_DEAD2,0,T_Collide,0,&s_strikedead3}; statetype s_strikedead = {false,SPR_STRIKE_DEAD1,7,T_Collide,0,&s_strikedead2}; statetype s_strikedie4 = {false,SPR_STRIKE_DIE4,7,T_Collide,0,&s_strikedead}; statetype s_strikedie3 = {false,SPR_STRIKE_DIE3,7,T_Collide,0,&s_strikedie4}; statetype s_strikedie2 = {false,SPR_STRIKE_DIE2,7,T_Collide,0,&s_strikedie3}; statetype s_strikedie1 = {false,SPR_STRIKE_DIE1,7,T_Collide,0,&s_strikedie2}; statetype s_strikecrushed2 = {false,SPR_STRIKE_DIE3,2,NULL,0,&s_strikedead}; statetype s_strikecrushed1 = {false,SPR_STRIKE_DIE1,2,NULL,0,&s_strikecrushed2}; /* ============================================================================ LIGHTNING GUARD ============================================================================ */ statetype s_blitzstand = {true,SPR_BLITZ_S1,0,T_Stand,0,&s_blitzstand}; statetype s_blitzpath4 = {true,SPR_BLITZ_W41,12,T_Path,0,&s_blitzpath1}; statetype s_blitzpath3 = {true,SPR_BLITZ_W31,12,T_Path,SF_CLOSE,&s_blitzpath4}; statetype s_blitzpath2 = {true,SPR_BLITZ_W21,12,T_Path,0,&s_blitzpath3}; statetype s_blitzpath1 = {true,SPR_BLITZ_W11,12,T_Path,SF_CLOSE,&s_blitzpath2}; statetype s_blitzcollide = {false,SPR_BLITZ_PAIN1,0,T_Collide,0,&s_blitzcollide}; statetype s_blitzcollide2 = {false,SPR_BLITZ_PAIN2,0,T_Collide,0,&s_blitzcollide2}; statetype s_blitzshoot4 = {false,SPR_BLITZ_SHOOT4,10,ActorMovement,0,&s_blitzchase1}; statetype s_blitzshoot3 = {false,SPR_BLITZ_SHOOT3,10,ActorMovement,0,&s_blitzshoot4}; statetype s_blitzshoot2 = {false,SPR_BLITZ_SHOOT2,5,A_Shoot,0,&s_blitzshoot3}; statetype s_blitzshoot1 = {false,SPR_BLITZ_SHOOT1,10,ActorMovement,0,&s_blitzshoot2}; statetype s_blitzrise4 = {false,SPR_BLITZ_RISE4,8,ActorMovement,0,&s_blitzchase1}; statetype s_blitzrise3 = {false,SPR_BLITZ_RISE3,8,ActorMovement,0,&s_blitzrise4}; statetype s_blitzrise2 = {false,SPR_BLITZ_RISE2,8,ActorMovement,0,&s_blitzrise3}; statetype s_blitzrise1 = {false,SPR_BLITZ_RISE1,8,ActorMovement,0,&s_blitzrise2}; statetype s_blitzuse = {true,SPR_BLITZ_USE,10,T_Use,0,&s_blitzpath1}; statetype s_blitzsteal2 = {true,SPR_BLITZ_STEAL2,20,A_Steal,0,&s_blitzchase1}; statetype s_blitzsteal1 = {true,SPR_BLITZ_STEAL1,20,ActorMovement,0,&s_blitzsteal2}; statetype s_blitzchase4 = {true,SPR_BLITZ_W41,12,T_Chase,0,&s_blitzchase1}; statetype s_blitzchase3 = {true,SPR_BLITZ_W31,12,T_Chase,SF_CLOSE,&s_blitzchase4}; statetype s_blitzchase2 = {true,SPR_BLITZ_W21,12,T_Chase,0,&s_blitzchase3}; statetype s_blitzchase1 = {true,SPR_BLITZ_W11,12,T_Chase,SF_CLOSE,&s_blitzchase2}; statetype s_blitzdead2 = {false,SPR_BLITZ_DEAD2,0,T_Collide,0,&s_blitzdead2}; statetype s_blitzdead = {false,SPR_BLITZ_DEAD1,0,T_Collide,0,&s_blitzdead2}; statetype s_blitzdie4 = {false,SPR_BLITZ_DIE4,7,T_Collide,0,&s_blitzdead}; statetype s_blitzdie3 = {false,SPR_BLITZ_DIE3,7,T_Collide,0,&s_blitzdie4}; statetype s_blitzdie2 = {false,SPR_BLITZ_DIE2,7,T_Collide,0,&s_blitzdie3}; statetype s_blitzdie1 = {false,SPR_BLITZ_DIE1,7,T_Collide,0,&s_blitzdie2}; statetype s_blitzstruggledead = {false,SPR_BLITZ_RISE2,0,T_Collide,0,&s_blitzstruggledead}; statetype s_blitzstruggledie1 = {false,SPR_BLITZ_RISE2,20,T_ReallyDead,0,&s_blitzstruggledead}; statetype s_blitzfakedead = {false,SPR_BLITZ_DEAD2,0,T_PlayDead,SF_FAKING,&s_blitzfakedead}; statetype s_blitzfakedie3 = {false,SPR_BLITZ_DEAD1,5,ActorMovement,0,&s_blitzfakedead}; statetype s_blitzfakedie2 = {false,SPR_BLITZ_DIE4,5,ActorMovement,0,&s_blitzfakedie3}; statetype s_blitzfakedie1 = {false,SPR_BLITZ_DIE3,5,ActorMovement,0,&s_blitzfakedie2}; statetype s_blitzcrushed2 = {false,SPR_BLITZ_DIE3,2,NULL,0,&s_blitzdead}; statetype s_blitzcrushed1 = {false,SPR_BLITZ_DIE1,2,NULL,0,&s_blitzcrushed2}; statetype s_blitzplead11 = {false,SPR_BLITZ_PLEAD11,0,T_Collide,0,&s_blitzplead11}; statetype s_blitzplead10 = {false,SPR_BLITZ_PLEAD10,6,NULL,0,&s_blitzplead11}; statetype s_blitzplead9 = {false,SPR_BLITZ_PLEAD9,6,NULL,0,&s_blitzplead10}; statetype s_blitzplead8 = {false,SPR_BLITZ_PLEAD8,6,NULL,0,&s_blitzplead9}; statetype s_blitzplead7 = {false,SPR_BLITZ_PLEAD7,6,NULL,0,&s_blitzplead8}; statetype s_blitzaplead4 = {false,SPR_BLITZ_PLEAD4,5,T_Plead,SF_DOWN,&s_blitzplead3}; statetype s_blitzaplead5 = {false,SPR_BLITZ_PLEAD5,5,T_Plead,SF_DOWN,&s_blitzaplead4}; statetype s_blitzplead6 = {false,SPR_BLITZ_PLEAD6,5,T_Plead,SF_DOWN,&s_blitzaplead5}; statetype s_blitzplead5 = {false,SPR_BLITZ_PLEAD5,5,T_Plead,SF_DOWN,&s_blitzplead6}; statetype s_blitzplead4 = {false,SPR_BLITZ_PLEAD4,5,T_Plead,SF_DOWN,&s_blitzplead5}; statetype s_blitzplead3 = {false,SPR_BLITZ_PLEAD3,5,T_Plead,SF_DOWN,&s_blitzplead4}; statetype s_blitzplead2 = {false,SPR_BLITZ_PLEAD2,6,ActorMovement,0,&s_blitzplead3}; statetype s_blitzplead1 = {false,SPR_BLITZ_PLEAD1,6,ActorMovement,0,&s_blitzplead2}; /* ============================================================================ TRIAD ENFORCERS ============================================================================ */ statetype s_enforcerstand = {true,SPR_ENFORCER_S1,0,T_Stand,0,&s_enforcerstand}; statetype s_enforcerpath4 = {true,SPR_ENFORCER_W41,12,T_Path,0,&s_enforcerpath1}; statetype s_enforcerpath3 = {true,SPR_ENFORCER_W31,12,T_Path,SF_CLOSE,&s_enforcerpath4}; statetype s_enforcerpath2 = {true,SPR_ENFORCER_W21,12,T_Path,0,&s_enforcerpath3}; statetype s_enforcerpath1 = {true,SPR_ENFORCER_W11,12,T_Path,SF_CLOSE,&s_enforcerpath2}; statetype s_enforcerchase4 = {true,SPR_ENFORCER_W41,12,T_Chase,0,&s_enforcerchase1}; statetype s_enforcerchase3 = {true,SPR_ENFORCER_W31,12,T_Chase,SF_CLOSE,&s_enforcerchase4}; statetype s_enforcerchase2 = {true,SPR_ENFORCER_W21,12,T_Chase,0,&s_enforcerchase3}; statetype s_enforcerchase1 = {true,SPR_ENFORCER_W11,12,T_Chase,SF_CLOSE,&s_enforcerchase2}; statetype s_enforcercollide = {false,SPR_ENFORCER_PAIN1,0,T_Collide,0,&s_enforcercollide}; statetype s_enforcercollide2 = {false,SPR_ENFORCER_PAIN2,0,T_Collide,0,&s_enforcercollide2}; //statetype s_enforceruse2 = {true,SPR_ENFORCER_USE21,10,T_Use,0,&s_enforcerchase1}; //statetype s_enforceruse1 = {true,SPR_ENFORCER_USE11,10,T_Use,0,&s_enforceruse2}; statetype s_enforcershoot4 = {false,SPR_ENFORCER_SHOOT4,6,A_Repeat,0,&s_enforcershoot3}; statetype s_enforcershoot3 = {false,SPR_ENFORCER_SHOOT3,6,A_Shoot,0,&s_enforcershoot4}; statetype s_enforcershoot2 = {false,SPR_ENFORCER_SHOOT2,6,ActorMovement,0,&s_enforcershoot3}; statetype s_enforcershoot1 = {false,SPR_ENFORCER_SHOOT1,6,ActorMovement,0,&s_enforcershoot2}; statetype s_enforcerthrow8 = {false,SPR_ENFORCER_THROW8,10,ActorMovement,0,&s_enforcerchase1}; statetype s_enforcerthrow7 = {false,SPR_ENFORCER_THROW7,10,ActorMovement,0,&s_enforcerthrow8}; statetype s_enforcerthrow6 = {false,SPR_ENFORCER_THROW6,10,ActorMovement,0,&s_enforcerthrow7}; statetype s_enforcerthrow5 = {false,SPR_ENFORCER_THROW5,10,A_MissileWeapon,0,&s_enforcerthrow6}; statetype s_enforcerthrow4 = {false,SPR_ENFORCER_THROW4,10,ActorMovement,0,&s_enforcerthrow5}; statetype s_enforcerthrow3 = {false,SPR_ENFORCER_THROW3,10,ActorMovement,0,&s_enforcerthrow4}; statetype s_enforcerthrow2 = {false,SPR_ENFORCER_THROW2,10,ActorMovement,0,&s_enforcerthrow3}; statetype s_enforcerthrow1 = {false,SPR_ENFORCER_THROW1,10,ActorMovement,0,&s_enforcerthrow2}; statetype s_grenade10 = {false,SPR_ENFORCER_GR10,2,T_Projectile,0,&s_grenade1}; statetype s_grenade9 = {false,SPR_ENFORCER_GR9,2,T_Projectile,0,&s_grenade10}; statetype s_grenade8 = {false,SPR_ENFORCER_GR8,2,T_Projectile,0,&s_grenade9}; statetype s_grenade7 = {false,SPR_ENFORCER_GR7,2,T_Projectile,0,&s_grenade8}; statetype s_grenade6 = {false,SPR_ENFORCER_GR6,2,T_Projectile,0,&s_grenade7}; statetype s_grenade5 = {false,SPR_ENFORCER_GR5,2,T_Projectile,0,&s_grenade6}; statetype s_grenade4 = {false,SPR_ENFORCER_GR4,2,T_Projectile,0,&s_grenade5}; statetype s_grenade3 = {false,SPR_ENFORCER_GR3,2,T_Projectile,0,&s_grenade4}; statetype s_grenade2 = {false,SPR_ENFORCER_GR2,2,T_Projectile,0,&s_grenade3}; statetype s_grenade1 = {false,SPR_ENFORCER_GR1,2,T_Projectile,0,&s_grenade2}; statetype s_grenade_fall6 = {false,SPR_ENFORCER_FALL6,6,T_Projectile,0,&s_grenade_fall6}; statetype s_grenade_fall5 = {false,SPR_ENFORCER_FALL5,6,T_Projectile,0,&s_grenade_fall6}; statetype s_grenade_fall4 = {false,SPR_ENFORCER_FALL4,6,T_Projectile,0,&s_grenade_fall5}; statetype s_grenade_fall3 = {false,SPR_ENFORCER_FALL3,6,T_Projectile,0,&s_grenade_fall4}; statetype s_grenade_fall2 = {false,SPR_ENFORCER_FALL1,6,T_Projectile,0,&s_grenade_fall3}; statetype s_grenade_fall1 = {false,SPR_ENFORCER_FALL1,6,T_Projectile,0,&s_grenade_fall2}; statetype s_grenadehit3 = {false,SPR_GRENADE_HIT3,5,NULL,0,NULL}; statetype s_grenadehit2 = {false,SPR_GRENADE_HIT2,5,NULL,0,&s_grenadehit3}; statetype s_grenadehit1 = {false,SPR_GRENADE_HIT1,5,NULL,0,&s_grenadehit2}; statetype s_enforcerdead = {false,SPR_ENFORCER_DEAD,0,T_Collide,0,&s_enforcerdead}; statetype s_enforcerdie4 = {false,SPR_ENFORCER_DIE4,7,T_Collide,0,&s_enforcerdead}; statetype s_enforcerdie3 = {false,SPR_ENFORCER_DIE3,7,T_Collide,0,&s_enforcerdie4}; statetype s_enforcerdie2 = {false,SPR_ENFORCER_DIE2,7,T_Collide,0,&s_enforcerdie3}; statetype s_enforcerdie1 = {false,SPR_ENFORCER_DIE1,7,T_Collide,0,&s_enforcerdie2}; statetype s_enforcercrushed2 = {false,SPR_ENFORCER_DIE3,2,NULL,0,&s_enforcerdead}; statetype s_enforcercrushed1 = {false,SPR_ENFORCER_DIE1,2,NULL,0,&s_enforcercrushed2}; /* ============================================================================ ROBOT GUARD ============================================================================ */ statetype s_robogrdstand = {16,SPR_ROBOGRD_S11,0,T_Stand,0,&s_robogrdstand}; statetype s_robogrdpath1 = {16,SPR_ROBOGRD_S11,20,T_AutoPath,0,&s_robogrdpath1}; statetype s_robowait = {16,SPR_ROBOGRD_S11,0,NULL,0,&s_robowait}; statetype s_roborealign = {16,SPR_ROBOGRD_S11,0,T_AutoRealign,0,&s_roborealign}; statetype s_roboalign = {16,SPR_ROBOGRD_S11,0,T_AutoShootAlign,0,&s_roboalign}; statetype s_robogrdshoot1 = {false,SPR_ROBOGRD_S11,35,A_MissileWeapon,0,&s_roborealign}; statetype s_robogrdshuriken4 = {false,SPR_ROBOGRD_SHURIKEN4,4,T_Projectile,0,&s_robogrdshuriken1}; statetype s_robogrdshuriken3 = {false,SPR_ROBOGRD_SHURIKEN3,4,T_Projectile,0,&s_robogrdshuriken4}; statetype s_robogrdshuriken2 = {false,SPR_ROBOGRD_SHURIKEN2,4,T_Projectile,0,&s_robogrdshuriken3}; statetype s_robogrdshuriken1 = {false,SPR_ROBOGRD_SHURIKEN1,4,T_Projectile,0,&s_robogrdshuriken2}; statetype s_shurikenhit3 = {false,SPR_SHURIKEN_HIT3,5,NULL,0,NULL}; statetype s_shurikenhit2 = {false,SPR_SHURIKEN_HIT2,5,NULL,0,&s_shurikenhit3}; statetype s_shurikenhit1 = {false,SPR_SHURIKEN_HIT1,5,NULL,0,&s_shurikenhit2}; statetype s_robogrdcollide = {16,SPR_ROBOGRD_S11,0,T_Collide,0,&s_robogrdcollide}; statetype s_robogrdcollide2 = {16,SPR_ROBOGRD_S11,0,T_Collide,0,&s_robogrdcollide2}; //statetype s_robogrdchase1 = {16,SPR_ROBOGRD_S11,10,T_RoboChase,0,&s_robogrdchase1}; statetype s_robogrddead = {false,ROBOGRDDEAD,0,T_Collide,0,&s_robogrddead}; statetype s_robogrddie9 = {false,ROBOGRDDIE9,3,T_Collide,0,&s_robogrddead}; statetype s_robogrddie8 = {false,ROBOGRDDIE8,3,T_Collide,0,&s_robogrddie9}; statetype s_robogrddie7 = {false,ROBOGRDDIE7,3,T_Collide,0,&s_robogrddie8}; statetype s_robogrddie6 = {false,ROBOGRDDIE6,3,T_Collide,0,&s_robogrddie7}; statetype s_robogrddie5 = {false,ROBOGRDDIE5,3,T_Collide,0,&s_robogrddie6}; statetype s_robogrddie4 = {false,ROBOGRDDIE4,3,T_Collide,0,&s_robogrddie5}; statetype s_robogrddie3 = {false,ROBOGRDDIE3,3,T_Collide,0,&s_robogrddie4}; statetype s_robogrddie2 = {false,ROBOGRDDIE2,3,T_Collide,0,&s_robogrddie3}; statetype s_robogrddie1 = {false,ROBOGRDDIE1,3,T_Collide,0,&s_robogrddie2}; statetype s_bstar4 = {false,SPR_BSTAR4,1,T_Projectile,0,&s_bstar1}; statetype s_bstar3 = {false,SPR_BSTAR3,1,T_Projectile,0,&s_bstar4}; statetype s_bstar2 = {false,SPR_BSTAR2,1,T_Projectile,0,&s_bstar3}; statetype s_bstar1 = {false,SPR_BSTAR1,1,T_Projectile,0,&s_bstar2}; /* ========================================================================== = = Explosions = ========================================================================== */ statetype s_altexplosion10 = {false,SPR_EXPLOSION19,3,NULL,0,NULL}; statetype s_altexplosion9 = {false,SPR_EXPLOSION17,3,NULL,0,&s_altexplosion10}; statetype s_altexplosion8 = {false,SPR_EXPLOSION15,3,NULL,0,&s_altexplosion9}; statetype s_altexplosion7 = {false,SPR_EXPLOSION13,3,NULL,0,&s_altexplosion8}; statetype s_altexplosion6 = {false,SPR_EXPLOSION11,3,NULL,0,&s_altexplosion7}; statetype s_altexplosion5 = {false,SPR_EXPLOSION9,3,NULL,0,&s_altexplosion6}; statetype s_altexplosion4 = {false,SPR_EXPLOSION7,3,NULL,0,&s_altexplosion5}; statetype s_altexplosion3 = {false,SPR_EXPLOSION5,3,NULL,0,&s_altexplosion4}; statetype s_altexplosion2 = {false,SPR_EXPLOSION3,3,T_Explosion,0,&s_altexplosion3}; statetype s_altexplosion1 = {false,SPR_EXPLOSION1,3,NULL,0,&s_altexplosion2}; statetype s_explosion20 = {false,SPR_EXPLOSION20,2,NULL,0,NULL}; statetype s_explosion19 = {false,SPR_EXPLOSION19,2,NULL,0,&s_explosion20}; statetype s_explosion18 = {false,SPR_EXPLOSION18,2,NULL,0,&s_explosion19}; statetype s_explosion17 = {false,SPR_EXPLOSION17,2,NULL,0,&s_explosion18}; statetype s_explosion16 = {false,SPR_EXPLOSION16,2,NULL,0,&s_explosion17}; statetype s_explosion15 = {false,SPR_EXPLOSION15,2,NULL,0,&s_explosion16}; statetype s_explosion14 = {false,SPR_EXPLOSION14,2,NULL,0,&s_explosion15}; statetype s_explosion13 = {false,SPR_EXPLOSION13,2,NULL,0,&s_explosion14}; statetype s_explosion12 = {false,SPR_EXPLOSION12,2,NULL,0,&s_explosion13}; statetype s_explosion11 = {false,SPR_EXPLOSION11,2,NULL,0,&s_explosion12}; statetype s_explosion10 = {false,SPR_EXPLOSION10,2,NULL,0,&s_explosion11}; statetype s_explosion9 = {false,SPR_EXPLOSION9,2,NULL,0,&s_explosion10}; statetype s_explosion8 = {false,SPR_EXPLOSION8,2,NULL,0,&s_explosion9}; statetype s_explosion7 = {false,SPR_EXPLOSION7,2,NULL,0,&s_explosion8}; statetype s_explosion6 = {false,SPR_EXPLOSION6,2,NULL,0,&s_explosion7}; statetype s_explosion5 = {false,SPR_EXPLOSION5,2,NULL,0,&s_explosion6}; statetype s_explosion4 = {false,SPR_EXPLOSION4,2,NULL,0,&s_explosion5}; statetype s_explosion3 = {false,SPR_EXPLOSION3,2,T_Explosion,0,&s_explosion4}; statetype s_explosion2 = {false,SPR_EXPLOSION2,2,NULL,0,&s_explosion3}; statetype s_explosion1 = {false,SPR_EXPLOSION1,2,NULL,0,&s_explosion2}; statetype s_grexplosion20 = {false,SPR_GROUNDEXPL20,2,T_Special,0,NULL}; statetype s_grexplosion19 = {false,SPR_GROUNDEXPL19,2,NULL,0,&s_grexplosion20}; statetype s_grexplosion18 = {false,SPR_GROUNDEXPL18,2,NULL,0,&s_grexplosion19}; statetype s_grexplosion17 = {false,SPR_GROUNDEXPL17,2,NULL,0,&s_grexplosion18}; statetype s_grexplosion16 = {false,SPR_GROUNDEXPL16,2,NULL,0,&s_grexplosion17}; statetype s_grexplosion15 = {false,SPR_GROUNDEXPL15,2,NULL,0,&s_grexplosion16}; statetype s_grexplosion14 = {false,SPR_GROUNDEXPL14,2,NULL,0,&s_grexplosion15}; statetype s_grexplosion13 = {false,SPR_GROUNDEXPL13,2,NULL,0,&s_grexplosion14}; statetype s_grexplosion12 = {false,SPR_GROUNDEXPL12,2,NULL,0,&s_grexplosion13}; statetype s_grexplosion11 = {false,SPR_GROUNDEXPL11,2,NULL,0,&s_grexplosion12}; statetype s_grexplosion10 = {false,SPR_GROUNDEXPL10,2,NULL,0,&s_grexplosion11}; statetype s_grexplosion9 = {false,SPR_GROUNDEXPL9,2,NULL,0,&s_grexplosion10}; statetype s_grexplosion8 = {false,SPR_GROUNDEXPL8,2,NULL,0,&s_grexplosion9}; statetype s_grexplosion7 = {false,SPR_GROUNDEXPL7,2,NULL,0,&s_grexplosion8}; statetype s_grexplosion6 = {false,SPR_GROUNDEXPL6,2,NULL,0,&s_grexplosion7}; statetype s_grexplosion5 = {false,SPR_GROUNDEXPL5,2,NULL,0,&s_grexplosion6}; statetype s_grexplosion4 = {false,SPR_GROUNDEXPL4,2,NULL,0,&s_grexplosion5}; statetype s_grexplosion3 = {false,SPR_GROUNDEXPL3,2,T_Explosion,0,&s_grexplosion4}; statetype s_grexplosion2 = {false,SPR_GROUNDEXPL2,2,NULL,0,&s_grexplosion3}; statetype s_grexplosion1 = {false,SPR_GROUNDEXPL1,2,NULL,0,&s_grexplosion2}; statetype s_staticexplosion25 = {false,SPR_STATICEXPL25,2,NULL,0,NULL}; statetype s_staticexplosion24 = {false,SPR_STATICEXPL24,2,NULL,0,&s_staticexplosion25}; statetype s_staticexplosion23 = {false,SPR_STATICEXPL23,2,NULL,0,&s_staticexplosion24}; statetype s_staticexplosion22 = {false,SPR_STATICEXPL22,2,NULL,0,&s_staticexplosion23}; statetype s_staticexplosion21 = {false,SPR_STATICEXPL21,2,NULL,0,&s_staticexplosion22}; statetype s_staticexplosion20 = {false,SPR_STATICEXPL20,2,NULL,0,&s_staticexplosion21}; statetype s_staticexplosion19 = {false,SPR_STATICEXPL19,2,NULL,0,&s_staticexplosion20}; statetype s_staticexplosion18 = {false,SPR_STATICEXPL18,2,NULL,0,&s_staticexplosion19}; statetype s_staticexplosion17 = {false,SPR_STATICEXPL17,2,NULL,0,&s_staticexplosion18}; statetype s_staticexplosion16 = {false,SPR_STATICEXPL16,2,NULL,0,&s_staticexplosion17}; statetype s_staticexplosion15 = {false,SPR_STATICEXPL15,2,NULL,0,&s_staticexplosion16}; statetype s_staticexplosion14 = {false,SPR_STATICEXPL14,2,NULL,0,&s_staticexplosion15}; statetype s_staticexplosion13 = {false,SPR_STATICEXPL13,2,NULL,0,&s_staticexplosion14}; statetype s_staticexplosion12 = {false,SPR_STATICEXPL12,2,NULL,0,&s_staticexplosion13}; statetype s_staticexplosion11 = {false,SPR_STATICEXPL11,2,NULL,0,&s_staticexplosion12}; statetype s_staticexplosion10 = {false,SPR_STATICEXPL10,2,NULL,0,&s_staticexplosion11}; statetype s_staticexplosion9 = {false,SPR_STATICEXPL9,2,NULL,0,&s_staticexplosion10}; statetype s_staticexplosion8 = {false,SPR_STATICEXPL8,2,NULL,0,&s_staticexplosion9}; statetype s_staticexplosion7 = {false,SPR_STATICEXPL7,2,NULL,0,&s_staticexplosion8}; statetype s_staticexplosion6 = {false,SPR_STATICEXPL6,2,NULL,0,&s_staticexplosion7}; statetype s_staticexplosion5 = {false,SPR_STATICEXPL5,2,NULL,0,&s_staticexplosion6}; statetype s_staticexplosion4 = {false,SPR_STATICEXPL4,2,NULL,0,&s_staticexplosion5}; statetype s_staticexplosion3 = {false,SPR_STATICEXPL3,2,T_Explosion,0,&s_staticexplosion4}; statetype s_staticexplosion2 = {false,SPR_STATICEXPL2,2,NULL,0,&s_staticexplosion3}; statetype s_staticexplosion1 = {false,SPR_STATICEXPL1,2,NULL,0,&s_staticexplosion2}; statetype s_upblade16 = {false,UBLADE8,1,T_Path,0,&s_upblade1}; statetype s_upblade15 = {false,UBLADE7,2,T_Path,0,&s_upblade16}; statetype s_upblade14 = {false,UBLADE6,1,T_Path,0,&s_upblade15}; statetype s_upblade13 = {false,UBLADE5,2,T_Path,0,&s_upblade14}; statetype s_upblade12 = {false,UBLADE4,1,T_Path,0,&s_upblade13}; statetype s_upblade11 = {false,UBLADE3,2,T_Path,0,&s_upblade12}; statetype s_upblade10 = {false,UBLADE2,1,T_Path,0,&s_upblade11}; statetype s_upblade9 = {false,UBLADE9,2,T_Path,0,&s_upblade10}; statetype s_upblade8 = {false,UBLADE8,1,T_Path,0,&s_upblade9}; statetype s_upblade7 = {false,UBLADE7,2,T_Path,0,&s_upblade8}; statetype s_upblade6 = {false,UBLADE6,1,T_Path,0,&s_upblade7}; statetype s_upblade5 = {false,UBLADE5,2,T_Path,0,&s_upblade6}; statetype s_upblade4 = {false,UBLADE4,1,T_Path,0,&s_upblade5}; statetype s_upblade3 = {false,UBLADE3,2,T_Path,0,&s_upblade4}; statetype s_upblade2 = {false,UBLADE2,1,T_Path,0,&s_upblade3}; statetype s_upblade1 = {false,UBLADE1,2,T_Path,SF_SOUND,&s_upblade2}; statetype s_firejetup23 = {false,FIREJETUP23,3,T_Path,SF_CRUSH,&s_firejetup1}; statetype s_firejetup22 = {false,FIREJETUP22,3,T_Path,SF_CRUSH,&s_firejetup23}; statetype s_firejetup21 = {false,FIREJETUP21,3,T_Path,0,&s_firejetup22}; statetype s_firejetup20 = {false,FIREJETUP20,3,T_Path,0,&s_firejetup21}; statetype s_firejetup19 = {false,FIREJETUP19,3,T_Path,0,&s_firejetup20}; statetype s_firejetup18 = {false,FIREJETUP18,3,T_Path,0,&s_firejetup19}; statetype s_firejetup17 = {false,FIREJETUP17,3,T_Path,0,&s_firejetup18}; statetype s_firejetup16 = {false,FIREJETUP16,3,T_Path,SF_CRUSH,&s_firejetup17}; statetype s_firejetup15 = {false,FIREJETUP15,3,T_Path,SF_CRUSH,&s_firejetup16}; statetype s_firejetup14 = {false,FIREJETUP14,3,T_Path,SF_CRUSH,&s_firejetup15}; statetype s_firejetup13 = {false,FIREJETUP13,3,T_Path,0,&s_firejetup14}; statetype s_firejetup12 = {false,FIREJETUP12,3,T_Path,0,&s_firejetup13}; statetype s_firejetup11 = {false,FIREJETUP11,3,T_Path,0,&s_firejetup12}; statetype s_firejetup10 = {false,FIREJETUP10,3,T_Path,0,&s_firejetup11}; statetype s_firejetup9 = {false,FIREJETUP9,3,T_Path,0,&s_firejetup10}; statetype s_firejetup8 = {false,FIREJETUP8,3,T_Path,SF_CRUSH,&s_firejetup9}; statetype s_firejetup7 = {false,FIREJETUP7,3,T_Path,SF_CRUSH,&s_firejetup8}; statetype s_firejetup6 = {false,FIREJETUP6,3,T_Path,SF_CRUSH,&s_firejetup7}; statetype s_firejetup5 = {false,FIREJETUP5,3,T_Path,0,&s_firejetup6}; statetype s_firejetup4 = {false,FIREJETUP4,3,T_Path,0,&s_firejetup5}; statetype s_firejetup3 = {false,FIREJETUP3,3,T_Path,0,&s_firejetup4}; statetype s_firejetup2 = {false,FIREJETUP2,3,T_Path,0,&s_firejetup3}; statetype s_firejetup1 = {false,FIREJETUP1,70,T_Path,SF_SOUND,&s_firejetup2}; statetype s_columndownup6 = {false,CRUSHDOWN7,5,NULL,0,&s_columndowndown1}; statetype s_columndownup5 = {false,CRUSHDOWN6,5,NULL,0,&s_columndownup6}; statetype s_columndownup4 = {false,CRUSHDOWN5,5,NULL,SF_BLOCK,&s_columndownup5}; statetype s_columndownup3 = {false,CRUSHDOWN4,5,NULL,SF_BLOCK,&s_columndownup4}; statetype s_columndownup2 = {false,CRUSHDOWN3,5,NULL,SF_BLOCK,&s_columndownup3}; statetype s_columndownup1 = {false,CRUSHDOWN2,5,NULL,SF_BLOCK,&s_columndownup2}; statetype s_columndowndown8 = {false,CRUSHDOWN1,5,T_CrushDown,SF_CRUSH|SF_DOWN|SF_BLOCK,&s_columndownup1}; statetype s_columndowndown7 = {false,CRUSHDOWN2,5,T_CrushDown,SF_CRUSH|SF_DOWN|SF_BLOCK,&s_columndowndown8}; statetype s_columndowndown6 = {false,CRUSHDOWN3,5,T_CrushDown,SF_DOWN|SF_BLOCK,&s_columndowndown7}; statetype s_columndowndown5 = {false,CRUSHDOWN4,5,T_CrushDown,SF_DOWN|SF_BLOCK,&s_columndowndown6}; statetype s_columndowndown4 = {false,CRUSHDOWN5,5,T_CrushDown,SF_DOWN,&s_columndowndown5}; statetype s_columndowndown3 = {false,CRUSHDOWN6,5,T_CrushDown,SF_DOWN,&s_columndowndown4}; statetype s_columndowndown2 = {false,CRUSHDOWN7,5,T_CrushDown,SF_DOWN,&s_columndowndown3}; statetype s_columndowndown1 = {false,CRUSHDOWN8,30,T_CrushDown,SF_DOWN|SF_SOUND,&s_columndowndown2}; statetype s_spearup16 = {false,SPEARUP16,2,T_Spears,SF_CRUSH,&s_spearup1}; statetype s_spearup15 = {false,SPEARUP15,2,T_Spears,SF_CRUSH,&s_spearup16}; statetype s_spearup14 = {false,SPEARUP14,2,T_Spears,SF_CRUSH,&s_spearup15}; statetype s_spearup13 = {false,SPEARUP13,2,T_Spears,SF_CRUSH,&s_spearup14}; statetype s_spearup12 = {false,SPEARUP12,2,T_Spears,SF_CRUSH,&s_spearup13}; statetype s_spearup11 = {false,SPEARUP11,2,T_Spears,SF_CRUSH,&s_spearup12}; statetype s_spearup10 = {false,SPEARUP10,2,T_Spears,SF_CRUSH,&s_spearup11}; statetype s_spearup9 = {false,SPEARUP9,2,T_Spears,SF_DOWN,&s_spearup10}; statetype s_spearup8 = {false,SPEARUP8,35,T_Spears,SF_DOWN|SF_SOUND,&s_spearup9}; statetype s_spearup7 = {false,SPEARUP7,2,T_Spears,SF_DOWN,&s_spearup8}; statetype s_spearup6 = {false,SPEARUP6,2,T_Spears,SF_CRUSH,&s_spearup7}; statetype s_spearup5 = {false,SPEARUP5,2,T_Spears,SF_CRUSH,&s_spearup6}; statetype s_spearup4 = {false,SPEARUP4,2,T_Spears,SF_CRUSH,&s_spearup5}; statetype s_spearup3 = {false,SPEARUP3,2,T_Spears,SF_CRUSH,&s_spearup4}; statetype s_spearup2 = {false,SPEARUP2,2,T_Spears,SF_CRUSH,&s_spearup3}; statetype s_spearup1 = {false,SPEARUP1,2,T_Spears,SF_CRUSH,&s_spearup2}; statetype s_dust = {false,NOTHING,0,NULL,0,&s_dust}; statetype s_gas2 = {false,SPR42_GRATE,5,T_Count,0,&s_gas2}; statetype s_gas1 = {false,SPR42_GRATE,0,NULL,0,&s_gas1}; //================== player stuff =======================================/ statetype s_p_bazooka1 = {16,SPR_BJMISS11,3,T_Projectile,0,&s_p_bazooka1}; statetype s_p_grenade = {16,SPR_BJMISS11,3,T_Projectile,0,&s_p_grenade}; /* statetype s_p_misssmoke4 = {false,MISSSMOKE4,7,NULL,0,NULL}; statetype s_p_misssmoke3 = {false,MISSSMOKE3,7,NULL,0,&s_p_misssmoke4}; statetype s_p_misssmoke2 = {false,MISSSMOKE2,7,NULL,0,&s_p_misssmoke3}; statetype s_p_misssmoke1 = {false,MISSSMOKE1,3,NULL,0,&s_p_misssmoke2}; */ statetype s_basemarker8 = {false,FLASH8,3,NULL,0,&s_basemarker1}; statetype s_basemarker7 = {false,FLASH7,3,NULL,0,&s_basemarker8}; statetype s_basemarker6 = {false,FLASH6,3,NULL,0,&s_basemarker7}; statetype s_basemarker5 = {false,FLASH5,3,NULL,0,&s_basemarker6}; statetype s_basemarker4 = {false,FLASH4,3,NULL,0,&s_basemarker5}; statetype s_basemarker3 = {false,FLASH3,3,NULL,0,&s_basemarker4}; statetype s_basemarker2 = {false,FLASH2,3,NULL,0,&s_basemarker3}; statetype s_basemarker1 = {false,FLASH1,3,NULL,0,&s_basemarker2}; statetype s_flash8 = {false,FLASH8,3,NULL,0,NULL}; statetype s_flash7 = {false,FLASH7,3,NULL,0,&s_flash8}; statetype s_flash6 = {false,FLASH6,3,NULL,0,&s_flash7}; statetype s_flash5 = {false,FLASH5,3,NULL,0,&s_flash6}; statetype s_flash4 = {false,FLASH4,3,NULL,0,&s_flash5}; statetype s_flash3 = {false,FLASH3,3,NULL,0,&s_flash4}; statetype s_flash2 = {false,FLASH2,3,NULL,0,&s_flash3}; statetype s_flash1 = {false,FLASH1,3,NULL,0,&s_flash2}; statetype s_gunsmoke8 = {false,GUNSMOKE8,3,NULL,0,NULL}; statetype s_gunsmoke7 = {false,GUNSMOKE7,3,NULL,0,&s_gunsmoke8}; statetype s_gunsmoke6 = {false,GUNSMOKE6,3,NULL,0,&s_gunsmoke7}; statetype s_gunsmoke5 = {false,GUNSMOKE5,3,NULL,0,&s_gunsmoke6}; statetype s_gunsmoke4 = {false,GUNSMOKE4,3,NULL,0,&s_gunsmoke5}; statetype s_gunsmoke3 = {false,GUNSMOKE3,3,NULL,0,&s_gunsmoke4}; statetype s_gunsmoke2 = {false,GUNSMOKE2,3,NULL,0,&s_gunsmoke3}; statetype s_gunsmoke1 = {false,GUNSMOKE1,2,NULL,0,&s_gunsmoke2}; statetype s_bloodspurt8 = {false,BLOODSPURT8,7,NULL,0,NULL}; statetype s_bloodspurt7 = {false,BLOODSPURT7,7,NULL,0,&s_bloodspurt8}; statetype s_bloodspurt6 = {false,BLOODSPURT6,7,NULL,0,&s_bloodspurt7}; statetype s_bloodspurt5 = {false,BLOODSPURT5,7,NULL,0,&s_bloodspurt6}; statetype s_bloodspurt4 = {false,BLOODSPURT4,7,NULL,0,&s_bloodspurt5}; statetype s_bloodspurt3 = {false,BLOODSPURT3,7,NULL,0,&s_bloodspurt4}; statetype s_bloodspurt2 = {false,BLOODSPURT2,7,NULL,0,&s_bloodspurt3}; statetype s_bloodspurt1 = {false,BLOODSPURT1,5,NULL,0,&s_bloodspurt2}; statetype s_hitmetalwall4 = {false,HITMETALWALL4,7,NULL,0,NULL}; statetype s_hitmetalwall3 = {false,HITMETALWALL3,7,NULL,0,&s_hitmetalwall4}; statetype s_hitmetalwall2 = {false,HITMETALWALL2,7,NULL,0,&s_hitmetalwall3}; statetype s_hitmetalwall1 = {false,HITMETALWALL1,5,NULL,0,&s_hitmetalwall2}; statetype s_hitmetalactor4 = {false,HITMETALACTOR4,7,NULL,0,NULL}; statetype s_hitmetalactor3 = {false,HITMETALACTOR3,7,NULL,0,&s_hitmetalactor4}; statetype s_hitmetalactor2 = {false,HITMETALACTOR2,7,NULL,0,&s_hitmetalactor3}; statetype s_hitmetalactor1 = {false,HITMETALACTOR1,5,NULL,0,&s_hitmetalactor2}; statetype s_fireunit15 = {false,FIREW15,3,T_Firethink,0,&s_fireunit1}; statetype s_fireunit14 = {false,FIREW14,3,T_Firethink,0,&s_fireunit15}; statetype s_fireunit13 = {false,FIREW13,3,T_Firethink,0,&s_fireunit14}; statetype s_fireunit12 = {false,FIREW12,3,T_Firethink,0,&s_fireunit13}; statetype s_fireunit11 = {false,FIREW11,3,T_Firethink,0,&s_fireunit12}; statetype s_fireunit10 = {false,FIREW10,3,T_Firethink,0,&s_fireunit11}; statetype s_fireunit9 = {false,FIREW9,3,T_Firethink,0,&s_fireunit10}; statetype s_fireunit8 = {false,FIREW8,3,T_Firethink,0,&s_fireunit9}; statetype s_fireunit7 = {false,FIREW7,3,T_Firethink,0,&s_fireunit8}; statetype s_fireunit6 = {false,FIREW6,3,T_Firethink,0,&s_fireunit7}; statetype s_fireunit5 = {false,FIREW5,3,T_Firethink,0,&s_fireunit6}; statetype s_fireunit4 = {false,FIREW4,3,T_Firethink,0,&s_fireunit5}; statetype s_fireunit3 = {false,FIREW3,3,T_Firethink,0,&s_fireunit4}; statetype s_fireunit2 = {false,FIREW2,3,T_Firethink,0,&s_fireunit3}; statetype s_fireunit1 = {false,FIREW1,3,T_Firethink,0,&s_fireunit2}; statetype s_skeleton48 = {false,SKELETON48,0,T_Convert,0,&s_skeleton48}; statetype s_skeleton47 = {false,SKELETON47,2,NULL,0,&s_skeleton48}; statetype s_skeleton46 = {false,SKELETON46,2,NULL,0,&s_skeleton47}; statetype s_skeleton45 = {false,SKELETON45,2,NULL,0,&s_skeleton46}; statetype s_skeleton44 = {false,SKELETON44,2,NULL,0,&s_skeleton45}; statetype s_skeleton43 = {false,SKELETON43,2,NULL,0,&s_skeleton44}; statetype s_skeleton42 = {false,SKELETON42,2,NULL,0,&s_skeleton43}; statetype s_skeleton41 = {false,SKELETON41,2,T_Xylophone,0,&s_skeleton42}; statetype s_skeleton40 = {false,SKELETON40,2,NULL,0,&s_skeleton41}; statetype s_skeleton39 = {false,SKELETON39,2,NULL,0,&s_skeleton40}; statetype s_skeleton38 = {false,SKELETON38,2,NULL,0,&s_skeleton39}; statetype s_skeleton37 = {false,SKELETON37,2,NULL,0,&s_skeleton38}; statetype s_skeleton36 = {false,SKELETON36,2,NULL,0,&s_skeleton37}; statetype s_skeleton35 = {false,SKELETON35,2,NULL,0,&s_skeleton36}; statetype s_skeleton34 = {false,SKELETON34,2,NULL,0,&s_skeleton35}; statetype s_skeleton33 = {false,SKELETON33,2,NULL,0,&s_skeleton34}; statetype s_skeleton32 = {false,SKELETON32,2,NULL,0,&s_skeleton33}; statetype s_skeleton31 = {false,SKELETON31,2,NULL,0,&s_skeleton32}; statetype s_skeleton30 = {false,SKELETON30,2,NULL,0,&s_skeleton31}; statetype s_skeleton29 = {false,SKELETON29,2,NULL,0,&s_skeleton30}; statetype s_skeleton28 = {false,SKELETON28,2,NULL,0,&s_skeleton29}; statetype s_skeleton27 = {false,SKELETON27,2,NULL,0,&s_skeleton28}; statetype s_skeleton26 = {false,SKELETON26,2,NULL,0,&s_skeleton27}; statetype s_skeleton25 = {false,SKELETON25,2,NULL,0,&s_skeleton26}; statetype s_skeleton24 = {false,SKELETON24,2,NULL,0,&s_skeleton25}; statetype s_skeleton23 = {false,SKELETON23,2,NULL,0,&s_skeleton24}; statetype s_skeleton22 = {false,SKELETON22,2,NULL,0,&s_skeleton23}; statetype s_skeleton21 = {false,SKELETON21,2,NULL,0,&s_skeleton22}; statetype s_skeleton20 = {false,SKELETON20,2,NULL,0,&s_skeleton21}; statetype s_skeleton19 = {false,SKELETON19,2,NULL,0,&s_skeleton20}; statetype s_skeleton18 = {false,SKELETON18,2,NULL,0,&s_skeleton19}; statetype s_skeleton17 = {false,SKELETON17,2,NULL,0,&s_skeleton18}; statetype s_skeleton16 = {false,SKELETON16,2,NULL,0,&s_skeleton17}; statetype s_skeleton15 = {false,SKELETON15,2,NULL,0,&s_skeleton16}; statetype s_skeleton14 = {false,SKELETON14,2,NULL,0,&s_skeleton15}; statetype s_skeleton13 = {false,SKELETON13,2,NULL,0,&s_skeleton14}; statetype s_skeleton12 = {false,SKELETON12,2,NULL,0,&s_skeleton13}; statetype s_skeleton11 = {false,SKELETON11,2,NULL,0,&s_skeleton12}; statetype s_skeleton10 = {false,SKELETON10,2,NULL,0,&s_skeleton11}; statetype s_skeleton9 = {false,SKELETON9,2,NULL,0,&s_skeleton10}; statetype s_skeleton8 = {false,SKELETON8,2,NULL,0,&s_skeleton9}; statetype s_skeleton7 = {false,SKELETON7,2,NULL,0,&s_skeleton8}; statetype s_skeleton6 = {false,SKELETON6,2,NULL,0,&s_skeleton7}; statetype s_skeleton5 = {false,SKELETON5,2,NULL,0,&s_skeleton6}; statetype s_skeleton4 = {false,SKELETON4,2,NULL,0,&s_skeleton5}; statetype s_skeleton3 = {false,SKELETON3,2,NULL,0,&s_skeleton4}; statetype s_skeleton2 = {false,SKELETON2,2,NULL,0,&s_skeleton3}; statetype s_skeleton1 = {false,SKELETON1,2,NULL,0,&s_skeleton2}; statetype s_spring9 = {false,SPRING9,4,T_Spring,SF_DOWN,&s_spring1}; statetype s_spring8 = {false,SPRING8,4,NULL,0,&s_spring9}; statetype s_spring7 = {false,SPRING7,4,NULL,0,&s_spring8}; statetype s_spring6 = {false,SPRING6,4,NULL,0,&s_spring7}; statetype s_spring5 = {false,SPRING5,4,NULL,0,&s_spring6}; statetype s_spring4 = {false,SPRING4,15,NULL,SF_UP,&s_spring5}; statetype s_spring3 = {false,SPRING3,1,NULL,SF_UP,&s_spring4}; statetype s_spring2 = {false,SPRING2,1,NULL,SF_UP,&s_spring3}; statetype s_spring1 = {false,SPRING1,0,NULL,SF_UP,&s_spring1}; statetype s_autospring9 = {false,SPRING9,4,NULL,0,&s_autospring1}; statetype s_autospring8 = {false,SPRING8,4,NULL,0,&s_autospring9}; statetype s_autospring7 = {false,SPRING7,4,NULL,0,&s_autospring8}; statetype s_autospring6 = {false,SPRING6,4,NULL,0,&s_autospring7}; statetype s_autospring5 = {false,SPRING5,4,NULL,0,&s_autospring6}; statetype s_autospring4 = {false,SPRING4,15,NULL,SF_UP,&s_autospring5}; statetype s_autospring3 = {false,SPRING3,1,T_Spring,SF_UP,&s_autospring4}; statetype s_autospring2 = {false,SPRING2,1,T_Spring,SF_UP,&s_autospring3}; statetype s_autospring1 = {false,SPRING1,70*SPRINGDELAY,NULL,0,&s_autospring2}; //====================== remote player ==============================// statetype s_itemspawn8 = {false,ITEMSPAWN8,6,NULL,0,NULL}; statetype s_itemspawn7 = {false,ITEMSPAWN7,6,NULL,0,&s_itemspawn8}; statetype s_itemspawn6 = {false,ITEMSPAWN6,6,NULL,0,&s_itemspawn7}; statetype s_itemspawn5 = {false,ITEMSPAWN5,6,NULL,0,&s_itemspawn6}; statetype s_itemspawn4 = {false,ITEMSPAWN4,6,NULL,0,&s_itemspawn5}; statetype s_itemspawn3 = {false,ITEMSPAWN3,6,NULL,0,&s_itemspawn4}; statetype s_itemspawn2 = {false,ITEMSPAWN2,6,NULL,0,&s_itemspawn3}; statetype s_itemspawn1 = {false,ITEMSPAWN1,6,NULL,0,&s_itemspawn2}; statetype s_player = {true,CASSATT_S1,0,T_Player,0,&s_player}; statetype s_pgunattack2 = {true,CASSATT_SHOOT11,0,T_Attack,0,&s_pgunattack2}; statetype s_pgunattack1 = {true,CASSATT_SHOOT21,5,T_Attack,0,&s_pgunattack2}; statetype s_pmissattack2 = {true,CASSATTM_SHOOT11,0,T_Attack,0,&s_pmissattack2}; statetype s_pmissattack1 = {true,CASSATTM_SHOOT21,5,T_Attack,0,&s_pmissattack2}; statetype s_pbatblast = {true,CASSATT_SHOOT21,0,T_BatBlast,0,&s_pbatblast}; statetype s_remotemove4 = {true,CASSATT_W41,5,T_Player,SF_DOWN,&s_remotemove1}; statetype s_remotemove3 = {true,CASSATT_W31,5,T_Player,SF_DOWN,&s_remotemove4}; statetype s_remotemove2 = {true,CASSATT_W21,5,T_Player,SF_DOWN,&s_remotemove3}; statetype s_remotemove1 = {true,CASSATT_W11,5,T_Player,SF_DOWN,&s_remotemove2}; statetype s_remoteinelev = {true,CASSATT_S1,700,T_Player,0,&s_remoteinelev}; statetype s_remotedead = {false,CASSATT_VDEAD,0,T_Player,0,&s_remotedead}; statetype s_remotedie6 = {false,CASSATT_VDIE6,3,T_Player,0,&s_remotedead}; statetype s_remotedie5 = {false,CASSATT_VDIE5,3,T_Player,0,&s_remotedie6}; statetype s_remotedie4 = {false,CASSATT_VDIE4,3,T_Player,0,&s_remotedie5}; statetype s_remotedie3 = {false,CASSATT_VDIE3,3,T_Player,0,&s_remotedie4}; statetype s_remotedie2 = {false,CASSATT_VDIE2,3,T_Player,0,&s_remotedie3}; statetype s_remotedie1 = {false,CASSATT_VDIE1,3,T_Player,0,&s_remotedie2}; statetype s_voidwait = {false,NOTHING,0,T_DeadWait,0,&s_voidwait}; statetype s_ashwait = {false,SKELETON48,0,T_DeadWait,0,&s_ashwait}; statetype s_deadwait = {false,CASSATT_VDEAD,0,T_DeadWait,0,&s_deadwait}; statetype s_gutwait = {false,GUTS12,0,T_DeadWait,0,&s_gutwait}; statetype s_remoteguts12 = {false,GUTS12,0,T_Player,0,&s_remoteguts12}; statetype s_remoteguts11 = {false,GUTS11,3,T_Player,0,&s_remoteguts12}; statetype s_remoteguts10 = {false,GUTS10,3,T_Player,0,&s_remoteguts11}; statetype s_remoteguts9 = {false,GUTS9,3,T_Player,0,&s_remoteguts10}; statetype s_remoteguts8 = {false,GUTS8,3,T_Player,0,&s_remoteguts9}; statetype s_remoteguts7 = {false,GUTS7,3,T_Player,0,&s_remoteguts8}; statetype s_remoteguts6 = {false,GUTS6,3,T_Player,0,&s_remoteguts7}; statetype s_remoteguts5 = {false,GUTS5,3,T_Player,0,&s_remoteguts6}; statetype s_remoteguts4 = {false,GUTS4,3,T_Player,0,&s_remoteguts5}; statetype s_remoteguts3 = {false,GUTS3,3,T_Player,0,&s_remoteguts4}; statetype s_remoteguts2 = {false,GUTS2,3,T_Player,0,&s_remoteguts3}; statetype s_remoteguts1 = {false,GUTS1,3,T_Player,0,&s_remoteguts2}; //========================================================================// statetype s_godfire4 = {false,GODFIRE4,3,T_Projectile,0,&s_godfire1}; statetype s_godfire3 = {false,GODFIRE3,3,T_Projectile,0,&s_godfire4}; statetype s_godfire2 = {false,GODFIRE2,3,T_Projectile,0,&s_godfire3}; statetype s_godfire1 = {false,GODFIRE1,3,T_Projectile,0,&s_godfire2}; statetype s_guts12 = {false,GUTS12,0,T_Collide,SF_GUTS,&s_guts12}; statetype s_guts11 = {false,GUTS11,3,T_Collide,SF_GUTS,&s_guts12}; statetype s_guts10 = {false,GUTS10,3,T_Collide,SF_GUTS,&s_guts11}; statetype s_guts9 = {false,GUTS9,3,T_Collide,SF_GUTS,&s_guts10}; statetype s_guts8 = {false,GUTS8,3,T_Collide,SF_GUTS,&s_guts9}; statetype s_guts7 = {false,GUTS7,3,T_Collide,SF_GUTS,&s_guts8}; statetype s_guts6 = {false,GUTS6,3,T_Collide,SF_GUTS,&s_guts7}; statetype s_guts5 = {false,GUTS5,3,T_Collide,SF_GUTS,&s_guts6}; statetype s_guts4 = {false,GUTS4,3,T_Collide,SF_GUTS,&s_guts5}; statetype s_guts3 = {false,GUTS3,3,T_Collide,SF_GUTS,&s_guts4}; statetype s_guts2 = {false,GUTS2,3,T_Collide,SF_GUTS,&s_guts3}; statetype s_guts1 = {false,GUTS1,3,T_Collide,SF_GUTS,&s_guts2}; //MED #if (SHAREWARE == 1) || (DOPEFISH == 0) statetype s_collectorwander8 = {false,COLLECTOR15,0,T_CollectorWander,0,&s_collectorwander1}; statetype s_collectorwander7 = {false,COLLECTOR13,1,T_CollectorWander,0,&s_collectorwander8}; statetype s_collectorwander6 = {false,COLLECTOR11,0,T_CollectorWander,0,&s_collectorwander7}; statetype s_collectorwander5 = {false,COLLECTOR9,1,T_CollectorWander,0,&s_collectorwander6}; statetype s_collectorwander4 = {false,COLLECTOR7,0,T_CollectorWander,0,&s_collectorwander5}; statetype s_collectorwander3 = {false,COLLECTOR5,1,T_CollectorWander,0,&s_collectorwander4}; statetype s_collectorwander2 = {false,COLLECTOR3,0,T_CollectorWander,0,&s_collectorwander3}; statetype s_collectorwander1 = {false,COLLECTOR1,1,T_CollectorWander,0,&s_collectorwander2}; #else statetype s_collectorwander8 = {false,DOPE8,2,T_CollectorWander,0,&s_collectorwander1}; statetype s_collectorwander7 = {false,DOPE7,2,T_CollectorWander,0,&s_collectorwander8}; statetype s_collectorwander6 = {false,DOPE6,2,T_CollectorWander,0,&s_collectorwander7}; statetype s_collectorwander5 = {false,DOPE5,2,T_CollectorWander,0,&s_collectorwander6}; statetype s_collectorwander4 = {false,DOPE4,2,T_CollectorWander,0,&s_collectorwander5}; statetype s_collectorwander3 = {false,DOPE3,2,T_CollectorWander,0,&s_collectorwander4}; statetype s_collectorwander2 = {false,DOPE2,2,T_CollectorWander,0,&s_collectorwander3}; statetype s_collectorwander1 = {false,DOPE1,2,T_CollectorWander,0,&s_collectorwander2}; #endif //MED #if (SHAREWARE == 1) || (DOPEFISH == 0) statetype s_collectorfdoor8 = {false,COLLECTOR15,0,T_CollectorFindDoor,0,&s_collectorfdoor1}; statetype s_collectorfdoor7 = {false,COLLECTOR13,1,T_CollectorFindDoor,0,&s_collectorfdoor8}; statetype s_collectorfdoor6 = {false,COLLECTOR11,0,T_CollectorFindDoor,0,&s_collectorfdoor7}; statetype s_collectorfdoor5 = {false,COLLECTOR9,1,T_CollectorFindDoor,0,&s_collectorfdoor6}; statetype s_collectorfdoor4 = {false,COLLECTOR7,0,T_CollectorFindDoor,0,&s_collectorfdoor5}; statetype s_collectorfdoor3 = {false,COLLECTOR5,1,T_CollectorFindDoor,0,&s_collectorfdoor4}; statetype s_collectorfdoor2 = {false,COLLECTOR3,0,T_CollectorFindDoor,0,&s_collectorfdoor3}; statetype s_collectorfdoor1 = {false,COLLECTOR1,1,T_CollectorFindDoor,0,&s_collectorfdoor2}; #else statetype s_collectorfdoor8 = {false,DOPE8,2,T_CollectorFindDoor,0,&s_collectorfdoor1}; statetype s_collectorfdoor7 = {false,DOPE7,2,T_CollectorFindDoor,0,&s_collectorfdoor8}; statetype s_collectorfdoor6 = {false,DOPE6,2,T_CollectorFindDoor,0,&s_collectorfdoor7}; statetype s_collectorfdoor5 = {false,DOPE5,2,T_CollectorFindDoor,0,&s_collectorfdoor6}; statetype s_collectorfdoor4 = {false,DOPE4,2,T_CollectorFindDoor,0,&s_collectorfdoor5}; statetype s_collectorfdoor3 = {false,DOPE3,2,T_CollectorFindDoor,0,&s_collectorfdoor4}; statetype s_collectorfdoor2 = {false,DOPE2,2,T_CollectorFindDoor,0,&s_collectorfdoor3}; statetype s_collectorfdoor1 = {false,DOPE1,2,T_CollectorFindDoor,0,&s_collectorfdoor2}; #endif statetype s_timekeeper = {false,NOTHING,140,T_End,0,NULL}; statetype s_wind = {false,-1,10,T_Wind,0,&s_wind}; statetype s_deadblood8 = {false,NOTHING,0,T_Blood,0,&s_deadblood8}; statetype s_deadblood7 = {false,DEADBLOOD7,5,NULL,0,&s_deadblood8}; statetype s_deadblood6 = {false,DEADBLOOD6,5,NULL,0,&s_deadblood7}; statetype s_deadblood5 = {false,DEADBLOOD5,5,NULL,0,&s_deadblood6}; statetype s_deadblood4 = {false,DEADBLOOD4,5,NULL,0,&s_deadblood5}; statetype s_deadblood3 = {false,DEADBLOOD3,5,NULL,0,&s_deadblood4}; statetype s_deadblood2 = {false,DEADBLOOD2,5,NULL,0,&s_deadblood3}; statetype s_deadblood1 = {false,DEADBLOOD1,5,NULL,0,&s_deadblood2}; /* statetype s_rain7 = {false,RAINDROP6,0,NULL,0,NULL}; statetype s_rain6 = {false,RAINDROP5,3,NULL,0,&s_rain7}; statetype s_rain5 = {false,RAINDROP4,0,NULL,0,&s_rain6}; statetype s_rain4 = {false,RAINDROP3,3,NULL,0,&s_rain5}; statetype s_rain3 = {false,RAINDROP2,0,NULL,0,&s_rain4}; statetype s_rain2 = {false,RAINDROP1,0,T_RainFall,0,&s_rain2}; statetype s_rain1 = {false,NOTHING,50,T_RainSpawn,0,&s_rain1}; statetype s_rainmaster = {false,NOTHING,0,T_RainMaster,0,&s_rainmaster}; */ statetype s_pathdisk = {false,PLATFORM1,0,T_Path,0,&s_pathdisk}; statetype s_elevdisk = {false,PLATFORM1,0,T_ElevDisk,0,&s_elevdisk}; statetype s_diskmaster = {false,NOTHING,0,T_ElevDisk,0,&s_diskmaster}; statetype s_blooddrip4 = {false,WALLGIB4,3,T_BloodFall,0,&s_blooddrip1}; statetype s_blooddrip3 = {false,WALLGIB3,3,T_BloodFall,0,&s_blooddrip4}; statetype s_blooddrip2 = {false,WALLGIB2,3,T_BloodFall,0,&s_blooddrip3}; statetype s_blooddrip1 = {false,WALLGIB1,3,T_BloodFall,0,&s_blooddrip2}; //==================== Push column =====================================// statetype s_pushcolumn1 = {false,SPR_PUSHCOLUMN1,6,T_MoveColumn,0,&s_pushcolumn1}; statetype s_pushcolumn2 = {false,SPR_PUSHCOLUMN1,6,T_MoveColumn,0,&s_pushcolumn2}; statetype s_pushcolumn3 = {false,SPR_PUSHCOLUMN1,6,T_MoveColumn,0,&s_pushcolumn3}; //=================== Wall Fire =======================================/ statetype s_wallfireball = {false,NOTHING,50,A_Wallfire,0,&s_wallfireball}; statetype s_crossfire2 = {true,SPR_CROSSFIRE31,6,T_Projectile,0,&s_crossfire1}; statetype s_crossfire1 = {true,SPR_CROSSFIRE11,6,T_Projectile,0,&s_crossfire2}; statetype s_crossdone5 = {false,SPR_CREXP5,6,NULL,0,NULL}; statetype s_crossdone4 = {false,SPR_CREXP4,6,NULL,0,&s_crossdone5}; statetype s_crossdone3 = {false,SPR_CREXP3,6,NULL,0,&s_crossdone4}; statetype s_crossdone2 = {false,SPR_CREXP2,6,NULL,0,&s_crossdone3}; statetype s_crossdone1 = {false,SPR_CREXP1,6,NULL,0,&s_crossdone2}; //=============== gib/related states ===========================================// statetype s_bossdeath = {false,NOTHING,140,T_BossDied,0,NULL}; statetype s_megaremove = {false,NOTHING,0,NULL,0,NULL}; statetype s_megaexplosions = {false,NOTHING,0,T_BossExplosions,0,&s_megaexplosions}; statetype s_superparticles = {false,NOTHING,0,T_ParticleGenerate,0,&s_superparticles}; statetype s_gibsdone8 = {false,PARTICLE12,2,NULL,0,NULL}; statetype s_gibsdone7 = {false,PARTICLE11,2,NULL,0,&s_gibsdone8}; //MED statetype s_gibsdone6 = {false,PARTICLE10,2,NULL,0,&s_gibsdone7}; statetype s_gibsdone5 = {false,PARTICLE09,2,NULL,0,&s_gibsdone6}; statetype s_gibsdone4 = {false,PARTICLE08,2,NULL,0,&s_gibsdone5}; statetype s_gibsdone3 = {false,PARTICLE07,2,NULL,0,&s_gibsdone4}; statetype s_gibsdone2 = {false,PARTICLE06,2,NULL,0,&s_gibsdone3}; statetype s_gibsdone1 = {false,PARTICLE05,2,NULL,0,&s_gibsdone2}; statetype s_gibs4 = {false,PARTICLE04,2,T_Particle,0,&s_gibs1}; statetype s_gibs3 = {false,PARTICLE03,2,T_Particle,0,&s_gibs4}; statetype s_gibs2 = {false,PARTICLE02,2,T_Particle,0,&s_gibs3}; statetype s_gibs1 = {false,PARTICLE01,2,T_Particle,0,&s_gibs2}; //statetype s_head = {false,DEADHEAD,4200,NULL,0,&s_gibsdone2}; statetype s_eye3 = {false,NOTHING,7,T_SlideDownScreen,SF_EYE3,&s_eye1}; statetype s_eye2 = {false,NOTHING,7,T_SlideDownScreen,SF_EYE2,&s_eye3}; statetype s_eye1 = {false,NOTHING,7,T_SlideDownScreen,SF_EYE1,&s_eye2}; statetype s_littlesoul = {false,LITTLESOUL,0,MissileMovement,0,&s_littlesoul}; statetype s_bigsoul = {false,BIGSOUL,0,MissileMovement,0,&s_bigsoul}; statetype s_vaporized8 = {false,VAPORIZED8,0,T_Convert,0,NULL}; statetype s_vaporized7 = {false,VAPORIZED7,3,NULL,0,&s_vaporized8}; statetype s_vaporized6 = {false,VAPORIZED6,3,NULL,0,&s_vaporized7}; statetype s_vaporized5 = {false,VAPORIZED5,3,NULL,0,&s_vaporized6}; statetype s_vaporized4 = {false,VAPORIZED4,3,NULL,0,&s_vaporized5}; statetype s_vaporized3 = {false,VAPORIZED3,3,NULL,0,&s_vaporized4}; statetype s_vaporized2 = {false,VAPORIZED2,3,NULL,0,&s_vaporized3}; statetype s_vaporized1 = {false,VAPORIZED1,3,NULL,0,&s_vaporized2}; statetype s_respawn8 = {false,VAPORIZED1,0,SetShapeoffset,0,&s_player}; statetype s_respawn7 = {false,VAPORIZED2,3,NULL,0,&s_respawn8}; statetype s_respawn6 = {false,VAPORIZED3,3,NULL,0,&s_respawn7}; statetype s_respawn5 = {false,VAPORIZED4,3,NULL,0,&s_respawn6}; statetype s_respawn4 = {false,VAPORIZED5,3,NULL,0,&s_respawn5}; statetype s_respawn3 = {false,VAPORIZED6,3,NULL,0,&s_respawn4}; statetype s_respawn2 = {false,VAPORIZED7,3,NULL,0,&s_respawn3}; statetype s_respawn1 = {false,VAPORIZED8,3,NULL,0,&s_respawn2}; #if (SHAREWARE == 0) //========================= NON-SHAREWARE STATES ============================ statetype s_scottwander7 = {false,SCOTHEAD7,4,T_CollectorWander,0,&s_scottwander1}; statetype s_scottwander6 = {false,SCOTHEAD6,4,T_CollectorWander,0,&s_scottwander7}; statetype s_scottwander5 = {false,SCOTHEAD5,4,T_CollectorWander,0,&s_scottwander6}; statetype s_scottwander4 = {false,SCOTHEAD4,4,T_CollectorWander,0,&s_scottwander5}; statetype s_scottwander3 = {false,SCOTHEAD3,4,T_CollectorWander,0,&s_scottwander4}; statetype s_scottwander2 = {false,SCOTHEAD2,4,T_CollectorWander,0,&s_scottwander3}; statetype s_scottwander1 = {false,SCOTHEAD1,4,T_CollectorWander,0,&s_scottwander2}; statetype s_scottwanderdoor7 = {false,SCOTHEAD7,4,T_CollectorWander,0,&s_scottwanderdoor1}; statetype s_scottwanderdoor6 = {false,SCOTHEAD6,4,T_CollectorWander,0,&s_scottwanderdoor7}; statetype s_scottwanderdoor5 = {false,SCOTHEAD5,4,T_CollectorWander,0,&s_scottwanderdoor6}; statetype s_scottwanderdoor4 = {false,SCOTHEAD4,4,T_CollectorWander,0,&s_scottwanderdoor5}; statetype s_scottwanderdoor3 = {false,SCOTHEAD3,4,T_CollectorWander,0,&s_scottwanderdoor4}; statetype s_scottwanderdoor2 = {false,SCOTHEAD2,4,T_CollectorWander,0,&s_scottwanderdoor3}; statetype s_scottwanderdoor1 = {false,SCOTHEAD1,4,T_CollectorWander,0,&s_scottwanderdoor2}; /* =========================================================================== OVERPATROLS (op) , =========================================================================== */ statetype s_opstand = {true,SPR_OP_S1,0,T_Stand,0,&s_opstand}; statetype s_oppath4 = {true,SPR_OP_W41,10,T_Path,0,&s_oppath1}; statetype s_oppath3 = {true,SPR_OP_W31,10,T_Path,SF_CLOSE,&s_oppath4}; statetype s_oppath2 = {true,SPR_OP_W21,10,T_Path,0,&s_oppath3}; statetype s_oppath1 = {true,SPR_OP_W11,10,T_Path,SF_CLOSE,&s_oppath2}; statetype s_opcollide = {false,SPR_OP_PAIN1,0,T_Collide,0,&s_opcollide}; statetype s_opcollide2 = {false,SPR_OP_PAIN2,0,T_Collide,0,&s_opcollide2}; //statetype s_opuse2 = {true,SPR_OP_USE21,10,T_Use,0,&s_oppath1}; //statetype s_opuse1 = {true,SPR_OP_USE11,10,T_Use,0,&s_opuse2}; statetype s_opshoot4 = {false,SPR_OP_SHOOT4,10,ActorMovement,0,&s_opchase1}; statetype s_opshoot3 = {false,SPR_OP_SHOOT3,10,ActorMovement,0,&s_opshoot4}; statetype s_opshoot2 = {false,SPR_OP_SHOOT2,20,A_Shoot,0,&s_opshoot3}; statetype s_opshoot1 = {false,SPR_OP_SHOOT1,6,ActorMovement,0,&s_opshoot2}; statetype s_opbolo5 = {false,SPR_OP_BOLOSHOOT5,6,ActorMovement,0,&s_opchase1}; statetype s_opbolo4 = {false,SPR_OP_BOLOSHOOT4,6,ActorMovement,0,&s_opbolo5}; statetype s_opbolo3 = {false,SPR_OP_BOLOSHOOT3,20,A_MissileWeapon,0,&s_opbolo4}; statetype s_opbolo2 = {false,SPR_OP_BOLOSHOOT2,6,ActorMovement,0,&s_opbolo3}; statetype s_opbolo1 = {false,SPR_OP_BOLOSHOOT1,6,ActorMovement,0,&s_opbolo2}; statetype s_bolocast4 = {false,SPR_BOLO4,6,T_Projectile,0,&s_bolocast4}; statetype s_bolocast3 = {false,SPR_BOLO3,6,T_Projectile,0,&s_bolocast4}; statetype s_bolocast2 = {false,SPR_BOLO2,6,T_Projectile,0,&s_bolocast3}; statetype s_bolocast1 = {false,SPR_BOLO1,6,T_Projectile,0,&s_bolocast2}; statetype s_opchase4 = {true,SPR_OP_W41,6,T_Chase,0,&s_opchase1}; statetype s_opchase3 = {true,SPR_OP_W31,6,T_Chase,SF_CLOSE,&s_opchase4}; statetype s_opchase2 = {true,SPR_OP_W21,6,T_Chase,0,&s_opchase3}; statetype s_opchase1 = {true,SPR_OP_W11,6,T_Chase,SF_CLOSE,&s_opchase2}; statetype s_opdead = {false,SPR_OP_ALTDEAD,0,T_Collide,0,&s_opdead}; statetype s_opdie5 = {false,SPR_OP_ALTDIE5,5,T_Collide,0,&s_opdead}; statetype s_opdie4 = {false,SPR_OP_ALTDIE4,5,T_Collide,0,&s_opdie5}; statetype s_opdie3 = {false,SPR_OP_ALTDIE3,5,T_Collide,0,&s_opdie4}; statetype s_opdie2 = {false,SPR_OP_ALTDIE2,5,T_Collide,0,&s_opdie3}; statetype s_opdie1 = {false,SPR_OP_ALTDIE1,5,T_Collide,0,&s_opdie2}; statetype s_opcrushed2 = {false,SPR_OP_DIE3,2,NULL,0,&s_opdead}; statetype s_opcrushed1 = {false,SPR_OP_DIE1,2,NULL,0,&s_opcrushed2}; /* ============================================================================ DEATH MONKS ============================================================================ */ statetype s_dmonkstand = {true,SPR_MONK_S1,0,T_Stand,0,&s_dmonkstand}; statetype s_dmonkpath4 = {true,SPR_MONK_W41,10,T_Path,0,&s_dmonkpath1}; statetype s_dmonkpath3 = {true,SPR_MONK_W31,10,T_Path,SF_CLOSE,&s_dmonkpath4}; statetype s_dmonkpath2 = {true,SPR_MONK_W21,10,T_Path,0,&s_dmonkpath3}; statetype s_dmonkpath1 = {true,SPR_MONK_W11,10,T_Path,SF_CLOSE,&s_dmonkpath2}; statetype s_dmonkcollide = {false,SPR_MONK_PAIN1,0,T_Collide,0,&s_dmonkcollide}; statetype s_dmonkcollide2 = {false,SPR_MONK_PAIN2,0,T_Collide,0,&s_dmonkcollide2}; statetype s_dmonkshoot6 = {false,SPR_MONK_DRAIN6,20,ActorMovement,0,&s_dmonkchase1}; statetype s_dmonkshoot5 = {false,SPR_MONK_DRAIN5,20,ActorMovement,0,&s_dmonkshoot6}; statetype s_dmonkshoot4 = {false,SPR_MONK_DRAIN4,20,ActorMovement,0,&s_dmonkshoot3}; statetype s_dmonkshoot3 = {false,SPR_MONK_DRAIN3,20,A_Drain,0,&s_dmonkshoot4}; statetype s_dmonkshoot2 = {false,SPR_MONK_DRAIN2,20,ActorMovement,0,&s_dmonkshoot3}; statetype s_dmonkshoot1 = {false,SPR_MONK_DRAIN1,20,A_Drain,0,&s_dmonkshoot2}; statetype s_dmonkchase4 = {true,SPR_MONK_W41,6,T_Chase,0,&s_dmonkchase1}; statetype s_dmonkchase3 = {true,SPR_MONK_W31,6,T_Chase,SF_CLOSE,&s_dmonkchase4}; statetype s_dmonkchase2 = {true,SPR_MONK_W21,6,T_Chase,0,&s_dmonkchase3}; statetype s_dmonkchase1 = {true,SPR_MONK_W11,6,T_Chase,SF_CLOSE,&s_dmonkchase2}; statetype s_dmonkdead = {false,SPR_MONK_DEAD,0,T_Collide,0,&s_dmonkdead}; statetype s_dmonkdie4 = {false,SPR_MONK_DIE4,5,T_Collide,0,&s_dmonkdead}; statetype s_dmonkdie3 = {false,SPR_MONK_DIE3,5,T_Collide,0,&s_dmonkdie4}; statetype s_dmonkdie2 = {false,SPR_MONK_DIE2,5,T_Collide,0,&s_dmonkdie3}; statetype s_dmonkdie1 = {false,SPR_MONK_DIE1,5,T_Collide,0,&s_dmonkdie2}; statetype s_dmonkcrushed2 = {false,SPR_MONK_DIE3,2,NULL,0,&s_dmonkdead}; statetype s_dmonkcrushed1 = {false,SPR_MONK_DIE1,2,NULL,0,&s_dmonkcrushed2}; /* ============================================================================ DEATH FIRE MONKS ============================================================================ */ statetype s_firemonkstand = {true,SPR_FIREMONK_S1,0,T_Stand,0,&s_firemonkstand}; statetype s_firemonkpath4 = {true,SPR_FIREMONK_W41,10,T_Path,0,&s_firemonkpath1}; statetype s_firemonkpath3 = {true,SPR_FIREMONK_W31,10,T_Path,SF_CLOSE,&s_firemonkpath4}; statetype s_firemonkpath2 = {true,SPR_FIREMONK_W21,10,T_Path,0,&s_firemonkpath3}; statetype s_firemonkpath1 = {true,SPR_FIREMONK_W11,10,T_Path,SF_CLOSE,&s_firemonkpath2}; statetype s_firemonkcollide = {false,SPR_FIREMONK_PAIN1,0,T_Collide,0,&s_firemonkcollide}; statetype s_firemonkcollide2 = {false,SPR_FIREMONK_PAIN2,0,T_Collide,0,&s_firemonkcollide2}; statetype s_firemonkcast7 = {false,SPR_FIREMONK_CAST7,6,ActorMovement,0,&s_firemonkchase1}; statetype s_firemonkcast6 = {false,SPR_FIREMONK_CAST6,40,A_MissileWeapon,0,&s_firemonkcast7}; statetype s_firemonkcast5 = {false,SPR_FIREMONK_CAST5,6,ActorMovement,0,&s_firemonkcast6}; statetype s_firemonkcast4 = {false,SPR_FIREMONK_CAST4,6,ActorMovement,0,&s_firemonkcast5}; statetype s_firemonkcast3 = {false,SPR_FIREMONK_CAST3,6,ActorMovement,0,&s_firemonkcast4}; statetype s_firemonkcast2 = {false,SPR_FIREMONK_CAST2,6,ActorMovement,0,&s_firemonkcast3}; statetype s_firemonkcast1 = {false,SPR_FIREMONK_CAST1,6,ActorMovement,0,&s_firemonkcast2}; statetype s_monkfire4 = {false,MONKFIRE4,3,T_Projectile,0,&s_monkfire1}; statetype s_monkfire3 = {false,MONKFIRE3,3,T_Projectile,0,&s_monkfire4}; statetype s_monkfire2 = {false,MONKFIRE2,3,T_Projectile,0,&s_monkfire3}; statetype s_monkfire1 = {false,MONKFIRE1,3,T_Projectile,0,&s_monkfire2}; statetype s_fireballhit3 = {false,SPR_FIREBALL_HIT3,5,NULL,0,NULL}; statetype s_fireballhit2 = {false,SPR_FIREBALL_HIT2,5,NULL,0,&s_fireballhit3}; statetype s_fireballhit1 = {false,SPR_FIREBALL_HIT1,5,NULL,0,&s_fireballhit2}; statetype s_firemonkchase4 = {true,SPR_FIREMONK_W41,6,T_Chase,0,&s_firemonkchase1}; statetype s_firemonkchase3 = {true,SPR_FIREMONK_W31,6,T_Chase,SF_CLOSE,&s_firemonkchase4}; statetype s_firemonkchase2 = {true,SPR_FIREMONK_W21,6,T_Chase,0,&s_firemonkchase3}; statetype s_firemonkchase1 = {true,SPR_FIREMONK_W11,6,T_Chase,SF_CLOSE,&s_firemonkchase2}; statetype s_firemonkdead7 = {false,SPR_FIREMONK_DEAD7,0,T_Collide,0,&s_firemonkdead7}; statetype s_firemonkdead6 = {false,SPR_FIREMONK_DEAD6,5,T_Collide,0,&s_firemonkdead7}; statetype s_firemonkdead5 = {false,SPR_FIREMONK_DEAD5,5,T_Collide,0,&s_firemonkdead6}; statetype s_firemonkdead4 = {false,SPR_FIREMONK_DEAD4,5,T_Collide,0,&s_firemonkdead5}; statetype s_firemonkdead3 = {false,SPR_FIREMONK_DEAD3,5,T_Collide,0,&s_firemonkdead4}; statetype s_firemonkdead2 = {false,SPR_FIREMONK_DEAD2,5,T_Collide,0,&s_firemonkdead3}; statetype s_firemonkdead = {false,SPR_FIREMONK_DEAD1,5,T_Collide,0,&s_firemonkdead2}; statetype s_firemonkdie4 = {false,SPR_FIREMONK_DIE3,5,T_Collide,0,&s_firemonkdead}; statetype s_firemonkdie3 = {false,SPR_FIREMONK_DIE3,5,T_Collide,0,&s_firemonkdie4}; statetype s_firemonkdie2 = {false,SPR_FIREMONK_DIE2,5,T_Collide,0,&s_firemonkdie3}; statetype s_firemonkdie1 = {false,SPR_FIREMONK_DIE1,5,T_Collide,0,&s_firemonkdie2}; statetype s_firemonkcrushed2 = {false,SPR_FIREMONK_DIE3,2,NULL,0,&s_firemonkdead}; statetype s_firemonkcrushed1 = {false,SPR_FIREMONK_DIE1,2,NULL,0,&s_firemonkcrushed2}; /*=========================================================================== INSANE WALL DUDE ============================================================================*/ statetype s_wallstand = {16,BCRAFT01,0,T_Stand,0,&s_wallstand}; statetype s_wallpath = {16,BCRAFT01,20,T_AutoPath,0,&s_wallpath}; statetype s_wallshoot = {16,BCRAFT01,15,A_MissileWeapon,0,&s_wallshoot}; statetype s_wallalign = {16,BCRAFT01,0,T_AutoShootAlign,0,&s_wallalign}; statetype s_wallwait = {16,BCRAFT01,0,NULL,0,&s_wallwait}; statetype s_wallrestore = {16,BCRAFT01,0,T_AutoRealign,0,&s_wallrestore}; statetype s_wallcollide = {16,BCRAFT01,0,T_Collide,0,&s_wallcollide}; /* =========================================================================== ESAU GUDERIAN =========================================================================== */ statetype s_darianstand = {true,SPR_DARIAN_S1,0,T_Stand,0,&s_darianstand}; statetype s_darianchase4 = {true,SPR_DARIAN_W41,8,T_EsauChase,0,&s_darianchase1}; statetype s_darianchase3 = {true,SPR_DARIAN_W31,8,T_EsauChase,SF_CLOSE,&s_darianchase4}; statetype s_darianchase2 = {true,SPR_DARIAN_W21,8,T_EsauChase,0,&s_darianchase3}; statetype s_darianchase1 = {true,SPR_DARIAN_W11,8,T_EsauChase,SF_CLOSE,&s_darianchase2}; statetype s_darianrise8 = {false,SPR_DARIAN_SINK1,3,NULL,0,&s_darianwait}; statetype s_darianrise7 = {false,SPR_DARIAN_SINK2,3,NULL,0,&s_darianrise8}; statetype s_darianrise6 = {false,SPR_DARIAN_SINK3,3,NULL,0,&s_darianrise7}; statetype s_darianrise5 = {false,SPR_DARIAN_SINK4,3,NULL,0,&s_darianrise6}; statetype s_darianrise4 = {false,SPR_DARIAN_SINK5,3,NULL,0,&s_darianrise5}; statetype s_darianrise3 = {false,SPR_DARIAN_SINK6,3,NULL,0,&s_darianrise4}; statetype s_darianrise2 = {false,SPR_DARIAN_SINK7,3,NULL,0,&s_darianrise3}; statetype s_darianrise1 = {false,SPR_DARIAN_SINK8,3,NULL,0,&s_darianrise2}; statetype s_dariansink9 = {false,NOTHING,110,T_EsauRise,0,&s_darianrise1}; statetype s_dariansink8 = {false,SPR_DARIAN_SINK8,3,NULL,0,&s_dariansink9}; statetype s_dariansink7 = {false,SPR_DARIAN_SINK7,3,NULL,0,&s_dariansink8}; statetype s_dariansink6 = {false,SPR_DARIAN_SINK6,3,NULL,0,&s_dariansink7}; statetype s_dariansink5 = {false,SPR_DARIAN_SINK5,3,NULL,0,&s_dariansink6}; statetype s_dariansink4 = {false,SPR_DARIAN_SINK4,3,NULL,0,&s_dariansink5}; statetype s_dariansink3 = {false,SPR_DARIAN_SINK3,3,NULL,0,&s_dariansink4}; statetype s_dariansink2 = {false,SPR_DARIAN_SINK2,3,NULL,0,&s_dariansink3}; statetype s_dariansink1 = {false,SPR_DARIAN_SINK1,3,NULL,0,&s_dariansink2}; statetype s_dariancollide = {false,SPR_DARIAN_PAIN1,0,T_Collide,0,&s_dariancollide}; statetype s_dariancollide2 = {false,SPR_DARIAN_PAIN2,0,T_Collide,0,&s_dariancollide2}; statetype s_darianshoot4 = {false,SPR_DARIAN_SHOOT4,10,NULL,0,&s_darianchase1}; statetype s_darianshoot3 = {false,SPR_DARIAN_SHOOT3,10,NULL,0,&s_darianshoot4}; statetype s_darianshoot2 = {false,SPR_DARIAN_SHOOT2,20,A_MissileWeapon,0,&s_darianshoot3}; statetype s_darianshoot1 = {false,SPR_DARIAN_SHOOT1,10,NULL,0,&s_darianshoot2}; statetype s_dariandefend3 = {false,SPR_DARIAN_SHOOT3,10,NULL,0,&s_darianwait}; statetype s_dariandefend2 = {false,SPR_DARIAN_SHOOT2,20,A_MissileWeapon,0,&s_dariandefend3}; statetype s_dariandefend1 = {false,SPR_DARIAN_SHOOT1,10,NULL,0,&s_dariandefend2}; statetype s_darianuse4 = {true,SPR_DARIAN_USE11,10,NULL,0,&s_darianspears}; statetype s_darianuse3 = {true,SPR_DARIAN_USE21,10,T_Use,0,&s_darianuse4}; statetype s_darianuse2 = {true,SPR_DARIAN_USE11,30,NULL,0,&s_darianuse3}; statetype s_darianuse1 = {true,SPR_DARIAN_S1,40,NULL,0,&s_darianuse2}; statetype s_darianwait = {false,SPR_DARIAN_SHOOT1,0,T_EsauWait,0,&s_darianwait}; statetype s_darianspears = {true,SPR_DARIAN_S1,280,NULL,0,&s_darianchase1}; statetype s_dspear16 = {false,SPEARDOWN7,2,T_Spears,SF_DOWN,NULL}; statetype s_dspear15 = {false,SPEARDOWN6,2,T_Spears,SF_CRUSH,&s_dspear16}; statetype s_dspear14 = {false,SPEARDOWN5,2,T_Spears,SF_CRUSH,&s_dspear15}; statetype s_dspear13 = {false,SPEARDOWN4,2,T_Spears,SF_CRUSH,&s_dspear14}; statetype s_dspear12 = {false,SPEARDOWN3,2,T_Spears,SF_CRUSH,&s_dspear13}; statetype s_dspear11 = {false,SPEARDOWN2,2,T_Spears,SF_CRUSH,&s_dspear12}; statetype s_dspear10 = {false,SPEARDOWN1,2,T_Spears,SF_CRUSH,&s_dspear11}; statetype s_dspear9 = {false,SPEARDOWN16,2,T_Spears,SF_CRUSH,&s_dspear10}; statetype s_dspear8 = {false,SPEARDOWN15,2,T_Spears,SF_CRUSH,&s_dspear9}; statetype s_dspear7 = {false,SPEARDOWN14,2,T_Spears,SF_CRUSH,&s_dspear8}; statetype s_dspear6 = {false,SPEARDOWN13,2,T_Spears,SF_CRUSH,&s_dspear7}; statetype s_dspear5 = {false,SPEARDOWN12,2,T_Spears,SF_CRUSH,&s_dspear6}; statetype s_dspear4 = {false,SPEARDOWN11,2,T_Spears,SF_CRUSH,&s_dspear5}; statetype s_dspear3 = {false,SPEARDOWN10,2,T_Spears,SF_CRUSH,&s_dspear4}; statetype s_dspear2 = {false,SPEARDOWN9,2,T_Spears,SF_DOWN,&s_dspear3}; statetype s_dspear1 = {false,SPEARDOWN8,2,T_Spears,SF_DOWN,&s_dspear2}; statetype s_dariandead2 = {false,SPR_DARIAN_DEAD,0,T_BossDied,0,&s_dariandead2}; statetype s_dariandead1 = {false,SPR_DARIAN_DEAD,140,NULL,0,&s_dariandead2}; statetype s_dariandead = {false,SPR_DARIAN_DEAD,0,NULL,0,&s_dariandead1}; statetype s_dariandie10 = {false,SPR_DARIAN_DIE10,5,NULL,0,&s_dariandead}; statetype s_dariandie9 = {false,SPR_DARIAN_DIE9,5,NULL,0,&s_dariandie10}; statetype s_dariandie8 = {false,SPR_DARIAN_DIE8,5,NULL,0,&s_dariandie9}; statetype s_dariandie7 = {false,SPR_DARIAN_DIE7,5,NULL,0,&s_dariandie8}; statetype s_dariandie6 = {false,SPR_DARIAN_DIE6,5,T_Guts,0,&s_dariandie7}; statetype s_dariandie5 = {false,SPR_DARIAN_DIE5,5,NULL,0,&s_dariandie6}; statetype s_dariandie4 = {false,SPR_DARIAN_DIE4,5,NULL,0,&s_dariandie5}; statetype s_dariandie3 = {false,SPR_DARIAN_DIE3,5,NULL,0,&s_dariandie4}; statetype s_dariandie2 = {false,SPR_DARIAN_DIE2,5,NULL,0,&s_dariandie3}; statetype s_dariandie1 = {false,SPR_DARIAN_DIE1,70,T_Collide,0,&s_dariandie2}; /* =========================================================================== HEINRICH KRIST =========================================================================== */ statetype s_heinrichstand = {true,SPR_KRIST_S1,0,T_Stand,0,&s_heinrichstand}; statetype s_heinrichchase = {true,SPR_KRIST_FOR1,10,T_HeinrichChase,0,&s_heinrichchase}; statetype s_kristleft = {true,SPR_KRIST_LEFT1,10,T_KristLeft,0,&s_kristleft}; statetype s_kristright = {true,SPR_KRIST_RIGHT1,10,T_KristRight,0,&s_kristright}; statetype s_heinrichshoot11 = {false,SPR_KRIST_SHOOT11,8,NULL,0,&s_heinrichchase}; statetype s_heinrichshoot10 = {false,SPR_KRIST_SHOOT10,8,NULL,0,&s_heinrichshoot11}; statetype s_heinrichshoot9 = {false,SPR_KRIST_SHOOT9,8,A_HeinrichShoot,0,&s_heinrichshoot10}; statetype s_heinrichshoot8 = {false,SPR_KRIST_SHOOT8,8,NULL,0,&s_heinrichshoot9}; statetype s_heinrichshoot7 = {false,SPR_KRIST_SHOOT7,8,T_KristCheckFire,0,&s_heinrichshoot8}; statetype s_heinrichshoot6 = {false,SPR_KRIST_SHOOT6,8,NULL,0,&s_heinrichshoot7}; statetype s_heinrichshoot5 = {false,SPR_KRIST_SHOOT5,8,NULL,0,&s_heinrichshoot6}; statetype s_heinrichshoot4 = {false,SPR_KRIST_SHOOT4,8,A_HeinrichShoot,0,&s_heinrichshoot5}; statetype s_heinrichshoot3 = {false,SPR_KRIST_SHOOT3,8,NULL,0,&s_heinrichshoot4}; statetype s_heinrichshoot2 = {false,SPR_KRIST_SHOOT2,8,NULL,0,&s_heinrichshoot3}; statetype s_heinrichshoot1 = {false,SPR_KRIST_SHOOT1,8,T_KristCheckFire,0,&s_heinrichshoot2}; statetype s_missile1 = {16,SPR_BJMISS11,6,T_Projectile,0,&s_missile1}; statetype s_missilehit3 = {false,SPR_MISSILEHIT3,6,NULL,0,NULL}; statetype s_missilehit2 = {false,SPR_MISSILEHIT2,6,NULL,0,&s_missilehit3}; statetype s_missilehit1 = {false,SPR_MISSILEHIT1,6,NULL,0,&s_missilehit2}; statetype s_mine4 = {false,SPR_MINE4,3,T_Projectile,0,&s_mine1}; statetype s_mine3 = {false,SPR_MINE3,3,T_Projectile,0,&s_mine4}; statetype s_mine2 = {false,SPR_MINE2,3,T_Projectile,0,&s_mine3}; statetype s_mine1 = {false,SPR_MINE1,3,T_Projectile,0,&s_mine2}; statetype s_heinrichdefend = {true,SPR_KRIST_MINERIGHT1,35,T_Heinrich_Defend,0,&s_heinrichdefend}; statetype s_heinrichooc = {true,SPR_KRIST_DEAD1,0,T_Heinrich_Out_of_Control,0,&s_heinrichooc}; statetype s_heinrichdead = {false,SPR_KRIST_DEAD1,35,T_Collide,0,&s_heinrichooc}; statetype s_heinrichdie2 = {false,SPR_KRIST_DIE2,35,T_Collide,0,&s_heinrichdead}; statetype s_heinrichdie1 = {false,SPR_KRIST_DIE1,35,T_Collide,0,&s_heinrichdie2}; statetype s_heindead2 = {false,-1,0,T_BossDied,0,NULL}; statetype s_heindead1 = {false, -1, 140,NULL,0,&s_heindead2}; statetype s_heinexp13 = {false,SPR_EXPLOSION13,2,NULL,0,&s_heindead1}; statetype s_heinexp12 = {false,SPR_EXPLOSION12,2,NULL,0,&s_heinexp13}; statetype s_heinexp11 = {false,SPR_EXPLOSION11,2,NULL,0,&s_heinexp12}; statetype s_heinexp10 = {false,SPR_EXPLOSION10,2,NULL,0,&s_heinexp11}; statetype s_heinexp9 = {false,SPR_EXPLOSION9,2,NULL,0,&s_heinexp10}; statetype s_heinexp8 = {false,SPR_EXPLOSION8,2,NULL,0,&s_heinexp9}; statetype s_heinexp7 = {false,SPR_EXPLOSION7,2,NULL,0,&s_heinexp8}; statetype s_heinexp6 = {false,SPR_EXPLOSION6,2,NULL,0,&s_heinexp7}; statetype s_heinexp5 = {false,SPR_EXPLOSION5,2,NULL,0,&s_heinexp6}; statetype s_heinexp4 = {false,SPR_EXPLOSION4,2,NULL,0,&s_heinexp5}; statetype s_heinexp3 = {false,SPR_EXPLOSION3,2,T_Explosion,0,&s_heinexp4}; statetype s_heinexp2 = {false,SPR_EXPLOSION2,2,NULL,0,&s_heinexp3}; statetype s_heinexp1 = {false,SPR_EXPLOSION1,0,NULL,0,&s_heinexp2}; /* =========================================================================== DARK MONK (TOM) =========================================================================== */ statetype s_darkmonkstand = {true,TOMS1,0,T_Stand,0,&s_darkmonkstand}; statetype s_darkmonkland = {true,TOMFLY11,6,NULL,0,&s_darkmonkstand}; statetype s_darkmonkchase2 = {true,TOMFLY21,10,T_DarkmonkChase,0,&s_darkmonkchase2}; statetype s_darkmonkchase1 = {true,TOMFLY11,3,T_DarkmonkChase,0,&s_darkmonkchase2}; statetype s_dmlandandfire = {true,TOMFLY11,0,T_DarkmonkLandAndFire,0,&s_dmlandandfire}; statetype s_darkmonkcover3 = {false,TAWAKEN1,1,NULL,0,&s_darkmonkawaken1}; statetype s_darkmonkcover2 = {false,TAWAKEN2,1,NULL,0,&s_darkmonkcover3}; statetype s_darkmonkcover1 = {false,TAWAKEN3,1,NULL,0,&s_darkmonkcover2}; statetype s_darkmonkawaken5 = {false,TAWAKEN5,3,NULL,0,&s_darkmonkchase1}; statetype s_darkmonkawaken4 = {false,TAWAKEN4,3,NULL,0,&s_darkmonkawaken5}; statetype s_darkmonkawaken3 = {false,TAWAKEN3,3,NULL,0,&s_darkmonkawaken4}; statetype s_darkmonkawaken2 = {false,TAWAKEN2,3,NULL,0,&s_darkmonkawaken3}; statetype s_darkmonkawaken1 = {false,TAWAKEN1,3,NULL,0,&s_darkmonkawaken2}; statetype s_darkmonklightning11 = {false,TOMLG11,3,NULL,0,&s_darkmonkchase1}; statetype s_darkmonklightning10 = {false,TOMLG10,3,NULL,0,&s_darkmonklightning11}; statetype s_darkmonklightning9 = {false,TOMLG9,70,A_DmonkAttack,0,&s_darkmonklightning10}; statetype s_darkmonklightning8 = {false,TOMLG8,3,NULL,0,&s_darkmonklightning9}; statetype s_darkmonklightning7 = {false,TOMLG7,3,NULL,0,&s_darkmonklightning8}; statetype s_darkmonklightning6 = {false,TOMLG6,3,NULL,0,&s_darkmonklightning7}; statetype s_darkmonklightning5 = {false,TOMLG5,3,NULL,0,&s_darkmonklightning6}; statetype s_darkmonklightning4 = {false,TOMLG4,3,NULL,0,&s_darkmonklightning5}; statetype s_darkmonklightning3 = {false,TOMLG3,3,NULL,0,&s_darkmonklightning4}; statetype s_darkmonklightning2 = {false,TOMLG2,3,NULL,0,&s_darkmonklightning3}; statetype s_darkmonklightning1 = {false,TOMLG1,3,NULL,0,&s_darkmonklightning2}; statetype s_darkmonkfspark6 = {false,TOMFS6,3,NULL,0,&s_darkmonkchase1}; statetype s_darkmonkfspark5 = {false,TOMFS5,70,A_DmonkAttack,0,&s_darkmonkfspark6}; statetype s_darkmonkfspark4 = {false,TOMFS4,3,NULL,0,&s_darkmonkfspark5}; statetype s_darkmonkfspark3 = {false,TOMFS3,3,NULL,0,&s_darkmonkfspark4}; statetype s_darkmonkfspark2 = {false,TOMFS2,3,NULL,0,&s_darkmonkfspark3}; statetype s_darkmonkfspark1 = {false,TOMFS1,3,NULL,0,&s_darkmonkfspark2}; statetype s_darkmonkbreathe8 = {false,TOMBR8,3,NULL,0,&s_darkmonkchase1}; statetype s_darkmonkbreathe7 = {false,TOMBR7,3,NULL,0,&s_darkmonkbreathe8}; statetype s_darkmonkbreathe6 = {false,TOMBR6,70,A_DmonkAttack,0,&s_darkmonkbreathe7}; statetype s_darkmonkbreathe5 = {false,TOMBR5,3,NULL,0,&s_darkmonkbreathe6}; statetype s_darkmonkbreathe4 = {false,TOMBR4,3,NULL,0,&s_darkmonkbreathe5}; statetype s_darkmonkbreathe3 = {false,TOMBR3,3,NULL,0,&s_darkmonkbreathe4}; statetype s_darkmonkbreathe2 = {false,TOMBR2,3,NULL,0,&s_darkmonkbreathe3}; statetype s_darkmonkbreathe1 = {false,TOMBR1,70,NULL,0,&s_darkmonkbreathe2}; statetype s_darkmonksummon3 = {false,TOMBR1,3,NULL,0,&s_darkmonkchase1}; statetype s_darkmonksummon2 = {false,TOMBR3,3,NULL,0,&s_darkmonksummon3}; statetype s_darkmonksummon1 = {false,TOMBR2,3,NULL,0,&s_darkmonksummon2}; statetype s_snakepath = {true,TOMHEAD1,0,T_SnakePath,0,&s_snakepath}; statetype s_snakefindpath = {true,TOMHEAD1,0,T_SnakeFindPath,0,&s_snakefindpath}; statetype s_darkmonkhead = {true,TOMHEAD1,0,T_DarkSnakeChase,0,&s_darkmonkhead}; statetype s_darkmonksnakelink = {true,TOMHEAD1,0,T_GenericMove,0,&s_darkmonksnakelink}; statetype s_darkmonkhspawn = {false,NOTHING,78,T_DarkSnakeSpawn,0,NULL}; statetype s_darkmonkfastspawn = {false,NOTHING,35,T_DarkSnakeSpawn,0,NULL}; statetype s_darkmonkheaddead = {false,THDIE2,0,NULL,0,&s_darkmonkheaddead}; statetype s_darkmonkheaddie1 = {false,THDIE1,1400,T_SnakeFinale,0,&s_snakefireworks1}; statetype s_snakefireworks2 = {false,THDIE2,10,T_SnakeFinale,0,&s_snakefireworks1}; statetype s_snakefireworks1 = {false,THDIE1,10,T_SnakeFinale,0,&s_snakefireworks2}; statetype s_darkmonkhball9 = {false,THBALL9,5,NULL,0,&s_darkmonkchase1}; statetype s_darkmonkhball8 = {false,THBALL8,5,NULL,0,&s_darkmonkhball9}; statetype s_darkmonkhball7 = {false,THBALL7,5,A_DmonkAttack,0,&s_darkmonkhball8}; statetype s_darkmonkhball6 = {false,THBALL6,5,NULL,0,&s_darkmonkhball7}; statetype s_darkmonkhball5 = {false,THBALL5,5,NULL,0,&s_darkmonkhball6}; statetype s_darkmonkhball4 = {false,THBALL4,5,NULL,0,&s_darkmonkhball5}; statetype s_darkmonkhball3 = {false,THBALL3,5,NULL,0,&s_darkmonkhball4}; statetype s_darkmonkhball2 = {false,THBALL2,5,NULL,0,&s_darkmonkhball3}; statetype s_darkmonkhball1 = {false,THBALL1,70,NULL,0,&s_darkmonkhball2}; statetype s_darkmonkabsorb9 = {false,THBALL9,3,NULL,0,&s_darkmonksphere1}; statetype s_darkmonkabsorb8 = {false,THBALL8,3,NULL,0,&s_darkmonkabsorb9}; statetype s_darkmonkabsorb7 = {false,THBALL7,3,NULL,0,&s_darkmonkabsorb8}; statetype s_darkmonkabsorb6 = {false,THBALL6,3,NULL,0,&s_darkmonkabsorb7}; statetype s_darkmonkabsorb5 = {false,THBALL5,3,NULL,0,&s_darkmonkabsorb6}; statetype s_darkmonkabsorb4 = {false,THBALL4,3,NULL,0,&s_darkmonkabsorb5}; statetype s_darkmonkabsorb3 = {false,THBALL3,3,NULL,0,&s_darkmonkabsorb4}; statetype s_darkmonkabsorb2 = {false,THBALL2,3,NULL,0,&s_darkmonkabsorb3}; statetype s_darkmonkabsorb1 = {false,THBALL1,3,NULL,0,&s_darkmonkabsorb2}; statetype s_darkmonksphere10 = {false,TSPHERE10,4,NULL,0,&s_darkmonkchase1}; statetype s_darkmonksphere9 = {false,TSPHERE9,4,NULL,0,&s_darkmonksphere10}; statetype s_darkmonksphere8 = {false,TSPHERE8,4,A_DmonkAttack,0,&s_darkmonksphere9}; statetype s_darkmonksphere7 = {false,TSPHERE7,4,NULL,0,&s_darkmonksphere8}; statetype s_darkmonksphere6 = {false,TSPHERE6,4,NULL,0,&s_darkmonksphere7}; statetype s_darkmonksphere5 = {false,TSPHERE5,4,NULL,0,&s_darkmonksphere6}; statetype s_darkmonksphere4 = {false,TSPHERE4,4,NULL,0,&s_darkmonksphere5}; statetype s_darkmonksphere3 = {false,TSPHERE3,4,NULL,0,&s_darkmonksphere4}; statetype s_darkmonksphere2 = {false,TSPHERE2,4,NULL,0,&s_darkmonksphere3}; statetype s_darkmonksphere1 = {false,TSPHERE1,4,NULL,0,&s_darkmonksphere2}; statetype s_dmgreenthing10 = {false,TSPHERE10,4,NULL,0,&s_darkmonkchase1}; statetype s_dmgreenthing9 = {false,TSPHERE9,4,NULL,0,&s_dmgreenthing10}; statetype s_dmgreenthing8 = {false,TSPHERE8,4,A_DmonkAttack,0,&s_dmgreenthing9}; statetype s_dmgreenthing7 = {false,TSPHERE7,4,NULL,0,&s_dmgreenthing8}; statetype s_dmgreenthing6 = {false,TSPHERE6,4,NULL,0,&s_dmgreenthing7}; statetype s_dmgreenthing5 = {false,TSPHERE5,4,NULL,0,&s_dmgreenthing6}; statetype s_dmgreenthing4 = {false,TSPHERE4,4,NULL,0,&s_dmgreenthing5}; statetype s_dmgreenthing3 = {false,TSPHERE3,4,NULL,0,&s_dmgreenthing4}; statetype s_dmgreenthing2 = {false,TSPHERE2,4,NULL,0,&s_dmgreenthing3}; statetype s_dmgreenthing1 = {false,TSPHERE1,4,NULL,0,&s_dmgreenthing2}; statetype s_energysphere4 = {false,TOMSPHERE4,4,T_Projectile,0,&s_energysphere1}; statetype s_energysphere3 = {false,TOMSPHERE3,4,T_Projectile,0,&s_energysphere4}; statetype s_energysphere2 = {false,TOMSPHERE2,4,T_Projectile,0,&s_energysphere3}; statetype s_energysphere1 = {false,TOMSPHERE1,4,T_Projectile,0,&s_energysphere2}; statetype s_lightning = {true,TOMLIGHTNING1,0,T_Projectile,0,&s_lightning}; statetype s_handball2 = {false,TOMHANDBALL2,3,T_Projectile,0,&s_handball1}; statetype s_handball1 = {false,TOMHANDBALL1,3,T_Projectile,0,&s_handball2}; statetype s_faceball2 = {false,TOMFACEBALL2,3,T_Projectile,0,&s_faceball1}; statetype s_faceball1 = {false,TOMFACEBALL1,3,T_Projectile,0,&s_faceball2}; statetype s_floorspark4 = {false,TOMFLOORSPARK4,3,T_Projectile,0,&s_floorspark1}; statetype s_floorspark3 = {false,TOMFLOORSPARK3,3,T_Projectile,0,&s_floorspark4}; statetype s_floorspark2 = {false,TOMFLOORSPARK2,3,T_Projectile,0,&s_floorspark3}; statetype s_floorspark1 = {false,TOMFLOORSPARK1,3,T_Projectile,0,&s_floorspark2}; statetype s_darkmonkreact = {true,TOMFLY11,0,T_DarkmonkReact,0,&s_darkmonkreact}; statetype s_darkmonkbball9 = {false,TBBALL9,4,NULL,0,&s_darkmonkchase1}; statetype s_darkmonkbball8 = {false,TBBALL8,4,NULL,0,&s_darkmonkbball9}; statetype s_darkmonkbball7 = {false,TBBALL7,4,A_DmonkAttack,0,&s_darkmonkbball8}; statetype s_darkmonkbball6 = {false,TBBALL6,4,NULL,0,&s_darkmonkbball7}; statetype s_darkmonkbball5 = {false,TBBALL5,4,NULL,0,&s_darkmonkbball6}; statetype s_darkmonkbball4 = {false,TBBALL4,4,NULL,0,&s_darkmonkbball5}; statetype s_darkmonkbball3 = {false,TBBALL3,4,NULL,0,&s_darkmonkbball4}; statetype s_darkmonkbball2 = {false,TBBALL2,4,NULL,0,&s_darkmonkbball3}; statetype s_darkmonkbball1 = {false,TBBALL1,70,NULL,0,&s_darkmonkbball2}; statetype s_darkmonkcharge10 = {false,TSCAREB3,140,T_DarkmonkCharge,0,&s_darkmonkchase1}; statetype s_darkmonkcharge9 = {false,TAWAKEN5,3,NULL,0,&s_darkmonkcharge10}; statetype s_darkmonkcharge8 = {false,TAWAKEN4,3,NULL,0,&s_darkmonkcharge9}; statetype s_darkmonkcharge7 = {false,TAWAKEN3,3,NULL,0,&s_darkmonkcharge8}; statetype s_darkmonkcharge6 = {false,TAWAKEN2,3,NULL,0,&s_darkmonkcharge7}; statetype s_darkmonkcharge5 = {false,TAWAKEN1,3,NULL,0,&s_darkmonkcharge6}; statetype s_darkmonkcharge4 = {false,TAWAKEN2,3,NULL,0,&s_darkmonkcharge5}; statetype s_darkmonkcharge3 = {false,TAWAKEN3,3,NULL,0,&s_darkmonkcharge4}; statetype s_darkmonkcharge2 = {false,TAWAKEN4,3,NULL,0,&s_darkmonkcharge3}; statetype s_darkmonkcharge1 = {false,TAWAKEN5,3,NULL,0,&s_darkmonkcharge2}; statetype s_darkmonkscare5 = {false,TSCAREB5,3,NULL,0,&s_darkmonkcharge1}; statetype s_darkmonkscare4 = {false,TSCAREB4,3,NULL,0,&s_darkmonkscare5}; statetype s_darkmonkscare3 = {false,TSCAREB3,3,NULL,0,&s_darkmonkscare4}; statetype s_darkmonkscare2 = {false,TSCAREB2,3,NULL,0,&s_darkmonkscare3}; statetype s_darkmonkscare1 = {false,TSCAREB1,3,NULL,0,&s_darkmonkscare2}; statetype s_darkmonkdead = {false,TOMDIE8,0,T_Collide,0,&s_darkmonkdead}; statetype s_darkmonkdie7 = {false,TOMDIE7,3,T_Collide,0,&s_darkmonkdead}; statetype s_darkmonkdie6 = {false,TOMDIE6,3,T_Collide,0,&s_darkmonkdie7}; statetype s_darkmonkdie5 = {false,TOMDIE5,3,T_Collide,0,&s_darkmonkdie6}; statetype s_darkmonkdie4 = {false,TOMDIE4,3,T_Collide,0,&s_darkmonkdie5}; statetype s_darkmonkdie3 = {false,TOMDIE3,3,T_Collide,0,&s_darkmonkdie4}; statetype s_darkmonkdie2 = {false,TOMDIE2,3,T_Collide,0,&s_darkmonkdie3}; statetype s_darkmonkdie1 = {false,TOMDIE1,3,T_Collide,0,&s_darkmonkdie2}; statetype s_darkmonkredhead = {true,TOMRH1,50,T_DarkSnakeChase,0,&s_darkmonkhead}; statetype s_darkmonkredlink = {true,TOMRH1,50,T_GenericMove,0,&s_darkmonksnakelink}; statetype s_redheadhit = {false,THDIE1,35,T_DarkSnakeChase,0,&s_darkmonkhead}; statetype s_redlinkhit = {false,THDIE1,35,T_GenericMove,0,&s_darkmonksnakelink}; statetype s_spithit4 = {false,SPITHIT4,3,NULL,0,NULL}; statetype s_spithit3 = {false,SPITHIT3,3,NULL,0,&s_spithit4}; statetype s_spithit2 = {false,SPITHIT2,3,NULL,0,&s_spithit3}; statetype s_spithit1 = {false,SPITHIT1,3,NULL,0,&s_spithit2}; statetype s_spit4 = {false,TOMSPIT4,3,T_Projectile,0,&s_spit1}; statetype s_spit3 = {false,TOMSPIT3,3,T_Projectile,0,&s_spit4}; statetype s_spit2 = {false,TOMSPIT2,3,T_Projectile,0,&s_spit3}; statetype s_spit1 = {false,TOMSPIT1,3,T_Projectile,0,&s_spit2}; statetype s_snakefire2 = {true,TOMHEAD1,1,T_DarkSnakeChase,SF_DOWN|SF_UP,&s_darkmonkhead}; statetype s_snakefire1 = {false,TPREPARE,30,T_DarkSnakeChase,SF_DOWN,&s_snakefire2}; statetype s_dexplosion22 = {false,-1,0,T_BossDied,0,NULL}; statetype s_dexplosion21 = {false, -1, 240,NULL,0,&s_dexplosion22}; statetype s_dexplosion20 = {false,SPR_EXPLOSION20,2,NULL,0,&s_dexplosion21}; statetype s_dexplosion19 = {false,SPR_EXPLOSION19,2,NULL,0,&s_dexplosion20}; statetype s_dexplosion18 = {false,SPR_EXPLOSION18,2,NULL,0,&s_dexplosion19}; statetype s_dexplosion17 = {false,SPR_EXPLOSION17,2,NULL,0,&s_dexplosion18}; statetype s_dexplosion16 = {false,SPR_EXPLOSION16,2,NULL,0,&s_dexplosion17}; statetype s_dexplosion15 = {false,SPR_EXPLOSION15,2,NULL,0,&s_dexplosion16}; statetype s_dexplosion14 = {false,SPR_EXPLOSION14,2,NULL,0,&s_dexplosion15}; statetype s_dexplosion13 = {false,SPR_EXPLOSION13,2,NULL,0,&s_dexplosion14}; statetype s_dexplosion12 = {false,SPR_EXPLOSION12,2,NULL,0,&s_dexplosion13}; statetype s_dexplosion11 = {false,SPR_EXPLOSION11,2,NULL,0,&s_dexplosion12}; statetype s_dexplosion10 = {false,SPR_EXPLOSION10,2,NULL,0,&s_dexplosion11}; statetype s_dexplosion9 = {false,SPR_EXPLOSION9,2,NULL,0,&s_dexplosion10}; statetype s_dexplosion8 = {false,SPR_EXPLOSION8,2,NULL,0,&s_dexplosion9}; statetype s_dexplosion7 = {false,SPR_EXPLOSION7,2,NULL,0,&s_dexplosion8}; statetype s_dexplosion6 = {false,SPR_EXPLOSION6,2,NULL,0,&s_dexplosion7}; statetype s_dexplosion5 = {false,SPR_EXPLOSION5,2,NULL,0,&s_dexplosion6}; statetype s_dexplosion4 = {false,SPR_EXPLOSION4,2,NULL,0,&s_dexplosion5}; statetype s_dexplosion3 = {false,SPR_EXPLOSION3,2,T_Explosion,0,&s_dexplosion4}; statetype s_dexplosion2 = {false,SPR_EXPLOSION2,2,NULL,0,&s_dexplosion3}; statetype s_dexplosion1 = {false,SPR_EXPLOSION1,2,NULL,0,&s_dexplosion2}; /* =========================================================================== OROBOT =========================================================================== */ statetype s_NMEdeathbuildup = {16,NMEBODY1_01,210,T_NME_Explode,0,NULL}; statetype s_NMEheadexplosion = {16,NMEHEAD1_01,140,T_Special,0,&s_grexplosion1}; statetype s_NMEstand = {16,NMEBODY1_01,0,T_Stand,0,&s_NMEstand}; statetype s_NMEhead1 = {16,NMEHEAD1_01,0,NULL,0,&s_NMEhead1}; statetype s_NMEhead2 = {16,NMEHEAD2_01,0,NULL,0,&s_NMEhead2}; statetype s_NMEchase = {16,NMEBODY1_01,20,T_OrobotChase,0,&s_NMEchase}; statetype s_NMEwheels1 = {16,NMEWHEEL1_01,0,NULL,0,&s_NMEwheels1}; statetype s_NMEwheels2 = {16,NMEWHEEL2_01,0,NULL,0,&s_NMEwheels2}; statetype s_NMEwheels3 = {16,NMEWHEEL3_01,0,NULL,0,&s_NMEwheels3}; statetype s_NMEwheels4 = {16,NMEWHEEL4_01,0,NULL,0,&s_NMEwheels4}; statetype s_NMEwheels5 = {16,NMEWHEEL5_01,0,NULL,0,&s_NMEwheels5}; statetype s_shootinghead = {16,NMEHEAD1_01,140,T_NME_HeadShoot,0,&s_shootinghead}; statetype s_NMEspinattack = {16,NMEBODY1_01,70,T_NME_SpinAttack,0,&s_NMEchase}; statetype s_NMEwheelspin = {16,NMEWHEEL1_01,70,NULL,0,&s_NMEwheels2}; statetype s_NMEminiball4 = {false,NMEMINIBALL_04,4,T_Projectile,0,&s_NMEminiball1}; statetype s_NMEminiball3 = {false,NMEMINIBALL_03,4,T_Projectile,0,&s_NMEminiball4}; statetype s_NMEminiball2 = {false,NMEMINIBALL_02,4,T_Projectile,0,&s_NMEminiball3}; statetype s_NMEminiball1 = {false,NMEMINIBALL_01,4,T_Projectile,0,&s_NMEminiball2}; statetype s_NMEsaucer4 = {false,NMESAUCER_04,6,T_Saucer,0,&s_NMEsaucer1}; statetype s_NMEsaucer3 = {false,NMESAUCER_03,6,T_Saucer,0,&s_NMEsaucer4}; statetype s_NMEsaucer2 = {false,NMESAUCER_02,6,T_Saucer,0,&s_NMEsaucer3}; statetype s_NMEsaucer1 = {false,NMESAUCER_01,6,T_Saucer,SF_SOUND,&s_NMEsaucer2}; statetype s_NMEdie = {16,NMEBODY1_01,0,T_Collide,0,&s_NMEdie}; statetype s_NMEspinfire = {16,NMEBODY1_01,0,T_NME_SpinFire,0,&s_NMEspinfire}; statetype s_NMEattack = {16,NMEBODY1_01,0,T_NME_Attack,0,&s_NMEattack}; statetype s_NMEhead1rl = {16,NMEROCKET_01,0,NULL,0,&s_NMEhead1rl}; statetype s_NMEhead2rl = {16,NMEROCKET2_01,0,NULL,0,&s_NMEhead2rl}; statetype s_NMEwindup = {16,NMEBODY1_01,0,T_NME_WindUp,0,&s_NMEwindup}; statetype s_NMEwheels120 = {16,NMEWHEEL1_01,0,NULL,0,&s_NMEwheels120}; statetype s_NMEwrotleft3 = {16,NMEWHEEL4_01,10,NULL,0,&s_NMEwrotleft3}; statetype s_NMEwrotleft2 = {16,NMEWHEEL3_01,10,NULL,0,&s_NMEwrotleft3}; statetype s_NMEwrotleft1 = {16,NMEWHEEL2_01,10,NULL,0,&s_NMEwrotleft2}; statetype s_NMEwrotright3 = {16,NMEWHEEL4_01,10,NULL,0,&s_NMEwrotleft3}; statetype s_NMEwrotright2 = {16,NMEWHEEL5_01,10,NULL,0,&s_NMEwrotleft3}; statetype s_NMEwrotright1 = {16,NMEWHEEL2_01,10,NULL,0,&s_NMEwrotleft2}; statetype s_oshuriken4 = {false,SPR_OSHUR4,1,T_Projectile,0,&s_oshuriken1}; statetype s_oshuriken3 = {false,SPR_OSHUR3,1,T_Projectile,0,&s_oshuriken4}; statetype s_oshuriken2 = {false,SPR_OSHUR2,1,T_Projectile,0,&s_oshuriken3}; statetype s_oshuriken1 = {false,SPR_OSHUR1,1,T_Projectile,0,&s_oshuriken2}; statetype s_oshurikenhit3 = {false,SPR_OSHURHIT3,3,NULL,0,NULL}; statetype s_oshurikenhit2 = {false,SPR_OSHURHIT2,3,NULL,0,&s_oshurikenhit3}; statetype s_oshurikenhit1 = {false,SPR_OSHURHIT1,3,NULL,0,&s_oshurikenhit2}; statetype s_speardown16 = {false,SPEARDOWN16,2,T_Spears,SF_CRUSH,&s_speardown1}; statetype s_speardown15 = {false,SPEARDOWN15,2,T_Spears,SF_CRUSH,&s_speardown16}; statetype s_speardown14 = {false,SPEARDOWN14,2,T_Spears,SF_CRUSH,&s_speardown15}; statetype s_speardown13 = {false,SPEARDOWN13,2,T_Spears,SF_CRUSH,&s_speardown14}; statetype s_speardown12 = {false,SPEARDOWN12,2,T_Spears,SF_CRUSH,&s_speardown13}; statetype s_speardown11 = {false,SPEARDOWN11,2,T_Spears,SF_CRUSH,&s_speardown12}; statetype s_speardown10 = {false,SPEARDOWN10,2,T_Spears,SF_CRUSH,&s_speardown11}; statetype s_speardown9 = {false,SPEARDOWN9,2,T_Spears,SF_DOWN,&s_speardown10}; statetype s_speardown8 = {false,SPEARDOWN8,35,T_Spears,SF_DOWN|SF_SOUND,&s_speardown9}; statetype s_speardown7 = {false,SPEARDOWN7,2,T_Spears,SF_DOWN,&s_speardown8}; statetype s_speardown6 = {false,SPEARDOWN6,2,T_Spears,SF_CRUSH,&s_speardown7}; statetype s_speardown5 = {false,SPEARDOWN5,2,T_Spears,SF_CRUSH,&s_speardown6}; statetype s_speardown4 = {false,SPEARDOWN4,2,T_Spears,SF_CRUSH,&s_speardown5}; statetype s_speardown3 = {false,SPEARDOWN3,2,T_Spears,SF_CRUSH,&s_speardown4}; statetype s_speardown2 = {false,SPEARDOWN2,2,T_Spears,SF_CRUSH,&s_speardown3}; statetype s_speardown1 = {false,SPEARDOWN1,2,T_Spears,SF_CRUSH,&s_speardown2}; statetype s_downblade16 = {false,DBLADE8,1,T_Path,0,&s_downblade1}; statetype s_downblade15 = {false,DBLADE7,2,T_Path,0,&s_downblade16}; statetype s_downblade14 = {false,DBLADE6,1,T_Path,0,&s_downblade15}; statetype s_downblade13 = {false,DBLADE5,2,T_Path,0,&s_downblade14}; statetype s_downblade12 = {false,DBLADE4,1,T_Path,0,&s_downblade13}; statetype s_downblade11 = {false,DBLADE3,2,T_Path,0,&s_downblade12}; statetype s_downblade10 = {false,DBLADE2,1,T_Path,0,&s_downblade11}; statetype s_downblade9 = {false,DBLADE9,2,T_Path,0,&s_downblade10}; statetype s_downblade8 = {false,DBLADE8,1,T_Path,0,&s_downblade9}; statetype s_downblade7 = {false,DBLADE7,2,T_Path,0,&s_downblade8}; statetype s_downblade6 = {false,DBLADE6,1,T_Path,0,&s_downblade7}; statetype s_downblade5 = {false,DBLADE5,2,T_Path,0,&s_downblade6}; statetype s_downblade4 = {false,DBLADE4,1,T_Path,0,&s_downblade5}; statetype s_downblade3 = {false,DBLADE3,2,T_Path,0,&s_downblade4}; statetype s_downblade2 = {false,DBLADE2,1,T_Path,0,&s_downblade3}; statetype s_downblade1 = {false,DBLADE1,2,T_Path,SF_SOUND,&s_downblade2}; statetype s_firejetdown23 = {false,FIREJETDOWN23,3,T_Path,SF_CRUSH,&s_firejetdown1}; statetype s_firejetdown22 = {false,FIREJETDOWN22,3,T_Path,SF_CRUSH,&s_firejetdown23}; statetype s_firejetdown21 = {false,FIREJETDOWN21,3,T_Path,0,&s_firejetdown22}; statetype s_firejetdown20 = {false,FIREJETDOWN20,3,T_Path,0,&s_firejetdown21}; statetype s_firejetdown19 = {false,FIREJETDOWN19,3,T_Path,0,&s_firejetdown20}; statetype s_firejetdown18 = {false,FIREJETDOWN18,3,T_Path,0,&s_firejetdown19}; statetype s_firejetdown17 = {false,FIREJETDOWN17,3,T_Path,0,&s_firejetdown18}; statetype s_firejetdown16 = {false,FIREJETDOWN16,3,T_Path,SF_CRUSH,&s_firejetdown17}; statetype s_firejetdown15 = {false,FIREJETDOWN15,3,T_Path,SF_CRUSH,&s_firejetdown16}; statetype s_firejetdown14 = {false,FIREJETDOWN14,3,T_Path,SF_CRUSH,&s_firejetdown15}; statetype s_firejetdown13 = {false,FIREJETDOWN13,3,T_Path,0,&s_firejetdown14}; statetype s_firejetdown12 = {false,FIREJETDOWN12,3,T_Path,0,&s_firejetdown13}; statetype s_firejetdown11 = {false,FIREJETDOWN11,3,T_Path,0,&s_firejetdown12}; statetype s_firejetdown10 = {false,FIREJETDOWN10,3,T_Path,0,&s_firejetdown11}; statetype s_firejetdown9 = {false,FIREJETDOWN9,3,T_Path,0,&s_firejetdown10}; statetype s_firejetdown8 = {false,FIREJETDOWN8,3,T_Path,SF_CRUSH,&s_firejetdown9}; statetype s_firejetdown7 = {false,FIREJETDOWN7,3,T_Path,SF_CRUSH,&s_firejetdown8}; statetype s_firejetdown6 = {false,FIREJETDOWN6,3,T_Path,SF_CRUSH,&s_firejetdown7}; statetype s_firejetdown5 = {false,FIREJETDOWN5,3,T_Path,0,&s_firejetdown6}; statetype s_firejetdown4 = {false,FIREJETDOWN4,3,T_Path,0,&s_firejetdown5}; statetype s_firejetdown3 = {false,FIREJETDOWN3,3,T_Path,0,&s_firejetdown4}; statetype s_firejetdown2 = {false,FIREJETDOWN2,3,T_Path,0,&s_firejetdown3}; statetype s_firejetdown1 = {false,FIREJETDOWN1,70,T_Path,SF_SOUND,&s_firejetdown2}; statetype s_columnupdown6 = {false,CRUSHUP7,5,T_CrushUp,SF_DOWN,&s_columnupup1}; statetype s_columnupdown5 = {false,CRUSHUP6,2,T_CrushUp,SF_DOWN,&s_columnupdown6}; statetype s_columnupdown4 = {false,CRUSHUP5,5,T_CrushUp,SF_DOWN|SF_BLOCK,&s_columnupdown5}; statetype s_columnupdown3 = {false,CRUSHUP4,5,T_CrushUp,SF_DOWN|SF_BLOCK,&s_columnupdown4}; statetype s_columnupdown2 = {false,CRUSHUP3,5,T_CrushUp,SF_DOWN|SF_BLOCK,&s_columnupdown3}; statetype s_columnupdown1 = {false,CRUSHUP2,2,T_CrushUp,SF_DOWN|SF_BLOCK,&s_columnupdown2}; statetype s_columnupup8 = {false,CRUSHUP1,5,T_CrushUp,SF_CRUSH|SF_BLOCK,&s_columnupdown1}; statetype s_columnupup7 = {false,CRUSHUP2,2,T_CrushUp,SF_CRUSH|SF_UP|SF_BLOCK,&s_columnupup8}; statetype s_columnupup6 = {false,CRUSHUP3,5,T_CrushUp,SF_UP|SF_BLOCK,&s_columnupup7}; statetype s_columnupup5 = {false,CRUSHUP4,5,T_CrushUp,SF_UP|SF_BLOCK,&s_columnupup6}; statetype s_columnupup4 = {false,CRUSHUP5,5,T_CrushUp,SF_UP,&s_columnupup5}; statetype s_columnupup3 = {false,CRUSHUP6,2,T_CrushUp,SF_UP,&s_columnupup4}; statetype s_columnupup2 = {false,CRUSHUP7,5,T_CrushUp,SF_UP,&s_columnupup3}; statetype s_columnupup1 = {false,CRUSHUP8,30,T_CrushUp,SF_SOUND,&s_columnupup2}; statetype s_spinupblade16 = {false,SPINUBLADE_16,2,T_Path,SF_DOWN,&s_spinupblade1}; statetype s_spinupblade15 = {false,SPINUBLADE_15,2,T_Path,0,&s_spinupblade16}; statetype s_spinupblade14 = {false,SPINUBLADE_14,2,T_Path,0,&s_spinupblade15}; statetype s_spinupblade13 = {false,SPINUBLADE_13,2,T_Path,0,&s_spinupblade14}; statetype s_spinupblade12 = {false,SPINUBLADE_12,2,T_Path,0,&s_spinupblade13}; statetype s_spinupblade11 = {false,SPINUBLADE_11,2,T_Path,0,&s_spinupblade12}; statetype s_spinupblade10 = {false,SPINUBLADE_10,2,T_Path,0,&s_spinupblade11}; statetype s_spinupblade9 = {false,SPINUBLADE_09,2,T_Path,0,&s_spinupblade10}; statetype s_spinupblade8 = {false,SPINUBLADE_08,2,T_Path,0,&s_spinupblade9}; statetype s_spinupblade7 = {false,SPINUBLADE_07,2,T_Path,0,&s_spinupblade8}; statetype s_spinupblade6 = {false,SPINUBLADE_06,2,T_Path,0,&s_spinupblade7}; statetype s_spinupblade5 = {false,SPINUBLADE_05,2,T_Path,0,&s_spinupblade6}; statetype s_spinupblade4 = {false,SPINUBLADE_04,2,T_Path,0,&s_spinupblade5}; statetype s_spinupblade3 = {false,SPINUBLADE_03,2,T_Path,0,&s_spinupblade4}; statetype s_spinupblade2 = {false,SPINUBLADE_02,2,T_Path,0,&s_spinupblade3}; statetype s_spinupblade1 = {false,SPINUBLADE_01,35,T_Path,SF_UP|SF_SOUND,&s_spinupblade2}; statetype s_spindownblade16 = {false,SPINDBLADE_16,2,T_Path,SF_DOWN,&s_spindownblade1}; statetype s_spindownblade15 = {false,SPINDBLADE_15,2,T_Path,0,&s_spindownblade16}; statetype s_spindownblade14 = {false,SPINDBLADE_14,2,T_Path,0,&s_spindownblade15}; statetype s_spindownblade13 = {false,SPINDBLADE_13,2,T_Path,0,&s_spindownblade14}; statetype s_spindownblade12 = {false,SPINDBLADE_12,2,T_Path,0,&s_spindownblade13}; statetype s_spindownblade11 = {false,SPINDBLADE_11,2,T_Path,0,&s_spindownblade12}; statetype s_spindownblade10 = {false,SPINDBLADE_10,2,T_Path,0,&s_spindownblade11}; statetype s_spindownblade9 = {false,SPINDBLADE_09,2,T_Path,0,&s_spindownblade10}; statetype s_spindownblade8 = {false,SPINDBLADE_08,2,T_Path,0,&s_spindownblade9}; statetype s_spindownblade7 = {false,SPINDBLADE_07,2,T_Path,0,&s_spindownblade8}; statetype s_spindownblade6 = {false,SPINDBLADE_06,2,T_Path,0,&s_spindownblade7}; statetype s_spindownblade5 = {false,SPINDBLADE_05,2,T_Path,0,&s_spindownblade6}; statetype s_spindownblade4 = {false,SPINDBLADE_04,2,T_Path,0,&s_spindownblade5}; statetype s_spindownblade3 = {false,SPINDBLADE_03,2,T_Path,0,&s_spindownblade4}; statetype s_spindownblade2 = {false,SPINDBLADE_02,2,T_Path,0,&s_spindownblade3}; statetype s_spindownblade1 = {false,SPINDBLADE_01,35,T_Path,SF_UP|SF_SOUND,&s_spindownblade2}; statetype s_bouldersink9 = {false,BSINK9,2,NULL,0,NULL}; statetype s_bouldersink8 = {false,BSINK8,2,NULL,0,&s_bouldersink9}; statetype s_bouldersink7 = {false,BSINK7,2,NULL,0,&s_bouldersink8}; statetype s_bouldersink6 = {false,BSINK6,2,NULL,0,&s_bouldersink7}; statetype s_bouldersink5 = {false,BSINK5,2,NULL,0,&s_bouldersink6}; statetype s_bouldersink4 = {false,BSINK4,2,NULL,0,&s_bouldersink5}; statetype s_bouldersink3 = {false,BSINK3,2,NULL,0,&s_bouldersink4}; statetype s_bouldersink2 = {false,BSINK2,2,NULL,0,&s_bouldersink3}; statetype s_bouldersink1 = {false,BSINK1,2,NULL,0,&s_bouldersink2}; statetype s_boulderroll8 = {false,BOULDER41,3,T_BoulderMove,0,&s_boulderroll1}; statetype s_boulderroll7 = {false,BOULDER31,3,T_BoulderMove,0,&s_boulderroll8}; statetype s_boulderroll6 = {false,BOULDER21,3,T_BoulderMove,0,&s_boulderroll7}; statetype s_boulderroll5 = {false,BOULDER11,3,T_BoulderMove,0,&s_boulderroll6}; statetype s_boulderroll4 = {false,BOULDER41,3,T_BoulderMove,0,&s_boulderroll5}; statetype s_boulderroll3 = {false,BOULDER31,3,T_BoulderMove,0,&s_boulderroll4}; statetype s_boulderroll2 = {false,BOULDER21,3,T_BoulderMove,0,&s_boulderroll3}; statetype s_boulderroll1 = {false,BOULDER11,3,T_BoulderMove,SF_SOUND,&s_boulderroll2}; statetype s_boulderdrop12 = {false,BOULDER11,0,T_BoulderDrop,0,&s_boulderdrop12}; statetype s_boulderdrop11 = {false,BDROP11,1,T_BoulderDrop,0,&s_boulderdrop12}; statetype s_boulderdrop10 = {false,BDROP10,1,T_BoulderDrop,0,&s_boulderdrop11}; statetype s_boulderdrop9 = {false,BDROP9,2,T_BoulderDrop,0,&s_boulderdrop10}; statetype s_boulderdrop8 = {false,BDROP8,1,T_BoulderDrop,0,&s_boulderdrop9}; statetype s_boulderdrop7 = {false,BDROP7,1,T_BoulderDrop,0,&s_boulderdrop8}; statetype s_boulderdrop6 = {false,BDROP6,2,T_BoulderDrop,0,&s_boulderdrop7}; statetype s_boulderdrop5 = {false,BDROP5,3,T_BoulderDrop,0,&s_boulderdrop6}; statetype s_boulderdrop4 = {false,BDROP4,4,T_BoulderDrop,0,&s_boulderdrop5}; statetype s_boulderdrop3 = {false,BDROP3,5,T_BoulderDrop,SF_SOUND,&s_boulderdrop4}; statetype s_boulderdrop2 = {false,BDROP2,6,NULL,0,&s_boulderdrop3}; statetype s_boulderdrop1 = {false,BDROP1,6,NULL,0,&s_boulderdrop2}; statetype s_boulderspawn = {false,NOTHING,70,T_BoulderSpawn,0,&s_boulderspawn}; /*========================================================================== GUN STUFF ============================================================================*/ statetype s_gunfire2 = {true,GUNRISE51,5,A_GunShoot,0,&s_gunfire1}; statetype s_gunfire1 = {true,GUNFIRE1,5,A_GunShoot,0,&s_gunfire2}; statetype s_gunstand = {true,GUNRISE11,0,T_GunStand,0,&s_gunstand}; statetype s_gunraise4 = {true,GUNRISE51,2,NULL,0,&s_gunfire1}; statetype s_gunraise3 = {true,GUNRISE41,2,NULL,0,&s_gunraise4}; statetype s_gunraise2 = {true,GUNRISE31,2,NULL,0,&s_gunraise3}; statetype s_gunraise1 = {true,GUNRISE21,2,NULL,0,&s_gunraise2}; statetype s_gunlower3 = {true,GUNRISE21,2,NULL,0,&s_gunstand}; statetype s_gunlower2 = {true,GUNRISE31,2,NULL,0,&s_gunlower3}; statetype s_gunlower1 = {true,GUNRISE41,2,NULL,0,&s_gunlower2}; statetype s_gundead = {false,GUNDEAD2,0,T_Collide,0,&s_gundead}; statetype s_gundie1 = {false,GUNDEAD1,5,NULL,0,&s_gundead}; //======================================================================// statetype s_4waygunfire1 = {true,FOURWAYFIRE01,5,A_4WayGunShoot,0,&s_4waygunfire2}; statetype s_4waygunfire2 = {true,FOURWAY01,5,NULL,0,&s_4waygunfire1}; statetype s_4waygun = {true,FOURWAY01,0,T_4WayGunStand,0,&s_4waygun}; statetype s_kessphere8 = {false,KESSPHERE8,2,T_Projectile,0,&s_kessphere1}; statetype s_kessphere7 = {false,KESSPHERE7,2,T_Projectile,0,&s_kessphere8}; statetype s_kessphere6 = {false,KESSPHERE6,2,T_Projectile,0,&s_kessphere7}; statetype s_kessphere5 = {false,KESSPHERE5,2,T_Projectile,0,&s_kessphere6}; statetype s_kessphere4 = {false,KESSPHERE4,2,T_Projectile,0,&s_kessphere5}; statetype s_kessphere3 = {false,KESSPHERE3,2,T_Projectile,0,&s_kessphere4}; statetype s_kessphere2 = {false,KESSPHERE2,2,T_Projectile,0,&s_kessphere3}; statetype s_kessphere1 = {false,KESSPHERE1,2,T_Projectile,0,&s_kessphere2}; statetype s_slop4 = {false,TOMSPIT4,3,T_Particle,0,&s_slop1}; statetype s_slop3 = {false,TOMSPIT3,3,T_Particle,0,&s_slop4}; statetype s_slop2 = {false,TOMSPIT2,3,T_Particle,0,&s_slop3}; statetype s_slop1 = {false,TOMSPIT1,3,T_Particle,0,&s_slop2}; statetype s_batblast4 = {false,BATBLAST4,3,T_Projectile,SF_BAT,&s_batblast1}; statetype s_batblast3 = {false,BATBLAST3,3,T_Projectile,SF_BAT,&s_batblast4}; statetype s_batblast2 = {false,BATBLAST2,3,T_Projectile,SF_BAT,&s_batblast3}; statetype s_batblast1 = {false,BATBLAST1,3,T_Projectile,SF_BAT,&s_batblast2}; statetype s_serialdog4 = {true,SERIALDOG_W41,5,T_Player,SF_DOGSTATE,&s_serialdog}; statetype s_serialdog3 = {true,SERIALDOG_W31,5,T_Player,SF_DOGSTATE,&s_serialdog4}; statetype s_serialdog2 = {true,SERIALDOG_W21,5,T_Player,SF_DOGSTATE,&s_serialdog3}; statetype s_serialdog = {true,SERIALDOG_W11,5,T_Player,SF_DOGSTATE,&s_serialdog2}; statetype s_serialdogattack = {true,SERIALDOG_ATTACK1,0,T_Attack,SF_DOGSTATE,&s_serialdogattack }; #endif #include "rt_table.h" rott-20230810/rott/rt_str.c000066400000000000000000001106421446517470200154320ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //****************************************************************************** // // RT_STR.C // Contains the menu stuff! // //****************************************************************************** #include #include #include #include #include #include #include "rt_def.h" #include "rt_menu.h" #include "rt_util.h" #include "rt_vid.h" #include "rt_build.h" #include "lumpy.h" #include "rt_str.h" #include "_rt_str.h" #include "isr.h" #include "rt_in.h" #include "rt_view.h" #include "w_wad.h" #include "z_zone.h" #include "modexlib.h" #include "rt_main.h" #include "rt_msg.h" #include "rt_playr.h" #include "rt_sound.h" #include "myprint.h" //****************************************************************************** // // GLOBALS // //****************************************************************************** int fontcolor; //****************************************************************************** // // LOCALS // //****************************************************************************** static int BKw; static int BKh; static char strbuf[MaxString]; //****************************************************************************** // // VW_DrawClippedString () // // Draws a string at x, y to bufferofs // //****************************************************************************** void VW_DrawClippedString (int x, int y, const char *string) { int width,height,ht; byte *source; int ch; int oy; ht = CurrentFont->height; oy=y; while ((ch = (unsigned char)*string++)!=0) { ch -= 31; width = CurrentFont->width[ch]; source = ((byte *)CurrentFont)+CurrentFont->charofs[ch]; while (width--) { if ((x>=0) && (x=0) && (y0) *((byte *)(bufferofs+ylookup[y]+x)) = *source; } source++; y++; } } x++; } } } //****************************************************************************** // // US_ClippedPrint() - Prints a string in bufferofs. Newlines are supported. // //****************************************************************************** void US_ClippedPrint (int x, int y, const char *string) { char c, *se; char *s; strcpy(strbuf, string); s = strbuf; while (*s) { se = s; while ((c = *se) && (c != '\n')) se++; *se = '\0'; VW_DrawClippedString ( x, y, s); s = se; if (c) { *se = c; s++; y += CurrentFont->height; } } } //****************************************************************************** // // VW_DrawPropString () // // Draws a string at px, py to bufferofs // //****************************************************************************** void VW_DrawPropString (const char *string) { byte pix; int width,step,height,ht; byte *source, *dest, *origdest; int ch; ht = CurrentFont->height; dest = origdest = (byte *)(bufferofs+ylookup[py]+px); while ((ch = (unsigned char)*string++)!=0) { ch -= 31; width = step = CurrentFont->width[ch]; source = ((byte *)CurrentFont)+CurrentFont->charofs[ch]; while (width--) { height = ht; while (height--) { pix = *source; if (pix) *dest = pix; source++; dest += linewidth; } px++; origdest++; dest = origdest; } } bufferheight = ht; bufferwidth = ((dest+1)-origdest); } //****************************************************************************** // // VWB_DrawPropString () // // Calls VW_DrawPropString then updates the mark block. // //****************************************************************************** void VWB_DrawPropString (const char *string) { int x; x = px; VW_DrawPropString (string); VW_MarkUpdateBlock (x, py, px-1, py+bufferheight-1); } //****************************************************************************** // // VW_DrawIPropString () // // Draws a string at px, py to bufferofs // //****************************************************************************** void VW_DrawIPropString (const char *string) { byte pix; int width,step,height,ht; byte *source, *dest, *origdest; int ch; ht = CurrentFont->height; dest = origdest = (byte *)(bufferofs+ylookup[py]+px); while ((ch = (unsigned char)*string++)!=0) { ch -= 31; width = step = CurrentFont->width[ch]; source = ((byte *)CurrentFont)+CurrentFont->charofs[ch]; while (width--) { height = ht; while (height--) { pix = *source; if (pix) *dest = pix; source++; dest += linewidth; } px++; origdest++; dest = origdest; } } bufferheight = ht; bufferwidth = ((dest+1)-origdest); } //****************************************************************************** // // VWB_DrawIPropString () // // Calls VW_DrawIPropString then updates the mark block. // //****************************************************************************** void VWB_DrawIPropString (const char *string) { int x; x = px; VW_DrawIPropString (string); VW_MarkUpdateBlock (x, py, px-1, py+bufferheight-1); } //****************************************************************************** // // VWL_MeasureString () // //****************************************************************************** void VWL_MeasureString (const char *s, int *width, int *height, const font_t *font) { *height = font->height; for (*width = 0; *s; s++) *width += font->width[(*((byte *)s))-31]; // proportional width } //****************************************************************************** // // VWL_MeasureIntensityString () // //****************************************************************************** void VWL_MeasureIntensityString (const char *s, int *width, int *height, const cfont_t *font) { *height = font->height; for (*width = 0; *s; s++) *width += font->width[(*((byte *)s))-31]; // proportional width } //****************************************************************************** // // VW_MeasureIntensityPropString () // //****************************************************************************** void VW_MeasureIntensityPropString (const char *string, int *width, int *height) { VWL_MeasureIntensityString (string, width, height, IFont); } //****************************************************************************** // // VW_MeasurePropString () // //****************************************************************************** void VW_MeasurePropString (const char *string, int *width, int *height) { VWL_MeasureString (string, width, height, CurrentFont); } //****************************************************************************** // // US_MeasureStr () // //****************************************************************************** void US_MeasureStr (int *width, int *height, const char * s, ...) { char c, *se, *ss; int w,h; va_list strptr; char buf[300]; *width = 0; *height = 0; memset (&buf[0], 0, sizeof (buf)); va_start (strptr, s); vsprintf (&buf[0], s, strptr); va_end (strptr); ss = &buf[0]; while (*ss) { se = ss; while ((c = *se) && (c != '\n')) se++; *se = '\0'; VWL_MeasureString (ss, &w, &h, CurrentFont); *height += h; if (w > *width) *width = w; ss = se; if (c) { *se = c; ss++; } } } //****************************************************************************** // // US_SetPrintRoutines() - Sets the routines used to measure and print // from within the User Mgr. Primarily provided to allow switching // between masked and non-masked fonts // //****************************************************************************** void US_SetPrintRoutines (void (*measure)(const char *, int *, int *, font_t *), void (*print)(const char *)) { USL_MeasureString = measure; USL_DrawString = print; } //****************************************************************************** // // US_Print() - Prints a string in the current window. Newlines are // supported. // //****************************************************************************** void US_Print (const char *string) { char c, *se, *s; int w,h; strcpy(strbuf, string); s = strbuf; while (*s) { se = s; while ((c = *se) && (c != '\n')) se++; *se = '\0'; USL_MeasureString (s, &w, &h, CurrentFont); px = PrintX; py = PrintY; USL_DrawString (s); s = se; if (c) { *se = c; s++; PrintX = WindowX; PrintY += h; } else PrintX += w; } } //****************************************************************************** // // US_BufPrint() - Prints a string in bufferofs. Newlines are supported. // //****************************************************************************** void US_BufPrint (const char *string) { char c, *se, *s; int startx; strcpy(strbuf, string); s = strbuf; startx=PrintX; while (*s) { se = s; while ((c = *se) && (c != '\n')) se++; *se = '\0'; px = PrintX; py = PrintY; USL_DrawString (s); PrintY = py; PrintX = px; s = se; if (c) { *se = c; s++; PrintY += CurrentFont->height; PrintX = startx; } } } //****************************************************************************** // // US_PrintUnsigned () - Prints an unsigned long int // //****************************************************************************** void US_PrintUnsigned (unsigned long int n) { char buffer[32]; US_Print (ultoa (n, buffer, 10)); } //****************************************************************************** // // US_PrintSigned() - Prints a signed long // //****************************************************************************** void US_PrintSigned (long int n) { char buffer[32]; US_Print (ltoa (n, buffer, 10)); } //****************************************************************************** // // USL_PrintInCenter() - Prints a string in the center of the given rect // //****************************************************************************** void USL_PrintInCenter (const char *s, Rect r) { int w,h, rw,rh; USL_MeasureString (s,&w,&h, CurrentFont); rw = r.lr.x - r.ul.x; rh = r.lr.y - r.ul.y; px = r.ul.x + ((rw - w) / 2); py = r.ul.y + ((rh - h) / 2); USL_DrawString (s); } //****************************************************************************** // // US_PrintCentered() - Prints a string centered in the current window. // //****************************************************************************** void US_PrintCentered (const char *s) { Rect r; r.ul.x = WindowX; r.ul.y = WindowY; r.lr.x = r.ul.x + WindowW; r.lr.y = r.ul.y + WindowH; USL_PrintInCenter (s, r); } //****************************************************************************** // // US_CPrintLine() - Prints a string centered on the current line and // advances to the next line. Newlines are not supported. // //****************************************************************************** void US_CPrintLine (const char *s) { int w, h; USL_MeasureString (s, &w, &h, CurrentFont); if (w > WindowW) Error("US_CPrintLine() - String exceeds width"); px = WindowX + ((WindowW - w) / 2); py = PrintY; USL_DrawString (s); PrintY += h; } //****************************************************************************** // // US_CPrint() - Prints a string in the current window. Newlines are // supported. // //****************************************************************************** void US_CPrint (const char *string) { char c, *se, *s; strcpy(strbuf, string); s = strbuf; while (*s) { se = s; while ((c = *se) && (c != '\n')) se++; *se = '\0'; US_CPrintLine (s); s = se; if (c) { *se = c; s++; } } } // // // Text Input routines // // // //****************************************************************************** // // USL_XORICursor() - XORs the I-bar text cursor. Used by US_LineInput() // //****************************************************************************** static void USL_XORICursor (int x, int y, const char *s, int cursor, int color) { static boolean status; // VGA doesn't XOR... char buf[MaxString]; int w,h; int oldx = px; int oldy = py; strcpy (buf,s); buf[cursor] = '\0'; USL_MeasureString (buf, &w, &h, CurrentFont); if (status^=1) { px = x + w; py = y; if (color) USL_DrawString ("\x80"); else DrawMenuBufPropString (px, py, "\x80"); } else { if (color) { VWB_Bar (px, py, BKw, BKh, color); USL_DrawString (s); } else { EraseMenuBufRegion (px, py, BKw, BKh); // EraseMenuBufRegion (px, py+1, BKw, BKh-2); DrawMenuBufPropString (px, py, s); } } px = oldx; py = oldy; } //****************************************************************************** // // US_LineInput() - Gets a line of user input at (x,y), the string defaults // to whatever is pointed at by def. Input is restricted to maxchars // chars or maxwidth pixels wide. If the user hits escape (and escok is // true), nothing is copied into buf, and false is returned. If the // user hits return, the current string is copied into buf, and true is // returned // ///****************************************************************************** extern char * IN_GetScanName (ScanCode scan); boolean US_LineInput (int x, int y, char *buf, const char *def, boolean escok, int maxchars, int maxwidth, int color) { boolean redraw, cursorvis, cursormoved, done, result = false; char s[MaxString], olds[MaxString]; int i, cursor, w,h, len; int lasttime; int lastkey; int cursorwidth; cursorwidth = CurrentFont->width[80-31]; memset (s, 0, MaxString); memset (olds, 0, MaxString); IN_ClearKeyboardQueue (); BKw = maxwidth; BKh = CurrentFont->height; if (def) strcpy (s, def); else *s = '\0'; *olds = '\0'; cursor = strlen (s); cursormoved = redraw = true; cursorvis = done = false; lasttime = GetTicCount(); lastkey = getASCII (); while (!done) { // if (GameEscaped==true) // PauseLoop (); IN_PumpEvents(); if (cursorvis) USL_XORICursor (x, y, s, cursor, color); LastScan = IN_InputUpdateKeyboard (); if (Keyboard[sc_LShift] || Keyboard[sc_RShift]) lastkey = ShiftNames[LastScan]; else lastkey = ASCIINames[LastScan]; switch (LastScan) { case sc_LeftArrow: if (cursor) { cursor--; cursormoved = true; MN_PlayMenuSnd (SD_MOVECURSORSND); } lastkey = key_None; Keyboard[sc_LeftArrow] = 0; break; case sc_RightArrow: if (s[cursor]) { cursor++; cursormoved = true; MN_PlayMenuSnd (SD_MOVECURSORSND); } lastkey = key_None; Keyboard[sc_RightArrow] = 0; break; case sc_Home: if ( cursor ) { cursor = 0; cursormoved = true; MN_PlayMenuSnd (SD_MOVECURSORSND); } Keyboard[sc_Home] = 0; lastkey = key_None; break; case sc_End: if ( cursor != (int)strlen (s) ) { cursor = strlen (s); cursormoved = true; MN_PlayMenuSnd (SD_MOVECURSORSND); } lastkey = key_None; Keyboard[sc_End] = 0; break; case sc_Return: strcpy (buf,s); done = true; result = true; lastkey = key_None; MN_PlayMenuSnd (SD_SELECTSND); break; case sc_Escape: if (escok) { done = true; result = false; MN_PlayMenuSnd (SD_ESCPRESSEDSND); } lastkey = key_None; break; case sc_BackSpace: if (cursor) { strcpy (s + cursor - 1,s + cursor); cursor--; redraw = true; cursormoved = true; MN_PlayMenuSnd (SD_MOVECURSORSND); } lastkey = key_None; Keyboard[sc_BackSpace] = 0; IN_ClearKeyboardQueue (); break; case sc_Delete: if (s[cursor]) { strcpy (s + cursor,s + cursor + 1); redraw = true; cursormoved = true; MN_PlayMenuSnd (SD_MOVECURSORSND); } lastkey = key_None; Keyboard[sc_Delete] = 0; IN_ClearKeyboardQueue (); break; case 0x4c: // Keypad 5 case sc_UpArrow: case sc_DownArrow: case sc_PgUp: case sc_PgDn: case sc_Insert: lastkey = key_None; break; } // if (GameEscaped==true) // PauseLoop (); if (lastkey) { len = strlen (s); USL_MeasureString (s, &w, &h, CurrentFont); if ( isprint(lastkey) && (len < MaxString - 1) && ((!maxchars) || (len < maxchars)) && ((!maxwidth) || ((w+2) < (maxwidth-cursorwidth-2))) ) { int ls; int rs; for (i = len + 1;i > cursor;i--) s[i] = s[i - 1]; s[cursor++] = lastkey; redraw = true; ls = Keyboard[sc_LShift]; rs = Keyboard[sc_RShift]; memset ((void*)Keyboard, 0, 127*sizeof(int)); // Clear printable keys Keyboard[sc_LShift] = ls; Keyboard[sc_RShift] = rs; MN_PlayMenuSnd (SD_MOVECURSORSND); } } // if (GameEscaped==true) // PauseLoop (); if (redraw) { if (color) VWB_Bar (x, y, BKw, BKh, color); else EraseMenuBufRegion (x, y, BKw, BKh); strcpy (olds, s); px = x; py = y; if (color) USL_DrawString (s); else DrawMenuBufPropString (px, py, s); px = x; py = y; redraw = false; } if (cursormoved) { cursorvis = false; lasttime = GetTicCount() - VBLCOUNTER; cursormoved = false; } if (GetTicCount() - lasttime > VBLCOUNTER / 2) { lasttime = GetTicCount(); cursorvis ^= true; } if (cursorvis) USL_XORICursor (x, y, s, cursor, color); // if (GameEscaped==true) // PauseLoop (); if (color) VW_UpdateScreen (); else RefreshMenuBuf (0); } if (cursorvis) USL_XORICursor (x, y, s, cursor, color); if (!result) { px = x; py = y; if (color) USL_DrawString (olds); else DrawMenuBufPropString (px, py, olds); } // if (GameEscaped==true) // PauseLoop (); if (color) VW_UpdateScreen (); else RefreshMenuBuf (0); IN_ClearKeyboardQueue (); return (result); } //****************************************************************************** // // US_lineinput() - Gets a line of user input at (x,y), the string defaults // to whatever is pointed at by def. Input is restricted to maxchars // chars or maxwidth pixels wide. If the user hits escape (and escok is // true), nothing is copied into buf, and false is returned. If the // user hits return, the current string is copied into buf, and true is // returned - PASSWORD INPUT // ///****************************************************************************** boolean US_lineinput (int x, int y, char *buf, const char *def, boolean escok, int maxchars, int maxwidth, int color) { boolean redraw, cursorvis, cursormoved, done, result = false; char s[MaxString], xx[MaxString], olds[MaxString]; int i, cursor, w,h, len; int lasttime; int lastkey; int cursorwidth; cursorwidth = CurrentFont->width[80-31]; memset (s, 0, MaxString); memset (xx, 0, MaxString); memset (olds, 0, MaxString); IN_ClearKeyboardQueue (); BKw = maxwidth; BKh = CurrentFont->height; if (def) strcpy (s, def); else *s = '\0'; *olds = '\0'; cursor = strlen (s); cursormoved = redraw = true; cursorvis = done = false; lasttime = GetTicCount(); lastkey = getASCII (); while (!done) { // if (GameEscaped == true) // PauseLoop (); IN_PumpEvents(); if (cursorvis) USL_XORICursor (x, y, xx, cursor, color); LastScan = IN_InputUpdateKeyboard (); if (Keyboard[sc_LShift] || Keyboard[sc_RShift]) lastkey = ShiftNames[LastScan]; else lastkey = ASCIINames[LastScan]; switch (LastScan) { case sc_LeftArrow: if (cursor) { cursor--; cursormoved = true; MN_PlayMenuSnd (SD_MOVECURSORSND); } lastkey = key_None; Keyboard[sc_LeftArrow] = 0; break; case sc_RightArrow: if (s[cursor]) { cursor++; cursormoved = true; MN_PlayMenuSnd (SD_MOVECURSORSND); } lastkey = key_None; Keyboard[sc_RightArrow] = 0; break; case sc_Home: if ( cursor != 0 ) { cursor = 0; cursormoved = true; MN_PlayMenuSnd (SD_MOVECURSORSND); } Keyboard[sc_Home] = 0; lastkey = key_None; break; case sc_End: if ( cursor != (int)strlen( s ) ) { cursor = strlen (s); cursormoved = true; MN_PlayMenuSnd (SD_MOVECURSORSND); } lastkey = key_None; Keyboard[sc_End] = 0; break; case sc_Return: strcpy (buf,s); done = true; result = true; lastkey = key_None; MN_PlayMenuSnd (SD_SELECTSND); break; case sc_Escape: if (escok) { done = true; result = false; MN_PlayMenuSnd (SD_ESCPRESSEDSND); } lastkey = key_None; break; case sc_BackSpace: if (cursor) { strcpy (s + cursor - 1,s + cursor); strcpy (xx + cursor - 1,xx + cursor); cursor--; redraw = true; MN_PlayMenuSnd (SD_MOVECURSORSND); cursormoved = true; } lastkey = key_None; Keyboard[sc_BackSpace] = 0; IN_ClearKeyboardQueue (); break; case sc_Delete: if (s[cursor]) { strcpy (s + cursor,s + cursor + 1); strcpy (xx + cursor,xx + cursor + 1); redraw = true; cursormoved = true; MN_PlayMenuSnd (SD_MOVECURSORSND); } lastkey = key_None; Keyboard[sc_Delete] = 0; IN_ClearKeyboardQueue (); break; case 0x4c: // Keypad 5 case sc_UpArrow: case sc_DownArrow: case sc_PgUp: case sc_PgDn: case sc_Insert: lastkey = key_None; break; } // if (GameEscaped==true) // PauseLoop (); if (lastkey) { len = strlen (s); USL_MeasureString (xx, &w, &h, CurrentFont); if ( isprint(lastkey) && (len < MaxString - 1) && ((!maxchars) || (len < maxchars)) && ((!maxwidth) || ((w+2) < (maxwidth-cursorwidth-2))) ) { int ls; int rs; for (i = len + 1;i > cursor;i--) s[i] = s[i - 1]; s[cursor] = lastkey; xx[cursor++] = '*'; redraw = true; ls = Keyboard[sc_LShift]; rs = Keyboard[sc_RShift]; memset ((void*)Keyboard, 0, 127*sizeof(int)); // Clear printable keys Keyboard[sc_LShift] = ls; Keyboard[sc_RShift] = rs; MN_PlayMenuSnd (SD_MOVECURSORSND); } } // if (GameEscaped==true) // PauseLoop (); if (redraw) { if (color) VWB_Bar (x, y, BKw, BKh, color); else EraseMenuBufRegion (x, y, BKw, BKh); strcpy (olds, s); px = x; py = y; if (color) USL_DrawString (xx); else DrawMenuBufPropString (px, py, xx); px = x; py = y; redraw = false; } if (cursormoved) { cursorvis = false; lasttime = GetTicCount() - VBLCOUNTER; cursormoved = false; } if (GetTicCount() - lasttime > VBLCOUNTER / 2) { lasttime = GetTicCount(); cursorvis ^= true; } if (cursorvis) USL_XORICursor (x, y, xx, cursor, color); if (color) VW_UpdateScreen (); else RefreshMenuBuf (0); } if (cursorvis) USL_XORICursor (x, y, xx, cursor, color); if (!result) { px = x; py = y; if (color) USL_DrawString (xx); else DrawMenuBufPropString (px, py, xx); } // if (GameEscaped==true) // PauseLoop (); if (color) VW_UpdateScreen (); else RefreshMenuBuf (0); IN_ClearKeyboardQueue (); return (result); } //****************************************************************************** //****************************************************************************** // // WINDOWING ROUTINES // //****************************************************************************** //****************************************************************************** //****************************************************************************** // // US_ClearWindow() - Clears the current window to white and homes the // cursor // //****************************************************************************** void US_ClearWindow (void) { VWB_Bar (WindowX, WindowY, WindowW, WindowH, 13); PrintX = WindowX; PrintY = WindowY; } //****************************************************************************** // // US_DrawWindow() - Draws a frame and sets the current window parms // //****************************************************************************** void US_DrawWindow (int x, int y, int w, int h) { int i, sx, sy, sw, sh; byte * shape; pic_t *Win1; pic_t *Win2; pic_t *Win3; pic_t *Win4; pic_t *Win6; pic_t *Win7; pic_t *Win8; pic_t *Win9; // Cache in windowing shapes shape = W_CacheLumpNum (W_GetNumForName ("window1"), PU_CACHE, Cvt_pic_t, 1); Win1 = (pic_t *) shape; shape = W_CacheLumpNum (W_GetNumForName ("window2"), PU_CACHE, Cvt_pic_t, 1); Win2 = (pic_t *) shape; shape = W_CacheLumpNum (W_GetNumForName ("window3"), PU_CACHE, Cvt_pic_t, 1); Win3 = (pic_t *) shape; shape = W_CacheLumpNum (W_GetNumForName ("window4"), PU_CACHE, Cvt_pic_t, 1); Win4 = (pic_t *) shape; shape = W_CacheLumpNum (W_GetNumForName ("window6"), PU_CACHE, Cvt_pic_t, 1); Win6 = (pic_t *) shape; shape = W_CacheLumpNum (W_GetNumForName ("window7"), PU_CACHE, Cvt_pic_t, 1); Win7 = (pic_t *) shape; shape = W_CacheLumpNum (W_GetNumForName ("window8"), PU_CACHE, Cvt_pic_t, 1); Win8 = (pic_t *) shape; shape = W_CacheLumpNum (W_GetNumForName ("window9"), PU_CACHE, Cvt_pic_t, 1); Win9 = (pic_t *) shape; WindowX = x * 8; WindowY = y * 8; WindowW = w * 8; WindowH = h * 8; PrintX = WindowX; PrintY = WindowY; sx = (x - 1) * 8; sy = (y - 1) * 8; sw = (w + 1) * 8; sh = (h + 1) * 8; US_ClearWindow (); VWB_DrawPic (sx, sy, Win1); VWB_DrawPic (sx, sy + sh, Win7); for (i = sx + 8;i <= sx + sw - 8; i += 8) { VWB_DrawPic (i, sy, Win2); VWB_DrawPic (i, sy + sh, Win8); } VWB_DrawPic (i, sy, Win3); VWB_DrawPic (i, sy + sh, Win9); for (i = sy + 8;i <= sy + sh - 8; i += 8) { VWB_DrawPic (sx, i, Win4); VWB_DrawPic (sx + sw, i, Win6); } } //****************************************************************************** // // US_CenterWindow() - Generates a window of a given width & height in the // middle of the screen // //****************************************************************************** void US_CenterWindow (int w, int h) { //HDG US_DrawWindow (((MaxX / 8) - w) / 2, ((MaxY / 8) - h) / 2, w, h); US_DrawWindow (((iGLOBAL_SCREENWIDTH / 8) - w) / 2,((iGLOBAL_SCREENHEIGHT / 8) - h) / 2, w, h); } //============================================================================== // // Intensity Font stuff // // TEXT FORMATTING COMMANDS - (Use EGA colors ONLY!) // ------------------------------------------------- // / - Change the following word to color // ` - Highlights the following word with lighter color of fontcolor // /N - Change the fontcolor to a certain color // //============================================================================== //****************************************************************************** // // GetIntensityColor () // //****************************************************************************** byte GetIntensityColor (byte pix) { if ((fontcolor<0) || (fontcolor>255)) Error("Intensity Color out of range\n"); return ((byte) intensitytable[(pix<<8)+fontcolor]); } //****************************************************************************** // // DrawIntensityChar () // // Draws an intensity character at px, py // //****************************************************************************** void DrawIntensityChar ( char ch ) { byte pix; int width; int height; int ht; byte *source; byte *dest; byte *origdest; ht = IFont->height; origdest = ( byte * )( bufferofs + ylookup[ py ] + px ); dest = origdest; ch -= 31; width = IFont->width[ (unsigned char)ch ]; source = ( ( byte * )IFont ) + IFont->charofs[ (unsigned char)ch ]; if ((iGLOBAL_SCREENWIDTH <= 320)||(StretchScreen == true)){ while( width-- ) { height = ht; while( height-- ) { pix = *source; if ( pix != 0xFE ) { *dest = GetIntensityColor( pix ); } source++; dest += linewidth; } px++; origdest++; dest = origdest; } }else{//strech letter in x any direction while( width-- ) { height = ht; while( height-- ) { pix = *source; if ( pix != 0xFE ) { *dest = GetIntensityColor( pix ); *(dest+iGLOBAL_SCREENWIDTH) = GetIntensityColor( pix ); *(dest+1) = GetIntensityColor( pix ); *(dest+1+iGLOBAL_SCREENWIDTH) = GetIntensityColor( pix ); } source++; dest += linewidth*2; } px++;px++; origdest++;origdest++; dest = origdest; } } } //****************************************************************************** // // GetColor () // //****************************************************************************** int GetColor (int num) { int returnval = 0; if ((num >= '0') && (num <= '9')) returnval = egacolor[num - '0']; else if ((num >= 'A') && (num <= 'F')) returnval = egacolor[((num - 'A') + 10)]; return (returnval); } //****************************************************************************** // // DrawIString () // //****************************************************************************** static int oldfontcolor = 0; static boolean highlight = false; void DrawIString (unsigned short int x, unsigned short int y, const char *string, int flags) { char ch; char temp; px = x; py = y; while ((ch = *string++) != 0) { if ( !PERMANENT_MSG( flags ) ) { // Highlighting is done only for 1 word - if we get a "space" // and highlight is on ...., reset variables. // if ((ch == ' ') && (highlight == true)) { highlight = false; fontcolor = oldfontcolor; DrawIntensityChar (ch); } else // '\\' is color change to a specific EGA color (ie. egacolor) // if (ch == '\\') { temp = *string++; temp = toupper (temp); // Force fontcolor to a specific color egacolor[ RED ]; if (temp == 'N') { temp = *string++; fontcolor = GetColor (temp); oldfontcolor = fontcolor; } //bna added else if (temp == 'X') { temp = *string; fontcolor = egacolor[ RED ]; oldfontcolor = fontcolor; } else if (temp == 'Y') { temp = *string; fontcolor = egacolor[ YELLOW ]; oldfontcolor = fontcolor; } else if (temp == 'Z') { temp = *string; fontcolor = egacolor[ GREEN ]; oldfontcolor = fontcolor; } //bna added end // Restore fontcolor to a previous color else if (temp == 'O') { fontcolor = oldfontcolor; } else { oldfontcolor = fontcolor; // save off old font color highlight = true; // set highlight fontcolor = GetColor (temp); } } else // '`' is highlight the current fontcolor // if (ch == '`') { oldfontcolor = fontcolor; // save off old font color highlight = true; // set highlight if (fontcolor < 8) // only highlight the fontcolor = fontcolor-10; // lower colors } else DrawIntensityChar (ch); } else DrawIntensityChar (ch); } if (highlight == true) { highlight = false; fontcolor = oldfontcolor; } } //****************************************************************************** // // DrawIntensityString () // //****************************************************************************** void DrawIntensityString (unsigned short int x, unsigned short int y, const char *string, int color) { char ch; px = x; py = y; fontcolor=color; while ((ch = *string++) != 0) { DrawIntensityChar (ch); } } rott-20230810/rott/rt_str.h000066400000000000000000000065431446517470200154430ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //*************************************************************************** // // Public header for RT_STR.C. // //*************************************************************************** #ifndef _rt_str_public #define _rt_str_public #include "lumpy.h" //*************************************************************************** // // GLOBALS // //*************************************************************************** extern int fontcolor; //*************************************************************************** // // TYPEDEFS // //*************************************************************************** typedef struct { int x,y; } Point; typedef struct { int x, y, w, h, px, py; } WindowRec; // Record used to save & restore screen windows typedef struct { Point ul,lr; } Rect; //*************************************************************************** // // PROTOTYPES // //*************************************************************************** // // String rtns // void VW_DrawClippedString (int x, int y, const char *string); void US_ClippedPrint (int x, int y, const char *s); void VWB_DrawPropString (const char *string); void VW_MeasurePropString (const char *string, int *width, int *height); void US_MeasureStr (int *width, int *height, const char * s, ...) __attribute__((format(printf,3,4))); void VW_DrawPropString (const char *string); void US_SetPrintRoutines (void (*measure)(const char *, int *, int *, font_t *), void (*print)(const char *)); void US_Print (const char *s); void US_BufPrint (const char *s); void US_PrintUnsigned (unsigned long int n); void US_PrintSigned (long int n); void USL_PrintInCenter (const char *s, Rect r); void US_PrintCentered (const char *s); void US_CPrintLine (const char *s); void US_CPrint (const char *s); // // Input rtns // boolean US_LineInput (int x, int y, char *buf, const char *def, boolean escok, int maxchars, int maxwidth, int color); boolean US_lineinput (int x, int y, char *buf, const char *def, boolean escok, int maxchars, int maxwidth, int color); int CalibrateJoystick(void); // // Window rtns // void US_DrawWindow (int x, int y, int w, int h); void US_CenterWindow (int w, int h); // // Intensity font rtns // void DrawIString (unsigned short int x, unsigned short int y, const char *string, int flags); void DrawIntensityString (unsigned short int x, unsigned short int y, const char *string, int color); void VW_MeasureIntensityPropString (const char *string, int *width, int *height); byte GetIntensityColor (byte pix); #include "myprint.h" #endif rott-20230810/rott/rt_table.h000066400000000000000000000542071446517470200157220ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_table_public #define _rt_table_public #include "states.h" statetype * statetable[MAXSTATES]= { &s_lowgrdstand , &s_lowgrdpath4 , &s_lowgrdpath3 , &s_lowgrdpath2 , &s_lowgrdpath1 , &s_lowgrdcollide , &s_lowgrdcollide2 , &s_lowgrdshoot4 , &s_lowgrdshoot3 , &s_lowgrdshoot2 , &s_lowgrdshoot1 , &s_lowgrdchase4 , &s_lowgrdchase3 , &s_lowgrdchase2 , &s_lowgrdchase1 , &s_lowgrddead , &s_lowgrddie4 , &s_lowgrddie3 , &s_lowgrddie2 , &s_lowgrddie1 , &s_lowgrdcrushed2 , &s_lowgrdcrushed1 , &s_sneakydown , &s_sneakyrise4 , &s_sneakyrise3 , &s_sneakyrise2 , &s_sneakyrise1 , &s_highgrdstand , &s_highgrdpath4 , &s_highgrdpath3 , &s_highgrdpath2 , &s_highgrdpath1 , &s_highgrdcollide , &s_highgrdcollide2 , &s_highgrdshoot4 , &s_highgrdshoot3 , &s_highgrdshoot2 , &s_highgrdshoot1 , &s_highgrdchase4 , &s_highgrdchase3 , &s_highgrdchase2 , &s_highgrdchase1 , &s_highgrddead , &s_highgrddie5 , &s_highgrddie4 , &s_highgrddie3 , &s_highgrddie2 , &s_highgrddie1 , &s_highgrdcrushed2 , &s_highgrdcrushed1 , &s_strikestand , &s_strikepath4 , &s_strikepath3 , &s_strikepath2 , &s_strikepath1 , &s_strikecollide , &s_strikecollide2 , &s_strikeshoot4 , &s_strikeshoot3 , &s_strikeshoot2 , &s_strikeshoot1 , &s_strikewait , &s_strikerollright6 , &s_strikerollright5 , &s_strikerollright4 , &s_strikerollright3 , &s_strikerollright2 , &s_strikerollright1 , &s_strikerollleft6 , &s_strikerollleft5 , &s_strikerollleft4 , &s_strikerollleft3 , &s_strikerollleft2 , &s_strikerollleft1 , &s_strikechase4 , &s_strikechase3 , &s_strikechase2 , &s_strikechase1 , &s_strikedead3 , &s_strikedead2 , &s_strikedead , &s_strikedie4 , &s_strikedie3 , &s_strikedie2 , &s_strikedie1 , &s_strikecrushed2 , &s_strikecrushed1 , &s_blitzstand , &s_blitzpath4 , &s_blitzpath3 , &s_blitzpath2 , &s_blitzpath1 , &s_blitzcollide , &s_blitzcollide2 , &s_blitzshoot4 , &s_blitzshoot3 , &s_blitzshoot2 , &s_blitzshoot1 , &s_blitzrise4 , &s_blitzrise3 , &s_blitzrise2 , &s_blitzrise1 , &s_blitzuse , &s_blitzsteal2 , &s_blitzsteal1 , &s_blitzchase4 , &s_blitzchase3 , &s_blitzchase2 , &s_blitzchase1 , &s_blitzdead2 , &s_blitzdead , &s_blitzdie4 , &s_blitzdie3 , &s_blitzdie2 , &s_blitzdie1 , &s_blitzcrushed2 , &s_blitzcrushed1 , &s_blitzplead1, &s_blitzplead2, &s_blitzplead3, &s_blitzplead4, &s_blitzplead5, &s_blitzplead6, &s_blitzplead7, &s_blitzplead8, &s_blitzplead9, &s_blitzplead10, &s_blitzplead11, &s_blitzaplead5, &s_blitzaplead4, &s_blitzfakedead, &s_blitzfakedie3, &s_blitzfakedie2, &s_blitzfakedie1, &s_blitzstruggledie1, &s_blitzstruggledead, &s_enforcerstand , &s_enforcerpath4 , &s_enforcerpath3 , &s_enforcerpath2 , &s_enforcerpath1 , &s_enforcerchase4 , &s_enforcerchase3 , &s_enforcerchase2 , &s_enforcerchase1 , &s_enforcercollide , &s_enforcercollide2 , &s_enforcershoot4 , &s_enforcershoot3 , &s_enforcershoot2 , &s_enforcershoot1 , &s_enforcerthrow8 , &s_enforcerthrow7 , &s_enforcerthrow6 , &s_enforcerthrow5 , &s_enforcerthrow4 , &s_enforcerthrow3 , &s_enforcerthrow2 , &s_enforcerthrow1 , &s_grenade10 , &s_grenade9 , &s_grenade8 , &s_grenade7 , &s_grenade6 , &s_grenade5 , &s_grenade4 , &s_grenade3 , &s_grenade2 , &s_grenade1 , &s_grenade_fall6 , &s_grenade_fall5 , &s_grenade_fall4 , &s_grenade_fall3 , &s_grenade_fall2 , &s_grenade_fall1 , &s_grenadehit3 , &s_grenadehit2 , &s_grenadehit1 , &s_enforcerdead , &s_enforcerdie4 , &s_enforcerdie3 , &s_enforcerdie2 , &s_enforcerdie1 , &s_enforcercrushed2 , &s_enforcercrushed1 , &s_robogrdstand , &s_robogrdpath1 , &s_robogrdshoot1 , &s_robogrdshuriken4 , &s_robogrdshuriken3 , &s_robogrdshuriken2 , &s_robogrdshuriken1 , &s_shurikenhit3 , &s_shurikenhit2 , &s_shurikenhit1 , &s_robogrdcollide , &s_robogrdcollide2 , &s_robogrddead , &s_robogrddie9 , &s_robogrddie8 , &s_robogrddie7 , &s_robogrddie6 , &s_robogrddie5 , &s_robogrddie4 , &s_robogrddie3 , &s_robogrddie2 , &s_robogrddie1 , &s_roboalign, &s_roborealign, &s_robowait, &s_altexplosion10 , &s_altexplosion9 , &s_altexplosion8 , &s_altexplosion7 , &s_altexplosion6 , &s_altexplosion5 , &s_altexplosion4 , &s_altexplosion3 , &s_altexplosion2 , &s_altexplosion1 , &s_explosion20 , &s_explosion19 , &s_explosion18 , &s_explosion17 , &s_explosion16 , &s_explosion15 , &s_explosion14 , &s_explosion13 , &s_explosion12 , &s_explosion11 , &s_explosion10 , &s_explosion9 , &s_explosion8 , &s_explosion7 , &s_explosion6 , &s_explosion5 , &s_explosion4 , &s_explosion3 , &s_explosion2 , &s_explosion1 , &s_grexplosion20 , &s_grexplosion19 , &s_grexplosion18 , &s_grexplosion17 , &s_grexplosion16 , &s_grexplosion15 , &s_grexplosion14 , &s_grexplosion13 , &s_grexplosion12 , &s_grexplosion11 , &s_grexplosion10 , &s_grexplosion9 , &s_grexplosion8 , &s_grexplosion7 , &s_grexplosion6 , &s_grexplosion5 , &s_grexplosion4 , &s_grexplosion3 , &s_grexplosion2 , &s_grexplosion1 , &s_staticexplosion25 , &s_staticexplosion24 , &s_staticexplosion23 , &s_staticexplosion22 , &s_staticexplosion21 , &s_staticexplosion20 , &s_staticexplosion19 , &s_staticexplosion18 , &s_staticexplosion17 , &s_staticexplosion16 , &s_staticexplosion15 , &s_staticexplosion14 , &s_staticexplosion13 , &s_staticexplosion12 , &s_staticexplosion11 , &s_staticexplosion10 , &s_staticexplosion9 , &s_staticexplosion8 , &s_staticexplosion7 , &s_staticexplosion6 , &s_staticexplosion5 , &s_staticexplosion4 , &s_staticexplosion3 , &s_staticexplosion2 , &s_staticexplosion1 , &s_upblade16 , &s_upblade15 , &s_upblade14 , &s_upblade13 , &s_upblade12 , &s_upblade11 , &s_upblade10 , &s_upblade9 , &s_upblade8 , &s_upblade7 , &s_upblade6 , &s_upblade5 , &s_upblade4 , &s_upblade3 , &s_upblade2 , &s_upblade1 , &s_firejetup23 , &s_firejetup22 , &s_firejetup21 , &s_firejetup20 , &s_firejetup19 , &s_firejetup18 , &s_firejetup17 , &s_firejetup16 , &s_firejetup15 , &s_firejetup14 , &s_firejetup13 , &s_firejetup12 , &s_firejetup11 , &s_firejetup10 , &s_firejetup9 , &s_firejetup8 , &s_firejetup7 , &s_firejetup6 , &s_firejetup5 , &s_firejetup4 , &s_firejetup3 , &s_firejetup2 , &s_firejetup1 , &s_columndownup6 , &s_columndownup5 , &s_columndownup4 , &s_columndownup3 , &s_columndownup2 , &s_columndownup1 , &s_columndowndown8 , &s_columndowndown7 , &s_columndowndown6 , &s_columndowndown5 , &s_columndowndown4 , &s_columndowndown3 , &s_columndowndown2 , &s_columndowndown1 , &s_spearup16 , &s_spearup15 , &s_spearup14 , &s_spearup13 , &s_spearup12 , &s_spearup11 , &s_spearup10 , &s_spearup9 , &s_spearup8 , &s_spearup7 , &s_spearup6 , &s_spearup5 , &s_spearup4 , &s_spearup3 , &s_spearup2 , &s_spearup1 , &s_pushcolumn1 , &s_pushcolumn2 , &s_pushcolumn3 , &s_wallfireball , &s_crossfire2 , &s_crossfire1 , &s_crossdone5 , &s_crossdone4 , &s_crossdone3 , &s_crossdone2 , &s_crossdone1 , &s_dust , &s_gas2 , &s_gas1 , &s_p_bazooka1 , &s_p_grenade , &s_gunsmoke8 , &s_gunsmoke7 , &s_gunsmoke6 , &s_gunsmoke5 , &s_gunsmoke4 , &s_gunsmoke3 , &s_gunsmoke2 , &s_gunsmoke1 , &s_bloodspurt8 , &s_bloodspurt7 , &s_bloodspurt6 , &s_bloodspurt5 , &s_bloodspurt4 , &s_bloodspurt3 , &s_bloodspurt2 , &s_bloodspurt1 , &s_hitmetalwall4 , &s_hitmetalwall3 , &s_hitmetalwall2 , &s_hitmetalwall1 , &s_hitmetalactor4 , &s_hitmetalactor3 , &s_hitmetalactor2 , &s_hitmetalactor1 , &s_fireunit15 , &s_fireunit14 , &s_fireunit13 , &s_fireunit12 , &s_fireunit11 , &s_fireunit10 , &s_fireunit9 , &s_fireunit8 , &s_fireunit7 , &s_fireunit6 , &s_fireunit5 , &s_fireunit4 , &s_fireunit3 , &s_fireunit2 , &s_fireunit1 , &s_skeleton48 , &s_skeleton47 , &s_skeleton46 , &s_skeleton45 , &s_skeleton44 , &s_skeleton43 , &s_skeleton42 , &s_skeleton41 , &s_skeleton40 , &s_skeleton39 , &s_skeleton38 , &s_skeleton37 , &s_skeleton36 , &s_skeleton35 , &s_skeleton34 , &s_skeleton33 , &s_skeleton32 , &s_skeleton31 , &s_skeleton30 , &s_skeleton29 , &s_skeleton28 , &s_skeleton27 , &s_skeleton26 , &s_skeleton25 , &s_skeleton24 , &s_skeleton23 , &s_skeleton22 , &s_skeleton21 , &s_skeleton20 , &s_skeleton19 , &s_skeleton18 , &s_skeleton17 , &s_skeleton16 , &s_skeleton15 , &s_skeleton14 , &s_skeleton13 , &s_skeleton12 , &s_skeleton11 , &s_skeleton10 , &s_skeleton9 , &s_skeleton8 , &s_skeleton7 , &s_skeleton6 , &s_skeleton5 , &s_skeleton4 , &s_skeleton3 , &s_skeleton2 , &s_skeleton1 , &s_spring9 , &s_spring8 , &s_spring7 , &s_spring6 , &s_spring5 , &s_spring4 , &s_spring3 , &s_spring2 , &s_spring1 , &s_pgunattack1 , &s_pmissattack1 , &s_pgunattack2 , &s_pmissattack2 , &s_pbatblast, &s_remotemove4 , &s_remotemove3 , &s_remotemove2 , &s_remotemove1 , &s_remoteinelev , &s_remotedead , &s_remotedie5 , &s_remotedie4 , &s_remotedie3 , &s_remotedie2 , &s_remotedie1 , &s_godfire4 , &s_godfire3 , &s_godfire2 , &s_godfire1 , &s_guts12 , &s_guts11 , &s_guts10 , &s_guts9 , &s_guts8 , &s_guts7 , &s_guts6 , &s_guts5 , &s_guts4 , &s_guts3 , &s_guts2 , &s_guts1 , &s_player , &s_free , &s_megaexplosions, &s_bossdeath, &s_superparticles, &s_littlesoul, &s_bigsoul, &s_vaporized8, &s_vaporized7, &s_vaporized6, &s_vaporized5, &s_vaporized4, &s_vaporized3, &s_vaporized2, &s_vaporized1, &s_autospring1, &s_autospring2, &s_autospring3, &s_autospring4, &s_autospring5, &s_autospring6, &s_autospring7, &s_autospring8, &s_autospring9, &s_gibsdone8, &s_gibsdone7, &s_gibsdone6, &s_gibsdone5, &s_gibsdone4, &s_gibsdone3, &s_gibsdone2, &s_gibsdone1, &s_gibs4, &s_gibs3, &s_gibs2, &s_gibs1, &s_collectorwander8, &s_collectorwander7, &s_collectorwander6, &s_collectorwander5, &s_collectorwander4, &s_collectorwander3, &s_collectorwander2, &s_collectorwander1, &s_collectorfdoor8, &s_collectorfdoor7, &s_collectorfdoor6, &s_collectorfdoor5, &s_collectorfdoor4, &s_collectorfdoor3, &s_collectorfdoor2, &s_collectorfdoor1, &s_tag, &s_wind, &s_timekeeper, &s_remoteguts1, &s_remoteguts2, &s_remoteguts3, &s_remoteguts4, &s_remoteguts5, &s_remoteguts6, &s_remoteguts7, &s_remoteguts8, &s_remoteguts9, &s_remoteguts10, &s_remoteguts11, &s_remoteguts12, &s_voidwait, &s_ashwait, &s_deadwait, &s_gutwait, &s_eye1, &s_eye2, &s_eye3, &s_itemspawn1, &s_itemspawn2, &s_itemspawn3, &s_itemspawn4, &s_itemspawn5, &s_itemspawn6, &s_itemspawn7, &s_itemspawn8, &s_deadblood1, &s_deadblood2, &s_deadblood3, &s_deadblood4, &s_deadblood5, &s_deadblood6, &s_deadblood7, &s_deadblood8, &s_flash1, &s_flash2, &s_flash3, &s_flash4, &s_flash5, &s_flash6, &s_flash7, &s_flash8, &s_basemarker1, &s_basemarker2, &s_basemarker3, &s_basemarker4, &s_basemarker5, &s_basemarker6, &s_basemarker7, &s_basemarker8, &s_pathdisk, &s_elevdisk, &s_megaremove, /*&s_rain7, &s_rain6, &s_rain5, &s_rain4, &s_rain3, &s_rain2, &s_rain1, &s_rainmaster,*/ &s_respawn8, &s_respawn7, &s_respawn6, &s_respawn5, &s_respawn4, &s_respawn3, &s_respawn2, &s_respawn1, &s_blooddrip1, &s_blooddrip2, &s_blooddrip3, &s_blooddrip4, &s_diskmaster, &s_bstar4 , &s_bstar3 , &s_bstar2 , &s_bstar1 , #if (SHAREWARE == 0) &s_scottwander7, &s_scottwander6, &s_scottwander5, &s_scottwander4, &s_scottwander3, &s_scottwander2, &s_scottwander1, &s_scottwanderdoor7, &s_scottwanderdoor6, &s_scottwanderdoor5, &s_scottwanderdoor4, &s_scottwanderdoor3, &s_scottwanderdoor2, &s_scottwanderdoor1, &s_opstand , &s_oppath4 , &s_oppath3 , &s_oppath2 , &s_oppath1 , &s_opcollide , &s_opcollide2 , &s_opshoot4 , &s_opshoot3 , &s_opshoot2 , &s_opshoot1 , &s_opbolo5 , &s_opbolo4 , &s_opbolo3 , &s_opbolo2 , &s_opbolo1 , &s_bolocast4 , &s_bolocast3 , &s_bolocast2 , &s_bolocast1 , &s_opchase4 , &s_opchase3 , &s_opchase2 , &s_opchase1 , &s_opdead , &s_opdie5 , &s_opdie4 , &s_opdie3 , &s_opdie2 , &s_opdie1 , &s_opcrushed2 , &s_opcrushed1 , &s_dmonkstand , &s_dmonkpath4 , &s_dmonkpath3 , &s_dmonkpath2 , &s_dmonkpath1 , &s_dmonkcollide , &s_dmonkcollide2 , &s_dmonkshoot6 , &s_dmonkshoot5 , &s_dmonkshoot4 , &s_dmonkshoot3 , &s_dmonkshoot2 , &s_dmonkshoot1 , &s_dmonkchase4 , &s_dmonkchase3 , &s_dmonkchase2 , &s_dmonkchase1 , &s_dmonkdead , &s_dmonkdie4 , &s_dmonkdie3 , &s_dmonkdie2 , &s_dmonkdie1 , &s_dmonkcrushed2 , &s_dmonkcrushed1 , &s_firemonkstand , &s_firemonkpath4 , &s_firemonkpath3 , &s_firemonkpath2 , &s_firemonkpath1 , &s_firemonkcollide , &s_firemonkcollide2 , &s_firemonkcast7 , &s_firemonkcast6 , &s_firemonkcast5 , &s_firemonkcast4 , &s_firemonkcast3 , &s_firemonkcast2 , &s_firemonkcast1 , &s_monkfire4 , &s_monkfire3 , &s_monkfire2 , &s_monkfire1 , &s_fireballhit3 , &s_fireballhit2 , &s_fireballhit1 , &s_firemonkchase4 , &s_firemonkchase3 , &s_firemonkchase2 , &s_firemonkchase1 , &s_firemonkdead7 , &s_firemonkdead6 , &s_firemonkdead5 , &s_firemonkdead4 , &s_firemonkdead3 , &s_firemonkdead2 , &s_firemonkdead , &s_firemonkdie4 , &s_firemonkdie3 , &s_firemonkdie2 , &s_firemonkdie1 , &s_firemonkcrushed2 , &s_firemonkcrushed1 , &s_wallstand , &s_wallpath , &s_wallshoot , &s_wallcollide , &s_wallalign, &s_wallrestore, &s_wallwait, &s_darianstand , &s_darianchase4 , &s_darianchase3 , &s_darianchase2 , &s_darianchase1 , &s_darianrise8 , &s_darianrise7 , &s_darianrise6 , &s_darianrise5 , &s_darianrise4 , &s_darianrise3 , &s_darianrise2 , &s_darianrise1 , &s_dariansink9 , &s_dariansink8 , &s_dariansink7 , &s_dariansink6 , &s_dariansink5 , &s_dariansink4 , &s_dariansink3 , &s_dariansink2 , &s_dariansink1 , &s_dariancollide , &s_dariancollide2 , &s_darianshoot4 , &s_darianshoot3 , &s_darianshoot2 , &s_darianshoot1 , &s_dariandefend3 , &s_dariandefend2 , &s_dariandefend1 , &s_darianuse4 , &s_darianuse3 , &s_darianuse2 , &s_darianuse1 , &s_darianwait , &s_darianspears , &s_dspear16 , &s_dspear15 , &s_dspear14 , &s_dspear13 , &s_dspear12 , &s_dspear11 , &s_dspear10 , &s_dspear9 , &s_dspear8 , &s_dspear7 , &s_dspear6 , &s_dspear5 , &s_dspear4 , &s_dspear3 , &s_dspear2 , &s_dspear1 , &s_dariandead2 , &s_dariandead1 , &s_dariandead , &s_dariandie10 , &s_dariandie9 , &s_dariandie8 , &s_dariandie7 , &s_dariandie6 , &s_dariandie5 , &s_dariandie4 , &s_dariandie3 , &s_dariandie2 , &s_dariandie1 , &s_heinrichstand , &s_heinrichchase , &s_kristleft , &s_kristright , &s_heinrichshoot11 , &s_heinrichshoot10 , &s_heinrichshoot9 , &s_heinrichshoot8 , &s_heinrichshoot7 , &s_heinrichshoot6 , &s_heinrichshoot5 , &s_heinrichshoot4 , &s_heinrichshoot3 , &s_heinrichshoot2 , &s_heinrichshoot1 , &s_missile1 , &s_missilehit3 , &s_missilehit2 , &s_missilehit1 , &s_mine4 , &s_mine3 , &s_mine2 , &s_mine1 , &s_heinrichdefend , &s_heinrichooc , &s_heinrichdead , &s_heinrichdie2 , &s_heinrichdie1 , &s_heindead2 , &s_heindead1 , &s_heinexp13 , &s_heinexp12 , &s_heinexp11 , &s_heinexp10 , &s_heinexp9 , &s_heinexp8 , &s_heinexp7 , &s_heinexp6 , &s_heinexp5 , &s_heinexp4 , &s_heinexp3 , &s_heinexp2 , &s_heinexp1 , &s_darkmonkstand , &s_darkmonkland , &s_darkmonkchase2 , &s_darkmonkchase1 , &s_dmlandandfire , &s_darkmonkcover3 , &s_darkmonkcover2 , &s_darkmonkcover1 , &s_darkmonkawaken5 , &s_darkmonkawaken4 , &s_darkmonkawaken3 , &s_darkmonkawaken2 , &s_darkmonkawaken1 , &s_darkmonklightning11 , &s_darkmonklightning10 , &s_darkmonklightning9 , &s_darkmonklightning8 , &s_darkmonklightning7 , &s_darkmonklightning6 , &s_darkmonklightning5 , &s_darkmonklightning4 , &s_darkmonklightning3 , &s_darkmonklightning2 , &s_darkmonklightning1 , &s_darkmonkfspark6 , &s_darkmonkfspark5 , &s_darkmonkfspark4 , &s_darkmonkfspark3 , &s_darkmonkfspark2 , &s_darkmonkfspark1 , &s_darkmonkbreathe8 , &s_darkmonkbreathe7 , &s_darkmonkbreathe6 , &s_darkmonkbreathe5 , &s_darkmonkbreathe4 , &s_darkmonkbreathe3 , &s_darkmonkbreathe2 , &s_darkmonkbreathe1 , &s_darkmonksummon3 , &s_darkmonksummon2 , &s_darkmonksummon1 , &s_snakepath , &s_snakefindpath , &s_darkmonkhead , &s_darkmonksnakelink , &s_darkmonkhspawn , &s_darkmonkfastspawn , &s_darkmonkheaddead , &s_darkmonkheaddie1 , &s_darkmonkhball9 , &s_darkmonkhball8 , &s_darkmonkhball7 , &s_darkmonkhball6 , &s_darkmonkhball5 , &s_darkmonkhball4 , &s_darkmonkhball3 , &s_darkmonkhball2 , &s_darkmonkhball1 , &s_darkmonkabsorb9 , &s_darkmonkabsorb8 , &s_darkmonkabsorb7 , &s_darkmonkabsorb6 , &s_darkmonkabsorb5 , &s_darkmonkabsorb4 , &s_darkmonkabsorb3 , &s_darkmonkabsorb2 , &s_darkmonkabsorb1 , &s_darkmonksphere10 , &s_darkmonksphere9 , &s_darkmonksphere8 , &s_darkmonksphere7 , &s_darkmonksphere6 , &s_darkmonksphere5 , &s_darkmonksphere4 , &s_darkmonksphere3 , &s_darkmonksphere2 , &s_darkmonksphere1 , &s_dmgreenthing10 , &s_dmgreenthing9 , &s_dmgreenthing8 , &s_dmgreenthing7 , &s_dmgreenthing6 , &s_dmgreenthing5 , &s_dmgreenthing4 , &s_dmgreenthing3 , &s_dmgreenthing2 , &s_dmgreenthing1 , &s_energysphere4 , &s_energysphere3 , &s_energysphere2 , &s_energysphere1 , &s_lightning , &s_handball2 , &s_handball1 , &s_faceball2 , &s_faceball1 , &s_floorspark4 , &s_floorspark3 , &s_floorspark2 , &s_floorspark1 , &s_darkmonkreact , &s_darkmonkbball9 , &s_darkmonkbball8 , &s_darkmonkbball7 , &s_darkmonkbball6 , &s_darkmonkbball5 , &s_darkmonkbball4 , &s_darkmonkbball3 , &s_darkmonkbball2 , &s_darkmonkbball1 , &s_darkmonkcharge10 , &s_darkmonkcharge9 , &s_darkmonkcharge8 , &s_darkmonkcharge7 , &s_darkmonkcharge6 , &s_darkmonkcharge5 , &s_darkmonkcharge4 , &s_darkmonkcharge3 , &s_darkmonkcharge2 , &s_darkmonkcharge1 , &s_darkmonkscare5 , &s_darkmonkscare4 , &s_darkmonkscare3 , &s_darkmonkscare2 , &s_darkmonkscare1 , &s_darkmonkdead , &s_darkmonkdie7 , &s_darkmonkdie6 , &s_darkmonkdie5 , &s_darkmonkdie4 , &s_darkmonkdie3 , &s_darkmonkdie2 , &s_darkmonkdie1 , &s_darkmonkredhead , &s_darkmonkredlink , &s_redheadhit , &s_redlinkhit , &s_spithit4 , &s_spithit3 , &s_spithit2 , &s_spithit1 , &s_spit4 , &s_spit3 , &s_spit2 , &s_spit1 , &s_snakefire2 , &s_snakefire1 , &s_snakefireworks1, &s_snakefireworks2, &s_dexplosion22 , &s_dexplosion21 , &s_dexplosion20 , &s_dexplosion19 , &s_dexplosion18 , &s_dexplosion17 , &s_dexplosion16 , &s_dexplosion15 , &s_dexplosion14 , &s_dexplosion13 , &s_dexplosion12 , &s_dexplosion11 , &s_dexplosion10 , &s_dexplosion9 , &s_dexplosion8 , &s_dexplosion7 , &s_dexplosion6 , &s_dexplosion5 , &s_dexplosion4 , &s_dexplosion3 , &s_dexplosion2 , &s_dexplosion1 , &s_NMEhead1 , &s_NMEhead2 , &s_NMEchase , &s_NMEwheels1 , &s_NMEwheels2 , &s_NMEwheels3 , &s_NMEwheels4 , &s_NMEwheels5 , &s_NMEspinattack , &s_NMEwheelspin , &s_NMEminiball4 , &s_NMEminiball3 , &s_NMEminiball2 , &s_NMEminiball1 , &s_NMEsaucer4 , &s_NMEsaucer3 , &s_NMEsaucer2 , &s_NMEsaucer1 , &s_NMEdie , &s_NMEattack , &s_NMEhead1rl , &s_NMEhead2rl , &s_NMEwindup , &s_NMEwheels120 , &s_NMEwrotleft3 , &s_NMEwrotleft2 , &s_NMEwrotleft1 , &s_NMEwrotright3 , &s_NMEwrotright2 , &s_NMEwrotright1 , &s_NMEdeathbuildup, &s_NMEheadexplosion, &s_NMEstand, &s_NMEspinfire, &s_oshuriken4 , &s_oshuriken3 , &s_oshuriken2 , &s_oshuriken1 , &s_oshurikenhit3 , &s_oshurikenhit2 , &s_oshurikenhit1 , &s_shootinghead, &s_speardown16 , &s_speardown15 , &s_speardown14 , &s_speardown13 , &s_speardown12 , &s_speardown11 , &s_speardown10 , &s_speardown9 , &s_speardown8 , &s_speardown7 , &s_speardown6 , &s_speardown5 , &s_speardown4 , &s_speardown3 , &s_speardown2 , &s_speardown1 , &s_downblade16 , &s_downblade15 , &s_downblade14 , &s_downblade13 , &s_downblade12 , &s_downblade11 , &s_downblade10 , &s_downblade9 , &s_downblade8 , &s_downblade7 , &s_downblade6 , &s_downblade5 , &s_downblade4 , &s_downblade3 , &s_downblade2 , &s_downblade1 , &s_firejetdown23 , &s_firejetdown22 , &s_firejetdown21 , &s_firejetdown20 , &s_firejetdown19 , &s_firejetdown18 , &s_firejetdown17 , &s_firejetdown16 , &s_firejetdown15 , &s_firejetdown14 , &s_firejetdown13 , &s_firejetdown12 , &s_firejetdown11 , &s_firejetdown10 , &s_firejetdown9 , &s_firejetdown8 , &s_firejetdown7 , &s_firejetdown6 , &s_firejetdown5 , &s_firejetdown4 , &s_firejetdown3 , &s_firejetdown2 , &s_firejetdown1 , &s_columnupdown6 , &s_columnupdown5 , &s_columnupdown4 , &s_columnupdown3 , &s_columnupdown2 , &s_columnupdown1 , &s_columnupup8 , &s_columnupup7 , &s_columnupup6 , &s_columnupup5 , &s_columnupup4 , &s_columnupup3 , &s_columnupup2 , &s_columnupup1 , &s_spinupblade16 , &s_spinupblade15 , &s_spinupblade14 , &s_spinupblade13 , &s_spinupblade12 , &s_spinupblade11 , &s_spinupblade10 , &s_spinupblade9 , &s_spinupblade8 , &s_spinupblade7 , &s_spinupblade6 , &s_spinupblade5 , &s_spinupblade4 , &s_spinupblade3 , &s_spinupblade2 , &s_spinupblade1 , &s_spindownblade16 , &s_spindownblade15 , &s_spindownblade14 , &s_spindownblade13 , &s_spindownblade12 , &s_spindownblade11 , &s_spindownblade10 , &s_spindownblade9 , &s_spindownblade8 , &s_spindownblade7 , &s_spindownblade6 , &s_spindownblade5 , &s_spindownblade4 , &s_spindownblade3 , &s_spindownblade2 , &s_spindownblade1 , &s_bouldersink9 , &s_bouldersink8 , &s_bouldersink7 , &s_bouldersink6 , &s_bouldersink5 , &s_bouldersink4 , &s_bouldersink3 , &s_bouldersink2 , &s_bouldersink1 , &s_boulderroll8 , &s_boulderroll7 , &s_boulderroll6 , &s_boulderroll5 , &s_boulderroll4 , &s_boulderroll3 , &s_boulderroll2 , &s_boulderroll1 , &s_boulderdrop12 , &s_boulderdrop11 , &s_boulderdrop10 , &s_boulderdrop9 , &s_boulderdrop8 , &s_boulderdrop7 , &s_boulderdrop6 , &s_boulderdrop5 , &s_boulderdrop4 , &s_boulderdrop3 , &s_boulderdrop2 , &s_boulderdrop1 , &s_boulderspawn , &s_gunfire2 , &s_gunfire1 , &s_gunstand , &s_gunraise4 , &s_gunraise3 , &s_gunraise2 , &s_gunraise1 , &s_gunlower3 , &s_gunlower2 , &s_gunlower1 , &s_gundead , &s_gundie1 , &s_4waygunfire1 , &s_4waygunfire2 , &s_4waygun , &s_kessphere8 , &s_kessphere7 , &s_kessphere6 , &s_kessphere5 , &s_kessphere4 , &s_kessphere3 , &s_kessphere2 , &s_kessphere1 , &s_slop1, &s_slop2, &s_slop3, &s_slop4, &s_batblast1, &s_batblast2, &s_batblast3, &s_batblast4, &s_serialdog4, &s_serialdog3, &s_serialdog2, &s_serialdog, &s_serialdogattack, &s_doguse , &s_doglick, &s_dogwait, #endif //SHAREWARE }; #endif rott-20230810/rott/rt_ted.c000066400000000000000000004220271446517470200154010ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ // make sure word alignment is OFF! #include "rt_def.h" #include "rt_sound.h" #include #include #include #include #include #include "states.h" #include "watcom.h" #include "rt_ted.h" #include "_rt_ted.h" #include "w_wad.h" #include "z_zone.h" #include "rt_util.h" #include "lumpy.h" #include "rt_vid.h" #include "rt_actor.h" #include "rt_stat.h" #include "rt_menu.h" #include "rt_draw.h" #include "rt_com.h" #include "rt_main.h" #include "rt_door.h" #include "rt_playr.h" #include "rt_view.h" #include "rt_str.h" #include "isr.h" #include "rt_floor.h" #include "rt_game.h" #include "rt_rand.h" #include "rt_cfg.h" #include "develop.h" #include "modexlib.h" #include "engine.h" #include "rt_debug.h" #include "rt_scale.h" #include "rt_net.h" //======================================== // GLOBAL VARIABLES //======================================== extern boolean UseBaseMarker; teamtype TEAM[MAXPLAYERS]; int numareatiles[NUMAREAS+1]; int shapestart,shapestop; _2dvec SPAWNLOC[MAXSPAWNLOCATIONS],FIRST,SECOND; int NUMSPAWNLOCATIONS,numteams=0; wall_t walls[MAXWALLTILES]; str_clock Clocks[MAXCLOCKS]; int numclocks; int LightsInArea[NUMAREAS+1]; int maxheight; int nominalheight; int elevatorstart; int gunsstart; int fog; int lightsource; int SNAKELEVEL; int whichpath; word *mapplanes[3]; int mapwidth; int mapheight; int lastlevelloaded=-1; boolean insetupgame; boolean ISRTL = false; unsigned MapSpecials = 0; char LevelName[80]; //======================================== // LOCAL VARIABLES //======================================== static cachetype * cachelist; static word cacheindex; static boolean CachingStarted=false; char * ROTTMAPS; char * BATTMAPS; static char NormalWeaponTiles[ 10 ] = { 46, 48, 49, 50, 51, 52, 53, 54, 55, 56 }; static char SharewareWeaponTiles[ 7 ] = { 48, 49, 50, 51, 52, 53, 54 }; static char CacheStrings[MAXSILLYSTRINGS][80]= { {"Ready yourself\nfor destruction!\0\0"}, {"Here comes the enemy!\0\0"}, {"Hope you wrote\nyour will!\0\0"}, {"Did you bring your\nextra bullets?\0\0"}, {"Try not to bleed\non the rug.\0\0"}, {"Let's see...bandages,\ntape, splints,...\0\0"}, {"Couldn't we just\ntalk this over?\0\0"}, {"Cache as cache can...\0\0"}, {"You are smart.\nMake us strong.\0\0"}, {"Bleh!\0\0"}, {"I am as far\nabove you...\0\0"}, {"Just keep thinkin':\nBut it's loadin' COOL\nstuff...\0\0"}, {"Guess which line\nwill win!\0\0"}, {"Oh, no. Not again.\0\0"}, {"Wait! I'm not ready!\nToo late.\0\0"}, {"Hope this doesn't\ncrash.\0\0"}, {"Have a sandwich.\0\0"}, {"Smoke 'em if\nya got 'em...and\nif ya like cancer.\0\0"}, {"Ummmmm...\0\0"}, {"Bang! Bang! Bang!\nFreeze!\0\0"}, {"You have the right\nto...DIE.\0\0"}, {"Insert funny phrase\nhere.\0\0"}, {"Blood, bullets,\nnicely decorated\nhallways.\0\0"}, {"You are to be killed,\nnot hurt.\0\0"}, {"It's time for you to\ngo down the stairs!\0\0"}, {"This game, like,\nrules and stuff.\0\0"}, {"We get money for this!\nHa ha ha ha!\0\0"}, {"Let's not start any\nreligious wars...\0\0"}, {"I don't wanna start\nno ting...\0\0"}, {"Ah, another sacrifice!\0\0"}, {"If you were dead,\nyou'd be the\nsame thing.\0\0"}, {"This Game isn't\nhuman; it can't\nbe reasoned with!\0\0"} }; void SetupGameLevel (void); void ScanInfoPlane(void); void DrawPreCache( void ); void InitializePlayerstates(void); void SetupSnakePath(void); void SetupRandomActors(void); void SetupActors(void); void SetupStatics(void); void LoftSprites( void ); int GetLumpForTile(int tile); //======================================== /* ====================== = = SortPreCache = Sort the Precache for cachelevel precedence using a HEAPSORT = ====================== */ #define SGN(x) ((x>0) ? (1) : ((x==0) ? (0) : (-1))) /*--------------------------------------------------------------------------*/ int CompareTags(s1p,s2p) cachetype *s1p,*s2p; { return SGN(s1p->lump-s2p->lump); } void SwitchCacheEntries(s1p,s2p) cachetype *s1p,*s2p; { cachetype temp; temp=*s1p; *s1p=*s2p; *s2p=temp; } void SortPreCache( void ) { hsort((char *)cachelist,cacheindex,sizeof(cachetype),&CompareTags,&SwitchCacheEntries); } //======================================== /* ====================== = = SetupPreCache = Setup the cache for pre-cacheing = ====================== */ void SetupPreCache( void ) { CachingStarted=true; cacheindex=0; cachelist=(cachetype *)SafeMalloc(MAXPRECACHE*(sizeof(cachetype))); DrawPreCache(); } /* ====================== = = ShutdownPreCache = Setup the cache for pre-cacheing = ====================== */ void ShutdownPreCache( void ) { CachingStarted=false; SafeFree((byte *)cachelist); } /* ====================== = = PreCacheLump = precache the lump and check to see if it is already tagged = ====================== */ void PreCacheLump( int lump, int level, int type ) // added type { int i; if (CachingStarted==false) return; if (!W_LumpLength(lump)) { return; } for (i=1;iplayer*REMOTEOFFSET); end =W_GetNumForName("CASWDEAD")+(pstate->player*REMOTEOFFSET); PreCacheGroup(start,end,cache_patch_t); } } } void PreCachePlayerSound(void) { switch (locplayerstate->player) { case 0: SD_PreCacheSound(SD_PLAYERTCSND); break; case 1: SD_PreCacheSound(SD_PLAYERTBSND); break; case 2: SD_PreCacheSound(SD_PLAYERDWSND); break; case 3: SD_PreCacheSound(SD_PLAYERLNSND); break; case 4: SD_PreCacheSound(SD_PLAYERIPFSND); break; } } #define IS_ALTERNATE_ACTOR(ob) \ ((ob->shapeoffset - deathshapeoffset[ob->obclass]) > 0)\ /* ====================== = = PreCacheActor = precache the lump and check to see if it is already tagged = ====================== */ void PreCacheActor( int actor, int which ) { int start; int end; switch (actor) { case lowguardobj: if (IS_ALTERNATE_ACTOR(new)) { start = SD_LOWGUARD2SEESND; end = SD_LOWGUARD2SEE3SND; SD_PreCacheSoundGroup(start,end); start = SD_LOWGUARD2DIESND; end = SD_LOWGUARD2DIESND; SD_PreCacheSoundGroup(start,end); start = SD_LOWGUARDFIRESND; end = SD_SNEAKYSPRINGFSND; SD_PreCacheSoundGroup(start,end); start=W_GetNumForName("MARSHOO1"); end =W_GetNumForName("MNGRISE4"); //end =W_GetNumForName("MARUSE28"); } else {start = SD_LOWGUARD1SEESND; end = SD_LOWGUARD1SEE3SND; SD_PreCacheSoundGroup(start,end); start = SD_LOWGUARD1DIESND; end = SD_LOWGUARD1DIESND; SD_PreCacheSoundGroup(start,end); start = SD_LOWGUARDFIRESND; end = SD_SNEAKYSPRINGFSND; SD_PreCacheSoundGroup(start,end); start=W_GetNumForName("LWGSHOO1"); end = W_GetNumForName("SNGRISE4"); //end =W_GetNumForName("LOWUSE28"); } break; case highguardobj: start = SD_HIGHGUARD1SEESND; end = SD_HIGHGUARDDIESND; SD_PreCacheSoundGroup(start,end); if (IS_ALTERNATE_ACTOR(new)) { start=W_GetNumForName("HIGSHOO1"); end =W_GetNumForName("HIGWDEAD"); //end =W_GetNumForName("HIHUSE28"); } else { start=W_GetNumForName("HG2SHOO1"); end =W_GetNumForName("HG2WDEAD"); //end =W_GetNumForName("H2HUSE28"); } break; case overpatrolobj: start=W_GetNumForName("OBBOLO1"); end =W_GetNumForName("OBBOLO4"); PreCacheGroup(start,end,cache_patch_t); start=W_GetNumForName("NET1"); end =W_GetNumForName("NET4"); PreCacheGroup(start,end,cache_patch_t); start = SD_OVERP1SEESND; end = SD_OVERPDIESND; SD_PreCacheSoundGroup(start,end); SD_PreCacheSoundGroup(SD_NETWIGGLESND,SD_NETFALLSND); if (IS_ALTERNATE_ACTOR(new)) { start=W_GetNumForName("PATSHOO1"); end =W_GetNumForName("PATDEAD"); //end =W_GetNumForName("OBPUSE28"); } else { start=W_GetNumForName("OBPSHOO1"); end =W_GetNumForName("OBPDEAD"); //end =W_GetNumForName("PATUSE28"); } break; case strikeguardobj: start = SD_STRIKE1SEESND; end = SD_STRIKEDIESND; SD_PreCacheSoundGroup(start,end); if (IS_ALTERNATE_ACTOR(new)) { start=W_GetNumForName("XYGSHOO1"); end =W_GetNumForName("XYLROLL6"); //end =W_GetNumForName("XYUSE28"); } else { start=W_GetNumForName("ANGSHOO1"); end =W_GetNumForName("ANLROLL6"); //end =W_GetNumForName("ANUSE28"); } break; case blitzguardobj: start = SD_BLITZ1SEESND; end = SD_BLITZDIESND; SD_PreCacheSoundGroup(start,end); if (IS_ALTERNATE_ACTOR(new)) { start=W_GetNumForName("WIGSHOO1"); end =W_GetNumForName("WIHUSE28"); } else { start=W_GetNumForName("LIGSHOO1"); end =W_GetNumForName("LIPEAD11"); } break; case triadenforcerobj: start = SD_ENFORCERSEESND; end = SD_ENFORCERDIESND; SD_PreCacheSoundGroup(start,end); start=W_GetNumForName("TEGREN1"); end =W_GetNumForName("TGRENF6"); PreCacheGroup(start,end,cache_patch_t); start=W_GetNumForName("TRISHOO1"); end =W_GetNumForName("TRIWDEAD"); //end =W_GetNumForName("TRIUSE28"); break; case deathmonkobj: start = SD_MONKSEESND; end = SD_MONKDIESND; SD_PreCacheSoundGroup(start,end); start=W_GetNumForName("MONKDR1"); end =W_GetNumForName("MONDEAD"); //end =W_GetNumForName("MONUSE28"); break; case dfiremonkobj: start = SD_FIREMONKSEESND; end = SD_FIREMONKDIESND; SD_PreCacheSoundGroup(start,end); start = W_GetNumForName("MONFIRE1"); end = W_GetNumForName("MONFIRE4"); PreCacheGroup(start,end,cache_patch_t); if (IS_ALTERNATE_ACTOR(new)) { start=W_GetNumForName("MRKKSH1"); end =W_GetNumForName("MRKDEAD7"); } else { start=W_GetNumForName("ALLKSH1"); end =W_GetNumForName("ALLDEAD7"); } break; case roboguardobj: start = SD_ROBOTSEESND; end = SD_ROBOTDIESND; SD_PreCacheSoundGroup(start,end); start=W_GetNumForName("ROBOGRD1"); end =W_GetNumForName("ROBGRD16"); break; case b_darianobj: PreCachePlayerSound(); start = SD_DARIANSEESND; end = SD_DARIANSAY3; SD_PreCacheSoundGroup(start,end); start=W_GetNumForName("DARSHOO1"); end =W_GetNumForName("DARUSE28"); break; case b_heinrichobj: PreCachePlayerSound(); start = SD_KRISTSEESND; end = SD_KRISTSAY3; SD_PreCacheSoundGroup(start,end); start=W_GetNumForName("MINE1"); end =W_GetNumForName("MINE4"); PreCacheGroup(start,end,cache_patch_t); start=W_GetNumForName("HSIT1"); end =W_GetNumForName("HDOPE8"); break; case b_darkmonkobj: start = SD_DARKMONKSEESND; end = SD_DARKMONKSAY3; SD_PreCacheSoundGroup(start,end); start=W_GetNumForName("LIGNING1"); end =W_GetNumForName("FSPARK4"); PreCacheGroup(start,end,cache_patch_t); start=W_GetNumForName("TOMS1"); end =W_GetNumForName("TOHRH8"); break; case b_darksnakeobj: PreCachePlayerSound(); start = SD_SNAKESEESND; end = SD_SNAKESAY3; SD_PreCacheSoundGroup(start,end); start=W_GetNumForName("TOMRH1"); end =W_GetNumForName("TOHRH8"); case b_robobossobj: PreCachePlayerSound(); start = SD_NMESEESND; end = SD_NMESEESND; SD_PreCacheSoundGroup(start,end); start=W_GetNumForName("RHEAD101"); end =W_GetNumForName("NMESAUC4"); break; case patrolgunobj: start = SD_EMPLACEMENTSEESND; end = SD_BIGEMPLACEFIRESND; SD_PreCacheSoundGroup(start,end); start=W_GetNumForName("GUNEMP1"); end =W_GetNumForName("GUNEMPF8"); PreCacheGroup(start,end,cache_patch_t); start=W_GetNumForName("GRISE11"); end =W_GetNumForName("GDEAD2"); break; case wallopobj: start=W_GetNumForName("BSTAR1"); end =W_GetNumForName("BSTAR4"); PreCacheGroup(start,end,cache_patch_t); start=W_GetNumForName("BCRAFT1"); end =W_GetNumForName("BCRAFT16"); break; case wallfireobj: SD_PreCacheSound(SD_FIRECHUTESND); SD_PreCacheSound(SD_FIREBALLSND); SD_PreCacheSound(SD_FIREBALLHITSND); start = W_GetNumForName("CRFIRE11"); end = W_GetNumForName("CREXP5"); case pillarobj: start=W_GetNumForName("PUSHCOL1"); end =W_GetNumForName("PSHCOL1A"); //end =W_GetNumForName("PUSHCOL3"); break; case firejetobj: SD_PreCacheSound(SD_FIREJETSND); if (which) { start=W_GetNumForName("FJUP0"); end =W_GetNumForName("FJUP22"); } #if (SHAREWARE == 0) else { start=W_GetNumForName("FJDOWN0"); end =W_GetNumForName("FJDOWN22"); } #endif break; case bladeobj: SD_PreCacheSound(SD_BLADESPINSND); #if (SHAREWARE == 0) if (which&2) { if (which&1) { start=W_GetNumForName("SPSTUP1"); end =W_GetNumForName("SPSTUP16"); } else { start=W_GetNumForName("SPSTDN1"); end =W_GetNumForName("SPSTDN16"); } } else { if (which&1) { start=W_GetNumForName("UBLADE1"); end =W_GetNumForName("UBLADE9"); } else { start=W_GetNumForName("DBLADE1"); end =W_GetNumForName("DBLADE9"); } } #else start=W_GetNumForName("UBLADE1"); end =W_GetNumForName("UBLADE9"); #endif break; case crushcolobj: SD_PreCacheSound(SD_CYLINDERMOVESND); if (which) { start=W_GetNumForName("CRDOWN1"); end =W_GetNumForName("CRDOWN8"); } #if (SHAREWARE == 0) else { start=W_GetNumForName("CRUP1"); end =W_GetNumForName("CRUP8"); } #endif break; case boulderobj: start=W_GetNumForName("BOL11"); end =W_GetNumForName("BSINK9"); SD_PreCacheSound(SD_BOULDERHITSND); SD_PreCacheSound(SD_BOULDERROLLSND); SD_PreCacheSound(SD_BOULDERFALLSND); break; case spearobj: SD_PreCacheSound(SD_SPEARSTABSND); if (which) { start=W_GetNumForName("SPEARUP1"); end =W_GetNumForName("SPERUP16"); } #if (SHAREWARE == 0) else { start=W_GetNumForName("SPEARDN1"); end =W_GetNumForName("SPERDN16"); } #endif break; case gasgrateobj: start = SD_GASSTARTSND; end = SD_GASMASKSND; SD_PreCacheSoundGroup(start,end); if ((locplayerstate->player == 1) || (locplayerstate->player == 3)) SD_PreCacheSound(SD_PLAYERCOUGHFSND); else SD_PreCacheSound(SD_PLAYERCOUGHMSND); start=-1; end=-1; break; case springobj: SD_PreCacheSound(SD_SPRINGBOARDSND); start=W_GetNumForName("SPRING1"); end =W_GetNumForName("SPRING9"); break; default: return; break; } if ((start>=0) && (end>=0)) PreCacheGroup(start,end,cache_patch_t); } /* ====================== = = MiscPreCache = precache the lump and check to see if it is already tagged = ====================== */ void MiscPreCache( void ) { int start; int end; //essential sounds SD_PreCacheSoundGroup(SD_HITWALLSND,SD_PLAYERDWHURTSND); SD_PreCacheSoundGroup(SD_RICOCHET1SND,SD_RICOCHET3SND); SD_PreCacheSound(SD_ATKPISTOLSND); SD_PreCacheSoundGroup(SD_PLAYERBURNEDSND,SD_PLAYERLANDSND); SD_PreCacheSoundGroup(SD_EXPLODEFLOORSND,SD_EXPLODESND); if (lightning==true) SD_PreCacheSound(SD_LIGHTNINGSND); SD_PreCacheSound(SD_BODYLANDSND); SD_PreCacheSound(SD_GIBSPLASHSND); SD_PreCacheSound(SD_ACTORLANDSND); SD_PreCacheSound(SD_ACTORSQUISHSND); // cache in bullet hole graphics start=W_GetNumForName("BULLETHO"); end=W_GetNumForName("ALTBHO"); PreCacheGroup(start,end,cache_transpatch_t); // cache in explosions start=W_GetNumForName("EXPLOS1"); end =W_GetNumForName("GREXP25"); PreCacheGroup(start,end,cache_patch_t); // cache in misc player sprites start=W_GetNumForName("BLOODS1"); end =W_GetNumForName("PLATFRM5"); PreCacheGroup(start,end,cache_patch_t); // cache in missile smoke start=W_GetNumForName("MISSMO11"); end =W_GetNumForName("MISSMO14"); PreCacheGroup(start,end,cache_patch_t); // cache in player's gun // cache in rubble start=W_GetNumForName("RUBBLE1"); end =W_GetNumForName("RUBBLE10"); PreCacheGroup(start,end,cache_patch_t); // cache in guts start=W_GetNumForName("GUTS1"); end =W_GetNumForName("GUTS12"); PreCacheGroup(start,end,cache_patch_t); // cache in player missile start=W_GetNumForName("BJMISS1"); end =W_GetNumForName("BJMISS16"); PreCacheGroup(start,end,cache_patch_t); if (gamestate.violence >= vl_high) { // cache in all gibs start = W_GetNumForName("PART1"); end = W_GetNumForName("GEYE3"); PreCacheGroup(start,end,cache_patch_t); } } /* ======================== = = IsChristmas = ======================== */ boolean IsChristmas(void) { struct dosdate_t date; _dos_getdate(&date); if (((date.day == 24) || (date.day == 25)) && //Christmas (date.month == 12) ) return true; return false; } /* ======================== = = CheckHolidays = ======================== */ void CheckHolidays(void) { struct dosdate_t date; _dos_getdate(&date); if (IsChristmas()) DrawNormalSprite(0,0,W_GetNumForName("santahat")); else if ((date.month == 5) && (date.day == 5)) // Cinco de Mayo DrawNormalSprite(0,0,W_GetNumForName("sombrero")); else if ((date.month == 7) && (date.day == 4)) // 4th of July DrawNormalSprite(0,0,W_GetNumForName("amflag")); else if ((date.month == 10) && (date.day == 31)) // Halloween DrawNormalSprite(0,0,W_GetNumForName("witchhat")); else if ((date.month == 4) && (date.dayofweek == 0)) //Easter { int i; for(i=15;i<=21;i++) { if (date.day == i) DrawNormalSprite(0,0,W_GetNumForName("esterhat")); } } } /* ====================== = = DrawPreCache = ====================== */ extern boolean dopefish; void DrawPreCache( void ) { if (loadedgame==false) { char temp[80]; int width, height, num; char buf[30]; if ( BATTLEMODE ) { VL_DrawPostPic (W_GetNumForName("trilogo")); VWB_TBar ( 30, 23, 260, 82 ); ShowBattleOptions( false, 56, 26 ); DrawPlayers (); } else { pic_t * pic; pic=(pic_t *)W_CacheLumpName("mmbk",PU_CACHE, Cvt_pic_t, 1); VWB_DrawPic (0, 0, pic); CheckHolidays(); } DrawNormalSprite (PRECACHEBARX, PRECACHEBARY, W_GetNumForName ("cachebar")); CurrentFont=smallfont; PrintY = PRECACHEESTRINGY; PrintX = PRECACHEESTRINGX; memset (&buf[0], 0, sizeof (buf)); if ( !BATTLEMODE ) { memcpy (&buf[0], "EPISODE ", 8); itoa (gamestate.episode,&buf[8],10); } else memcpy (&buf[0], "COMM-BAT", 8); US_MeasureStr (&width, &height, "%s", &buf[0]); VWB_TBar (PrintX-2, PrintY-2, width+4, height+4); US_BufPrint (&buf[0]); PrintY = PRECACHEASTRINGY; memset (&buf[0], 0, sizeof (buf)); memcpy (&buf[0], "AREA ", 5); if ( !BATTLEMODE ) { itoa( GetLevel( gamestate.episode, gamestate.mapon ), &buf[ 5 ], 10 ); } else { itoa( gamestate.mapon + 1, &buf[ 5 ], 10 ); } US_MeasureStr (&width, &height, "%s", &buf[0]); PrintX = (300-width); VWB_TBar (PrintX-2, PrintY-2, width+4, height+4); US_BufPrint (&buf[0]); PrintY = PRECACHESTRINGY; num = (RandomNumber ("PreCacheString", 0)) % MAXSILLYSTRINGS; if ((dopefish==true) || (tedlevel == true)) strcpy (temp, &(CacheStrings[num][0])); else strcpy (temp, &(LevelName[0])); US_MeasureStr (&width, &height, "%s", &temp[0]); PrintX = (320-width) >> 1; PrintY = PRECACHESTRINGY; VWB_TBar (PrintX-2, PrintY-2, width+4, height+4); US_BufPrint (&temp[0]); VW_UpdateScreen(); MenuFadeIn (); } } #define CACHETICDELAY (6) /* ====================== = = PreCache = precache all the lumps for the level = ====================== */ void PreCache( void ) { int total = 0; int maxheapsize = 0; int newheap = 0; int currentmem = 0; int currentcache = 0; int lastmem=0; int lastcache=0; int ticdelay = 0; byte *tempbuf; double Gs = (iGLOBAL_SCREENWIDTH*100.0/320.0) / 100.0; //SetTextMode ( ); /* #define PRECACHEBARX 28 #define PRECACHEBARY 178 #define PRECACHELED1X 9 #define PRECACHELED1Y 8 #define PRECACHELED2X 9 #define PRECACHELED2Y 12 */ if (CachingStarted==false) { if (loadedgame==false) { ClearGraphicsScreen(); MenuFadeIn (); } return; } MiscPreCache(); SortPreCache(); if (loadedgame==false) { maxheapsize=Z_HeapSize(); total=0; tempbuf=bufferofs; bufferofs=page1start; // fixed, was displayofs ticdelay=CACHETICDELAY; for (size_t i=1;i= MAXLEDS) currentmem = MAXLEDS - 1; while (lastmem<=currentmem) {//SetTextMode ( ); if ( iGLOBAL_SCREENWIDTH == 320) { DrawNormalSprite (PRECACHEBARX+PRECACHELED1X+(lastmem<<2), PRECACHEBARY+PRECACHELED1Y, W_GetNumForName ("led1"));//led1 progressbar }else if ( iGLOBAL_SCREENWIDTH == 640) { DrawNormalSprite (72+(Gs*(lastmem<<2)),446,W_GetNumForName ("led1"));//led1 progressbar DrawNormalSprite (72+(Gs*(lastmem<<2)),446+3,W_GetNumForName ("led1"));//led1 progressbar DrawNormalSprite (72+3+(Gs*(lastmem<<2)),446,W_GetNumForName ("led1"));//led1 progressbar DrawNormalSprite (72+3+(Gs*(lastmem<<2)),446+3,W_GetNumForName ("led1"));//led1 progressbar } lastmem++; VW_UpdateScreen (); // was missing, fixed } currentcache=(i*MAXLEDS)/(cacheindex+1); while (lastcache<=currentcache) { if ( iGLOBAL_SCREENWIDTH == 320) { DrawNormalSprite (PRECACHEBARX+PRECACHELED2X+(lastcache<<2), PRECACHEBARY+PRECACHELED2Y, W_GetNumForName ("led2"));//led2 progressbar }else if ( iGLOBAL_SCREENWIDTH == 640) { DrawNormalSprite (72+(Gs*(lastcache<<2)),458,W_GetNumForName ("led2"));//led2 progressbar DrawNormalSprite (72+(Gs*(lastcache<<2)),458+3,W_GetNumForName ("led2"));//led2 progressbar DrawNormalSprite (72+3+(Gs*(lastcache<<2)),458,W_GetNumForName ("led2"));//led2 progressbar DrawNormalSprite (72+3+(Gs*(lastcache<<2)),458+3,W_GetNumForName ("led2"));//led2 progressbar } DisableScreenStretch();//bna++ VW_UpdateScreen ();//bna++ lastcache++; ticdelay--; if (ticdelay==0) { extern boolean dopefish; if ( dopefish==true ) { SD_PlayPitchedSound ( SD_DOPEFISHSND, 255, 0 ); } ticdelay=CACHETICDELAY; } VW_UpdateScreen (); // was missing, fixed } } DisableScreenStretch();//bna++ VW_UpdateScreen ();//bna++ //I_Delay(200); bufferofs=tempbuf; ShutdownPreCache (); if ( BATTLEMODE ) { int width = 0; int height = 0; char buf[30] = {0};//byte * shape; double WHratio = (16200.0/200.0) / 100.0; /// iGLOBAL_SCREENWIDTH = 640; // iGLOBAL_SCREENHEIGHT = 480; DisableScreenStretch(); // Cache in fonts // shape = W_CacheLumpNum (W_GetNumForName ("newfnt1"), PU_STATIC, Cvt_font_t, 1); // bigfont = (font_t *)shape; CurrentFont = newfont1;//smallfont; strcpy( buf, "Press Any Key" ); US_MeasureStr (&width, &height, "%s", &buf[ 0 ] ); PrintX = (iGLOBAL_SCREENWIDTH-(width)) / 2; PrintY = WHratio*iGLOBAL_SCREENHEIGHT;//162; //VWB_TBar (PrintX-2, PrintY-2, width+4, height+4); US_BufPrint (&buf[0]); VW_UpdateScreen(); IN_StartAck(); while (!IN_CheckAck ()) ; } // EnableScreenStretch(); } else { for (size_t i=1;i RTL_VERSION ) { Error( "The file '%s' is a version %d.%d %s file.\n" "The highest this version of ROTT can load is %d.%d.", filename, RTLVersion >> 8, RTLVersion & 0xff, RTLSignature, RTL_VERSION >> 8, RTL_VERSION & 0xff ); } close( filehandle ); } /* ====================== = = ReadROTTMap = ====================== */ void ReadROTTMap ( char *filename, int mapnum ) { RTLMAP RTLMap; int filehandle; long pos; long compressed; long expanded; int plane; byte *buffer; CheckRTLVersion( filename ); filehandle = SafeOpenRead( filename ); // // Load map header // lseek( filehandle, RTL_HEADER_OFFSET + mapnum * sizeof( RTLMap ), SEEK_SET ); SafeRead( filehandle, &RTLMap, sizeof( RTLMap ) ); SwapIntelLong((int *)&RTLMap.used); SwapIntelLong((int *)&RTLMap.CRC); SwapIntelLong((int *)&RTLMap.RLEWtag); SwapIntelLong((int *)&RTLMap.MapSpecials); SwapIntelLongArray((int *)&RTLMap.planestart, NUMPLANES); SwapIntelLongArray((int *)&RTLMap.planelength, NUMPLANES); if ( !RTLMap.used ) { Error( "ReadROTTMap: Tried to load a non existent map!" ); } #if ( SHAREWARE == 1 ) if ( RTLMap.RLEWtag == REGISTERED_TAG ) { Error( "Can't use maps from the registered game in shareware version." ); } if ( RTLMap.RLEWtag != SHAREWARE_TAG ) { Error( "Can't use modified maps in shareware version." ); } #endif mapwidth = 128; mapheight = 128; // Get special map flags MapSpecials = RTLMap.MapSpecials; // // load the planes in // expanded = mapwidth * mapheight * 2; for( plane = 0; plane <= 2; plane++ ) { pos = RTLMap.planestart[ plane ]; compressed = RTLMap.planelength[ plane ]; buffer = SafeMalloc( compressed ); lseek( filehandle, pos, SEEK_SET ); SafeRead( filehandle, buffer, compressed ); mapplanes[ plane ] = Z_Malloc( expanded, PU_LEVEL, (void **)&mapplanes[ plane ] ); // // unRLEW, skipping expanded length // #if ( SHAREWARE == 1 ) CA_RLEWexpand( ( word * )buffer, ( word * )mapplanes[ plane ], expanded >> 1, SHAREWARE_TAG ); #else CA_RLEWexpand( ( word * )buffer, ( word * )mapplanes[ plane ], expanded >> 1, RTLMap.RLEWtag ); #endif SafeFree( buffer ); } close(filehandle); // // get map name // strcpy( LevelName, RTLMap.Name ); } /* ====================== = = GetNextMap = ====================== */ int GetNextMap ( int tilex, int tiley ) { word next; word icon; boolean done; next = MAPSPOT( tilex, tiley, 2 ); icon = MAPSPOT( tilex, tiley, 1 ); done=false; if ( ( ( icon != EXITTILE ) && ( icon != SECRETEXITTILE ) ) || ( ( ( next&0xff00 ) != 0xe200 ) && ( ( next&0xff00 ) != 0xe400 ) ) ) { int i,j; for ( j = 0; j < mapheight; j++ ) { for ( i = 0; i < mapwidth; i++ ) { icon = MAPSPOT( i, j, 1 ); next = MAPSPOT( i, j, 2 ); if ( ( ( icon == EXITTILE ) || ( icon == SECRETEXITTILE ) ) && ( ( ( next&0xff00 ) == 0xe200 ) || ( ( next&0xff00 ) == 0xe400 ) ) ) { done=true; break; } } if ( done == true ) { break; } } if ( !done ) { Error( "GetNextMap : No exit tile on map %d.", gamestate.mapon ); } } if ( ( ( next & 0xff00 ) != 0xe200 ) && ( ( next & 0xff00 ) != 0xe400 ) ) { // Should this be DEVELOPMENT only? Error( "GetNextMap : Illegal destination map %xh at exit " "tile on map %d.", next, gamestate.mapon ); } if ( next == 0xe2ff ) { return -1; } return ( next & 0xff ); } /* ====================== = = GetMapFileInfo = ====================== */ void GetMapFileInfo ( mapfileinfo_t *mapinfo, char *filename ) { RTLMAP RTLMap[ 100 ]; int filehandle; int i; int nummaps; CheckRTLVersion( filename ); filehandle = SafeOpenRead( filename ); // // Load map header // lseek( filehandle, RTL_HEADER_OFFSET, SEEK_SET ); SafeRead( filehandle, &RTLMap, sizeof( RTLMap ) ); close( filehandle ); nummaps = 0; for( i = 0; i < 100; i++ ) { if ( !RTLMap[ i ].used ) { continue; } mapinfo->maps[ nummaps ].number = i; strcpy( mapinfo->maps[ nummaps ].mapname, RTLMap[ i ].Name ); nummaps++; } mapinfo->nummaps = nummaps; } /* ====================== = = GetMapFileName = ====================== */ void GetMapFileName ( char * filename ) { if ( ( BATTLEMODE ) && (BattleLevels.avail == true) ) { strcpy(filename,BattleLevels.file); } else if (GameLevels.avail == true) { strcpy(filename,GameLevels.file); } else if ( BATTLEMODE ) { strcpy(filename,BATTMAPS); } else { strcpy(filename,ROTTMAPS); } } /* ====================== = = SetBattleMapFileName = ====================== */ void SetBattleMapFileName ( char * filename ) { BattleLevels.avail = true; BattleLevels.file = strdup(filename); } /* ====================== = = GetMapCRC = ====================== */ word GetMapCRC ( int num ) { int filehandle; char filename[ 80 ]; RTLMAP RTLMap; GetMapFileName( &filename[ 0 ] ); CheckRTLVersion( filename ); filehandle = SafeOpenRead( filename ); // // Load map header // lseek( filehandle, RTL_HEADER_OFFSET + num * sizeof( RTLMap ), SEEK_SET ); SafeRead( filehandle, &RTLMap, sizeof( RTLMap ) ); close( filehandle ); return( RTLMap.CRC ); } /* ====================== = = GetAlternateMapInfo = ====================== */ void GetAlternateMapInfo (mapfileinfo_t * mapinfo, AlternateInformation *info) { if (UL_ChangeDirectory (info->path) == false) Error ("ERROR : Can't change to alternate directory %s!\n", info->path); GetMapFileInfo (mapinfo, info->file); UL_ChangeDirectory (&CWD[0]); } /* ====================== = = GetMapInfo = ====================== */ void GetMapInfo ( mapfileinfo_t *mapinfo ) { if ( ( BATTLEMODE ) && ( BattleLevels.avail == true ) ) { GetAlternateMapInfo( mapinfo, &BattleLevels ); } else if ( GameLevels.avail == true ) { GetAlternateMapInfo( mapinfo, &GameLevels ); } else if ( BATTLEMODE ) { GetMapFileInfo( mapinfo, BATTMAPS ); } else { GetMapFileInfo( mapinfo, ROTTMAPS ); } } /* ====================== = = LoadTedMap = ====================== */ void LoadTedMap ( const char *extension, int mapnum ) { long pos; long compressed; long expanded; int plane; int i; int maphandle; byte *buffer; maptype mapheader; char name[ 200 ]; mapfiletype *tinf; // // load maphead.ext (offsets and tileinfo for map file) // strcpy( name, "maphead." ); strcat( name, extension ); LoadFile( name, ( void * )&tinf ); // fix structure alignment tinf = ( void * )( ( word * )tinf - 1 ); for( i = 0 ; i < 100 ; i++ ) { tinf->headeroffsets[ i ] = IntelLong( tinf->headeroffsets[ i ] ); } // // open the data file // strcpy( name, "maptemp." ); strcat( name, extension ); maphandle = SafeOpenRead( name ); // // load map header // pos = tinf->headeroffsets[ mapnum ]; // $FFFFFFFF start is a sparse map if ( pos < 0 ) { Error( "LoadTedMap : Tried to load a non existent map!" ); } lseek( maphandle, pos, SEEK_SET ); SafeRead( maphandle, &mapheader, sizeof( maptype ) ); for( i = 0 ; i < 3; i++ ) { mapheader.planestart[ i ] = IntelLong( mapheader.planestart[ i ] ); mapheader.planelength[ i ] = IntelShort( mapheader.planelength[ i ] ); } mapheader.width = IntelShort( mapheader.width ); mapheader.height = IntelShort( mapheader.height ); mapwidth = mapheader.width; mapheight = mapheader.height; // Set special map flags MapSpecials = 0; // // load the planes in // expanded = mapheader.width * mapheader.height * 2; for( plane = 0; plane <= 2; plane++ ) { pos = mapheader.planestart[ plane ]; lseek( maphandle, pos, SEEK_SET ); compressed = mapheader.planelength[ plane ]; buffer = SafeMalloc( compressed ); SafeRead( maphandle, buffer, compressed ); mapplanes[ plane ] = Z_Malloc( expanded, PU_LEVEL, (void **)&mapplanes[ plane ] ); // // unRLEW, skipping expanded length // CA_RLEWexpand( ( word * )( buffer + 2 ), ( word * )mapplanes[ plane ], expanded >> 1, 0xabcd ); SafeFree( buffer ); } // fix structure alignment tinf = ( void * )( ( word * )tinf + 1 ); SafeFree( tinf ); if ( close( maphandle ) ) { Error( "Error closing Ted file Error #%d", errno ); } } /* ====================== = = LoadAlternateMap = ====================== */ void LoadAlternateMap (AlternateInformation *info, int mapnum) { if (UL_ChangeDirectory (info->path) == false) Error ("ERROR : Can't change to alternate directory %s!\n",info->path); ReadROTTMap (info->file, mapnum); UL_ChangeDirectory (&CWD[0]); } /* ====================== = = LoadROTTMap = ====================== */ void LoadROTTMap ( int mapnum ) { if ( tedlevel == true ) { LoadTedMap( "rot", mapnum ); } else if ( ( BATTLEMODE ) && ( BattleLevels.avail == true ) ) { LoadAlternateMap( &BattleLevels, mapnum ); } else if ( GameLevels.avail == true ) { LoadAlternateMap( &GameLevels, mapnum ); } else if ( BATTLEMODE ) { ReadROTTMap( BATTMAPS, mapnum ); } else { ReadROTTMap( ROTTMAPS, mapnum ); } } void CountAreaTiles(void) {int i,j,areanumber; word*map,tile; memset(numareatiles,0,sizeof(numareatiles)); map = mapplanes[0]; for(i=0;i= 0) && (areanumber <= NUMAREAS)) numareatiles[areanumber] ++; } } #define InitWall(lump,index,newx,newy) \ { \ PreCacheLump(lump,PU_CACHEWALLS,cache_pic_t); \ if (W_LumpLength(lump) == 0) \ Error("%s being used in shareware at %d %d",\ W_GetNameForNum(lump),newx,newy); \ actorat[newx][newy]= &walls[index]; \ tempwall = (wall_t*)actorat[newx][newy]; \ tempwall->which = WALL; \ tempwall->tile = index; \ } \ /* ================== = = SetupWalls = ================== */ void SetupWalls( void ) { int i,j,lump,index; word *map,tile; wall_t * tempwall; for (i=0;i=0) && (i<=3) && (j==0)) { map++; continue; } if ((loadedgame == false) && (MAPSPOT(i,j,2) == 0xeeee)) {_2Dpoint *tdptr; tdptr = &(MISCVARS->EPOP[MISCVARS->nextpop]); tdptr->x = i; tdptr->y = j; MISCVARS->nextpop ++; MISCVARS->popsleft ++; } tile= *map++; if ((tile > 89) || ((tile > 32) && (tile < 36)) || (tile == 44) || (tile == 45) || (tile == 0) ) { tilemap[i][j] = 0; continue; } if (tile <= 32) { index = tile; } else index = tile-3; if ((tile > 75) && (tile <= 79)) { lump = tilemap[i][j] = GetLumpForTile(tile); PreCacheLump(lump,PU_CACHEWALLS,cache_pic_t); PreCacheLump(elevatorstart+5,PU_CACHEWALLS,cache_pic_t); PreCacheLump(elevatorstart+6,PU_CACHEWALLS,cache_pic_t); PreCacheLump(elevatorstart+7,PU_CACHEWALLS,cache_pic_t); tilemap[i][j]|=0x2000; if (MAPSPOT(i,j,2)==0) MAPSPOT(i,j,2)=21; } else if ((tile >= 47) && (tile <= 48)) { lump = tilemap[i][j] = GetLumpForTile(tile); InitWall(lump,index,i,j); tilemap[i][j]|=0x2000; if (MAPSPOT(i,j,2)==0) MAPSPOT(i,j,2)=21; } else { lump = tilemap[i][j] = GetLumpForTile(tile); InitWall(lump,index,i,j); if (MAPSPOT(i,j,2)) tilemap[i][j]|=0x2000; } } } } /* =============== = = GetNearestAreaNumber = =============== */ word GetNearestAreaNumber ( int tilex, int tiley ) { int up,dn,lt,rt; int tile; tile=MAPSPOT(tilex,tiley,0)-AREATILE; if ((tile<=NUMAREAS) && (tile>0)) return (tile+AREATILE); up=MAPSPOT(tilex,tiley-1,0)-AREATILE; dn=MAPSPOT(tilex,tiley+1,0)-AREATILE; lt=MAPSPOT(tilex-1,tiley,0)-AREATILE; rt=MAPSPOT(tilex+1,tiley,0)-AREATILE; up = ((up>0) && (up<=NUMAREAS)); dn = ((dn>0) && (dn<=NUMAREAS)); lt = ((lt>0) && (lt<=NUMAREAS)); rt = ((rt>0) && (rt<=NUMAREAS)); if (rt) return (MAPSPOT(tilex+1,tiley,0) + AREATILE); else if (lt) return (MAPSPOT(tilex-1,tiley,0) + AREATILE); else if (up) return (MAPSPOT(tilex,tiley-1,0) + AREATILE); else if (dn) return (MAPSPOT(tilex,tiley+1,0) + AREATILE); // else // Error("GetNearestAreaNumber: Couldn't fix up area at x=%ld y=%ld\n",tilex,tiley); return (NUMAREAS+AREATILE-1); } /* =============== = = SetupWindows = =============== */ void SetupWindows ( void ) { int i,j; boolean skythere; skythere = SkyExists(); for (j=0;j=0) && (i<=3) && (j==0)) continue; if (IsWindow(i,j)) { actorat[i][j]=0; if (skythere==true) { tilemap[i][j]|=0x2000; } else { MAPSPOT(i,j,2)=0; } MAPSPOT(i,j,0)=(word)(GetNearestAreaNumber(i,j)); } } } } /* ================== = = GetWallIndex = ================== */ int GetWallIndex( int texture ) { int wallstart; int exitstart; wallstart=W_GetNumForName("WALLSTRT"); exitstart=W_GetNumForName("EXITSTRT"); elevatorstart = W_GetNumForName("ELEVSTRT"); if (texture&0x1000) { texture&=~0x1000; if (texture==0) return 41; else if (texture==1) return 90; else if (texture==2) return 91; else if (texture==3) return 42; else if (texture==4) return 92; else if (texture==5) return 93; else if (texture==6) return 94; else if (texture==7) return 95; else if (texture==8) return 96; else if (texture==9) return 97; else if (texture==10) return 98; else if (texture==11) return 99; else if (texture==12) return 100; else if (texture==13) return 101; else if (texture==14) return 102; else if (texture==15) return 103; else if (texture==16) return 104; } else if (texture > elevatorstart) return (texture - elevatorstart + 68); // else if (texture > specialstart) // return (texture - specialstart + 41); else if (texture > exitstart) return (texture - exitstart + 43); else { if (texture>wallstart+63) return (texture - (wallstart + 63) + 76 ); else if (texture>wallstart+40) return (texture - (wallstart + 40) + 45 ); else return (texture - wallstart); } return 0x8000; } /* ================== = = SetupAnimatedWalls = ================== */ void SetupAnimatedWalls( void ) { int i,j; word *map,tile; wall_t * tempwall; InitAnimatedWallList(); map = mapplanes[0]; for (j=0;j=0) && (i<=3) && (j==0)) { map++; continue; } tile= *map++; if (tile == 44) { actorat[i][j]= &walls[tile-3]; tempwall = (wall_t*)actorat[i][j]; tempwall->which = WALL; tempwall->tile = tile-3; tempwall->flags = FL_W_DAMAGE; SetupAnimatedWall(0); tilemap[i][j]=0; tilemap[i][j]|=0x1000; } else if (tile == 45) { actorat[i][j]= &walls[tile-3]; tempwall = (wall_t*)actorat[i][j]; tempwall->which = WALL; tempwall->tile = tile-3; SetupAnimatedWall(3); tilemap[i][j]=3; tilemap[i][j]|=0x1000; } else if ((tile >= 106) && (tile <= 107)) { actorat[i][j]= &walls[tile-16]; tempwall = (wall_t*)actorat[i][j]; tempwall->which = WALL; tempwall->tile = tile-16; SetupAnimatedWall(tile-105); tilemap[i][j]=tile-105; tilemap[i][j]|=0x1000; } else if ((tile >= 224) && (tile <= 233)) { actorat[i][j]= &walls[tile-224+92]; tempwall = (wall_t*)actorat[i][j]; tempwall->which = WALL; tempwall->tile = tile-224+94; if (tile==233) tempwall->flags = FL_W_DAMAGE; SetupAnimatedWall(tile-224+4); tilemap[i][j]=tile-224+4; tilemap[i][j]|=0x1000; } else if ((tile >= 242) && (tile <= 244)) { actorat[i][j]= &walls[tile-242+102]; tempwall = (wall_t*)actorat[i][j]; tempwall->which = WALL; tempwall->tile = tile-242+102; SetupAnimatedWall(tile-242+14); tilemap[i][j]=tile-242+14; tilemap[i][j]|=0x1000; } } } } /* ================== = = SetupSwitches = ================== */ void SetupSwitches( void ) { int i,j; word *map,tile; map = mapplanes[0]; for (j=0;j=0) && (i<=3) && (j==0)) { map++; continue; } tile= *map++; if ((tile >= 76) && (tile <= 79)) { if (tile == 79) lastswitch->flags |= FL_ON; SpawnSwitchThingy(i,j); } else if ((tile == 157) || (tile == 175)) // hi masked switches { lastswitch->flags |= FL_W_INVERTED; lastswitch->flags |= FL_REVERSIBLE; if (tile==175) lastswitch->flags |= FL_ON; SpawnSwitchThingy(i,j); } } } } void RespawnPlayerobj(objtype *ob) {int rand,numchecked=0; int oldsetupgame,nx,ny,ndir; playertype *pstate; M_LINKSTATE(ob,pstate); if (gamestate.battlemode != battle_CaptureTheTriad) { rand = (GameRandomNumber("playerobj respawn",0) % NUMSPAWNLOCATIONS); while(numchecked < NUMSPAWNLOCATIONS) { if (!actorat[SPAWNLOC[rand].x][SPAWNLOC[rand].y]) {RevivePlayerobj(SPAWNLOC[rand].x,SPAWNLOC[rand].y,SPAWNLOC[rand].dir,ob); return; } numchecked ++; rand = (rand + 1) % NUMSPAWNLOCATIONS; } nx = SPAWNLOC[rand].x; ny = SPAWNLOC[rand].y; ndir = SPAWNLOC[rand].dir; } else {nx = TEAM[pstate->team].tilex; ny = TEAM[pstate->team].tiley; ndir = TEAM[pstate->team].dir; } oldsetupgame = insetupgame; insetupgame = true; FindEmptyTile(&nx,&ny); insetupgame = oldsetupgame; RevivePlayerobj(nx,ny,ndir,ob); } #define SetupSpecificFlagTeamAt(whichteam, spawnlocindex) \ {int newx,newy; \ \ newx = SPAWNLOC[spawnlocindex].x; \ newy = SPAWNLOC[spawnlocindex].y; \ TEAM[whichteam].tilex = newx; \ TEAM[whichteam].tiley = newy; \ TEAM[whichteam].dir = SPAWNLOC[spawnlocindex].x; \ SpawnStatic(newx,newy,stat_collector,9); \ SpawnNewObj(newx,newy,&s_basemarker1,inertobj); \ LASTACTOR->z = LASTSTAT->z; \ LASTSTAT->flags |= FL_COLORED; \ LASTSTAT->hitpoints = whichteam; \ locspawned[spawnlocindex]=1; \ for(j=0;j 2)) Error("players selected more colors(%d) than Capture the Triad allows",numteams); } else TEAM[teamforcolor[color]].nummembers ++; PLAYERSTATE[i].team = teamforcolor[color]; } } /* ============= = = SetupTeams = ============= */ void SetupTeams(void) { int i,j,rand,sx,sy,ntilex,ntiley,dir, maxdist,currdist,spawnindex,cnt; int locspawned[MAXSPAWNLOCATIONS] = {0}; if (gamestate.battlemode == battle_CaptureTheTriad) {rand = (GameRandomNumber("net player spawn",0) % NUMSPAWNLOCATIONS); for(i=0;i TEAM[0].nummembers) ) {SetupSpecificFlagTeamAt(0,rand); break; } rand = (rand + 1)%NUMSPAWNLOCATIONS; } if (i == NUMSPAWNLOCATIONS) Error("No spawn location available for team 0, capture the flag"); maxdist = 0x80000000; for(i=0;i maxdist) {maxdist = currdist; spawnindex = i; } } SetupSpecificFlagTeamAt(1,spawnindex); } else { int badcount = 0,teamindex; if (numteams > NUMSPAWNLOCATIONS) Error("More teams than spawn locations !"); //cnt =0; //for(rand = 0;rand < NUMSPAWNLOCATIONS;rand++) for(cnt=0;cntflags |= FL_DESIGNATED; for(i=0;imissileweapon = pstate->oldweapon = pstate->new_weapon = pstate->oldmissileweapon = pstate->weapon = wp_godhand; pstate->bulletweapon = -1; } else {pstate->missileweapon = pstate->oldweapon = pstate->new_weapon = pstate->oldmissileweapon = pstate->bulletweapon = pstate->weapon = -1; } } } PreCachePlayers(); } /* ================== = = SetupMaskedWalls = ================== */ void SetupMaskedWalls( void ) { int i,j; word *map,tile; map = mapplanes[0]; for (j=0;j= 158) && (tile <= 160)) // Multi glassed walls { SpawnMaskedWall(i,j,mw_multi1+(tile-158),MW_MULTI|MW_BLOCKING|MW_BLOCKINGCHANGES|MW_SHOOTABLE); } else if ((tile >= 176) && (tile <= 178)) // Multi shot out glassed walls { SpawnMaskedWall(i,j,mw_multi1+(tile-176),MW_BOTTOMPASSABLE); } else if ((tile >= 162) && (tile <= 171)) { switch (tile) { case 162: SpawnMaskedWall(i,j,mw_normal1,MW_SHOOTABLE|MW_BLOCKING); break; case 163: SpawnMaskedWall(i,j,mw_normal1,MW_BLOCKING); break; case 164: SpawnMaskedWall(i,j,mw_normal2,MW_SHOOTABLE|MW_BLOCKING); break; case 165: SpawnMaskedWall(i,j,mw_normal2,MW_BLOCKING); break; case 166: SpawnMaskedWall(i,j,mw_normal3,MW_SHOOTABLE|MW_BLOCKING); break; case 167: SpawnMaskedWall(i,j,mw_normal3,MW_BLOCKING); break; case 168: SpawnMaskedWall(i,j,mw_singlepane,MW_SHOOTABLE|MW_BLOCKINGCHANGES|MW_BLOCKING); break; case 169: SpawnMaskedWall(i,j,mw_singlepane,MW_BOTTOMPASSABLE); break; case 170: SpawnMaskedWall(i,j,mw_dogwall,MW_NONDOGBLOCKING|MW_WEAPONBLOCKING); break; case 171: SpawnMaskedWall(i,j,mw_peephole,MW_WEAPONBLOCKING|MW_BLOCKING); break; } } else if (tile == 172) SpawnMaskedWall(i,j,mw_exitarch,MW_BOTTOMPASSABLE); else if (tile == 173) SpawnMaskedWall(i,j,mw_secretexitarch,MW_BOTTOMPASSABLE); else if (tile == 174) // entry gate SpawnMaskedWall(i,j,mw_entrygate,MW_BLOCKING); else if (tile == 157) // hi switch off SpawnMaskedWall(i,j,mw_hiswitchoff,MW_BLOCKING); else if (tile == 175) // hi switch on SpawnMaskedWall(i,j,mw_hiswitchon,MW_BLOCKING|MW_SWITCHON); else if (tile == 179) // railing; SpawnMaskedWall(i,j,mw_railing,MW_ABOVEPASSABLE|MW_MIDDLEPASSABLE); // else if (tile == 161) // pillar // SpawnMaskedWall(i,j,mw_pillar,MW_BLOCKING); } } for (j=0;j=0) || (MAPSPOT(i,j,0)==21)) // check to see we are not on a wall { int which; which=MAPSPOT(i,j,2)-4; switch (which) { case 0: SpawnMaskedWall(i,j,mw_platform1,MW_BOTTOMPASSABLE|MW_MIDDLEPASSABLE); break; case 1: SpawnMaskedWall(i,j,mw_platform2,MW_ABOVEPASSABLE|MW_MIDDLEPASSABLE); break; case 2: SpawnMaskedWall(i,j,mw_platform3,MW_MIDDLEPASSABLE); break; case 3: SpawnMaskedWall(i,j,mw_platform4,MW_BOTTOMPASSABLE); break; case 4: SpawnMaskedWall(i,j,mw_platform5,MW_BOTTOMPASSABLE|MW_ABOVEPASSABLE); break; case 5: SpawnMaskedWall(i,j,mw_platform6,MW_ABOVEPASSABLE); break; case -3: SpawnMaskedWall(i,j,mw_platform7,MW_ABOVEPASSABLE); break; default: Error ("Illegal Maskedwall platform value at x=%d y=%d\n",i,j); break; } } else Error("You have what appears to be a platform ontop\n a wall at x=%d y=%d\n",i,j); } } } /* int GetAreaNumber ( int tilex, int tiley, int dir ); void RemoveDangerWalls ( void ) { int i; int j; word *map; word tile; map = mapplanes[ 1 ]; for( j = 0; j < mapheight; j++ ) { for( i = 0; i < mapwidth; i++ ) { tile = *map++; switch( tile ) { case 256: case 257: case 258: case 259: if ( MAPSPOT( i, j, 2 ) == 0 ) { MAPSPOT( i, j, 0 ) = ( word )( GetAreaNumber( i, j, ( tile - 256 ) << 1 ) + AREATILE ); MAPSPOT( i, j, 1 ) = 0; } break; case 300: case 318: case 336: case 354: if ( MAPSPOT( i, j, 2 ) == 0 ) { MAPSPOT( i, j, 0 ) = ( word )( GetAreaNumber( i, j, ( ( tile - 300 ) / 9 ) + AREATILE ) ); MAPSPOT( i, j, 1 ) = 0; } break; } } } } */ /* ================== = = SetupPushWalls = ================== */ void SetupPushWalls( void ) { int i,j; word *map,tile; int temp; map = mapplanes[1]; for(j=0;jtilex==tx) && (pwallobjlist[i]->tiley==ty)) return i; Error ("Could not find a push wall at x=%d y=%d\n",tx,ty); return -1; } /* ================== = = SetupPushWallLinks = ================== */ void SetupPushWallLinks( void ) { int i,j; word *map,tile; word touchx,touchy; map = mapplanes[1]; for(j=0;j> 8) & 0xff); touchy = (word) ((MAPSPOT(i,j,2) >> 0) & 0xff); if (touchindices[touchx][touchy]) { if (MAPSPOT(i,j+1,2)!=0) { //TODO: This code does nothing. } Link_To_Touchplate(touchx,touchy,ActivatePushWall,NULL,GetPushWallNumber(i,j),0); } else Error("tried to link a pushwall at x=%d y=%d to a non-existent touchplate\n",i,j); } } break; case 80: if (ActorIsPushWall(i,j)) { if (MAPSPOT(i,j,2)) { Error("You shouldn't be linking a nondirectional-push wall at x=%d y=%d\n",i,j); } } break; case 256: case 257: case 258: case 259: if (ActorIsPushWall(i,j)) { if (MAPSPOT(i,j,2)) { touchx = (word) ((MAPSPOT(i,j,2) >> 8) & 0xff); touchy = (word) ((MAPSPOT(i,j,2) >> 0) & 0xff); if (touchindices[touchx][touchy]) { if (MAPSPOT(i,j+1,2)!=0) { //TODO: This code does nothing. } Link_To_Touchplate(touchx,touchy,ActivateMoveWall,NULL,GetPushWallNumber(i,j),0); } else Error("tried to link a turbomovewall at x=%d y=%d to a non-existent touchplate\n",i,j); } } break; case 300: case 318: case 336: case 354: if (ActorIsPushWall(i,j)) { if (MAPSPOT(i,j,2)) { touchx = (word) ((MAPSPOT(i,j,2) >> 8) & 0xff); touchy = (word) ((MAPSPOT(i,j,2) >> 0) & 0xff); if (touchindices[touchx][touchy]) { if (MAPSPOT(i,j+1,2)!=0) { //TODO: This code does nothing. } Link_To_Touchplate(touchx,touchy,ActivateMoveWall,NULL,GetPushWallNumber(i,j),0); } else Error("tried to link a movewall at x=%d y=%d to a non-existent touchplate\n",i,j); } } break; } } } } /* ================= = = SetupElevators = ================= */ void SetupElevators (void) { int j, i,x,y,starti; word *map; word tile; elevator_t *elev; doorobj_t* dptr; map = mapplanes[1]; map += 4 ; for (j = 0; j < mapheight; j++) { if (j == 0) starti = 4; else starti = 0; for (i = starti; i < mapwidth; i++) {tile = *map++; if ((tile > 89) && (tile < 98)) {elev = &ELEVATOR[tile-90]; if (!elev->sx) {elev->sx = i; elev->sy = j; elev->doortoopen = -1; elev->doorclosing = -1; elev->nextaction = -1; _numelevators ++; } else {elev->dx = i; elev->dy = j; } } } } if (_numelevators && (!ELEVATOR[0].sx)) Error("Elevators must start at 1, dumb ass."); for(i=0;i<_numelevators;i++) {elev = &ELEVATOR[i]; x = elev->sx; y = elev->sy; for(j=0;jtilex == (x+1)) && (dptr->tiley == y)) || ((dptr->tilex == (x-1)) && (dptr->tiley == y)) || ((dptr->tilex == x) && (dptr->tiley == (y+1))) || ((dptr->tilex == x) && (dptr->tiley == (y-1)))) {elev->door1 = j; dptr->eindex = i; if ((dptr->tilex == (x+1)) && (dptr->tiley == y)) {elev->esx = x-1; elev->esy = y; } else if ((dptr->tilex == (x-1)) && (dptr->tiley == y)) {elev->esx = x+1; elev->esy = y; } else if ((dptr->tilex == x) && (dptr->tiley == (y+1))) {elev->esx = x; elev->esy = y-1; } else if ((dptr->tilex == x) && (dptr->tiley == (y-1))) {elev->esx = x; elev->esy = y+1; } break; } } x = elev->dx; y = elev->dy; for(j=0;jtilex == (x+1)) && (dptr->tiley == y)) || ((dptr->tilex == (x-1)) && (dptr->tiley == y)) || ((dptr->tilex == x) && (dptr->tiley == (y+1))) || ((dptr->tilex == x) && (dptr->tiley == (y-1)))) {elev->door2 = j; dptr->eindex = i; dptr->flags |= DF_ELEVLOCKED; if ((dptr->tilex == (x+1)) && (dptr->tiley == y)) {elev->edx = x-1; elev->edy = y; } else if ((dptr->tilex == (x-1)) && (dptr->tiley == y)) {elev->edx = x+1; elev->edy = y; } else if ((dptr->tilex == x) && (dptr->tiley == (y+1))) {elev->edx = x; elev->edy = y-1; } else if ((dptr->tilex == x) && (dptr->tiley == (y-1))) {elev->edx = x; elev->edy = y+1; } break; } } } } /* ================= = = SetupDoors = ================= */ void SetupDoors (void) { int j, i; word *map; word tile; byte locked; map = mapplanes[0]; for (j = 0; j < mapheight; j++) for (i = 0; i < mapwidth; i++) { tile = *map++; if ((tile >= 33) && (tile <= 35)) { tilemap[i][j] = doornum; locked=0; if (MAPSPOT (i, j, 2)) locked = 5; SpawnDoor (i, j, locked, (tile-33)+15); } else if ((tile > 89) && (tile < 94)) { tilemap[i][j] = doornum; locked = 0; if (MAPSPOT (i, j, 2)) locked = 5; SpawnDoor (i, j, locked, tile-90); } else if ((tile > 93) && (tile < 98)) { Error("locked door %d being used at %d,%d",tile,i,j); } else if ((tile > 97) && (tile < 105)) { tilemap[i][j] = doornum; locked = 0; if (MAPSPOT (i, j, 2)) locked = 5; SpawnDoor (i, j, locked, tile-90); } else if ((tile >= 154) && (tile <= 156)) { tilemap[i][j] = doornum; locked=0; if (MAPSPOT (i, j, 2)) locked = 5; SpawnDoor (i, j, locked, (tile-154)+18); } } } /* ================== = = GetDoorNumber = ================== */ int GetDoorNumber( int tx, int ty ) { int i; for (i=0;itilex==tx) && (doorobjlist[i]->tiley==ty)) return i; Error ("Could not find a door at x=%d y=%d\n",tx,ty); return -1; } /* ================= = = SetupDoorLinks = ================= */ void SetupDoorLinks (void) { int j, i, k; word *map; int clocklinked; int clockx,clocky; int doornumber; word touchx, touchy; map = mapplanes[0]; for (j = 0; j < mapheight; j++) for (i = 0; i < mapwidth; i++) { map++; if (MAPSPOT (i, j, 2)) { if (IsDoor(i,j)==1) { clocklinked = 0; doornumber=GetDoorNumber(i,j); for (k = 0; k < numclocks; k++) { clockx = Clocks[k].points_to_tilex; clocky = Clocks[k].points_to_tiley; if ((clockx == i) && (clocky == j)) { clocklinked = 1; ClockLink (LinkedOpenDoor, LinkedCloseDoor, doornumber, k); doorobjlist[doornumber]->lock = 5; doorobjlist[doornumber]->flags |= DF_TIMED; } } if (!clocklinked) { touchx = (word) ((MAPSPOT (i, j, 2) >> 8) & 0xff); touchy = (word) ((MAPSPOT (i, j, 2) >> 0) & 0xff); if (touchindices[touchx][touchy]) { if (MAPSPOT (i, j, 1) == 192) Link_To_Touchplate (touchx, touchy, LinkedCloseDoor, LinkedCloseDoor, doornumber, 0); else Link_To_Touchplate (touchx, touchy, LinkedOpenDoor, LinkedOpenDoor, doornumber, 0); } else Error ("tried to link a door at x=%d y=%d to a non-existent touchplate",i,j); } } } } } /* ================= = = FindTimeTile = ================= */ void FindTimeTile ( int * x, int * y ) { int xx,yy; xx=*x; yy=*y; if (!(tilemap[xx+1][yy]) && MAPSPOT(xx+1,yy,2)) { *x=xx+1; return; } if (!(tilemap[xx-1][yy]) && MAPSPOT(xx-1,yy,2)) { *x=xx-1; return; } if (!(tilemap[xx][yy+1]) && MAPSPOT(xx,yy+1,2)) { *y=yy+1; return; } if (!(tilemap[xx][yy-1]) && MAPSPOT(xx,yy-1,2)) { *y=yy-1; return; } Error ("Could not find an end time for a clock linked item\nat x=%d y=%d\n",*x,*y); } /* ================= = = SetupClocks = ================= */ void SetupClocks (void) { int i, j, minutes, seconds, starti; word *map, tile, mapx, mapy; int endtimex, endtimey; map = mapplanes[1]; map += 4 ; for (j = 0; j < mapheight; j++) { if (j == 0) starti = 4; else starti = 0; for (i = starti; i < mapwidth; i++) { tile = *map++; if (tile == 121) { mapx = (word) ((MAPSPOT (i, j, 2) >> 8) & 0xff); mapy = (word) ((MAPSPOT (i, j, 2) >> 0) & 0xff); minutes = (int) ((MAPSPOT (mapx, mapy, 2) >> 8) & 0xff); seconds = (int) ((MAPSPOT (mapx, mapy, 2) >> 0) & 0xff); if (seconds > 0x59) Error ("seconds of clock time must be below 0x5a (60 secs) "); seconds = 10 * (seconds/16) + (seconds % 16); minutes = 60 * (10*(minutes/16) + (minutes % 16)); // total seconds Clocks[numclocks].time1 = VBLCOUNTER*(seconds + minutes); endtimex=mapx; endtimey=mapy; FindTimeTile (&endtimex, &endtimey); minutes = (int) ((MAPSPOT (endtimex, endtimey, 2) >> 8) & 0xff); seconds = (int) ((MAPSPOT (endtimex, endtimey, 2) >> 0) & 0xff); if (seconds > 0x59) Error("seconds of clock time must be below 0x5a (60 secs)"); seconds = 10 * (seconds/16) + (seconds % 16); minutes = 60 * (10*(minutes/16) + (minutes % 16)); // total seconds Clocks[numclocks].time2 = VBLCOUNTER * (seconds + minutes); Clocks[numclocks].points_to_tilex = mapx; Clocks[numclocks].points_to_tiley = mapy; Clocks[numclocks].linkindex = lasttouch; numclocks ++; // clocks treated as virtual touchplates lasttouch ++; } } } } /* ================= = = LinkElevatorDiskGroups = ================= */ void LinkElevatorDiskGroups(void) { objtype *diskfinder1,*temp,*master; int maxplatformheight[30]={-1}; int num_distinct_max_heights=0; int i; boolean newdiskheight; #define M_ISELEVDISK(actor) \ ((actor->obclass == diskobj) && (actor->state == &s_elevdisk)) for(diskfinder1 = FIRSTACTOR;diskfinder1;diskfinder1 = diskfinder1->next) { if (!M_ISELEVDISK(diskfinder1)) continue; newdiskheight = true; for(i=0;itemp2) { newdiskheight = false; break; } } if (newdiskheight == true) maxplatformheight[num_distinct_max_heights++] = diskfinder1->temp2; } for(i=0;itemp2 = maxplatformheight[i]; for(temp = FIRSTACTOR;temp;temp = temp->next) { if (temp == master) continue; if (!M_ISELEVDISK(temp)) continue; if (temp->temp2 != maxplatformheight[i]) continue; temp->target = master; SetTilePosition(master,temp->tilex,temp->tiley); master->areanumber=AREANUMBER(master->tilex,master->tiley); } master->flags |= FL_ABP; MakeActive(master); } } /* ================= = = LinkActor = ================= */ void LinkActor (objtype *ob,int tilex,int tiley, void (*action)(intptr_t),void (*swapaction)(intptr_t) ) { word touchx,touchy; int clockx,clocky; int clocklinked,k; wall_t * tswitch; clocklinked = 0; for(k=0;k> 8) & 0xff); touchy = (word) ((MAPSPOT(tilex,tiley,2) >> 0) & 0xff); if ((MISCVARS->TOMLOC.x == touchx) && (MISCVARS->TOMLOC.y == touchy)) { objtype *tom = (objtype*)actorat[touchx][touchy]; tom->whatever = ob; } else if (touchindices[touchx][touchy]) { tswitch = (wall_t*) actorat[touchx][touchy]; if (tswitch && (ob->obclass == wallfireobj)) { tswitch->flags |= FL_REVERSIBLE; if (tswitch->flags & FL_ON) ob->flags |= FL_ACTIVE; } if (tswitch && (tswitch->flags & FL_ON)) Link_To_Touchplate(touchx,touchy,swapaction,action,(intptr_t)ob,0); else Link_To_Touchplate(touchx,touchy,action,swapaction,(intptr_t)ob,0); if (ob->obclass == gasgrateobj) { ob->temp1 = touchx; ob->temp2 = touchy; } } else Error("tried to link an object at x=%d y=%d to a non-existent touchplate supposedly at x=%d y=%d",tilex,tiley,touchx,touchy); } if (tilemap[tilex][tiley]) (MAPSPOT(tilex,tiley,2))=21; } /* ====================== = = SetupInanimateActors = ====================== */ void SetupInanimateActors (void) { int i,j,linked; word *map,tile; void (*action)(intptr_t),(*swapaction)(intptr_t); map = mapplanes[1]; // non-linked, harmless inanimate actors for(j=0;jflags |= FL_ACTIVE; if (tilemap[i][j]) MAPSPOT(i,j,2) = 21; } else LinkActor(new,i,j,action,swapaction); } else if (tilemap[i][j]) MAPSPOT(i,j,2) = 21; break; case 303: case 304: case 305: SpawnPushColumn(i,j,tile-303,east,linked); swapaction = NULL; if (linked) LinkActor(new,i,j,action,swapaction); break; case 321: case 322: case 323: SpawnPushColumn(i,j,tile-321,north,linked); swapaction = NULL; if (linked) LinkActor(new,i,j,action,swapaction); break; case 339: case 340: case 341: SpawnPushColumn(i,j,tile-339,west,linked); swapaction = NULL; if (linked) LinkActor(new,i,j,action,swapaction); break; case 357: case 358: case 359: SpawnPushColumn(i,j,tile-357,south,linked); swapaction = NULL; if (linked) LinkActor(new,i,j,action,swapaction); break; } } } //harmful actors if ((!BATTLEMODE) || (gamestate.BattleOptions.SpawnDangers)) { map = mapplanes[1]; for(j=0;jflags |= FL_ABP; MakeActive(new); swapaction = NULL; if (linked) LinkActor(new,i,j,action,swapaction); } break; case 301: case 302: SpawnBlade(i,j,east,tile-301,0); if (!linked) new->flags |= FL_ACTIVE; else LinkActor(new,i,j,action,swapaction); break; case 319: case 320: SpawnBlade(i,j,north,tile-319,0); if (!linked) new->flags |= FL_ACTIVE; else LinkActor(new,i,j,action,swapaction); break; case 337: case 338: SpawnBlade(i,j,west,tile-337,0); if (!linked) new->flags |= FL_ACTIVE; else LinkActor(new,i,j,action,swapaction); break; case 355: case 356: SpawnBlade(i,j,south,tile-355,0); if (!linked) new->flags |= FL_ACTIVE; else LinkActor(new,i,j,action,swapaction); break; case 372: SpawnFirejet(i,j,nodir,0); break; case 373: case 374: case 375: case 376: SpawnFirejet(i,j,tile-373,0); break; case 390: SpawnFirejet(i,j,nodir,1); break; case 391: case 392: case 393: case 394: SpawnFirejet(i,j,tile-391,1); break; case 278: case 279: case 280: case 281: SpawnBoulder(i,j,tile-278); if (!linked) new->flags |= FL_ACTIVE; else LinkActor(new,i,j,action,swapaction); break; } } } } LinkElevatorDiskGroups(); } /* =================== = = FixTiles = =================== */ void FixTiles(void) { word *map,tile; int i,j; map = mapplanes[1]; for(j=0;jstatnext) if (temp->flags & FL_LIGHTON) TurnOnLight(temp->tilex,temp->tiley); } /* ================= = = SetupLights = ================= */ void SetupLights(void) { int i,j,touchx,touchy; wall_t *tswitch; word *map,tile; int starti; // Initialize Lights in Area memset(LightsInArea,0,sizeof(LightsInArea)); map = mapplanes[1]; map+=5; for (j=0;jflags |= FL_LIGHTON; break; case 28: case 43: if (MAPSPOT(i,j,2)) { touchx = (word) ((MAPSPOT(i,j,2) >> 8) & 0xff); touchy = (word) ((MAPSPOT(i,j,2) >> 0) & 0xff); tswitch = (wall_t*) actorat[touchx][touchy]; if (tswitch && (tswitch->which == WALL)) {tswitch->flags |= FL_REVERSIBLE; if (!(tswitch->flags & FL_ON)) {sprites[i][j]->shapenum --; if (touchindices[touchx][touchy]) {Link_To_Touchplate(touchx,touchy,ActivateLight,DeactivateLight,(intptr_t)(sprites[i][j]),0); sprites[i][j]->linked_to = touchindices[touchx][touchy]-1; } else Error("tried to link a light at x=%d y=%d to a non-existent touchplate",i,j); } else {if (touchindices[touchx][touchy]) {Link_To_Touchplate(touchx,touchy,DeactivateLight,ActivateLight,(intptr_t)(sprites[i][j]),0); sprites[i][j]->linked_to = touchindices[touchx][touchy]-1; } else Error("tried to link a light at x=%d y=%d to a non-existent touchplate",i,j); sprites[i][j]->flags |= FL_LIGHTON; } } else {if (touchindices[touchx][touchy]) {Link_To_Touchplate(touchx,touchy,DeactivateLight,ActivateLight,(intptr_t)(sprites[i][j]),0); sprites[i][j]->linked_to = touchindices[touchx][touchy]-1; } else Error("tried to link a light at x=%d y=%d to a non-existent touchplate",i,j); sprites[i][j]->flags |= FL_LIGHTON; } } else sprites[i][j]->flags |= FL_LIGHTON; break; } } } } /* ================== = = PrintMapStats = ================== */ void PrintMapStats (void) { int size; int total; if (MAPSTATS==false) return; OpenMapDebug(); total=0; MapDebug("MAP STATS Map Number %d\n",gamestate.mapon); MapDebug("=======================\n"); size=pwallnum*sizeof(pwallobj_t); total+=size; MapDebug("Number of PushWalls : %4d size = %6d\n",pwallnum,size); size=maskednum*sizeof(maskedwallobj_t); total+=size; MapDebug("Number of MaskedWalls : %4d size = %6d\n",maskednum,size); size=doornum*sizeof(doorobj_t); total+=size; MapDebug("Number of Doors : %4d size = %6d\n",doornum,size); size=lasttouch*sizeof(touchplatetype); total+=size; MapDebug("Number of TouchPlates : %4d size = %6d\n",lasttouch,size); size=_numelevators*sizeof(elevator_t); total+=size; MapDebug("Number of Elevators : %4d size = %6d\n",_numelevators,size); size=statcount*sizeof(statobj_t); total+=size; MapDebug("Number of Sprites : %4d size = %6d\n",statcount,size); size=objcount*sizeof(objtype); total+=size; MapDebug("Number of Actors : %4d size = %6d\n",objcount,size); MapDebug("Number of Clocks : %4d\n",numclocks); MapDebug("\nTotal size of level : %6d\n",total); } boolean IsWeapon(int tile) { if ((tile >= 46) && (tile <= 56)) return true; return false; } char *WeaponName(int tile) { switch(tile) { case 46: return "Bat "; break; case 47: return "Knife "; break; case 48: return "Double Pistol "; break; case 49: return "MP40 "; break; case 50: return "Bazooka "; break; case 51: return "Firebomb "; break; case 52: return "Heatseeker "; break; case 53: return "Drunk Missile "; break; case 54: return "Flamewall "; break; case 55: return "Split Missile "; break; case 56: return "KES "; break; } return " "; } int GetLumpForTile(int tile) { int wallstart; int exitstart; wallstart=W_GetNumForName("WALLSTRT"); exitstart=W_GetNumForName("EXITSTRT"); elevatorstart = W_GetNumForName("ELEVSTRT"); if ((tile >= 1) && (tile <= 32)) { return (tile + wallstart); } else if ((tile >= 36) && (tile <= 45)) { return (tile + wallstart - 3); } else if (tile == 46) { return (wallstart + 74); } else if ((tile >= 47) && (tile <= 48)) { return (tile + exitstart - 46); } else if ((tile >= 49) && (tile <= 71)) { return (tile + wallstart - 8); } else if ((tile >= 72) && (tile <= 79)) { return (tile - 72 + elevatorstart + 1); } else if ((tile >= 80) && (tile <= 89)) { return (tile + wallstart - 16); } return -1; } /* ================== = = PrintTileStats = ================== */ void PrintTileStats (void) { int i,j; word *map; int easytotal; int hardtotal; int tally[1000]; if (TILESTATS==false) return; OpenMapDebug(); MapDebug("TILE STATS Map Number %d\n",gamestate.mapon); MapDebug("=======================\n\n"); // Weapons memset(tally,0,sizeof(tally)); MapDebug("=======================\n"); MapDebug("= WEAPONS\n"); MapDebug("=======================\n"); map = mapplanes[1]; for (j=0;j0) tally[(*map)]++; map++; } } // Low Guards easytotal=0; hardtotal=0; for (i=108;i<=119;i++) easytotal+=tally[i]; for (i=126;i<=137;i++) hardtotal+=tally[i]; MapDebug("\nLowGuards\n"); MapDebug("-----------------------\n"); MapDebug("EasyTotal=%4d\n",easytotal); MapDebug("HardTotal=%4d\n",hardtotal); MapDebug(" Total=%4d\n",easytotal+hardtotal); // Sneaky Low Guards easytotal=0; hardtotal=0; for (i=120;i<=120;i++) easytotal+=tally[i]; for (i=138;i<=138;i++) hardtotal+=tally[i]; MapDebug("\nSneakyLowGuards\n"); MapDebug("-----------------------\n"); MapDebug("EasyTotal=%4d\n",easytotal); MapDebug("HardTotal=%4d\n",hardtotal); MapDebug(" Total=%4d\n",easytotal+hardtotal); // High Guards easytotal=0; hardtotal=0; for (i=144;i<=155;i++) easytotal+=tally[i]; for (i=162;i<=173;i++) hardtotal+=tally[i]; MapDebug("\nHighGuards\n"); MapDebug("-----------------------\n"); MapDebug("EasyTotal=%4d\n",easytotal); MapDebug("HardTotal=%4d\n",hardtotal); MapDebug(" Total=%4d\n",easytotal+hardtotal); // OverPatrol Guards easytotal=0; hardtotal=0; for (i=216;i<=227;i++) easytotal+=tally[i]; for (i=234;i<=245;i++) hardtotal+=tally[i]; MapDebug("\nOverPatrolGuards\n"); MapDebug("-----------------------\n"); MapDebug("EasyTotal=%4d\n",easytotal); MapDebug("HardTotal=%4d\n",hardtotal); MapDebug(" Total=%4d\n",easytotal+hardtotal); // Strike Guards easytotal=0; hardtotal=0; for (i=180;i<=191;i++) easytotal+=tally[i]; for (i=198;i<=204;i++) hardtotal+=tally[i]; MapDebug("\nStrikeGuards\n"); MapDebug("-----------------------\n"); MapDebug("EasyTotal=%4d\n",easytotal); MapDebug("HardTotal=%4d\n",hardtotal); MapDebug(" Total=%4d\n",easytotal+hardtotal); // TriadEnforcer Guards easytotal=0; hardtotal=0; for (i=288;i<=299;i++) easytotal+=tally[i]; for (i=306;i<=317;i++) hardtotal+=tally[i]; MapDebug("\nTriadEnforcer Guards\n"); MapDebug("-----------------------\n"); MapDebug("EasyTotal=%4d\n",easytotal); MapDebug("HardTotal=%4d\n",hardtotal); MapDebug(" Total=%4d\n",easytotal+hardtotal); // Lightning Guards easytotal=0; hardtotal=0; for (i=324;i<=335;i++) easytotal+=tally[i]; for (i=342;i<=353;i++) hardtotal+=tally[i]; MapDebug("\nLightningGuards\n"); MapDebug("-----------------------\n"); MapDebug("EasyTotal=%4d\n",easytotal); MapDebug("HardTotal=%4d\n",hardtotal); MapDebug(" Total=%4d\n",easytotal+hardtotal); // Random Actors easytotal=0; hardtotal=0; for (i=122;i<=125;i++) easytotal+=tally[i]; MapDebug("\nRandom Actors\n"); MapDebug("-----------------------\n"); MapDebug(" Total=%4d\n",easytotal); // Monks easytotal=0; hardtotal=0; for (i=360;i<=371;i++) easytotal+=tally[i]; for (i=378;i<=389;i++) hardtotal+=tally[i]; MapDebug("\nMonks\n"); MapDebug("-----------------------\n"); MapDebug("EasyTotal=%4d\n",easytotal); MapDebug("HardTotal=%4d\n",hardtotal); MapDebug(" Total=%4d\n",easytotal+hardtotal); // Fire Monks easytotal=0; hardtotal=0; for (i=396;i<=407;i++) easytotal+=tally[i]; for (i=414;i<=425;i++) hardtotal+=tally[i]; MapDebug("\nFire Monks\n"); MapDebug("-----------------------\n"); MapDebug("EasyTotal=%4d\n",easytotal); MapDebug("HardTotal=%4d\n",hardtotal); MapDebug(" Total=%4d\n",easytotal+hardtotal); // Robo Guards easytotal=0; hardtotal=0; for (i=158;i<=161;i++) easytotal+=tally[i]; for (i=176;i<=179;i++) hardtotal+=tally[i]; MapDebug("\nRoboGuards\n"); MapDebug("-----------------------\n"); MapDebug("EasyTotal=%4d\n",easytotal); MapDebug("HardTotal=%4d\n",hardtotal); MapDebug(" Total=%4d\n",easytotal+hardtotal); // Ballistikrafts easytotal=0; hardtotal=0; for (i=408;i<=411;i++) easytotal+=tally[i]; for (i=426;i<=429;i++) hardtotal+=tally[i]; MapDebug("\nBallistikrafts\n"); MapDebug("-----------------------\n"); MapDebug("EasyTotal=%4d\n",easytotal); MapDebug("HardTotal=%4d\n",hardtotal); MapDebug(" Total=%4d\n",easytotal+hardtotal); // Boulders easytotal=0; hardtotal=0; for (i=278;i<=281;i++) easytotal+=tally[i]; for (i=395;i<=395;i++) hardtotal+=tally[i]; MapDebug("\nBoulders\n"); MapDebug("-----------------------\n"); MapDebug("Boulders=%4d\n",easytotal); MapDebug("BoulderHoles=%4d\n",hardtotal); // PushColumns easytotal=0; hardtotal=0; for (i=285;i<=287;i++) easytotal+=tally[i]; for (i=303;i<=305;i++) easytotal+=tally[i]; for (i=321;i<=323;i++) easytotal+=tally[i]; for (i=339;i<=341;i++) easytotal+=tally[i]; for (i=357;i<=359;i++) easytotal+=tally[i]; MapDebug("\nPushColumns\n"); MapDebug("-----------------------\n"); MapDebug(" Total=%4d\n",easytotal); // Gun Emplacements easytotal=0; hardtotal=0; for (i=194;i<=197;i++) easytotal+=tally[i]; for (i=212;i<=215;i++) hardtotal+=tally[i]; MapDebug("\nGun Emplacements\n"); MapDebug("-----------------------\n"); MapDebug("EasyTotal=%4d\n",easytotal); MapDebug("HardTotal=%4d\n",hardtotal); MapDebug(" Total=%4d\n",easytotal+hardtotal); // 4-way guns easytotal=0; hardtotal=0; for (i=89;i<=89;i++) easytotal+=tally[i]; for (i=211;i<=211;i++) hardtotal+=tally[i]; MapDebug("\n4-way guns\n"); MapDebug("-----------------------\n"); MapDebug("EasyTotal=%4d\n",easytotal); MapDebug("HardTotal=%4d\n",hardtotal); MapDebug(" Total=%4d\n",easytotal+hardtotal); // Stabbers from above MapDebug("\nStabbers from above\n"); MapDebug("-----------------------\n"); MapDebug(" Total=%4d\n",tally[412]); // Stabbers from below MapDebug("\nStabbers from below\n"); MapDebug("-----------------------\n"); MapDebug(" Total=%4d\n",tally[430]); // Crushing pillar from above MapDebug("\nCrushing pillar from above\n"); MapDebug("-----------------------\n"); MapDebug(" Total=%4d\n",tally[413]); // Crushing pillar from below MapDebug("\nCrushing pillar from below\n"); MapDebug("-----------------------\n"); MapDebug(" Total=%4d\n",tally[431]); // Above Spinner MapDebug("\nAbove Spinner\n"); MapDebug("-----------------------\n"); MapDebug(" Total=%4d\n",tally[156]); // Ground Spinner MapDebug("\nGround Spinner\n"); MapDebug("-----------------------\n"); MapDebug(" Total=%4d\n",tally[174]); // Spinner from above MapDebug("\nSpinner from above\n"); MapDebug("-----------------------\n"); MapDebug(" Total=%4d\n",tally[157]); // Spinner from below MapDebug("\nSpinner from below\n"); MapDebug("-----------------------\n"); MapDebug(" Total=%4d\n",tally[175]); // Bosses easytotal=0; for (i=99;i<=103;i++) easytotal+=tally[i]; MapDebug("\nBosses\n"); MapDebug("-----------------------\n"); MapDebug(" Total=%4d\n",easytotal); // Spring Boards MapDebug("\nSpring Boards\n"); MapDebug("-----------------------\n"); MapDebug(" Total=%4d\n",tally[193]); // Above FlameJets easytotal=0; hardtotal=0; for (i=372;i<=376;i++) easytotal+=tally[i]; for (i=390;i<=394;i++) hardtotal+=tally[i]; MapDebug("\nFlameJets\n"); MapDebug("-----------------------\n"); MapDebug(" Above=%4d\n",easytotal); MapDebug(" Ground=%4d\n",hardtotal); // Fire Chutes easytotal=0; for (i=140;i<=143;i++) easytotal+=tally[i]; MapDebug("\nFireChutes\n"); MapDebug("-----------------------\n"); MapDebug(" Total=%4d\n",easytotal); // Sprites MapDebug("=======================\n"); MapDebug("= SPRITES\n"); MapDebug("=======================\n"); MapDebug("Sprite # Frequency\n"); MapDebug("-----------------------\n"); for (i=1;i<=72;i++) if (tally[i]!=0) MapDebug(" %4d %4d\n",i,tally[i]); for (i=210;i<=210;i++) if (tally[i]!=0) MapDebug(" %4d %4d\n",i,tally[i]); for (i=228;i<=233;i++) if (tally[i]!=0) MapDebug(" %4d %4d\n",i,tally[i]); for (i=246;i<=255;i++) if (tally[i]!=0) MapDebug(" %4d %4d\n",i,tally[i]); for (i=260;i<=273;i++) if (tally[i]!=0) MapDebug(" %4d %4d\n",i,tally[i]); for (i=282;i<=284;i++) if (tally[i]!=0) MapDebug(" %4d %4d\n",i,tally[i]); } //*************************************************************************** // // GetSongForLevel - returns song to play for current level // //*************************************************************************** int GetSongForLevel ( void ) { int i; int num; for (i=0;i>8) == 0xba ) return (num&0xff); } // Error("GetSongForLevel: could not find song in level %ld\n",gamestate.mapon); // return -1; return 0; } /* ================== = = DoSharewareConversionBackgroundPlane = ================== */ void DoSharewareConversionBackgroundPlane (void) { int i,j; word * map; for (j=0;j=90) && (crud<=97)) { levelheight=crud-89; maxheight = (levelheight << 6)-32; nominalheight = maxheight-32; } else if ((crud>=450) && (crud<=457)) { levelheight=crud-450+9; maxheight = (levelheight << 6)-32; nominalheight = maxheight-32; } else Error("You must specify a valid height sprite icon at (2,0) on map %d\n",gamestate.mapon); /* if ( ( BATTLEMODE ) && ( !gamestate.BattleOptions.SpawnDangers ) ) { RemoveDangerWalls(); } */ // pheight=maxheight-32; CountAreaTiles(); SetupWalls(); SetupClocks(); SetupAnimatedWalls(); if (loadedgame==false) { SetupSwitches(); SetupStatics (); SetupMaskedWalls(); SetupDoors(); SetupPushWalls(); SetupPlayers(); if (!BATTLEMODE) { SetupActors(); SetupRandomActors(); } SetupElevators(); SetupDoorLinks(); SetupPushWallLinks(); FixDoorAreaNumbers(); FixMaskedWallAreaNumbers(); SetupWindows(); SetupLights(); SetupInanimateActors(); } else { FixTiles(); } if (gamestate.SpawnEluder || gamestate.SpawnDeluder) { //MED for (i=0;i<25;i++) RespawnEluder(); } if ( ( BATTLEMODE ) && ( MapSpecials & MAP_SPECIAL_TOGGLE_PUSHWALLS ) ) { ActivateAllPushWalls(); } Illuminate(); if (SNAKELEVEL == 1) SetupSnakePath(); LoftSprites(); SetPlaneViewSize(); if (loadedgame==false) { ConnectAreas(); PreCache(); SetupPlayScreen(); SetupScreen(false); } if (BATTLEMODE) { SetModemLightLevel ( gamestate.BattleOptions.LightLevel ); } if (player != NULL) { for (i=0;i<100;i++) { UpdateLightLevel(player->areanumber); } } insetupgame=false; tedlevel = false; // turn it off once we have done any ted stuff EnableScreenStretch(); } void InitializePlayerstates(void) {int i; playertype * pstate; if (NewGame || (gamestate.mapon == 0) || tedlevel) {for(i=0;imissileweapon == wp_godhand) #if (SHAREWARE == 0) || (pstate->missileweapon == wp_dog) #endif ) { pstate->weapon=pstate->new_weapon=pstate->oldweapon; pstate->missileweapon = pstate->oldmissileweapon; } ResetPlayerstate(pstate); } NewGame = false; } void SetupSnakePath(void) { #if (SHAREWARE == 0) int i,j; word *map,tile; map = mapplanes[1]; for(j=0;j= 72) && (tile <= 79) && (!tilemap[i][j])) {SNAKEPATH[whichpath].x = i; SNAKEPATH[whichpath].y = j; whichpath ++; } } #endif } void SetupRandomActors(void) {int i,j; word *map,tile; int starti,totalrandom=0,count=0,ambush,locindex,orig; byte actorpresent[10]={0},index=0,randomtype,used[100]={0}; _2Dpoint randloc[100]; map = mapplanes[1]; map+=5; for(i=0;i<10;i++) {if (RANDOMACTORTYPE[i]) actorpresent[index++]=i; } if (!index) return; for (j=0;j= 122) && (tile <= 125)) {randloc[totalrandom].x = i; randloc[totalrandom].y = j; totalrandom++; if (totalrandom >= 100) Error("Max random actors (100) exceeded"); } } } orig = totalrandom; switch(gamestate.difficulty) { case gd_baby: totalrandom = 7*totalrandom/10; break; case gd_easy: totalrandom = 8*totalrandom/10; break; case gd_medium: totalrandom = 9*totalrandom/10; break; } while(countTOMLOC.x = i; MISCVARS->TOMLOC.y = j; break; case 102: SpawnMultiSpriteActor(b_robobossobj,i,j,tile-102); break; case 103: SpawnSnake(i,j); break; case 426: case 427: case 428: case 429: if (gamestate.difficulty < gd_hard) break; tile -= 18; case 408: case 409: case 410: case 411: SpawnPatrol(wallopobj,i,j,tile-408); break; } } } } void SetupStatics(void) { int i,j,spawnz; word *map,tile; int starti; map = mapplanes[1]; map+=5; BATTLE_NumCollectorItems = 0; for (j=0;jplayer == 1) || (locplayerstate->player == 3)) PreCacheGroup(W_GetNumForName("RFPIST1"), W_GetNumForName("LFPIST3"), cache_patch_t); else if (locplayerstate->player == 2) PreCacheGroup(W_GetNumForName("RBMPIST1"), W_GetNumForName("LBMPIST3"), cache_patch_t); else PreCacheGroup(W_GetNumForName("RMPIST1"), W_GetNumForName("LMPIST3"), cache_patch_t); SpawnStatic(i,j,tile-23,spawnz); break; case 49: SD_PreCacheSound(SD_ATKMP40SND); PreCacheGroup(W_GetNumForName("MP401"), W_GetNumForName("MP403"), cache_patch_t); SpawnStatic(i,j,tile-23,spawnz); break; case 50: SD_PreCacheSound(SD_MISSILEHITSND); SD_PreCacheSound(SD_MISSILEFLYSND); SD_PreCacheSound(SD_BAZOOKAFIRESND); PreCacheGroup(W_GetNumForName("BAZOOKA1"), W_GetNumForName("BAZOOKA4"), cache_patch_t); SpawnStatic(i,j,tile-23,spawnz); if (loadedgame == false) gamestate.missiletotal ++; break; case 51: SD_PreCacheSound(SD_MISSILEHITSND); SD_PreCacheSound(SD_MISSILEFLYSND); SD_PreCacheSound(SD_FIREBOMBFIRESND); PreCacheGroup(W_GetNumForName("FBOMB1"), W_GetNumForName("FBOMB4"), cache_patch_t); SpawnStatic(i,j,tile-23,spawnz); if (loadedgame == false) gamestate.missiletotal ++; break; case 52: SD_PreCacheSound(SD_MISSILEHITSND); SD_PreCacheSound(SD_MISSILEFLYSND); SD_PreCacheSound(SD_HEATSEEKFIRESND); PreCacheGroup(W_GetNumForName("HSEEK1"), W_GetNumForName("HSEEK4"), cache_patch_t); SpawnStatic(i,j,tile-23,spawnz); if (loadedgame == false) gamestate.missiletotal ++; break; case 53: SD_PreCacheSound(SD_MISSILEHITSND); SD_PreCacheSound(SD_MISSILEFLYSND); SD_PreCacheSound(SD_DRUNKFIRESND); PreCacheGroup(W_GetNumForName("DRUNK1"), W_GetNumForName("DRUNK4"), cache_patch_t); SpawnStatic(i,j,tile-23,spawnz); if (loadedgame == false) gamestate.missiletotal ++; break; case 54: SD_PreCacheSound(SD_MISSILEHITSND); SD_PreCacheSound(SD_MISSILEFLYSND); SD_PreCacheSound(SD_FLAMEWALLFIRESND); SD_PreCacheSound(SD_FLAMEWALLSND); PreCacheGroup(W_GetNumForName("FIREW1"), W_GetNumForName("FIREW3"), cache_patch_t); PreCacheGroup(W_GetNumForName("FWALL1"), W_GetNumForName("FWALL15"), cache_patch_t); PreCacheGroup(W_GetNumForName("SKEL1"), W_GetNumForName("SKEL48"), cache_patch_t); SpawnStatic(i,j,tile-23,spawnz); if (loadedgame == false) gamestate.missiletotal ++; break; case 55: #if (SHAREWARE == 1) Error("\n tried to spawn split missile at %d,%d in shareware !",i,j); #endif SD_PreCacheSound(SD_MISSILEHITSND); SD_PreCacheSound(SD_MISSILEFLYSND); SD_PreCacheSound(SD_SPLITFIRESND); SD_PreCacheSound(SD_SPLITSND); PreCacheGroup(W_GetNumForName("SPLIT1"), W_GetNumForName("SPLIT4"), cache_patch_t); SpawnStatic(i,j,tile-23,spawnz); if (loadedgame == false) gamestate.missiletotal ++; break; case 56: #if (SHAREWARE == 1) Error("\n tried to spawn kes at %d,%d in shareware !",i,j); #endif SD_PreCacheSound(SD_GRAVSND); SD_PreCacheSound(SD_GRAVHITSND); SD_PreCacheSound(SD_GRAVFIRESND); SD_PreCacheSound(SD_GRAVBUILDSND); PreCacheGroup(W_GetNumForName("KES1"), W_GetNumForName("KES6"), cache_patch_t); PreCacheGroup(W_GetNumForName("KSPHERE1"), W_GetNumForName("KSPHERE4"), cache_patch_t); SpawnStatic(i,j,tile-23,spawnz); if (loadedgame == false) gamestate.missiletotal ++; break; case 57: case 58: case 59: case 60: case 61: case 62: case 65: case 66: case 67: SpawnStatic(i,j,tile-23,spawnz); break; case 68: case 69: case 70: case 71: SpawnStatic(i,j,tile-23,spawnz); break; case 98: SpawnStatic(i,j,tile-98+49,spawnz); break; case 210: SpawnStatic(i,j,stat_scotthead,spawnz); break; case 228: case 229: case 230: case 231: case 232: case 233: SpawnStatic(i,j,tile-228+51,spawnz); break; case 246: case 247: case 248: case 249: case 250: case 251: SpawnStatic(i,j,tile-246+57,spawnz); break; case 264: case 265: SpawnStatic(i,j,tile-264+63,spawnz); gamestate.planttotal ++; break; case 266: SpawnStatic(i,j,stat_urn,spawnz); break; case 268: SpawnStatic(i,j,tile-265+63,spawnz); break; case 269: SpawnStatic(i,j,tile-265+63,spawnz); break; case 267: SpawnStatic(i,j,stat_emptystatue,spawnz); break; case 282: SpawnStatic(i,j,stat_heatgrate,spawnz); break; case 283: SpawnStatic(i,j,stat_standardpole,spawnz); break; case 284: if ( !BATTLEMODE ) { SpawnStatic(i,j,stat_pit,spawnz); } break; case 252: SD_PreCacheSound(SD_GRAVSND); SD_PreCacheSound(SD_GRAVHITSND); SD_PreCacheSoundGroup(SD_GODMODEFIRESND,SD_LOSEMODESND); if ((locplayerstate->player == 1) || (locplayerstate->player ==3)) SD_PreCacheSound(SD_GODWOMANSND); else SD_PreCacheSound(SD_GODMANSND); PreCacheGroup(W_GetNumForName("GODHAND1"), W_GetNumForName("GODHAND8"), cache_patch_t); PreCacheGroup(W_GetNumForName("VAPO1"), W_GetNumForName("LITSOUL"), cache_patch_t); PreCacheGroup(W_GetNumForName("GODFIRE1"), W_GetNumForName("GODFIRE4"), cache_patch_t); SpawnStatic(i,j,stat_godmode,spawnz); if (loadedgame == false) gamestate.supertotal ++; break; case 253: #if (SHAREWARE == 1) Error("DogMode Power up in shareware at x=%d y=%d\n",i,j); #endif SD_PreCacheSoundGroup(SD_DOGMODEPANTSND,SD_DOGMODELICKSND); if ((locplayerstate->player == 1) || (locplayerstate->player ==3)) SD_PreCacheSound(SD_DOGWOMANSND); else SD_PreCacheSound(SD_DOGMANSND); PreCacheGroup(W_GetNumForName("DOGNOSE1"), W_GetNumForName("DOGPAW4"), cache_patch_t); SpawnStatic(i,j,stat_dogmode,spawnz); if (loadedgame == false) gamestate.supertotal ++; break; case 254: SpawnStatic(i,j,stat_fleetfeet,spawnz); if (loadedgame == false) gamestate.supertotal ++; break; case 255: SpawnStatic(i,j,stat_random,spawnz); if (loadedgame == false) gamestate.supertotal ++; break; case 260: SpawnStatic(i,j,stat_elastic,spawnz); if (loadedgame == false) gamestate.supertotal ++; break; case 261: SpawnStatic(i,j,stat_mushroom,spawnz); if (loadedgame == false) { gamestate.supertotal ++; gamestate.democratictotal ++; } break; case 262: SpawnStatic(i,j,stat_tomlarva,spawnz); break; case 263: if (gamestate.SpawnCollectItems) { SpawnStatic(i,j,stat_collector,spawnz); LASTSTAT->flags |= FL_COLORED; LASTSTAT->hitpoints = ( GameRandomNumber("colors",0) % MAXPLAYERCOLORS ); BATTLE_NumCollectorItems++; } break; case 270: SpawnStatic(i,j,stat_bulletproof,spawnz); if (loadedgame == false) gamestate.supertotal ++; break; case 271: SpawnStatic(i,j,stat_asbesto,spawnz); if (loadedgame == false) gamestate.supertotal ++; break; case 272: SpawnStatic(i,j,stat_gasmask,spawnz); if (loadedgame == false) gamestate.supertotal ++; break; case 461: SpawnStatic(i,j,stat_disk,spawnz); break; } } } } void RaiseSprites( int x, int y, int count, int dir ) { int a,c; int dx,dy; int h; int i; int xx; int hc; int d; dx=0; dy=0; if (dir==1) dx=1; else dy=1; if (((statobj_t *)sprites[x][y])->z==-65) { c=(maxheight+20)<<8; hc=(count+1)<<7; a=(c<<8)/(hc*hc); for (i=0;i>8; ((statobj_t *)sprites[x+(dx*i)][y+(dy*i)])->z=maxheight-h; } } else { if (ActorIsSpring(x-(dx),y-(dy))) d=1; else if (ActorIsSpring(x+(dx*count),y+(dy*count))) d=0; else Error("Cannot find a spring board around a ramp ascension near x=%d y=%d\n",x,y); hc=((maxheight+20)<<16)/(count+1); h=hc<<1; for (i=0;iz=maxheight-(h>>16); else ((statobj_t *)sprites[x+(dx*(count-i-1))][y+(dy*(count-i-1))])->z=maxheight-(h>>16); h+=hc; } } } void LoftSprites( void ) { int x,y; int count; for(y=1;y=4) && (MAPSPOT((x),(y),2)<=9))) #define EXITTILE (107) #define SECRETEXITTILE (106) #define FL_SWITCH 0x01 #define FL_ON 0x02 #define FL_REVERSIBLE 0x04 #define FL_W_DAMAGE 0x08 #define FL_W_INVERTED 0x10 #define FL_S_FLIPPED 0x20 #define MAXTEAMS 11 typedef struct { int nummembers; int uniformcolor; int tilex,tiley; byte dir; } teamtype; extern teamtype TEAM[MAXPLAYERS]; typedef struct { thingtype which; byte flags; byte hitpoints; word tile; byte tilex,tiley; } wall_t; typedef struct { int number; char mapname[23]; } mapinfo_t; typedef struct { int nummaps; mapinfo_t maps[100]; } mapfileinfo_t; #define MAXLEVELNAMELENGTH 23 #define ALLOCATEDLEVELNAMELENGTH 24 #define NUMPLANES 3 #define NUMHEADEROFFSETS 100 #define MAP_SPECIAL_TOGGLE_PUSHWALLS 0x0001 typedef struct { unsigned used; unsigned CRC; unsigned RLEWtag; unsigned MapSpecials; unsigned planestart[ NUMPLANES ]; unsigned planelength[ NUMPLANES ]; char Name[ ALLOCATEDLEVELNAMELENGTH ]; } RTLMAP; typedef struct {int x,y,dir; }_2dvec; extern _2dvec SPAWNLOC[MAXSPAWNLOCATIONS],FIRST,SECOND; typedef struct {int time1; int time2; byte points_to_tilex; byte points_to_tiley; int linkindex; }str_clock; extern int numareatiles[NUMAREAS+1]; extern int shapestart,shapestop; extern int NUMSPAWNLOCATIONS; extern int mapwidth; extern int mapheight; extern wall_t walls[MAXWALLTILES]; extern str_clock Clocks[MAXCLOCKS]; extern int LightsInArea[NUMAREAS+1]; extern int numclocks; extern word ELEVATORLOCATION; extern unsigned short int *mapplanes[3]; extern int gunsstart; extern int elevatorstart; extern int spritestop; extern int fog; extern int lightsource; extern int SNAKELEVEL; extern boolean insetupgame; extern char LevelName[80]; extern boolean ISRTL; void PreCacheGroup(int,int,int); // added type void AssignTeams(void); void LoadTedMap( const char *extension, int mapnum ); void SetupGameLevel(void); void ScanInfoPlane(void); void PreCacheLump( int lump, int level, int type ); // added type void SetupGameLevelAgain (void); void ScanInfoPlaneAgain (void); void PreCacheActor( int actor, int which ); void PreCache( void ); void SetupWalls( void ); void SetupAnimatedWalls( void ); void SetupSwitches( void ); void SetupPlayers( void ); void SetupMaskedWalls( void ); void SetupPushWalls( void ); void SetupPushWallLinks( void ); void SetupDoors (void); void SetupDoorLinks (void); void SetupClocks (void); void SetupLinkedActors (void); void SetupLights(void); void SetupWindows ( void ); int GetWallIndex( int texture ); void PrintMapStats (void); void PrintTileStats (void); void GetMapInfo (mapfileinfo_t * mapinfo); void GetMapFileName ( char * filename ); void SetBattleMapFileName ( char * filename ); word GetMapCRC ( int num ); int GetNextMap ( int tilex, int tiley ); void Illuminate(); int GetSongForLevel ( void ); void CheckHolidays(void); boolean IsChristmas(void); #endif rott-20230810/rott/rt_util.c000066400000000000000000000622331446517470200156010ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "SDL.h" #include #include #include #include #include #include #include #include #include #include "watcom.h" #include "_rt_util.h" #include "rt_util.h" #include "isr.h" #include "z_zone.h" #include "rt_dr_a.h" #include "rt_in.h" #include "rt_main.h" #include "scriplib.h" #include "rt_menu.h" #include "rt_playr.h" #include "version.h" #include "develop.h" #include "rt_vid.h" #include "rt_view.h" #include "modexlib.h" #include "rt_cfg.h" int egacolor[16]; byte * origpal; FILE * errout; FILE * debugout; FILE * mapdebugout; static boolean SoftErrorStarted=false; static boolean DebugStarted=false; static boolean MapDebugStarted=false; extern SDL_Surface *VL_GetVideoSurface (void); static unsigned char egargb[48]={ 0x00,0x00,0x00, 0x00,0x00,0xab, 0x00,0xab,0x00, 0x00,0xab,0xab, 0xab,0x00,0x00, 0xab,0x00,0xab, 0xab,0x57,0x00, 0xab,0xab,0xab, 0x57,0x57,0x57, 0x57,0x57,0xff, 0x57,0xff,0x57, 0x57,0xff,0xff, 0xff,0x57,0x57, 0xff,0x57,0xff, 0xff,0xff,0x57, 0xff,0xff,0xff}; extern const byte * ROTT_ERR; #define SWAP(a,b) \ { \ a=(a)^(b); \ b=(a)^(b); \ a=(a)^(b); \ } \ //****************************************************************************** // // FindDistance // //****************************************************************************** int FindDistance(int ix, int iy) { int t; ix= abs(ix); /* absolute values */ iy= abs(iy); if (ix>1); return (ix - (ix>>5) - (ix>>7) + (t>>2) + (t>>6)); } //****************************************************************************** // // Find_3D_Distance // //****************************************************************************** int Find_3D_Distance(int ix, int iy, int iz) { int t; ix= abs(ix); /* absolute values */ iy= abs(iy); iz= abs(iz); if (ix>4) + (t>>2) + (t>>3)); } //****************************************************************************** // // atan2_appx // //****************************************************************************** int atan2_appx(int dx, int dy) {int absdx, absdy; fixed angle; fixed ratio; if (!(dx||dy)) return 0; absdx = abs(dx); absdy = abs(dy); if (absdx >= absdy) ratio = FixedDiv2(absdy,absdx); else ratio = FixedDiv2(absdx,absdy); if (dx >= 0) {if (dy >= 0) {if (absdx >= absdy) angle = ratio; // 1st octant else angle = (2<<16) - ratio; // 2nd octant } else {if (absdx >= absdy) angle = (8<<16) - ratio; // 8th octant else angle = (6<<16) + ratio; // 7th octant } } else {if (dy >= 0) {if (absdx >= absdy) angle = (4<<16) - ratio; // 4th octant else angle = (2<<16) + ratio; // 3rd octant } else {if (absdx >= absdy) angle = (4<<16) + ratio; // 5th octant else angle = (6<<16) - ratio; // 6th octant } } return (((int)FixedMul(angle,ANGLESDIV8))&(FINEANGLES-1)); } //****************************************************************************** // // StringsNotEqual // //****************************************************************************** boolean StringsNotEqual (char * s1, char * s2, int length) { int i; for (i=0;i 1) abort(); SetTextMode (); memset (msgbuf, 0, 300); va_start (argptr, error); vsprintf (&msgbuf[0], error, argptr); va_end (argptr); scriptbuffer = &msgbuf[0]; size = strlen (msgbuf); sptr = script_p = scriptbuffer; scriptend_p = script_p + size; scriptline = 1; endofscript = false; tokenready = false; px = ERRORCOL; py = ERRORROW; GetToken (true); while (!endofscript) { if ((script_p - sptr) >= 60) { px = ERRORCOL; py++; sptr = script_p; } UL_printf (token); px++; //SPACE GetToken (true); } if (player!=NULL) { printf ("Player X = %lx\n", (long int)player->x); printf ("Player Y = %lx\n", (long int)player->y); printf ("Player Angle = %lx\n\n", (long int)player->angle); } printf ("Episode = %ld\n", (long int)gamestate.episode); if (gamestate.episode > 1) level = (gamestate.mapon+1) - ((gamestate.episode-1) << 3); else level = gamestate.mapon+1; printf ("Area = %ld\n", (long int)level); ShutDown(); // DDOI - moved this so that it doesn't try to access player // which is freed by this function. SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, PACKAGE_STRING, msgbuf, NULL); SDL_Quit(); exit (1); } //#if (SOFTERROR==1) /* ================= = = SoftwareError = ================= */ void SoftwareError (char *error, ...) { va_list argptr; if (SoftErrorStarted==false) return; va_start (argptr, error); vfprintf (errout, error, argptr); va_end (argptr); } //#endif //TODO: Not sure if this is DEBUG code or not. //#if (DEBUG == 1) /* ================= = = DebugError = ================= */ void DebugError (char *error, ...) { va_list argptr; if (DebugStarted==false) return; va_start (argptr, error); vfprintf (debugout, error, argptr); va_end (argptr); } //#endif /* ================= = = OpenSoftError = ================= */ void OpenSoftError ( void ) { errout = fopen(SOFTERRORFILE,"wt+"); SoftErrorStarted=true; } /* ================= = = MapDebug = ================= */ void MapDebug (char *error, ...) { va_list argptr; if (MapDebugStarted==false) return; va_start (argptr, error); vfprintf (mapdebugout, error, argptr); va_end (argptr); } /* ================= = = OpenMapDebug = ================= */ void OpenMapDebug ( void ) { char *filename; if (MapDebugStarted==true) return; filename = M_StringJoin(ApogeePath, PATH_SEP_STR, MAPDEBUGFILE, NULL); mapdebugout = fopen(filename,"wt+"); free(filename); MapDebugStarted=true; } /* ================= = = StartupSoftError = ================= */ void StartupSoftError ( void ) { #if (SOFTERROR == 1) if (SoftErrorStarted==false) OpenSoftError(); #endif } /* ================= = = ShutdownSoftError = ================= */ void ShutdownSoftError ( void ) { if (DebugStarted==true) { fclose(debugout); DebugStarted=false; } if (SoftErrorStarted==true) { fclose(errout); SoftErrorStarted=false; } if (MapDebugStarted==true) { fclose(mapdebugout); MapDebugStarted=false; } } /* ================= = = CheckParm = = Checks for the given parameter in the program's command line arguments = = Returns the argument number (1 to argc-1) or 0 if not present = ================= */ int CheckParm (char *check) { int i; char *parm; for (i = 1;i<_argc;i++) { parm = _argv[i]; if ( !isalpha(*parm) ) // skip - / \ etc.. in front of parm { parm++; if (!*parm) continue; // parm was only one char } if ( !_fstricmp(check,parm) ) return i; } return 0; } int SafeOpenAppend (char *_filename) { int handle; char filename[MAX_PATH]; strncpy(filename, _filename, sizeof (filename)); filename[sizeof (filename) - 1] = '\0'; handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND , S_IREAD | S_IWRITE); if (handle == -1) Error ("Error opening for append %s: %s",filename,strerror(errno)); return handle; } int SafeOpenWrite (char *_filename) { int handle; char filename[MAX_PATH]; strncpy(filename, _filename, sizeof (filename)); filename[sizeof (filename) - 1] = '\0'; handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_TRUNC , S_IREAD | S_IWRITE); if (handle == -1) Error ("Error opening %s: %s",filename,strerror(errno)); return handle; } int SafeOpenRead (char *_filename) { int handle; char filename[MAX_PATH]; strncpy(filename, _filename, sizeof (filename)); filename[sizeof (filename) - 1] = '\0'; handle = open(filename,O_RDONLY | O_BINARY); if (handle == -1) Error ("Error opening %s: %s",filename,strerror(errno)); return handle; } void SafeRead (int handle, void *buffer, long count) { unsigned iocount; while (count) { iocount = count > 0x8000 ? 0x8000 : count; if (read (handle,buffer,iocount) != (int)iocount) Error ("File read failure reading %ld bytes",count); buffer = (void *)( (byte *)buffer + iocount ); count -= iocount; } } void SafeWrite (int handle, void *buffer, long count) { unsigned iocount; while (count) { iocount = count > 0x8000 ? 0x8000 : count; if (write (handle,buffer,iocount) != (int)iocount) Error ("File write failure writing %ld bytes",count); buffer = (void *)( (byte *)buffer + iocount ); count -= iocount; } } void SafeWriteString (int handle, char * buffer) { unsigned iocount; iocount=strlen(buffer); if (write (handle,buffer,iocount) != (int)iocount) Error ("File write string failure writing %s\n",buffer); } void *SafeMalloc (long size) { void *ptr; if (zonememorystarted==false) Error("Called SafeMalloc without starting zone memory\n"); ptr = Z_Malloc (size,PU_STATIC,NULL); if (!ptr && size) Error ("SafeMalloc failure for %lu bytes",size); return ptr; } void *SafeLevelMalloc (long size) { void *ptr; if (zonememorystarted==false) Error("Called SafeLevelMalloc without starting zone memory\n"); ptr = Z_LevelMalloc (size,PU_STATIC,NULL); if (!ptr && size) Error ("SafeLevelMalloc failure for %lu bytes",size); return ptr; } void SafeFree (void * ptr) { if ( ptr != NULL ) Z_Free (ptr); } void *safe_realloc (void *ptr, size_t size) { void *new_ptr; new_ptr = realloc(ptr, size); if (new_ptr == NULL && size != 0) { free(ptr); Error("safe_realloc: Could not realloc %lu bytes", (unsigned long) size); } return new_ptr; } /* ============== = = LoadFile = ============== */ long LoadFile (char *filename, void **bufferptr) { int handle; long length; handle = SafeOpenRead (filename); length = filelength (handle); *bufferptr = SafeMalloc (length); SafeRead (handle,*bufferptr, length); close (handle); return length; } /* ============== = = SaveFile = ============== */ void SaveFile (char *filename, void *buffer, long count) { int handle; handle = SafeOpenWrite (filename); SafeWrite (handle, buffer, count); close (handle); } void _dos_getdate(struct dosdate_t *date) { time_t curtime = time(NULL); struct tm *tm; if (date == NULL) { return; } memset(date, 0, sizeof(struct dosdate_t)); if ((tm = localtime(&curtime)) != NULL) { date->day = tm->tm_mday; date->month = tm->tm_mon + 1; date->year = tm->tm_year + 1900; date->dayofweek = tm->tm_wday + 1; } } void DefaultExtension (char *path, char *extension) { char *src; // // if path doesn't have a .EXT, append extension // (extension should include the .) // src = path + strlen(path) - 1; while (*src != PATH_SEP_CHAR && src != path) { if (*src == '.') return; // it has an extension src--; } strcat (path, extension); } void DefaultPath (char *path, char *basepath) { char temp[128]; if (path[0] == PATH_SEP_CHAR) return; // absolute path location strcpy (temp,path); strcpy (path,basepath); strcat (path,temp); } void ExtractFileBase (char *path, char *dest) { char *src; int length; src = path + strlen(path) - 1; // // back up until a \ or the start // while (src != path && *(src-1) != PATH_SEP_CHAR) src--; // // copy up to eight characters // memset (dest,0,8); length = 0; while (*src && *src != '.') { if (++length == 9) Error ("Filename base of %s >8 chars",path); *dest++ = toupper(*src++); } } /* ============== = = ParseNum / ParseHex = ============== */ long ParseHex (char *hex) { char *str; long num; num = 0; str = hex; while (*str) { num <<= 4; if (*str >= '0' && *str <= '9') num += *str-'0'; else if (*str >= 'a' && *str <= 'f') num += 10 + *str-'a'; else if (*str >= 'A' && *str <= 'F') num += 10 + *str-'A'; else Error ("Bad hex number: %s",hex); str++; } return num; } long ParseNum (char *str) { if (str[0] == '$') return ParseHex (str+1); if (str[0] == '0' && str[1] == 'x') return ParseHex (str+2); return atol (str); } #if (BYTE_ORDER == LITTLE_ENDIAN) #define KeepShort IntelShort #define SwapShort MotoShort #define KeepLong IntelLong #define SwapLong MotoLong #else #define KeepShort MotoShort #define SwapShort IntelShort #define KeepLong MotoLong #define SwapLong IntelLong #endif short SwapShort (short l) { byte b1,b2; b1 = l&255; b2 = (l>>8)&255; return (b1<<8) + b2; } short KeepShort (short l) { return l; } int SwapLong (int l) { byte b1,b2,b3,b4; b1 = l&255; b2 = (l>>8)&255; b3 = (l>>16)&255; b4 = (l>>24)&255; return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4; } int KeepLong (int l) { return l; } #undef KeepShort #undef KeepLong #undef SwapShort #undef SwapLong void SwapIntelLong(int *l) { *l = IntelLong(*l); } void SwapIntelShort(short *s) { *s = IntelShort(*s); } void SwapIntelLongArray(int *l, int num) { while (num--) { SwapIntelLong(l); l++; } } void SwapIntelShortArray(short *s, int num) { while (num--) { SwapIntelShort(s); s++; } } /* ============================================================================ BASIC GRAPHICS ============================================================================ */ void GetPalette(char * palette) { int i; SDL_Palette *pal = VL_GetVideoSurface()->format->palette; for (i = 0; i < 256; i++) { palette[0] = pal->colors[i].r; palette[1] = pal->colors[i].g; palette[2] = pal->colors[i].b; palette += 3; } } void SetPalette ( byte * pal ) { VL_SetPalette (pal); } //****************************************************************************** // // US_CheckParm() - checks to see if a string matches one of a set of // strings. The check is case insensitive. The routine returns the // index of the string that matched, or -1 if no matches were found // //****************************************************************************** int US_CheckParm (char *parm, char **strings) { char cp,cs, *p,*s; int i; int length; length=strlen(parm); while ( (!isalpha(*parm)) && (length>0)) // Skip non-alphas { length--; parm++; } for (i = 0;*strings && **strings;i++) { for (s = *strings++,p = parm,cs = cp = 0;cs == cp;) { cs = *s++; if (!cs) return(i); cp = *p++; if (isupper(cs)) cs = tolower(cs); if (isupper(cp)) cp = tolower(cp); } } return(-1); } /* ============================================================================= PALETTE OPS To avoid snow, do a WaitVBL BEFORE calling these ============================================================================= */ /* ================= = = VL_FillPalette = ================= */ void VL_FillPalette (int red, int green, int blue) { SDL_Color cmap[256]; int i; for (i = 0; i < 256; i++) { cmap[i].r = red << 2; cmap[i].g = green << 2; cmap[i].b = blue << 2; } SDL_SetPaletteColors (VL_GetVideoSurface()->format->palette, cmap, 0, 256); } //=========================================================================== /* ================= = = VL_SetColor = ================= */ void VL_SetColor (int color, int red, int green, int blue) { STUB_FUNCTION; } //=========================================================================== /* ================= = = VL_GetColor = ================= */ void VL_GetColor (int color, int *red, int *green, int *blue) { STUB_FUNCTION; } //=========================================================================== /* ================= = = VL_NormalizePalette = ================= */ void VL_NormalizePalette (byte *palette) { int i; for (i = 0; i < 768; i++) *(palette+i)=(*(palette+i))>>2; } /* ================= = = VL_SetPalette = = If fast palette setting has been tested for, it is used = -some cards don't like outsb palette setting- = ================= */ void VL_SetPalette (byte *palette) { SDL_Color cmap[256]; int i; for (i = 0; i < 256; i++) { cmap[i].r = gammatable[(gammaindex<<6)+(*palette++)] << 2; cmap[i].g = gammatable[(gammaindex<<6)+(*palette++)] << 2; cmap[i].b = gammatable[(gammaindex<<6)+(*palette++)] << 2; } SDL_SetPaletteColors (VL_GetVideoSurface()->format->palette, cmap, 0, 256); } //=========================================================================== /* ================= = = VL_GetPalette = = This does not use the port string instructions, = due to some incompatabilities = ================= */ void VL_GetPalette (byte *palette) { int i; SDL_Palette *pal = VL_GetVideoSurface()->format->palette; for (i = 0; i < 256; i++) { palette[0] = pal->colors[i].r >> 2; palette[1] = pal->colors[i].g >> 2; palette[2] = pal->colors[i].b >> 2; palette += 3; } } /* ================= = = UL_DisplayMemoryError () = ================= */ void UL_DisplayMemoryError ( int memneeded ) { STUB_FUNCTION; exit (0); } /* ================= = = UL_printf = ================= */ void UL_printf (char *str) { printf ("%s ",str); // Hackish but works - DDOI } /* ================= = = UL_ColorBox = ================= */ void UL_ColorBox (int x, int y, int w, int h, int color) { } //****************************************************************************** // // SideOfLine // //****************************************************************************** int SideOfLine(int x1, int y1, int x2, int y2, int x3, int y3) { int a1,b1,c1; /* Compute a1, b1, c1, where line joining points 1 and 2 * is "a1 x + b1 y + c1 = 0". */ a1 = y2 - y1; b1 = x1 - x2; c1 = FixedMulShift(x2,y1,16) - FixedMulShift(x1,y2,16); return SGN(FixedMulShift(a1,x3,16) + FixedMulShift(b1,y3,16) + c1); } //****************************************************************************** // // HSORT - heap sort // //****************************************************************************** typedef int (*PFI)(); /* pointer to a function returning int */ typedef void (*PFV)(); /* pointer to a function returning int */ static PFI Comp; /* pointer to comparison routine */ static PFV Switch; /* pointer to comparison routine */ static int Width; /* width of an object in bytes */ static char *Base; /* pointer to element [-1] of array */ static void newsift_down(L,U) int L,U; { int c; while(1) {c=L+L; if(c>U) break; if( (c+Width <= U) && ((*Comp)(Base+c+Width,Base+c)>0) ) c+= Width; if ((*Comp)(Base+L,Base+c)>=0) break; (*Switch)(Base+L, Base+c); L=c; } } void hsort(char * base, int nel, int width, int (*compare)(), void (*switcher)()) { static int i,n,stop; /* Perform a heap sort on an array starting at base. The array is nel elements large and width is the size of a single element in bytes. Compare is a pointer to a comparison routine which will be passed pointers to two elements of the array. It should return a negative number if the left-most argument is less than the rightmost, 0 if the two arguments are equal, a positive number if the left argument is greater than the right. (That is, it acts like a "subtract" operator.) If compare is 0 then the default comparison routine, argvcmp (which sorts an argv-like array of pointers to strings), is used. */ Width=width; Comp= compare; Switch= switcher; n=nel*Width; Base=base-Width; for (i=(n/Width/2)*Width; i>=Width; i-=Width) newsift_down(i,n); stop=Width+Width; for (i=n; i>=stop; ) { (*Switch)(base, Base+i); newsift_down(Width,i-=Width); } } /*---------------------------------------------------------------------------*/ //****************************************************************************** // // UL_GetPath // // Purpose // To parse the directory entered by the user to make the directory. // // Parms // Path - the path to be parsed. // // Returns // Pointer to next path // //****************************************************************************** char * UL_GetPath (char * path, char *dir) { boolean done = 0; char *dr = dir; int cnt = 0; if (*path == SLASHES) path++; while (!done) { *dr = *path; cnt++; // make sure the number of characters in the dir if (cnt > MAXCHARS) // name doesn't exceed acceptable limits. Error ("ERROR : Directory name can only be %d characters long.\n", MAXCHARS); path++; dr++; if ((*path == SLASHES) || (*path == 0)) done = true; } *dr = 0; return (path); } //****************************************************************************** // // UL_ChangeDirectory () // // Purpose // To change to a directory. Checks for drive changes. // // Parms // path - The path to change to. // // Returns // TRUE - If successful. // FALSE - If unsuccessful. // //****************************************************************************** boolean UL_ChangeDirectory (char *path) { if (!path || !*path) { return true; } if (chdir (path) == -1) { return (false); } return true; } //****************************************************************************** // // UL_ChangeDrive () // // Purpose // To change drives. // // Parms // drive - The drive to change to. // // Returns // TRUE - If drive change successful. // FALSE - If drive change unsuccessful. // //****************************************************************************** boolean UL_ChangeDrive (char *drive) { STUB_FUNCTION; return false; } /* ============= = = AbortCheck = ============= */ void AbortCheck (char * abortstring) { // User abort check IN_UpdateKeyboard (); if (Keyboard[sc_Escape]) Error("%s\n",abortstring); } rott-20230810/rott/rt_util.h000066400000000000000000000105461446517470200156060ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //*************************************************************************** // // RT_UTIL.C - various utils palette funcs and modex stuff // //*************************************************************************** #ifndef _rt_util_public #define _rt_util_public #define ERRORVERSIONROW 1 #define ERRORVERSIONCOL 67 #include "rt_def.h" #include "m_misc2.h" #include "develop.h" extern int egacolor[16]; extern byte * origpal; extern int _argc; extern char ** _argv; void markgetch( void ); boolean StringsNotEqual (char * s1, char * s2, int length); void GetPalette(char * pal); void ClearGraphicsScreen( void ); void ClearBuffer( char * buf, int size ); void Error (char *error, ...) __attribute__((noreturn,format(printf,1,2))); void StartupSoftError ( void ); void ShutdownSoftError ( void ); int CheckParm (char *check); int SafeOpenWrite (char *filename); int SafeOpenAppend (char *filename); int SafeOpenRead (char *filename); void SafeRead (int handle, void *buffer, long count); void SafeWrite (int handle, void *buffer, long count); void SafeWriteString (int handle, char * buffer); void *SafeMalloc (long size); void *SafeLevelMalloc (long size); void SafeFree (void * ptr); long LoadFile (char *filename, void **bufferptr); void SaveFile (char *filename, void *buffer, long count); void DefaultExtension (char *path, char *extension); void DefaultPath (char *path, char *basepath); void ExtractFileBase (char *path, char *dest); long ParseHex (char *hex); long ParseNum (char *str); short MotoShort (short l); short IntelShort (short l); int MotoLong (int l); int IntelLong (int l); void SwapIntelLong (int *l); void SwapIntelShort(short *s); void SwapIntelLongArray (int *l, int num); void SwapIntelShortArray (short *s, int num); int US_CheckParm (char *parm, char **strings); byte BestColor (int r, int g, int b, byte *palette); int atan2_appx(int,int); int FindDistance(int ix, int iy); int Find_3D_Distance(int ix, int iy, int iz); void SetPalette ( byte * pal ); void SetaPalette ( byte * pal ); void FindEGAColors ( void ); void VL_FillPalette (int red, int green, int blue); void VL_SetColor (int color, int red, int green, int blue); void VL_GetColor (int color, int *red, int *green, int *blue); void VL_SetPalette (byte *palette); void VL_GetPalette (byte *palette); void UL_printf (char *str); void VL_NormalizePalette (byte *palette); void MapDebug (char *error, ...) __attribute__((format(printf,1,2))); void OpenMapDebug ( void ); void UL_ColorBox (int x, int y, int w, int h, int color); void UL_DisplayMemoryError ( int memneeded ); int SideOfLine(int x1, int y1, int x2, int y2, int x3, int y3); void hsort(char * base, int nel, int width, int (*compare)(), void (*switcher)()); char * UL_GetPath (char * path, char *dir); boolean UL_ChangeDirectory (char *path); boolean UL_ChangeDrive (char *drive); void AbortCheck (char * abortstring); struct dosdate_t { unsigned char day; unsigned char month; unsigned int year; unsigned char dayofweek; }; void _dos_getdate(struct dosdate_t *date); void *safe_realloc (void *ptr, size_t size); #if (SOFTERROR==1) void SoftwareError (char *error, ...) __attribute__((format(printf,1,2))); #define SoftError SoftwareError #else void SoftwareError (char *error, ...) __attribute__((format(printf,1,2))); //#define SoftError SoftwareError #define SoftError if (1) {} else SoftwareError //#define SoftError #endif void DebugError (char *error, ...) __attribute__((format(printf,1,2))); #define Debug DebugError //#define Debug void Square (void); #define my_outp(a,b) #define OUTP my_outp #endif rott-20230810/rott/rt_vh_a.h000066400000000000000000000020221446517470200155340ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_vh_a_public #define _rt_vh_a_public //*************************************************************************** // // Public header for RT_VH_A.ASM. // //*************************************************************************** void VH_UpdateScreen (void); void JoyStick_Vals (void); #endif rott-20230810/rott/rt_vid.c000066400000000000000000000512041446517470200154020ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "rt_vid.h" #include "_rt_vid.h" #include "rt_menu.h" #include "rt_util.h" #include "modexlib.h" #include "profile.h" #include "watcom.h" #include "rt_str.h" #include "rt_draw.h" #include "rt_in.h" #include "rt_main.h" #include "z_zone.h" #include "lumpy.h" #include "rt_vh_a.h" #include "isr.h" #include "rt_view.h" #include "cin_efct.h" #include "w_wad.h" //****************************************************************************** // // GLOBALS // //****************************************************************************** byte *updateptr; unsigned mapwidthtable[64]; unsigned uwidthtable[UPDATEHIGH]; unsigned blockstarts[UPDATEWIDE*UPDATEHIGH]; byte update[UPDATESIZE]; byte palette1[256][3], palette2[256][3]; boolean screenfaded; //****************************************************************************** // // VL_MemToScreen () // //****************************************************************************** void VL_MemToScreen (byte *source, int width, int height, int x, int y) { /* TODO please optimize me */ byte *ptr, *destline; int plane, i, j; ptr = source; for (plane = 0; plane < 4; plane++) { for (j = 0; j < height; j++) { destline = (byte *)(bufferofs+ylookup[y+j]+x); for (i = 0; i < width; i++) { // if (ptr < bufferofs + toplimit) { //bnafix zxcvb *(destline + i*4 + plane) = *ptr++; // } } } } } // bna function start void VL_MemToScreenClipped (byte *source, int width, int height, int x, int y); void VL_MemToScreenClipped (byte *source, int width, int height, int x, int y) { byte *ptr, *destline; int plane, i, j;//,toplimit; ptr = source; for (plane = 0; plane < 4; plane++) { for (j = 0; j < height; j++) { destline = (byte *)(bufferofs+ylookup[y+j]+x); for (i = 0; i < width; i++) { if (*ptr != 255){ *(destline + i*4 + plane) = *ptr++; }else{ptr++;} } } } } //copy picture to mem (bufferofs) in doublesize void VL_MemStrechedToScreen (byte *source, int width, int height, int x, int y) { byte *ptr, *destline,*tmp,*o; int plane, i, j; tmp = bufferofs; ptr = source; for (plane = 0; plane < 4; plane++) { for (j = 0; j < height; j++) { destline = (byte *)(bufferofs+(iGLOBAL_SCREENWIDTH*j)+ylookup[y+j]+x); o = ptr; for (i = 0; i < width; i+=1) { *(destline + i*4 + plane) = *ptr; destline++; *(destline + i*4 + plane) = *ptr++; } ptr = o; destline = (byte *)(bufferofs+iGLOBAL_SCREENWIDTH+(iGLOBAL_SCREENWIDTH*j)+ylookup[y+j]+x); for (i = 0; i < width; i+=1) { *(destline + i*4 + plane) = *ptr; destline++; *(destline + i*4 + plane) = *ptr++; } } } bufferofs = tmp; } // bna function end //************************************************************************* // // DrawTiledRegion () - Fills the specified region with a tiled image // //************************************************************************* void DrawTiledRegion ( int x, int y, int width, int height, int offx, int offy, pic_t *tile ) { byte *source; byte *sourceoff; int sourcex; int sourcey; int sourcewidth; int sourceheight; int plane; int planesize; byte *start; byte *origdest; byte *dest; int startoffset; int HeightIndex; int WidthIndex; start = ( byte * )( bufferofs + x + ylookup[ y ] ); source = &tile->data; sourcewidth = tile->width; sourceheight = tile->height; if ( offx >= sourcewidth ) { offx %= sourcewidth; } if ( offy >= sourceheight ) { offy %= sourceheight; } startoffset = offy * sourcewidth; planesize = sourcewidth * sourceheight; plane = 4; while( plane > 0 ) { origdest = start+(4-plane); sourcey = offy; sourceoff = source + startoffset; HeightIndex = height; while( HeightIndex-- ) { dest = origdest; sourcex = offx; WidthIndex = width; while( WidthIndex-- ) { *dest = sourceoff[ sourcex ]; dest += 4; sourcex++; if ( sourcex >= sourcewidth ) { sourcex = 0; } } origdest += iGLOBAL_SCREENWIDTH; sourceoff += sourcewidth; sourcey++; if ( sourcey >= sourceheight ) { sourcey = 0; sourceoff = source; } } source += planesize; plane--; } } //****************************************************************************** // // VWB_DrawPic () - Draws a linear pic and marks the update block // //****************************************************************************** void VWB_DrawPic (int x, int y, pic_t *pic) { if (((iGLOBAL_SCREENWIDTH > 320) && !StretchScreen) || VW_MarkUpdateBlock (x, y, x+(pic->width<<2)-1, y+(pic->height)-1)) VL_MemToScreen ((byte *)&pic->data, pic->width, pic->height, x, y); } //****************************************************************************** // // VL_Bar () - Draws a bar // //****************************************************************************** void VL_Bar (int x, int y, int width, int height, int color) { byte *dest = (byte *)(bufferofs+ylookup[y]+x); while (height--) { memset(dest, color, width); dest += linewidth; } } //****************************************************************************** // // VWB_Bar () - Draws a block and marks the update block // //****************************************************************************** void VWB_Bar (int x, int y, int width, int height, int color) { if (((iGLOBAL_SCREENWIDTH > 320) && !StretchScreen) || VW_MarkUpdateBlock (x,y,x+width,y+height-1) ) VL_Bar (x, y, width, height, color); } //****************************************************************************** // // VL_TBar () - Draws a bar // //****************************************************************************** void VL_TBar (int x, int y, int width, int height) { int w = width; while (height--) { byte *dest = (byte *)(bufferofs+ylookup[y]+x); width = w; while (width--) { byte pixel = *dest; pixel = *(colormap+(27<<8)+pixel); *dest = pixel; dest++; } y++; } } //****************************************************************************** // // VWB_TBar () - Draws a block and marks the update block // //****************************************************************************** void VWB_TBar (int x, int y, int width, int height) { if (VW_MarkUpdateBlock (x,y,x+width,y+height-1)) VL_TBar (x, y, width, height); } //****************************************************************************** // // VL_Hlin () - Draws a horizontal line // //****************************************************************************** void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color) { byte *dest = (byte*)(bufferofs+ylookup[y]+x); memset(dest, color, width); } //****************************************************************************** // // VL_Vlin () - Draws a vertical line // //****************************************************************************** void VL_Vlin (int x, int y, int height, int color) { byte *dest = (byte*)(bufferofs+ylookup[y]+x); while (height--) { *dest = color; dest += linewidth; } } //****************************************************************************** // // VWB_Hlin () - Draws a horizontal line and marks the update block // //****************************************************************************** void VWB_Hlin (int x1, int x2, int y, int color) { if (VW_MarkUpdateBlock (x1,y,x2,y)) VW_Hlin(x1,x2,y,color); } //****************************************************************************** // // VWB_Vlin () - Draws a vertical line and marks the update block // //****************************************************************************** void VWB_Vlin (int y1, int y2, int x, int color) { if (VW_MarkUpdateBlock (x,y1,x,y2)) VW_Vlin(y1,y2,x,color); } //****************************************************************************** // // VL_THlin () // //****************************************************************************** void VL_THlin (unsigned x, unsigned y, unsigned width, boolean up) { byte *dest = (byte*)(bufferofs+ylookup[y]+x); while (width--) { byte pixel = *dest; if (up) { pixel = *(colormap+(13<<8)+pixel); } else { pixel = *(colormap+(27<<8)+pixel); } *dest = pixel; dest++; } } //****************************************************************************** // // VL_TVlin () // //****************************************************************************** void VL_TVlin (unsigned x, unsigned y, unsigned height, boolean up) { byte *dest = (byte*)(bufferofs+ylookup[y]+x); while (height--) { byte pixel = *dest; if (up) { pixel = *(colormap+(13<<8)+pixel); } else { pixel = *(colormap+(27<<8)+pixel); } *dest = pixel; dest += linewidth; } } //****************************************************************************** // // VWB_THlin () - Draws a horizontal line and marks the update block // //****************************************************************************** void VWB_THlin (int x1, int x2, int y, boolean up) { if (VW_MarkUpdateBlock (x1,y,x2,y)) VW_THlin (x1,x2,y,up); } //****************************************************************************** // // VWB_TVlin () - Draws a vertical line and marks the update block // //****************************************************************************** void VWB_TVlin (int y1, int y2, int x, boolean up) { if (VW_MarkUpdateBlock (x,y1,x,y2)) VW_TVlin (y1,y2,x,up); } /* ================================================================================ Double buffer management routines ================================================================================ */ //****************************************************************************** // // VW_MarkUpdateBlock // // Takes a pixel bounded block and marks the tiles in bufferblocks // Returns 0 if the entire block is off the buffer screen // //****************************************************************************** int VW_MarkUpdateBlock (int x1, int y1, int x2, int y2) { int x, y, xt1, yt1, xt2, yt2, nextline; byte *mark; xt1 = x1 >> PIXTOBLOCK; yt1 = y1 >> PIXTOBLOCK; xt2 = x2 >> PIXTOBLOCK; yt2 = y2 >> PIXTOBLOCK; if (xt1 < 0) xt1 = 0; else if (xt1 >= UPDATEWIDE) return 0; if (yt1 < 0) yt1 = 0; else if (yt1 > UPDATEHIGH) return 0; if (xt2 < 0) return 0; else if (xt2 >= UPDATEWIDE) xt2 = UPDATEWIDE-1; if (yt2 < 0) return 0; else if (yt2 >= UPDATEHIGH) yt2 = UPDATEHIGH-1; mark = updateptr + uwidthtable[yt1] + xt1; nextline = UPDATEWIDE - (xt2-xt1) - 1; for (y = yt1; y <= yt2; y++) { for (x = xt1; x <= xt2; x++) *mark++ = 1; // this tile will need to be updated mark += nextline; } return 1; } //****************************************************************************** // // VW_UpdateScreen () // //****************************************************************************** void VW_UpdateScreen (void) { VH_UpdateScreen (); } //=========================================================================== /* ================= = = VL_FadeOut = = Fades the current palette to the given color in the given number of steps = ================= */ void VL_FadeOut (int start, int end, int red, int green, int blue, int steps) { int i,j,orig,delta; byte *origptr, *newptr; if (screenfaded) return; VH_UpdateScreen(); WaitVBL (); VL_GetPalette (&palette1[0][0]); memcpy (palette2, palette1, 768); // // fade through intermediate frames // for (i = 0; i < steps; i++) { origptr = &palette1[start][0]; newptr = &palette2[start][0]; for (j = start; j <= end; j++) { orig = *origptr++; delta = red-orig; *newptr++ = orig + delta * i / steps; orig = *origptr++; delta = green-orig; *newptr++ = orig + delta * i / steps; orig = *origptr++; delta = blue-orig; *newptr++ = orig + delta * i / steps; } VH_UpdateScreen(); WaitVBL (); VL_SetPalette (&palette2[0][0]); } // // final color // VL_FillPalette (red,green,blue); VH_UpdateScreen(); screenfaded = true; } /* ================= = = VL_FadeToColor = = Fades the current palette to the given color in the given number of steps = ================= */ void VL_FadeToColor (int time, int red, int green, int blue) { int i,j,orig,delta; byte *origptr, *newptr; int dmax,dmin; if (screenfaded) return; VH_UpdateScreen(); WaitVBL (); VL_GetPalette (&palette1[0][0]); memcpy (palette2, palette1, 768); dmax=(maxshade<<16)/time; dmin=(minshade<<16)/time; // // fade through intermediate frames // for (i = 0; i < time; i+=tics) { origptr = &palette1[0][0]; newptr = &palette2[0][0]; for (j = 0; j <= 255; j++) { orig = *origptr++; delta = ((red>>2)-orig)<<16; *newptr++ = orig + FixedMul(delta/time,i); orig = *origptr++; delta = ((green>>2)-orig)<<16; *newptr++ = orig + FixedMul(delta/time,i); orig = *origptr++; delta = ((blue>>2)-orig)<<16; *newptr++ = orig + FixedMul(delta/time,i); } maxshade=(dmax*(time-i))>>16; minshade=(dmin*(time-i))>>16; VH_UpdateScreen(); WaitVBL (); VL_SetPalette (&palette2[0][0]); ThreeDRefresh(); CalcTics(); } // // final color // VL_FillPalette (red>>2,green>>2,blue>>2); VH_UpdateScreen(); screenfaded = true; } /* ================= = = VL_FadeIn = ================= */ void VL_FadeIn (int start, int end, byte *palette, int steps) { int i,j,delta; VH_UpdateScreen(); WaitVBL (); VL_GetPalette (&palette1[0][0]); memcpy (&palette2[0][0], &palette1[0][0], sizeof(palette1)); start *= 3; end = end*3+2; // // fade through intermediate frames // for (i=0;i>1); temp = bufferofs; bufferofs = displayofs; VL_Bar (0, 0, 320, 200, 0); bufferofs = temp; VL_FadeIn(0,255,newpal,steps>>1); } //========================================================================== //**************************************************************************** // // VL_DecompressLBM () // // LIMITATIONS - Only works with 320x200!!! // //**************************************************************************** void VL_DecompressLBM (lbm_t *lbminfo, boolean flip) { int count; byte b, rept; byte *source = (byte *)&lbminfo->data; byte *buf; int ht = lbminfo->height; byte pal[768]; EnableScreenStretch(); memcpy(&pal[0],lbminfo->palette,768); VL_NormalizePalette (&pal[0]); VW_MarkUpdateBlock (0, 0, 320, 200); buf = (byte *)bufferofs; while (ht--) { count = 0; do { rept = *source++; if (rept > 0x80) { rept = (rept^0xff)+2; b = *source++; memset (buf, b, rept); buf += rept; } else if (rept < 0x80) { rept++; memcpy (buf, source, rept); buf += rept; source += rept; } else rept = 0; // rept of 0x80 is NOP count += rept; } while (count < lbminfo->width); if (iGLOBAL_SCREENWIDTH > 320){ buf += (iGLOBAL_SCREENWIDTH-320); //eg 800 - 320) } } if (flip==true) VW_UpdateScreen (); VL_FadeIn (0, 255, &pal[0], 15); } //**************************************************************************** // // SetBorderColor // //**************************************************************************** void SetBorderColor (int color) { // bna section start byte *cnt,*Ycnt,*b; b=(byte *)bufferofs; // color 56 could be used //paint top red line for (cnt=b;cnt=abs(dx)) { count=abs(dy); if (count == 0) return; yinc=(dy<<16)/count; if (dy==0) { return; } else { xinc=(dx<<16)/count; } } else { count=abs(dx); if (count == 0) return; xinc=(dx<<16)/count; if (dx==0) { return; } else { yinc=(dy<<16)/count; } } x1<<=16; y1<<=16; while (count>0) { *((byte *)bufferofs+(x1>>16)+(ylookup[y1>>16]))=color; x1+=xinc; y1+=yinc; count--; } } //****************************************************************************** // // DrawXYPic // //****************************************************************************** void DrawXYPic (int x, int y, int shapenum) { byte *buffer; byte *buf; int xx,yy; int plane; byte *src; pic_t *p; p = (pic_t *) W_CacheLumpNum (shapenum, PU_CACHE, Cvt_pic_t, 1); if ((x<0) || ((x+(p->width<<2))>=320)) Error ("DrawXYPic: x is out of range\n"); if ((y<0) || ((y+p->height)>=200)) Error ("DrawXYPic: y is out of range\n"); buffer = (byte*)bufferofs+ylookup[y]; src=(byte *)&p->data; for (plane=x;planeheight; yy++) { buf=buffer+ylookup[yy]; for (xx = 0; xx < p->width; xx++,buf++) *(buf+plane+xx*4)=*(src++); } } } rott-20230810/rott/rt_vid.h000066400000000000000000000064701446517470200154140ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _rt_vid_public #define _rt_vid_public //*************************************************************************** // // Public header for RT_VID.C // //*************************************************************************** #include "lumpy.h" //*************************************************************************** // // DEFINES // //*************************************************************************** #define PORTTILESWIDE 20 // all drawing takes place inside a #define PORTTILESHIGH 13 // non displayed port of this size #define UPDATEWIDE PORTTILESWIDE #define UPDATEHIGH PORTTILESHIGH #define UPDATESIZE (UPDATEWIDE*UPDATEHIGH) //*************************************************************************** // // GLOBALS // //*************************************************************************** extern byte *updateptr; extern unsigned mapwidthtable[64]; extern unsigned uwidthtable[UPDATEHIGH]; extern unsigned blockstarts[UPDATEWIDE*UPDATEHIGH]; extern byte update[UPDATESIZE]; extern boolean screenfaded; //*************************************************************************** // // PROTOTYPES // //*************************************************************************** void VL_MemStrechedToScreen (byte *source, int width, int height, int x, int y); void VL_MemToScreen (byte *source, int width, int height, int x, int y); void DrawTiledRegion( int x, int y, int width, int height, int offx, int offy, pic_t *tile ); void VWB_DrawPic (int x, int y, pic_t *pic); void VL_Bar (int x, int y, int width, int height, int color); void VWB_Bar (int x, int y, int width, int height, int color); void VWB_Hlin (int x1, int x2, int y, int color); void VWB_Vlin (int y1, int y2, int x, int color); void VWB_THlin (int x1, int x2, int y, boolean up); void VWB_TVlin (int y1, int y2, int x, boolean up); int VW_MarkUpdateBlock (int x1, int y1, int x2, int y2); void VW_UpdateScreen (void); void VL_FadeOut (int start, int end, int red, int green, int blue, int steps); void VL_FadeIn (int start, int end, byte *palette, int steps); void VL_DecompressLBM (lbm_t *lbminfo, boolean flip); void VL_FadeToColor (int time, int red, int green, int blue); void VWB_TBar (int x, int y, int width, int height); void SwitchPalette (byte * newpal, int steps); void SetBorderColor (int color); void VL_DrawPostPic (int lumpnum); void VL_DrawLine (int x1, int y1, int x2, int y2, byte color); #define MenuFadeOut() VL_FadeOut (0, 255, 0, 0, 0, 10) #define MenuFadeIn() VL_FadeIn (0, 255, origpal, 10) void DrawXYPic (int x, int y, int shapenum); #endif rott-20230810/rott/rt_view.c000066400000000000000000000444721446517470200156030ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "rt_view.h" #include "z_zone.h" #include "w_wad.h" #include "lumpy.h" #include "rt_util.h" #include "rt_vid.h" #include "rt_game.h" #include "rt_draw.h" #include "rt_ted.h" #include "isr.h" #include "rt_rand.h" #include "rt_sound.h" #include "modexlib.h" #include "rt_menu.h" #include #include "rt_main.h" #include "rt_battl.h" #include "rt_floor.h" #include "rt_str.h" #include "watcom.h" #include "develop.h" #define LIGHTNINGLEVEL 4 #define MINLIGHTNINGLEVEL 2 #define MAXLIGHTNINGLEVEL 10 /* ============================================================================= GLOBALS ============================================================================= */ extern int G_weaponscale; int StatusBar = 0; int lightninglevel=0; boolean lightning=false; int normalshade; int darknesslevel; int maxshade; int minshade; int baseminshade; int basemaxshade; int viewheight; int viewwidth; longword heightnumerator; fixed scale; int screenofs; int centerx; int centery; int centeryfrac; int fulllight; int weaponscale; int viewsize; byte * colormap; byte * redmap; byte * greenmap; byte * playermaps[MAXPLAYERCOLORS]; //short pixelangle[MAXVIEWWIDTH]; short pixelangle[800]; byte gammatable[GAMMAENTRIES]; int gammaindex; int focalwidth=160; int yzangleconverter; byte uniformcolors[MAXPLAYERCOLORS]={ 25, 222, 29, 206, 52, 6, 155, 16, 90, 129, 109 }; /* ============================================================================= LOCAL ============================================================================= */ static char *YourComputerSucksString = "Buy a 486! :)"; static int viewsizes[MAXVIEWSIZES*2]={ 80,48, 128,72, 160,88, 192,104, 224,120, 256,136, 288,152, 320,168, 320,184, 320,200, 320,200}; static int ColorMapLoaded=0; static int lightningtime=0; static int lightningdelta=0; static int lightningdistance=0; static int lightningsoundtime=0; static boolean periodic=false; static int periodictime=0; void SetViewDelta ( void ); void UpdatePeriodicLighting (void); /* ==================== = = ResetFocalWidth = ==================== */ void ResetFocalWidth ( void ) { focalwidth=iGLOBAL_FOCALWIDTH;//FOCALWIDTH; SetViewDelta(); } /* ==================== = = ChangeFocalWidth = ==================== */ void ChangeFocalWidth ( int amount ) { focalwidth=iGLOBAL_FOCALWIDTH+amount;//FOCALWIDTH+amount; SetViewDelta(); } /* ==================== = = SetViewDelta = ==================== */ void SetViewDelta ( void ) { // // calculate scale value for vertical height calculations // and sprite x calculations // scale = (centerx*focalwidth)/(160); // // divide heightnumerator by a posts distance to get the posts height for // the heightbuffer. The pixel height is height>>HEIGHTFRACTION // heightnumerator = (((focalwidth/10)*centerx*4096)<>1; for (i=0;i>16]; SwapIntelLong(&intang); pixelangle[centerx-1-i] =(short) intang; pixelangle[centerx+i] =(short) -intang; frac+=(length*65536/centerx); } table=W_CacheLumpName("tables",PU_CACHE, CvtNull, 1); SafeFree(pangle); } /* ========================== = = SetViewSize = ========================== */ void SetViewSize ( int size ) { int height; int maxheight; int screenx; int screeny; int topy; /* if (size>=10){ SetTextMode ( ); screenx=screenx; return; } */ if ( iGLOBAL_SCREENWIDTH == 640) { height = 0;//we use height as dummy cnt viewsizes[height++]= 380; viewsizes[height++]= 336; viewsizes[height++]= 428; viewsizes[height++]= 352; viewsizes[height++]= 460; viewsizes[height++]= 368; viewsizes[height++]= 492; viewsizes[height++]= 384; viewsizes[height++]= 524; viewsizes[height++]= 400; viewsizes[height++]= 556; viewsizes[height++]= 416; viewsizes[height++]= 588; viewsizes[height++]= 432; viewsizes[height++]= 640; viewsizes[height++]= 448; viewsizes[height++]= 640; viewsizes[height++]= 464; viewsizes[height++]= 640; viewsizes[height++]= 480; viewsizes[height++]= 640; viewsizes[height++]= 480; } if ((size<0) || (size>=MAXVIEWSIZES)){//bna added printf("Illegal screen size = %d\n",size); size = 8;//set default value viewsize = 8; } //if ((size<0) || (size>=MAXVIEWSIZES)) // Error("Illegal screen size = %ld\n",size); viewwidth = viewsizes[ size << 1 ]; // must be divisable by 16 viewheight = viewsizes[ ( size << 1 ) + 1 ]; // must be even maxheight = iGLOBAL_SCREENHEIGHT; topy = 0; // Only keep the kills flag StatusBar &= ~( BOTTOM_STATUS_BAR | TOP_STATUS_BAR | STATUS_PLAYER_STATS ); if ( SHOW_KILLS() ) { // Account for height of kill boxes maxheight -= 24; } if ( size < 9 ) { StatusBar |= TOP_STATUS_BAR; // Account for height of top status bar maxheight -= 16; topy += 16; } // if ( size == 7 ){maxheight -= 16;}//bna++ // if ( size <= 6 ){topy -= 8;}//bna++ if ( size < 8 ) { // Turn on health and ammo bar StatusBar |= BOTTOM_STATUS_BAR; maxheight -= 16; } else if ( size < 10 ) { // Turn on transparent health and ammo bar StatusBar |= STATUS_PLAYER_STATS; } // SetTextMode ( ); // viewheight=viewheight; height = viewheight; if ( height > 168*iGLOBAL_SCREENHEIGHT/200 ) { // Prevent weapon from being scaled too big height = 168*iGLOBAL_SCREENHEIGHT/200; } weaponscale = ( height << 16 ) / 168;//( height << 16 ) = 170 * 65536 centerx = viewwidth >> 1; centery = viewheight >> 1; centeryfrac = (centery << 16); yzangleconverter = ( 0xaf85 * viewheight ) / iGLOBAL_SCREENHEIGHT; // Center the view horizontally screenx = ( iGLOBAL_SCREENWIDTH - viewwidth ) >> 1; if ( viewheight >= maxheight ) { screeny = topy; viewheight = maxheight; } else { // Center the view vertically screeny = ( ( maxheight - viewheight ) >> 1 ) + topy; } // Calculate offset of view window screenofs = screenx + ylookup[ screeny ]; // // calculate trace angles and projection constants // ResetFocalWidth(); // Already being called in ResetFocalWidth // SetViewDelta(); CalcProjection(); } //****************************************************************************** // // DrawCPUJape () // //****************************************************************************** void DrawCPUJape ( void ) { int width; int height; CurrentFont = tinyfont; VW_MeasurePropString( YourComputerSucksString, &width, &height ); DrawGameString( 160 - width / 2, 100 + 48 / 2 + 2, YourComputerSucksString, true ); } /* ========================== = = SetupScreen = ========================== */ void SetupScreen ( boolean flip ) { pic_t *shape; SetViewSize(viewsize); if ( viewsize < 7 ) { shape = ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 ); //DrawTiledRegion( 0, 16, 320, 200 - 32, 0, 16, shape ); DrawTiledRegion( 0, 16, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 32, 0, 16, shape );//bna++ } if ( viewsize == 0 ) { DrawCPUJape(); } DrawPlayScreen (true); if (flip==true) { ThreeDRefresh(); VL_CopyDisplayToHidden(); } } void LoadColorMap( void ) { int i,j; int lump, length; if (ColorMapLoaded==1) Error("Called LoadColorMap twice\n"); ColorMapLoaded=1; // // load in the light tables // 256 byte align tables // lump = W_GetNumForName("colormap"); length = W_LumpLength (lump) + 255; colormap = SafeMalloc (length); colormap = (byte *)( ((intptr_t)colormap + 255)&~0xff); W_ReadLump (lump,colormap); // Fix fire colors in colormap for (i=31;i>=16;i--) for (j=0xea;j<0xf9;j++) colormap[i*256+j]=colormap[(((i-16)/4+16))*256+j]; // Get special maps lump = W_GetNumForName("specmaps"); length = W_LumpLength (lump+1) + 255; redmap = SafeMalloc (length); redmap = (byte *)( ((intptr_t)redmap + 255)&~0xff); W_ReadLump (lump+1,redmap); greenmap = redmap+(16*256); // Get player colormaps // if (modemgame==true) { lump = W_GetNumForName("playmaps")+1; for (i=0;i=104) && ((word)MAPSPOT(2,0,1)<=105)) fog=(word)MAPSPOT(2,0,1)-104; else Error ("There is no Fog icon on map %d\n",gamestate.mapon); if ((word)MAPSPOT(3,0,1)==139) { if (fog==0) { lightsource=1; lights=Z_Malloc(MAPSIZE*MAPSIZE*(sizeof(unsigned long)),PU_LEVEL,NULL); memset (lights,0,MAPSIZE*MAPSIZE*(sizeof(unsigned long))); } else Error("You cannot use light sourcing on a level with fog on map %d\n",gamestate.mapon); } else if ((word)MAPSPOT(3,0,1)) Error("You must use the lightsource icon or nothing at all at (3,0) in plane 1 on map %d\n",gamestate.mapon); if (((word)MAPSPOT(2,0,0)>=LIGHTLEVELBASE) && ((word)MAPSPOT(2,0,0)<=LIGHTLEVELEND)) glevel=(MAPSPOT(2,0,0)-LIGHTLEVELBASE); else Error("You must specify a valid darkness level icon at (2,0) on map %d\n",gamestate.mapon); SetLightLevels ( glevel ); if (((word)MAPSPOT(3,0,0)>=LIGHTRATEBASE) && ((word)MAPSPOT(3,0,0)<=LIGHTRATEEND)) glevel=(MAPSPOT(3,0,0)-LIGHTRATEBASE); else { // Error("You must specify a valid darkness rate icon at (3,0) on map %ld\n",gamestate.mapon); glevel = 4; } SetLightRate ( glevel ); lightningtime=0; lightningdistance=0; lightninglevel=0; lightningdelta=0; lightningsoundtime=0; } /* ========================== = = SetLightLevels = ========================== */ void SetLightLevels ( int darkness ) { if (fog==0) { baseminshade=0x10+((7-darkness)>>1); basemaxshade=0x1f-(darkness>>1); } else { baseminshade=darkness; basemaxshade=0x10; } minshade=baseminshade; maxshade=basemaxshade; darknesslevel=darkness; } /* ========================== = = GetLightLevelTile = ========================== */ int GetLightLevelTile ( void ) { if (fog==0) { return ((7-((baseminshade-0x10)<<1))+LIGHTLEVELBASE); } else { return (baseminshade+LIGHTLEVELBASE); } } /* ========================== = = SetLightRate = ========================== */ void SetLightRate ( int rate ) { normalshade=(HEIGHTFRACTION+8)-rate; if (normalshade>14) normalshade=14; if (normalshade<3) normalshade=3; } /* ========================== = = GetLightRate = ========================== */ int GetLightRate ( void ) { return ((HEIGHTFRACTION+8)-normalshade); } /* ========================== = = GetLightRateTile = ========================== */ int GetLightRateTile ( void ) { return ((HEIGHTFRACTION+8)-normalshade+LIGHTRATEBASE); } /* ========================== = = UpdateLightLevel = ========================== */ void UpdateLightLevel (int area) { int numlights; int targetmin; int targetmax; int numtiles; if (fog==true) return; numtiles=(numareatiles[area]>>5)-2; numlights=(LightsInArea[area]-numtiles)>>1; if (numlights<0) numlights=0; if (numlights>GENERALNUMLIGHTS) numlights=GENERALNUMLIGHTS; targetmin=baseminshade+(GENERALNUMLIGHTS-numlights); targetmax=basemaxshade-numlights; if (targetmaxtargetmax) targetmin=targetmax; if (minshade>targetmin) minshade-=1; else if (minshadetargetmax) maxshade-=1; else if (maxshade31) maxshade=31; if (maxshade<0x10) maxshade=0x10; minshade-=level; if (minshade<0x10) minshade=0x10; if (minshade>31) minshade=31; } /* ========================== = = GetIlluminationDelta = ========================== */ int GetIlluminationDelta (void) { if (fog) return 0; else return maxshade-basemaxshade; } /* ========================== = = UpdateLightning = ========================== */ void UpdateLightning (void) { if (periodic==true) { UpdatePeriodicLighting(); return; } if ((fog==1) || (lightning==false)) return; if (lightningtime<=0) { if (lightningsoundtime>0) SD_Play3D (SD_LIGHTNINGSND, 0, lightningdistance); lightningtime=GameRandomNumber("UpdateLightning",0)<<1; lightningdistance=GameRandomNumber("UpdateLightning",0); lightninglevel=(255-lightningdistance)>>LIGHTNINGLEVEL; if (lightninglevelMAXLIGHTNINGLEVEL) lightninglevel=MAXLIGHTNINGLEVEL; lightningdelta=lightninglevel>>1; lightningsoundtime=lightningdistance>>1; if (lightningdistance<100) { SetIllumination(lightninglevel); } } else if (lightninglevel>0) { lightninglevel-=lightningdelta; if (lightninglevel<=0) { lightninglevel=0; } } else lightningtime--; if (lightningsoundtime) { lightningsoundtime--; if (lightningsoundtime<=0) { int volume; volume=255-lightningdistance; if (volume>170) volume=170; SD_PlayPitchedSound ( SD_LIGHTNINGSND, volume,-(lightningdistance<<2)); lightningsoundtime=0; } } } /* ========================== = = UpdatePeriodicLighting = ========================== */ #define PERIODICMAG (6) #define PERIODICSTEP (20) #define PERIODICBASE (0x0f) void UpdatePeriodicLighting (void) { int val; val=FixedMul(PERIODICMAG,sintable[periodictime]); periodictime=(periodictime+PERIODICSTEP)&(FINEANGLES-1); basemaxshade=PERIODICBASE+(PERIODICMAG)+val; baseminshade=basemaxshade-GENERALNUMLIGHTS-1; } /* ========================== = = SetModemLightLevel = ========================== */ void SetModemLightLevel ( int type ) { periodic=false; fulllight=false; switch (type) { case bo_light_dark: MAPSPOT(2,0,0)=(word)216; MAPSPOT(3,0,0)=(word)255; MAPSPOT(3,0,1)=(word)139; MAPSPOT(2,0,1)=(word)104; SetupLightLevels (); break; case bo_light_normal: break; case bo_light_bright: MAPSPOT(2,0,0)=(word)223; MAPSPOT(3,0,0)=(word)267; MAPSPOT(3,0,1)=(word)0; MAPSPOT(2,0,1)=(word)104; SetupLightLevels (); break; case bo_light_fog: MAPSPOT(2,0,0)=(word)219; MAPSPOT(3,0,0)=(word)259; MAPSPOT(2,0,1)=(word)105; MAPSPOT(3,0,1)=(word)0; SetupLightLevels (); break; case bo_light_periodic: fog=0; MAPSPOT(2,0,1)=(word)104; MAPSPOT(3,0,1)=(word)139; SetupLightLevels (); periodic=true; break; case bo_light_lightning: if (sky!=0) { MAPSPOT(2,0,0)=(word)222; MAPSPOT(3,0,0)=(word)255; MAPSPOT(3,0,1)=(word)139; MAPSPOT(2,0,1)=(word)104; SetupLightLevels (); lightning=true; } break; } } rott-20230810/rott/rt_view.h000066400000000000000000000072411446517470200156010ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //*************************************************************************** // // RT_VIEW.H // //*************************************************************************** #ifndef _rt_view_public #define _rt_view_public #include "modexlib.h" #define HEIGHTFRACTION 6 #define MAXVIEWSIZES 11 //#define FOCALWIDTH 160//160 //#define FPFOCALWIDTH 160.0//160.0 #define NUMGAMMALEVELS 8 #define GAMMAENTRIES (64*8) #define GENERALNUMLIGHTS (5) extern int StatusBar; // Kill count #define STATUS_KILLS 0x1 // Transparent health bar #define STATUS_PLAYER_STATS 0x2 // Bottom status bar #define BOTTOM_STATUS_BAR 0x4 // Top status bar #define TOP_STATUS_BAR 0x8 #define SHOW_KILLS() ( StatusBar & STATUS_KILLS ) #define SHOW_PLAYER_STATS() ( StatusBar & STATUS_PLAYER_STATS ) #define SHOW_BOTTOM_STATUS_BAR() ( StatusBar & BOTTOM_STATUS_BAR ) #define SHOW_TOP_STATUS_BAR() ( StatusBar & TOP_STATUS_BAR ) #define YOURCPUSUCKS_Y ( 100 + 48 / 2 + 2 ) #define YOURCPUSUCKS_HEIGHT 8 #define MAXPLAYERCOLORS (11) typedef enum { pc_gray, pc_brown, pc_black, pc_tan, pc_red, pc_olive, pc_blue, pc_white, pc_green, pc_purple, pc_orange } playercolors; extern byte * playermaps[MAXPLAYERCOLORS]; //extern short pixelangle[MAXVIEWWIDTH]; extern short pixelangle[800]; extern byte gammatable[GAMMAENTRIES]; extern int gammaindex; extern byte uniformcolors[MAXPLAYERCOLORS]; extern byte mapmasks1[4][9]; // Map Mask for post scaling extern byte mapmasks2[4][9]; // Map Mask for post scaling extern byte mapmasks3[4][9]; // Map Mask for post scaling extern int normalshade; // Normal shading level for stuff extern int maxshade; // max shading level extern int minshade; // min shading level extern int baseminshade; extern int basemaxshade; extern int viewheight; extern int viewwidth; extern longword heightnumerator; extern fixed scale; extern int screenofs; extern int centerx; extern int centery; extern int centeryfrac; extern int fulllight; extern byte * colormap; extern byte * greenmap; extern byte * redmap; extern int weaponscale; extern int viewsize; extern int focalwidth; extern int yzangleconverter; extern int lightninglevel; extern boolean lightning; extern int darknesslevel; void DrawCPUJape( void ); void SetupScreen ( boolean flip ); void ResetFocalWidth ( void ); void ChangeFocalWidth ( int amount ); void SetViewSize ( int size ); void LoadColorMap( void ); void UpdateLightLevel (int area); void SetIllumination (int level); int GetIlluminationDelta (void); void UpdateLightning (void); void SetLightLevels ( int darkness ); void SetupLightLevels ( void ); void SetLightRate ( int rate ); int GetLightRate ( void ); void SetModemLightLevel ( int type ); int GetLightRateTile ( void ); int GetLightLevelTile ( void ); #endif rott-20230810/rott/sbconfig.h000066400000000000000000000073261446517470200157200ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 SBCONFIG_H #define SBCONFIG_H /* ----------------------------------------------------------------------- */ /* See the bottom of this file for a syntax diagram for the config file */ #define MAX_STRING_LENGTH 40 /* ----------------------------------------------------------------------- */ //typedef long fixed; /* 16.16 fixed pt number */ #define INT_TO_FIXED(n) ((fixed)((long)(n)<<16)) #define FIXED_TO_INT(n) ((long)((n)>>16)) #define FLOAT_TO_FIXED(n) ((fixed)((n)*65536.0)) #define FIXED_ADD(a, b) ((a)+(b)) #define FIXED_SUB(a, b) ((a)-(b)) /* ----------------------------------------------------------------------- */ typedef struct { short low; /* range of input values this warp covers */ short high; fixed mult; /* multiplier to be applied to this range */ } WarpRange; typedef struct { char name[MAX_STRING_LENGTH]; WarpRange *pWarp; int nWarp; } WarpRecord; /* ----------------------------------------------------------------------- */ /* Parse the config file */ int SbConfigParse(char *filename); /* Get the button config name for the button named or return NULL * if none exists. can be either the left or the right side name. * So, for the config line: * * BUTTON_A MY_BUTTON * * ConfigGetButton("BUTTON_A") will return "MY_BUTTON" * ConfigGetButton("MY_BUTTON") will return "BUTTON_A" * * Note that this makes it illegal to have game button names have the names * "BUTTON_A", "BUTTON_B", "BUTTON_C", etc... * * Also, the comparison is CASE INSENSITIVE. */ char *SbConfigGetButton(char *btnName); int SbConfigGetButtonNumber(char *btnName); /* * Get the warp ranges for the config range named or return NULL * if none exists. */ WarpRecord *SbConfigGetWarpRange(char *rngName); /* * Warp a value based on the given warp range */ fixed SbFxConfigWarp(WarpRecord *warp, short value); /* returns fixed pt */ long SbConfigWarp(WarpRecord *warp, short value); /* returns integer */ /* ----------------------------------------------------------------------- */ /* Lexical Definitions: ** ** comment: ;[^\n]*\n ** integer: [0-9]+ ** identifier: [A-Za-z_][A-Za-z_0-9]* ** */ /* Syntax Diagram: (Line by Line parsing) ** ** ** ConfigFile: ** | ConfigLine ConfigFile ** ; ** ** ConfigLine: ** | comment ** | VersionLine comment ** | ButtonLine comment ** | RangeLine comment ** ; ** ** VersionLine: 'VERSION' integer ** ; ** ** ButtonLine: 'BUTTON_A' identifier ** | 'BUTTON_B' identifier ** | 'BUTTON_C' identifier ** | 'BUTTON_D' identifier ** | 'BUTTON_E' identifier ** | 'BUTTON_F' identifier ** ; ** ** RangeLine: identifier '{' RangeList '}' ** ; ** ** RangeList: ** | '{' integer ',' integer ',' integer '}' ** | '{' integer ',' integer ',' integer '}' ',' RangeList ** ; ** */ /* ----------------------------------------------------------------------- */ #endif rott-20230810/rott/scriplib.c000066400000000000000000000130571446517470200157260ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ // scriplib.c #include #include #include "rt_def.h" #include "scriplib.h" #include "rt_util.h" /* ============================================================================= PARSING STUFF ============================================================================= */ char token[MAXTOKEN]; char name[MAXTOKEN*2]; char scriptfilename[512]; char *scriptbuffer,*script_p,*scriptend_p; int scriptline; boolean endofscript; boolean tokenready; // only true if UnGetToken was just called /* ============== = = LoadScriptFile = ============== */ void LoadScriptFile (char *filename) { long size; size = LoadFile (filename, (void **)&scriptbuffer); snprintf(scriptfilename, sizeof(scriptfilename), "%s", filename); script_p = scriptbuffer; scriptend_p = script_p + size; scriptline = 1; endofscript = false; tokenready = false; } /* ============== = = UnGetToken = = Signals that the current token was not used, and should be reported = for the next GetToken. Note that GetToken (true); UnGetToken (); GetToken (false); = could cross a line boundary. = ============== */ void UnGetToken (void) { tokenready = true; } /* ============== = = GetToken = ============== */ void GetToken (boolean crossline) { char *token_p; if (tokenready) // is a token allready waiting? { tokenready = false; return; } if (script_p >= scriptend_p) { if (!crossline) Error ("Line %i is incomplete\nin file %s\n", scriptline,scriptfilename); endofscript = true; return; } // // skip space // skipspace: while (*script_p <= 32) { if (script_p >= scriptend_p) { if (!crossline) Error ("Line %i is incomplete\nin file %s\n", scriptline,scriptfilename); endofscript = true; return; } if (*script_p++ == '\n') { if (!crossline) Error ("Line %i is incomplete\nin file %s\n", scriptline,scriptfilename); scriptline++; } } if (script_p >= scriptend_p) { if (!crossline) Error ("Line %i is incomplete\nin file %s\n", scriptline,scriptfilename); endofscript = true; return; } if (*script_p == ';') // semicolon is comment field { if (!crossline) Error ("Line %i is incomplete\nin file %s\n", scriptline,scriptfilename); while (*script_p++ != '\n') if (script_p >= scriptend_p) { endofscript = true; return; } goto skipspace; } // // copy token // token_p = token; while ( *script_p > 32 && *script_p != ';') { *token_p++ = *script_p++; if (script_p == scriptend_p) break; if (token_p == &token[MAXTOKEN]) Error ("Token too large on line %i\nin file %s\n", scriptline,scriptfilename); } *token_p = 0; } /* ============== = = GetTokenEOL = ============== */ void GetTokenEOL (boolean crossline) { char *name_p; if (tokenready) // is a token allready waiting? { tokenready = false; return; } if (script_p >= scriptend_p) { if (!crossline) Error ("Line %i is incomplete\nin file %s\n", scriptline,scriptfilename); endofscript = true; return; } // // skip space // skipspace: while (*script_p <= 32) { if (script_p >= scriptend_p) { if (!crossline) Error ("Line %i is incomplete\nin file %s\n", scriptline,scriptfilename); endofscript = true; return; } if (*script_p++ == '\n') { if (!crossline) Error ("Line %i is incomplete\nin file %s\n", scriptline,scriptfilename); scriptline++; } } if (script_p >= scriptend_p) { if (!crossline) Error ("Line %i is incomplete\nin file %s\n", scriptline,scriptfilename); endofscript = true; return; } if (*script_p == ';') // semicolon is comment field { if (!crossline) Error ("Line %i is incomplete\nin file %s\n", scriptline,scriptfilename); while (*script_p++ != '\n') if (script_p >= scriptend_p) { endofscript = true; return; } goto skipspace; } // // copy token // name_p = name; while (*script_p >= 32) { *name_p++ = *script_p++; if (script_p == scriptend_p) break; if (name_p == &name[MAXTOKEN*2]) Error ("Name too large on line %i\nin file %s\n", scriptline,scriptfilename); } *name_p = 0; } /* ============== = = TokenAvailable = = Returns true if there is another token on the line = ============== */ boolean TokenAvailable (void) { char *search_p; search_p = script_p; if (search_p >= scriptend_p) return false; while ( *search_p <= 32) { if (*search_p == '\n') return false; search_p++; if (search_p == scriptend_p) return false; } if (*search_p == ';') return false; return true; } rott-20230810/rott/scriplib.h000066400000000000000000000023221446517470200157240ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ // scriplib.h #ifndef _scriplib_public #define _scriplib_public #define MAXTOKEN 128 extern char token[MAXTOKEN]; extern char name[MAXTOKEN*2]; extern char *scriptbuffer,*script_p,*scriptend_p; extern int scriptline; extern boolean endofscript; extern boolean tokenready; // only true if UnGetToken was just called void LoadScriptFile (char *filename); void GetToken (boolean crossline); void GetTokenEOL (boolean crossline); void UnGetToken (void); boolean TokenAvailable (void); #endif rott-20230810/rott/snd_reg.h000066400000000000000000002061101446517470200155370ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ typedef enum { // MENU SOUNDS D_MENUFLIP, D_ESCPRESSEDSND, D_MOVECURSORSND, D_SELECTSND, D_WARNINGBOXSND, D_INFOBOXSND, D_QUESTIONBOXSND, D_NOPESND, D_QUIT1SND, D_QUIT2SND, D_QUIT3SND, D_QUIT4SND, D_QUIT5SND, D_QUIT6SND, D_QUIT7SND, // GAME SOUNDS D_LEVELSTARTSND, D_LEVELDONESND, D_GAMEOVERSND, // LEVEL END SCREEN D_ENDBONUS1SND, D_NOBONUSSND, D_PERCENT100SND, // PLAYER SOUNDS D_HITWALLSND, D_SELECTWPNSND, D_NOWAYSND, D_DONOTHINGSND, // D_NOITEMSND, D_PLAYERDYINGSND, D_PLAYERTBDEATHSND, D_PLAYERTCDEATHSND, D_PLAYERLNDEATHSND, D_PLAYERDWDEATHSND, D_PLAYERIPFDEATHSND, D_PLAYERTBHURTSND, D_PLAYERTCHURTSND, D_PLAYERLNHURTSND, D_PLAYERDWHURTSND, D_PLAYERIPFHURTSND, D_PLAYERTBSND, D_PLAYERTCSND, D_PLAYERLNSND, D_PLAYERDWSND, D_PLAYERIPFSND, // D_WALK1SND, // D_WALK2SND, D_PLAYERBURNEDSND, D_PLAYERLANDSND, D_PLAYERCOUGHMSND, D_PLAYERCOUGHFSND, D_NETWIGGLESND, D_NETFALLSND, // PLAYER WEAPONS D_ATKPISTOLSND, D_ATKTWOPISTOLSND, D_ATKMP40SND, D_RICOCHET1SND, D_RICOCHET2SND, D_RICOCHET3SND, D_BAZOOKAFIRESND, D_FIREBOMBFIRESND, D_HEATSEEKFIRESND, D_DRUNKFIRESND, D_FLAMEWALLFIRESND, D_FLAMEWALLSND, D_SPLITFIRESND, D_SPLITSND, D_GRAVBUILDSND, D_GRAVFIRESND, D_GRAVSND, D_GRAVHITSND, D_FIREHITSND, D_MISSILEFLYSND, D_MISSILEHITSND, D_EXCALIBOUNCESND, D_EXCALISWINGSND, D_EXCALIHITSND, D_EXCALIBUILDSND, D_EXCALIBLASTSND, D_GODMODEFIRESND, D_GODMODE1SND, D_GODMODE2SND, D_GODMODE3SND, D_LOSEMODESND, D_DOGMODEPANTSND, D_DOGMODEBITE1SND, D_DOGMODEBITE2SND, D_DOGMODELICKSND, D_DOGMODEBLASTSND, D_DOGMODEPREPBLASTSND, D_DOGMANSND, D_DOGWOMANSND, D_GODMANSND, D_GODWOMANSND, D_FLYINGSND, // PLAYER-CAUSED SOUNDS D_GLASSBREAKSND, D_ITEMBLOWSND, D_BONUSBARRELSND, D_TOUCHPLATESND, D_BADTOUCHSND, D_EXPLODEFLOORSND, D_EXPLODESND, // D_GASSTARTSND, D_GASHISSSND, D_GASENDSND, D_GASMASKSND, // GET ITEM SOUNDS D_GETKEYSND, D_GETBONUSSND, D_GETHEALTH1SND, D_GETHEALTH2SND, D_COOKHEALTHSND, D_GETWEAPONSND, D_GETKNIFESND, D_GETGODSND, D_GETDOGSND, D_GETFLEETSND, D_GETELASTSND, D_GETSHROOMSSND, D_GETBVESTSND, D_GETAVESTSND, D_GETMASKSND, D_GETBATSND, D_GETHEADSND, D_GET1UPSND, D_GET3UPSND, D_RESPAWNSND, D_PLAYERSPAWNSND, // ACTOR SOUNDS D_LOWGUARD1SEESND, D_LOWGUARD1ASEESND, D_LOWGUARD1SEE2SND, // D_LOWGUARD2SEESND, // D_LOWGUARD2ASEESND, // D_LOWGUARD2SEE2SND, D_LOWGUARDOUCHSND, D_LOWGUARD1DIESND, // D_LOWGUARD2DIESND, D_SNEAKYSPRINGMSND, // D_SNEAKYSPRINGFSND, D_HIGHGUARD1SEESND, D_HIGHGUARD2SEESND, D_HIGHGUARDOUCHSND, D_HIGHGUARDDIESND, D_OVERP1SEESND, // D_OVERP2SEESND, D_OVERPNETSND, D_OVERPOUCHSND, D_OVERPDIESND, D_STRIKE1SEESND, // D_STRIKE2SEESND, D_STRIKEROLLSND, D_STRIKEOUCHSND, D_STRIKEDIESND, D_BLITZ1SEESND, D_BLITZ2SEESND, D_BLITZSTEALSND, D_BLITZOUCHSND, D_BLITZDIESND, D_BLITZPLEADSND, D_BLITZPLEAD1SND, D_BLITZPLEAD2SND, D_ENFORCERSEESND, D_ENFORCERFIRESND, D_ENFORCERTHROWSND, D_ENFORCEROUCHSND, D_ENFORCERDIESND, D_MONKSEESND, D_MONKGRABSND, D_MONKOUCHSND, D_MONKDIESND, D_FIREMONKSEESND, D_FIREMONKFIRESND, D_FIREMONKOUCHSND, D_FIREMONKDIESND, D_ROBOTSEESND, D_ROBOTFIRESND, D_ROBOTDIESND, D_DARIANSEESND, D_DARIANGONNAUSESND, D_DARIANHIDESND, D_DARIANDIESND, D_DARIANSAY1, D_DARIANSAY2, D_DARIANSAY3, D_KRISTSEESND, D_KRISTMOTORSND, D_KRISTTURNSND, D_KRISTDROPSND, D_KRISTMINEBEEPSND, D_KRISTMINEHITSND, D_KRISTDIESND, D_KRISTSAY1, D_KRISTSAY2, D_KRISTSAY3, D_NMESEESND, D_NMEREADYSND, D_NMEAPARTSND, D_NMEUFOSND, D_DARKMONKSEESND, D_DARKMONKFIRE1SND, D_DARKMONKFIRE2SND, D_DARKMONKFIRE3SND, D_DARKMONKFIRE4SND, D_DARKMONKRECHARGESND, D_DARKMONKFLOATSND, D_DARKMONKDIESND, D_DARKMONKSAY1, D_DARKMONKSAY2, D_DARKMONKSAY3, D_SNAKESEESND, D_SNAKEREADYSND, D_SNAKECHARGESND, D_SNAKEOUCHSND, D_SNAKEDIESND, D_SNAKESPITSND, D_SNAKESAY1, D_SNAKESAY2, D_SNAKESAY3, D_EMPLACEMENTSEESND, D_EMPLACEMENTFIRESND, D_BIGEMPLACEFIRESND, // ENVIRONMENT SOUNDS D_OPENDOORSND, D_CLOSEDOORSND, D_DOORHITSND, D_FIRECHUTESND, D_FIREBALLSND, D_FIREBALLHITSND, D_BLADESPINSND, D_PUSHWALLSND, D_PUSHWALLHITSND, D_GOWALLSND, D_TURBOWALLSND, D_BOULDERHITSND, D_BOULDERROLLSND, D_PITTRAPSND, D_FIREJETSND, D_ACTORSQUISHSND, D_ACTORBURNEDSND, D_ACTORSKELETONSND, D_SPEARSTABSND, D_CYLINDERMOVESND, D_ELEVATORONSND, D_ELEVATORENDSND, D_SPRINGBOARDSND, D_LIGHTNINGSND, D_WINDSND, // D_WATERSND, // SECRET SOUNDS D_DOPEFISHSND, D_YOUSUCKSND, D_SILLYMOVESND, D_SOUNDSELECTSND, D_SOUNDESCSND, D_BODYLANDSND, D_GIBSPLASHSND, D_ACTORLANDSND, D_LASTSOUND=-1 } digisounds; static sound_t sounds[MAXSOUNDS] = { //SD_MENUFLIP, //|-------DIGITAL--------|---------MUSE---------|----FLAGS---| {{D_MENUFLIP, MUSE_MENUFLIPSND, }, 0,SD_PRIOMENU, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ESCPRESSEDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ESCPRESSEDSND, MUSE_ESCPRESSEDSND, }, 0,SD_PRIOMENU, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_MOVECURSORSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_MOVECURSORSND, MUSE_MOVECURSORSND, }, 0,SD_PRIOMENU, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SELECTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SELECTSND, MUSE_SELECTSND, }, 0,SD_PRIOMENU, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_WARNINGBOXSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_WARNINGBOXSND, MUSE_WARNINGBOXSND, }, 0,SD_PRIOMENU, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_INFOBOXSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_INFOBOXSND, MUSE_INFOBOXSND, }, 0,SD_PRIOMENU, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_QUESTIONBOXSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_QUESTIONBOXSND, MUSE_QUESTIONBOXSND, }, 0,SD_PRIOMENU, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NOPESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_NOPESND, MUSE_NOPESND, }, 0,SD_PRIOMENU, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_QUIT1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_QUIT1SND, MUSE_SELECTSND, }, 0,SD_PRIOQUIT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_QUIT2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_QUIT2SND, MUSE_SELECTSND, }, 0,SD_PRIOQUIT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_QUIT3SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_QUIT3SND, MUSE_SELECTSND, }, 0,SD_PRIOQUIT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_QUIT4SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_QUIT4SND, MUSE_SELECTSND, }, 0,SD_PRIOQUIT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_QUIT5SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_QUIT5SND, MUSE_SELECTSND, }, 0,SD_PRIOQUIT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_QUIT6SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_QUIT6SND, MUSE_SELECTSND, }, 0,SD_PRIOQUIT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_QUIT7SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_QUIT7SND, MUSE_SELECTSND, }, 0,SD_PRIOQUIT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LEVELSTARTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LEVELSTARTSND, MUSE_LEVELSTARTSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LEVELDONESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LEVELDONESND, MUSE_LEVELENDSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GAMEOVERSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GAMEOVERSND, MUSE_GAMEOVERSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ENDBONUS1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ENDBONUS1SND, MUSE_ENDBONUS1SND, }, SD_PITCHSHIFTOFF,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NOBONUSSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_NOBONUSSND, MUSE_NOBONUSSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PERCENT100SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PERCENT100SND, MUSE_PERCENT100SND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_HITWALLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_HITWALLSND, MUSE_HITWALLSND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SELECTWPNSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SELECTWPNSND, MUSE_SELECTWPNSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NOWAYSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_NOWAYSND, MUSE_NOWAYSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DONOTHINGSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DONOTHINGSND, MUSE_DONOTHINGSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NOITEMSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_NOWAYSND, MUSE_NOITEMSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERDYINGSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERDYINGSND, MUSE_PLAYERDYINGSND, }, SD_PITCHSHIFTOFF,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERTCDEATHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCDEATHSND, MUSE_PLAYERDEATHSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERTBDEATHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTBDEATHSND, MUSE_PLAYERDEATHSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERDWDEATHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERDWDEATHSND, MUSE_PLAYERDEATHSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERLNDEATHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERLNDEATHSND, MUSE_PLAYERDEATHSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERIPFDEATHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERIPFDEATHSND, MUSE_PLAYERDEATHSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERTCHURTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCHURTSND, MUSE_PLAYERHURTSND, }, SD_PLAYONCE, SD_PRIOPHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERTBHURTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTBHURTSND, MUSE_PLAYERHURTSND, }, SD_PLAYONCE, SD_PRIOPHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERDWHURTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERDWHURTSND, MUSE_PLAYERHURTSND, }, SD_PLAYONCE, SD_PRIOPHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERLNHURTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERLNHURTSND, MUSE_PLAYERHURTSND, }, SD_PLAYONCE, SD_PRIOPHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERIPFHURTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERIPFHURTSND, MUSE_PLAYERHURTSND, }, SD_PLAYONCE, SD_PRIOPHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERTCSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCSND, MUSE_PLAYERYESSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERTBSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTBSND, MUSE_PLAYERYESSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERDWSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERDWSND, MUSE_PLAYERYESSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERLNSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERLNSND, MUSE_PLAYERYESSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERIPFSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERIPFSND, MUSE_PLAYERYESSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_WALK1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| // {{D_WALK1SND, MUSE_WALK1SND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_WALK2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| // {{D_WALK2SND, MUSE_WALK2SND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERBURNEDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERBURNEDSND, MUSE_PLAYERHURTSND, }, SD_PLAYONCE,SD_PRIOPHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERLANDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERLANDSND, MUSE_PLAYERLANDSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERCOUGHMSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERCOUGHMSND, MUSE_LASTSOUND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERCOUGHFSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERCOUGHFSND, MUSE_LASTSOUND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NETWIGGLESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_NETWIGGLESND, MUSE_LASTSOUND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NETFALLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_NETFALLSND, MUSE_NETFALLSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ATKPISTOLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ATKPISTOLSND, MUSE_ATKPISTOLSND, }, SD_WRITE,SD_PRIOPGUNS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ATKTWOPISTOLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ATKTWOPISTOLSND, MUSE_ATKPISTOLSND, }, SD_WRITE,SD_PRIOPGUNS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ATKMP40SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ATKMP40SND, MUSE_ATKMP40SND, }, SD_WRITE,SD_PRIOPMP40, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_RICOCHET1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_RICOCHET1SND, MUSE_RICOCHETSND, }, SD_WRITE,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_RICOCHET2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_RICOCHET2SND, MUSE_RICOCHETSND, }, SD_WRITE,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_RICOCHET3SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_RICOCHET3SND, MUSE_RICOCHETSND, }, SD_WRITE,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BAZOOKAFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BAZOOKAFIRESND, MUSE_MISSILEFIRESND, }, SD_WRITE,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREBOMBFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FIREBOMBFIRESND, MUSE_MISSILEFIRESND, }, SD_WRITE,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_HEATSEEKFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_HEATSEEKFIRESND, MUSE_MISSILEFIRESND, }, SD_WRITE,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DRUNKFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DRUNKFIRESND, MUSE_MISSILEFIRESND, }, SD_WRITE,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FLAMEWALLFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FLAMEWALLFIRESND, MUSE_MISSILEFIRESND, }, SD_WRITE,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FLAMEWALLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FLAMEWALLSND, MUSE_FLAMEWALLSND, }, 0,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SPLITFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SPLITFIRESND, MUSE_MISSILEFIRESND, }, 0,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SPLITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SPLITSND, MUSE_MISSILEFIRESND, }, 0,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GRAVBUILDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GRAVBUILDSND, MUSE_WEAPONBUILDSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GRAVFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GRAVFIRESND, MUSE_ENERGYFIRESND, }, 0,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GRAVSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GRAVSND, MUSE_LASTSOUND, }, 0,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GRAVHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GRAVHITSND, MUSE_MISSILEHITSND, }, 0,SD_PRIOEXPL, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FIREHITSND, MUSE_MISSILEHITSND, }, 0,SD_PRIOEXPL, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_MISSILEFLYSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_MISSILEFLYSND, MUSE_LASTSOUND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_MISSILEHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_MISSILEHITSND, MUSE_MISSILEHITSND, }, 0,SD_PRIOEXPL, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EXCALIBOUNCESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_EXCALIBOUNCESND, MUSE_LASTSOUND, }, 0,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EXCALISWINGSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_EXCALISWINGSND, MUSE_MISSILEFIRESND, }, 0,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EXCALIHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_EXCALIHITSND, MUSE_MISSILEHITSND, }, 0,SD_PRIOEXPL, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EXCALIBUILDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_EXCALIBUILDSND, MUSE_WEAPONBUILDSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EXCALIBLASTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_EXCALIBLASTSND, MUSE_ENERGYFIRESND, }, 0,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GODMODEFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GODMODEFIRESND, MUSE_ENERGYFIRESND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GODMODE1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GODMODE1SND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GODMODE2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GODMODE2SND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GODMODE3SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GODMODE3SND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOSEMODESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOSEMODESND, MUSE_LOSEMODESND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOGMODEPANTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DOGMODEPANTSND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOGMODEBITE1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DOGMODEBITE1SND, MUSE_DOGBITESND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOGMODEBITE2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DOGMODEBITE2SND, MUSE_DOGBITESND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOGMODELICKSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DOGMODELICKSND, MUSE_DOGLICKSND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOGMODEBLASTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DOGMODEBLASTSND, MUSE_DOGBITESND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOGMODEPREPBLASTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DOGMODEPREPBLASTSND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOGMANSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DOGMANSND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOGWOMANSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DOGWOMANSND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GODMANSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GODMANSND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GODWOMANSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GODWOMANSND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FLYINGSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FLYINGSND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GLASSBREAKSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GLASSBREAKSND, MUSE_GLASSBREAKSND, }, 0,SD_PRIOGLASS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ITEMBLOWSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ITEMBLOWSND, MUSE_EXPLOSIONSND, }, 0,SD_PRIOEXPL, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BONUSBARRELSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BONUSBARRELSND, MUSE_EXPLOSIONSND, }, 0,SD_PRIOEXPL, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_TOUCHPLATESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_TOUCHPLATESND, MUSE_TOUCHPLATESND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BADTOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BADTOUCHSND, MUSE_BADTOUCHSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EXPLODEFLOORSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_EXPLODEFLOORSND, MUSE_EXPLOSIONSND, }, 0,SD_PRIOEXPL, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EXPLODESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_EXPLODESND, MUSE_EXPLOSIONSND, }, 0,SD_PRIOEXPL, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GASSTARTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_TOUCHPLATESND, MUSE_SWITCHSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GASHISSSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GASHISSSND, MUSE_LASTSOUND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GASENDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GASENDSND, MUSE_SWITCHSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GASMASKSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GASMASKSND, MUSE_LASTSOUND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETKEYSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETKEYSND, MUSE_GETKEYSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETBONUSSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETBONUSSND, MUSE_GETBONUSSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETHEALTH1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETHEALTH1SND, MUSE_GETHEALTHSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETHEALTH2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETHEALTH2SND, MUSE_GETHEALTHSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_COOKHEALTHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_COOKHEALTHSND, MUSE_GETBONUSSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETWEAPONSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETWEAPONSND, MUSE_GETWEAPONSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETKNIFESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETKNIFESND, MUSE_GETWEAPONSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETGODSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETGODSND, MUSE_GETPOWERUPSND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETDOGSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETDOGSND, MUSE_GETPOWERUPSND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETFLEETSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETFLEETSND, MUSE_GETPOWERUPSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETELASTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETELASTSND, MUSE_GETPOWERDOWNSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETSHROOMSSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETSHROOMSSND, MUSE_GETPOWERDOWNSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETBVESTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETBVESTSND, MUSE_GETARMORSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETAVESTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETAVESTSND, MUSE_GETARMORSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETMASKSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETMASKSND, MUSE_GETARMORSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETBATSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETBATSND, MUSE_GETWEIRDSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETHEADSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETHEADSND, MUSE_GETWEIRDSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GET1UPSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GET1UPSND, MUSE_GETLIFESND, }, SD_PITCHSHIFTOFF,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GET3UPSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GET3UPSND, MUSE_GETLIFESND, }, SD_PITCHSHIFTOFF,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_RESPAWNSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_RESPAWNSND, MUSE_GETBONUSSND, }, SD_PITCHSHIFTOFF,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERSPAWNSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERSPAWNSND, MUSE_GETLIFESND, }, SD_PITCHSHIFTOFF,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARD1SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARD1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARD1ASEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARD1ASEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARD1SEE3SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARD1SEE2SND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARD2SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARD1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARD2ASEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARD1ASEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARD2SEE3SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARD1SEE2SND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARDFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ATKPISTOLSND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARDOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARDOUCHSND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARD1DIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARD1DIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARD2DIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARD1DIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNEAKYSPRINGMSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SNEAKYSPRINGMSND, MUSE_ACTORDOITSND, }, 0,SD_PRIOASNEAK, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNEAKYSPRINGFSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SNEAKYSPRINGMSND, MUSE_ACTORDOITSND, }, 0,SD_PRIOASNEAK, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_HIGHGUARD1SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_HIGHGUARD1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_HIGHGUARD2SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_HIGHGUARD2SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_HIGHGUARDFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ATKMP40SND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_HIGHGUARDOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_HIGHGUARDOUCHSND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_HIGHGUARDDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_HIGHGUARDDIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_OVERP1SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_OVERP1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_OVERP2SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_OVERP1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_OVERPFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ATKPISTOLSND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_OVERPNETSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_OVERPNETSND, MUSE_ACTORTHROWSND, }, 0,SD_PRIOASNEAK, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_OVERPOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_OVERPOUCHSND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_OVERPDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_OVERPDIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_STRIKE1SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_STRIKE1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_STRIKE2SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_STRIKE1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_STRIKEFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ATKPISTOLSND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_STRIKEROLLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_STRIKEROLLSND, MUSE_ACTORROLLSND, }, 0,SD_PRIOASNEAK, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_STRIKEOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_STRIKEOUCHSND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_STRIKEDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_STRIKEDIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZ1SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLITZ1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZ2SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLITZ2SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ATKPISTOLSND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZSTEALSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLITZSTEALSND, MUSE_GETPOWERDOWNSND, }, 0,SD_PRIOASNEAK, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLITZOUCHSND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLITZDIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZPLEADSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLITZPLEADSND, MUSE_LASTSOUND, }, SD_PLAYONCE,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZPLEAD1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLITZPLEAD1SND, MUSE_LASTSOUND, }, SD_PLAYONCE,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZPLEAD2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLITZPLEAD2SND, MUSE_LASTSOUND, }, SD_PLAYONCE,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ENFORCERSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ENFORCERSEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ENFORCERFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ENFORCERFIRESND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ENFORCERTHROWSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ENFORCERTHROWSND, MUSE_ACTORTHROWSND, }, 0,SD_PRIOASNEAK, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ENFORCEROUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ENFORCEROUCHSND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ENFORCERDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ENFORCERDIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_MONKSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_MONKSEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_MONKGRABSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_MONKGRABSND, MUSE_ACTORDOITSND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_MONKOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_MONKOUCHSND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_MONKDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_MONKDIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREMONKSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FIREMONKSEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREMONKFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FIREMONKFIRESND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREMONKOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FIREMONKOUCHSND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREMONKDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FIREMONKDIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ROBOTSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ROBOTSEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ROBOTFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ROBOTFIRESND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ROBOTDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ROBOTDIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ROBOTMOVESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_KRISTMOTORSND, MUSE_LASTSOUND, }, SD_PLAYONCE,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BALLISTIKRAFTSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BAZOOKAFIRESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BALLISTIKRAFTFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ROBOTFIRESND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARIANSEESND, MUSE_BOSSSEESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BAZOOKAFIRESND, MUSE_BOSSFIRESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANGONNAUSESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARIANGONNAUSESND, MUSE_BOSSDOSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANUSESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_TOUCHPLATESND, MUSE_BOSSDOSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANHIDESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARIANHIDESND, MUSE_BOSSDOSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARIANDIESND, MUSE_BOSSDIESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANSAY1, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARIANSAY1, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANSAY2, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARIANSAY2, MUSE_BOSSHEYSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANSAY3, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARIANSAY3, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_KRISTSEESND, MUSE_BOSSSEESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BAZOOKAFIRESND, MUSE_BOSSFIRESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTMOTORSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_KRISTMOTORSND, MUSE_LASTSOUND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTTURNSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_KRISTTURNSND, MUSE_BOSSBEEPSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTDROPSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_KRISTDROPSND, MUSE_BOSSDOSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTMINEBEEPSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_KRISTMINEBEEPSND, MUSE_BOSSBEEPSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTMINEHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_KRISTMINEHITSND, MUSE_MISSILEHITSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_KRISTDIESND, MUSE_BOSSDIESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTSAY1, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_KRISTSAY1, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTSAY2, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_KRISTSAY2, MUSE_BOSSHEYSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTSAY3, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_KRISTSAY3, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NMESEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_NMESEESND, MUSE_BOSSSEESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NMEREADYSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_NMEREADYSND, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NMEFIRE1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BAZOOKAFIRESND, MUSE_BOSSFIRESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NMEAPARTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_NMEAPARTSND, MUSE_BOSSBEEPSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NMEUFOSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_NMEUFOSND, MUSE_MISSILEFIRESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NMEDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_EXPLODESND, MUSE_BOSSDIESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARKMONKSEESND, MUSE_BOSSSEESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKFIRE1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARKMONKFIRE1SND, MUSE_BOSSFIRESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKFIRE2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARKMONKFIRE2SND, MUSE_BOSSFIRE2SND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKFIRE3SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARKMONKFIRE3SND, MUSE_BOSSFIRESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKFIRE4SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARKMONKFIRE4SND, MUSE_BOSSFIRE2SND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKRECHARGESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARKMONKRECHARGESND, MUSE_WEAPONBUILDSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKFLOATSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARKMONKFLOATSND, MUSE_LASTSOUND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARKMONKDIESND, MUSE_BOSSDIESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKSAY1, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARKMONKSAY1, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKSAY2, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARKMONKSAY2, MUSE_BOSSHEYSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKSAY3, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DARKMONKSAY3, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKESEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SNAKESEESND, MUSE_BOSSSEESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKEREADYSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SNAKEREADYSND, MUSE_BOSSBEEPSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKECHARGESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SNAKECHARGESND, MUSE_WEAPONBUILDSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKEOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SNAKEOUCHSND, MUSE_BOSSOUCHSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKEDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SNAKEDIESND, MUSE_BOSSDIESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKESPITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SNAKESPITSND, MUSE_BOSSFIRESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKESAY1, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SNAKESAY1, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKESAY2, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SNAKESAY2, MUSE_BOSSHEYSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKESAY3, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SNAKESAY3, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EMPLACEMENTSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_EMPLACEMENTSEESND, MUSE_SWITCHSND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EMPLACEMENTFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_EMPLACEMENTFIRESND, MUSE_EMPFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BIGEMPLACEFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BIGEMPLACEFIRESND, MUSE_EMPFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_OPENDOORSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_OPENDOORSND, MUSE_OPENDOORSND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_CLOSEDOORSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_CLOSEDOORSND, MUSE_CLOSEDOORSND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOORHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ELEVATORENDSND, MUSE_LASTSOUND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIRECHUTESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FIRECHUTESND, MUSE_MISSILEFIRESND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREBALLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FIREBALLSND, MUSE_LASTSOUND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREBALLHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FIREBALLHITSND, MUSE_MISSILEHITSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLADESPINSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLADESPINSND, MUSE_SPINBLADESND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PUSHWALLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PUSHWALLSND, MUSE_PUSHWALLSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PUSHWALLHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PUSHWALLHITSND, MUSE_MISSILEHITSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GOWALLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GOWALLSND, MUSE_PUSHWALLSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_TURBOWALLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_TURBOWALLSND, MUSE_PUSHWALLSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BOULDERHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BOULDERHITSND, MUSE_MISSILEHITSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BOULDERROLLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BOULDERROLLSND, MUSE_BOULDERSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BOULDERFALLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BOULDERHITSND, MUSE_PITTRAPSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PITTRAPSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PITTRAPSND, MUSE_PITTRAPSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREJETSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FIREJETSND, MUSE_FIREJETSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ACTORSQUISHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ACTORSQUISHSND, MUSE_ACTORSQUISHSND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ACTORBURNEDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ACTORBURNEDSND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ACTORSKELETONSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ACTORSKELETONSND, MUSE_LASTSOUND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SPEARSTABSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SPEARSTABSND, MUSE_STABBERSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_CYLINDERMOVESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_CYLINDERMOVESND, MUSE_CYLINDERHITSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ELEVATORONSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ELEVATORONSND, MUSE_ELEVATORSND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ELEVATORENDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ELEVATORENDSND, MUSE_LASTSOUND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SPRINGBOARDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SPRINGBOARDSND, MUSE_SPRINGBOARDSND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LIGHTNINGSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LIGHTNINGSND, MUSE_LASTSOUND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_WINDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_WINDSND, MUSE_LASTSOUND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_WATERSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BODYLANDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BODYLANDSND, MUSE_LASTSOUND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GIBSPLASHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GIBSPLASHSND, MUSE_LASTSOUND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ACTORLANDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ACTORLANDSND, MUSE_LASTSOUND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOPEFISHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DOPEFISHSND, MUSE_LASTSOUND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_YOUSUCKSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_YOUSUCKSND, MUSE_LASTSOUND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SILLYMOVESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SILLYMOVESND, MUSE_LASTSOUND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SOUNDSELECTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SOUNDSELECTSND, MUSE_LASTSOUND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SOUNDESCSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SOUNDESCSND, MUSE_LASTSOUND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM1SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM2SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM3SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM3SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM4SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM4SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM5SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM5SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM6SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM6SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM7SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM7SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM8SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM8SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM9SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM9SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM10SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM10SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LASTSOUND //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOSECRET, 0, 0, 0} //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ }; rott-20230810/rott/snd_shar.h000066400000000000000000001771001446517470200157250ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ typedef enum { D_LASTSOUND=-1, // MENU SOUNDS D_MENUFLIP, D_ESCPRESSEDSND, D_MOVECURSORSND, D_SELECTSND, D_WARNINGBOXSND, D_INFOBOXSND, D_QUESTIONBOXSND, D_NOPESND, // GAME SOUNDS D_LEVELSTARTSND, D_LEVELDONESND, D_GAMEOVERSND, // LEVEL END SCREEN D_ENDBONUS1SND, // PLAYER SOUNDS D_HITWALLSND, D_SELECTWPNSND, D_NOWAYSND, D_DONOTHINGSND, //D_NOITEMSND, D_PLAYERDYINGSND, D_PLAYERTCDEATHSND, D_PLAYERTCHURTSND, D_PLAYERTCSND, //D_WALK1SND, //D_WALK2SND, D_PLAYERBURNEDSND, D_PLAYERLANDSND, D_PLAYERCOUGHMSND, // PLAYER WEAPONS D_ATKPISTOLSND, D_ATKTWOPISTOLSND, D_ATKMP40SND, D_RICOCHET1SND, D_RICOCHET2SND, D_RICOCHET3SND, D_BAZOOKAFIRESND, D_HEATSEEKFIRESND, D_FIREBOMBFIRESND, D_DRUNKFIRESND, D_FLAMEWALLFIRESND, D_FLAMEWALLSND, D_GRAVSND, D_FIREHITSND, D_MISSILEFLYSND, D_MISSILEHITSND, D_GODMODEFIRESND, D_GODMODE1SND, D_GODMODE2SND, D_GODMODE3SND, D_LOSEMODESND, D_GODMANSND, D_FLYINGSND, // PLAYER-CAUSED SOUNDS D_GLASSBREAKSND, D_ITEMBLOWSND, D_BONUSBARRELSND, D_TOUCHPLATESND, D_BADTOUCHSND, D_EXPLODEFLOORSND, D_EXPLODESND, //D_GASSTARTSND, D_GASHISSSND, D_GASENDSND, D_GASMASKSND, // GET ITEM SOUNDS D_GETKEYSND, D_GETBONUSSND, D_GETHEALTH1SND, D_COOKHEALTHSND, D_GETWEAPONSND, D_GETGODSND, D_GETFLEETSND, D_GETELASTSND, D_GETSHROOMSSND, D_GETBVESTSND, D_GETAVESTSND, D_GETMASKSND, D_GET1UPSND, D_RESPAWNSND, D_PLAYERSPAWNSND, // ACTOR SOUNDS D_LOWGUARD1SEESND, D_LOWGUARD1SEE2SND, D_LOWGUARDOUCHSND, D_LOWGUARD1DIESND, D_SNEAKYSPRINGMSND, D_HIGHGUARD1SEESND, D_HIGHGUARDOUCHSND, D_HIGHGUARDDIESND, D_STRIKE1SEESND, D_STRIKEROLLSND, D_STRIKEOUCHSND, D_STRIKEDIESND, D_BLITZ1SEESND, D_BLITZSTEALSND, D_BLITZOUCHSND, D_BLITZDIESND, D_BLITZPLEADSND, D_BLITZPLEAD1SND, D_BLITZPLEAD2SND, D_ENFORCERSEESND, D_ENFORCERFIRESND, D_ENFORCERTHROWSND, D_ENFORCEROUCHSND, D_ENFORCERDIESND, D_ROBOTSEESND, D_ROBOTFIRESND, D_ROBOTDIESND, D_KRISTMOTORSND, // ENVIRONMENT SOUNDS D_OPENDOORSND, D_CLOSEDOORSND, D_DOORHITSND, D_FIRECHUTESND, D_FIREBALLSND, D_FIREBALLHITSND, D_BLADESPINSND, D_PUSHWALLSND, D_PUSHWALLHITSND, D_GOWALLSND, D_TURBOWALLSND, D_PITTRAPSND, D_FIREJETSND, D_ACTORSQUISHSND, D_ACTORBURNEDSND, D_ACTORSKELETONSND, D_SPEARSTABSND, D_CYLINDERMOVESND, D_ELEVATORONSND, D_ELEVATORENDSND, D_SPRINGBOARDSND, D_LIGHTNINGSND, //D_WINDSND, // SECRET SOUNDS D_YOUSUCKSND, D_BODYLANDSND, D_GIBSPLASHSND, D_ACTORLANDSND } digisounds; static sound_t sounds[MAXSOUNDS] = { //SD_MENUFLIP, //|-------DIGITAL--------|---------MUSE---------|-MIDI----------FLAGS---| {{D_MENUFLIP, MUSE_MENUFLIPSND, }, 0,SD_PRIOMENU, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ESCPRESSEDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ESCPRESSEDSND, MUSE_ESCPRESSEDSND, }, 0,SD_PRIOMENU, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_MOVECURSORSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_MOVECURSORSND, MUSE_MOVECURSORSND, }, 0,SD_PRIOMENU, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SELECTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SELECTSND, MUSE_SELECTSND, }, 0,SD_PRIOMENU, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_WARNINGBOXSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_WARNINGBOXSND, MUSE_WARNINGBOXSND, }, 0,SD_PRIOMENU, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_INFOBOXSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_INFOBOXSND, MUSE_INFOBOXSND, }, 0,SD_PRIOMENU, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_QUESTIONBOXSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_QUESTIONBOXSND, MUSE_QUESTIONBOXSND, }, 0,SD_PRIOMENU, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NOPESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_NOPESND, MUSE_NOPESND, }, 0,SD_PRIOMENU, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_QUIT1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_SELECTSND, }, 0,SD_PRIOQUIT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_QUIT2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_SELECTSND, }, 0,SD_PRIOQUIT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_QUIT3SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_SELECTSND, }, 0,SD_PRIOQUIT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_QUIT4SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_SELECTSND, }, 0,SD_PRIOQUIT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_QUIT5SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_SELECTSND, }, 0,SD_PRIOQUIT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_QUIT6SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_SELECTSND, }, 0,SD_PRIOQUIT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_QUIT7SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_SELECTSND, }, 0,SD_PRIOQUIT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LEVELSTARTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LEVELSTARTSND, MUSE_LEVELSTARTSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LEVELDONESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LEVELDONESND, MUSE_LEVELENDSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GAMEOVERSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GAMEOVERSND, MUSE_GAMEOVERSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ENDBONUS1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ENDBONUS1SND, MUSE_ENDBONUS1SND, }, SD_PITCHSHIFTOFF,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NOBONUSSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_NOBONUSSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PERCENT100SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_PERCENT100SND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_HITWALLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_HITWALLSND, MUSE_HITWALLSND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SELECTWPNSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SELECTWPNSND, MUSE_SELECTWPNSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NOWAYSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_NOWAYSND, MUSE_NOWAYSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DONOTHINGSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DONOTHINGSND, MUSE_DONOTHINGSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NOITEMSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_NOWAYSND, MUSE_NOITEMSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERDYINGSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERDYINGSND, MUSE_PLAYERDYINGSND, }, SD_PITCHSHIFTOFF,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERTCDEATHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCDEATHSND, MUSE_PLAYERDEATHSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERTBDEATHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCDEATHSND, MUSE_PLAYERDEATHSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERDWDEATHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCDEATHSND, MUSE_PLAYERDEATHSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERLNDEATHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCDEATHSND, MUSE_PLAYERDEATHSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERIPFDEATHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCDEATHSND, MUSE_PLAYERDEATHSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERTCHURTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCHURTSND, MUSE_PLAYERHURTSND, }, SD_PLAYONCE, SD_PRIOPHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERTBHURTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCHURTSND, MUSE_PLAYERHURTSND, }, SD_PLAYONCE, SD_PRIOPHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERDWHURTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCHURTSND, MUSE_PLAYERHURTSND, }, SD_PLAYONCE, SD_PRIOPHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERLNHURTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCHURTSND, MUSE_PLAYERHURTSND, }, SD_PLAYONCE, SD_PRIOPHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERIPFHURTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCHURTSND, MUSE_PLAYERHURTSND, }, SD_PLAYONCE, SD_PRIOPHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERTCSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCSND, MUSE_PLAYERYESSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERTBSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCSND, MUSE_PLAYERYESSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERDWSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCSND, MUSE_PLAYERYESSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERLNSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCSND, MUSE_PLAYERYESSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERIPFSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERTCSND, MUSE_PLAYERYESSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_WALK1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| // {{D_WALK1SND, MUSE_WALK1SND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_WALK2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| // {{D_WALK2SND, MUSE_WALK2SND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERBURNEDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERBURNEDSND, MUSE_PLAYERHURTSND, }, SD_PLAYONCE,SD_PRIOPHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERLANDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERLANDSND, MUSE_PLAYERLANDSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERCOUGHMSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERCOUGHMSND, MUSE_LASTSOUND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERCOUGHFSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NETWIGGLESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NETFALLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_NETFALLSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ATKPISTOLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ATKPISTOLSND, MUSE_ATKPISTOLSND, }, SD_WRITE,SD_PRIOPGUNS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ATKTWOPISTOLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ATKTWOPISTOLSND, MUSE_ATKPISTOLSND, }, SD_WRITE,SD_PRIOPGUNS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ATKMP40SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ATKMP40SND, MUSE_ATKMP40SND, }, SD_WRITE,SD_PRIOPMP40, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_RICOCHET1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_RICOCHET1SND, MUSE_RICOCHETSND, }, SD_WRITE,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_RICOCHET2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_RICOCHET2SND, MUSE_RICOCHETSND, }, SD_WRITE,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_RICOCHET3SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_RICOCHET3SND, MUSE_RICOCHETSND, }, SD_WRITE,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BAZOOKAFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BAZOOKAFIRESND, MUSE_MISSILEFIRESND, }, SD_WRITE,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREBOMBFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FIREBOMBFIRESND, MUSE_MISSILEFIRESND, }, SD_WRITE,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_HEATSEEKFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_HEATSEEKFIRESND, MUSE_MISSILEFIRESND, }, SD_WRITE,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DRUNKFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_DRUNKFIRESND, MUSE_MISSILEFIRESND, }, SD_WRITE,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FLAMEWALLFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FLAMEWALLFIRESND, MUSE_MISSILEFIRESND, }, SD_WRITE,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FLAMEWALLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FLAMEWALLSND, MUSE_FLAMEWALLSND, }, 0,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SPLITFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_MISSILEFIRESND, }, 0,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SPLITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_MISSILEFIRESND, }, 0,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GRAVBUILDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_WEAPONBUILDSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GRAVFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_ENERGYFIRESND, }, 0,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GRAVSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GRAVSND, MUSE_LASTSOUND, }, 0,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GRAVHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_MISSILEHITSND, }, 0,SD_PRIOEXPL, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FIREHITSND, MUSE_MISSILEHITSND, }, 0,SD_PRIOEXPL, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_MISSILEFLYSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_MISSILEFLYSND, MUSE_LASTSOUND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_MISSILEHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_MISSILEHITSND, MUSE_MISSILEHITSND, }, 0,SD_PRIOEXPL, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EXCALIBOUNCESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EXCALISWINGSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_MISSILEFIRESND, }, 0,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EXCALIHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_MISSILEHITSND, }, 0,SD_PRIOEXPL, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EXCALIBUILDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_WEAPONBUILDSND, }, 0,SD_PRIOPSNDS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EXCALIBLASTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_ENERGYFIRESND, }, 0,SD_PRIOPMISS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GODMODEFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GODMODEFIRESND, MUSE_ENERGYFIRESND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GODMODE1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GODMODE1SND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GODMODE2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GODMODE2SND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GODMODE3SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GODMODE3SND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOSEMODESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOSEMODESND, MUSE_LOSEMODESND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOGMODEPANTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOGMODEBITE1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_DOGBITESND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOGMODEBITE2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_DOGBITESND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOGMODELICKSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_DOGLICKSND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOGMODEBLASTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_DOGBITESND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOGMODEPREPBLASTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOGMANSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOGWOMANSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GODMANSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GODMANSND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GODWOMANSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FLYINGSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FLYINGSND, MUSE_LASTSOUND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GLASSBREAKSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GLASSBREAKSND, MUSE_GLASSBREAKSND, }, 0,SD_PRIOGLASS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ITEMBLOWSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ITEMBLOWSND, MUSE_EXPLOSIONSND, }, 0,SD_PRIOEXPL, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BONUSBARRELSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BONUSBARRELSND, MUSE_EXPLOSIONSND, }, 0,SD_PRIOEXPL, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_TOUCHPLATESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_TOUCHPLATESND, MUSE_TOUCHPLATESND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BADTOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BADTOUCHSND, MUSE_BADTOUCHSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EXPLODEFLOORSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_EXPLODEFLOORSND, MUSE_EXPLOSIONSND, }, 0,SD_PRIOEXPL, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EXPLODESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_EXPLODESND, MUSE_EXPLOSIONSND, }, 0,SD_PRIOEXPL, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GASSTARTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_TOUCHPLATESND, MUSE_SWITCHSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GASHISSSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GASHISSSND, MUSE_LASTSOUND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GASENDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GASENDSND, MUSE_SWITCHSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GASMASKSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GASMASKSND, MUSE_LASTSOUND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETKEYSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETKEYSND, MUSE_GETKEYSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETBONUSSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETBONUSSND, MUSE_GETBONUSSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETHEALTH1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETHEALTH1SND, MUSE_GETHEALTHSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETHEALTH2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETHEALTH1SND, MUSE_GETHEALTHSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_COOKHEALTHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_COOKHEALTHSND, MUSE_GETBONUSSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETWEAPONSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETWEAPONSND, MUSE_GETWEAPONSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETKNIFESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_GETWEAPONSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETGODSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETGODSND, MUSE_GETPOWERUPSND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETDOGSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_GETPOWERUPSND, }, 0,SD_PRIOGODDOG, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETFLEETSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETFLEETSND, MUSE_GETPOWERUPSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETELASTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETELASTSND, MUSE_GETPOWERDOWNSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETSHROOMSSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETSHROOMSSND, MUSE_GETPOWERDOWNSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETBVESTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETBVESTSND, MUSE_GETARMORSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETAVESTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETAVESTSND, MUSE_GETARMORSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETMASKSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GETMASKSND, MUSE_GETARMORSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETBATSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_GETWEIRDSND, }, 0,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GETHEADSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_GETWEIRDSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GET1UPSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GET1UPSND, MUSE_GETLIFESND, }, SD_PITCHSHIFTOFF,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GET3UPSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_GETLIFESND, }, SD_PITCHSHIFTOFF,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_RESPAWNSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_RESPAWNSND, MUSE_GETBONUSSND, }, SD_PITCHSHIFTOFF,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PLAYERSPAWNSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PLAYERSPAWNSND, MUSE_GETLIFESND, }, SD_PITCHSHIFTOFF,SD_PRIOGAME, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARD1SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARD1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARD1ASEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARD1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARD1SEE3SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARD1SEE2SND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARD2SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARD1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARD2ASEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARD1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARD2SEE3SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARD1SEE2SND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARDFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ATKPISTOLSND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARDOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARDOUCHSND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARD1DIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARD1DIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LOWGUARD2DIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LOWGUARD1DIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNEAKYSPRINGMSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SNEAKYSPRINGMSND, MUSE_ACTORDOITSND, }, 0,SD_PRIOASNEAK, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNEAKYSPRINGFSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SNEAKYSPRINGMSND, MUSE_ACTORDOITSND, }, 0,SD_PRIOASNEAK, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_HIGHGUARD1SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_HIGHGUARD1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_HIGHGUARD2SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_HIGHGUARD1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_HIGHGUARDFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ATKMP40SND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_HIGHGUARDOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_HIGHGUARDOUCHSND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_HIGHGUARDDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_HIGHGUARDDIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_OVERP1SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_OVERP2SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_OVERPFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ATKPISTOLSND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_OVERPNETSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_ACTORTHROWSND, }, 0,SD_PRIOASNEAK, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_OVERPOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_OVERPDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_STRIKE1SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_STRIKE1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_STRIKE2SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_STRIKE1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_STRIKEFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ATKPISTOLSND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_STRIKEROLLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_STRIKEROLLSND, MUSE_ACTORROLLSND, }, 0,SD_PRIOASNEAK, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_STRIKEOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_STRIKEOUCHSND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_STRIKEDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_STRIKEDIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZ1SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLITZ1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZ2SEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLITZ1SEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ATKPISTOLSND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZSTEALSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLITZSTEALSND, MUSE_GETPOWERDOWNSND, }, 0,SD_PRIOASNEAK, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLITZOUCHSND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLITZDIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZPLEADSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLITZPLEADSND, MUSE_LASTSOUND, }, SD_PLAYONCE,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZPLEAD1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLITZPLEAD1SND, MUSE_LASTSOUND, }, SD_PLAYONCE,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLITZPLEAD2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLITZPLEAD2SND, MUSE_LASTSOUND, }, SD_PLAYONCE,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ENFORCERSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ENFORCERSEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ENFORCERFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ENFORCERFIRESND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ENFORCERTHROWSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ENFORCERTHROWSND, MUSE_ACTORTHROWSND, }, 0,SD_PRIOASNEAK, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ENFORCEROUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ENFORCEROUCHSND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ENFORCERDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ENFORCERDIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_MONKSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_MONKGRABSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_ACTORDOITSND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_MONKOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_MONKDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREMONKSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREMONKFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREMONKOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREMONKDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ROBOTSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ROBOTSEESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ROBOTFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ROBOTFIRESND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ROBOTDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ROBOTDIESND, MUSE_ACTORDIESND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ROBOTMOVESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_KRISTMOTORSND, MUSE_LASTSOUND, }, SD_PLAYONCE,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BALLISTIKRAFTSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BAZOOKAFIRESND, MUSE_ACTORSEESND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BALLISTIKRAFTFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ROBOTFIRESND, MUSE_ACTORFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSSEESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BAZOOKAFIRESND, MUSE_BOSSFIRESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANGONNAUSESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSDOSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANUSESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_TOUCHPLATESND, MUSE_BOSSDOSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANHIDESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSDOSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSDIESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANSAY1, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANSAY2, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSHEYSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARIANSAY3, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSSEESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BAZOOKAFIRESND, MUSE_BOSSFIRESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTMOTORSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTTURNSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSBEEPSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTDROPSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSDOSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTMINEBEEPSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSBEEPSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTMINEHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_MISSILEHITSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSDIESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTSAY1, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTSAY2, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSHEYSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_KRISTSAY3, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NMESEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSSEESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NMEREADYSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NMEFIRE1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BAZOOKAFIRESND, MUSE_BOSSFIRESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NMEAPARTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSBEEPSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NMEUFOSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_MISSILEFIRESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_NMEDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_EXPLODESND, MUSE_BOSSDIESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSSEESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKFIRE1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSFIRESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKFIRE2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSFIRE2SND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKFIRE3SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSFIRESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKFIRE4SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSFIRE2SND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKRECHARGESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_WEAPONBUILDSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKFLOATSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSDIESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKSAY1, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKSAY2, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSHEYSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DARKMONKSAY3, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKESEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSSEESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKEREADYSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSBEEPSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKECHARGESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_WEAPONBUILDSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKEOUCHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSOUCHSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKEDIESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSDIESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKESPITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSFIRESND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKESAY1, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKESAY2, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSHEYSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SNAKESAY3, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOSSWARNSND, }, 0,SD_PRIOBOSS, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EMPLACEMENTSEESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_SWITCHSND, }, 0,SD_PRIOAGREET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_EMPLACEMENTFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_EMPFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BIGEMPLACEFIRESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_EMPFIRESND, }, 0,SD_PRIOAFIRE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_OPENDOORSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_OPENDOORSND, MUSE_OPENDOORSND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_CLOSEDOORSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_CLOSEDOORSND, MUSE_CLOSEDOORSND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOORHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ELEVATORENDSND, MUSE_LASTSOUND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIRECHUTESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FIRECHUTESND, MUSE_MISSILEFIRESND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREBALLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FIREBALLSND, MUSE_LASTSOUND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREBALLHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FIREBALLHITSND, MUSE_MISSILEHITSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BLADESPINSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BLADESPINSND, MUSE_SPINBLADESND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PUSHWALLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PUSHWALLSND, MUSE_PUSHWALLSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PUSHWALLHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PUSHWALLHITSND, MUSE_MISSILEHITSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GOWALLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GOWALLSND, MUSE_PUSHWALLSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_TURBOWALLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_TURBOWALLSND, MUSE_PUSHWALLSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BOULDERHITSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_MISSILEHITSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BOULDERROLLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_BOULDERSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BOULDERFALLSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_PITTRAPSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_PITTRAPSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_PITTRAPSND, MUSE_PITTRAPSND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_FIREJETSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_FIREJETSND, MUSE_FIREJETSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ACTORSQUISHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ACTORSQUISHSND, MUSE_ACTORSQUISHSND, }, 0,SD_PRIOADEATH, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ACTORBURNEDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ACTORBURNEDSND, MUSE_ACTOROUCHSND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ACTORSKELETONSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ACTORSKELETONSND, MUSE_LASTSOUND, }, 0,SD_PRIOAHURT, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SPEARSTABSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SPEARSTABSND, MUSE_STABBERSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_CYLINDERMOVESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_CYLINDERMOVESND, MUSE_CYLINDERHITSND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ELEVATORONSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ELEVATORONSND, MUSE_ELEVATORSND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ELEVATORENDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ELEVATORENDSND, MUSE_LASTSOUND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SPRINGBOARDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_SPRINGBOARDSND, MUSE_SPRINGBOARDSND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LIGHTNINGSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LIGHTNINGSND, MUSE_LASTSOUND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_WINDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_WATERSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOPCAUSD, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_BODYLANDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_BODYLANDSND, MUSE_LASTSOUND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_GIBSPLASHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_GIBSPLASHSND, MUSE_LASTSOUND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_ACTORLANDSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_ACTORLANDSND, MUSE_LASTSOUND, }, 0,SD_PRIOENVRON, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_DOPEFISHSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_YOUSUCKSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_YOUSUCKSND, MUSE_LASTSOUND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SILLYMOVESND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SOUNDSELECTSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_SOUNDESCSND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_YOUSUCKSND, MUSE_LASTSOUND, }, 0,SD_PRIOSECRET, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM1SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM1SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM2SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM2SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM3SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM3SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM4SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM4SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM5SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM5SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM6SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM6SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM7SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM7SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM8SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM8SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM9SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM9SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_REMOTEM10SND, //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_REMOTEM10SND, MUSE_LASTSOUND, }, 0,SD_PRIOREMOTE, 0, 0, 0}, //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ //SD_LASTSOUND //|-------DIGITAL--------|--------MUSE----------|----FLAGS---| {{D_LASTSOUND, MUSE_LASTSOUND, }, 0,SD_PRIOSECRET, 0, 0, 0} //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ }; rott-20230810/rott/sndcards.h000066400000000000000000000024371446517470200157250ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: SNDCARDS.H author: James R. Dose phone: (214)-271-1365 Ext #221 date: March 31, 1994 Contains enumerated type definitions for sound cards. (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #ifndef __SNDCARDS_H #define __SNDCARDS_H #define ASS_VERSION_STRING "1.04" typedef enum { // ASS_NoSound, SoundBlaster, SoundScape, UltraSound, NumSoundCards } soundcardnames; #endif rott-20230810/rott/splib.h000066400000000000000000000132601446517470200152310ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 SPLIB_H #define SPLIB_H /* ======================================================================= * * Please Read "SpReadme.doc" for usage * * ======================================================================= */ /* ======================================================================= * * Compiler & Memory Mode Wrappers. * * ----------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #endif #if defined(REALMODE) #define FAR __far #else #define FAR #endif //--------------------------------------------------------------------------- // Constants #define TSR_SERIAL_LENGTH 14 #define TSR_MAX_LENGTH 80 //--------------------------------------------------------------------------- typedef struct { char copyright[TSR_MAX_LENGTH]; // driver copyright short major; // driver version number short minor; short count; // # of available devices } SpwDrvOpenPacket; typedef struct { char copyright[TSR_MAX_LENGTH]; // device copyright char serial[TSR_SERIAL_LENGTH]; // device serial number } SpwDevOpenPacket; typedef struct { long timestamp; // time of event unsigned short period; // period since last MOVEMENT unsigned short button; // button pressed mask short tx; // Translation X short ty; // Y short tz; // Z short rx; // Rotation X short ry; // Y short rz; // Z } SpwForcePacket; typedef struct { long timestamp; // time of event unsigned short period; // period since last BUTTON unsigned short button; // button pressed mask } SpwButtonPacket; typedef struct { unsigned long data; // MUST be TSRCMD_DATA } SpwCommandPacket; #define TSRCMD_DATA 0xFF0000FF //--------------------------------------------------------------------------- typedef union { char padding[128]; /* Extra room for future expansion */ SpwCommandPacket command; SpwDrvOpenPacket drvOpen; SpwDevOpenPacket devOpen; SpwForcePacket force; SpwButtonPacket button; } SpwPacket; // TSR Interrupt Functions #define TSR_DRIVER_CLOSE 0x0000 #define TSR_DRIVER_OPEN 0x8001 #define TSR_DEVICE_CLOSE 0x0002 #define TSR_DEVICE_OPEN 0x8003 #define TSR_DEVICE_DISABLE 0x0010 #define TSR_DEVICE_ENABLE 0x0011 #define TSR_DEVICE_GETFORCE 0x8020 #define TSR_DEVICE_GETBUTTONS 0x8021 /* ======================================================================= * * Function Prototypes * * ======================================================================= */ short SpwOpenDriver(SpwPacket FAR *packet); short SpwCloseDriver(void); short SpwOpenDevice(short device, SpwPacket FAR *packet); short SpwCloseDevice(short device); short SpwEnableDevice(short device); short SpwDisableDevice(short device); short SpwGetForce(short device, SpwPacket FAR *packet); short SpwGetButton(short device, SpwPacket FAR *packet); /* ======================================================================= * * Convience functions * * ======================================================================= */ /* ----------------------------------------------------------------------- * * The SpwSimple... functions are just convienence wrappers for the above * * functions. * * ----------------------------------------------------------------------- */ #ifndef SPWSTRUCTS #define SPWSTRUCTS enum SpwDeviceType { SPW_AVENGER=1, }; enum SpwEventType { SPW_NO_EVENT=0, SPW_BUTTON_HELD=1, SPW_BUTTON_DOWN=2, SPW_BUTTON_UP=4, SPW_MOTION=8 }; /* ----------------------------------------------------------------------- * * Data struct for handling library calls * * ----------------------------------------------------------------------- */ typedef struct { short new; short cur; short old; } SpwButtonRec; typedef struct { short tx; /* Current Translation vector */ short ty; short tz; short rx; /* Current Rotation vector */ short ry; short rz; SpwButtonRec buttons; /* Current Button Record */ short newData; /* An SpEventType mask of newData, 0 if none */ } SpwRawData; #endif short SpwSimpleGet(short devNum, SpwRawData FAR *splayer); short SpwSimpleOpen(short devNum); short SpwSimpleClose(short devNum); /* ======================================================================= * * Compiler & Memory Mode Wrappers. * * ======================================================================= * */ #ifdef __cplusplus }; #endif /* ======================================================================= */ #endif rott-20230810/rott/sprites.h000066400000000000000000001377321446517470200156240ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _sprites_public #define _sprites_public #include "develop.h" typedef enum {ACTOR_START_LABEL, /*************** UNTERWACHE *************************************/ SPR_LOWGRD_SHOOT1,SPR_LOWGRD_SHOOT2,SPR_LOWGRD_SHOOT3,SPR_LOWGRD_SHOOT4, SPR_LOWGRD_S1,SPR_LOWGRD_S2,SPR_LOWGRD_S3,SPR_LOWGRD_S4, SPR_LOWGRD_S5,SPR_LOWGRD_S6,SPR_LOWGRD_S7,SPR_LOWGRD_S8, SPR_LOWGRD_W11,SPR_LOWGRD_W12,SPR_LOWGRD_W13,SPR_LOWGRD_W14, SPR_LOWGRD_W15,SPR_LOWGRD_W16,SPR_LOWGRD_W17,SPR_LOWGRD_W18, SPR_LOWGRD_W21,SPR_LOWGRD_W22,SPR_LOWGRD_W23,SPR_LOWGRD_W24, SPR_LOWGRD_W25,SPR_LOWGRD_W26,SPR_LOWGRD_W27,SPR_LOWGRD_W28, SPR_LOWGRD_W31,SPR_LOWGRD_W32,SPR_LOWGRD_W33,SPR_LOWGRD_W34, SPR_LOWGRD_W35,SPR_LOWGRD_W36,SPR_LOWGRD_W37,SPR_LOWGRD_W38, SPR_LOWGRD_W41,SPR_LOWGRD_W42,SPR_LOWGRD_W43,SPR_LOWGRD_W44, SPR_LOWGRD_W45,SPR_LOWGRD_W46,SPR_LOWGRD_W47,SPR_LOWGRD_W48, SPR_LOWGRD_PAIN1, SPR_LOWGRD_PAIN2, SPR_LOWGRD_DIE1, SPR_LOWGRD_DIE2, SPR_LOWGRD_DIE3, SPR_LOWGRD_DIE4, SPR_LOWGRD_DEAD, SPR_LOWGRD_WPAIN1, SPR_LOWGRD_WPAIN2, SPR_LOWGRD_WDIE1, SPR_LOWGRD_WDIE2, SPR_LOWGRD_WDIE3, SPR_LOWGRD_WDIE4, SPR_LOWGRD_WDEAD, SPR_SNEAKY_DEAD, SPR_RISE1, SPR_RISE2, SPR_RISE3, SPR_RISE4, /* SPR_LOWGRD_USE11,SPR_LOWGRD_USE12,SPR_LOWGRD_USE13,SPR_LOWGRD_USE14, SPR_LOWGRD_USE15,SPR_LOWGRD_USE16,SPR_LOWGRD_USE17,SPR_LOWGRD_USE18, SPR_LOWGRD_USE21,SPR_LOWGRD_USE22,SPR_LOWGRD_USE23,SPR_LOWGRD_USE24, SPR_LOWGRD_USE25,SPR_LOWGRD_USE26,SPR_LOWGRD_USE27,SPR_LOWGRD_USE28, */ /***************** Highguard 1 (Steve B.) ***************************************/ SPR_HIGHGRD_SHOOT1,SPR_HIGHGRD_SHOOT2,SPR_HIGHGRD_SHOOT3,SPR_HIGHGRD_SHOOT4, SPR_HIGHGRD_S1,SPR_HIGHGRD_S2,SPR_HIGHGRD_S3,SPR_HIGHGRD_S4, SPR_HIGHGRD_S5,SPR_HIGHGRD_S6,SPR_HIGHGRD_S7,SPR_HIGHGRD_S8, SPR_HIGHGRD_W11,SPR_HIGHGRD_W12,SPR_HIGHGRD_W13,SPR_HIGHGRD_W14, SPR_HIGHGRD_W15,SPR_HIGHGRD_W16,SPR_HIGHGRD_W17,SPR_HIGHGRD_W18, SPR_HIGHGRD_W21,SPR_HIGHGRD_W22,SPR_HIGHGRD_W23,SPR_HIGHGRD_W24, SPR_HIGHGRD_W25,SPR_HIGHGRD_W26,SPR_HIGHGRD_W27,SPR_HIGHGRD_W28, SPR_HIGHGRD_W31,SPR_HIGHGRD_W32,SPR_HIGHGRD_W33,SPR_HIGHGRD_W34, SPR_HIGHGRD_W35,SPR_HIGHGRD_W36,SPR_HIGHGRD_W37,SPR_HIGHGRD_W38, SPR_HIGHGRD_W41,SPR_HIGHGRD_W42,SPR_HIGHGRD_W43,SPR_HIGHGRD_W44, SPR_HIGHGRD_W45,SPR_HIGHGRD_W46,SPR_HIGHGRD_W47,SPR_HIGHGRD_W48, SPR_HIGHGRD_PAIN1,SPR_HIGHGRD_PAIN2, SPR_HIGHGRD_DIE1,SPR_HIGHGRD_DIE2,SPR_HIGHGRD_DIE3,SPR_HIGHGRD_DIE4, SPR_HIGHGRD_DIE5,SPR_HIGHGRD_DEAD, SPR_HIGHGRD_WPAIN1,SPR_HIGHGRD_WPAIN2, SPR_HIGHGRD_WDIE1,SPR_HIGHGRD_WDIE2,SPR_HIGHGRD_WDIE3,SPR_HIGHGRD_WDIE4, SPR_HIGHGRD_WDIE5,SPR_HIGHGRD_WDEAD, /* SPR_HIGHGRD_USE11,SPR_HIGHGRD_USE12,SPR_HIGHGRD_USE13,SPR_HIGHGRD_USE14, SPR_HIGHGRD_USE15,SPR_HIGHGRD_USE16,SPR_HIGHGRD_USE17,SPR_HIGHGRD_USE18, SPR_HIGHGRD_USE21,SPR_HIGHGRD_USE22,SPR_HIGHGRD_USE23,SPR_HIGHGRD_USE24, SPR_HIGHGRD_USE25,SPR_HIGHGRD_USE26,SPR_HIGHGRD_USE27,SPR_HIGHGRD_USE28, */ /******************** ANGRIFFSTUPPE **********************************/ SPR_STRIKE_SHOOT1,SPR_STRIKE_SHOOT2,SPR_STRIKE_SHOOT3,SPR_STRIKE_SHOOT4, SPR_STRIKE_KSHOOT1,SPR_STRIKE_KSHOOT2,SPR_STRIKE_KSHOOT3, SPR_STRIKE_S1,SPR_STRIKE_S2,SPR_STRIKE_S3,SPR_STRIKE_S4, SPR_STRIKE_S5,SPR_STRIKE_S6,SPR_STRIKE_S7,SPR_STRIKE_S8, SPR_STRIKE_W11,SPR_STRIKE_W12,SPR_STRIKE_W13,SPR_STRIKE_W14, SPR_STRIKE_W15,SPR_STRIKE_W16,SPR_STRIKE_W17,SPR_STRIKE_W18, SPR_STRIKE_W21,SPR_STRIKE_W22,SPR_STRIKE_W23,SPR_STRIKE_W24, SPR_STRIKE_W25,SPR_STRIKE_W26,SPR_STRIKE_W27,SPR_STRIKE_W28, SPR_STRIKE_W31,SPR_STRIKE_W32,SPR_STRIKE_W33,SPR_STRIKE_W34, SPR_STRIKE_W35,SPR_STRIKE_W36,SPR_STRIKE_W37,SPR_STRIKE_W38, SPR_STRIKE_W41,SPR_STRIKE_W42,SPR_STRIKE_W43,SPR_STRIKE_W44, SPR_STRIKE_W45,SPR_STRIKE_W46,SPR_STRIKE_W47,SPR_STRIKE_W48, SPR_STRIKE_PAIN1,SPR_STRIKE_PAIN2, SPR_STRIKE_DIE1,SPR_STRIKE_DIE2,SPR_STRIKE_DIE3, SPR_STRIKE_DIE4,SPR_STRIKE_DEAD1,SPR_STRIKE_DEAD2,SPR_STRIKE_DEAD3, SPR_STRIKE_WPAIN1,SPR_STRIKE_WPAIN2, SPR_STRIKE_WDIE1,SPR_STRIKE_WDIE2,SPR_STRIKE_WDIE3, SPR_STRIKE_WDIE4,SPR_STRIKE_WDEAD1,SPR_STRIKE_WDEAD2,SPR_STRIKE_WDEAD3, SPR_STRIKE_RROLL1,SPR_STRIKE_RROLL2,SPR_STRIKE_RROLL3,SPR_STRIKE_RROLL4, SPR_STRIKE_RROLL5,SPR_STRIKE_RROLL6, SPR_STRIKE_LROLL1,SPR_STRIKE_LROLL2,SPR_STRIKE_LROLL3,SPR_STRIKE_LROLL4, SPR_STRIKE_LROLL5,SPR_STRIKE_LROLL6, /********************** BLITZWACHE **********************************/ SPR_BLITZ_SHOOT1,SPR_BLITZ_SHOOT2,SPR_BLITZ_SHOOT3,SPR_BLITZ_SHOOT4, SPR_BLITZ_S1,SPR_BLITZ_S2,SPR_BLITZ_S3,SPR_BLITZ_S4, SPR_BLITZ_S5,SPR_BLITZ_S6,SPR_BLITZ_S7,SPR_BLITZ_S8, SPR_BLITZ_W11,SPR_BLITZ_W12,SPR_BLITZ_W13,SPR_BLITZ_W14, SPR_BLITZ_W15,SPR_BLITZ_W16,SPR_BLITZ_W17,SPR_BLITZ_W18, SPR_BLITZ_W21,SPR_BLITZ_W22,SPR_BLITZ_W23,SPR_BLITZ_W24, SPR_BLITZ_W25,SPR_BLITZ_W26,SPR_BLITZ_W27,SPR_BLITZ_W28, SPR_BLITZ_W31,SPR_BLITZ_W32,SPR_BLITZ_W33,SPR_BLITZ_W34, SPR_BLITZ_W35,SPR_BLITZ_W36,SPR_BLITZ_W37,SPR_BLITZ_W38, SPR_BLITZ_W41,SPR_BLITZ_W42,SPR_BLITZ_W43,SPR_BLITZ_W44, SPR_BLITZ_W45,SPR_BLITZ_W46,SPR_BLITZ_W47,SPR_BLITZ_W48, SPR_BLITZ_PAIN1, SPR_BLITZ_PAIN2,SPR_BLITZ_DIE1,SPR_BLITZ_DIE2, SPR_BLITZ_DIE3,SPR_BLITZ_DIE4,SPR_BLITZ_DEAD1, SPR_BLITZ_DEAD2, SPR_BLITZ_WPAIN1, SPR_BLITZ_WPAIN2,SPR_BLITZ_WDIE1,SPR_BLITZ_WDIE2, SPR_BLITZ_WDIE3,SPR_BLITZ_WDIE4,SPR_BLITZ_WDEAD1, SPR_BLITZ_WDEAD2, SPR_BLITZ_RISE1, SPR_BLITZ_RISE2, SPR_BLITZ_RISE3, SPR_BLITZ_RISE4, SPR_BLITZ_USE11,SPR_BLITZ_USE12,SPR_BLITZ_USE13,SPR_BLITZ_USE14, SPR_BLITZ_USE15,SPR_BLITZ_USE16,SPR_BLITZ_USE17,SPR_BLITZ_USE18, SPR_BLITZ_USE21,SPR_BLITZ_USE22,SPR_BLITZ_USE23,SPR_BLITZ_USE24, SPR_BLITZ_USE25,SPR_BLITZ_USE26,SPR_BLITZ_USE27,SPR_BLITZ_USE28, SPR_BLITZ_PLEAD1,SPR_BLITZ_PLEAD2,SPR_BLITZ_PLEAD3,SPR_BLITZ_PLEAD4, SPR_BLITZ_PLEAD5,SPR_BLITZ_PLEAD6,SPR_BLITZ_PLEAD7,SPR_BLITZ_PLEAD8, SPR_BLITZ_PLEAD9,SPR_BLITZ_PLEAD10,SPR_BLITZ_PLEAD11, /******************** DREIHEITWACHE ***********************************/ SPR_ENFORCER_SHOOT1,SPR_ENFORCER_SHOOT2,SPR_ENFORCER_SHOOT3, SPR_ENFORCER_SHOOT4, SPR_ENFORCER_S1,SPR_ENFORCER_S2,SPR_ENFORCER_S3,SPR_ENFORCER_S4, SPR_ENFORCER_S5,SPR_ENFORCER_S6,SPR_ENFORCER_S7,SPR_ENFORCER_S8, SPR_ENFORCER_W11,SPR_ENFORCER_W12,SPR_ENFORCER_W13,SPR_ENFORCER_W14, SPR_ENFORCER_W15,SPR_ENFORCER_W16,SPR_ENFORCER_W17,SPR_ENFORCER_W18, SPR_ENFORCER_W21,SPR_ENFORCER_W22,SPR_ENFORCER_W23,SPR_ENFORCER_W24, SPR_ENFORCER_W25,SPR_ENFORCER_W26,SPR_ENFORCER_W27,SPR_ENFORCER_W28, SPR_ENFORCER_W31,SPR_ENFORCER_W32,SPR_ENFORCER_W33,SPR_ENFORCER_W34, SPR_ENFORCER_W35,SPR_ENFORCER_W36,SPR_ENFORCER_W37,SPR_ENFORCER_W38, SPR_ENFORCER_W41,SPR_ENFORCER_W42,SPR_ENFORCER_W43,SPR_ENFORCER_W44, SPR_ENFORCER_W45,SPR_ENFORCER_W46,SPR_ENFORCER_W47,SPR_ENFORCER_W48, SPR_ENFORCER_THROW1,SPR_ENFORCER_THROW2,SPR_ENFORCER_THROW3,SPR_ENFORCER_THROW4, SPR_ENFORCER_THROW5,SPR_ENFORCER_THROW6,SPR_ENFORCER_THROW7,SPR_ENFORCER_THROW8, SPR_ENFORCER_PAIN1,SPR_ENFORCER_PAIN2, SPR_ENFORCER_DIE1,SPR_ENFORCER_DIE2,SPR_ENFORCER_DIE3,SPR_ENFORCER_DIE4, SPR_ENFORCER_DEAD, SPR_ENFORCER_WPAIN1,SPR_ENFORCER_WPAIN2, SPR_ENFORCER_WDIE1,SPR_ENFORCER_WDIE2,SPR_ENFORCER_WDIE3,SPR_ENFORCER_WDIE4, SPR_ENFORCER_WDEAD, /* SPR_ENFORCER_USE11,SPR_ENFORCER_USE12,SPR_ENFORCER_USE13,SPR_ENFORCER_USE14, SPR_ENFORCER_USE15,SPR_ENFORCER_USE16,SPR_ENFORCER_USE17,SPR_ENFORCER_USE18, SPR_ENFORCER_USE21,SPR_ENFORCER_USE22,SPR_ENFORCER_USE23,SPR_ENFORCER_USE24, SPR_ENFORCER_USE25,SPR_ENFORCER_USE26,SPR_ENFORCER_USE27,SPR_ENFORCER_USE28, */ /************************* ROBOT GUARD *********************************/ SPR_ROBOGRD_S11,SPR_ROBOGRD_S12,SPR_ROBOGRD_S13,SPR_ROBOGRD_S14, SPR_ROBOGRD_S15,SPR_ROBOGRD_S16,SPR_ROBOGRD_S17,SPR_ROBOGRD_S18, SPR_ROBOGRD_S21,SPR_ROBOGRD_S22,SPR_ROBOGRD_S23,SPR_ROBOGRD_S24, SPR_ROBOGRD_S25,SPR_ROBOGRD_S26,SPR_ROBOGRD_S27,SPR_ROBOGRD_S28, ROBOGRDDIE1,ROBOGRDDIE2,ROBOGRDDIE3,ROBOGRDDIE4, ROBOGRDDIE5,ROBOGRDDIE6,ROBOGRDDIE7,ROBOGRDDIE8, ROBOGRDDIE9,ROBOGRDDEAD, /************************* EXPLOSIONS *******************************/ SPR_EXPLOSION1,SPR_EXPLOSION2,SPR_EXPLOSION3,SPR_EXPLOSION4, SPR_EXPLOSION5,SPR_EXPLOSION6,SPR_EXPLOSION7,SPR_EXPLOSION8, SPR_EXPLOSION9,SPR_EXPLOSION10,SPR_EXPLOSION11,SPR_EXPLOSION12, SPR_EXPLOSION13,SPR_EXPLOSION14,SPR_EXPLOSION15,SPR_EXPLOSION16, SPR_EXPLOSION17,SPR_EXPLOSION18,SPR_EXPLOSION19,SPR_EXPLOSION20, SPR_STATICEXPL1,SPR_STATICEXPL2,SPR_STATICEXPL3,SPR_STATICEXPL4, SPR_STATICEXPL5,SPR_STATICEXPL6,SPR_STATICEXPL7,SPR_STATICEXPL8, SPR_STATICEXPL9,SPR_STATICEXPL10,SPR_STATICEXPL11,SPR_STATICEXPL12, SPR_STATICEXPL13,SPR_STATICEXPL14,SPR_STATICEXPL15,SPR_STATICEXPL16, SPR_STATICEXPL17,SPR_STATICEXPL18,SPR_STATICEXPL19,SPR_STATICEXPL20, SPR_STATICEXPL21,SPR_STATICEXPL22,SPR_STATICEXPL23,SPR_STATICEXPL24, SPR_STATICEXPL25, SPR_GROUNDEXPL1,SPR_GROUNDEXPL2,SPR_GROUNDEXPL3,SPR_GROUNDEXPL4, SPR_GROUNDEXPL5,SPR_GROUNDEXPL6,SPR_GROUNDEXPL7,SPR_GROUNDEXPL8, SPR_GROUNDEXPL9,SPR_GROUNDEXPL10,SPR_GROUNDEXPL11,SPR_GROUNDEXPL12, SPR_GROUNDEXPL13,SPR_GROUNDEXPL14,SPR_GROUNDEXPL15,SPR_GROUNDEXPL16, SPR_GROUNDEXPL17,SPR_GROUNDEXPL18,SPR_GROUNDEXPL19,SPR_GROUNDEXPL20, /************************* HAZARDS *******************************/ UBLADE1,UBLADE2,UBLADE3,UBLADE4, UBLADE5,UBLADE6,UBLADE7,UBLADE8, UBLADE9,//UBLADE10,UBLADE11,UBLADE12, //UBLADE13,UBLADE14,UBLADE15,UBLADE16, FIREJETUP1,FIREJETUP2,FIREJETUP3,FIREJETUP4, FIREJETUP5,FIREJETUP6,FIREJETUP7,FIREJETUP8, FIREJETUP9,FIREJETUP10,FIREJETUP11,FIREJETUP12, FIREJETUP13,FIREJETUP14,FIREJETUP15,FIREJETUP16, FIREJETUP17,FIREJETUP18,FIREJETUP19,FIREJETUP20, FIREJETUP21,FIREJETUP22,FIREJETUP23, CRUSHDOWN1,CRUSHDOWN2,CRUSHDOWN3,CRUSHDOWN4, CRUSHDOWN5,CRUSHDOWN6,CRUSHDOWN7,CRUSHDOWN8, //CRUSHDOWN9,CRUSHDOWN10,CRUSHDOWN11,CRUSHDOWN12, //CRUSHDOWN13,CRUSHDOWN14,CRUSHDOWN15,CRUSHDOWN16, SPEARUP1,SPEARUP2,SPEARUP3,SPEARUP4, SPEARUP5,SPEARUP6,SPEARUP7,SPEARUP8, SPEARUP9,SPEARUP10,SPEARUP11,SPEARUP12, SPEARUP13,SPEARUP14,SPEARUP15,SPEARUP16, SPRING1,SPRING2,SPRING3,SPRING4, SPRING5,SPRING6,SPRING7,SPRING8, SPRING9,SPRING10, FIREW1,FIREW2,FIREW3,FIREW4,FIREW5,FIREW6,FIREW7,FIREW8, FIREW9,FIREW10,FIREW11,FIREW12,FIREW13,FIREW14,FIREW15, GUTS1,GUTS2,GUTS3,GUTS4, GUTS5,GUTS6,GUTS7,GUTS8, GUTS9,GUTS10,GUTS11,GUTS12, PARTICLE01,PARTICLE02,PARTICLE03,PARTICLE04, PARTICLE05,PARTICLE06,PARTICLE07,PARTICLE08, PARTICLE09,PARTICLE10,PARTICLE11,PARTICLE12, ORGAN01,ORGAN02,ORGAN03,ORGAN04, ORGAN05,ORGAN06,ORGAN07,ORGAN08, ORGAN09,ORGAN10,ORGAN11,ORGAN12, RIB01,RIB02,RIB03,RIB04, RIB05,RIB06,RIB07,RIB08, RIB09,RIB10,RIB11,RIB12, PINK01, PINK02, PINK03, PINK04, PINK05, PINK06, PINK07, PINK08, PINK09, PINK10, PINK11, PINK12, GIBHEAD01,GIBHEAD02,GIBHEAD03,GIBHEAD04, GIBHEAD05,GIBHEAD06,GIBHEAD07,GIBHEAD08, GIBHEAD09,GIBHEAD10,GIBHEAD11,GIBHEAD12, GARM01,GARM02,GARM03,GARM04, GARM05,GARM06,GARM07,GARM08, GARM09,GARM10,GARM11,GARM12, GLEG01,GLEG02,GLEG03,GLEG04, GLEG05,GLEG06,GLEG07,GLEG08, GLEG09,GLEG10,GLEG11,GLEG12, HUMERUS01, HUMERUS02, HUMERUS03, HUMERUS04, HUMERUS05, HUMERUS06, HUMERUS07, HUMERUS08, HUMERUS09, HUMERUS10, HUMERUS11, HUMERUS12, PELVIS01, PELVIS02, PELVIS03, PELVIS04, PELVIS05, PELVIS06, PELVIS07, PELVIS08, PELVIS09, PELVIS10, PELVIS11, PELVIS12, LIMB01, LIMB02, LIMB03, LIMB04, LIMB05, LIMB06, LIMB07, LIMB08, LIMB09, LIMB10, LIMB11, LIMB12, DEADHEAD, WALLGIB1,WALLGIB2,WALLGIB3,WALLGIB4, GIBEYE1,GIBEYE2,GIBEYE3, VAPORIZED1,VAPORIZED2,VAPORIZED3,VAPORIZED4, VAPORIZED5,VAPORIZED6,VAPORIZED7,VAPORIZED8, BIGSOUL,LITTLESOUL, COLLECTOR1, COLLECTOR3, COLLECTOR5, COLLECTOR7, COLLECTOR9, COLLECTOR11, COLLECTOR13, COLLECTOR15, ITEMSPAWN1,ITEMSPAWN2,ITEMSPAWN3,ITEMSPAWN4, ITEMSPAWN5,ITEMSPAWN6,ITEMSPAWN7,ITEMSPAWN8, DEADBLOOD1,DEADBLOOD2,DEADBLOOD3,DEADBLOOD4, DEADBLOOD5,DEADBLOOD6,DEADBLOOD7, FLASH1,FLASH2,FLASH3,FLASH4, FLASH5,FLASH6,FLASH7,FLASH8, SKELETON1,SKELETON2,SKELETON3,SKELETON4, SKELETON5,SKELETON6,SKELETON7,SKELETON8, SKELETON9,SKELETON10,SKELETON11,SKELETON12, SKELETON13,SKELETON14,SKELETON15,SKELETON16, SKELETON17,SKELETON18,SKELETON19,SKELETON20, SKELETON21,SKELETON22,SKELETON23,SKELETON24, SKELETON25,SKELETON26,SKELETON27,SKELETON28, SKELETON29,SKELETON30,SKELETON31,SKELETON32, SKELETON33,SKELETON34,SKELETON35,SKELETON36, SKELETON37,SKELETON38,SKELETON39,SKELETON40, SKELETON41,SKELETON42,SKELETON43,SKELETON44, SKELETON45,SKELETON46,SKELETON47,SKELETON48, SPR_PUSHCOLUMN1,SPR_PUSHCOLUMN1a, /* SPR_PUSHCOLUMN2,SPR_PUSHCOLUMN2a, SPR_PUSHCOLUMN3,SPR_PUSHCOLUMN3a, */ BLOODSPURT1,BLOODSPURT2,BLOODSPURT3,BLOODSPURT4, BLOODSPURT5,BLOODSPURT6,BLOODSPURT7,BLOODSPURT8, GUNSMOKE1,GUNSMOKE2,GUNSMOKE3,GUNSMOKE4, GUNSMOKE5,GUNSMOKE6,GUNSMOKE7,GUNSMOKE8, HITMETALWALL1,HITMETALWALL2,HITMETALWALL3,HITMETALWALL4, HITMETALACTOR1,HITMETALACTOR2,HITMETALACTOR3,HITMETALACTOR4, PLATFORM1, PLATFORM2, PLATFORM3, PLATFORM4, PLATFORM5, SPR_CROSSFIRE11, SPR_CROSSFIRE12,SPR_CROSSFIRE13, SPR_CROSSFIRE14, SPR_CROSSFIRE15, SPR_CROSSFIRE16,SPR_CROSSFIRE17, SPR_CROSSFIRE18, SPR_CROSSFIRE31, SPR_CROSSFIRE32,SPR_CROSSFIRE33, SPR_CROSSFIRE34, SPR_CROSSFIRE35, SPR_CROSSFIRE36,SPR_CROSSFIRE37, SPR_CROSSFIRE38, SPR_CREXP1,SPR_CREXP2,SPR_CREXP3,SPR_CREXP4,SPR_CREXP5, GODFIRE1,GODFIRE2,GODFIRE3,GODFIRE4, SPR_ENFORCER_GR1,SPR_ENFORCER_GR2,SPR_ENFORCER_GR3,SPR_ENFORCER_GR4, SPR_ENFORCER_GR5,SPR_ENFORCER_GR6,SPR_ENFORCER_GR7,SPR_ENFORCER_GR8, SPR_ENFORCER_GR9,SPR_ENFORCER_GR10, SPR_ENFORCER_FALL1,SPR_ENFORCER_FALL2,SPR_ENFORCER_FALL3,SPR_ENFORCER_FALL4, SPR_ENFORCER_FALL5,SPR_ENFORCER_FALL6, SPR_MINE1,SPR_MINE2,SPR_MINE3,SPR_MINE4, SPR_BJMISS11,SPR_BJMISS12,SPR_BJMISS13,SPR_BJMISS14, SPR_BJMISS15,SPR_BJMISS16,SPR_BJMISS17,SPR_BJMISS18, SPR_BJMISS19,SPR_BJMISS110,SPR_BJMISS111,SPR_BJMISS112, SPR_BJMISS113,SPR_BJMISS114,SPR_BJMISS115,SPR_BJMISS116, SPR_BSTAR1,SPR_BSTAR2,SPR_BSTAR3,SPR_BSTAR4, GODPOWERUP1, GODPOWERUP2, GODPOWERUP3, GODPOWERUP4, GODPOWERUP5, GODPOWERUP6, GODPOWERUP7, GODPOWERUP8, ELASTICPOWERUP1, ELASTICPOWERUP2, ELASTICPOWERUP3, ELASTICPOWERUP4, ELASTICPOWERUP5, ELASTICPOWERUP6, ELASTICPOWERUP7, ELASTICPOWERUP8, RANDOMPOWERUP1, RANDOMPOWERUP2, RANDOMPOWERUP3, RANDOMPOWERUP4, RANDOMPOWERUP5, RANDOMPOWERUP6, RANDOMPOWERUP7, RANDOMPOWERUP8, FLEETFEETPOWERUP1, FLEETFEETPOWERUP2, FLEETFEETPOWERUP3, FLEETFEETPOWERUP4, FLEETFEETPOWERUP5, FLEETFEETPOWERUP6, FLEETFEETPOWERUP7, FLEETFEETPOWERUP8, MUSHROOMPOWERUP1, MUSHROOMPOWERUP2, MUSHROOMPOWERUP3, MUSHROOMPOWERUP4, MUSHROOMPOWERUP5, MUSHROOMPOWERUP6, MUSHROOMPOWERUP7, MUSHROOMPOWERUP8, ONEUP01, ONEUP02, ONEUP03, ONEUP04, ONEUP05, ONEUP06, ONEUP07, ONEUP08, LIFEITEMA01, LIFEITEMA02, LIFEITEMA03, LIFEITEMA04, LIFEITEMA05, LIFEITEMA06, LIFEITEMA07, LIFEITEMA08, LIFEITEMB01, LIFEITEMB02, LIFEITEMB03, LIFEITEMB04, LIFEITEMB05, LIFEITEMB06, LIFEITEMB07, LIFEITEMB08, LIFEITEMC01, LIFEITEMC02, LIFEITEMC03, LIFEITEMC04, LIFEITEMC05, LIFEITEMC06, LIFEITEMC07, LIFEITEMC08, LIFEITEMC09, LIFEITEMC10, LIFEITEMC11, LIFEITEMC12, LIFEITEMC13, LIFEITEMC14, LIFEITEMC15, LIFEITEMD01, LIFEITEMD02, LIFEITEMD03, LIFEITEMD04, LIFEITEMD05, LIFEITEMD06, LIFEITEMD07, LIFEITEMD08, RUBBLE1,RUBBLE2,RUBBLE3,RUBBLE4,RUBBLE5,RUBBLE6,RUBBLE7, RUBBLE8,RUBBLE9,RUBBLE10, WOODFRAG1,WOODFRAG2,WOODFRAG3,WOODFRAG4,WOODFRAG5,WOODFRAG6, WOODFRAG7,WOODFRAG8,WOODFRAG9,WOODFRAG10,WOODFRAG11,WOODFRAG12, WOODFRAG13,WOODFRAG14, MISSMOKE1,MISSMOKE2,MISSMOKE3,MISSMOKE4, SPR62_ETOUCH1, SPR63_ETOUCH2, SPR64_ETOUCH3, SPR73_GKEY1, SPR74_GKEY2, SPR75_GKEY3, SPR76_GKEY4, SPR77_GKEY5, SPR78_GKEY6, SPR79_GKEY7, SPR80_GKEY8, SPR81_GKEY9, SPR82_GKEY10, SPR83_GKEY11, SPR84_GKEY12, SPR85_GKEY13, SPR86_GKEY14, SPR87_GKEY15, SPR88_GKEY16, SPR6_GIBS1, SPR7_GIBS2, SPR8_GIBS3, SPR33_CBARREL, SPR34_TOUCH1, SPR35_TOUCH2, SPR36_TOUCH3, SPR37_TOUCH4, SPR40_GARBAGE3,SPR41_SHIT, BLUEVASE, SPR54_HAY, BULLETHOLE, ALTBULLETHO, STNPOLE1, STNPOLE2, STNPOLE3, STNPOLE4, STNPOLE5, STNPOLE6, STNPOLE7, STNPOLE8, HGRATE1, HGRATE2, HGRATE3, HGRATE4, SPR0_YLIGHT, SPR1_RLIGHT, SPR2_GLIGHT, SPR3_BLIGHT, SPR4_CHAND, SPR5_LAMPOFF, SPR5_LAMP, SPR9_MONKMEAL, SPR_ABRAZIEROFF, SPR_ABRAZIER2, SPR32_EXPLOS, SPR38_GARBAGE1,SPR39_GARBAGE2, SPR42_GRATE, SPR43_MSHARDS, SPR44_PEDESTAL,SPR45_ETABLE, SPR46_STOOL, SPR50_TREE, SPR51_PLANT, SPR55_IBARREL, FBASIN1, FBASIN2, FBASIN3, EBASIN, PORRIDGE1, PORRIDGE2, PORRIDGE3, PORRIDGE4, PORRIDGE5, PORRIDGE6, MONKCRYSTAL11, MONKCRYSTAL12, MONKCRYSTAL13, MONKCRYSTAL14, MONKCRYSTAL15, MONKCRYSTAL16, MONKCRYSTAL21, MONKCRYSTAL22, MONKCRYSTAL23, MONKCRYSTAL24, MONKCRYSTAL25, MONKCRYSTAL26, MONKCRYSTAL27, TORCH1, TORCH2, TORCH3, TORCH4, TORCH5, TORCH6, TORCH7, TORCH8, TORCH9, TORCH10, TORCH11, TORCH12, TORCH13, TORCH14, TORCH15, /* ATORCH2, ATORCH3, ATORCH4, ATORCH5, ATORCH6, ATORCH7, ATORCH8, ATORCH9, ATORCH10, ATORCH11, ATORCH12, ATORCH13, ATORCH14, ATORCH15, ATORCH16, */ FFLAME1, FFLAME2, FFLAME3, FFLAME4, FFLAME5, FFLAME6, FFLAME7, SPR_TWOPIST, SPR_MP40, SPR_BAZOOKA, SPR_FIREBOMB, SPR_HEATSEEK, SPR_DRUNK, SPR_FIREWALL, SPR_KES, SPR_SPLIT, GASMASKPOWERUP, BULLETPROOFPOWERUP, ASBESTOSPOWERUP,PREPIT,POSTPIT, CASSATT_SHOOT11,CASSATT_SHOOT12,CASSATT_SHOOT13,CASSATT_SHOOT14, CASSATT_SHOOT15,CASSATT_SHOOT16,CASSATT_SHOOT17,CASSATT_SHOOT18, CASSATT_SHOOT21,CASSATT_SHOOT22,CASSATT_SHOOT23,CASSATT_SHOOT24, CASSATT_SHOOT25,CASSATT_SHOOT26,CASSATT_SHOOT27,CASSATT_SHOOT28, CASSATTM_SHOOT11,CASSATTM_SHOOT12,CASSATTM_SHOOT13,CASSATTM_SHOOT14, CASSATTM_SHOOT15,CASSATTM_SHOOT16,CASSATTM_SHOOT17,CASSATTM_SHOOT18, CASSATTM_SHOOT21,CASSATTM_SHOOT22,CASSATTM_SHOOT23,CASSATTM_SHOOT24, CASSATTM_SHOOT25,CASSATTM_SHOOT26,CASSATTM_SHOOT27,CASSATTM_SHOOT28, CASSATT_S1,CASSATT_S2,CASSATT_S3,CASSATT_S4, CASSATT_S5,CASSATT_S6,CASSATT_S7,CASSATT_S8, CASSATT_W11,CASSATT_W12,CASSATT_W13,CASSATT_W14, CASSATT_W15,CASSATT_W16,CASSATT_W17,CASSATT_W18, CASSATT_W21,CASSATT_W22,CASSATT_W23,CASSATT_W24, CASSATT_W25,CASSATT_W26,CASSATT_W27,CASSATT_W28, CASSATT_W31,CASSATT_W32,CASSATT_W33,CASSATT_W34, CASSATT_W35,CASSATT_W36,CASSATT_W37,CASSATT_W38, CASSATT_W41,CASSATT_W42,CASSATT_W43,CASSATT_W44, CASSATT_W45,CASSATT_W46,CASSATT_W47,CASSATT_W48, CASSATT_VDIE1,CASSATT_VDIE2,CASSATT_VDIE3,CASSATT_VDIE4,CASSATT_VDIE5, CASSATT_VDIE6, CASSATT_VDEAD, CASSATT_DIE1,CASSATT_DIE2,CASSATT_DIE3,CASSATT_DIE4,CASSATT_DIE5, CASSATT_DIE6, CASSATT_DEAD, // DDOI - Wad ends here BARRETT_SHOOT11,BARRETT_SHOOT12,BARRETT_SHOOT13,BARRETT_SHOOT14, BARRETT_SHOOT15,BARRETT_SHOOT16,BARRETT_SHOOT17,BARRETT_SHOOT18, BARRETT_SHOOT21,BARRETT_SHOOT22,BARRETT_SHOOT23,BARRETT_SHOOT24, BARRETT_SHOOT25,BARRETT_SHOOT26,BARRETT_SHOOT27,BARRETT_SHOOT28, BARRETTM_SHOOT11,BARRETTM_SHOOT12,BARRETTM_SHOOT13,BARRETTM_SHOOT14, BARRETTM_SHOOT15,BARRETTM_SHOOT16,BARRETTM_SHOOT17,BARRETTM_SHOOT18, BARRETTM_SHOOT21,BARRETTM_SHOOT22,BARRETTM_SHOOT23,BARRETTM_SHOOT24, BARRETTM_SHOOT25,BARRETTM_SHOOT26,BARRETTM_SHOOT27,BARRETTM_SHOOT28, BARRETT_S1,BARRETT_S2,BARRETT_S3,BARRETT_S4, BARRETT_S5,BARRETT_S6,BARRETT_S7,BARRETT_S8, BARRETT_W11,BARRETT_W12,BARRETT_W13,BARRETT_W14, BARRETT_W15,BARRETT_W16,BARRETT_W17,BARRETT_W18, BARRETT_W21,BARRETT_W22,BARRETT_W23,BARRETT_W24, BARRETT_W25,BARRETT_W26,BARRETT_W27,BARRETT_W28, BARRETT_W31,BARRETT_W32,BARRETT_W33,BARRETT_W34, BARRETT_W35,BARRETT_W36,BARRETT_W37,BARRETT_W38, BARRETT_W41,BARRETT_W42,BARRETT_W43,BARRETT_W44, BARRETT_W45,BARRETT_W46,BARRETT_W47,BARRETT_W48, BARRETT_VDIE1,BARRETT_VDIE2,BARRETT_VDIE3,BARRETT_VDIE4,BARRETT_VDIE5, BARRETT_VDIE6, BARRETT_VDEAD, BARRETT_DIE1,BARRETT_DIE2,BARRETT_DIE3,BARRETT_DIE4,BARRETT_DIE5, BARRETT_DIE6, BARRETT_DEAD, WENDT_SHOOT11,WENDT_SHOOT12,WENDT_SHOOT13,WENDT_SHOOT14, WENDT_SHOOT15,WENDT_SHOOT16,WENDT_SHOOT17,WENDT_SHOOT18, WENDT_SHOOT21,WENDT_SHOOT22,WENDT_SHOOT23,WENDT_SHOOT24, WENDT_SHOOT25,WENDT_SHOOT26,WENDT_SHOOT27,WENDT_SHOOT28, WENDTM_SHOOT11,WENDTM_SHOOT12,WENDTM_SHOOT13,WENDTM_SHOOT14, WENDTM_SHOOT15,WENDTM_SHOOT16,WENDTM_SHOOT17,WENDTM_SHOOT18, WENDTM_SHOOT21,WENDTM_SHOOT22,WENDTM_SHOOT23,WENDTM_SHOOT24, WENDTM_SHOOT25,WENDTM_SHOOT26,WENDTM_SHOOT27,WENDTM_SHOOT28, WENDT_S1,WENDT_S2,WENDT_S3,WENDT_S4, WENDT_S5,WENDT_S6,WENDT_S7,WENDT_S8, WENDT_W11,WENDT_W12,WENDT_W13,WENDT_W14, WENDT_W15,WENDT_W16,WENDT_W17,WENDT_W18, WENDT_W21,WENDT_W22,WENDT_W23,WENDT_W24, WENDT_W25,WENDT_W26,WENDT_W27,WENDT_W28, WENDT_W31,WENDT_W32,WENDT_W33,WENDT_W34, WENDT_W35,WENDT_W36,WENDT_W37,WENDT_W38, WENDT_W41,WENDT_W42,WENDT_W43,WENDT_W44, WENDT_W45,WENDT_W46,WENDT_W47,WENDT_W48, WENDT_VDIE1,WENDT_VDIE2,WENDT_VDIE3,WENDT_VDIE4,WENDT_VDIE5,WENDT_VDIE6, WENDT_VDEAD, WENDT_DIE1,WENDT_DIE2,WENDT_DIE3,WENDT_DIE4,WENDT_DIE5,WENDT_DIE6, WENDT_DEAD, //====== NI_SHOOT11,NI_SHOOT12,NI_SHOOT13,NI_SHOOT14, NI_SHOOT15,NI_SHOOT16,NI_SHOOT17,NI_SHOOT18, NI_SHOOT21,NI_SHOOT22,NI_SHOOT23,NI_SHOOT24, NI_SHOOT25,NI_SHOOT26,NI_SHOOT27,NI_SHOOT28, NIM_SHOOT11,NIM_SHOOT12,NIM_SHOOT13,NIM_SHOOT14, NIM_SHOOT15,NIM_SHOOT16,NIM_SHOOT17,NIM_SHOOT18, NIM_SHOOT21,NIM_SHOOT22,NIM_SHOOT23,NIM_SHOOT24, NIM_SHOOT25,NIM_SHOOT26,NIM_SHOOT27,NIM_SHOOT28, NI_S1,NI_S2,NI_S3,NI_S4, NI_S5,NI_S6,NI_S7,NI_S8, NI_W11,NI_W12,NI_W13,NI_W14, NI_W15,NI_W16,NI_W17,NI_W18, NI_W21,NI_W22,NI_W23,NI_W24, NI_W25,NI_W26,NI_W27,NI_W28, NI_W31,NI_W32,NI_W33,NI_W34, NI_W35,NI_W36,NI_W37,NI_W38, NI_W41,NI_W42,NI_W43,NI_W44, NI_W45,NI_W46,NI_W47,NI_W48, NI_VDIE1,NI_VDIE2,NI_VDIE3,NI_VDIE4,NI_VDIE5,NI_VDIE6, NI_VDEAD, NI_DIE1,NI_DIE2,NI_DIE3,NI_DIE4,NI_DIE5,NI_DIE6, NI_DEAD, IPF_SHOOT11,IPF_SHOOT12,IPF_SHOOT13,IPF_SHOOT14, IPF_SHOOT15,IPF_SHOOT16,IPF_SHOOT17,IPF_SHOOT18, IPF_SHOOT21,IPF_SHOOT22,IPF_SHOOT23,IPF_SHOOT24, IPF_SHOOT25,IPF_SHOOT26,IPF_SHOOT27,IPF_SHOOT28, IPFM_SHOOT11,IPFM_SHOOT12,IPFM_SHOOT13,IPFM_SHOOT14, IPFM_SHOOT15,IPFM_SHOOT16,IPFM_SHOOT17,IPFM_SHOOT18, IPFM_SHOOT21,IPFM_SHOOT22,IPFM_SHOOT23,IPFM_SHOOT24, IPFM_SHOOT25,IPFM_SHOOT26,IPFM_SHOOT27,IPFM_SHOOT28, IPF_S1,IPF_S2,IPF_S3,IPF_S4, IPF_S5,IPF_S6,IPF_S7,IPF_S8, IPF_W11,IPF_W12,IPF_W13,IPF_W14, IPF_W15,IPF_W16,IPF_W17,IPF_W18, IPF_W21,IPF_W22,IPF_W23,IPF_W24, IPF_W25,IPF_W26,IPF_W27,IPF_W28, IPF_W31,IPF_W32,IPF_W33,IPF_W34, IPF_W35,IPF_W36,IPF_W37,IPF_W38, IPF_W41,IPF_W42,IPF_W43,IPF_W44, IPF_W45,IPF_W46,IPF_W47,IPF_W48, IPF_VDIE1,IPF_VDIE2,IPF_VDIE3,IPF_VDIE4,IPF_VDIE5,IPF_VDIE6, IPF_VDEAD, IPF_DIE1,IPF_DIE2,IPF_DIE3,IPF_DIE4,IPF_DIE5,IPF_DIE6, IPF_DEAD, SERIALDOG_W11,SERIALDOG_W12,SERIALDOG_W13,SERIALDOG_W14, SERIALDOG_W15,SERIALDOG_W16,SERIALDOG_W17,SERIALDOG_W18, SERIALDOG_W21,SERIALDOG_W22,SERIALDOG_W23,SERIALDOG_W24, SERIALDOG_W25,SERIALDOG_W26,SERIALDOG_W27,SERIALDOG_W28, SERIALDOG_W31,SERIALDOG_W32,SERIALDOG_W33,SERIALDOG_W34, SERIALDOG_W35,SERIALDOG_W36,SERIALDOG_W37,SERIALDOG_W38, SERIALDOG_W41,SERIALDOG_W42,SERIALDOG_W43,SERIALDOG_W44, SERIALDOG_W45,SERIALDOG_W46,SERIALDOG_W47,SERIALDOG_W48, SERIALDOG_ATTACK1,SERIALDOG_ATTACK2,SERIALDOG_ATTACK3,SERIALDOG_ATTACK4, SERIALDOG_ATTACK5,SERIALDOG_ATTACK6,SERIALDOG_ATTACK7,SERIALDOG_ATTACK8, /*************** Lowguard 2 (Marianna) *************************************/ /* SPR_MARIANNA_SHOOT1,SPR_MARIANNA_SHOOT2,SPR_MARIANNA_SHOOT3,SPR_MARIANNA_SHOOT4, SPR_MARIANNA_S1,SPR_MARIANNA_S2,SPR_MARIANNA_S3,SPR_MARIANNA_S4, SPR_MARIANNA_S5,SPR_MARIANNA_S6,SPR_MARIANNA_S7,SPR_MARIANNA_S8, SPR_MARIANNA_W11,SPR_MARIANNA_W12,SPR_MARIANNA_W13,SPR_MARIANNA_W14, SPR_MARIANNA_W15,SPR_MARIANNA_W16,SPR_MARIANNA_W17,SPR_MARIANNA_W18, SPR_MARIANNA_W21,SPR_MARIANNA_W22,SPR_MARIANNA_W23,SPR_MARIANNA_W24, SPR_MARIANNA_W25,SPR_MARIANNA_W26,SPR_MARIANNA_W27,SPR_MARIANNA_W28, SPR_MARIANNA_W31,SPR_MARIANNA_W32,SPR_MARIANNA_W33,SPR_MARIANNA_W34, SPR_MARIANNA_W35,SPR_MARIANNA_W36,SPR_MARIANNA_W37,SPR_MARIANNA_W38, SPR_MARIANNA_W41,SPR_MARIANNA_W42,SPR_MARIANNA_W43,SPR_MARIANNA_W44, SPR_MARIANNA_W45,SPR_MARIANNA_W46,SPR_MARIANNA_W47,SPR_MARIANNA_W48, SPR_MARIANNA_PAIN1, SPR_MARIANNA_PAIN2, SPR_MARIANNA_DIE1, SPR_MARIANNA_DIE2, SPR_MARIANNA_DIE3, SPR_MARIANNA_DIE4, SPR_MARIANNA_DEAD, SPR_MARIANNA_WPAIN1, SPR_MARIANNA_WPAIN2, SPR_MARIANNA_WDIE1, SPR_MARIANNA_WDIE2, SPR_MARIANNA_WDIE3, SPR_MARIANNA_WDIE4, SPR_MARIANNA_WDEAD, SPR_SNMAR_DEAD, SPR_MARISE1, SPR_MARISE2, SPR_MARISE3, SPR_MARISE4, */ /****************** OBERPATROLLE (Nolan) ***********************************/ SPR_OP_SHOOT1,SPR_OP_SHOOT2,SPR_OP_SHOOT3,SPR_OP_SHOOT4, SPR_OP_BOLOSHOOT1,SPR_OP_BOLOSHOOT2,SPR_OP_BOLOSHOOT3,SPR_OP_BOLOSHOOT4, SPR_OP_BOLOSHOOT5, SPR_OP_S1,SPR_OP_S2,SPR_OP_S3,SPR_OP_S4, SPR_OP_S5,SPR_OP_S6,SPR_OP_S7,SPR_OP_S8, SPR_OP_W11,SPR_OP_W12,SPR_OP_W13,SPR_OP_W14, SPR_OP_W15,SPR_OP_W16,SPR_OP_W17,SPR_OP_W18, SPR_OP_W21,SPR_OP_W22,SPR_OP_W23,SPR_OP_W24, SPR_OP_W25,SPR_OP_W26,SPR_OP_W27,SPR_OP_W28, SPR_OP_W31,SPR_OP_W32,SPR_OP_W33,SPR_OP_W34, SPR_OP_W35,SPR_OP_W36,SPR_OP_W37,SPR_OP_W38, SPR_OP_W41,SPR_OP_W42,SPR_OP_W43,SPR_OP_W44, SPR_OP_W45,SPR_OP_W46,SPR_OP_W47,SPR_OP_W48, SPR_OP_PAIN1,SPR_OP_PAIN2, SPR_OP_ALTDIE1,SPR_OP_ALTDIE2,SPR_OP_ALTDIE3, SPR_OP_ALTDIE4,SPR_OP_ALTDIE5,SPR_OP_ALTDEAD, SPR_OP_WPAIN1,SPR_OP_WPAIN2, SPR_OP_WALTDIE1,SPR_OP_WALTDIE2,SPR_OP_WALTDIE3, SPR_OP_WALTDIE4,SPR_OP_WALTDIE5,SPR_OP_WALTDEAD, SPR_OP_DIE1,SPR_OP_DIE2,SPR_OP_DIE3, SPR_OP_DIE4,SPR_OP_DIE5,SPR_OP_DIE6, SPR_OP_DEAD, /******************* Normal monk (Lee)**********************************/ SPR_MONK_DRAIN1,SPR_MONK_DRAIN2,SPR_MONK_DRAIN3,SPR_MONK_DRAIN4, SPR_MONK_DRAIN5,SPR_MONK_DRAIN6, /*SPR_MONK_CAST1,SPR_MONK_CAST2,SPR_MONK_CAST3,SPR_MONK_CAST4, SPR_MONK_CAST5,SPR_MONK_CAST6,SPR_MONK_CAST7,SPR_MONK_CAST8,*/ SPR_MONK_S1,SPR_MONK_S2,SPR_MONK_S3,SPR_MONK_S4, SPR_MONK_S5,SPR_MONK_S6,SPR_MONK_S7,SPR_MONK_S8, SPR_MONK_W11,SPR_MONK_W12,SPR_MONK_W13,SPR_MONK_W14, SPR_MONK_W15,SPR_MONK_W16,SPR_MONK_W17,SPR_MONK_W18, SPR_MONK_W21,SPR_MONK_W22,SPR_MONK_W23,SPR_MONK_W24, SPR_MONK_W25,SPR_MONK_W26,SPR_MONK_W27,SPR_MONK_W28, SPR_MONK_W31,SPR_MONK_W32,SPR_MONK_W33,SPR_MONK_W34, SPR_MONK_W35,SPR_MONK_W36,SPR_MONK_W37,SPR_MONK_W38, SPR_MONK_W41,SPR_MONK_W42,SPR_MONK_W43,SPR_MONK_W44, SPR_MONK_W45,SPR_MONK_W46,SPR_MONK_W47,SPR_MONK_W48, SPR_MONK_PAIN1,SPR_MONK_PAIN2, SPR_MONK_DIE1,SPR_MONK_DIE2,SPR_MONK_DIE3,SPR_MONK_DIE4, SPR_MONK_DEAD, /*SPR_MONK_USE11,SPR_MONK_USE12,SPR_MONK_USE13,SPR_MONK_USE14, SPR_MONK_USE15,SPR_MONK_USE16,SPR_MONK_USE17,SPR_MONK_USE18, SPR_MONK_USE21,SPR_MONK_USE22,SPR_MONK_USE23,SPR_MONK_USE24, SPR_MONK_USE25,SPR_MONK_USE26,SPR_MONK_USE27,SPR_MONK_USE28, */ /******************* Fire monk (Allen)**********************************/ SPR_FIREMONK_CAST1,SPR_FIREMONK_CAST2,SPR_FIREMONK_CAST3,SPR_FIREMONK_CAST4, SPR_FIREMONK_CAST5,SPR_FIREMONK_CAST6,SPR_FIREMONK_CAST7, SPR_FIREMONK_S1,SPR_FIREMONK_S2,SPR_FIREMONK_S3,SPR_FIREMONK_S4, SPR_FIREMONK_S5,SPR_FIREMONK_S6,SPR_FIREMONK_S7,SPR_FIREMONK_S8, SPR_FIREMONK_W11,SPR_FIREMONK_W12,SPR_FIREMONK_W13,SPR_FIREMONK_W14, SPR_FIREMONK_W15,SPR_FIREMONK_W16,SPR_FIREMONK_W17,SPR_FIREMONK_W18, SPR_FIREMONK_W21,SPR_FIREMONK_W22,SPR_FIREMONK_W23,SPR_FIREMONK_W24, SPR_FIREMONK_W25,SPR_FIREMONK_W26,SPR_FIREMONK_W27,SPR_FIREMONK_W28, SPR_FIREMONK_W31,SPR_FIREMONK_W32,SPR_FIREMONK_W33,SPR_FIREMONK_W34, SPR_FIREMONK_W35,SPR_FIREMONK_W36,SPR_FIREMONK_W37,SPR_FIREMONK_W38, SPR_FIREMONK_W41,SPR_FIREMONK_W42,SPR_FIREMONK_W43,SPR_FIREMONK_W44, SPR_FIREMONK_W45,SPR_FIREMONK_W46,SPR_FIREMONK_W47,SPR_FIREMONK_W48, SPR_FIREMONK_PAIN1,SPR_FIREMONK_PAIN2, SPR_FIREMONK_DIE1,SPR_FIREMONK_DIE2,SPR_FIREMONK_DIE3,SPR_FIREMONK_DIE4, SPR_FIREMONK_DEAD1,SPR_FIREMONK_DEAD2,SPR_FIREMONK_DEAD3,SPR_FIREMONK_DEAD4, SPR_FIREMONK_DEAD5,SPR_FIREMONK_DEAD6,SPR_FIREMONK_DEAD7, /* SPR_ALLEN_USE11,SPR_ALLEN_USE12,SPR_ALLEN_USE13,SPR_ALLEN_USE14, SPR_ALLEN_USE15,SPR_ALLEN_USE16,SPR_ALLEN_USE17,SPR_ALLEN_USE18, SPR_ALLEN_USE21,SPR_ALLEN_USE22,SPR_ALLEN_USE23,SPR_ALLEN_USE24, SPR_ALLEN_USE25,SPR_ALLEN_USE26,SPR_ALLEN_USE27,SPR_ALLEN_USE28, */ BCRAFT01,BCRAFT02,BCRAFT03,BCRAFT04, BCRAFT05,BCRAFT06,BCRAFT07,BCRAFT08, BCRAFT09,BCRAFT10,BCRAFT11,BCRAFT12, BCRAFT13,BCRAFT14,BCRAFT15,BCRAFT16, /************************* GENERAL DARIAN *******************************/ SPR_DARIAN_SHOOT1,SPR_DARIAN_SHOOT2,SPR_DARIAN_SHOOT3,SPR_DARIAN_SHOOT4, SPR_DARIAN_SINK1,SPR_DARIAN_SINK2,SPR_DARIAN_SINK3,SPR_DARIAN_SINK4, SPR_DARIAN_SINK5,SPR_DARIAN_SINK6,SPR_DARIAN_SINK7,SPR_DARIAN_SINK8, SPR_DARIAN_S1,SPR_DARIAN_S2,SPR_DARIAN_S3,SPR_DARIAN_S4, SPR_DARIAN_S5,SPR_DARIAN_S6,SPR_DARIAN_S7,SPR_DARIAN_S8, SPR_DARIAN_W11,SPR_DARIAN_W12,SPR_DARIAN_W13,SPR_DARIAN_W14, SPR_DARIAN_W15,SPR_DARIAN_W16,SPR_DARIAN_W17,SPR_DARIAN_W18, SPR_DARIAN_W21,SPR_DARIAN_W22,SPR_DARIAN_W23,SPR_DARIAN_W24, SPR_DARIAN_W25,SPR_DARIAN_W26,SPR_DARIAN_W27,SPR_DARIAN_W28, SPR_DARIAN_W31,SPR_DARIAN_W32,SPR_DARIAN_W33,SPR_DARIAN_W34, SPR_DARIAN_W35,SPR_DARIAN_W36,SPR_DARIAN_W37,SPR_DARIAN_W38, SPR_DARIAN_W41,SPR_DARIAN_W42,SPR_DARIAN_W43,SPR_DARIAN_W44, SPR_DARIAN_W45,SPR_DARIAN_W46,SPR_DARIAN_W47,SPR_DARIAN_W48, SPR_DARIAN_PAIN1, SPR_DARIAN_PAIN2, SPR_DARIAN_DIE1, SPR_DARIAN_DIE2, SPR_DARIAN_DIE3, SPR_DARIAN_DIE4,SPR_DARIAN_DIE5, SPR_DARIAN_DIE6, SPR_DARIAN_DIE7, SPR_DARIAN_DIE8,SPR_DARIAN_DIE9, SPR_DARIAN_DIE10, SPR_DARIAN_DEAD, SPR_DARIAN_WPAIN1, SPR_DARIAN_WPAIN2, SPR_WDARIAN_DIE1, SPR_WDARIAN_DIE2, SPR_DARIAN_WDIE3, SPR_DARIAN_WDIE4,SPR_WDARIAN_DIE5, SPR_WDARIAN_DIE6, SPR_DARIAN_WDIE7, SPR_DARIAN_WDIE8,SPR_WDARIAN_DIE9, SPR_WDARIAN_DIE10, SPR_DARIAN_WDEAD, SPR_DARIAN_USE11,SPR_DARIAN_USE12,SPR_DARIAN_USE13,SPR_DARIAN_USE14, SPR_DARIAN_USE15,SPR_DARIAN_USE16,SPR_DARIAN_USE17,SPR_DARIAN_USE18, SPR_DARIAN_USE21,SPR_DARIAN_USE22,SPR_DARIAN_USE23,SPR_DARIAN_USE24, SPR_DARIAN_USE25,SPR_DARIAN_USE26,SPR_DARIAN_USE27,SPR_DARIAN_USE28, /************************* HEINRICH KRIST ******************************/ SPR_KRIST_S1,SPR_KRIST_S2,SPR_KRIST_S3,SPR_KRIST_S4, SPR_KRIST_S5,SPR_KRIST_S6,SPR_KRIST_S7,SPR_KRIST_S8, SPR_KRIST_LEFT1,SPR_KRIST_LEFT2,SPR_KRIST_LEFT3,SPR_KRIST_LEFT4, SPR_KRIST_LEFT5,SPR_KRIST_LEFT6,SPR_KRIST_LEFT7,SPR_KRIST_LEFT8, SPR_KRIST_SHOOT1,SPR_KRIST_SHOOT2,SPR_KRIST_SHOOT3,SPR_KRIST_SHOOT4, SPR_KRIST_SHOOT5,SPR_KRIST_SHOOT6,SPR_KRIST_SHOOT7,SPR_KRIST_SHOOT8, SPR_KRIST_SHOOT9,SPR_KRIST_SHOOT10,SPR_KRIST_SHOOT11, //SPR_KRIST_PAIN1,SPR_KRIST_PAIN2,SPR_KRIST_PAIN3,SPR_KRIST_PAIN4, //SPR_KRIST_PAIN5,SPR_KRIST_PAIN6,SPR_KRIST_PAIN7,SPR_KRIST_PAIN8, SPR_KRIST_DIE1,SPR_KRIST_DIE2,SPR_KRIST_DEAD1,SPR_KRIST_DEAD2, SPR_KRIST_DEAD3,SPR_KRIST_DEAD4,SPR_KRIST_DEAD5,SPR_KRIST_DEAD6, SPR_KRIST_DEAD7,SPR_KRIST_DEAD8, SPR_KRIST_RIGHT1,SPR_KRIST_RIGHT2,SPR_KRIST_RIGHT3,SPR_KRIST_RIGHT4, SPR_KRIST_RIGHT5,SPR_KRIST_RIGHT6,SPR_KRIST_RIGHT7,SPR_KRIST_RIGHT8, SPR_KRIST_FOR1,SPR_KRIST_FOR2,SPR_KRIST_FOR3,SPR_KRIST_FOR4, SPR_KRIST_FOR5,SPR_KRIST_FOR6,SPR_KRIST_FOR7,SPR_KRIST_FOR8, //SPR_KRIST_BACK1,SPR_KRIST_BACK2,SPR_KRIST_BACK3,SPR_KRIST_BACK4, //SPR_KRIST_BACK5,SPR_KRIST_BACK6,SPR_KRIST_BACK7,SPR_KRIST_BACK8, SPR_KRIST_MINERIGHT1,SPR_KRIST_MINERIGHT2,SPR_KRIST_MINERIGHT3,SPR_KRIST_MINERIGHT4, SPR_KRIST_MINERIGHT5,SPR_KRIST_MINERIGHT6,SPR_KRIST_MINERIGHT7,SPR_KRIST_MINERIGHT8, //SPR_KRIST_MINELEFT1,SPR_KRIST_MINELEFT2,SPR_KRIST_MINELEFT3,SPR_KRIST_MINELEFT4, //SPR_KRIST_MINELEFT5,SPR_KRIST_MINELEFT6,SPR_KRIST_MINELEFT7,SPR_KRIST_MINELEFT8, SPR_KRIST_DOPE1,SPR_KRIST_DOPE2,SPR_KRIST_DOPE3, /************************* NME ******************************/ NMEHEAD1_01,NMEHEAD1_02,NMEHEAD1_03,NMEHEAD1_04, NMEHEAD1_05,NMEHEAD1_06,NMEHEAD1_07,NMEHEAD1_08, NMEHEAD1_09,NMEHEAD1_10,NMEHEAD1_11,NMEHEAD1_12, NMEHEAD1_13,NMEHEAD1_14,NMEHEAD1_15,NMEHEAD1_16, NMEHEAD2_01,NMEHEAD2_02,NMEHEAD2_03,NMEHEAD2_04, NMEHEAD2_05,NMEHEAD2_06,NMEHEAD2_07,NMEHEAD2_08, NMEHEAD2_09,NMEHEAD2_10,NMEHEAD2_11,NMEHEAD2_12, NMEHEAD2_13,NMEHEAD2_14,NMEHEAD2_15,NMEHEAD2_16, NMEBODY1_01,NMEBODY1_02,NMEBODY1_03,NMEBODY1_04, NMEBODY1_05,NMEBODY1_06,NMEBODY1_07,NMEBODY1_08, NMEBODY1_09,NMEBODY1_10,NMEBODY1_11,NMEBODY1_12, NMEBODY1_13,NMEBODY1_14,NMEBODY1_15,NMEBODY1_16, NMEBODY2_01,NMEBODY2_02,NMEBODY2_03,NMEBODY2_04, NMEBODY2_05,NMEBODY2_06,NMEBODY2_07,NMEBODY2_08, NMEBODY2_09,NMEBODY2_10,NMEBODY2_11,NMEBODY2_12, NMEBODY2_13,NMEBODY2_14,NMEBODY2_15,NMEBODY2_16, NMEBODY3_01,NMEBODY3_02,NMEBODY3_03,NMEBODY3_04, NMEBODY3_05,NMEBODY3_06,NMEBODY3_07,NMEBODY3_08, NMEBODY3_09,NMEBODY3_10,NMEBODY3_11,NMEBODY3_12, NMEBODY3_13,NMEBODY3_14,NMEBODY3_15,NMEBODY3_16, NMEBODY4_01,NMEBODY4_02,NMEBODY4_03,NMEBODY4_04, NMEBODY4_05,NMEBODY4_06,NMEBODY4_07,NMEBODY4_08, NMEBODY4_09,NMEBODY4_10,NMEBODY4_11,NMEBODY4_12, NMEBODY4_13,NMEBODY4_14,NMEBODY4_15,NMEBODY4_16, NMEWHEEL1_01,NMEWHEEL1_02,NMEWHEEL1_03,NMEWHEEL1_04, NMEWHEEL1_05,NMEWHEEL1_06,NMEWHEEL1_07,NMEWHEEL1_08, NMEWHEEL1_09,NMEWHEEL1_10,NMEWHEEL1_11,NMEWHEEL1_12, NMEWHEEL1_13,NMEWHEEL1_14,NMEWHEEL1_15,NMEWHEEL1_16, NMEWHEEL2_01,NMEWHEEL2_02,NMEWHEEL2_03,NMEWHEEL2_04, NMEWHEEL2_05,NMEWHEEL2_06,NMEWHEEL2_07,NMEWHEEL2_08, NMEWHEEL2_09,NMEWHEEL2_10,NMEWHEEL2_11,NMEWHEEL2_12, NMEWHEEL2_13,NMEWHEEL2_14,NMEWHEEL2_15,NMEWHEEL2_16, NMEWHEEL3_01,NMEWHEEL3_02,NMEWHEEL3_03,NMEWHEEL3_04, NMEWHEEL3_05,NMEWHEEL3_06,NMEWHEEL3_07,NMEWHEEL3_08, NMEWHEEL3_09,NMEWHEEL3_10,NMEWHEEL3_11,NMEWHEEL3_12, NMEWHEEL3_13,NMEWHEEL3_14,NMEWHEEL3_15,NMEWHEEL3_16, NMEWHEEL4_01,NMEWHEEL4_02,NMEWHEEL4_03,NMEWHEEL4_04, NMEWHEEL4_05,NMEWHEEL4_06,NMEWHEEL4_07,NMEWHEEL4_08, NMEWHEEL4_09,NMEWHEEL4_10,NMEWHEEL4_11,NMEWHEEL4_12, NMEWHEEL4_13,NMEWHEEL4_14,NMEWHEEL4_15,NMEWHEEL4_16, NMEWHEEL5_01,NMEWHEEL5_02,NMEWHEEL5_03,NMEWHEEL5_04, NMEWHEEL5_05,NMEWHEEL5_06,NMEWHEEL5_07,NMEWHEEL5_08, NMEWHEEL5_09,NMEWHEEL5_10,NMEWHEEL5_11,NMEWHEEL5_12, NMEWHEEL5_13,NMEWHEEL5_14,NMEWHEEL5_15,NMEWHEEL5_16, NMEROCKET_01,NMEROCKET_02,NMEROCKET_03,NMEROCKET_04, NMEROCKET_05,NMEROCKET_06,NMEROCKET_07,NMEROCKET_08, NMEROCKET_09,NMEROCKET_10,NMEROCKET_11,NMEROCKET_12, NMEROCKET_13,NMEROCKET_14,NMEROCKET_15,NMEROCKET_16, NMEROCKET2_01,NMEROCKET2_02,NMEROCKET2_03,NMEROCKET2_04, NMEROCKET2_05,NMEROCKET2_06,NMEROCKET2_07,NMEROCKET2_08, NMEROCKET2_09,NMEROCKET2_10,NMEROCKET2_11,NMEROCKET2_12, NMEROCKET2_13,NMEROCKET2_14,NMEROCKET2_15,NMEROCKET2_16, NMEMINIBALL_01,NMEMINIBALL_02,NMEMINIBALL_03,NMEMINIBALL_04, NMESAUCER_01,NMESAUCER_02,NMESAUCER_03,NMESAUCER_04, /************************** TOM ****************************************/ TOMS1,TOMS2,TOMS3,TOMS4,TOMS5,TOMS6,TOMS7,TOMS8, TOMFLY11,TOMFLY12,TOMFLY13,TOMFLY14, TOMFLY15,TOMFLY16,TOMFLY17,TOMFLY18, TOMFLY21,TOMFLY22,TOMFLY23,TOMFLY24, TOMFLY25,TOMFLY26,TOMFLY27,TOMFLY28, TOMLG1,TOMLG2,TOMLG3,TOMLG4, TOMLG5,TOMLG6,TOMLG7,TOMLG8, TOMLG9,TOMLG10,TOMLG11, TOMFS1,TOMFS2,TOMFS3,TOMFS4, TOMFS5,TOMFS6, TOMBR1,TOMBR2,TOMBR3,TOMBR4, TOMBR5,TOMBR6,TOMBR7,TOMBR8, TOMHEAD1,TOMHEAD2,TOMHEAD3,TOMHEAD4, TOMHEAD5,TOMHEAD6,TOMHEAD7,TOMHEAD8, TPREPARE , THDIE1 , THDIE2 , TAWAKEN1,TAWAKEN2,TAWAKEN3,TAWAKEN4, TAWAKEN5, THBALL1 ,THBALL2 ,THBALL3 ,THBALL4 , THBALL5 ,THBALL6 ,THBALL7 ,THBALL8 , THBALL9 , TSPHERE1,TSPHERE2,TSPHERE3,TSPHERE4, TSPHERE5,TSPHERE6,TSPHERE7,TSPHERE8, TSPHERE9,TSPHERE10, TBBALL1 ,TBBALL2 ,TBBALL3 ,TBBALL4 , TBBALL5 ,TBBALL6 ,TBBALL7 ,TBBALL8 , TBBALL9 , TSCAREB1,TSCAREB2,TSCAREB3,TSCAREB4, TSCAREB5, TOMDIE1 ,TOMDIE2 ,TOMDIE3 ,TOMDIE4 , TOMDIE5 ,TOMDIE6 ,TOMDIE7 ,TOMDIE8 , TOMRH1 ,TOMRH2 ,TOMRH3 ,TOMRH4 , TOMRH5 ,TOMRH6 ,TOMRH7 ,TOMRH8 , TOHRH1 ,TOHRH2 ,TOHRH3 ,TOHRH4 , TOHRH5 ,TOHRH6 ,TOHRH7 ,TOHRH8 , SPEARDOWN1,SPEARDOWN2,SPEARDOWN3,SPEARDOWN4, SPEARDOWN5,SPEARDOWN6,SPEARDOWN7,SPEARDOWN8, SPEARDOWN9,SPEARDOWN10,SPEARDOWN11,SPEARDOWN12, SPEARDOWN13,SPEARDOWN14,SPEARDOWN15,SPEARDOWN16, DBLADE1,DBLADE2,DBLADE3,DBLADE4, DBLADE5,DBLADE6,DBLADE7,DBLADE8, DBLADE9,//DBLADE10,DBLADE11,DBLADE12, //DBLADE13,DBLADE14,DBLADE15,DBLADE16, FIREJETDOWN1,FIREJETDOWN2,FIREJETDOWN3,FIREJETDOWN4, FIREJETDOWN5,FIREJETDOWN6,FIREJETDOWN7,FIREJETDOWN8, FIREJETDOWN9,FIREJETDOWN10,FIREJETDOWN11,FIREJETDOWN12, FIREJETDOWN13,FIREJETDOWN14,FIREJETDOWN15,FIREJETDOWN16, FIREJETDOWN17,FIREJETDOWN18,FIREJETDOWN19,FIREJETDOWN20, FIREJETDOWN21,FIREJETDOWN22,FIREJETDOWN23, CRUSHUP1,CRUSHUP2,CRUSHUP3,CRUSHUP4, CRUSHUP5,CRUSHUP6,CRUSHUP7,CRUSHUP8, SPINUBLADE_01,SPINUBLADE_02,SPINUBLADE_03,SPINUBLADE_04, SPINUBLADE_05,SPINUBLADE_06,SPINUBLADE_07,SPINUBLADE_08, SPINUBLADE_09,SPINUBLADE_10,SPINUBLADE_11,SPINUBLADE_12, SPINUBLADE_13,SPINUBLADE_14,SPINUBLADE_15,SPINUBLADE_16, SPINDBLADE_01,SPINDBLADE_02,SPINDBLADE_03,SPINDBLADE_04, SPINDBLADE_05,SPINDBLADE_06,SPINDBLADE_07,SPINDBLADE_08, SPINDBLADE_09,SPINDBLADE_10,SPINDBLADE_11,SPINDBLADE_12, SPINDBLADE_13,SPINDBLADE_14,SPINDBLADE_15,SPINDBLADE_16, DIP11,DIP21,DIP31, TOMLARVA1, TOMLARVA2, TOMLARVA3, TOMLARVA4, SCOTHEAD1,SCOTHEAD2,SCOTHEAD3,SCOTHEAD4, SCOTHEAD5,SCOTHEAD6,SCOTHEAD7, KNIFE_STATUE1,KNIFE_STATUE2,KNIFE_STATUE3,KNIFE_STATUE4, KNIFE_STATUE5,KNIFE_STATUE6,KNIFE_STATUE7,KNIFE_STATUE8, EMPTY_STATUE1,EMPTY_STATUE2,EMPTY_STATUE3,EMPTY_STATUE4, EMPTY_STATUE5,EMPTY_STATUE6,EMPTY_STATUE7,EMPTY_STATUE8, BAT1,BAT2,BAT3,BAT4, BAT5,BAT6,BAT7,BAT8, BAT9,BAT10,BAT11,BAT12, BAT13,BAT14,BAT15,BAT16, DOGPOWERUP1, DOGPOWERUP2, DOGPOWERUP3, DOGPOWERUP4, DOGPOWERUP5, DOGPOWERUP6, DOGPOWERUP7, DOGPOWERUP8, THREEUP01, THREEUP02, THREEUP03, THREEUP04, THREEUP05, THREEUP06, THREEUP07, THREEUP08, BOULDER11,BOULDER21,BOULDER31,BOULDER41, BDROP1,BDROP2,BDROP3,BDROP4,BDROP5,BDROP6,BDROP7,BDROP8,BDROP9, BDROP10,BDROP11, BSINK1,BSINK2,BSINK3,BSINK4,BSINK5,BSINK6,BSINK7,BSINK8,BSINK9, GUNRISE11,GUNRISE12,GUNRISE13,GUNRISE14, GUNRISE15,GUNRISE16,GUNRISE17,GUNRISE18, GUNRISE21,GUNRISE22,GUNRISE23,GUNRISE24, GUNRISE25,GUNRISE26,GUNRISE27,GUNRISE28, GUNRISE31,GUNRISE32,GUNRISE33,GUNRISE34, GUNRISE35,GUNRISE36,GUNRISE37,GUNRISE38, GUNRISE41,GUNRISE42,GUNRISE43,GUNRISE44, GUNRISE45,GUNRISE46,GUNRISE47,GUNRISE48, GUNRISE51,GUNRISE52,GUNRISE53,GUNRISE54, GUNRISE55,GUNRISE56,GUNRISE57,GUNRISE58, GUNFIRE1,GUNFIRE2,GUNFIRE3,GUNFIRE4, GUNFIRE5,GUNFIRE6,GUNFIRE7,GUNFIRE8, GUNDEAD1,GUNDEAD2, FOURWAY01,FOURWAY02,FOURWAY03,FOURWAY04, FOURWAY05,FOURWAY06,FOURWAY07,FOURWAY08, FOURWAYFIRE01,FOURWAYFIRE02,FOURWAYFIRE03,FOURWAYFIRE04, FOURWAYFIRE05,FOURWAYFIRE06,FOURWAYFIRE07,FOURWAYFIRE08, TOMLIGHTNING1,TOMLIGHTNING2,TOMLIGHTNING3,TOMLIGHTNING4, TOMLIGHTNING5,TOMLIGHTNING6,TOMLIGHTNING7,TOMLIGHTNING8, TOMSPHERE1,TOMSPHERE2,TOMSPHERE3,TOMSPHERE4, TOMHANDBALL1,TOMHANDBALL2, TOMFACEBALL1,TOMFACEBALL2, TOMFLOORSPARK1,TOMFLOORSPARK2,TOMFLOORSPARK3,TOMFLOORSPARK4, TOMSPIT1,TOMSPIT2,TOMSPIT3,TOMSPIT4, SPITHIT1,SPITHIT2,SPITHIT3,SPITHIT4, MONKFIRE1,MONKFIRE2,MONKFIRE3,MONKFIRE4, BATBLAST1,BATBLAST2,BATBLAST3,BATBLAST4, KESSPHERE1,KESSPHERE2,KESSPHERE3,KESSPHERE4, KESSPHERE5,KESSPHERE6,KESSPHERE7,KESSPHERE8, SPR_BOLO1,SPR_BOLO2,SPR_BOLO3,SPR_BOLO4, //MED DOPE1,DOPE2,DOPE3,DOPE4,DOPE5,DOPE6,DOPE7,DOPE8, //CRUSHUP9,CRUSHUP10,CRUSHUP11,CRUSHUP12, //CRUSHUP13,CRUSHUP14,CRUSHUP15,CRUSHUP16, /***************** Highguard 2 (Steve H.) ***************************************/ SPR_HIGHGRD2_SHOOT1,SPR_HIGHGRD2_SHOOT2,SPR_HIGHGRD2_SHOOT3,SPR_HIGHGRD2_SHOOT4, SPR_HIGHGRD2_S1,SPR_HIGHGRD2_S2,SPR_HIGHGRD2_S3,SPR_HIGHGRD2_S4, SPR_HIGHGRD2_S5,SPR_HIGHGRD2_S6,SPR_HIGHGRD2_S7,SPR_HIGHGRD2_S8, SPR_HIGHGRD2_W11,SPR_HIGHGRD2_W12,SPR_HIGHGRD2_W13,SPR_HIGHGRD2_W14, SPR_HIGHGRD2_W15,SPR_HIGHGRD2_W16,SPR_HIGHGRD2_W17,SPR_HIGHGRD2_W18, SPR_HIGHGRD2_W21,SPR_HIGHGRD2_W22,SPR_HIGHGRD2_W23,SPR_HIGHGRD2_W24, SPR_HIGHGRD2_W25,SPR_HIGHGRD2_W26,SPR_HIGHGRD2_W27,SPR_HIGHGRD2_W28, SPR_HIGHGRD2_W31,SPR_HIGHGRD2_W32,SPR_HIGHGRD2_W33,SPR_HIGHGRD2_W34, SPR_HIGHGRD2_W35,SPR_HIGHGRD2_W36,SPR_HIGHGRD2_W37,SPR_HIGHGRD2_W38, SPR_HIGHGRD2_W41,SPR_HIGHGRD2_W42,SPR_HIGHGRD2_W43,SPR_HIGHGRD2_W44, SPR_HIGHGRD2_W45,SPR_HIGHGRD2_W46,SPR_HIGHGRD2_W47,SPR_HIGHGRD2_W48, SPR_HIGHGRD2_PAIN1,SPR_HIGHGRD2_PAIN2, SPR_HIGHGRD2_DIE1,SPR_HIGHGRD2_DIE2,SPR_HIGHGRD2_DIE3,SPR_HIGHGRD2_DIE4, SPR_HIGHGRD2_DIE5,SPR_HIGHGRD2_DEAD, SPR_HIGHGRD2_WPAIN1,SPR_HIGHGRD2_WPAIN2, SPR_HIGHGRD2_WDIE1,SPR_HIGHGRD2_WDIE2,SPR_HIGHGRD2_WDIE3,SPR_HIGHGRD2_WDIE4, SPR_HIGHGRD2_WDIE5,SPR_HIGHGRD2_WDEAD, /* SPR_HIGHGRD2_USE11,SPR_HIGHGRD2_USE12,SPR_HIGHGRD2_USE13,SPR_HIGHGRD2_USE14, SPR_HIGHGRD2_USE15,SPR_HIGHGRD2_USE16,SPR_HIGHGRD2_USE17,SPR_HIGHGRD2_USE18, SPR_HIGHGRD2_USE21,SPR_HIGHGRD2_USE22,SPR_HIGHGRD2_USE23,SPR_HIGHGRD2_USE24, SPR_HIGHGRD2_USE25,SPR_HIGHGRD2_USE26,SPR_HIGHGRD2_USE27,SPR_HIGHGRD2_USE28, */ /****************** Alt. Overpatrol (Pat) ***********************************/ SPR_PAT_SHOOT1,SPR_PAT_SHOOT2,SPR_PAT_SHOOT3,SPR_PAT_SHOOT4, SPR_PAT_BOLOSHOOT1,SPR_PAT_BOLOSHOOT2,SPR_PAT_BOLOSHOOT3,SPR_PAT_BOLOSHOOT4, SPR_PAT_BOLOSHOOT5, SPR_PAT_S1,SPR_PAT_S2,SPR_PAT_S3,SPR_PAT_S4, SPR_PAT_S5,SPR_PAT_S6,SPR_PAT_S7,SPR_PAT_S8, SPR_PAT_W11,SPR_PAT_W12,SPR_PAT_W13,SPR_PAT_W14, SPR_PAT_W15,SPR_PAT_W16,SPR_PAT_W17,SPR_PAT_W18, SPR_PAT_W21,SPR_PAT_W22,SPR_PAT_W23,SPR_PAT_W24, SPR_PAT_W25,SPR_PAT_W26,SPR_PAT_W27,SPR_PAT_W28, SPR_PAT_W31,SPR_PAT_W32,SPR_PAT_W33,SPR_PAT_W34, SPR_PAT_W35,SPR_PAT_W36,SPR_PAT_W37,SPR_PAT_W38, SPR_PAT_W41,SPR_PAT_W42,SPR_PAT_W43,SPR_PAT_W44, SPR_PAT_W45,SPR_PAT_W46,SPR_PAT_W47,SPR_PAT_W48, SPR_PAT_PAIN1,SPR_PAT_PAIN2, SPR_PAT_ALTDIE1,SPR_PAT_ALTDIE2,SPR_PAT_ALTDIE3, SPR_PAT_ALTDIE4,SPR_PAT_ALTDIE5,SPR_PAT_ALTDEAD, SPR_PAT_WPAIN1,SPR_PAT_WPAIN2, SPR_PAT_WALTDIE1,SPR_PAT_WALTDIE2,SPR_PAT_WALTDIE3, SPR_PAT_WALTDIE4,SPR_PAT_WALTDIE5,SPR_PAT_WALTDEAD, SPR_PAT_DIE1,SPR_PAT_DIE2,SPR_PAT_DIE3, SPR_PAT_DIE4,SPR_PAT_DIE5,SPR_PAT_DIE6, SPR_PAT_DEAD, /******************** Alt. Lightning Guard (Ann) **********************************/ SPR_ANN_SHOOT1,SPR_ANN_SHOOT2,SPR_ANN_SHOOT3,SPR_ANN_SHOOT4, SPR_ANN_KSHOOT1,SPR_ANN_KSHOOT2,SPR_ANN_KSHOOT3, SPR_ANN_S1,SPR_ANN_S2,SPR_ANN_S3,SPR_ANN_S4, SPR_ANN_S5,SPR_ANN_S6,SPR_ANN_S7,SPR_ANN_S8, SPR_ANN_W11,SPR_ANN_W12,SPR_ANN_W13,SPR_ANN_W14, SPR_ANN_W15,SPR_ANN_W16,SPR_ANN_W17,SPR_ANN_W18, SPR_ANN_W21,SPR_ANN_W22,SPR_ANN_W23,SPR_ANN_W24, SPR_ANN_W25,SPR_ANN_W26,SPR_ANN_W27,SPR_ANN_W28, SPR_ANN_W31,SPR_ANN_W32,SPR_ANN_W33,SPR_ANN_W34, SPR_ANN_W35,SPR_ANN_W36,SPR_ANN_W37,SPR_ANN_W38, SPR_ANN_W41,SPR_ANN_W42,SPR_ANN_W43,SPR_ANN_W44, SPR_ANN_W45,SPR_ANN_W46,SPR_ANN_W47,SPR_ANN_W48, SPR_ANN_PAIN1,SPR_ANN_PAIN2, SPR_ANN_DIE1,SPR_ANN_DIE2,SPR_ANN_DIE3, SPR_ANN_DIE4,SPR_ANN_DEAD1,SPR_ANN_DEAD2,SPR_ANN_DEAD3, SPR_ANN_WPAIN1,SPR_ANN_WPAIN2, SPR_ANN_WDIE1,SPR_ANN_WDIE2,SPR_ANN_WDIE3, SPR_ANN_WDIE4,SPR_ANN_WDEAD1,SPR_ANN_WDEAD2,SPR_ANN_WDEAD3, SPR_ANN_RROLL1,SPR_ANN_RROLL2,SPR_ANN_RROLL3,SPR_ANN_RROLL4, SPR_ANN_RROLL5,SPR_ANN_RROLL6, SPR_ANN_LROLL1,SPR_ANN_LROLL2,SPR_ANN_LROLL3,SPR_ANN_LROLL4, SPR_ANN_LROLL5,SPR_ANN_LROLL6, /********************** Alt. Blitzguard (William) **********************************/ SPR_WILLIAM_SHOOT1,SPR_WILLIAM_SHOOT2,SPR_WILLIAM_SHOOT3,SPR_WILLIAM_SHOOT4, SPR_WILLIAM_S1,SPR_WILLIAM_S2,SPR_WILLIAM_S3,SPR_WILLIAM_S4, SPR_WILLIAM_S5,SPR_WILLIAM_S6,SPR_WILLIAM_S7,SPR_WILLIAM_S8, SPR_WILLIAM_W11,SPR_WILLIAM_W12,SPR_WILLIAM_W13,SPR_WILLIAM_W14, SPR_WILLIAM_W15,SPR_WILLIAM_W16,SPR_WILLIAM_W17,SPR_WILLIAM_W18, SPR_WILLIAM_W21,SPR_WILLIAM_W22,SPR_WILLIAM_W23,SPR_WILLIAM_W24, SPR_WILLIAM_W25,SPR_WILLIAM_W26,SPR_WILLIAM_W27,SPR_WILLIAM_W28, SPR_WILLIAM_W31,SPR_WILLIAM_W32,SPR_WILLIAM_W33,SPR_WILLIAM_W34, SPR_WILLIAM_W35,SPR_WILLIAM_W36,SPR_WILLIAM_W37,SPR_WILLIAM_W38, SPR_WILLIAM_W41,SPR_WILLIAM_W42,SPR_WILLIAM_W43,SPR_WILLIAM_W44, SPR_WILLIAM_W45,SPR_WILLIAM_W46,SPR_WILLIAM_W47,SPR_WILLIAM_W48, SPR_WILLIAM_PAIN1, SPR_WILLIAM_PAIN2,SPR_WILLIAM_DIE1,SPR_WILLIAM_DIE2, SPR_WILLIAM_DIE3,SPR_WILLIAM_DIE4,SPR_WILLIAM_DEAD1, SPR_WILLIAM_DEAD2, SPR_WILLIAM_WPAIN1, SPR_WILLIAM_WPAIN2,SPR_WILLIAM_WDIE1,SPR_WILLIAM_WDIE2, SPR_WILLIAM_WDIE3,SPR_WILLIAM_WDIE4,SPR_WILLIAM_WDEAD1, SPR_WILLIAM_WDEAD2, SPR_WILLIAM_RISE1, SPR_WILLIAM_RISE2, SPR_WILLIAM_RISE3, SPR_WILLIAM_RISE4, SPR_WILLIAM_USE11,SPR_WILLIAM_USE12,SPR_WILLIAM_USE13,SPR_WILLIAM_USE14, SPR_WILLIAM_USE15,SPR_WILLIAM_USE16,SPR_WILLIAM_USE17,SPR_WILLIAM_USE18, SPR_WILLIAM_USE21,SPR_WILLIAM_USE22,SPR_WILLIAM_USE23,SPR_WILLIAM_USE24, SPR_WILLIAM_USE25,SPR_WILLIAM_USE26,SPR_WILLIAM_USE27,SPR_WILLIAM_USE28, /******************* Fire monk (Mark)**********************************/ SPR_MARK_CAST1,SPR_MARK_CAST2,SPR_MARK_CAST3,SPR_MARK_CAST4, SPR_MARK_CAST5,SPR_MARK_CAST6,SPR_MARK_CAST7, SPR_MARK_S1,SPR_MARK_S2,SPR_MARK_S3,SPR_MARK_S4, SPR_MARK_S5,SPR_MARK_S6,SPR_MARK_S7,SPR_MARK_S8, SPR_MARK_W11,SPR_MARK_W12,SPR_MARK_W13,SPR_MARK_W14, SPR_MARK_W15,SPR_MARK_W16,SPR_MARK_W17,SPR_MARK_W18, SPR_MARK_W21,SPR_MARK_W22,SPR_MARK_W23,SPR_MARK_W24, SPR_MARK_W25,SPR_MARK_W26,SPR_MARK_W27,SPR_MARK_W28, SPR_MARK_W31,SPR_MARK_W32,SPR_MARK_W33,SPR_MARK_W34, SPR_MARK_W35,SPR_MARK_W36,SPR_MARK_W37,SPR_MARK_W38, SPR_MARK_W41,SPR_MARK_W42,SPR_MARK_W43,SPR_MARK_W44, SPR_MARK_W45,SPR_MARK_W46,SPR_MARK_W47,SPR_MARK_W48, SPR_MARK_PAIN1,SPR_MARK_PAIN2, SPR_MARK_DIE1,SPR_MARK_DIE2,SPR_MARK_DIE3,SPR_MARK_DIE4, SPR_MARK_DEAD1,SPR_MARK_DEAD2,SPR_MARK_DEAD3,SPR_MARK_DEAD4, SPR_MARK_DEAD5,SPR_MARK_DEAD6,SPR_MARK_DEAD7, /* SPR_FIREMONK_USE11,SPR_FIREMONK_USE12,SPR_FIREMONK_USE13,SPR_FIREMONK_USE14, SPR_FIREMONK_USE15,SPR_FIREMONK_USE16,SPR_FIREMONK_USE17,SPR_FIREMONK_USE18, SPR_FIREMONK_USE21,SPR_FIREMONK_USE22,SPR_FIREMONK_USE23,SPR_FIREMONK_USE24, SPR_FIREMONK_USE25,SPR_FIREMONK_USE26,SPR_FIREMONK_USE27,SPR_FIREMONK_USE28, */ //#endif } actornames_t; typedef enum {GUNSTART_LABEL, #if (SHAREWARE == 0) W_KNIFE,WK2,WK3,WK4,WK5,WK6,WK7,WK8,WK9,WK10, W_BMALEPISTOL1,xab,xcd, W_BMRIGHTPISTOL1,xef,xgh, W_BMLEFTPISTOL1,xij,xkl, #endif W_MALEPISTOL1,x5,x6, W_MRIGHTPISTOL1,x7,x8, W_MLEFTPISTOL1,x9,x10, #if (SHAREWARE == 0) W_FEMALEPISTOL1,x11,x12, W_FRIGHTPISTOL1,x13,x14, W_FLEFTPISTOL1,x15,x16, #endif W_MP40,FN7,FN8, W_BAZOOKA,FN22,fn104,fn105, W_HEATSEEKER,FN80,fn108,fn109, W_DRUNK,FN72,FN73,FN74, W_FIREBOMB,FN33,fn106,fn107, W_FIREWALL,FN66,FN67, W_GODHAND,ded1,ded2,ded3,ded4,ded5,ded6,ded7, #if (SHAREWARE == 0) W_SPLIT,FN69,FN70,FN71, W_KES,fn101,fn102,fn103,x99,x100, W_BAT,fn111,fn112,fn113,fn114,fn115,fn117, W_DOG,bite1,bite2,bite3,nose1,nose2,nose3,nose4,paw1,paw2,paw3,paw4 #endif } weaponsprites; #define SPR_DDOG_FIRE1 SPR_DDOG_JUMP1 #define SPR_DDOG_FIRE2 SPR_DDOG_JUMP2 #define SPR_DDOG_BOLTS2 SPR_DDOG_BOLTS1 #define SPR_DDOG_BOLTS3 SPR_DDOG_BOLTS1 #define SPR_DDOG_BOLTS4 SPR_DDOG_BOLTS1 #define SPR_DDOG_HIT1 -1 #define SPR_DDOG_HIT2 -1 #define SPR_DDOG_HIT3 -1 #define SPR_DDOG_PAIN1 SPR_DDOG_DIE1 #define SPR_DDOG_PAIN2 SPR_DDOG_DIE1 #define SPR_BLITZ_USE SPR_BLITZ_S1 #define SPR_BLITZ_STEAL1 SPR_BLITZ_USE11 #define SPR_BLITZ_STEAL2 SPR_BLITZ_USE12 #define SPR_GRENADE_HIT1 -1 #define SPR_GRENADE_HIT2 -1 #define SPR_GRENADE_HIT3 -1 #define SPR_FIREBALL_HIT1 -1 #define SPR_FIREBALL_HIT2 -1 #define SPR_FIREBALL_HIT3 -1 #define SPR_ROBOGRD_SHURIKEN1 SPR_BSTAR1 #define SPR_ROBOGRD_SHURIKEN2 SPR_BSTAR2 #define SPR_ROBOGRD_SHURIKEN3 SPR_BSTAR3 #define SPR_ROBOGRD_SHURIKEN4 SPR_BSTAR4 #define SPR_SHURIKEN_HIT1 -1 #define SPR_SHURIKEN_HIT2 -1 #define SPR_SHURIKEN_HIT3 -1 #define SPR_ESAU_USE SPR_ESAU_S1 #define SPR_ESAU_WINS SPR_ESAU_S1 #define SPR_ESAU_DIE4 SPR_ESAU_DIE3 #define SPR_ESAU_DIE5 SPR_ESAU_DIE3 #define SPR_ESAU_DIE6 SPR_ESAU_DIE3 #define SPR_ESAU_DIE7 SPR_ESAU_DIE3 #define SPR_MISSILEHIT1 -1 #define SPR_MISSILEHIT2 -1 #define SPR_MISSILEHIT3 -1 #define SPR_HEINRICH_DIE4 SPR_HEINRICH_DIE3 #define SPR_HEINRICH_DIE5 SPR_HEINRICH_DIE3 #define SPR_HEINRICH_DIE6 SPR_HEINRICH_DIE3 #define SPR_HEINRICH_DIE7 SPR_HEINRICH_DIE3 #define SPR_HEINRICH_DEAD SPR_HEINRICH_DIE3 #define SPR_HEINRICH_MINE SPR_HEINRICH_S1 #define SPR_HEINRICH_USE SPR_HEINRICH_S1 #define SPR_DMFBALL11 SPR_FIREBALL1 #define SPR_DMFBALL21 SPR_FIREBALL2 #define SPR_DMFBALL31 SPR_FIREBALL3 #define SPR_DMFBALL41 SPR_FIREBALL4 #define SPR_DMFBALLHIT1 -1 #define SPR_DMFBALLHIT2 -1 #define SPR_DMFBALLHIT3 -1 #define SPR_DARKMONK_DIE4 SPR_DARKMONK_DIE3 #define SPR_DARKMONK_DIE5 SPR_DARKMONK_DIE3 #define SPR_DARKMONK_DIE6 SPR_DARKMONK_DIE3 #define SPR_DARKMONK_DIE7 SPR_DARKMONK_DIE3 #define SPR_DARKMONK_PAIN1 SPR_DARKMONK_DIE1 #define SPR_DARKMONK_PAIN2 SPR_DARKMONK_DIE5 #define SPR_OSHURHIT1 -1 #define SPR_OSHURHIT2 -1 #define SPR_OSHURHIT3 -1 #define SPR_OSHUR1 SPR_BSTAR1 #define SPR_OSHUR2 SPR_BSTAR2 #define SPR_OSHUR3 SPR_BSTAR4 #define SPR_OSHUR4 SPR_BSTAR4 #define SPR_WALLSHOOT SPR_WALLSTAND1 #define SPR_WALLPATH1 SPR_WALLSTAND1 #endif rott-20230810/rott/states.h000066400000000000000000000422111446517470200154210ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _states_public #define _states_public #include "develop.h" #if (SHAREWARE == 0) #define MAXSTATES 1300+17+8+32+32 #else #define MAXSTATES 660+17+8+32+32 #endif #define SF_CLOSE 0x01 #define SF_CRUSH 0x02 #define SF_UP 0x04 #define SF_DOWN 0x08 #define SF_SOUND 0x10 #define SF_BLOCK 0x20 #define SF_EYE1 0 #define SF_EYE2 1 #define SF_EYE3 2 #define SF_DOGSTATE 0x40 #define SF_BAT 0x80 #define SF_FAKING 0x80 #define SF_DEAD 0x80 typedef struct statestruct { byte rotate; short shapenum; // a shapenum of -1 means get from ob->temp1 short tictime; void (*think) (); signed char condition; struct statestruct *next; } statetype; extern statetype * statetable[MAXSTATES]; extern statetype s_lowgrdstand; extern statetype s_lowgrdpath4; extern statetype s_lowgrdpath3; extern statetype s_lowgrdpath2; extern statetype s_lowgrdpath1; extern statetype s_lowgrdcollide; extern statetype s_lowgrdcollide2; //extern statetype s_lowgrduse1; extern statetype s_lowgrdshoot1; extern statetype s_lowgrdchase1; extern statetype s_lowgrddie1; extern statetype s_lowgrdcrushed1; extern statetype s_lowgrdcrushed1; extern statetype s_sneakydown; extern statetype s_sneakyrise1; extern statetype s_highgrdstand; extern statetype s_highgrdpath1; extern statetype s_highgrdcollide; extern statetype s_highgrdcollide2; //extern statetype s_highgrduse1; extern statetype s_highgrdshoot1; extern statetype s_highgrdshoot3; extern statetype s_highgrdchase1; extern statetype s_highgrddie1; extern statetype s_highgrdcrushed1; extern statetype s_strikestand; extern statetype s_strikepath1; extern statetype s_strikecollide; extern statetype s_strikecollide2; extern statetype s_strikeshoot1; //extern statetype s_strikeuse1; extern statetype s_strikerollright1; extern statetype s_strikerollright3; extern statetype s_strikerollleft1; extern statetype s_strikerollleft3; extern statetype s_strikechase1; extern statetype s_strikedie1; extern statetype s_strikewait; extern statetype s_strikecrushed1; extern statetype s_blitzstand; extern statetype s_blitzpath1; extern statetype s_blitzcollide; extern statetype s_blitzcollide2; extern statetype s_blitzshoot1; extern statetype s_blitzuse; extern statetype s_blitzsteal1; extern statetype s_blitzchase1; extern statetype s_blitzdie1; extern statetype s_blitzdie3; extern statetype s_blitzplead1; extern statetype s_blitzplead3; extern statetype s_blitzplead4; extern statetype s_blitzplead7; extern statetype s_blitzaplead5; extern statetype s_blitzaplead4; extern statetype s_blitzcrushed1; extern statetype s_blitzfakedie1; extern statetype s_blitzrise2; extern statetype s_blitzstruggledie1; extern statetype s_blitzstruggledead; extern statetype s_enforcerstand; extern statetype s_enforcerpath1; extern statetype s_enforcercollide; extern statetype s_enforcercollide2; //extern statetype s_enforceruse1; extern statetype s_enforcershoot1; extern statetype s_enforcershoot3; extern statetype s_enforcerthrow1; extern statetype s_grenade1; extern statetype s_grenadehit1; extern statetype s_enforcerchase1; extern statetype s_enforcerdie1; extern statetype s_grenade_fall1; extern statetype s_grenade_fall6; extern statetype s_enforcercrushed1; extern statetype s_robogrdstand; extern statetype s_robogrdpath1; extern statetype s_robogrdshoot1; extern statetype s_robogrdshuriken1; extern statetype s_shurikenhit1; extern statetype s_robogrdchase1; extern statetype s_robogrddie1; extern statetype s_robogrdcollide; extern statetype s_robogrdcollide2; extern statetype s_robogrdcrushed1; extern statetype s_roboalign; extern statetype s_robowait; extern statetype s_roborealign; extern statetype s_altexplosion10; extern statetype s_altexplosion9 ; extern statetype s_altexplosion8 ; extern statetype s_altexplosion7 ; extern statetype s_altexplosion6 ; extern statetype s_altexplosion5 ; extern statetype s_altexplosion4 ; extern statetype s_altexplosion3 ; extern statetype s_altexplosion2 ; extern statetype s_altexplosion1 ; extern statetype s_explosion1; extern statetype s_explosion2; extern statetype s_explosion3; extern statetype s_explosion4; extern statetype s_explosion5; extern statetype s_explosion6; extern statetype s_explosion7; extern statetype s_explosion8; extern statetype s_explosion9; extern statetype s_explosion10; extern statetype s_explosion11; extern statetype s_explosion12; extern statetype s_explosion13; extern statetype s_explosion14; extern statetype s_explosion15; extern statetype s_explosion16; extern statetype s_explosion17; extern statetype s_explosion18; extern statetype s_explosion19; extern statetype s_explosion20; extern statetype s_grexplosion1; extern statetype s_grexplosion2; extern statetype s_grexplosion3; extern statetype s_grexplosion4; extern statetype s_grexplosion5; extern statetype s_grexplosion6; extern statetype s_grexplosion7; extern statetype s_grexplosion8; extern statetype s_grexplosion9; extern statetype s_grexplosion10; extern statetype s_grexplosion11; extern statetype s_grexplosion12; extern statetype s_grexplosion13; extern statetype s_grexplosion14; extern statetype s_grexplosion15; extern statetype s_grexplosion16; extern statetype s_grexplosion17; extern statetype s_grexplosion18; extern statetype s_grexplosion19; extern statetype s_grexplosion20; extern statetype s_staticexplosion1; extern statetype s_staticexplosion2; extern statetype s_staticexplosion3; extern statetype s_staticexplosion4; extern statetype s_staticexplosion5; extern statetype s_staticexplosion6; extern statetype s_staticexplosion7; extern statetype s_staticexplosion8; extern statetype s_staticexplosion9; extern statetype s_staticexplosion10; extern statetype s_staticexplosion11; extern statetype s_staticexplosion12; extern statetype s_staticexplosion13; extern statetype s_staticexplosion14; extern statetype s_staticexplosion15; extern statetype s_staticexplosion16; extern statetype s_staticexplosion17; extern statetype s_staticexplosion18; extern statetype s_staticexplosion19; extern statetype s_staticexplosion20; extern statetype s_staticexplosion21; extern statetype s_staticexplosion22; extern statetype s_staticexplosion23; extern statetype s_staticexplosion24; extern statetype s_staticexplosion25; extern statetype s_upblade1; extern statetype s_firejetup1; extern statetype s_columndowndown1; extern statetype s_spearup1; extern statetype s_pushcolumn1; extern statetype s_pushcolumn2; extern statetype s_pushcolumn3; extern statetype s_wallfireball; extern statetype s_crossfire1; extern statetype s_crossdone1; extern statetype s_fireunit1; extern statetype s_firespan1; extern statetype s_p_bazooka1; extern statetype s_p_bazooka2; extern statetype s_p_grenade; extern statetype s_p_gfall1; extern statetype s_p_gfall2; extern statetype s_p_gfall3; extern statetype s_p_gfall4; extern statetype s_gunsmoke1; extern statetype s_bloodspurt1; extern statetype s_hitmetalwall1; extern statetype s_hitmetalactor1; extern statetype s_dust; extern statetype s_skeleton1; extern statetype s_gas2; extern statetype s_gas1; extern statetype s_spring1; extern statetype s_spring2; extern statetype s_player; extern statetype s_free; extern statetype s_pgunattack1; extern statetype s_pmissattack1; extern statetype s_pgunattack2; extern statetype s_pmissattack2; extern statetype s_remoteinelev; extern statetype s_remotemove1; extern statetype s_godfire1; extern statetype s_remotedie1; extern statetype s_guts1; extern statetype s_guts12; extern statetype s_bossdeath; extern statetype s_megaexplosions; extern statetype s_superparticles; extern statetype s_gibs1; extern statetype s_gibsdone1; extern statetype s_bigsoul; extern statetype s_littlesoul; extern statetype s_vaporized1; extern statetype s_autospring1; extern statetype s_pbatblast; extern statetype s_collectorwander1; extern statetype s_collectorfdoor1; extern statetype s_tag; extern statetype s_timekeeper; extern statetype s_skeleton48; extern statetype s_skeleton24; extern statetype s_wind; extern statetype s_remoteguts1; extern statetype s_voidwait; extern statetype s_ashwait; extern statetype s_deadwait; extern statetype s_gutwait; extern statetype s_vaporized8; extern statetype s_remoteguts12; extern statetype s_eye1; extern statetype s_itemspawn1; extern statetype s_deadblood1; extern statetype s_flash1; extern statetype s_elevdisk; extern statetype s_pathdisk; extern statetype s_megaremove; extern statetype s_respawn1; extern statetype s_basemarker1; extern statetype s_blooddrip1; extern statetype s_diskmaster; extern statetype s_bstar1; #if (SHAREWARE == 0) extern statetype s_scottwander1; extern statetype s_scottwanderdoor1; extern statetype s_opstand; extern statetype s_oppath1; extern statetype s_opcollide; extern statetype s_opcollide2; extern statetype s_opgiveup; //extern statetype s_opuse1; extern statetype s_opshoot1; extern statetype s_opbolo1; extern statetype s_bolocast1; extern statetype s_opchase1; extern statetype s_opdie1; extern statetype s_opcrushed1; extern statetype s_dmonkstand; extern statetype s_dmonkpath1; extern statetype s_dmonkshoot1; extern statetype s_dmonkshoot2; extern statetype s_dmonkchase1; extern statetype s_dmonkdie1; extern statetype s_dmonkcollide; extern statetype s_dmonkcollide2; extern statetype s_dmonkcrushed1; extern statetype s_dmonkshoot5; extern statetype s_dmonkshoot3; extern statetype s_dmonkshoot4; extern statetype s_firemonkstand; extern statetype s_firemonkpath1; extern statetype s_firemonkcast1; extern statetype s_monkfire1; extern statetype s_fireballhit1; extern statetype s_firemonkchase1; extern statetype s_firemonkdie1; extern statetype s_firemonkcollide; extern statetype s_firemonkcollide2; extern statetype s_firemonkcrushed1; extern statetype s_wallstand; extern statetype s_wallpath; extern statetype s_wallshoot; extern statetype s_wallcollide; extern statetype s_wallalign; extern statetype s_wallwait; extern statetype s_wallrestore; extern statetype s_darianstand; extern statetype s_darianchase1; extern statetype s_darianuse; extern statetype s_darianshoot1; extern statetype s_dariancollide; extern statetype s_dariancollide2; extern statetype s_dariandie1; extern statetype s_darianspears; extern statetype s_darianuse1; extern statetype s_dariansink1; extern statetype s_dariansink9; extern statetype s_darianrise1; extern statetype s_darianwait; extern statetype s_dariandefend1; extern statetype s_heinrichstand; extern statetype s_heinrichshoot1; extern statetype s_heinrichshoot4; extern statetype s_heinrichshoot9; extern statetype s_heinrichooc; extern statetype s_heinrichchase; extern statetype s_heinexp1; extern statetype s_kristleft; extern statetype s_kristright; extern statetype s_missile1; extern statetype s_missilehit1; extern statetype s_mine1; extern statetype s_heinrichchase1; extern statetype s_heinrichuse; extern statetype s_heinrichmine; extern statetype s_heinrichdie1; extern statetype s_heinrichdead; extern statetype s_heinrichdefend; extern statetype s_dexplosion22; extern statetype s_dexplosion21; extern statetype s_dexplosion20; extern statetype s_dexplosion19; extern statetype s_dexplosion18; extern statetype s_dexplosion17; extern statetype s_dexplosion16; extern statetype s_dexplosion15; extern statetype s_dexplosion14; extern statetype s_dexplosion13; extern statetype s_dexplosion12; extern statetype s_dexplosion11; extern statetype s_dexplosion10; extern statetype s_dexplosion9; extern statetype s_dexplosion8; extern statetype s_dexplosion7; extern statetype s_dexplosion6; extern statetype s_dexplosion5; extern statetype s_dexplosion4; extern statetype s_dexplosion3; extern statetype s_dexplosion2; extern statetype s_dexplosion1; extern statetype s_dspear1; extern statetype s_NMEchase; extern statetype s_NMEdie; extern statetype s_NMEhead1; extern statetype s_NMEhead2; extern statetype s_NMEwheels1; extern statetype s_NMEwheels2; extern statetype s_NMEwheels3; extern statetype s_NMEwheels4; extern statetype s_NMEwheels5; extern statetype s_NMEwindup; extern statetype s_NMEwheels120; extern statetype s_NMEwrotleft3; extern statetype s_NMEwrotleft2; extern statetype s_NMEwrotleft1; extern statetype s_NMEwrotright3; extern statetype s_NMEwrotright2; extern statetype s_NMEwrotright1; extern statetype s_NMEminiball1; extern statetype s_NMEattack; extern statetype s_NMEsaucer1; extern statetype s_NMEhead1rl; extern statetype s_NMEhead2rl; extern statetype s_NMEspinattack; extern statetype s_NMEwheelspin; extern statetype s_NMEcollide; extern statetype s_NMEdeathbuildup; extern statetype s_NMEheadexplosion; extern statetype s_NMEstand; extern statetype s_NMEspinfire; extern statetype s_shootinghead; extern statetype s_oshuriken1; extern statetype s_oshurikenhit1; extern statetype s_darkmonkstand; extern statetype s_darkmonkcharge1; extern statetype s_darkmonkreact; extern statetype s_darkmonkland; extern statetype s_darkmonkchase1; extern statetype s_darkmonkcover1; extern statetype s_darkmonkawaken1; extern statetype s_darkmonklightning1; extern statetype s_darkmonkfspark1; extern statetype s_darkmonkbreathe1; extern statetype s_darkmonksummon1; extern statetype s_darkmonkhead; extern statetype s_darkmonkhspawn; extern statetype s_darkmonksneer1; extern statetype s_darkmonkheadhappy; extern statetype s_darkmonkheaddie1; extern statetype s_darkmonkhball1; extern statetype s_darkmonksphere1; extern statetype s_darkmonksphere8; extern statetype s_darkmonkbball1; extern statetype s_darkmonkscare1; extern statetype s_darkmonkdie1; extern statetype s_darkmonkredhead; extern statetype s_redheadhit; extern statetype s_darkmonksnakelink; extern statetype s_darkmonkredlink; extern statetype s_redlinkhit; extern statetype s_energysphere1; extern statetype s_lightning; extern statetype s_handball2; extern statetype s_handball1; extern statetype s_faceball2; extern statetype s_faceball1; extern statetype s_floorspark1; extern statetype s_dmlandandfire; extern statetype s_darkmonkhball7; extern statetype s_darkmonkbball7; extern statetype s_darkmonklightning9; extern statetype s_darkmonkfspark5; extern statetype s_darkmonkbreathe6; extern statetype s_darkmonkabsorb1; extern statetype s_dmgreenthing1; extern statetype s_dmgreenthing8; extern statetype s_darkmonkfastspawn; extern statetype s_spit1; extern statetype s_spithit1; extern statetype s_snakefire1; extern statetype s_snakepath; extern statetype s_snakefindpath; extern statetype s_snakefireworks1; extern statetype s_snakefireworks2; extern statetype s_speardown1; extern statetype s_downblade1; extern statetype s_firejetdown1; extern statetype s_columnupup1; extern statetype s_columnupup2; extern statetype s_columnupup8; extern statetype s_columnupup7; extern statetype s_columnupdown1; extern statetype s_columnupdown6; extern statetype s_spinupblade1; extern statetype s_spindownblade1; extern statetype s_boulderdrop12; extern statetype s_boulderdrop10; extern statetype s_boulderdrop8; extern statetype s_boulderdrop1; extern statetype s_boulderspawn; extern statetype s_bouldersink1; extern statetype s_boulderroll1; extern statetype s_gunfire1; extern statetype s_gunfire2; extern statetype s_gundie1; extern statetype s_gunstand; extern statetype s_gunraise1; extern statetype s_gunlower1; extern statetype s_4waygunfire1; extern statetype s_4waygunfire2; extern statetype s_4waygun; extern statetype s_kessphere1; extern statetype s_batblast1; extern statetype s_slop1; extern statetype s_serialdog4; extern statetype s_serialdog3; extern statetype s_serialdog2; extern statetype s_serialdog; extern statetype s_serialdogattack; extern statetype s_doguse; extern statetype s_doglick; extern statetype s_dogwait; #endif #endif rott-20230810/rott/task_man.h000066400000000000000000000037361446517470200157240ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ /********************************************************************** module: TASK_MAN.C author: James R. Dose phone: (214)-271-1365 Ext #221 date: July 25, 1994 Public header for TASK_MAN.C, a low level timer task scheduler. (c) Copyright 1994 James R. Dose. All Rights Reserved. **********************************************************************/ #ifndef __TASK_MAN_H #define __TASK_MAN_H enum TASK_ERRORS { TASK_Warning = -2, TASK_Error = -1, TASK_Ok = 0 }; typedef struct task { struct task *next; struct task *prev; void ( *TaskService )( struct task * ); void *data; long rate; volatile long count; int priority; int active; } task; // TS_InInterrupt is TRUE during a taskman interrupt. // Use this if you have code that may be used both outside // and within interrupts. extern volatile int TS_InInterrupt; void TS_Shutdown( void ); task *TS_ScheduleTask( void ( *Function )( task * ), int rate, int priority, void *data ); int TS_Terminate( task *ptr ); void TS_Dispatch( void ); void TS_SetTaskRate( task *Task, int rate ); void TS_UnlockMemory( void ); int TS_LockMemory( void ); #endif rott-20230810/rott/version.h000066400000000000000000000015771446517470200156150ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 VERSION_H #define VERSION_H #define ROTTMAJORVERSION 1 #define ROTTMINORVERSION 4 #define ROTTVERSION ((ROTTMAJORVERSION*10)+(ROTTMINORVERSION)) #endif rott-20230810/rott/w_wad.c000066400000000000000000000243361446517470200152220ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ // W_wad.c #include #include #include #include #include "rt_def.h" #include "rt_util.h" #include "_w_wad.h" #include "w_wad.h" #include "z_zone.h" #include "isr.h" #include "develop.h" #include "rt_crc.h" #include "rt_main.h" //============= // GLOBALS //============= int numlumps; void **lumpcache; //============= // STATICS //============= static lumpinfo_t *lumpinfo; // location of each lump on disk /* ============================================================================ LUMP BASED ROUTINES ============================================================================ */ /* ==================== = = W_AddFile = = All files are optional, but at least one file must be found = Files with a .wad extension are wadlink files with multiple lumps = Other files are single lumps with the base filename for the lump name = ==================== */ void W_AddFile (char *_filename) { wadinfo_t header; lumpinfo_t *lump_p; unsigned i; int handle, length; int startlump; filelump_t *fileinfo, singleinfo; char filename[MAX_PATH]; char buf[MAX_PATH+100];//bna++ strncpy(filename, _filename, sizeof (filename)); filename[sizeof (filename) - 1] = '\0'; //bna section start if (access (filename, 0) != 0) { strcpy (buf,"Error, Could not find User file '"); strcat (buf,filename); strcat (buf,"', ignoring file"); printf("%s", buf); } //bna section end // // read the entire file in // FIXME: shared opens if ( (handle = open (filename,O_RDONLY | O_BINARY)) == -1) return; startlump = numlumps; if ( (strcmpi (filename+strlen(filename)-3 , "wad" ) ) && (strcmpi (filename+strlen(filename)-3 , "rts" ) ) ) { // single lump file if (!quiet) printf(" Adding single file %s.\n",filename); fileinfo = &singleinfo; singleinfo.filepos = 0; singleinfo.size = LONG(filelength(handle)); ExtractFileBase (filename, singleinfo.name); numlumps++; } else { // WAD file if (!quiet) printf(" Adding %s.\n",filename); read (handle, &header, sizeof(header)); if (strncmp(header.identification,"IWAD",4)) Error ("Wad file %s doesn't have IWAD id\n",filename); header.numlumps = IntelLong(LONG(header.numlumps)); header.infotableofs = IntelLong(LONG(header.infotableofs)); length = header.numlumps*sizeof(filelump_t); fileinfo = alloca (length); if (!fileinfo) Error ("Wad file could not allocate header info on stack"); lseek (handle, header.infotableofs, SEEK_SET); read (handle, fileinfo, length); numlumps += header.numlumps; } // // Fill in lumpinfo // lumpinfo = safe_realloc(lumpinfo, numlumps * sizeof(*lumpinfo)); lump_p = &lumpinfo[startlump]; for (i=startlump ; i<(unsigned int)numlumps ; i++,lump_p++, fileinfo++) { fileinfo->filepos = IntelLong(LONG(fileinfo->filepos)); fileinfo->size = IntelLong(LONG(fileinfo->size)); lump_p->handle = handle; lump_p->position = LONG(fileinfo->filepos); lump_p->size = LONG(fileinfo->size); strncpy (lump_p->name, fileinfo->name, 8); } } /* ==================== = = W_CheckWADIntegrity = ==================== */ void W_CheckWADIntegrity ( void ) { // CRC disabled because it's not very useful these days } /* ==================== = = W_InitMultipleFiles = = Pass a null terminated list of files to use. = = All files are optional, but at least one file must be found = = Files with a .wad extension are idlink files with multiple lumps = = Other files are single lumps with the base filename for the lump name = = Lump names can appear multiple times. The name searcher looks backwards, = so a later file can override an earlier one. = ==================== */ void W_InitMultipleFiles (char **filenames) { // // open all the files, load headers, and count lumps // numlumps = 0; lumpinfo = NULL; // will be realloced as lumps are added for ( ; *filenames ; filenames++) W_AddFile (*filenames); if (numlumps < 2) Error ("W_InitFiles: One or more of the required ROTT 1.3 data files could not be found."); // // set up caching // lumpcache = calloc (numlumps, sizeof(*lumpcache)); if (!lumpcache) Error("W_InitFiles: lumpcache malloc failed size=%d\n",numlumps<<2); if (!quiet) printf("W_Wad: Wad Manager Started NUMLUMPS=%ld\n",(long int)numlumps); W_CheckWADIntegrity (); } /* ==================== = = W_InitFile = = Just initialize from a single file = ==================== */ void W_InitFile (char *filename) { char *names[2]; names[0] = filename; names[1] = NULL; W_InitMultipleFiles (names); } /* ==================== = = W_NumLumps = ==================== */ int W_NumLumps (void) { return numlumps; } /* ==================== = = W_CheckNumForName = = Returns -1 if name not found = ==================== */ int W_CheckNumForName (char *name) { char name8[9]; int v1,v2; lumpinfo_t *lump_p; lumpinfo_t *endlump; // make the name into two integers for easy compares strncpy (name8,name,8); name8[8] = 0; // in case the name was a fill 8 chars strupr (name8); // case insensitive v1 = *(int *)name8; v2 = *(int *)&name8[4]; // scan backwards so patch lump files take precedence lump_p = lumpinfo; endlump = lumpinfo + numlumps; while (lump_p != endlump) { if ( *(int *)lump_p->name == v1 && *(int *)&lump_p->name[4] == v2) return lump_p - lumpinfo; lump_p++; } return -1; } /* ==================== = = W_GetNumForName = = Calls W_CheckNumForName, but bombs out if not found = ==================== */ int W_GetNumForName (char *name) { int i; i = W_CheckNumForName (name); if (i != -1) return i; Error ("W_GetNumForName: %s not found!",name); return -1; } /* ==================== = = W_LumpLength = = Returns the buffer size needed to load the given lump = ==================== */ int W_LumpLength (int lump) { if (lump >= numlumps) Error ("W_LumpLength: %i >= numlumps",lump); return lumpinfo[lump].size; } /* ==================== = = W_GetNameForNum = ==================== */ char * W_GetNameForNum (int i) { if (i>=numlumps) Error ("W_GetNameForNum: %i >= numlumps",i); return &(lumpinfo[i].name[0]); } /* ==================== = = W_ReadLump = = Loads the lump into the given buffer, which must be >= W_LumpLength() = ==================== */ int readinglump; byte * lumpdest; void W_ReadLump (int lump, void *dest) { int c; lumpinfo_t *l; readinglump=lump; lumpdest=dest; if (lump >= numlumps) Error ("W_ReadLump: %i >= numlumps",lump); if (lump < 0) Error ("W_ReadLump: %i < 0",lump); l = lumpinfo+lump; lseek (l->handle, l->position, SEEK_SET); c = read (l->handle, dest, l->size); if (c < l->size) Error ("W_ReadLump: only read %i of %i on lump %i",c,l->size,lump); } /* ==================== = = W_WriteLump = = Writes the lump into the given buffer, which must be >= W_LumpLength() = ==================== */ void W_WriteLump (int lump, void *src) { int c; lumpinfo_t *l; if (lump >= numlumps) Error ("W_WriteLump: %i >= numlumps",lump); if (lump < 0) Error ("W_WriteLump: %i < 0",lump); l = lumpinfo+lump; lseek (l->handle, l->position, SEEK_SET); c = write (l->handle, src, l->size); if (c < l->size) Error ("W_WriteLump: only wrote %i of %i on lump %i",c,l->size,lump); } /* ==================== = = W_CacheLumpNum = ==================== */ void *W_CacheLumpNum (int lump, int tag, converter_t converter, int numrec) { if (lump >= (int)numlumps) Error ("W_CacheLumpNum: %i >= numlumps",lump); else if (lump < 0) Error ("W_CacheLumpNum: %i < 0 Taglevel: %i",lump,tag); if (!lumpcache[lump]) { // read the lump in Z_Malloc (W_LumpLength (lump), tag, &lumpcache[lump]); W_ReadLump (lump, lumpcache[lump]); Debug("Invoking endian converter on %p, %i records\n", lumpcache[lump], numrec); converter(lumpcache[lump], numrec); } else { Z_ChangeTag (lumpcache[lump],tag); } return lumpcache[lump]; } /* ==================== = = W_CacheLumpName = ==================== */ void *W_CacheLumpName (char *name, int tag, converter_t converter, int numrec) { return W_CacheLumpNum (W_GetNumForName(name), tag, converter, numrec); } rott-20230810/rott/w_wad.h000066400000000000000000000041751446517470200152260ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //*************************************************************************** // // W_WAD.C - Wad managment utilities // //*************************************************************************** #ifndef _w_wad_public #define _w_wad_public #include "byteordr.h" void W_InitMultipleFiles (char **filenames); // Initialize multiple wads void W_InitFile (char *filename); // Init a single wad file int W_CheckNumForName (char *name); // Check to see if the named lump exists int W_GetNumForName (char *name); // Get the number for the named lump char * W_GetNameForNum (int i); // Get the name for a number int W_NumLumps (void); // Get the current number of lumps managed int W_LumpLength (int lump); // Get the length of the numbered lump void W_ReadLump (int lump, void *dest); // Read the numbered lump into a buffer void W_WriteLump (int lump, void *src); void *W_CacheLumpNum (int lump, int tag, converter_t converter, int numrecs); // Cache in the numbered lump with the appropriate memory tag void *W_CacheLumpName (char *name, int tag, converter_t converter, int numrecs); // Cache in the named lump with the appropriate memory tag extern int numlumps; extern void **lumpcache; #endif rott-20230810/rott/watcom.c000066400000000000000000000013151446517470200154030ustar00rootroot00000000000000#include "rt_def.h" #include "watcom.h" /* C versions of watcom.h assembly. */ fixed FixedMul(fixed a, fixed b) { int64_t scratch1 = (int64_t) a * (int64_t) b + (int64_t) 0x8000; return (scratch1 >> 16) & 0xffffffff; } fixed FixedMulShift(fixed a, fixed b, fixed shift) { int64_t x = a; int64_t y = b; int64_t z = x * y; return (((uint64_t)z) >> shift) & 0xffffffff; } fixed FixedDiv2(fixed a, fixed b) { int64_t x = (signed int)a; int64_t y = (signed int)b; int64_t z = x * 65536 / y; return (z) & 0xffffffff; } fixed FixedScale(fixed orig, fixed factor, fixed divisor) { int64_t x = orig; int64_t y = factor; int64_t z = divisor; int64_t w = (x * y) / z; return (w) & 0xffffffff; } rott-20230810/rott/watcom.h000066400000000000000000000017121446517470200154110ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 _watcom_h_public #define _watcom_h_public fixed FixedMul(fixed a, fixed b); fixed FixedDiv2(fixed a, fixed b); fixed FixedScale(fixed orig, fixed factor, fixed divisor); fixed FixedMulShift(fixed a, fixed b, fixed shift); #endif rott-20230810/rott/winrott.c000066400000000000000000000103111446517470200156130ustar00rootroot00000000000000/* Routines from winrott needed for the highres support for the SDL port */ #include #include #include "WinRott.h" #include "modexlib.h" //typedef unsigned char byte; int iGLOBAL_SCREENWIDTH = 640;//bna int iGLOBAL_SCREENHEIGHT = 480;//bna int iGLOBAL_SCREENBWIDE ; int iG_SCREENWIDTH;// default screen width in bytes int iGLOBAL_HEALTH_X; int iGLOBAL_HEALTH_Y; int iGLOBAL_AMMO_X; int iGLOBAL_AMMO_Y; int iGLOBAL_FOCALWIDTH; double dGLOBAL_FPFOCALWIDTH; double dTopYZANGLELIMIT; int iG_X_center; int iG_Y_center; boolean iG_aimCross = 0; extern int viewheight; extern int viewwidth; //---------------------------------------------------------------------- #define FINEANGLES 2048 void SetRottScreenRes (int Width, int Height) { iGLOBAL_SCREENWIDTH = Width; iGLOBAL_SCREENHEIGHT = Height; iGLOBAL_SCREENBWIDE = iGLOBAL_SCREENWIDTH*(96/320); iG_SCREENWIDTH = iGLOBAL_SCREENWIDTH*(96/320);;// default screen width in bytes if (iGLOBAL_SCREENWIDTH == 320) { iGLOBAL_FOCALWIDTH = 160; dGLOBAL_FPFOCALWIDTH = 160.0; iGLOBAL_HEALTH_X = 20; iGLOBAL_HEALTH_Y = 185; iGLOBAL_AMMO_X = 300; iGLOBAL_AMMO_Y = 184; dTopYZANGLELIMIT = (44*FINEANGLES/360);; } if (iGLOBAL_SCREENWIDTH == 640) { iGLOBAL_FOCALWIDTH = 180; dGLOBAL_FPFOCALWIDTH = 180.0 ; iGLOBAL_HEALTH_X = 40;//20*2; iGLOBAL_HEALTH_Y = 466;//(185*2)+16; iGLOBAL_AMMO_X = 600;//300*2; iGLOBAL_AMMO_Y = 464;//480-16; dTopYZANGLELIMIT = (42*FINEANGLES/360);; } } //---------------------------------------------------------------------- //luckey for me that I am not programmin a 386 or the next //4 function would never have worked. bna++ extern int viewsize; void MoveScreenUpLeft() { int startX,startY,startoffset; byte *Ycnt,*b; // SetTextMode ( ); b=(byte *)bufferofs; b += (((iGLOBAL_SCREENHEIGHT-viewheight)/2)*iGLOBAL_SCREENWIDTH)+((iGLOBAL_SCREENWIDTH-viewwidth)/2); if (viewsize == 8) {b += 8*iGLOBAL_SCREENWIDTH;} startX = 3; //take 3 pixels to the right startY = 3; //take 3 lines down startoffset = (startY*iGLOBAL_SCREENWIDTH)+startX; for (Ycnt=b;Ycntb;Ycnt-=iGLOBAL_SCREENWIDTH){ memcpy(Ycnt+startoffset,Ycnt+startX,viewwidth-startX); } } //---------------------------------------------------------------------- void MoveScreenUpRight() { int startX,startY,startoffset; byte *Ycnt,*b; // SetTextMode ( ); b=(byte *)bufferofs; b += (((iGLOBAL_SCREENHEIGHT-viewheight)/2)*iGLOBAL_SCREENWIDTH)+((iGLOBAL_SCREENWIDTH-viewwidth)/2); if (viewsize == 8) {b += 8*iGLOBAL_SCREENWIDTH;} startX = 3; //take 3 pixels to the right startY = 3; //take 3 lines down startoffset = (startY*iGLOBAL_SCREENWIDTH);//+startX; for (Ycnt=b;Ycntb;Ycnt-=iGLOBAL_SCREENWIDTH){ memcpy(Ycnt+startoffset,Ycnt,viewwidth-startX); } } rott-20230810/rott/z_zone.c000066400000000000000000000115351446517470200154220ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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 "rt_def.h" #include "rt_util.h" #include "z_zone.h" #define MAXMEMORYSIZE (8 << 20) int zonememorystarted = 0; // Minimum chunk size at which blocks are allocated #define CHUNK_SIZE sizeof(void *) // signature for block header #define ZONEID (0x1a2b3c4d) typedef struct memblock { struct memblock *next,*prev; size_t size; void **user; unsigned id; pu_tag tag; } memblock_t; static const size_t HEADER_SIZE = (sizeof(memblock_t)+CHUNK_SIZE-1) & ~(CHUNK_SIZE-1); static memblock_t *blockbytag[PU_MAX]; static size_t heapsize; void Z_Init (int size, int min) { zonememorystarted = 1; heapsize = 0; } void Z_ShutDown (void) { zonememorystarted = 0; } // Z_Malloc // You can pass a NULL user if the tag is < PU_CACHE. static void Z_FreeTag(pu_tag tag); void *Z_Malloc(size_t size, pu_tag tag, void **user) { memblock_t *block = NULL; if (tag == PU_CACHE && !user) Error ("Z_Malloc: An owner is required for purgable blocks"); if (!size) return user ? *user = NULL : NULL; // malloc(0) returns NULL while (!(block = malloc(size + HEADER_SIZE))) { if (!blockbytag[PU_CACHE]) Error ("Z_Malloc: Failure trying to allocate %lu bytes", (unsigned long) size); Z_FreeTag(PU_CACHE); } if (!blockbytag[tag]) { blockbytag[tag] = block; block->next = block->prev = block; } else { blockbytag[tag]->prev->next = block; block->prev = blockbytag[tag]->prev; block->next = blockbytag[tag]; blockbytag[tag]->prev = block; } block->size = size; block->id = ZONEID; // signature required in block header block->tag = tag; // tag block->user = user; // user block = (memblock_t *)((char *) block + HEADER_SIZE); if (user) // if there is a user *user = block; // set user to point to new block heapsize += size; return block; } void Z_Free(void *p) { memblock_t *block = (memblock_t *)((char *) p - HEADER_SIZE); if (!p) return; if (block->id != ZONEID) Error("Z_Free: freed a pointer without ZONEID"); block->id = 0; // Nullify id so another free fails if (block->user) // Nullify user if one exists *block->user = NULL; if (block == block->next) blockbytag[block->tag] = NULL; else if (blockbytag[block->tag] == block) blockbytag[block->tag] = block->next; block->prev->next = block->next; block->next->prev = block->prev; heapsize -= block->size; free(block); } static void Z_FreeTag(pu_tag tag) { memblock_t *block, *end_block; if (tag < 0 || tag >= PU_MAX) Error("Z_FreeTag: Tag %i does not exist", tag); block = blockbytag[tag]; if (!block) return; end_block = block->prev; while (1) { memblock_t *next = block->next; Z_Free((char *) block + HEADER_SIZE); if (block == end_block) break; block = next; // Advance to next block } } void Z_FreeTags(pu_tag lowtag, pu_tag hightag) { pu_tag tag; for (tag = lowtag; tag <= hightag; tag++) { Z_FreeTag(tag); } } void Z_ChangeTag(void *ptr, pu_tag tag) { memblock_t *block = (memblock_t *)((char *) ptr - HEADER_SIZE); // proff - added sanity check, this can happen when an empty lump is locked if (!ptr) return; // proff - do nothing if tag doesn't differ if (tag == block->tag) return; if (block->id != ZONEID) Error ("Z_ChangeTag: freed a pointer without ZONEID"); if (tag == PU_CACHE && !block->user) Error ("Z_ChangeTag: an owner is required for purgable blocks\n"); if (block == block->next) blockbytag[block->tag] = NULL; else if (blockbytag[block->tag] == block) blockbytag[block->tag] = block->next; block->prev->next = block->next; block->next->prev = block->prev; if (!blockbytag[tag]) { blockbytag[tag] = block; block->next = block->prev = block; } else { blockbytag[tag]->prev->next = block; block->prev = blockbytag[tag]->prev; block->next = blockbytag[tag]; blockbytag[tag]->prev = block; } block->tag = tag; } size_t Z_HeapSize (void) { return (size_t)MAXMEMORYSIZE; } size_t Z_UsedHeap (void) { return heapsize; } rott-20230810/rott/z_zone.h000066400000000000000000000052441446517470200154270ustar00rootroot00000000000000/* Copyright (C) 1994-1995 Apogee Software, Ltd. 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. */ //*************************************************************************** // // Z_Zone Memory management Constants // //*************************************************************************** #ifndef _z_zone_public #define _z_zone_public #include typedef enum { // tags < PU_PURGELEVEL are not overwritten until freed PU_STATIC, // static entire execution time PU_LEVEL, // start of static until level exited // tags >= PU_PURGELEVEL are purgable whenever needed PU_CACHE, PU_MAX } pu_tag; #define PU_GAME PU_STATIC #define PU_LEVELSTRUCT PU_LEVEL #define PU_LEVELEND PU_LEVEL #define URGENTLEVELSTART PU_LEVEL #define PU_PURGELEVEL PU_CACHE #define PU_FLAT PU_CACHE #define PU_PATCH PU_CACHE #define PU_TEXTURE PU_CACHE #define PU_CACHESOUNDS PU_CACHE #define PU_CACHEACTORS PU_CACHE #define PU_CACHEBJWEAP PU_CACHE #define PU_CACHESPRITES PU_CACHE #define PU_CACHEWALLS PU_CACHE //*************************************************************************** // // Z_ZONE.C - Carmack's Memory manager for protected mode // //*************************************************************************** extern int zonememorystarted; void Z_Init (int size, int min); // Starts up Memory manager (size is in bytes), (min is minimum requirement) void Z_Free (void *ptr); // Free a pointer in Z_Zone's domain void *Z_Malloc (size_t size, pu_tag tag, void **user); // Malloc You can pass a NULL user if the tag is < PU_PURGELEVEL void Z_FreeTags (pu_tag lowtag, pu_tag hightag); // Free a series of memory tags void Z_ChangeTag (void *ptr, pu_tag tag); // Change the tag of a memory item size_t Z_HeapSize ( void ); // Return the total heap size size_t Z_UsedHeap ( void ); // Return used portion of heap size void Z_ShutDown( void ); #define Z_LevelMalloc(a,b,c) Z_Malloc(a,b,c) #define Z_UsedLevelHeap() Z_UsedHeap() #endif