pax_global_header00006660000000000000000000000064147732005030014513gustar00rootroot0000000000000052 comment=b315ef29933acd02bcef602eb317d9c941d213d3 xatrix-XATRIX_2_14/000077500000000000000000000000001477320050300141405ustar00rootroot00000000000000xatrix-XATRIX_2_14/.github/000077500000000000000000000000001477320050300155005ustar00rootroot00000000000000xatrix-XATRIX_2_14/.github/workflows/000077500000000000000000000000001477320050300175355ustar00rootroot00000000000000xatrix-XATRIX_2_14/.github/workflows/linux_aarch64.yml000066400000000000000000000027341477320050300227350ustar00rootroot00000000000000name: Testbuild for Linux (aarch64) run-name: testbuild_linux_aarch64 on: push: branches: - 'master' pull_request: types: - edited - opened - synchronize concurrency: # Cancel concurrent workflows for the same PR or commit hash. group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} cancel-in-progress: true jobs: build_ubuntu_aarch64: runs-on: ubuntu-22.04-arm strategy: fail-fast: false matrix: include: - env: ubuntu steps: - name: Check out repository code uses: actions/checkout@v4 - name: Build run: | # Public runners come with 4 CPUs. make -j4 - name: Create testbuild package run: | # Create release directory tree mkdir -p publish/quake2-xatrix-linux_aarch64-${{github.sha}}/misc/docs # Copy release assets cp -r release/* publish/quake2-xatrix-linux_aarch64-${{github.sha}}/ # Copy misc assets cp -r stuff/mapfixes publish/quake2-xatrix-linux_aarch64-${{github.sha}}/misc cp LICENSE publish/quake2-xatrix-linux_aarch64-${{github.sha}}/misc/docs/LICENSE.txt cp README.md publish/quake2-xatrix-linux_aarch64-${{github.sha}}/misc/docs/README.txt - name: Upload testbuild package uses: actions/upload-artifact@v4 with: name: quake2-xatrix-linux_aarch64-${{github.sha}} path: publish/ if-no-files-found: error xatrix-XATRIX_2_14/.github/workflows/linux_x86_64.yml000066400000000000000000000027171477320050300224440ustar00rootroot00000000000000name: Testbuild for Linux (x86_64) run-name: testbuild_linux_x86_64 on: push: branches: - 'master' pull_request: types: - edited - opened - synchronize concurrency: # Cancel concurrent workflows for the same PR or commit hash. group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} cancel-in-progress: true jobs: build_ubuntu_x86_64: runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: include: - env: ubuntu steps: - name: Check out repository code uses: actions/checkout@v4 - name: Build run: | # Public runners come with 4 CPUs. make -j4 - name: Create testbuild package run: | # Create release directory tree mkdir -p publish/quake2-xatrix-linux_x86_64-${{github.sha}}/misc/docs # Copy release assets cp -r release/* publish/quake2-xatrix-linux_x86_64-${{github.sha}}/ # Copy misc assets cp -r stuff/mapfixes publish/quake2-xatrix-linux_x86_64-${{github.sha}}/misc cp LICENSE publish/quake2-xatrix-linux_x86_64-${{github.sha}}/misc/docs/LICENSE.txt cp README.md publish/quake2-xatrix-linux_x86_64-${{github.sha}}/misc/docs/README.txt - name: Upload testbuild package uses: actions/upload-artifact@v4 with: name: quake2-xatrix-linux_x86_64-${{github.sha}} path: publish/ if-no-files-found: error xatrix-XATRIX_2_14/.github/workflows/macos.yml000066400000000000000000000027671477320050300213760ustar00rootroot00000000000000name: Testbuild for MacOS run-name: testbuild_macos on: push: branches: - 'master' pull_request: types: - edited - opened - synchronize concurrency: # Cancel concurrent workflows for the same PR or commit hash. group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} cancel-in-progress: true jobs: build_macos_aarch64: runs-on: macos-latest strategy: fail-fast: false matrix: include: - env: macos steps: - name: Install build dependencies run: | brew update brew install make - name: Check out repository code uses: actions/checkout@v4 - name: Build run: | # Public runners come with 3 CPUs. gmake -j3 - name: Create testbuild package run: | # Create release directory tree mkdir -p publish/quake2-xatrix-macos-${{github.sha}}/misc/docs # Copy release assets cp -r release/* publish/quake2-xatrix-macos-${{github.sha}}/ # Copy misc assets cp -r stuff/mapfixes publish/quake2-xatrix-macos-${{github.sha}}/misc cp LICENSE publish/quake2-xatrix-macos-${{github.sha}}/misc/docs/LICENSE.txt cp README.md publish/quake2-xatrix-macos-${{github.sha}}/misc/docs/README.txt - name: Upload testbuild package uses: actions/upload-artifact@v4 with: name: quake2-xatrix-macos-${{github.sha}} path: publish/ if-no-files-found: error xatrix-XATRIX_2_14/.github/workflows/win32.yml000066400000000000000000000032711477320050300212250ustar00rootroot00000000000000name: Testbuild for Win32 run-name: testbuild_win32 on: push: branches: - 'master' pull_request: types: - edited - opened - synchronize concurrency: # Cancel concurrent workflows for the same PR or commit hash. group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} cancel-in-progress: true jobs: build_mingw_x86_32: runs-on: windows-latest strategy: fail-fast: false matrix: include: - { sys: mingw32, env: i686 } steps: - uses: msys2/setup-msys2@v2 with: msystem: ${{matrix.sys}} update: true install: >- git make mingw-w64-${{matrix.env}}-gcc mingw-w64-${{matrix.env}}-make - name: Check out repository code uses: actions/checkout@v4 - name: Build shell: msys2 {0} run: | # Public runners come with 4 CPUs. make -j4 - name: Create testbuild package shell: msys2 {0} run: | # Create release directory tree mkdir -p publish/quake2-xatrix-win32-${{github.sha}}/misc/docs # Copy release assets cp -r release/* publish/quake2-xatrix-win32-${{github.sha}}/ # Copy misc assets cp -r stuff/mapfixes publish/quake2-xatrix-win32-${{github.sha}}/misc cp LICENSE publish/quake2-xatrix-win32-${{github.sha}}/misc/docs/LICENSE.txt cp README.md publish/quake2-xatrix-win32-${{github.sha}}/misc/docs/README.txt - name: Upload testbuild package uses: actions/upload-artifact@v4 with: name: quake2-xatrix-win32-${{github.sha}} path: publish/ if-no-files-found: error xatrix-XATRIX_2_14/.github/workflows/win64.yml000066400000000000000000000032731477320050300212340ustar00rootroot00000000000000name: Testbuild for Win64 run-name: testbuild_win64 on: push: branches: - 'master' pull_request: types: - edited - opened - synchronize concurrency: # Cancel concurrent workflows for the same PR or commit hash. group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} cancel-in-progress: true jobs: build_mingw_x86_64: runs-on: windows-latest strategy: fail-fast: false matrix: include: - { sys: mingw64, env: x86_64 } steps: - uses: msys2/setup-msys2@v2 with: msystem: ${{matrix.sys}} update: true install: >- git make mingw-w64-${{matrix.env}}-gcc mingw-w64-${{matrix.env}}-make - name: Check out repository code uses: actions/checkout@v4 - name: Build shell: msys2 {0} run: | # Public runners come with 4 CPUs. make -j4 - name: Create testbuild package shell: msys2 {0} run: | # Create release directory tree mkdir -p publish/quake2-xatrix-win64-${{github.sha}}/misc/docs # Copy release assets cp -r release/* publish/quake2-xatrix-win64-${{github.sha}}/ # Copy misc assets cp -r stuff/mapfixes publish/quake2-xatrix-win64-${{github.sha}}/misc cp LICENSE publish/quake2-xatrix-win64-${{github.sha}}/misc/docs/LICENSE.txt cp README.md publish/quake2-xatrix-win64-${{github.sha}}/misc/docs/README.txt - name: Upload testbuild package uses: actions/upload-artifact@v4 with: name: quake2-xatrix-win64-${{github.sha}} path: publish/ if-no-files-found: error xatrix-XATRIX_2_14/.gitignore000066400000000000000000000000211477320050300161210ustar00rootroot00000000000000/build/ /release/xatrix-XATRIX_2_14/CHANGELOG000066400000000000000000000116351477320050300153600ustar00rootroot00000000000000The Reckoning 2.13 to 2.14: - Add weapon preview to the `cycleweap` command (by protocultor) - Fix leaking temporary spawnflags into entities spawned mid-level. (by BjossiAlfreds) The Reckoning 2.12 to 2.13: - Implement `g_quick_weap`. If set to 1, both weapprev and weapnext commands will count how many times they have been called, making possible to skip weapons by quickly tapping one of these keys. (by protocultor) - Work around naggy help icons. (by BjossiAlfreds) - Implement `g_monsterfootsteps`. (by 0lvin) The Reckoning 2.11 to 2.12: - Relicense under GPL2. - Implement `g_swap_speed`. This allows to skip frames of "putting down weapon" and "raising weapon" animations, speeding them up. (by protocultor) - Several fixes to makron (by BjossiAlfreds) - Fixed stand-ground gladiators not attacking at certain range. (by BjossiAlfreds) - Fixed monsters seeing players during intermissions. (by BjossiAlfreds) The Reckoning 2.10 to 2.11: - Implement faster weapon switching with the new 'cycleweap' command. (by protocultor). - Fixes pusher delta yaw manipulation. This fixes the infamous bug were a player standing on a blocked elevator gets turned around (by skuller). - Fix several coop related bugs with the powercubes. (by BjossiAlfreds) - A way better fix for dead bodies obstructing elevators or falling through the worldmodel. (by BjossiAlfreds) - Fix items already in water playing a splash sound at level start. (by BjossiAlfreds) - Phalanx explosions should be muffled under water. (by protocultor) The Reckoning 2.09 to 2.10: - Refine the 'g_footstep' cvar to match Quake II itself. - Implement 'g_machinegun_norecoil'. The cvar is cheat protected. (by De-Seppe) - Fix soldiers never showing their pain skins as long as they're alive. (by BjossiAlfreds) - Fix laser guard trying to fire two shots when dying. (Found by drakonorodny and fix suggested by BjossiAlfreds) The Reckoning 2.08 to 2.09: - Fix wrong sound for some items when activated. (by BjossiAlfreds) - Port the 'aimfix' cvar. (by Mitchell Richters) - Port the 'coop_pickup_weapons' and 'coop_elevator_delay' cvars. - Fix a long standing crash occuring when exploding projectiles like grenates or rockets generate sound targets and a least one monster starts moving to one of that targets. - Add a cvar `g_footsteps` to control the generation of footstep sound. - Move several hard coded map fixes to entity files. Add newly discovered mapfixes to the entity files. (by BjossiAlfreds) - Fix several subtile gameplay and entity handling bug. (by BjossiAlfreds) The Reckoning 2.07 to 2.08: - Several fixes for subtile bugs (by BjossiAlfreds) The Reckoning 2.06 to 2.07: - New commands: 'listentities' allows listing of entities. 'teleport' teleports the player to the given coordinates. - A lot of fixes for subtle, long standing AI and game play bugs. (by BjossiAlfreds) - Fix problem found by PVS studio. (analysis by demoth and fixes by BjossiAlfreds) The Reckoning 2.05 to 2.06: - Small bugfixes and better support for the current version of the Windows build environment. The Reckoning 2.04 to 2.05: - Fix a lot of potential crashes. (reported by Maarakate) - Fix monsters running in place. - Fix monsters not recognizing the player under some circumstances. - Fix a rare progress stopper in xsewer1 in coop. (by Maarakate) - Make Brains work again. The Reckoning 2.03 to 2.04: - Make gibs and debris SOLID_BBOX so they move on entities. - Switch from an arch whitelist to an "all archs are supported" approach. The Reckoning 2.02 to 2.03: - Add CMake as an optional build system. - Fix bug with high velocities in vents in 32bit builds. The Reckoning 2.01 to 2.02: - Coop bugfixes The Reckoning 2.00 to 2.01: - Fix a progress stopper in xware.bsp The Reckoning 2.00RC to 2.00: - Updates to the opened inventory screen were fixed. (By svdijk, merged from baseq2) The Reckoning 1.09 to 2.00RC: - Cleanup of the whole source, nearly every line was audited and touched. - Add sanity checks to all function. - Fix all known bugs. - Merge all missing changes from baseq2. The Reckoning 1.08 to 1.09 - Port 'The Reckoning' to Mac OS X. The Reckoning 1.07 to 1.08 - Port 'The Reckoning' to Windows. - Use randk() instead of rand(), a better PNRG. - Fix some potential problems found by scan-build. The Reckoning 1.06 to 1.07 - Port the new savegame system from baseq2 - Reorder the files to reflect the new structure of baseq2 The Reckoning 1.05 to 1.06: - Reformat the console output The Reckoning 1.04 to 1.05: - Fix "weapprev" cmd, weapon change via mousewheel should now work without running into loops - Fix animation of strogg infantry The Reckoning 1.04RC2 to 1.04: - Just version number change The Reckoning 1.04RC to 1.04RC2: - Saner CFLAGS - Do not show the gun symbol when fov is bigger than 91 and cl_gun is set to 2 The Reckoning 1.03 to 1.04RC: - Slightly better performance (~10 FPS) The Reckoning 1.02 to 1.03: - Added License - Added Readme xatrix-XATRIX_2_14/CMakeLists.txt000066400000000000000000000076741477320050300167160ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.0) # Print a message that using the Makefiles is recommended. message(NOTICE: " The CMakeLists.txt is unmaintained. Use the Makefile if possible.") # Enforce "Debug" as standard build type if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) endif(NOT CMAKE_BUILD_TYPE) # CMake project configuration project(yquake2-xatrix) # Enforce compiler flags (GCC / Clang compatible, yquake2 # won't build with another compiler anyways) # -Wall -> More warnings # -fno-strict-aliasing -> Quake 2 is far away from strict aliasing # -fwrapv -> Make signed integer overflows defined set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fno-strict-aliasing -fwrapv") # Use -O2 as maximum optimization level. -O3 has it's problems with yquake2. string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") # Operating system add_definitions(-DYQ2OSTYPE="${CMAKE_SYSTEM_NAME}") # Architecture string string(REGEX REPLACE "amd64" "x86_64" YQ2_ARCH "${CMAKE_SYSTEM_PROCESSOR}") string(REGEX REPLACE "i.86" "i386" YQ2_ARCH "${YQ2_ARCH}") string(REGEX REPLACE "^arm.*" "arm" YQ2_ARCH "${YQ2_ARCH}") add_definitions(-DYQ2ARCH="${YQ2_ARCH}") # Linker Flags if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") list(APPEND XatrixLinkerFlags "-lm") else() list(APPEND XatrixLinkerFlags "-lm -rdynamic") endif() set(Xatrix-Source src/monster/berserker/berserker.c src/monster/boss2/boss2.c src/monster/boss3/boss3.c src/monster/boss3/boss31.c src/monster/boss3/boss32.c src/monster/boss5/boss5.c src/monster/brain/brain.c src/monster/chick/chick.c src/monster/fixbot/fixbot.c src/monster/flipper/flipper.c src/monster/float/float.c src/monster/flyer/flyer.c src/monster/gekk/gekk.c src/monster/gladiator/gladb.c src/monster/gladiator/gladiator.c src/monster/gunner/gunner.c src/monster/hover/hover.c src/monster/infantry/infantry.c src/monster/insane/insane.c src/monster/medic/medic.c src/monster/misc/move.c src/monster/mutant/mutant.c src/monster/parasite/parasite.c src/monster/soldier/soldier.c src/monster/supertank/supertank.c src/monster/tank/tank.c src/player/client.c src/player/hud.c src/player/trail.c src/player/view.c src/player/weapon.c src/savegame/savegame.c src/shared/flash.c src/shared/rand.c src/shared/shared.c src/g_ai.c src/g_chase.c src/g_cmds.c src/g_combat.c src/g_func.c src/g_items.c src/g_main.c src/g_misc.c src/g_monster.c src/g_phys.c src/g_spawn.c src/g_svcmds.c src/g_target.c src/g_trigger.c src/g_turret.c src/g_utils.c src/g_weapon.c ) set(Xatrix-Header src/header/game.h src/header/local.h src/header/shared.h src/monster/berserker/berserker.h src/monster/boss2/boss2.h src/monster/boss3/boss31.h src/monster/boss3/boss32.h src/monster/brain/brain.h src/monster/chick/chick.h src/monster/fixbot/fixbot.h src/monster/flipper/flipper.h src/monster/float/float.h src/monster/flyer/flyer.h src/monster/gekk/gekk.h src/monster/gladiator/gladiator.h src/monster/gunner/gunner.h src/monster/hover/hover.h src/monster/infantry/infantry.h src/monster/insane/insane.h src/monster/medic/medic.h src/monster/misc/player.h src/monster/mutant/mutant.h src/monster/parasite/parasite.h src/monster/soldier/soldier.h src/monster/soldier/soldierh.h src/monster/supertank/supertank.h src/monster/tank/tank.h src/savegame/tables/clientfields.h src/savegame/tables/fields.h src/savegame/tables/gamefunc_decs.h src/savegame/tables/gamefunc_list.h src/savegame/tables/gamemmove_decs.h src/savegame/tables/gamemmove_list.h src/savegame/tables/levelfields.h ) # Build the xatrix dynamic library add_library(game SHARED ${Xatrix-Source} ${Xatrix-Header}) set_target_properties(game PROPERTIES PREFIX "" LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/Release ) target_link_libraries(game ${XatrixLinkerFlags}) xatrix-XATRIX_2_14/LICENSE000066400000000000000000000431101477320050300151440ustar00rootroot00000000000000 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. xatrix-XATRIX_2_14/Makefile000066400000000000000000000171771477320050300156150ustar00rootroot00000000000000# ----------------------------------------------------- # # Makefile for the xatrix game module for Quake II # # # # Just type "make" to compile the # # - The Reckoning Game (game.so / game.dll) # # # # Dependencies: # # - None, but you need a Quake II to play. # # While in theory every one should work # # Yamagi Quake II is recommended. # # # # Platforms: # # - FreeBSD # # - Linux # # - Mac OS X # # - OpenBSD # # - Windows # # ----------------------------------------------------- # # Detect the OS ifdef SystemRoot YQ2_OSTYPE ?= Windows else YQ2_OSTYPE ?= $(shell uname -s) endif # Special case for MinGW ifneq (,$(findstring MINGW,$(YQ2_OSTYPE))) YQ2_OSTYPE := Windows endif # Detect the architecture ifeq ($(YQ2_OSTYPE), Windows) ifdef MINGW_CHOST ifeq ($(MINGW_CHOST), x86_64-w64-mingw32) YQ2_ARCH ?= x86_64 else # i686-w64-mingw32 YQ2_ARCH ?= i386 endif else # windows, but MINGW_CHOST not defined ifdef PROCESSOR_ARCHITEW6432 # 64 bit Windows YQ2_ARCH ?= $(PROCESSOR_ARCHITEW6432) else # 32 bit Windows YQ2_ARCH ?= $(PROCESSOR_ARCHITECTURE) endif endif # windows but MINGW_CHOST not defined else ifneq ($(YQ2_OSTYPE), Darwin) # Normalize some abiguous YQ2_ARCH strings YQ2_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/amd64/x86_64/' -e 's/^arm.*/arm/') else YQ2_ARCH ?= $(shell uname -m) endif endif # On Windows / MinGW $(CC) is undefined by default. ifeq ($(YQ2_OSTYPE),Windows) CC ?= gcc endif # Detect the compiler ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1) COMPILER := clang COMPILERVER := $(shell $(CC) -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/') else ifeq ($(shell $(CC) -v 2>&1 | grep -c -E "(gcc version|gcc-Version)"), 1) COMPILER := gcc COMPILERVER := $(shell $(CC) -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/') else COMPILER := unknown endif # ---------- # Base CFLAGS. These may be overridden by the environment. # Highest supported optimizations are -O2, higher levels # will likely break this crappy code. ifdef DEBUG CFLAGS ?= -O0 -g -Wall -pipe else CFLAGS ?= -O2 -Wall -pipe -fomit-frame-pointer endif # Always needed are: # -fno-strict-aliasing since the source doesn't comply # with strict aliasing rules and it's next to impossible # to get it there... # -fwrapv for defined integer wrapping. MSVC6 did this # and the game code requires it. override CFLAGS += -fno-strict-aliasing -fwrapv # -MMD to generate header dependencies. Unsupported by # the Clang shipped with OS X. ifneq ($(YQ2_OSTYPE), Darwin) override CFLAGS += -MMD endif # OS X architecture. ifeq ($(YQ2_OSTYPE), Darwin) override CFLAGS += -arch $(YQ2_ARCH) endif # ---------- # Switch of some annoying warnings. ifeq ($(COMPILER), clang) # -Wno-missing-braces because otherwise clang complains # about totally valid 'vec3_t bla = {0}' constructs. CFLAGS += -Wno-missing-braces else ifeq ($(COMPILER), gcc) # GCC 8.0 or higher. ifeq ($(shell test $(COMPILERVER) -ge 80000; echo $$?),0) # -Wno-format-truncation and -Wno-format-overflow # because GCC spams about 50 false positives. CFLAGS += -Wno-format-truncation -Wno-format-overflow endif endif # ---------- # Defines the operating system and architecture override CFLAGS += -DYQ2OSTYPE=\"$(YQ2_OSTYPE)\" -DYQ2ARCH=\"$(YQ2_ARCH)\" # ---------- # For reproduceable builds, look here for details: # https://reproducible-builds.org/specs/source-date-epoch/ ifdef SOURCE_DATE_EPOCH CFLAGS += -DBUILD_DATE=\"$(shell date --utc --date="@${SOURCE_DATE_EPOCH}" +"%b %_d %Y" | sed -e 's/ /\\ /g')\" endif # ---------- # Using the default x87 float math on 32bit x86 causes rounding trouble # -ffloat-store could work around that, but the better solution is to # just enforce SSE - every x86 CPU since Pentium3 supports that # and this should even improve the performance on old CPUs ifeq ($(YQ2_ARCH), i386) override CFLAGS += -msse -mfpmath=sse endif # Force SSE math on x86_64. All sane compilers should do this # anyway, just to protect us from broken Linux distros. ifeq ($(YQ2_ARCH), x86_64) override CFLAGS += -mfpmath=sse endif # ---------- # Base LDFLAGS. LDFLAGS ?= # It's a shared library. override LDFLAGS += -shared # Required libaries ifeq ($(YQ2_OSTYPE), Darwin) override LDFLAGS += -arch $(YQ2_ARCH) else ifeq ($(YQ2_OSTYPE), Windows) override LDFLAGS += -static-libgcc else override LDFLAGS += -lm endif # ---------- # Builds everything all: xatrix # ---------- # When make is invoked by "make VERBOSE=1" print # the compiler and linker commands. ifdef VERBOSE Q := else Q := @ endif # ---------- # Phony targets .PHONY : all clean xatrix # ---------- # Cleanup clean: @echo "===> CLEAN" ${Q}rm -Rf build release # ---------- # The xatrix game ifeq ($(YQ2_OSTYPE), Windows) xatrix: @echo "===> Building game.dll" ${Q}mkdir -p release ${MAKE} release/game.dll else ifeq ($(YQ2_OSTYPE), Darwin) xatrix: @echo "===> Building game.dylib" ${Q}mkdir -p release $(MAKE) release/game.dylib else xatrix: @echo "===> Building game.so" ${Q}mkdir -p release $(MAKE) release/game.so release/game.so : CFLAGS += -fPIC endif build/%.o: %.c @echo "===> CC $<" ${Q}mkdir -p $(@D) ${Q}$(CC) -c $(CFLAGS) -o $@ $< # ---------- XATRIX_OBJS_ = \ src/g_ai.o \ src/g_chase.o \ src/g_cmds.o \ src/g_combat.o \ src/g_func.o \ src/g_items.o \ src/g_main.o \ src/g_misc.o \ src/g_monster.o \ src/g_phys.o \ src/g_spawn.o \ src/g_svcmds.o \ src/g_target.o \ src/g_trigger.o \ src/g_turret.o \ src/g_utils.o \ src/g_weapon.o \ src/monster/berserker/berserker.o \ src/monster/boss2/boss2.o \ src/monster/boss3/boss3.o \ src/monster/boss3/boss31.o \ src/monster/boss3/boss32.o \ src/monster/boss5/boss5.o \ src/monster/brain/brain.o \ src/monster/chick/chick.o \ src/monster/fixbot/fixbot.o \ src/monster/flipper/flipper.o \ src/monster/float/float.o \ src/monster/flyer/flyer.o \ src/monster/gekk/gekk.o \ src/monster/gladiator/gladb.o \ src/monster/gladiator/gladiator.o \ src/monster/gunner/gunner.o \ src/monster/hover/hover.o \ src/monster/infantry/infantry.o \ src/monster/insane/insane.o \ src/monster/medic/medic.o \ src/monster/misc/move.o \ src/monster/mutant/mutant.o \ src/monster/parasite/parasite.o \ src/monster/soldier/soldier.o \ src/monster/supertank/supertank.o \ src/monster/tank/tank.o \ src/player/client.o \ src/player/hud.o \ src/player/trail.o \ src/player/view.o \ src/player/weapon.o \ src/savegame/savegame.o \ src/shared/flash.o \ src/shared/rand.o \ src/shared/shared.o # ---------- # Rewrite paths to our object directory XATRIX_OBJS = $(patsubst %,build/%,$(XATRIX_OBJS_)) # ---------- # Generate header dependencies XATRIX_DEPS= $(XATRIX_OBJS:.o=.d) # ---------- # Suck header dependencies in -include $(XATRIX_DEPS) # ---------- ifeq ($(YQ2_OSTYPE), Windows) release/game.dll : $(XATRIX_OBJS) @echo "===> LD $@" ${Q}$(CC) -o $@ $(XATRIX_OBJS) $(LDFLAGS) else ifeq ($(YQ2_OSTYPE), Darwin) release/game.dylib : $(XATRIX_OBJS) @echo "===> LD $@" ${Q}$(CC) -o $@ $(XATRIX_OBJS) $(LDFLAGS) else release/game.so : $(XATRIX_OBJS) @echo "===> LD $@" ${Q}$(CC) -o $@ $(XATRIX_OBJS) $(LDFLAGS) endif # ---------- xatrix-XATRIX_2_14/README.md000066400000000000000000000043631477320050300154250ustar00rootroot00000000000000# The Reckoning for Yamagi Quake II The Reckoning for Yamagi Quake II is a bugfixed version of the first official missionpack released for Quake II. It's based upon the Quake II SDK source code and licensed under GPL version 2: * [LICENSE](https://github.com/yquake2/xatrix/blob/master/LICENSE) Hundreds of bugs were fixed and some convenience features added. The missionpack is intended to be used with Yamagi Quake II, but it's also fully backward compatible with the last Quake II pointrelease 3.20 and may work with other source ports. Officially supported operating systems are: * FreeBSD * Linux * Windows Beside theses The Reckoning for Yamagi Quake II has community support for MacOS and most other unixoid operating systems, including NetBSD, OpenBSD and Solaris. ## Development The Reckoning for Yamagi Quake II is a community driven project and lives from community involvement. Please report bugs in our issue tracker: * [Issue Tracker](https://github.com/yquake2/xatrix/issues) We are always open to code contributions, no matter if they are small bugfixes or bigger features. However, Yamagi Quake II is a conservative project with big focus on stability and backward compatibility. We don't accept breaking changes. When in doubt please open an issue and ask if a contribution in welcome before putting too much work into it. Open a pull request to submit code: * [Pull Requests](https://github.com/yquake2/xatrix/pulls) Also have a look at our contributors guide: * [Contributors Guide](https://github.com/yquake2/yquake2/blob/master/doc/080_contributing.md) ## Documentation Yamagi Quake II has rather extensive documentation covering all relevant areas from installation and configuration to package building. Have a look at the documentation index: * [Documentation Index](https://github.com/yquake2/yquake2/blob/master/doc/010_index.md) ## Releases The Reckoning for Yamagi Quake II releases at an irregular schedule. The official releases with source code tarballs and prebuild Windows binaries can be found at the homepage: * [Homepage](https://www.yamagi.org/quake2/) Our CI builds **unsupported** Linux, MacOS and Windows binaries at every commit. The artifacts can be found here: * [Github Actions](https://github.com/yquake2/xatrix/actions) xatrix-XATRIX_2_14/src/000077500000000000000000000000001477320050300147275ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/g_ai.c000066400000000000000000000573051477320050300160040ustar00rootroot00000000000000/* ======================================================================= * * The basic AI functions like enemy detection, attacking and so on. * * ======================================================================= */ #include "header/local.h" qboolean FindTarget(edict_t *self); extern cvar_t *maxclients; qboolean ai_checkattack(edict_t *self, float dist); qboolean enemy_vis; qboolean enemy_infront; int enemy_range; float enemy_yaw; /* ============================================================================ */ /* * Called once each frame to set level.sight_client * to the player to be checked for in findtarget. * If all clients are either dead or in notarget, * sight_client will be null. In coop games, * sight_client will cycle between the clients. */ void AI_SetSightClient(void) { edict_t *ent; int start, check; if (level.sight_client == NULL) { start = 1; } else { start = level.sight_client - g_edicts; } check = start; while (1) { check++; if (check > game.maxclients) { check = 1; } ent = &g_edicts[check]; if (ent->inuse && (ent->health > 0) && !(ent->flags & FL_NOTARGET)) { level.sight_client = ent; return; /* got one */ } if (check == start) { level.sight_client = NULL; return; /* nobody to see */ } } } /* ============================================================================ */ /* * Move the specified distance at current * facing. This replaces the QC functions: * ai_forward, ai_back, ai_pain, and ai_painforward */ void ai_move(edict_t *self, float dist) { M_walkmove(self, self->s.angles[YAW], dist); } /* * Used for standing around and looking for * players. Distance is for slight position * adjustments needed by the animations */ void ai_stand(edict_t *self, float dist) { vec3_t v; if (!self) { return; } if (dist) { M_walkmove(self, self->s.angles[YAW], dist); } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { if (self->enemy) { VectorSubtract(self->enemy->s.origin, self->s.origin, v); self->ideal_yaw = vectoyaw(v); if ((self->s.angles[YAW] != self->ideal_yaw) && self->monsterinfo.aiflags & AI_TEMP_STAND_GROUND) { self->monsterinfo.aiflags &= ~(AI_STAND_GROUND | AI_TEMP_STAND_GROUND); self->monsterinfo.run(self); } M_ChangeYaw(self); ai_checkattack(self, 0); } else { FindTarget(self); } return; } if (FindTarget(self)) { return; } if (level.time > self->monsterinfo.pausetime) { self->monsterinfo.walk(self); return; } if (!(self->spawnflags & 1) && (self->monsterinfo.idle) && (level.time > self->monsterinfo.idle_time)) { if (self->monsterinfo.idle_time) { self->monsterinfo.idle(self); self->monsterinfo.idle_time = level.time + 15 + random() * 15; } else { self->monsterinfo.idle_time = level.time + random() * 15; } } } /* * The monster is walking it's beat */ void ai_walk(edict_t *self, float dist) { if (!self) { return; } M_MoveToGoal(self, dist); /* check for noticing a player */ if (FindTarget(self)) { return; } if ((self->monsterinfo.search) && (level.time > self->monsterinfo.idle_time)) { if (self->monsterinfo.idle_time) { self->monsterinfo.search(self); self->monsterinfo.idle_time = level.time + 15 + random() * 15; } else { self->monsterinfo.idle_time = level.time + random() * 15; } } } /* * Turns towards target and advances. * Use this call with a distnace of 0 * to replace ai_face */ void ai_charge(edict_t *self, float dist) { vec3_t v; if (!self) { return; } if(self->enemy) { VectorSubtract(self->enemy->s.origin, self->s.origin, v); } self->ideal_yaw = vectoyaw(v); M_ChangeYaw(self); if (dist) { M_walkmove(self, self->s.angles[YAW], dist); } } /* * Don't move, but turn towards ideal_yaw * Distance is for slight position adjustments * needed by the animations */ void ai_turn(edict_t *self, float dist) { if (!self) { return; } if (dist) { M_walkmove(self, self->s.angles[YAW], dist); } if (FindTarget(self)) { return; } M_ChangeYaw(self); } /* * .enemy * Will be world if not currently angry at anyone. * * .movetarget * The next path spot to walk toward. If .enemy, ignore .movetarget. * When an enemy is killed, the monster will try to return to it's path. * * .hunt_time * Set to time + something when the player is in sight, but movement straight for * him is blocked. This causes the monster to use wall following code for * movement direction instead of sighting on the player. * * .ideal_yaw * A yaw angle of the intended direction, which will be turned towards at up * to 45 deg / state. If the enemy is in view and hunt_time is not active, * this will be the exact line towards the enemy. * * .pausetime * A monster will leave it's stand state and head towards it's .movetarget when * time > .pausetime. * * walkmove(angle, speed) primitive is all or nothing */ /* * returns the range catagorization of an entity reletive to self * 0 melee range, will become hostile even if back is turned * 1 visibility and infront, or visibility and show hostile * 2 infront and show hostile * 3 only triggered by damage */ int range(edict_t *self, edict_t *other) { vec3_t v; float len; if (!self || !other) { return 0; } VectorSubtract(self->s.origin, other->s.origin, v); len = VectorLength(v); if (len < MELEE_DISTANCE) { return RANGE_MELEE; } if (len < 500) { return RANGE_NEAR; } if (len < 1000) { return RANGE_MID; } return RANGE_FAR; } /* * returns 1 if the entity is visible * to self, even if not infront() */ qboolean visible(edict_t *self, edict_t *other) { vec3_t spot1; vec3_t spot2; trace_t trace; if (!self || !other) { return false; } VectorCopy(self->s.origin, spot1); spot1[2] += self->viewheight; VectorCopy(other->s.origin, spot2); spot2[2] += other->viewheight; trace = gi.trace(spot1, vec3_origin, vec3_origin, spot2, self, MASK_OPAQUE); if (trace.fraction == 1.0) { return true; } return false; } /* * returns 1 if the entity is in * front (in sight) of self */ qboolean infront(edict_t *self, edict_t *other) { vec3_t vec; float dot; vec3_t forward; if (!self || !other) { return false; } AngleVectors(self->s.angles, forward, NULL, NULL); VectorSubtract(other->s.origin, self->s.origin, vec); VectorNormalize(vec); dot = DotProduct(vec, forward); if (dot > 0.3) { return true; } return false; } /* ============================================================================ */ void HuntTarget(edict_t *self) { vec3_t vec; if (!self) { return; } self->goalentity = self->enemy; if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.stand(self); } else { self->monsterinfo.run(self); } if(visible(self, self->enemy)) { VectorSubtract(self->enemy->s.origin, self->s.origin, vec); } else { VectorClear(vec); } self->ideal_yaw = vectoyaw(vec); /* wait a while before first attack */ if (!(self->monsterinfo.aiflags & AI_STAND_GROUND)) { AttackFinished(self, 1); } } void FoundTarget(edict_t *self) { if (!self|| !self->enemy || !self->enemy->inuse) { return; } /* let other monsters see this monster for a while */ if (self->enemy->client) { level.sight_entity = self; level.sight_entity_framenum = level.framenum; level.sight_entity->light_level = 128; } self->show_hostile = level.time + 1; /* wake up other monsters */ VectorCopy(self->enemy->s.origin, self->monsterinfo.last_sighting); self->monsterinfo.trail_time = level.time; if (!self->combattarget) { HuntTarget(self); return; } self->goalentity = self->movetarget = G_PickTarget(self->combattarget); if (!self->movetarget) { self->goalentity = self->movetarget = self->enemy; HuntTarget(self); gi.dprintf("%s at %s, combattarget %s not found\n", self->classname, vtos(self->s.origin), self->combattarget); return; } /* clear out our combattarget, these are a one shot deal */ self->combattarget = NULL; self->monsterinfo.aiflags |= AI_COMBAT_POINT; /* clear the targetname, that point is ours! */ self->movetarget->targetname = NULL; self->monsterinfo.pausetime = 0; /* run for it */ self->monsterinfo.run(self); } /* * Self is currently not attacking anything, so try * to find a target. Returns TRUE if an enemy was sighted. * When a player fires a missile, the point of impact * becomes a fakeplayer so that monsters that see the * impact will respond as if they had seen the player. * * To avoid spending too much time, only a single client * (or fakeclient) is checked each frame. This means multi * player games will have slightly slower noticing monsters. */ qboolean FindTarget(edict_t *self) { edict_t *client; qboolean heardit; int r; if (!self) { return false; } if (self->monsterinfo.aiflags & AI_GOOD_GUY) { return false; } /* if we're going to a combat point, just proceed */ if (self->monsterinfo.aiflags & AI_COMBAT_POINT) { return false; } /* if the first spawnflag bit is set, the monster will only wake up on really seeing the player, not another monster getting angry or hearing something */ heardit = false; if ((level.sight_entity_framenum >= (level.framenum - 1)) && !(self->spawnflags & 1)) { client = level.sight_entity; if (client->enemy == self->enemy) { return false; } } else if (level.sound_entity_framenum >= (level.framenum - 1)) { client = level.sound_entity; heardit = true; } else if (!(self->enemy) && (level.sound2_entity_framenum >= (level.framenum - 1)) && !(self->spawnflags & 1)) { client = level.sound2_entity; heardit = true; } else { client = level.sight_client; } /* if the entity went away, forget it */ if (!client || !client->inuse || (client->client && level.intermissiontime)) { return false; } if (client == self->enemy) { return true; } if (client->client) { if (client->flags & FL_NOTARGET) { return false; } } else if (client->svflags & SVF_MONSTER) { if (!client->enemy) { return false; } if (client->enemy->flags & FL_NOTARGET) { return false; } } else if (heardit) { if (client->owner->flags & FL_NOTARGET) { return false; } } else { return false; } if (!heardit) { r = range(self, client); if (r == RANGE_FAR) { return false; } /* is client in an spot too dark to be seen? */ if (client->light_level <= 5) { return false; } if (!visible(self, client)) { return false; } if (r == RANGE_NEAR) { if ((client->show_hostile < level.time) && !infront(self, client)) { return false; } } else if (r == RANGE_MID) { if (!infront(self, client)) { return false; } } self->enemy = client; if (strcmp(self->enemy->classname, "player_noise") != 0) { self->monsterinfo.aiflags &= ~AI_SOUND_TARGET; if (!self->enemy->client) { self->enemy = self->enemy->enemy; if (!self->enemy->client) { self->enemy = NULL; return false; } } } } else /* heardit */ { vec3_t temp; if (self->spawnflags & 1) { if (!visible(self, client)) { return false; } } else { if (!gi.inPHS(self->s.origin, client->s.origin)) { return false; } } VectorSubtract(client->s.origin, self->s.origin, temp); if (VectorLength(temp) > 1000) /* too far to hear */ { return false; } /* check area portals - if they are different and not connected then we can't hear it */ if (client->areanum != self->areanum) { if (!gi.AreasConnected(self->areanum, client->areanum)) { return false; } } self->ideal_yaw = vectoyaw(temp); M_ChangeYaw(self); /* hunt the sound for a bit; hopefully find the real player */ self->monsterinfo.aiflags |= AI_SOUND_TARGET; self->enemy = client; } /* got one */ FoundTarget(self); if (!(self->monsterinfo.aiflags & AI_SOUND_TARGET) && (self->monsterinfo.sight)) { self->monsterinfo.sight(self, self->enemy); } return true; } /* ============================================================================= */ qboolean FacingIdeal(edict_t *self) { float delta; if (!self) { return false; } delta = anglemod(self->s.angles[YAW] - self->ideal_yaw); if ((delta > 45) && (delta < 315)) { return false; } return true; } /* ============================================================================= */ qboolean M_CheckAttack(edict_t *self) { vec3_t spot1, spot2; float chance; trace_t tr; if (!self || !self->enemy || !self->enemy->inuse) { return false; } if (self->enemy->health > 0) { /* see if any entities are in the way of the shot */ VectorCopy(self->s.origin, spot1); spot1[2] += self->viewheight; VectorCopy(self->enemy->s.origin, spot2); spot2[2] += self->enemy->viewheight; tr = gi.trace(spot1, NULL, NULL, spot2, self, CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_SLIME | CONTENTS_LAVA | CONTENTS_WINDOW); /* do we have a clear shot? */ if (tr.ent != self->enemy) { return false; } } /* melee attack */ if (enemy_range == RANGE_MELEE) { /* don't always melee in easy mode */ if ((skill->value == SKILL_EASY) && (rand() & 3)) { return false; } if (self->monsterinfo.melee) { self->monsterinfo.attack_state = AS_MELEE; } else { self->monsterinfo.attack_state = AS_MISSILE; } return true; } /* missile attack */ if (!self->monsterinfo.attack) { return false; } if (level.time < self->monsterinfo.attack_finished) { return false; } if (enemy_range == RANGE_FAR) { return false; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { chance = 0.4; } else if (enemy_range == RANGE_NEAR) { chance = 0.1; } else if (enemy_range == RANGE_MID) { chance = 0.02; } else { return false; } if (skill->value == SKILL_EASY) { chance *= 0.5; } else if (skill->value >= SKILL_HARD) { chance *= 2; } if (random() < chance) { self->monsterinfo.attack_state = AS_MISSILE; self->monsterinfo.attack_finished = level.time + 2 * random(); return true; } if (self->flags & FL_FLY) { if (random() < 0.3) { self->monsterinfo.attack_state = AS_SLIDING; } else { self->monsterinfo.attack_state = AS_STRAIGHT; } } return false; } /* * Turn and close until within * an angle to launch a melee attack */ void ai_run_melee(edict_t *self) { if (!self) { return; } self->ideal_yaw = enemy_yaw; M_ChangeYaw(self); if (FacingIdeal(self)) { if (self->monsterinfo.melee) { self->monsterinfo.melee(self); self->monsterinfo.attack_state = AS_STRAIGHT; } } } /* * Turn in place until within * an angle to launch a missile attack */ void ai_run_missile(edict_t *self) { if (!self) { return; } self->ideal_yaw = enemy_yaw; M_ChangeYaw(self); if (FacingIdeal(self)) { if (self->monsterinfo.attack) { self->monsterinfo.attack(self); self->monsterinfo.attack_state = AS_STRAIGHT; } } } /* * Strafe sideways, but stay * at aproximately the same range */ void ai_run_slide(edict_t *self, float distance) { float ofs; if (!self) { return; } self->ideal_yaw = enemy_yaw; M_ChangeYaw(self); if (self->monsterinfo.lefty) { ofs = 90; } else { ofs = -90; } if (M_walkmove(self, self->ideal_yaw + ofs, distance)) { return; } self->monsterinfo.lefty = 1 - self->monsterinfo.lefty; M_walkmove(self, self->ideal_yaw - ofs, distance); } /* * Decides if we're going to * attack or do something else */ static qboolean hesDeadJim(const edict_t *self) { const edict_t *enemy = self->enemy; if (!enemy || !enemy->inuse) { return true; } if (self->monsterinfo.aiflags & AI_MEDIC) { return (enemy->health > 0); } if (enemy->client && level.intermissiontime) { return true; } if (self->monsterinfo.aiflags & AI_BRUTAL) { return (enemy->health <= -80); } return (enemy->health <= 0); } qboolean ai_checkattack(edict_t *self, float dist) { vec3_t temp; if (!self) { enemy_vis = false; return false; } /* this causes monsters to run blindly to the combat point w/o firing */ if (self->goalentity) { if (self->monsterinfo.aiflags & AI_COMBAT_POINT) { return false; } if ((self->monsterinfo.aiflags & AI_SOUND_TARGET) && !visible(self, self->goalentity)) { if ((level.time - self->enemy->last_sound_time) > 5.0) { if (self->goalentity == self->enemy) { if (self->movetarget) { self->goalentity = self->movetarget; } else { self->goalentity = NULL; } } self->monsterinfo.aiflags &= ~AI_SOUND_TARGET; if (self->monsterinfo.aiflags & AI_TEMP_STAND_GROUND) { self->monsterinfo.aiflags &= ~(AI_STAND_GROUND | AI_TEMP_STAND_GROUND); } } else { self->show_hostile = level.time + 1; return false; } } } enemy_vis = false; /* see if the enemy is dead */ if (hesDeadJim(self)) { self->enemy = NULL; self->monsterinfo.aiflags &= ~AI_MEDIC; if (self->oldenemy && (self->oldenemy->health > 0)) { self->enemy = self->oldenemy; self->oldenemy = NULL; HuntTarget(self); } else { if (self->movetarget) { self->goalentity = self->movetarget; self->monsterinfo.walk(self); } else { /* we need the pausetime otherwise the stand code will just revert to walking with no target and the monsters will wonder around aimlessly trying to hunt the world entity */ self->monsterinfo.pausetime = level.time + 100000000; self->monsterinfo.stand(self); } return true; } } self->show_hostile = level.time + 1; /* wake up other monsters */ /* check knowledge of enemy */ enemy_vis = visible(self, self->enemy); if (enemy_vis) { self->monsterinfo.search_time = level.time + 5; VectorCopy(self->enemy->s.origin, self->monsterinfo.last_sighting); } if (coop && coop->value && (self->monsterinfo.search_time < level.time)) { if (FindTarget(self)) { return true; } } if (self->enemy) { enemy_infront = infront(self, self->enemy); enemy_range = range(self, self->enemy); VectorSubtract(self->enemy->s.origin, self->s.origin, temp); enemy_yaw = vectoyaw(temp); } if (self->monsterinfo.attack_state == AS_MISSILE) { ai_run_missile(self); return true; } if (self->monsterinfo.attack_state == AS_MELEE) { ai_run_melee(self); return true; } /* if enemy is not currently visible, we will never attack */ if (!enemy_vis) { return false; } return self->monsterinfo.checkattack(self); } /* * The monster has an enemy it is trying to kill */ void ai_run(edict_t *self, float dist) { vec3_t v; edict_t *tempgoal; edict_t *save; qboolean new; edict_t *marker; float d1, d2; trace_t tr; vec3_t v_forward, v_right; float left, center, right; vec3_t left_target, right_target; if (!self) { return; } /* if we're going to a combat point, just proceed */ if (self->monsterinfo.aiflags & AI_COMBAT_POINT) { M_MoveToGoal(self, dist); return; } if (self->monsterinfo.aiflags & AI_SOUND_TARGET) { /* Special case: Some projectiles like grenades or rockets are classified as an enemy. When they explode they generate a sound entity, triggering this code path. Since they're gone after the explosion their entity pointer is NULL. Therefor self->enemy is also NULL and we're crashing. Work around this by predending that the enemy is still there, and move to it. */ if (self->enemy) { VectorSubtract(self->s.origin, self->enemy->s.origin, v); if (VectorLength(v) < 64) { self->monsterinfo.aiflags |= (AI_STAND_GROUND | AI_TEMP_STAND_GROUND); self->monsterinfo.stand(self); return; } } M_MoveToGoal(self, dist); if (!FindTarget(self)) { return; } } if (ai_checkattack(self, dist)) { return; } if (self->monsterinfo.attack_state == AS_SLIDING) { ai_run_slide(self, dist); return; } if (enemy_vis) { M_MoveToGoal(self, dist); self->monsterinfo.aiflags &= ~AI_LOST_SIGHT; VectorCopy(self->enemy->s.origin, self->monsterinfo.last_sighting); self->monsterinfo.trail_time = level.time; return; } if ((self->monsterinfo.search_time) && (level.time > (self->monsterinfo.search_time + 20))) { M_MoveToGoal(self, dist); self->monsterinfo.search_time = 0; return; } tempgoal = G_SpawnOptional(); if (!tempgoal) { M_MoveToGoal(self, dist); return; } save = self->goalentity; self->goalentity = tempgoal; new = false; if (!(self->monsterinfo.aiflags & AI_LOST_SIGHT)) { /* just lost sight of the player, decide where to go first */ self->monsterinfo.aiflags |= (AI_LOST_SIGHT | AI_PURSUIT_LAST_SEEN); self->monsterinfo.aiflags &= ~(AI_PURSUE_NEXT | AI_PURSUE_TEMP); new = true; } if (self->monsterinfo.aiflags & AI_PURSUE_NEXT) { self->monsterinfo.aiflags &= ~AI_PURSUE_NEXT; /* give ourself more time since we got this far */ self->monsterinfo.search_time = level.time + 5; if (self->monsterinfo.aiflags & AI_PURSUE_TEMP) { self->monsterinfo.aiflags &= ~AI_PURSUE_TEMP; marker = NULL; VectorCopy(self->monsterinfo.saved_goal, self->monsterinfo.last_sighting); new = true; } else if (self->monsterinfo.aiflags & AI_PURSUIT_LAST_SEEN) { self->monsterinfo.aiflags &= ~AI_PURSUIT_LAST_SEEN; marker = PlayerTrail_PickFirst(self); } else { marker = PlayerTrail_PickNext(self); } if (marker) { VectorCopy(marker->s.origin, self->monsterinfo.last_sighting); self->monsterinfo.trail_time = marker->timestamp; self->s.angles[YAW] = self->ideal_yaw = marker->s.angles[YAW]; new = true; } } VectorSubtract(self->s.origin, self->monsterinfo.last_sighting, v); d1 = VectorLength(v); if (d1 <= dist) { self->monsterinfo.aiflags |= AI_PURSUE_NEXT; dist = d1; } VectorCopy(self->monsterinfo.last_sighting, self->goalentity->s.origin); if (new) { tr = gi.trace(self->s.origin, self->mins, self->maxs, self->monsterinfo.last_sighting, self, MASK_PLAYERSOLID); if (tr.fraction < 1) { VectorSubtract(self->goalentity->s.origin, self->s.origin, v); d1 = VectorLength(v); center = tr.fraction; d2 = d1 * ((center + 1) / 2); self->s.angles[YAW] = self->ideal_yaw = vectoyaw(v); AngleVectors(self->s.angles, v_forward, v_right, NULL); VectorSet(v, d2, -16, 0); G_ProjectSource(self->s.origin, v, v_forward, v_right, left_target); tr = gi.trace(self->s.origin, self->mins, self->maxs, left_target, self, MASK_PLAYERSOLID); left = tr.fraction; VectorSet(v, d2, 16, 0); G_ProjectSource(self->s.origin, v, v_forward, v_right, right_target); tr = gi.trace(self->s.origin, self->mins, self->maxs, right_target, self, MASK_PLAYERSOLID); right = tr.fraction; center = (d1 * center) / d2; if ((left >= center) && (left > right)) { if (left < 1) { VectorSet(v, d2 * left * 0.5, -16, 0); G_ProjectSource(self->s.origin, v, v_forward, v_right, left_target); } VectorCopy(self->monsterinfo.last_sighting, self->monsterinfo.saved_goal); self->monsterinfo.aiflags |= AI_PURSUE_TEMP; VectorCopy(left_target, self->goalentity->s.origin); VectorCopy(left_target, self->monsterinfo.last_sighting); VectorSubtract(self->goalentity->s.origin, self->s.origin, v); self->s.angles[YAW] = self->ideal_yaw = vectoyaw(v); } else if ((right >= center) && (right > left)) { if (right < 1) { VectorSet(v, d2 * right * 0.5, 16, 0); G_ProjectSource(self->s.origin, v, v_forward, v_right, right_target); } VectorCopy(self->monsterinfo.last_sighting, self->monsterinfo.saved_goal); self->monsterinfo.aiflags |= AI_PURSUE_TEMP; VectorCopy(right_target, self->goalentity->s.origin); VectorCopy(right_target, self->monsterinfo.last_sighting); VectorSubtract(self->goalentity->s.origin, self->s.origin, v); self->s.angles[YAW] = self->ideal_yaw = vectoyaw(v); } } } M_MoveToGoal(self, dist); G_FreeEdict(tempgoal); self->goalentity = save; } xatrix-XATRIX_2_14/src/g_chase.c000066400000000000000000000073671477320050300165010ustar00rootroot00000000000000/* * ======================================================================= * * Chase cam. Only used in multiplayer mode. * * ======================================================================= */ #include "header/local.h" void UpdateChaseCam(edict_t *ent) { vec3_t o, ownerv, goal; edict_t *targ; vec3_t forward, right; trace_t trace; int i; vec3_t angles; if (!ent) { return; } /* is our chase target gone? */ if (!ent->client->chase_target->inuse || ent->client->chase_target->client->resp.spectator) { edict_t *old = ent->client->chase_target; ChaseNext(ent); if (ent->client->chase_target == old) { ent->client->chase_target = NULL; ent->client->ps.pmove.pm_flags &= ~PMF_NO_PREDICTION; return; } } targ = ent->client->chase_target; VectorCopy(targ->s.origin, ownerv); ownerv[2] += targ->viewheight; VectorCopy(targ->client->v_angle, angles); if (angles[PITCH] > 56) { angles[PITCH] = 56; } AngleVectors(angles, forward, right, NULL); VectorNormalize(forward); VectorMA(ownerv, -30, forward, o); if (o[2] < targ->s.origin[2] + 20) { o[2] = targ->s.origin[2] + 20; } /* jump animation lifts */ if (!targ->groundentity) { o[2] += 16; } trace = gi.trace(ownerv, vec3_origin, vec3_origin, o, targ, MASK_SOLID); VectorCopy(trace.endpos, goal); VectorMA(goal, 2, forward, goal); /* pad for floors and ceilings */ VectorCopy(goal, o); o[2] += 6; trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID); if (trace.fraction < 1) { VectorCopy(trace.endpos, goal); goal[2] -= 6; } VectorCopy(goal, o); o[2] -= 6; trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID); if (trace.fraction < 1) { VectorCopy(trace.endpos, goal); goal[2] += 6; } if (targ->deadflag) { ent->client->ps.pmove.pm_type = PM_DEAD; } else { ent->client->ps.pmove.pm_type = PM_FREEZE; } VectorCopy(goal, ent->s.origin); for (i = 0; i < 3; i++) { ent->client->ps.pmove.delta_angles[i] = ANGLE2SHORT( targ->client->v_angle[i] - ent->client->resp.cmd_angles[i]); } if (targ->deadflag) { ent->client->ps.viewangles[ROLL] = 40; ent->client->ps.viewangles[PITCH] = -15; ent->client->ps.viewangles[YAW] = targ->client->killer_yaw; } else { VectorCopy(targ->client->v_angle, ent->client->ps.viewangles); VectorCopy(targ->client->v_angle, ent->client->v_angle); } ent->viewheight = 0; ent->client->ps.pmove.pm_flags |= PMF_NO_PREDICTION; gi.linkentity(ent); } void ChaseNext(edict_t *ent) { int i; edict_t *e; if (!ent) { return; } if (!ent->client->chase_target) { return; } i = ent->client->chase_target - g_edicts; do { i++; if (i > maxclients->value) { i = 1; } e = g_edicts + i; if (!e->inuse) { continue; } if (!e->client->resp.spectator) { break; } } while (e != ent->client->chase_target); ent->client->chase_target = e; ent->client->update_chase = true; } void ChasePrev(edict_t *ent) { int i; edict_t *e; if (!ent) { return; } if (!ent->client->chase_target) { return; } i = ent->client->chase_target - g_edicts; do { i--; if (i < 1) { i = maxclients->value; } e = g_edicts + i; if (!e->inuse) { continue; } if (!e->client->resp.spectator) { break; } } while (e != ent->client->chase_target); ent->client->chase_target = e; ent->client->update_chase = true; } void GetChaseTarget(edict_t *ent) { int i; edict_t *other; if (!ent) { return; } for (i = 1; i <= maxclients->value; i++) { other = g_edicts + i; if (other->inuse && !other->client->resp.spectator) { ent->client->chase_target = other; ent->client->update_chase = true; UpdateChaseCam(ent); return; } } gi.centerprintf(ent, "No other players to chase."); } xatrix-XATRIX_2_14/src/g_cmds.c000066400000000000000000000710551477320050300163370ustar00rootroot00000000000000/* ======================================================================= * * Game command processing. * * ======================================================================= */ #include "header/local.h" #include "monster/misc/player.h" static char * ClientTeam(edict_t *ent, char* value) { char *p; value[0] = 0; if (!ent) { return value; } if (!ent->client) { return value; } strcpy(value, Info_ValueForKey(ent->client->pers.userinfo, "skin")); p = strchr(value, '/'); if (!p) { return value; } if ((int)(dmflags->value) & DF_MODELTEAMS) { *p = 0; return value; } return ++p; } qboolean OnSameTeam(edict_t *ent1, edict_t *ent2) { char ent1Team[512]; char ent2Team[512]; if (!ent1 || !ent2) { return false; } if (!((int)(dmflags->value) & (DF_MODELTEAMS | DF_SKINTEAMS))) { return false; } ClientTeam(ent1, ent1Team); ClientTeam(ent2, ent2Team); if (ent1Team[0] != '\0' && strcmp(ent1Team, ent2Team) == 0) { return true; } return false; } void SelectNextItem(edict_t *ent, int itflags) { gclient_t *cl; int i, index; gitem_t *it; if (!ent) { return; } cl = ent->client; if (cl->chase_target) { ChaseNext(ent); return; } /* scan for the next valid one */ for (i = 1; i <= MAX_ITEMS; i++) { index = (cl->pers.selected_item + i) % MAX_ITEMS; if (!cl->pers.inventory[index]) { continue; } it = &itemlist[index]; if (!it->use) { continue; } if (!(it->flags & itflags)) { continue; } cl->pers.selected_item = index; return; } cl->pers.selected_item = -1; } void SelectPrevItem(edict_t *ent, int itflags) { gclient_t *cl; int i, index; gitem_t *it; if (!ent) { return; } cl = ent->client; if (cl->chase_target) { ChasePrev(ent); return; } /* scan for the next valid one */ for (i = 1; i <= MAX_ITEMS; i++) { index = (cl->pers.selected_item + MAX_ITEMS - i) % MAX_ITEMS; if (!cl->pers.inventory[index]) { continue; } it = &itemlist[index]; if (!it->use) { continue; } if (!(it->flags & itflags)) { continue; } cl->pers.selected_item = index; return; } cl->pers.selected_item = -1; } void ValidateSelectedItem(edict_t *ent) { gclient_t *cl; if (!ent) { return; } cl = ent->client; if (cl->pers.inventory[cl->pers.selected_item]) { return; /* valid */ } SelectNextItem(ent, -1); } /* ================================================================================= */ /* * Give items to a client */ void Cmd_Give_f(edict_t *ent) { char *name; gitem_t *it; int index; int i; qboolean give_all; edict_t *it_ent; if (!ent) { return; } if ((deathmatch->value || coop->value) && !sv_cheats->value) { gi.cprintf(ent, PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n"); return; } name = gi.args(); if (Q_stricmp(name, "all") == 0) { give_all = true; } else { give_all = false; } if (give_all || (Q_stricmp(gi.argv(1), "health") == 0)) { if (gi.argc() == 3) { ent->health = atoi(gi.argv(2)); ent->health = ent->health < 1 ? 1 : ent->health; } else { ent->health = ent->max_health; } if (!give_all) { return; } } if (give_all || (Q_stricmp(name, "weapons") == 0)) { for (i = 0; i < game.num_items; i++) { it = itemlist + i; if (!it->pickup) { continue; } if (!(it->flags & IT_WEAPON)) { continue; } ent->client->pers.inventory[i] += 1; } if (!give_all) { return; } } if (give_all || (Q_stricmp(name, "ammo") == 0)) { for (i = 0; i < game.num_items; i++) { it = itemlist + i; if (!it->pickup) { continue; } if (!(it->flags & IT_AMMO)) { continue; } Add_Ammo(ent, it, 1000); } if (!give_all) { return; } } if (give_all || (Q_stricmp(name, "armor") == 0)) { gitem_armor_t *info; it = FindItem("Jacket Armor"); ent->client->pers.inventory[ITEM_INDEX(it)] = 0; it = FindItem("Combat Armor"); ent->client->pers.inventory[ITEM_INDEX(it)] = 0; it = FindItem("Body Armor"); info = (gitem_armor_t *)it->info; ent->client->pers.inventory[ITEM_INDEX(it)] = info->max_count; if (!give_all) { return; } } if (give_all || (Q_stricmp(name, "Power Shield") == 0)) { it = FindItem("Power Shield"); it_ent = G_Spawn(); it_ent->classname = it->classname; SpawnItem(it_ent, it); Touch_Item(it_ent, ent, NULL, NULL); if (it_ent->inuse) { G_FreeEdict(it_ent); } if (!give_all) { return; } } if (give_all) { for (i = 0; i < game.num_items; i++) { it = itemlist + i; if (!it->pickup) { continue; } if (it->flags & (IT_ARMOR | IT_WEAPON | IT_AMMO)) { continue; } ent->client->pers.inventory[i] = 1; } return; } it = FindItem(name); if (!it) { name = gi.argv(1); it = FindItem(name); if (!it) { gi.cprintf(ent, PRINT_HIGH, "unknown item\n"); return; } } if (!it->pickup) { gi.cprintf(ent, PRINT_HIGH, "non-pickup item\n"); return; } index = ITEM_INDEX(it); if (it->flags & IT_AMMO) { if (gi.argc() == 3) { ent->client->pers.inventory[index] = atoi(gi.argv(2)); } else { ent->client->pers.inventory[index] += it->quantity; } } else { it_ent = G_Spawn(); it_ent->classname = it->classname; SpawnItem(it_ent, it); Touch_Item(it_ent, ent, NULL, NULL); if (it_ent->inuse) { G_FreeEdict(it_ent); } } } /* * Sets client to godmode */ void Cmd_God_f(edict_t *ent) { char *msg; if (!ent) { return; } if ((deathmatch->value || coop->value) && !sv_cheats->value) { gi.cprintf(ent, PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n"); return; } ent->flags ^= FL_GODMODE; if (!(ent->flags & FL_GODMODE)) { msg = "godmode OFF\n"; } else { msg = "godmode ON\n"; } gi.cprintf(ent, PRINT_HIGH, msg); } /* * Sets client to notarget */ void Cmd_Notarget_f(edict_t *ent) { char *msg; if (!ent) { return; } if ((deathmatch->value || coop->value) && !sv_cheats->value) { gi.cprintf(ent, PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n"); return; } ent->flags ^= FL_NOTARGET; if (!(ent->flags & FL_NOTARGET)) { msg = "notarget OFF\n"; } else { msg = "notarget ON\n"; } gi.cprintf(ent, PRINT_HIGH, msg); } void Cmd_Noclip_f(edict_t *ent) { char *msg; if (!ent) { return; } if ((deathmatch->value || coop->value) && !sv_cheats->value) { gi.cprintf(ent, PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n"); return; } if (ent->movetype == MOVETYPE_NOCLIP) { ent->movetype = MOVETYPE_WALK; msg = "noclip OFF\n"; } else { ent->movetype = MOVETYPE_NOCLIP; msg = "noclip ON\n"; } gi.cprintf(ent, PRINT_HIGH, msg); } /* * Use an inventory item */ void Cmd_Use_f(edict_t *ent) { int index; gitem_t *it; char *s; if (!ent) { return; } s = gi.args(); it = FindItem(s); if (!it) { gi.cprintf(ent, PRINT_HIGH, "unknown item: %s\n", s); return; } if (!it->use) { gi.cprintf(ent, PRINT_HIGH, "Item is not usable.\n"); return; } index = ITEM_INDEX(it); if (!ent->client->pers.inventory[index]) { if (strcmp(it->pickup_name, "HyperBlaster") == 0) { it = FindItem("Ionripper"); index = ITEM_INDEX(it); if (!ent->client->pers.inventory[index]) { gi.cprintf(ent, PRINT_HIGH, "Out of item: %s\n", s); return; } } else if (strcmp(it->pickup_name, "Railgun") == 0) { it = FindItem("Phalanx"); index = ITEM_INDEX(it); if (!ent->client->pers.inventory[index]) { gi.cprintf(ent, PRINT_HIGH, "Out of item: %s\n", s); return; } } else { gi.cprintf(ent, PRINT_HIGH, "Out of item: %s\n", s); return; } } it->use(ent, it); } /* * Drop an inventory item */ void Cmd_Drop_f(edict_t *ent) { int index; gitem_t *it; char *s; if (!ent) { return; } s = gi.args(); it = FindItem(s); if (!it) { gi.cprintf(ent, PRINT_HIGH, "unknown item: %s\n", s); return; } if (!it->drop) { gi.cprintf(ent, PRINT_HIGH, "Item is not dropable.\n"); return; } index = ITEM_INDEX(it); if (!ent->client->pers.inventory[index]) { if (strcmp(it->pickup_name, "HyperBlaster") == 0) { it = FindItem("Ionripper"); index = ITEM_INDEX(it); if (!ent->client->pers.inventory[index]) { gi.cprintf(ent, PRINT_HIGH, "Out of item: %s\n", s); return; } } else if (strcmp(it->pickup_name, "Railgun") == 0) { it = FindItem("Phalanx"); index = ITEM_INDEX(it); if (!ent->client->pers.inventory[index]) { gi.cprintf(ent, PRINT_HIGH, "Out of item: %s\n", s); return; } } else { gi.cprintf(ent, PRINT_HIGH, "Out of item: %s\n", s); return; } } it->drop(ent, it); } void Cmd_Score_f(edict_t *ent) { if (!ent) { return; } ent->client->showinventory = false; ent->client->showhelp = false; if (!deathmatch->value && !coop->value) { return; } if (ent->client->showscores) { ent->client->showscores = false; return; } ent->client->showscores = true; DeathmatchScoreboardMessage(ent, ent->enemy); gi.unicast(ent, true); } void Cmd_Help_f(edict_t *ent) { if (!ent) { return; } /* this is for backwards compatability */ if (deathmatch->value) { Cmd_Score_f(ent); return; } ent->client->showinventory = false; ent->client->showscores = false; if (ent->client->showhelp) { ent->client->showhelp = false; return; } ent->client->showhelp = true; ent->client->pers.helpchanged = 0; HelpComputerMessage(ent); gi.unicast(ent, true); } void Cmd_Inven_f(edict_t *ent) { gclient_t *cl; if (!ent) { return; } cl = ent->client; cl->showscores = false; cl->showhelp = false; if (cl->showinventory) { cl->showinventory = false; return; } cl->showinventory = true; InventoryMessage(ent); gi.unicast(ent, true); } void Cmd_InvUse_f(edict_t *ent) { gitem_t *it; if (!ent) { return; } ValidateSelectedItem(ent); if (ent->client->pers.selected_item == -1) { gi.cprintf(ent, PRINT_HIGH, "No item to use.\n"); return; } it = &itemlist[ent->client->pers.selected_item]; if (!it->use) { gi.cprintf(ent, PRINT_HIGH, "Item is not usable.\n"); return; } it->use(ent, it); } void Cmd_WeapPrev_f(edict_t *ent) { gclient_t *cl; int i, index; gitem_t *it; int selected_weapon; if (!ent) { return; } cl = ent->client; if (g_quick_weap->value && cl->newweapon) { it = cl->newweapon; } else if (cl->pers.weapon) { it = cl->pers.weapon; } else { return; } selected_weapon = ITEM_INDEX(it); /* scan for the next valid one */ for (i = 1; i <= MAX_ITEMS; i++) { index = (selected_weapon + MAX_ITEMS - i) % MAX_ITEMS; if (!cl->pers.inventory[index]) { continue; } it = &itemlist[index]; if (!it->use || !(it->flags & IT_WEAPON)) { continue; } it->use(ent, it); if (cl->newweapon == it) { if (g_quick_weap->value) { cl->ps.stats[STAT_PICKUP_ICON] = gi.imageindex(cl->newweapon->icon); cl->ps.stats[STAT_PICKUP_STRING] = CS_ITEMS + ITEM_INDEX(cl->newweapon); cl->pickup_msg_time = level.time + 0.9f; } return; } } } void Cmd_WeapNext_f(edict_t *ent) { gclient_t *cl; int i, index; gitem_t *it; int selected_weapon; if (!ent) { return; } cl = ent->client; if (g_quick_weap->value && cl->newweapon) { it = cl->newweapon; } else if (cl->pers.weapon) { it = cl->pers.weapon; } else { return; } selected_weapon = ITEM_INDEX(it); /* scan for the next valid one */ for (i = 1; i <= MAX_ITEMS; i++) { index = (selected_weapon + i) % MAX_ITEMS; if (!cl->pers.inventory[index]) { continue; } it = &itemlist[index]; if (!it->use || !(it->flags & IT_WEAPON)) { continue; } it->use(ent, it); if (cl->newweapon == it) { if (g_quick_weap->value) { cl->ps.stats[STAT_PICKUP_ICON] = gi.imageindex(cl->newweapon->icon); cl->ps.stats[STAT_PICKUP_STRING] = CS_ITEMS + ITEM_INDEX(cl->newweapon); cl->pickup_msg_time = level.time + 0.9f; } return; } } } void Cmd_WeapLast_f(edict_t *ent) { gclient_t *cl; int index; gitem_t *it; if (!ent) { return; } cl = ent->client; if (!cl->pers.weapon || !cl->pers.lastweapon) { return; } index = ITEM_INDEX(cl->pers.lastweapon); if (!cl->pers.inventory[index]) { return; } it = &itemlist[index]; if (!it->use) { return; } if (!(it->flags & IT_WEAPON)) { return; } it->use(ent, it); } void Cmd_InvDrop_f(edict_t *ent) { gitem_t *it; if (!ent) { return; } ValidateSelectedItem(ent); if (ent->client->pers.selected_item == -1) { gi.cprintf(ent, PRINT_HIGH, "No item to drop.\n"); return; } it = &itemlist[ent->client->pers.selected_item]; if (!it->drop) { gi.cprintf(ent, PRINT_HIGH, "Item is not dropable.\n"); return; } it->drop(ent, it); } void Cmd_Kill_f(edict_t *ent) { if (!ent) { return; } if (((level.time - ent->client->respawn_time) < 5) || (ent->client->resp.spectator)) { return; } ent->flags &= ~FL_GODMODE; ent->health = 0; meansOfDeath = MOD_SUICIDE; player_die(ent, ent, ent, 100000, vec3_origin); } void Cmd_PutAway_f(edict_t *ent) { if (!ent) { return; } ent->client->showscores = false; ent->client->showhelp = false; ent->client->showinventory = false; } int PlayerSort(void const *a, void const *b) { int anum, bnum; if (!a || !b) { return 0; } anum = *(int *)a; bnum = *(int *)b; anum = game.clients[anum].ps.stats[STAT_FRAGS]; bnum = game.clients[bnum].ps.stats[STAT_FRAGS]; if (anum < bnum) { return -1; } if (anum > bnum) { return 1; } return 0; } void Cmd_Players_f(edict_t *ent) { int i; int count; char small[64]; char large[1280]; int index[256]; if (!ent) { return; } count = 0; for (i = 0; i < maxclients->value; i++) { if (game.clients[i].pers.connected) { index[count] = i; count++; } } /* sort by frags */ qsort(index, count, sizeof(index[0]), PlayerSort); /* print information */ large[0] = 0; for (i = 0; i < count; i++) { Com_sprintf(small, sizeof(small), "%3i %s\n", game.clients[index[i]].ps.stats[STAT_FRAGS], game.clients[index[i]].pers.netname); if (strlen(small) + strlen(large) > sizeof(large) - 100) { /* can't print all of them in one packet */ strcat(large, "...\n"); break; } strcat(large, small); } gi.cprintf(ent, PRINT_HIGH, "%s\n%i players\n", large, count); } void Cmd_Wave_f(edict_t *ent) { int i; if (!ent) { return; } i = atoi(gi.argv(1)); /* can't wave when ducked */ if (ent->client->ps.pmove.pm_flags & PMF_DUCKED) { return; } if (ent->client->anim_priority > ANIM_WAVE) { return; } ent->client->anim_priority = ANIM_WAVE; switch (i) { case 0: gi.cprintf(ent, PRINT_HIGH, "flipoff\n"); ent->s.frame = FRAME_flip01 - 1; ent->client->anim_end = FRAME_flip12; break; case 1: gi.cprintf(ent, PRINT_HIGH, "salute\n"); ent->s.frame = FRAME_salute01 - 1; ent->client->anim_end = FRAME_salute11; break; case 2: gi.cprintf(ent, PRINT_HIGH, "taunt\n"); ent->s.frame = FRAME_taunt01 - 1; ent->client->anim_end = FRAME_taunt17; break; case 3: gi.cprintf(ent, PRINT_HIGH, "wave\n"); ent->s.frame = FRAME_wave01 - 1; ent->client->anim_end = FRAME_wave11; break; case 4: default: gi.cprintf(ent, PRINT_HIGH, "point\n"); ent->s.frame = FRAME_point01 - 1; ent->client->anim_end = FRAME_point12; break; } } static qboolean flooded(edict_t *ent) { gclient_t *cl; int i; int num_msgs; int mx; if (!ent) { return false; } if (!deathmatch->value && !coop->value) { return false; } num_msgs = flood_msgs->value; if (num_msgs <= 0) { return false; } cl = ent->client; mx = sizeof(cl->flood_when) / sizeof(cl->flood_when[0]); if (num_msgs > mx) { gi.dprintf("flood_msgs lowered to max: 10\n"); num_msgs = mx; gi.cvar_forceset("flood_msgs", "10"); } if (level.time < cl->flood_locktill) { gi.cprintf(ent, PRINT_HIGH, "You can't talk for %d more seconds\n", (int)(cl->flood_locktill - level.time)); return true; } i = (cl->flood_whenhead - num_msgs) + 1; if (i < 0) { i += mx; } if (cl->flood_when[i] && (level.time - cl->flood_when[i]) < flood_persecond->value) { cl->flood_locktill = level.time + flood_waitdelay->value; gi.cprintf(ent, PRINT_CHAT, "Flood protection: You can't talk for %d seconds.\n", (int)flood_waitdelay->value); return true; } cl->flood_whenhead = (cl->flood_whenhead + 1) % mx; cl->flood_when[cl->flood_whenhead] = level.time; return false; } void Cmd_Say_f(edict_t *ent, qboolean team, qboolean arg0) { int j; edict_t *other; char *p; char text[2048]; if (!ent) { return; } if ((gi.argc() < 2) && !arg0) { return; } if (flooded(ent)) { return; } if (!((int)(dmflags->value) & (DF_MODELTEAMS | DF_SKINTEAMS))) { team = false; } if (team) { Com_sprintf(text, sizeof(text), "(%s): ", ent->client->pers.netname); } else { Com_sprintf(text, sizeof(text), "%s: ", ent->client->pers.netname); } if (arg0) { strcat(text, gi.argv(0)); strcat(text, " "); strcat(text, gi.args()); } else { p = gi.args(); if (*p == '"') { p++; p[strlen(p) - 1] = 0; } strcat(text, p); } /* don't let text be too long for malicious reasons */ if (strlen(text) > 150) { text[150] = 0; } strcat(text, "\n"); if (dedicated->value) { gi.cprintf(NULL, PRINT_CHAT, "%s", text); } for (j = 1; j <= game.maxclients; j++) { other = &g_edicts[j]; if (!other->inuse) { continue; } if (!other->client) { continue; } if (team) { if (!OnSameTeam(ent, other)) { continue; } } gi.cprintf(other, PRINT_CHAT, "%s", text); } } void Cmd_PlayerList_f(edict_t *ent) { int i, text_len; char st[80]; char text[1400]; edict_t *e2; if (!ent) { return; } /* connect time, ping, score, name */ *text = '\0'; for (i = 0, e2 = g_edicts + 1; i < maxclients->value; i++, e2++) { if (!e2->inuse) { continue; } Com_sprintf(st, sizeof(st), "%02d:%02d %4d %3d %s%s\n", (level.framenum - e2->client->resp.enterframe) / 600, ((level.framenum - e2->client->resp.enterframe) % 600) / 10, e2->client->ping, e2->client->resp.score, e2->client->pers.netname, e2->client->resp.spectator ? " (spectator)" : ""); text_len = strlen(text); if ((text_len + strlen(st)) > (sizeof(text) - 50)) { snprintf(text + text_len, sizeof(text) - text_len, "And more...\n"); gi.cprintf(ent, PRINT_HIGH, "%s", text); return; } strcat(text, st); } gi.cprintf(ent, PRINT_HIGH, "%s", text); } void Cmd_Teleport_f(edict_t *ent) { if (!ent) { return; } if ((deathmatch->value || coop->value) && !sv_cheats->value) { gi.cprintf(ent, PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n"); return; } if (gi.argc() != 4) { gi.cprintf(ent, PRINT_HIGH, "Usage: teleport x y z\n"); return; } /* Unlink it to prevent unwanted interactions with other entities. This works because linkentity() uses the first available slot and the player is always at postion 0. */ gi.unlinkentity(ent); /* Set new position */ ent->s.origin[0] = atof(gi.argv(1)); ent->s.origin[1] = atof(gi.argv(2)); ent->s.origin[2] = atof(gi.argv(3)) + 10.0; /* Remove velocity and keep the entity briefly in place to give the server and clients time to catch up. */ VectorClear(ent->velocity); ent->client->ps.pmove.pm_time = 20; ent->client->ps.pmove.pm_flags |= PMF_TIME_TELEPORT; /* Remove viewangles. They'll be recalculated by the client at the next frame. */ VectorClear(ent->s.angles); VectorClear(ent->client->ps.viewangles); VectorClear(ent->client->v_angle); /* Telefrag everything that's in the target location. */ KillBox(ent); /* And link it back in. */ gi.linkentity(ent); } void Cmd_ListEntities_f(edict_t *ent) { if ((deathmatch->value || coop->value) && !sv_cheats->value) { gi.cprintf(ent, PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n"); return; } if (gi.argc() < 2) { gi.cprintf(ent, PRINT_HIGH, "Usage: listentities \n"); return; } /* What to print? */ qboolean all = false; qboolean ammo = false; qboolean items = false; qboolean keys = false; qboolean monsters = false; qboolean weapons = false; for (int i = 1; i < gi.argc(); i++) { const char *arg = gi.argv(i); if (Q_stricmp(arg, "all") == 0) { all = true; } else if (Q_stricmp(arg, "ammo") == 0) { ammo = true; } else if (Q_stricmp(arg, "items") == 0) { items = true; } else if (Q_stricmp(arg, "keys") == 0) { keys = true; } else if (Q_stricmp(arg, "monsters") == 0) { monsters = true; } else if (Q_stricmp(arg, "weapons") == 0) { weapons = true; } else { gi.cprintf(ent, PRINT_HIGH, "Usage: listentities \n"); } } /* Print what's requested. */ for (int i = 0; i < globals.num_edicts; i++) { edict_t *cur = &g_edicts[i]; qboolean print = false; /* Ensure that the entity is valid. */ if (!cur->classname) { continue; } if (all) { print = true; } else { if (ammo) { if (strncmp(cur->classname, "ammo_", 5) == 0) { print = true; } } if (items) { if (strncmp(cur->classname, "item_", 5) == 0) { print = true; } } if (keys) { if (strncmp(cur->classname, "key_", 4) == 0) { print = true; } } if (monsters) { if (strncmp(cur->classname, "monster_", 8) == 0) { print = true; } } if (weapons) { if (strncmp(cur->classname, "weapon_", 7) == 0) { print = true; } } } if (print) { /* We use dprintf() because cprintf() may flood the server... */ gi.dprintf("%s: %f %f %f\n", cur->classname, cur->s.origin[0], cur->s.origin[1], cur->s.origin[2]); } } } static int get_ammo_usage(gitem_t *weap) { if (!weap) { return 0; } /* handles grenades and tesla which only use 1 ammo per shot */ /* have to check this because they don't store their ammo usage in weap->quantity */ if (weap->flags & IT_AMMO) { return 1; } /* weapons store their ammo usage in the quantity field */ return weap->quantity; } static gitem_t * cycle_weapon(edict_t *ent) { gclient_t *cl; gitem_t *noammo_fallback; gitem_t *noweap_fallback; gitem_t *weap; gitem_t *ammo; int i; int start; int num_weaps; const char *weapname = NULL; if (!ent) { return NULL; } cl = ent->client; if (!cl) { return NULL; } num_weaps = gi.argc(); /* find where we want to start the search for the next eligible weapon */ if (cl->newweapon) { weapname = cl->newweapon->classname; } else if (cl->pers.weapon) { weapname = cl->pers.weapon->classname; } if (weapname) { for (i = 1; i < num_weaps; i++) { if (Q_stricmp(weapname, gi.argv(i)) == 0) { break; } } i++; if (i >= num_weaps) { i = 1; } } else { i = 1; } start = i; noammo_fallback = NULL; noweap_fallback = NULL; /* find the first eligible weapon in the list we can switch to */ do { weap = FindItemByClassname(gi.argv(i)); if (weap && weap != cl->pers.weapon && (weap->flags & IT_WEAPON) && weap->use) { if (cl->pers.inventory[ITEM_INDEX(weap)] > 0) { if (weap->ammo) { ammo = FindItem(weap->ammo); if (ammo) { if (cl->pers.inventory[ITEM_INDEX(ammo)] >= get_ammo_usage(weap)) { return weap; } if (!noammo_fallback) { noammo_fallback = weap; } } } else { return weap; } } else if (!noweap_fallback) { noweap_fallback = weap; } } i++; if (i >= num_weaps) { i = 1; } } while (i != start); /* if no weapon was found, the fallbacks will be used for printing the appropriate error message to the console */ if (noammo_fallback) { return noammo_fallback; } return noweap_fallback; } void Cmd_CycleWeap_f(edict_t *ent) { gitem_t *weap; gclient_t *cl; int num_weaps; if (!ent) { return; } num_weaps = gi.argc(); if (num_weaps <= 1) { gi.cprintf(ent, PRINT_HIGH, "Usage: cycleweap classname1 classname2 .. classnameN\n"); return; } weap = cycle_weapon(ent); if (!weap) return; cl = ent->client; if (cl->pers.inventory[ITEM_INDEX(weap)] <= 0) { gi.cprintf(ent, PRINT_HIGH, "Out of item: %s\n", weap->pickup_name); return; } weap->use(ent, weap); if (num_weaps > 3 && cl->newweapon == weap) { cl->ps.stats[STAT_PICKUP_ICON] = gi.imageindex(weap->icon); cl->ps.stats[STAT_PICKUP_STRING] = CS_ITEMS + ITEM_INDEX(weap); cl->pickup_msg_time = level.time + 0.7f; } } static gitem_t * preferred_weapon(edict_t *ent) { gclient_t *cl; gitem_t *noammo_fallback; gitem_t *noweap_fallback; gitem_t *weap; gitem_t *ammo; int i; int num_weaps; if (!ent) { return NULL; } cl = ent->client; if (!cl) { return NULL; } num_weaps = gi.argc(); noammo_fallback = NULL; noweap_fallback = NULL; /* find the first eligible weapon in the list we can switch to */ for (i = 1; i < num_weaps; i++) { weap = FindItemByClassname(gi.argv(i)); if (weap && (weap->flags & IT_WEAPON) && weap->use) { if (cl->pers.inventory[ITEM_INDEX(weap)] > 0) { if (weap->ammo) { ammo = FindItem(weap->ammo); if (ammo) { if (cl->pers.inventory[ITEM_INDEX(ammo)] >= get_ammo_usage(weap)) { return weap; } if (!noammo_fallback) { noammo_fallback = weap; } } } else { return weap; } } else if (!noweap_fallback) { noweap_fallback = weap; } } } /* if no weapon was found, the fallbacks will be used for printing the appropriate error message to the console */ if (noammo_fallback) { return noammo_fallback; } return noweap_fallback; } void Cmd_PrefWeap_f(edict_t *ent) { gitem_t *weap; if (!ent) { return; } if (gi.argc() <= 1) { gi.cprintf(ent, PRINT_HIGH, "Usage: prefweap classname1 classname2 .. classnameN\n"); return; } weap = preferred_weapon(ent); if (weap) { if (ent->client->pers.inventory[ITEM_INDEX(weap)] <= 0) { gi.cprintf(ent, PRINT_HIGH, "Out of item: %s\n", weap->pickup_name); } else { weap->use(ent, weap); } } } void ClientCommand(edict_t *ent) { char *cmd; if (!ent) { return; } if (!ent->client) { return; /* not fully in game yet */ } cmd = gi.argv(0); if (Q_stricmp(cmd, "players") == 0) { Cmd_Players_f(ent); return; } if (Q_stricmp(cmd, "say") == 0) { Cmd_Say_f(ent, false, false); return; } if (Q_stricmp(cmd, "say_team") == 0) { Cmd_Say_f(ent, true, false); return; } if (Q_stricmp(cmd, "score") == 0) { Cmd_Score_f(ent); return; } if (Q_stricmp(cmd, "help") == 0) { Cmd_Help_f(ent); return; } if (level.intermissiontime) { return; } if (Q_stricmp(cmd, "use") == 0) { Cmd_Use_f(ent); } else if (Q_stricmp(cmd, "drop") == 0) { Cmd_Drop_f(ent); } else if (Q_stricmp(cmd, "give") == 0) { Cmd_Give_f(ent); } else if (Q_stricmp(cmd, "god") == 0) { Cmd_God_f(ent); } else if (Q_stricmp(cmd, "notarget") == 0) { Cmd_Notarget_f(ent); } else if (Q_stricmp(cmd, "noclip") == 0) { Cmd_Noclip_f(ent); } else if (Q_stricmp(cmd, "inven") == 0) { Cmd_Inven_f(ent); } else if (Q_stricmp(cmd, "invnext") == 0) { SelectNextItem(ent, -1); } else if (Q_stricmp(cmd, "invprev") == 0) { SelectPrevItem(ent, -1); } else if (Q_stricmp(cmd, "invnextw") == 0) { SelectNextItem(ent, IT_WEAPON); } else if (Q_stricmp(cmd, "invprevw") == 0) { SelectPrevItem(ent, IT_WEAPON); } else if (Q_stricmp(cmd, "invnextp") == 0) { SelectNextItem(ent, IT_POWERUP); } else if (Q_stricmp(cmd, "invprevp") == 0) { SelectPrevItem(ent, IT_POWERUP); } else if (Q_stricmp(cmd, "invuse") == 0) { Cmd_InvUse_f(ent); } else if (Q_stricmp(cmd, "invdrop") == 0) { Cmd_InvDrop_f(ent); } else if (Q_stricmp(cmd, "weapprev") == 0) { Cmd_WeapPrev_f(ent); } else if (Q_stricmp(cmd, "weapnext") == 0) { Cmd_WeapNext_f(ent); } else if (Q_stricmp(cmd, "weaplast") == 0) { Cmd_WeapLast_f(ent); } else if (Q_stricmp(cmd, "kill") == 0) { Cmd_Kill_f(ent); } else if (Q_stricmp(cmd, "putaway") == 0) { Cmd_PutAway_f(ent); } else if (Q_stricmp(cmd, "wave") == 0) { Cmd_Wave_f(ent); } else if (Q_stricmp(cmd, "playerlist") == 0) { Cmd_PlayerList_f(ent); } else if (Q_stricmp(cmd, "teleport") == 0) { Cmd_Teleport_f(ent); } else if (Q_stricmp(cmd, "listentities") == 0) { Cmd_ListEntities_f(ent); } else if (Q_stricmp(cmd, "cycleweap") == 0) { Cmd_CycleWeap_f(ent); } else if (Q_stricmp(cmd, "prefweap") == 0) { Cmd_PrefWeap_f(ent); } else /* anything that doesn't match a command will be a chat */ { Cmd_Say_f(ent, false, true); } } xatrix-XATRIX_2_14/src/g_combat.c000066400000000000000000000341061477320050300166520ustar00rootroot00000000000000/* * ======================================================================= * * Combat code like damage, death and so on. * * ======================================================================= */ #include "header/local.h" /* * Returns true if the inflictor can directly damage the * target. Used for explosions and melee attacks. */ qboolean CanDamage(edict_t *targ, edict_t *inflictor) { vec3_t dest; trace_t trace; if (!targ || !inflictor) { return false; } /* bmodels need special checking because their origin is 0,0,0 */ if (targ->movetype == MOVETYPE_PUSH) { VectorAdd(targ->absmin, targ->absmax, dest); VectorScale(dest, 0.5, dest); trace = gi.trace(inflictor->s.origin, vec3_origin, vec3_origin, dest, inflictor, MASK_SOLID); if (trace.fraction == 1.0) { return true; } if (trace.ent == targ) { return true; } return false; } trace = gi.trace(inflictor->s.origin, vec3_origin, vec3_origin, targ->s.origin, inflictor, MASK_SOLID); if (trace.fraction == 1.0) { return true; } VectorCopy(targ->s.origin, dest); dest[0] += 15.0; dest[1] += 15.0; trace = gi.trace(inflictor->s.origin, vec3_origin, vec3_origin, dest, inflictor, MASK_SOLID); if (trace.fraction == 1.0) { return true; } VectorCopy(targ->s.origin, dest); dest[0] += 15.0; dest[1] -= 15.0; trace = gi.trace(inflictor->s.origin, vec3_origin, vec3_origin, dest, inflictor, MASK_SOLID); if (trace.fraction == 1.0) { return true; } VectorCopy(targ->s.origin, dest); dest[0] -= 15.0; dest[1] += 15.0; trace = gi.trace(inflictor->s.origin, vec3_origin, vec3_origin, dest, inflictor, MASK_SOLID); if (trace.fraction == 1.0) { return true; } VectorCopy(targ->s.origin, dest); dest[0] -= 15.0; dest[1] -= 15.0; trace = gi.trace(inflictor->s.origin, vec3_origin, vec3_origin, dest, inflictor, MASK_SOLID); if (trace.fraction == 1.0) { return true; } return false; } void Killed(edict_t *targ, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point) { if (!targ || !inflictor || !attacker) { return; } targ->enemy = attacker; if ((targ->svflags & SVF_MONSTER) && (targ->deadflag != DEAD_DEAD)) { if (!(targ->monsterinfo.aiflags & AI_GOOD_GUY)) { level.killed_monsters++; if (coop->value && attacker->client) { attacker->client->resp.score++; } /* medics won't heal monsters that they kill themselves */ if (attacker->classname && strcmp(attacker->classname, "monster_medic") == 0) { targ->owner = attacker; } } } if ((targ->movetype == MOVETYPE_PUSH) || (targ->movetype == MOVETYPE_STOP) || (targ->movetype == MOVETYPE_NONE)) { /* doors, triggers, etc */ targ->die(targ, inflictor, attacker, damage, point); return; } if ((targ->svflags & SVF_MONSTER) && (targ->deadflag != DEAD_DEAD)) { targ->touch = NULL; monster_death_use(targ); } targ->die(targ, inflictor, attacker, damage, point); } void SpawnDamage(int type, vec3_t origin, vec3_t normal, int damage) { gi.WriteByte (svc_temp_entity); gi.WriteByte (type); gi.WritePosition (origin); gi.WriteDir (normal); gi.multicast (origin, MULTICAST_PVS); } /* * targ entity that is being damaged * inflictor entity that is causing the damage * attacker entity that caused the inflictor to damage targ * example: targ=monster, inflictor=rocket, attacker=player * * dir direction of the attack * point point at which the damage is being inflicted * normal normal vector from that point * damage amount of damage being inflicted * knockback force to be applied against targ as a result of the damage * * dflags these flags are used to control how T_Damage works * DAMAGE_RADIUS damage was indirect (from a nearby explosion) * DAMAGE_NO_ARMOR armor does not protect from this damage * DAMAGE_ENERGY damage is from an energy based weapon * DAMAGE_NO_KNOCKBACK do not affect velocity, just view angles * DAMAGE_BULLET damage is from a bullet (used for ricochets) * DAMAGE_NO_PROTECTION kills godmode, armor, everything * ============ */ int CheckPowerArmor(edict_t *ent, vec3_t point, vec3_t normal, int damage, int dflags) { gclient_t *client; int save; int power_armor_type; int index = 0; int damagePerCell; int pa_te_type; int power = 0; int power_used; if (!ent) { return 0; } if (!damage) { return 0; } index = 0; client = ent->client; if (dflags & DAMAGE_NO_ARMOR) { return 0; } if (client) { power_armor_type = PowerArmorType(ent); if (power_armor_type != POWER_ARMOR_NONE) { index = ITEM_INDEX(FindItem("Cells")); power = client->pers.inventory[index]; } } else if (ent->svflags & SVF_MONSTER) { power_armor_type = ent->monsterinfo.power_armor_type; power = ent->monsterinfo.power_armor_power; index = 0; } else { return 0; } if (power_armor_type == POWER_ARMOR_NONE) { return 0; } if (!power) { return 0; } if (power_armor_type == POWER_ARMOR_SCREEN) { vec3_t vec; float dot; vec3_t forward; /* only works if damage point is in front */ AngleVectors(ent->s.angles, forward, NULL, NULL); VectorSubtract(point, ent->s.origin, vec); VectorNormalize(vec); dot = DotProduct(vec, forward); if (dot <= 0.3) { return 0; } damagePerCell = 1; pa_te_type = TE_SCREEN_SPARKS; damage = damage / 3; } else { damagePerCell = 2; pa_te_type = TE_SHIELD_SPARKS; damage = (2 * damage) / 3; } save = power * damagePerCell; if (!save) { return 0; } if (save > damage) { save = damage; } SpawnDamage(pa_te_type, point, normal, save); ent->powerarmor_time = level.time + 0.2; power_used = save / damagePerCell; if (client) { client->pers.inventory[index] -= power_used; } else { ent->monsterinfo.power_armor_power -= power_used; } return save; } int CheckArmor(edict_t *ent, vec3_t point, vec3_t normal, int damage, int te_sparks, int dflags) { gclient_t *client; int save; int index; gitem_t *armor; if (!ent) { return 0; } if (!damage) { return 0; } client = ent->client; if (!client) { return 0; } if (dflags & DAMAGE_NO_ARMOR) { return 0; } index = ArmorIndex(ent); if (!index) { return 0; } armor = GetItemByIndex(index); if (dflags & DAMAGE_ENERGY) { save = ceil(((gitem_armor_t *)armor->info)->energy_protection * damage); } else { save = ceil(((gitem_armor_t *)armor->info)->normal_protection * damage); } if (save >= client->pers.inventory[index]) { save = client->pers.inventory[index]; } if (!save) { return 0; } client->pers.inventory[index] -= save; SpawnDamage(te_sparks, point, normal, save); return save; } void M_ReactToDamage(edict_t *targ, edict_t *attacker) { if (!targ || !attacker) { return; } if (targ->health <= 0) { return; } if (!(attacker->client) && !(attacker->svflags & SVF_MONSTER)) { return; } if ((attacker == targ) || (attacker == targ->enemy)) { return; } /* if we are a good guy monster and our attacker is a player or another good guy, do not get mad at them */ if (targ->monsterinfo.aiflags & AI_GOOD_GUY) { if (attacker->client || (attacker->monsterinfo.aiflags & AI_GOOD_GUY)) { return; } } /* if attacker is a client, get mad at them because he's good and we're not */ if (attacker->client) { targ->monsterinfo.aiflags &= ~AI_SOUND_TARGET; /* this can only happen in coop (both new and old enemies are clients) only switch if can't see the current enemy */ if (targ->enemy && targ->enemy->client) { if (visible(targ, targ->enemy)) { targ->oldenemy = attacker; return; } targ->oldenemy = targ->enemy; } targ->enemy = attacker; if (!(targ->monsterinfo.aiflags & AI_DUCKED)) { FoundTarget(targ); } return; } /* it's the same base (walk/swim/fly) type and a different classname and it's not a tank (they spray too much), get mad at them */ if (((targ->flags & (FL_FLY | FL_SWIM)) == (attacker->flags & (FL_FLY | FL_SWIM))) && (strcmp(targ->classname, attacker->classname) != 0) && (strcmp(attacker->classname, "monster_tank") != 0) && (strcmp(attacker->classname, "monster_supertank") != 0) && (strcmp(attacker->classname, "monster_makron") != 0) && (strcmp(attacker->classname, "monster_jorg") != 0)) { if (targ->enemy && targ->enemy->client) { targ->oldenemy = targ->enemy; } targ->enemy = attacker; if (!(targ->monsterinfo.aiflags & AI_DUCKED)) { FoundTarget(targ); } } /* if they *meant* to shoot us, then shoot back */ else if (attacker->enemy == targ) { if (targ->enemy && targ->enemy->client) { targ->oldenemy = targ->enemy; } targ->enemy = attacker; if (!(targ->monsterinfo.aiflags & AI_DUCKED)) { FoundTarget(targ); } } /* otherwise get mad at whoever they are mad at (help our buddy) unless it is us! */ else if (attacker->enemy) { if (targ->enemy && targ->enemy->client) { targ->oldenemy = targ->enemy; } targ->enemy = attacker->enemy; if (!(targ->monsterinfo.aiflags & AI_DUCKED)) { FoundTarget(targ); } } } static void apply_knockback(edict_t *targ, vec3_t dir, float knockback, float scale) { vec3_t kvel; float mass; if (!knockback) { return; } mass = (targ->mass < 50) ? 50.0f : (float)targ->mass; VectorNormalize2(dir, kvel); VectorScale(kvel, scale * (knockback / mass), kvel); VectorAdd(targ->velocity, kvel, targ->velocity); } void T_Damage(edict_t *targ, edict_t *inflictor, edict_t *attacker, vec3_t dir, vec3_t point, vec3_t normal, int damage, int knockback, int dflags, int mod) { gclient_t *client; int take; int save; int asave; int psave; int te_sparks; if (!targ || !inflictor || !attacker) { return; } if (!targ->takedamage) { return; } /* friendly fire avoidance. If enabled you can't hurt teammates (but you can hurt yourself) knockback still occurs */ if ((targ != attacker) && ((deathmatch->value && ((int)(dmflags->value) & (DF_MODELTEAMS | DF_SKINTEAMS))) || coop->value)) { if (OnSameTeam(targ, attacker)) { if ((int)(dmflags->value) & DF_NO_FRIENDLY_FIRE) { damage = 0; } else { mod |= MOD_FRIENDLY_FIRE; } } } meansOfDeath = mod; /* easy mode takes half damage */ if ((skill->value == SKILL_EASY) && (deathmatch->value == 0) && targ->client) { damage *= 0.5; if (!damage) { damage = 1; } } client = targ->client; if (dflags & DAMAGE_BULLET) { te_sparks = TE_BULLET_SPARKS; } else { te_sparks = TE_SPARKS; } /* bonus damage for suprising a monster */ if (!(dflags & DAMAGE_RADIUS) && (targ->svflags & SVF_MONSTER) && (attacker->client) && (!targ->enemy) && (targ->health > 0)) { damage *= 2; } if (targ->flags & FL_NO_KNOCKBACK) { knockback = 0; } /* figure momentum add */ if (!(dflags & DAMAGE_NO_KNOCKBACK) && (targ->movetype != MOVETYPE_NONE) && (targ->movetype != MOVETYPE_BOUNCE) && (targ->movetype != MOVETYPE_PUSH) && (targ->movetype != MOVETYPE_STOP)) { apply_knockback (targ, dir, knockback, ((client && attacker == targ) ? 1600.0f : 500.0f)); } take = damage; save = 0; /* check for godmode */ if ((targ->flags & FL_GODMODE) && !(dflags & DAMAGE_NO_PROTECTION)) { take = 0; save = damage; SpawnDamage(te_sparks, point, normal, save); } /* check for invincibility */ if ((client && (client->invincible_framenum > level.framenum)) && !(dflags & DAMAGE_NO_PROTECTION) && (mod != MOD_TRAP)) { if (targ->pain_debounce_time < level.time) { gi.sound(targ, CHAN_ITEM, gi.soundindex( "items/protect4.wav"), 1, ATTN_NORM, 0); targ->pain_debounce_time = level.time + 2; } take = 0; save = damage; } psave = CheckPowerArmor(targ, point, normal, take, dflags); take -= psave; asave = CheckArmor(targ, point, normal, take, te_sparks, dflags); take -= asave; /* treat cheat/powerup savings the same as armor */ asave += save; /* do the damage */ if (take) { if ((targ->svflags & SVF_MONSTER) || (client)) { if (strcmp(targ->classname, "monster_gekk") == 0) { SpawnDamage(TE_GREENBLOOD, point, normal, take); } else { SpawnDamage(TE_BLOOD, point, normal, take); } } else { SpawnDamage(te_sparks, point, normal, take); } targ->health = targ->health - take; if (targ->health <= 0) { if ((targ->svflags & SVF_MONSTER) || (client)) { targ->flags |= FL_NO_KNOCKBACK; } Killed(targ, inflictor, attacker, take, point); return; } } if (targ->svflags & SVF_MONSTER) { M_ReactToDamage(targ, attacker); if (!(targ->monsterinfo.aiflags & (AI_DUCKED|AI_IGNORE_PAIN)) && (take)) { targ->pain(targ, attacker, knockback, take); /* nightmare mode monsters don't go into pain frames often */ if (skill->value == SKILL_HARDPLUS) { targ->pain_debounce_time = level.time + 5; } } } else if (client) { if (!(targ->flags & FL_GODMODE) && (take)) { targ->pain(targ, attacker, knockback, take); } } else if (take) { if (targ->pain) { targ->pain(targ, attacker, knockback, take); } } /* add to the damage inflicted on a player this frame the total will be turned into screen blends and view angle kicks at the end of the frame */ if (client) { client->damage_parmor += psave; client->damage_armor += asave; client->damage_blood += take; client->damage_knockback += knockback; VectorCopy(point, client->damage_from); } } void T_RadiusDamage(edict_t *inflictor, edict_t *attacker, float damage, edict_t *ignore, float radius, int mod) { float points; edict_t *ent = NULL; vec3_t v; vec3_t dir; if (!inflictor || !attacker) { return; } while ((ent = findradius(ent, inflictor->s.origin, radius)) != NULL) { if (ent == ignore) { continue; } if (!ent->takedamage) { continue; } VectorAdd(ent->mins, ent->maxs, v); VectorMA(ent->s.origin, 0.5, v, v); VectorSubtract(inflictor->s.origin, v, v); points = damage - 0.5 * VectorLength(v); if (ent == attacker) { points = points * 0.5; } if (points > 0) { if (CanDamage(ent, inflictor)) { VectorSubtract(ent->s.origin, inflictor->s.origin, dir); T_Damage(ent, inflictor, attacker, dir, inflictor->s.origin, vec3_origin, (int)points, (int)points, DAMAGE_RADIUS, mod); } } } } xatrix-XATRIX_2_14/src/g_func.c000066400000000000000000001662671477320050300163560ustar00rootroot00000000000000/* * ======================================================================= * * Level functions. Platforms, buttons, dooors and so on. * * ======================================================================= */ #include "header/local.h" /* * PLATS * * movement options: * * linear * smooth start, hard stop * smooth start, smooth stop * * start * end * acceleration * speed * deceleration * begin sound * end sound * target fired when reaching end * wait at end * * object characteristics that use move segments * --------------------------------------------- * movetype_push, or movetype_stop * action when touched * action when blocked * action when used * disabled? * auto trigger spawning */ #define PLAT_LOW_TRIGGER 1 #define STATE_TOP 0 #define STATE_BOTTOM 1 #define STATE_UP 2 #define STATE_DOWN 3 #define DOOR_START_OPEN 1 #define DOOR_REVERSE 2 #define DOOR_CRUSHER 4 #define DOOR_NOMONSTER 8 #define DOOR_TOGGLE 32 #define DOOR_X_AXIS 64 #define DOOR_Y_AXIS 128 /* Support routines for movement (changes in origin using velocity) */ void Move_Done(edict_t *ent) { if (!ent) { return; } VectorClear(ent->velocity); ent->moveinfo.endfunc(ent); } void Move_Final(edict_t *ent) { if (!ent) { return; } if (ent->moveinfo.remaining_distance == 0) { Move_Done(ent); return; } VectorScale(ent->moveinfo.dir, ent->moveinfo.remaining_distance / FRAMETIME, ent->velocity); ent->think = Move_Done; ent->nextthink = level.time + FRAMETIME; } void Move_Begin(edict_t *ent) { float frames; if (!ent) { return; } if ((ent->moveinfo.speed * FRAMETIME) >= ent->moveinfo.remaining_distance) { Move_Final(ent); return; } VectorScale(ent->moveinfo.dir, ent->moveinfo.speed, ent->velocity); frames = floor((ent->moveinfo.remaining_distance / ent->moveinfo.speed) / FRAMETIME); ent->moveinfo.remaining_distance -= frames * ent->moveinfo.speed * FRAMETIME; ent->nextthink = level.time + (frames * FRAMETIME); ent->think = Move_Final; } void Think_AccelMove(edict_t *ent); void Move_Calc(edict_t *ent, vec3_t dest, void (*func)(edict_t *)) { if (!ent || !func) { return; } VectorClear(ent->velocity); VectorSubtract(dest, ent->s.origin, ent->moveinfo.dir); ent->moveinfo.remaining_distance = VectorNormalize(ent->moveinfo.dir); ent->moveinfo.endfunc = func; if ((ent->moveinfo.speed == ent->moveinfo.accel) && (ent->moveinfo.speed == ent->moveinfo.decel)) { if (level.current_entity == ((ent->flags & FL_TEAMSLAVE) ? ent->teammaster : ent)) { Move_Begin(ent); } else { ent->nextthink = level.time + FRAMETIME; ent->think = Move_Begin; } } else { /* accelerative */ ent->moveinfo.current_speed = 0; ent->think = Think_AccelMove; ent->nextthink = level.time + FRAMETIME; } } /* * Support routines for angular movement * (changes in angle using avelocity) */ void AngleMove_Done(edict_t *ent) { if (!ent) { return; } VectorClear(ent->avelocity); ent->moveinfo.endfunc(ent); } void AngleMove_Final(edict_t *ent) { vec3_t move; if (!ent) { return; } if (ent->moveinfo.state == STATE_UP) { VectorSubtract(ent->moveinfo.end_angles, ent->s.angles, move); } else { VectorSubtract(ent->moveinfo.start_angles, ent->s.angles, move); } if (VectorCompare(move, vec3_origin)) { AngleMove_Done(ent); return; } VectorScale(move, 1.0 / FRAMETIME, ent->avelocity); ent->think = AngleMove_Done; ent->nextthink = level.time + FRAMETIME; } void AngleMove_Begin(edict_t *ent) { vec3_t destdelta; float len; float traveltime; float frames; if (!ent) { return; } /* set destdelta to the vector needed to move */ if (ent->moveinfo.state == STATE_UP) { VectorSubtract(ent->moveinfo.end_angles, ent->s.angles, destdelta); } else { VectorSubtract(ent->moveinfo.start_angles, ent->s.angles, destdelta); } /* calculate length of vector */ len = VectorLength(destdelta); /* divide by speed to get time to reach dest */ traveltime = len / ent->moveinfo.speed; if (traveltime < FRAMETIME) { AngleMove_Final(ent); return; } frames = floor(traveltime / FRAMETIME); /* scale the destdelta vector by the time spent traveling to get velocity */ VectorScale(destdelta, 1.0 / traveltime, ent->avelocity); /* set nextthink to trigger a think when dest is reached */ ent->nextthink = level.time + frames * FRAMETIME; ent->think = AngleMove_Final; } void AngleMove_Calc(edict_t *ent, void (*func)(edict_t *)) { if (!ent || !func) { return; } VectorClear(ent->avelocity); ent->moveinfo.endfunc = func; if (level.current_entity == ((ent->flags & FL_TEAMSLAVE) ? ent->teammaster : ent)) { AngleMove_Begin(ent); } else { ent->nextthink = level.time + FRAMETIME; ent->think = AngleMove_Begin; } } /* * The team has completed a frame of movement, so * change the speed for the next frame */ #define AccelerationDistance(target, rate) (target * ((target / rate) + 1) / 2) void plat_CalcAcceleratedMove(moveinfo_t *moveinfo) { float accel_dist; float decel_dist; if (!moveinfo) { return; } moveinfo->move_speed = moveinfo->speed; if (moveinfo->remaining_distance < moveinfo->accel) { moveinfo->current_speed = moveinfo->remaining_distance; return; } accel_dist = AccelerationDistance(moveinfo->speed, moveinfo->accel); decel_dist = AccelerationDistance(moveinfo->speed, moveinfo->decel); if ((moveinfo->remaining_distance - accel_dist - decel_dist) < 0) { float f; f = (moveinfo->accel + moveinfo->decel) / (moveinfo->accel * moveinfo->decel); moveinfo->move_speed = (-2 + sqrt(4 - 4 * f * (-2 * moveinfo->remaining_distance))) / (2 * f); decel_dist = AccelerationDistance(moveinfo->move_speed, moveinfo->decel); } moveinfo->decel_distance = decel_dist; } void plat_Accelerate(moveinfo_t *moveinfo) { if (!moveinfo) { return; } /* are we decelerating? */ if (moveinfo->remaining_distance <= moveinfo->decel_distance) { if (moveinfo->remaining_distance < moveinfo->decel_distance) { if (moveinfo->next_speed) { moveinfo->current_speed = moveinfo->next_speed; moveinfo->next_speed = 0; return; } if (moveinfo->current_speed > moveinfo->decel) { moveinfo->current_speed -= moveinfo->decel; } } return; } /* are we at full speed and need to start decelerating during this move? */ if (moveinfo->current_speed == moveinfo->move_speed) { if ((moveinfo->remaining_distance - moveinfo->current_speed) < moveinfo->decel_distance) { float p1_distance; float p2_distance; float distance; p1_distance = moveinfo->remaining_distance - moveinfo->decel_distance; p2_distance = moveinfo->move_speed * (1.0 - (p1_distance / moveinfo->move_speed)); distance = p1_distance + p2_distance; moveinfo->current_speed = moveinfo->move_speed; moveinfo->next_speed = moveinfo->move_speed - moveinfo->decel * (p2_distance / distance); return; } } /* are we accelerating? */ if (moveinfo->current_speed < moveinfo->speed) { float old_speed; float p1_distance; float p1_speed; float p2_distance; float distance; old_speed = moveinfo->current_speed; /* figure simple acceleration up to move_speed */ moveinfo->current_speed += moveinfo->accel; if (moveinfo->current_speed > moveinfo->speed) { moveinfo->current_speed = moveinfo->speed; } /* are we accelerating throughout this entire move? */ if ((moveinfo->remaining_distance - moveinfo->current_speed) >= moveinfo->decel_distance) { return; } /* during this move we will accelrate from current_speed to move_speed and cross over the decel_distance; figure the average speed for the entire move */ p1_distance = moveinfo->remaining_distance - moveinfo->decel_distance; p1_speed = (old_speed + moveinfo->move_speed) / 2.0; p2_distance = moveinfo->move_speed * (1.0 - (p1_distance / p1_speed)); distance = p1_distance + p2_distance; moveinfo->current_speed = (p1_speed * (p1_distance / distance)) + (moveinfo->move_speed * (p2_distance / distance)); moveinfo->next_speed = moveinfo->move_speed - moveinfo->decel * (p2_distance / distance); return; } /* we are at constant velocity (move_speed) */ return; } /* * The team has completed a frame of movement, * so change the speed for the next frame */ void Think_AccelMove(edict_t *ent) { if (!ent) { return; } ent->moveinfo.remaining_distance -= ent->moveinfo.current_speed; if (ent->moveinfo.current_speed == 0) /* starting or blocked */ { plat_CalcAcceleratedMove(&ent->moveinfo); } plat_Accelerate(&ent->moveinfo); /* will the entire move complete on next frame? */ if (ent->moveinfo.remaining_distance <= ent->moveinfo.current_speed) { Move_Final(ent); return; } VectorScale(ent->moveinfo.dir, ent->moveinfo.current_speed * 10, ent->velocity); ent->nextthink = level.time + FRAMETIME; ent->think = Think_AccelMove; } void plat_go_down(edict_t *ent); void plat_hit_top(edict_t *ent) { if (!ent) { return; } if (!(ent->flags & FL_TEAMSLAVE)) { if (ent->moveinfo.sound_end) { gi.sound(ent, CHAN_NO_PHS_ADD + CHAN_VOICE, ent->moveinfo.sound_end, 1, ATTN_STATIC, 0); } ent->s.sound = 0; } ent->moveinfo.state = STATE_TOP; ent->think = plat_go_down; ent->nextthink = level.time + 3; } void plat_hit_bottom(edict_t *ent) { if (!ent) { return; } if (!(ent->flags & FL_TEAMSLAVE)) { if (ent->moveinfo.sound_end) { gi.sound(ent, CHAN_NO_PHS_ADD + CHAN_VOICE, ent->moveinfo.sound_end, 1, ATTN_STATIC, 0); } ent->s.sound = 0; } ent->moveinfo.state = STATE_BOTTOM; } void plat_go_down(edict_t *ent) { if (!ent) { return; } if (!(ent->flags & FL_TEAMSLAVE)) { if (ent->moveinfo.sound_start) { gi.sound(ent, CHAN_NO_PHS_ADD + CHAN_VOICE, ent->moveinfo.sound_start, 1, ATTN_STATIC, 0); } ent->s.sound = ent->moveinfo.sound_middle; } ent->moveinfo.state = STATE_DOWN; Move_Calc(ent, ent->moveinfo.end_origin, plat_hit_bottom); } void plat_go_up(edict_t *ent) { if (!ent) { return; } if (!(ent->flags & FL_TEAMSLAVE)) { if (ent->moveinfo.sound_start) { gi.sound(ent, CHAN_NO_PHS_ADD + CHAN_VOICE, ent->moveinfo.sound_start, 1, ATTN_STATIC, 0); } ent->s.sound = ent->moveinfo.sound_middle; } ent->moveinfo.state = STATE_UP; Move_Calc(ent, ent->moveinfo.start_origin, plat_hit_top); } void plat_blocked(edict_t *self, edict_t *other) { if (!self || !other) { return; } if (!(other->svflags & SVF_MONSTER) && (!other->client)) { /* give it a chance to go away on it's own terms (like gibs) */ T_Damage(other, self, self, vec3_origin, other->s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH); /* if it's still there, nuke it */ if (other->inuse) { /* Hack for entity without it's origin near the model */ VectorMA (other->absmin, 0.5, other->size, other->s.origin); BecomeExplosion1(other); } return; } T_Damage(other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg, 1, 0, MOD_CRUSH); if (self->moveinfo.state == STATE_UP) { plat_go_down(self); } else if (self->moveinfo.state == STATE_DOWN) { plat_go_up(self); } } void Use_Plat(edict_t *ent, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!ent) { return; } if (ent->think) { return; /* already down */ } plat_go_down(ent); } void wait_and_change_think(edict_t* ent) { void (*afterwaitfunc)(edict_t *) = ent->moveinfo.endfunc; ent->moveinfo.endfunc = NULL; afterwaitfunc(ent); } /* * In coop mode, this waits for coop_elevator_delay seconds * before calling afterwaitfunc(ent); otherwise it just calls * afterwaitfunc(ent); */ static void wait_and_change(edict_t* ent, void (*afterwaitfunc)(edict_t *)) { float waittime = coop_elevator_delay->value; if (coop->value && waittime > 0.0f) { if(ent->nextthink == 0) { ent->moveinfo.endfunc = afterwaitfunc; ent->think = wait_and_change_think; ent->nextthink = level.time + waittime; } } else { afterwaitfunc(ent); } } void Touch_Plat_Center(edict_t *ent, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf /* unused */) { if (!ent || !other) { return; } if (!other->client) { return; } if (other->health <= 0) { return; } ent = ent->enemy; /* now point at the plat, not the trigger */ if (ent->moveinfo.state == STATE_BOTTOM) { wait_and_change(ent, plat_go_up); } else if (ent->moveinfo.state == STATE_TOP) { ent->nextthink = level.time + 1; /* the player is still on the plat, so delay going down */ } } void plat_spawn_inside_trigger(edict_t *ent) { if (!ent) { return; } edict_t *trigger; vec3_t tmin, tmax; /* middle trigger */ trigger = G_Spawn(); trigger->touch = Touch_Plat_Center; trigger->movetype = MOVETYPE_NONE; trigger->solid = SOLID_TRIGGER; trigger->enemy = ent; tmin[0] = ent->mins[0] + 25; tmin[1] = ent->mins[1] + 25; tmax[0] = ent->maxs[0] - 25; tmax[1] = ent->maxs[1] - 25; tmax[2] = ent->maxs[2] + 8; tmin[2] = tmax[2] - (ent->pos1[2] - ent->pos2[2] + st.lip); if (ent->spawnflags & PLAT_LOW_TRIGGER) { tmax[2] = tmin[2] + 8; } if (tmax[0] - tmin[0] <= 0) { tmin[0] = (ent->mins[0] + ent->maxs[0]) * 0.5; tmax[0] = tmin[0] + 1; } if (tmax[1] - tmin[1] <= 0) { tmin[1] = (ent->mins[1] + ent->maxs[1]) * 0.5; tmax[1] = tmin[1] + 1; } VectorCopy(tmin, trigger->mins); VectorCopy(tmax, trigger->maxs); gi.linkentity(trigger); } /* * QUAKED func_plat (0 .5 .8) ? PLAT_LOW_TRIGGER * * speed -> default 150 * * Plats are always drawn in the extended position, * so they will light correctly. * * If the plat is the target of another trigger or button, * it will start out disabled in the extended position until * it is trigger, when it will lower and become a normal plat. * * "speed" overrides default 200. * "accel" overrides default 500 * "lip" overrides default 8 pixel lip * * If the "height" key is set, that will determine the amount * the plat moves, instead of being implicitly determoveinfoned * by the model's height. * * Set "sounds" to one of the following: * 1) base fast * 2) chain slow */ void SP_func_plat(edict_t *ent) { if (!ent) { return; } VectorClear(ent->s.angles); ent->solid = SOLID_BSP; ent->movetype = MOVETYPE_PUSH; gi.setmodel(ent, ent->model); ent->blocked = plat_blocked; if (!ent->speed) { ent->speed = 20; } else { ent->speed *= 0.1; } if (!ent->accel) { ent->accel = 5; } else { ent->accel *= 0.1; } if (!ent->decel) { ent->decel = 5; } else { ent->decel *= 0.1; } if (!ent->dmg) { ent->dmg = 2; } if (!st.lip) { st.lip = 8; } /* pos1 is the top position, pos2 is the bottom */ VectorCopy(ent->s.origin, ent->pos1); VectorCopy(ent->s.origin, ent->pos2); if (st.height) { ent->pos2[2] -= st.height; } else { ent->pos2[2] -= (ent->maxs[2] - ent->mins[2]) - st.lip; } ent->use = Use_Plat; plat_spawn_inside_trigger(ent); /* the "start moving" trigger */ if (ent->targetname) { ent->moveinfo.state = STATE_UP; } else { VectorCopy(ent->pos2, ent->s.origin); gi.linkentity(ent); ent->moveinfo.state = STATE_BOTTOM; } ent->moveinfo.speed = ent->speed; ent->moveinfo.accel = ent->accel; ent->moveinfo.decel = ent->decel; ent->moveinfo.wait = ent->wait; VectorCopy(ent->pos1, ent->moveinfo.start_origin); VectorCopy(ent->s.angles, ent->moveinfo.start_angles); VectorCopy(ent->pos2, ent->moveinfo.end_origin); VectorCopy(ent->s.angles, ent->moveinfo.end_angles); ent->moveinfo.sound_start = gi.soundindex("plats/pt1_strt.wav"); ent->moveinfo.sound_middle = gi.soundindex("plats/pt1_mid.wav"); ent->moveinfo.sound_end = gi.soundindex("plats/pt1_end.wav"); } /* ==================================================================== */ /* * QUAKED func_rotating (0 .5 .8) ? START_ON REVERSE X_AXIS Y_AXIS * TOUCH_PAIN STOP ANIMATED ANIMATED_FAST * * You need to have an origin brush as part of this entity. * The center of that brush will be the point around which it * is rotated. It will rotate around the Z axis by default. * You can check either the X_AXIS or Y_AXIS box to change that. * * "speed" determines how fast it moves; default value is 100. * "dmg" damage to inflict when blocked (2 default) * * REVERSE will cause the it to rotate in the opposite direction. * STOP mean it will stop moving instead of pushing entities */ void rotating_blocked(edict_t *self, edict_t *other) { if (!self || !other) { return; } T_Damage(other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg, 1, 0, MOD_CRUSH); } void rotating_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf /* unused */) { if (!self || !other) { return; } if (self->avelocity[0] || self->avelocity[1] || self->avelocity[2]) { T_Damage(other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg, 1, 0, MOD_CRUSH); } } void rotating_use(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!self) { return; } if (!VectorCompare(self->avelocity, vec3_origin)) { self->s.sound = 0; VectorClear(self->avelocity); self->touch = NULL; } else { self->s.sound = self->moveinfo.sound_middle; VectorScale(self->movedir, self->speed, self->avelocity); if (self->spawnflags & 16) { self->touch = rotating_touch; } } } void SP_func_rotating(edict_t *ent) { if (!ent) { return; } ent->solid = SOLID_BSP; if (ent->spawnflags & 32) { ent->movetype = MOVETYPE_STOP; } else { ent->movetype = MOVETYPE_PUSH; } /* set the axis of rotation */ VectorClear(ent->movedir); if (ent->spawnflags & 4) { ent->movedir[2] = 1.0; } else if (ent->spawnflags & 8) { ent->movedir[0] = 1.0; } else { ent->movedir[1] = 1.0; } /* check for reverse rotation */ if (ent->spawnflags & 2) { VectorNegate(ent->movedir, ent->movedir); } if (!ent->speed) { ent->speed = 100; } if (!ent->dmg) { ent->dmg = 2; } ent->use = rotating_use; ent->blocked = rotating_blocked; if (ent->spawnflags & 1) { ent->use(ent, NULL, NULL); } if (ent->spawnflags & 64) { ent->s.effects |= EF_ANIM_ALL; } if (ent->spawnflags & 128) { ent->s.effects |= EF_ANIM_ALLFAST; } gi.setmodel(ent, ent->model); gi.linkentity(ent); } /* ==================================================================== */ /* BUTTONS */ /* * QUAKED func_button (0 .5 .8) ? * * When a button is touched, it moves some distance * in the direction of it's angle, triggers all of it's * targets, waits some time, then returns to it's original * position where it can be triggered again. * * "angle" determines the opening direction * "target" all entities with a matching targetname will be used * "speed" override the default 40 speed * "wait" override the default 1 second wait (-1 = never return) * "lip" override the default 4 pixel lip remaining at end of move * "health" if set, the button must be killed instead of touched * "sounds" * 1) silent * 2) steam metal * 3) wooden clunk * 4) metallic click * 5) in-out */ void button_done(edict_t *self) { if (!self) { return; } self->moveinfo.state = STATE_BOTTOM; self->s.effects &= ~EF_ANIM23; self->s.effects |= EF_ANIM01; } void button_return(edict_t *self) { if (!self) { return; } self->moveinfo.state = STATE_DOWN; Move_Calc(self, self->moveinfo.start_origin, button_done); self->s.frame = 0; if (self->health) { self->takedamage = DAMAGE_YES; } } void button_wait(edict_t *self) { if (!self) { return; } self->moveinfo.state = STATE_TOP; self->s.effects &= ~EF_ANIM01; self->s.effects |= EF_ANIM23; G_UseTargets(self, self->activator); self->s.frame = 1; if (self->moveinfo.wait >= 0) { self->nextthink = level.time + self->moveinfo.wait; self->think = button_return; } } void button_fire(edict_t *self) { if (!self) { return; } if ((self->moveinfo.state == STATE_UP) || (self->moveinfo.state == STATE_TOP)) { return; } self->moveinfo.state = STATE_UP; if (self->moveinfo.sound_start && !(self->flags & FL_TEAMSLAVE)) { gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_STATIC, 0); } Move_Calc(self, self->moveinfo.end_origin, button_wait); } void button_use(edict_t *self, edict_t *other /* unused */, edict_t *activator) { if (!self ||!activator) { return; } self->activator = activator; button_fire(self); } void button_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf /* unused */) { if (!self || !other) { return; } if (!other->client) { return; } if (other->health <= 0) { return; } self->activator = other; button_fire(self); } void button_killed(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unsued */, int damage /* unused */, vec3_t point /* unused */) { if (!self) { return; } self->activator = attacker; self->health = self->max_health; self->takedamage = DAMAGE_NO; button_fire(self); } void SP_func_button(edict_t *ent) { vec3_t abs_movedir; float dist; if (!ent) { return; } G_SetMovedir(ent->s.angles, ent->movedir); ent->movetype = MOVETYPE_STOP; ent->solid = SOLID_BSP; gi.setmodel(ent, ent->model); if (ent->sounds != 1) { ent->moveinfo.sound_start = gi.soundindex("switches/butn2.wav"); } if (!ent->speed) { ent->speed = 40; } if (!ent->accel) { ent->accel = ent->speed; } if (!ent->decel) { ent->decel = ent->speed; } if (!ent->wait) { ent->wait = 3; } if (!st.lip) { st.lip = 4; } VectorCopy(ent->s.origin, ent->pos1); abs_movedir[0] = fabs(ent->movedir[0]); abs_movedir[1] = fabs(ent->movedir[1]); abs_movedir[2] = fabs(ent->movedir[2]); dist = abs_movedir[0] * ent->size[0] + abs_movedir[1] * ent->size[1] + abs_movedir[2] * ent->size[2] - st.lip; VectorMA(ent->pos1, dist, ent->movedir, ent->pos2); ent->use = button_use; ent->s.effects |= EF_ANIM01; if (ent->health) { ent->max_health = ent->health; ent->die = button_killed; ent->takedamage = DAMAGE_YES; } else if (!ent->targetname) { ent->touch = button_touch; } ent->moveinfo.state = STATE_BOTTOM; ent->moveinfo.speed = ent->speed; ent->moveinfo.accel = ent->accel; ent->moveinfo.decel = ent->decel; ent->moveinfo.wait = ent->wait; VectorCopy(ent->pos1, ent->moveinfo.start_origin); VectorCopy(ent->s.angles, ent->moveinfo.start_angles); VectorCopy(ent->pos2, ent->moveinfo.end_origin); VectorCopy(ent->s.angles, ent->moveinfo.end_angles); gi.linkentity(ent); } /* ==================================================================== */ /* * DOORS * * spawn a trigger surrounding the entire team * unless it is already targeted by another */ void door_go_down(edict_t *self); /* * QUAKED func_door (0 .5 .8) ? START_OPEN x CRUSHER NOMONSTER ANIMATED TOGGLE ANIMATED_FAST * * TOGGLE wait in both the start and end states for a trigger event. * START_OPEN the door to moves to its destination when spawned, and operate in reverse. * It is used to temporarily or permanently close off an area when triggered * (not useful for touch or takedamage doors). * NOMONSTER monsters will not trigger this door * * "message" is printed when the door is touched if it is a trigger door and it hasn't been fired yet * "angle" determines the opening direction * "targetname" if set, no touch field will be spawned and a remote button or trigger field activates the door. * "health" if set, door must be shot open * "speed" movement speed (100 default) * "wait" wait before returning (3 default, -1 = never return) * "lip" lip remaining at end of move (8 default) * "dmg" damage to inflict when blocked (2 default) * "sounds" * 1) silent * 2) light * 3) medium * 4) heavy */ void door_use_areaportals(edict_t *self, qboolean open) { edict_t *t = NULL; if (!self) { return; } if (!self->target) { return; } while ((t = G_Find(t, FOFS(targetname), self->target))) { if (Q_stricmp(t->classname, "func_areaportal") == 0) { gi.SetAreaPortalState(t->style, open); } } } void door_hit_top(edict_t *self) { if (!self) { return; } if (!(self->flags & FL_TEAMSLAVE)) { if (self->moveinfo.sound_end) { gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_end, 1, ATTN_STATIC, 0); } self->s.sound = 0; } self->moveinfo.state = STATE_TOP; if (self->spawnflags & DOOR_TOGGLE) { return; } if (self->moveinfo.wait >= 0) { self->think = door_go_down; self->nextthink = level.time + self->moveinfo.wait; } } void door_hit_bottom(edict_t *self) { if (!self) { return; } if (!(self->flags & FL_TEAMSLAVE)) { if (self->moveinfo.sound_end) { gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_end, 1, ATTN_STATIC, 0); } self->s.sound = 0; } self->moveinfo.state = STATE_BOTTOM; door_use_areaportals(self, false); } void door_go_down(edict_t *self) { if (!self) { return; } if (!(self->flags & FL_TEAMSLAVE)) { if (self->moveinfo.sound_start) { gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_STATIC, 0); } self->s.sound = self->moveinfo.sound_middle; } if (self->max_health) { self->takedamage = DAMAGE_YES; self->health = self->max_health; } self->moveinfo.state = STATE_DOWN; if (strcmp(self->classname, "func_door") == 0) { Move_Calc(self, self->moveinfo.start_origin, door_hit_bottom); } else if (strcmp(self->classname, "func_door_rotating") == 0) { AngleMove_Calc(self, door_hit_bottom); } } void door_go_up(edict_t *self, edict_t *activator) { if (!self) { return; } if (self->moveinfo.state == STATE_UP) { return; /* already going up */ } if (self->moveinfo.state == STATE_TOP) { /* reset top wait time */ if (self->moveinfo.wait >= 0) { self->nextthink = level.time + self->moveinfo.wait; } return; } if (!(self->flags & FL_TEAMSLAVE)) { if (self->moveinfo.sound_start) { gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_STATIC, 0); } self->s.sound = self->moveinfo.sound_middle; } self->moveinfo.state = STATE_UP; if (strcmp(self->classname, "func_door") == 0) { Move_Calc(self, self->moveinfo.end_origin, door_hit_top); } else if (strcmp(self->classname, "func_door_rotating") == 0) { AngleMove_Calc(self, door_hit_top); } G_UseTargets(self, activator); door_use_areaportals(self, true); } void door_use(edict_t *self, edict_t *other /* unused */, edict_t *activator) { edict_t *ent; if (!self) { return; } if (self->flags & FL_TEAMSLAVE) { return; } if (self->spawnflags & DOOR_TOGGLE) { if ((self->moveinfo.state == STATE_UP) || (self->moveinfo.state == STATE_TOP)) { /* trigger all paired doors */ for (ent = self; ent; ent = ent->teamchain) { ent->message = NULL; ent->touch = NULL; door_go_down(ent); } return; } } /* trigger all paired doors */ for (ent = self; ent; ent = ent->teamchain) { ent->message = NULL; ent->touch = NULL; door_go_up(ent, activator); } } void Touch_DoorTrigger(edict_t *self, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf /* unused */) { if (!self || !other) { return; } if (other->health <= 0) { return; } if (!(other->svflags & SVF_MONSTER) && (!other->client)) { return; } if ((self->owner->spawnflags & DOOR_NOMONSTER) && (other->svflags & SVF_MONSTER)) { return; } if (level.time < self->touch_debounce_time) { return; } self->touch_debounce_time = level.time + 1.0; door_use(self->owner, other, other); } void Think_CalcMoveSpeed(edict_t *self) { edict_t *ent; float min; float time; float newspeed; float ratio; float dist; if (!self) { return; } if (self->flags & FL_TEAMSLAVE) { return; /* only the team master does this */ } /* find the smallest distance any member of the team will be moving */ min = fabs(self->moveinfo.distance); for (ent = self->teamchain; ent; ent = ent->teamchain) { dist = fabs(ent->moveinfo.distance); if (dist < min) { min = dist; } } time = min / self->moveinfo.speed; /* adjust speeds so they will all complete at the same time */ for (ent = self; ent; ent = ent->teamchain) { newspeed = fabs(ent->moveinfo.distance) / time; ratio = newspeed / ent->moveinfo.speed; if (ent->moveinfo.accel == ent->moveinfo.speed) { ent->moveinfo.accel = newspeed; } else { ent->moveinfo.accel *= ratio; } if (ent->moveinfo.decel == ent->moveinfo.speed) { ent->moveinfo.decel = newspeed; } else { ent->moveinfo.decel *= ratio; } ent->moveinfo.speed = newspeed; } } void Think_SpawnDoorTrigger(edict_t *ent) { edict_t *other; vec3_t mins, maxs; if (!ent) { return; } if (ent->flags & FL_TEAMSLAVE) { return; /* only the team leader spawns a trigger */ } VectorCopy(ent->absmin, mins); VectorCopy(ent->absmax, maxs); for (other = ent->teamchain; other; other = other->teamchain) { AddPointToBounds(other->absmin, mins, maxs); AddPointToBounds(other->absmax, mins, maxs); } /* expand */ mins[0] -= 60; mins[1] -= 60; maxs[0] += 60; maxs[1] += 60; other = G_Spawn(); VectorCopy(mins, other->mins); VectorCopy(maxs, other->maxs); other->owner = ent; other->solid = SOLID_TRIGGER; other->movetype = MOVETYPE_NONE; other->touch = Touch_DoorTrigger; gi.linkentity(other); if (ent->spawnflags & DOOR_START_OPEN) { door_use_areaportals(ent, true); } Think_CalcMoveSpeed(ent); } void door_blocked(edict_t *self, edict_t *other) { edict_t *ent; if (!self || !other) { return; } if (!(other->svflags & SVF_MONSTER) && (!other->client)) { /* give it a chance to go away on it's own terms (like gibs) */ T_Damage(other, self, self, vec3_origin, other->s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH); /* if it's still there, nuke it */ if (other->inuse) { /* Hack for entitiy without their origin near the model */ VectorMA (other->absmin, 0.5, other->size, other->s.origin); BecomeExplosion1(other); } return; } T_Damage(other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg, 1, 0, MOD_CRUSH); if (self->spawnflags & DOOR_CRUSHER) { return; } /* if a door has a negative wait, it would never come back if blocked, so let it just squash the object to death real fast */ if (self->moveinfo.wait >= 0) { if (self->moveinfo.state == STATE_DOWN) { for (ent = self->teammaster; ent; ent = ent->teamchain) { door_go_up(ent, ent->activator); } } else { for (ent = self->teammaster; ent; ent = ent->teamchain) { door_go_down(ent); } } } } void door_killed(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker, int damage /* unused */, vec3_t point /* unused */) { edict_t *ent; if (!self || !attacker) { return; } for (ent = self->teammaster; ent; ent = ent->teamchain) { ent->health = ent->max_health; ent->takedamage = DAMAGE_NO; } door_use(self->teammaster, attacker, attacker); } void door_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf /* unused */) { if (!self || !other) { return; } if (!other->client) { return; } if (level.time < self->touch_debounce_time) { return; } self->touch_debounce_time = level.time + 5.0; gi.centerprintf(other, "%s", self->message); gi.sound(other, CHAN_AUTO, gi.soundindex("misc/talk1.wav"), 1, ATTN_NORM, 0); } void SP_func_door(edict_t *ent) { vec3_t abs_movedir; if (!ent) { return; } if (ent->sounds != 1) { ent->moveinfo.sound_start = gi.soundindex("doors/dr1_strt.wav"); ent->moveinfo.sound_middle = gi.soundindex("doors/dr1_mid.wav"); ent->moveinfo.sound_end = gi.soundindex("doors/dr1_end.wav"); } G_SetMovedir(ent->s.angles, ent->movedir); ent->movetype = MOVETYPE_PUSH; ent->solid = SOLID_BSP; gi.setmodel(ent, ent->model); ent->blocked = door_blocked; ent->use = door_use; if (!ent->speed) { ent->speed = 100; } if (deathmatch->value) { ent->speed *= 2; } if (!ent->accel) { ent->accel = ent->speed; } if (!ent->decel) { ent->decel = ent->speed; } if (!ent->wait) { ent->wait = 3; } if (!st.lip) { st.lip = 8; } if (!ent->dmg) { ent->dmg = 2; } /* calculate second position */ VectorCopy(ent->s.origin, ent->pos1); abs_movedir[0] = fabs(ent->movedir[0]); abs_movedir[1] = fabs(ent->movedir[1]); abs_movedir[2] = fabs(ent->movedir[2]); ent->moveinfo.distance = abs_movedir[0] * ent->size[0] + abs_movedir[1] * ent->size[1] + abs_movedir[2] * ent->size[2] - st.lip; VectorMA(ent->pos1, ent->moveinfo.distance, ent->movedir, ent->pos2); /* if it starts open, switch the positions */ if (ent->spawnflags & DOOR_START_OPEN) { VectorCopy(ent->pos2, ent->s.origin); VectorCopy(ent->pos1, ent->pos2); VectorCopy(ent->s.origin, ent->pos1); } ent->moveinfo.state = STATE_BOTTOM; if (ent->health) { ent->takedamage = DAMAGE_YES; ent->die = door_killed; ent->max_health = ent->health; } else if (ent->targetname && ent->message) { gi.soundindex("misc/talk.wav"); ent->touch = door_touch; } ent->moveinfo.speed = ent->speed; ent->moveinfo.accel = ent->accel; ent->moveinfo.decel = ent->decel; ent->moveinfo.wait = ent->wait; VectorCopy(ent->pos1, ent->moveinfo.start_origin); VectorCopy(ent->s.angles, ent->moveinfo.start_angles); VectorCopy(ent->pos2, ent->moveinfo.end_origin); VectorCopy(ent->s.angles, ent->moveinfo.end_angles); if (ent->spawnflags & 16) { ent->s.effects |= EF_ANIM_ALL; } if (ent->spawnflags & 64) { ent->s.effects |= EF_ANIM_ALLFAST; } /* to simplify logic elsewhere, make non-teamed doors into a team of one */ if (!ent->team) { ent->teammaster = ent; } gi.linkentity(ent); ent->nextthink = level.time + FRAMETIME; if (ent->health || ent->targetname) { ent->think = Think_CalcMoveSpeed; } else { ent->think = Think_SpawnDoorTrigger; } } /* * QUAKED func_door_rotating (0 .5 .8) ? START_OPEN REVERSE CRUSHER NOMONSTER ANIMATED TOGGLE X_AXIS Y_AXIS * * TOGGLE causes the door to wait in both the start and end states for a trigger event. * START_OPEN the door to moves to its destination when spawned, and operate in reverse. * It is used to temporarily or permanently close off an area when triggered * (not useful for touch or takedamage doors). * NOMONSTER monsters will not trigger this door * * You need to have an origin brush as part of this entity. The center of that brush will be * the point around which it is rotated. It will rotate around the Z axis by default. You can * check either the X_AXIS or Y_AXIS box to change that. * * "distance" is how many degrees the door will be rotated. * "speed" determines how fast the door moves; default value is 100. * * REVERSE will cause the door to rotate in the opposite direction. * * "message" is printed when the door is touched if it is a trigger door and it hasn't been fired yet * "angle" determines the opening direction * "targetname" if set, no touch field will be spawned and a remote button or trigger field activates the door. * "health" if set, door must be shot open * "speed" movement speed (100 default) * "wait" wait before returning (3 default, -1 = never return) * "dmg" damage to inflict when blocked (2 default) * "sounds" * 1) silent * 2) light * 3) medium * 4) heavy */ void SP_func_door_rotating(edict_t *ent) { if (!ent) { return; } VectorClear(ent->s.angles); /* set the axis of rotation */ VectorClear(ent->movedir); if (ent->spawnflags & DOOR_X_AXIS) { ent->movedir[2] = 1.0; } else if (ent->spawnflags & DOOR_Y_AXIS) { ent->movedir[0] = 1.0; } else /* Z_AXIS */ { ent->movedir[1] = 1.0; } /* check for reverse rotation */ if (ent->spawnflags & DOOR_REVERSE) { VectorNegate(ent->movedir, ent->movedir); } if (!st.distance) { gi.dprintf("%s at %s with no distance set\n", ent->classname, vtos(ent->s.origin)); st.distance = 90; } VectorCopy(ent->s.angles, ent->pos1); VectorMA(ent->s.angles, st.distance, ent->movedir, ent->pos2); ent->moveinfo.distance = st.distance; ent->movetype = MOVETYPE_PUSH; ent->solid = SOLID_BSP; gi.setmodel(ent, ent->model); ent->blocked = door_blocked; ent->use = door_use; if (!ent->speed) { ent->speed = 100; } if (!ent->accel) { ent->accel = ent->speed; } if (!ent->decel) { ent->decel = ent->speed; } if (!ent->wait) { ent->wait = 3; } if (!ent->dmg) { ent->dmg = 2; } if (ent->sounds != 1) { ent->moveinfo.sound_start = gi.soundindex("doors/dr1_strt.wav"); ent->moveinfo.sound_middle = gi.soundindex("doors/dr1_mid.wav"); ent->moveinfo.sound_end = gi.soundindex("doors/dr1_end.wav"); } /* if it starts open, switch the positions */ if (ent->spawnflags & DOOR_START_OPEN) { VectorCopy(ent->pos2, ent->s.angles); VectorCopy(ent->pos1, ent->pos2); VectorCopy(ent->s.angles, ent->pos1); VectorNegate(ent->movedir, ent->movedir); } if (ent->health) { ent->takedamage = DAMAGE_YES; ent->die = door_killed; ent->max_health = ent->health; } if (ent->targetname && ent->message) { gi.soundindex("misc/talk.wav"); ent->touch = door_touch; } ent->moveinfo.state = STATE_BOTTOM; ent->moveinfo.speed = ent->speed; ent->moveinfo.accel = ent->accel; ent->moveinfo.decel = ent->decel; ent->moveinfo.wait = ent->wait; VectorCopy(ent->s.origin, ent->moveinfo.start_origin); VectorCopy(ent->pos1, ent->moveinfo.start_angles); VectorCopy(ent->s.origin, ent->moveinfo.end_origin); VectorCopy(ent->pos2, ent->moveinfo.end_angles); if (ent->spawnflags & 16) { ent->s.effects |= EF_ANIM_ALL; } /* to simplify logic elsewhere, make non-teamed doors into a team of one */ if (!ent->team) { ent->teammaster = ent; } gi.linkentity(ent); ent->nextthink = level.time + FRAMETIME; if (ent->health || ent->targetname) { ent->think = Think_CalcMoveSpeed; } else { ent->think = Think_SpawnDoorTrigger; } } /* ==================================================================== */ /* * QUAKED func_water (0 .5 .8) ? START_OPEN * * func_water is a moveable water brush. It must be targeted to operate. * Use a non-water texture at your own risk. * * START_OPEN causes the water to move to its destination when spawned * and operate in reverse. * * "angle" determines the opening direction (up or down only) * "speed" movement speed (25 default) * "wait" wait before returning (-1 default, -1 = TOGGLE) * "lip" lip remaining at end of move (0 default) * "sounds" (yes, these need to be changed) * 0) no sound * 1) water * 2) lava */ void SP_func_water(edict_t *self) { vec3_t abs_movedir; if (!self) { return; } G_SetMovedir(self->s.angles, self->movedir); self->movetype = MOVETYPE_PUSH; self->solid = SOLID_BSP; gi.setmodel(self, self->model); switch (self->sounds) { default: break; case 1: /* water */ case 2: /* lava */ self->moveinfo.sound_start = gi.soundindex("world/mov_watr.wav"); self->moveinfo.sound_end = gi.soundindex("world/stp_watr.wav"); break; } /* calculate second position */ VectorCopy(self->s.origin, self->pos1); abs_movedir[0] = fabs(self->movedir[0]); abs_movedir[1] = fabs(self->movedir[1]); abs_movedir[2] = fabs(self->movedir[2]); self->moveinfo.distance = abs_movedir[0] * self->size[0] + abs_movedir[1] * self->size[1] + abs_movedir[2] * self->size[2] - st.lip; VectorMA(self->pos1, self->moveinfo.distance, self->movedir, self->pos2); /* if it starts open, switch the positions */ if (self->spawnflags & DOOR_START_OPEN) { VectorCopy(self->pos2, self->s.origin); VectorCopy(self->pos1, self->pos2); VectorCopy(self->s.origin, self->pos1); } VectorCopy(self->pos1, self->moveinfo.start_origin); VectorCopy(self->s.angles, self->moveinfo.start_angles); VectorCopy(self->pos2, self->moveinfo.end_origin); VectorCopy(self->s.angles, self->moveinfo.end_angles); self->moveinfo.state = STATE_BOTTOM; if (!self->speed) { self->speed = 25; } self->moveinfo.accel = self->moveinfo.decel = self->moveinfo.speed = self->speed; if (!self->wait) { self->wait = -1; } self->moveinfo.wait = self->wait; self->use = door_use; if (self->wait == -1) { self->spawnflags |= DOOR_TOGGLE; } self->classname = "func_door"; gi.linkentity(self); } /* ==================================================================== */ #define TRAIN_START_ON 1 #define TRAIN_TOGGLE 2 #define TRAIN_BLOCK_STOPS 4 void train_next(edict_t *self); /* * QUAKED func_train (0 .5 .8) ? START_ON TOGGLE BLOCK_STOPS * * Trains are moving platforms that players can ride. * The targets origin specifies the min point of the train * at each corner. The train spawns at the first target it * is pointing at. If the train is the target of a button * or trigger, it will not begin moving until activated. * * speed default 100 * dmg default 2 * noise looping sound to play when the train is in motion * */ void train_next(edict_t *self); void train_blocked(edict_t *self, edict_t *other) { if (!self || !other) { return; } if (!(other->svflags & SVF_MONSTER) && (!other->client)) { /* give it a chance to go away on it's own terms (like gibs) */ T_Damage(other, self, self, vec3_origin, other->s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH); /* if it's still there, nuke it */ if (other->inuse) { /* Hack for entity without an origin near the model */ VectorMA (other->absmin, 0.5, other->size, other->s.origin); BecomeExplosion1(other); } return; } if (level.time < self->touch_debounce_time) { return; } if (!self->dmg) { return; } self->touch_debounce_time = level.time + 0.5; T_Damage(other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg, 1, 0, MOD_CRUSH); } void train_wait(edict_t *self) { if (!self) { return; } if (self->target_ent->pathtarget) { char *savetarget; edict_t *ent; ent = self->target_ent; savetarget = ent->target; ent->target = ent->pathtarget; G_UseTargets(ent, self->activator); ent->target = savetarget; /* make sure we didn't get killed by a killtarget */ if (!self->inuse) { return; } } if (self->moveinfo.wait) { if (self->moveinfo.wait > 0) { self->nextthink = level.time + self->moveinfo.wait; self->think = train_next; } else if (self->spawnflags & TRAIN_TOGGLE) { train_next(self); self->spawnflags &= ~TRAIN_START_ON; VectorClear(self->velocity); self->nextthink = 0; } if (!(self->flags & FL_TEAMSLAVE)) { if (self->moveinfo.sound_end) { gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_end, 1, ATTN_STATIC, 0); } self->s.sound = 0; } } else { train_next(self); } } void train_next(edict_t *self) { if (!self) { return; } edict_t *ent; vec3_t dest; qboolean first; first = true; again: if (!self->target) { return; } ent = G_PickTarget(self->target); if (!ent) { gi.dprintf("train_next: bad target %s\n", self->target); return; } self->target = ent->target; /* check for a teleport path_corner */ if (ent->spawnflags & 1) { if (!first) { gi.dprintf("connected teleport path_corners, see %s at %s\n", ent->classname, vtos(ent->s.origin)); return; } first = false; VectorSubtract(ent->s.origin, self->mins, self->s.origin); VectorCopy(self->s.origin, self->s.old_origin); self->s.event = EV_OTHER_TELEPORT; gi.linkentity(self); goto again; } self->moveinfo.wait = ent->wait; self->target_ent = ent; if (!(self->flags & FL_TEAMSLAVE)) { if (self->moveinfo.sound_start) { gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_STATIC, 0); } self->s.sound = self->moveinfo.sound_middle; } VectorSubtract(ent->s.origin, self->mins, dest); self->moveinfo.state = STATE_TOP; VectorCopy(self->s.origin, self->moveinfo.start_origin); VectorCopy(dest, self->moveinfo.end_origin); Move_Calc(self, dest, train_wait); self->spawnflags |= TRAIN_START_ON; } void train_resume(edict_t *self) { edict_t *ent; vec3_t dest; if (!self) { return; } ent = self->target_ent; VectorSubtract(ent->s.origin, self->mins, dest); self->moveinfo.state = STATE_TOP; VectorCopy(self->s.origin, self->moveinfo.start_origin); VectorCopy(dest, self->moveinfo.end_origin); Move_Calc(self, dest, train_wait); self->spawnflags |= TRAIN_START_ON; } void func_train_find(edict_t *self) { edict_t *ent; if (!self) { return; } if (!self->target) { gi.dprintf("train_find: no target\n"); return; } ent = G_PickTarget(self->target); if (!ent) { gi.dprintf("train_find: target %s not found\n", self->target); return; } self->target = ent->target; VectorSubtract(ent->s.origin, self->mins, self->s.origin); gi.linkentity(self); /* if not triggered, start immediately */ if (!self->targetname) { self->spawnflags |= TRAIN_START_ON; } if (self->spawnflags & TRAIN_START_ON) { self->nextthink = level.time + FRAMETIME; self->think = train_next; self->activator = self; } } void train_use(edict_t *self, edict_t *other /* unused */, edict_t *activator) { if (!self || !activator) { return; } self->activator = activator; if (self->spawnflags & TRAIN_START_ON) { if (!(self->spawnflags & TRAIN_TOGGLE)) { return; } self->spawnflags &= ~TRAIN_START_ON; VectorClear(self->velocity); self->nextthink = 0; } else { if (self->target_ent) { train_resume(self); } else { train_next(self); } } } void SP_func_train(edict_t *self) { if (!self) { return; } self->movetype = MOVETYPE_PUSH; VectorClear(self->s.angles); self->blocked = train_blocked; if (self->spawnflags & TRAIN_BLOCK_STOPS) { self->dmg = 0; } else { if (!self->dmg) { self->dmg = 100; } } self->solid = SOLID_BSP; gi.setmodel(self, self->model); if (st.noise) { self->moveinfo.sound_middle = gi.soundindex(st.noise); } if (!self->speed) { self->speed = 100; } self->moveinfo.speed = self->speed; self->moveinfo.accel = self->moveinfo.decel = self->moveinfo.speed; self->use = train_use; gi.linkentity(self); if (self->target) { /* start trains on the second frame, to make * sure their targets have had a chance to spawn */ self->nextthink = level.time + FRAMETIME; self->think = func_train_find; } else { gi.dprintf("func_train without a target at %s\n", vtos(self->absmin)); } } /* ==================================================================== */ /* * QUAKED trigger_elevator (0.3 0.1 0.6) (-8 -8 -8) (8 8 8) */ void trigger_elevator_use(edict_t *self, edict_t *other, edict_t *activator /* unused */) { edict_t *target; edict_t *train; if (!self || !other) { return; } train = self->movetarget; if (!train || !train->inuse || !train->classname || strcmp(train->classname, "func_train") != 0) { return; } if (train->nextthink) { return; } if (!other->pathtarget) { gi.dprintf("elevator used with no pathtarget\n"); return; } target = G_PickTarget(other->pathtarget); if (!target) { gi.dprintf("elevator used with bad pathtarget: %s\n", other->pathtarget); return; } train->target_ent = target; train_resume(train); } void trigger_elevator_init(edict_t *self) { if (!self) { return; } if (!self->target) { gi.dprintf("trigger_elevator has no target\n"); return; } self->movetarget = G_PickTarget(self->target); if (!self->movetarget) { gi.dprintf("trigger_elevator unable to find target %s\n", self->target); return; } if (strcmp(self->movetarget->classname, "func_train") != 0) { gi.dprintf("trigger_elevator target %s is not a train\n", self->target); return; } self->use = trigger_elevator_use; self->svflags = SVF_NOCLIENT; } void SP_trigger_elevator(edict_t *self) { if (!self) { return; } self->think = trigger_elevator_init; self->nextthink = level.time + FRAMETIME; } /* ==================================================================== */ /* * QUAKED func_timer (0.3 0.1 0.6) (-8 -8 -8) (8 8 8) START_ON * * "wait" base time between triggering all targets, default is 1 * "random" wait variance, default is 0 * * so, the basic time between firing is a random time * between (wait - random) and (wait + random) * * "delay" delay before first firing when turned on, default is 0 * "pausetime" additional delay used only the very first time * and only if spawned with START_ON * * These can used but not touched. */ void func_timer_think(edict_t *self) { if (!self) { return; } G_UseTargets(self, self->activator); self->nextthink = level.time + self->wait + crandom() * self->random; } void func_timer_use(edict_t *self, edict_t *other /* unused */, edict_t *activator) { if (!self || !activator) { return; } self->activator = activator; /* if on, turn it off */ if (self->nextthink) { self->nextthink = 0; return; } /* turn it on */ if (self->delay) { self->nextthink = level.time + self->delay; } else { func_timer_think(self); } } void SP_func_timer(edict_t *self) { if (!self) { return; } if (!self->wait) { self->wait = 1.0; } self->use = func_timer_use; self->think = func_timer_think; if (self->random >= self->wait) { self->random = self->wait - FRAMETIME; gi.dprintf("func_timer at %s has random >= wait\n", vtos(self->s.origin)); } if (self->spawnflags & 1) { self->nextthink = level.time + 1.0 + st.pausetime + self->delay + self->wait + crandom() * self->random; self->activator = self; } self->svflags = SVF_NOCLIENT; } /* ==================================================================== */ /* * QUAKED func_conveyor (0 .5 .8) ? START_ON TOGGLE * * Conveyors are stationary brushes that move what's on them. * The brush should be have a surface with at least one current * content enabled. * * speed default 100 */ void func_conveyor_use(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!self) { return; } if (self->spawnflags & 1) { self->speed = 0; self->spawnflags &= ~1; } else { self->speed = self->count; self->spawnflags |= 1; } if (!(self->spawnflags & 2)) { self->count = 0; } } void SP_func_conveyor(edict_t *self) { if (!self) { return; } if (!self->speed) { self->speed = 100; } if (!(self->spawnflags & 1)) { self->count = self->speed; self->speed = 0; } self->use = func_conveyor_use; gi.setmodel(self, self->model); self->solid = SOLID_BSP; gi.linkentity(self); } /* ==================================================================== */ /* * QUAKED func_door_secret (0 .5 .8) ? always_shoot 1st_left 1st_down * A secret door. Slide back and then to the side. * * open_once doors never closes * 1st_left 1st move is left of arrow * 1st_down 1st move is down from arrow * always_shoot door is shootebale even if targeted * * "angle" determines the direction * "dmg" damage to inflic when blocked (default 2) * "wait" how long to hold in the open position (default 5, -1 means hold) */ #define SECRET_ALWAYS_SHOOT 1 #define SECRET_1ST_LEFT 2 #define SECRET_1ST_DOWN 4 void door_secret_move1(edict_t *self); void door_secret_move2(edict_t *self); void door_secret_move3(edict_t *self); void door_secret_move4(edict_t *self); void door_secret_move5(edict_t *self); void door_secret_move6(edict_t *self); void door_secret_done(edict_t *self); void door_secret_use(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!self) { return; } /* make sure we're not already moving */ if (!VectorCompare(self->s.origin, vec3_origin)) { return; } Move_Calc(self, self->pos1, door_secret_move1); door_use_areaportals(self, true); } void door_secret_move1(edict_t *self) { if (!self) { return; } self->nextthink = level.time + 1.0; self->think = door_secret_move2; } void door_secret_move2(edict_t *self) { if (!self) { return; } Move_Calc(self, self->pos2, door_secret_move3); } void door_secret_move3(edict_t *self) { if (!self) { return; } if (self->wait == -1) { return; } self->nextthink = level.time + self->wait; self->think = door_secret_move4; } void door_secret_move4(edict_t *self) { if (!self) { return; } Move_Calc(self, self->pos1, door_secret_move5); } void door_secret_move5(edict_t *self) { if (!self) { return; } self->nextthink = level.time + 1.0; self->think = door_secret_move6; } void door_secret_move6(edict_t *self) { if (!self) { return; } Move_Calc(self, vec3_origin, door_secret_done); } void door_secret_done(edict_t *self) { if (!self) { return; } if (!(self->targetname) || (self->spawnflags & SECRET_ALWAYS_SHOOT)) { self->health = 0; self->takedamage = DAMAGE_YES; } door_use_areaportals(self, false); } void door_secret_blocked(edict_t *self, edict_t *other) { if (!self || !other) { return; } if (!(other->svflags & SVF_MONSTER) && (!other->client)) { /* give it a chance to go away on it's own terms (like gibs) */ T_Damage(other, self, self, vec3_origin, other->s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH); /* if it's still there, nuke it */ if (other->inuse) { /* Hack for entities without their origin near the model */ VectorMA (other->absmin, 0.5, other->size, other->s.origin); BecomeExplosion1(other); } return; } if (level.time < self->touch_debounce_time) { return; } self->touch_debounce_time = level.time + 0.5; T_Damage(other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg, 1, 0, MOD_CRUSH); } void door_secret_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker, int damage /* unused */, vec3_t point /* unused */) { if (!self || !attacker) { return; } self->takedamage = DAMAGE_NO; door_secret_use(self, attacker, attacker); } void SP_func_door_secret(edict_t *ent) { vec3_t forward, right, up; float side; float width; float length; if (!ent) { return; } ent->moveinfo.sound_start = gi.soundindex("doors/dr1_strt.wav"); ent->moveinfo.sound_middle = gi.soundindex("doors/dr1_mid.wav"); ent->moveinfo.sound_end = gi.soundindex("doors/dr1_end.wav"); ent->movetype = MOVETYPE_PUSH; ent->solid = SOLID_BSP; gi.setmodel(ent, ent->model); ent->blocked = door_secret_blocked; ent->use = door_secret_use; if (!(ent->targetname) || (ent->spawnflags & SECRET_ALWAYS_SHOOT)) { ent->health = 0; ent->takedamage = DAMAGE_YES; ent->die = door_secret_die; } if (!ent->dmg) { ent->dmg = 2; } if (!ent->wait) { ent->wait = 5; } ent->moveinfo.accel = ent->moveinfo.decel = ent->moveinfo.speed = 50; /* calculate positions */ AngleVectors(ent->s.angles, forward, right, up); VectorClear(ent->s.angles); side = 1.0 - (ent->spawnflags & SECRET_1ST_LEFT); if (ent->spawnflags & SECRET_1ST_DOWN) { width = fabs(DotProduct(up, ent->size)); } else { width = fabs(DotProduct(right, ent->size)); } length = fabs(DotProduct(forward, ent->size)); if (ent->spawnflags & SECRET_1ST_DOWN) { VectorMA(ent->s.origin, -1 * width, up, ent->pos1); } else { VectorMA(ent->s.origin, side * width, right, ent->pos1); } VectorMA(ent->pos1, length, forward, ent->pos2); if (ent->health) { ent->takedamage = DAMAGE_YES; ent->die = door_killed; ent->max_health = ent->health; } else if (ent->targetname && ent->message) { gi.soundindex("misc/talk.wav"); ent->touch = door_touch; } ent->classname = "func_door"; gi.linkentity(ent); } /* ==================================================================== */ /* * QUAKED func_killbox (1 0 0) ? * * Kills everything inside when fired, * irrespective of protection. */ void use_killbox(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!self) { return; } KillBox(self); /* Hack to make sure that really everything is killed */ self->count--; if (!self->count) { self->think = G_FreeEdict; self->nextthink = level.time + 1; } } void SP_func_killbox(edict_t *ent) { if (!ent) { return; } gi.setmodel(ent, ent->model); ent->use = use_killbox; ent->svflags = SVF_NOCLIENT; } /* * QUAKED rotating_light (0 .5 .8) (-8 -8 -8) (8 8 8) START_OFF ALARM * "health" if set, the light may be killed. */ #define START_OFF 1 void rotating_light_alarm(edict_t *self) { if (!self) { return; } if (self->spawnflags & START_OFF) { self->think = NULL; self->nextthink = 0; } else { gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_STATIC, 0); self->nextthink = level.time + 1; } } void rotating_light_killed(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage /* unused */, vec3_t point /* unused */) { if (!self) { return; } gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_WELDING_SPARKS); gi.WriteByte(30); gi.WritePosition(self->s.origin); gi.WriteDir(vec3_origin); gi.WriteByte(0xe0 + (rand() & 7)); gi.multicast(self->s.origin, MULTICAST_PVS); self->s.effects &= ~EF_SPINNINGLIGHTS; self->use = NULL; self->think = G_FreeEdict; self->nextthink = level.time + 0.1; } void rotating_light_use(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!self) { return; } if (self->spawnflags & START_OFF) { self->spawnflags &= ~START_OFF; self->s.effects |= EF_SPINNINGLIGHTS; if (self->spawnflags & 2) { self->think = rotating_light_alarm; self->nextthink = level.time + 0.1; } } else { self->spawnflags |= START_OFF; self->s.effects &= ~EF_SPINNINGLIGHTS; } } void SP_rotating_light(edict_t *self) { if (!self) { return; } self->movetype = MOVETYPE_STOP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/objects/light/tris.md2"); self->s.frame = 0; self->use = rotating_light_use; if (self->spawnflags & START_OFF) { self->s.effects &= ~EF_SPINNINGLIGHTS; } else { self->s.effects |= EF_SPINNINGLIGHTS; } if (!self->speed) { self->speed = 32; } if (!self->health) { self->health = 10; self->max_health = self->health; self->die = rotating_light_killed; self->takedamage = DAMAGE_YES; } else { self->max_health = self->health; self->die = rotating_light_killed; self->takedamage = DAMAGE_YES; } if (self->spawnflags & 2) { self->moveinfo.sound_start = gi.soundindex("misc/alarm.wav"); } gi.linkentity(self); } /* * QUAKED func_object_repair (1 .5 0) (-8 -8 -8) (8 8 8) * object to be repaired. * The default delay is 1 second * "delay" the delay in seconds for spark to occur */ void object_repair_fx(edict_t *ent) { if (!ent) { return; } ent->nextthink = level.time + ent->delay; if (ent->health <= 100) { ent->health++; } else { gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_WELDING_SPARKS); gi.WriteByte(10); gi.WritePosition(ent->s.origin); gi.WriteDir(vec3_origin); gi.WriteByte(0xe0 + (rand() & 7)); gi.multicast(ent->s.origin, MULTICAST_PVS); } } void object_repair_dead(edict_t *ent) { if (!ent) { return; } G_UseTargets(ent, ent); ent->nextthink = level.time + 0.1; ent->think = object_repair_fx; } void object_repair_sparks(edict_t *ent) { if (!ent) { return; } if (ent->health < 0) { ent->nextthink = level.time + 0.1; ent->think = object_repair_dead; return; } ent->nextthink = level.time + ent->delay; gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_WELDING_SPARKS); gi.WriteByte(10); gi.WritePosition(ent->s.origin); gi.WriteDir(vec3_origin); gi.WriteByte(0xe0 + (rand() & 7)); gi.multicast(ent->s.origin, MULTICAST_PVS); } void SP_object_repair(edict_t *ent) { if (!ent) { return; } ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; ent->classname = "object_repair"; ent->think = object_repair_sparks; ent->nextthink = level.time + 1.0; ent->health = 100; if (!ent->delay) { ent->delay = 1.0; } gi.linkentity(ent); } xatrix-XATRIX_2_14/src/g_items.c000066400000000000000000001446671477320050300165440ustar00rootroot00000000000000/* * ======================================================================= * * Item handling and item definitions. * * ======================================================================= */ #include "header/local.h" #define HEALTH_IGNORE_MAX 1 #define HEALTH_TIMED 2 qboolean Pickup_Weapon(edict_t *ent, edict_t *other); void Use_Weapon(edict_t *ent, gitem_t *inv); void Use_Weapon2(edict_t *ent, gitem_t *inv); void Drop_Weapon(edict_t *ent, gitem_t *inv); void Weapon_Blaster(edict_t *ent); void Weapon_Shotgun(edict_t *ent); void Weapon_SuperShotgun(edict_t *ent); void Weapon_Machinegun(edict_t *ent); void Weapon_Chaingun(edict_t *ent); void Weapon_HyperBlaster(edict_t *ent); void Weapon_RocketLauncher(edict_t *ent); void Weapon_Grenade(edict_t *ent); void Weapon_GrenadeLauncher(edict_t *ent); void Weapon_Railgun(edict_t *ent); void Weapon_BFG(edict_t *ent); void Weapon_Ionripper(edict_t *ent); void Weapon_Phalanx(edict_t *ent); void Weapon_Trap(edict_t *ent); gitem_armor_t jacketarmor_info = {25, 50, .30, .00, ARMOR_JACKET}; gitem_armor_t combatarmor_info = {50, 100, .60, .30, ARMOR_COMBAT}; gitem_armor_t bodyarmor_info = {100, 200, .80, .60, ARMOR_BODY}; int jacket_armor_index; int combat_armor_index; int body_armor_index; static int power_screen_index; static int power_shield_index; void Use_Quad(edict_t *ent, gitem_t *item); void Use_QuadFire(edict_t *ent, gitem_t *item); static int quad_drop_timeout_hack; static int quad_fire_drop_timeout_hack; /* ====================================================================== */ gitem_t * GetItemByIndex(int index) { if ((index == 0) || (index >= game.num_items)) { return NULL; } return &itemlist[index]; } gitem_t * FindItemByClassname(char *classname) { int i; gitem_t *it; if (!classname) { return NULL; } it = itemlist; for (i = 0; i < game.num_items; i++, it++) { if (!it->classname) { continue; } if (!Q_stricmp(it->classname, classname)) { return it; } } return NULL; } gitem_t * FindItem(char *pickup_name) { int i; gitem_t *it; if (!pickup_name) { return NULL; } it = itemlist; for (i = 0; i < game.num_items; i++, it++) { if (!it->pickup_name) { continue; } if (!Q_stricmp(it->pickup_name, pickup_name)) { return it; } } return NULL; } /* ====================================================================== */ void DoRespawn(edict_t *ent) { if (!ent) { return; } if (ent->team) { edict_t *master; int count; int choice; master = ent->teammaster; for (count = 0, ent = master; ent; ent = ent->chain, count++) { } choice = count ? randk() % count : 0; for (count = 0, ent = master; count < choice; ent = ent->chain, count++) { } } ent->svflags &= ~SVF_NOCLIENT; ent->solid = SOLID_TRIGGER; gi.linkentity(ent); /* send an effect */ ent->s.event = EV_ITEM_RESPAWN; } void SetRespawn(edict_t *ent, float delay) { if (!ent) { return; } ent->flags |= FL_RESPAWN; ent->svflags |= SVF_NOCLIENT; ent->solid = SOLID_NOT; ent->nextthink = level.time + delay; ent->think = DoRespawn; gi.linkentity(ent); } /* ====================================================================== */ qboolean Pickup_Powerup(edict_t *ent, edict_t *other) { int quantity; if (!ent || !other) { return false; } quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)]; if (((skill->value == SKILL_MEDIUM) && (quantity >= 2)) || ((skill->value >= SKILL_HARD) && (quantity >= 1))) { return false; } if ((coop->value) && (ent->item->flags & IT_STAY_COOP) && (quantity > 0)) { return false; } other->client->pers.inventory[ITEM_INDEX(ent->item)]++; if (deathmatch->value) { if (!(ent->spawnflags & DROPPED_ITEM)) { SetRespawn(ent, ent->item->quantity); } } return true; } void Drop_General(edict_t *ent, gitem_t *item) { if (!ent || !item) { return; } Drop_Item(ent, item); ent->client->pers.inventory[ITEM_INDEX(item)]--; ValidateSelectedItem(ent); } /* ====================================================================== */ qboolean Pickup_Adrenaline(edict_t *ent, edict_t *other) { if (!ent || !other) { return false; } if (!deathmatch->value) { other->max_health += 1; } if (other->health < other->max_health) { other->health = other->max_health; } if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value)) { SetRespawn(ent, ent->item->quantity); } return true; } qboolean Pickup_AncientHead(edict_t *ent, edict_t *other) { if (!ent || !other) { return false; } other->max_health += 2; if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value)) { SetRespawn(ent, ent->item->quantity); } return true; } qboolean Pickup_Bandolier(edict_t *ent, edict_t *other) { gitem_t *item; int index; if (!ent || !other) { return false; } if (other->client->pers.max_bullets < 250) { other->client->pers.max_bullets = 250; } if (other->client->pers.max_shells < 150) { other->client->pers.max_shells = 150; } if (other->client->pers.max_cells < 250) { other->client->pers.max_cells = 250; } if (other->client->pers.max_slugs < 75) { other->client->pers.max_slugs = 75; } if (other->client->pers.max_magslug < 75) { other->client->pers.max_magslug = 75; } item = FindItem("Bullets"); if (item) { index = ITEM_INDEX(item); other->client->pers.inventory[index] += item->quantity; if (other->client->pers.inventory[index] > other->client->pers.max_bullets) { other->client->pers.inventory[index] = other->client->pers.max_bullets; } } item = FindItem("Shells"); if (item) { index = ITEM_INDEX(item); other->client->pers.inventory[index] += item->quantity; if (other->client->pers.inventory[index] > other->client->pers.max_shells) { other->client->pers.inventory[index] = other->client->pers.max_shells; } } if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value)) { SetRespawn(ent, ent->item->quantity); } return true; } qboolean Pickup_Pack(edict_t *ent, edict_t *other) { gitem_t *item; int index; if (!ent || !other) { return false; } if (other->client->pers.max_bullets < 300) { other->client->pers.max_bullets = 300; } if (other->client->pers.max_shells < 200) { other->client->pers.max_shells = 200; } if (other->client->pers.max_rockets < 100) { other->client->pers.max_rockets = 100; } if (other->client->pers.max_grenades < 100) { other->client->pers.max_grenades = 100; } if (other->client->pers.max_cells < 300) { other->client->pers.max_cells = 300; } if (other->client->pers.max_slugs < 100) { other->client->pers.max_slugs = 100; } if (other->client->pers.max_magslug < 100) { other->client->pers.max_magslug = 100; } item = FindItem("Bullets"); if (item) { index = ITEM_INDEX(item); other->client->pers.inventory[index] += item->quantity; if (other->client->pers.inventory[index] > other->client->pers.max_bullets) { other->client->pers.inventory[index] = other->client->pers.max_bullets; } } item = FindItem("Shells"); if (item) { index = ITEM_INDEX(item); other->client->pers.inventory[index] += item->quantity; if (other->client->pers.inventory[index] > other->client->pers.max_shells) { other->client->pers.inventory[index] = other->client->pers.max_shells; } } item = FindItem("Cells"); if (item) { index = ITEM_INDEX(item); other->client->pers.inventory[index] += item->quantity; if (other->client->pers.inventory[index] > other->client->pers.max_cells) { other->client->pers.inventory[index] = other->client->pers.max_cells; } } item = FindItem("Grenades"); if (item) { index = ITEM_INDEX(item); other->client->pers.inventory[index] += item->quantity; if (other->client->pers.inventory[index] > other->client->pers.max_grenades) { other->client->pers.inventory[index] = other->client->pers.max_grenades; } } item = FindItem("Rockets"); if (item) { index = ITEM_INDEX(item); other->client->pers.inventory[index] += item->quantity; if (other->client->pers.inventory[index] > other->client->pers.max_rockets) { other->client->pers.inventory[index] = other->client->pers.max_rockets; } } item = FindItem("Slugs"); if (item) { index = ITEM_INDEX(item); other->client->pers.inventory[index] += item->quantity; if (other->client->pers.inventory[index] > other->client->pers.max_slugs) { other->client->pers.inventory[index] = other->client->pers.max_slugs; } } item = FindItem("Mag Slug"); if (item) { index = ITEM_INDEX(item); other->client->pers.inventory[index] += item->quantity; if (other->client->pers.inventory[index] > other->client->pers.max_magslug) { other->client->pers.inventory[index] = other->client->pers.max_magslug; } } if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value)) { SetRespawn(ent, ent->item->quantity); } return true; } /* ====================================================================== */ void Use_Quad(edict_t *ent, gitem_t *item) { int timeout; if (!ent || !item) { return; } ent->client->pers.inventory[ITEM_INDEX(item)]--; ValidateSelectedItem(ent); if (quad_drop_timeout_hack) { timeout = quad_drop_timeout_hack; quad_drop_timeout_hack = 0; } else { timeout = 300; } if (ent->client->quad_framenum > level.framenum) { ent->client->quad_framenum += timeout; } else { ent->client->quad_framenum = level.framenum + timeout; } gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0); } /* ===================================================================== */ void Use_QuadFire(edict_t *ent, gitem_t *item) { int timeout; if (!ent || !item) { return; } ent->client->pers.inventory[ITEM_INDEX(item)]--; ValidateSelectedItem(ent); if (quad_fire_drop_timeout_hack) { timeout = quad_fire_drop_timeout_hack; quad_fire_drop_timeout_hack = 0; } else { timeout = 300; } if (ent->client->quadfire_framenum > level.framenum) { ent->client->quadfire_framenum += timeout; } else { ent->client->quadfire_framenum = level.framenum + timeout; } gi.sound(ent, CHAN_ITEM, gi.soundindex("items/quadfire1.wav"), 1, ATTN_NORM, 0); } /* ====================================================================== */ void Use_Breather(edict_t *ent, gitem_t *item) { if (!ent || !item) { return; } ent->client->pers.inventory[ITEM_INDEX(item)]--; ValidateSelectedItem(ent); if (ent->client->breather_framenum > level.framenum) { ent->client->breather_framenum += 300; } else { ent->client->breather_framenum = level.framenum + 300; } } /* ====================================================================== */ void Use_Envirosuit(edict_t *ent, gitem_t *item) { if (!ent || !item) { return; } ent->client->pers.inventory[ITEM_INDEX(item)]--; ValidateSelectedItem(ent); if (ent->client->enviro_framenum > level.framenum) { ent->client->enviro_framenum += 300; } else { ent->client->enviro_framenum = level.framenum + 300; } } /* ====================================================================== */ void Use_Invulnerability(edict_t *ent, gitem_t *item) { if (!ent || !item) { return; } ent->client->pers.inventory[ITEM_INDEX(item)]--; ValidateSelectedItem(ent); if (ent->client->invincible_framenum > level.framenum) { ent->client->invincible_framenum += 300; } else { ent->client->invincible_framenum = level.framenum + 300; } gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect.wav"), 1, ATTN_NORM, 0); } /* ====================================================================== */ void Use_Silencer(edict_t *ent, gitem_t *item) { if (!ent || !item) { return; } ent->client->pers.inventory[ITEM_INDEX(item)]--; ValidateSelectedItem(ent); ent->client->silencer_shots += 30; } /* ====================================================================== */ qboolean Pickup_Key(edict_t *ent, edict_t *other) { if (!ent || !other) { return false; } if (coop->value) { if (strcmp(ent->classname, "key_power_cube") == 0) { if (other->client->pers.power_cubes & ((ent->spawnflags & 0x0000ff00) >> 8)) { return false; } other->client->pers.inventory[ITEM_INDEX(ent->item)]++; other->client->pers.power_cubes |= ((ent->spawnflags & 0x0000ff00) >> 8); } else { if (other->client->pers.inventory[ITEM_INDEX(ent->item)]) { return false; } other->client->pers.inventory[ITEM_INDEX(ent->item)] = 1; } return true; } other->client->pers.inventory[ITEM_INDEX(ent->item)]++; return true; } /* ====================================================================== */ qboolean Add_Ammo(edict_t *ent, gitem_t *item, int count) { int index; int max; if (!ent || !item) { return false; } if (!ent->client) { return false; } if (item->tag == AMMO_BULLETS) { max = ent->client->pers.max_bullets; } else if (item->tag == AMMO_SHELLS) { max = ent->client->pers.max_shells; } else if (item->tag == AMMO_ROCKETS) { max = ent->client->pers.max_rockets; } else if (item->tag == AMMO_GRENADES) { max = ent->client->pers.max_grenades; } else if (item->tag == AMMO_CELLS) { max = ent->client->pers.max_cells; } else if (item->tag == AMMO_SLUGS) { max = ent->client->pers.max_slugs; } else if (item->tag == AMMO_MAGSLUG) { max = ent->client->pers.max_magslug; } else if (item->tag == AMMO_TRAP) { max = ent->client->pers.max_trap; } else { return false; } index = ITEM_INDEX(item); if (ent->client->pers.inventory[index] == max) { return false; } ent->client->pers.inventory[index] += count; if (ent->client->pers.inventory[index] > max) { ent->client->pers.inventory[index] = max; } return true; } qboolean Pickup_Ammo(edict_t *ent, edict_t *other) { int oldcount; int count; qboolean weapon; if (!ent || !other) { return false; } weapon = (ent->item->flags & IT_WEAPON); if ((weapon) && ((int)dmflags->value & DF_INFINITE_AMMO)) { count = 1000; } else if (ent->count) { count = ent->count; } else { count = ent->item->quantity; } oldcount = other->client->pers.inventory[ITEM_INDEX(ent->item)]; if (!Add_Ammo(other, ent->item, count)) { return false; } if (weapon && !oldcount) { if ((other->client->pers.weapon != ent->item) && (!deathmatch->value || (other->client->pers.weapon == FindItem("blaster")))) { other->client->newweapon = ent->item; } } if (!(ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)) && (deathmatch->value)) { SetRespawn(ent, 30); } return true; } void Drop_Ammo(edict_t *ent, gitem_t *item) { edict_t *dropped; int index; if (!ent || !item) { return; } index = ITEM_INDEX(item); dropped = Drop_Item(ent, item); if (ent->client->pers.inventory[index] >= item->quantity) { dropped->count = item->quantity; } else { dropped->count = ent->client->pers.inventory[index]; } if (ent->client->pers.weapon && (ent->client->pers.weapon->tag == AMMO_GRENADES) && (item->tag == AMMO_GRENADES) && (ent->client->pers.inventory[index] - dropped->count <= 0)) { gi.cprintf(ent, PRINT_HIGH, "Can't drop current weapon\n"); G_FreeEdict(dropped); return; } ent->client->pers.inventory[index] -= dropped->count; ValidateSelectedItem(ent); } /* ====================================================================== */ void MegaHealth_think(edict_t *self) { if (!self) { return; } if (self->owner->health > self->owner->max_health) { self->nextthink = level.time + 1; self->owner->health -= 1; return; } if (!(self->spawnflags & DROPPED_ITEM) && (deathmatch->value)) { SetRespawn(self, 20); } else { G_FreeEdict(self); } } qboolean Pickup_Health(edict_t *ent, edict_t *other) { if (!ent || !other) { return false; } if (!(ent->style & HEALTH_IGNORE_MAX)) { if (other->health >= other->max_health) { return false; } } other->health += ent->count; if (!(ent->style & HEALTH_IGNORE_MAX)) { if (other->health > other->max_health) { other->health = other->max_health; } } if (ent->style & HEALTH_TIMED) { ent->think = MegaHealth_think; ent->nextthink = level.time + 5; ent->owner = other; ent->flags |= FL_RESPAWN; ent->svflags |= SVF_NOCLIENT; ent->solid = SOLID_NOT; } else { if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value)) { SetRespawn(ent, 30); } } return true; } /* ====================================================================== */ int ArmorIndex(edict_t *ent) { if (!ent) { return 0; } if (!ent->client) { return 0; } if (ent->client->pers.inventory[jacket_armor_index] > 0) { return jacket_armor_index; } if (ent->client->pers.inventory[combat_armor_index] > 0) { return combat_armor_index; } if (ent->client->pers.inventory[body_armor_index] > 0) { return body_armor_index; } return 0; } qboolean Pickup_Armor(edict_t *ent, edict_t *other) { int old_armor_index; gitem_armor_t *oldinfo; gitem_armor_t *newinfo; int newcount; float salvage; int salvagecount; if (!ent || !other) { return false; } /* get info on new armor */ newinfo = (gitem_armor_t *)ent->item->info; old_armor_index = ArmorIndex(other); /* handle armor shards specially */ if (ent->item->tag == ARMOR_SHARD) { if (!old_armor_index) { other->client->pers.inventory[jacket_armor_index] = 2; } else { other->client->pers.inventory[old_armor_index] += 2; } } /* if player has no armor, just use it */ else if (!old_armor_index) { other->client->pers.inventory[ITEM_INDEX(ent->item)] = newinfo->base_count; } /* use the better armor */ else { /* get info on old armor */ if (old_armor_index == jacket_armor_index) { oldinfo = &jacketarmor_info; } else if (old_armor_index == combat_armor_index) { oldinfo = &combatarmor_info; } else /* (old_armor_index == body_armor_index) */ { oldinfo = &bodyarmor_info; } if (newinfo->normal_protection > oldinfo->normal_protection) { /* calc new armor values */ salvage = oldinfo->normal_protection / newinfo->normal_protection; salvagecount = salvage * other->client->pers.inventory[old_armor_index]; newcount = newinfo->base_count + salvagecount; if (newcount > newinfo->max_count) { newcount = newinfo->max_count; } /* zero count of old armor so it goes away */ other->client->pers.inventory[old_armor_index] = 0; /* change armor to new item with computed value */ other->client->pers.inventory[ITEM_INDEX(ent->item)] = newcount; } else { /* calc new armor values */ salvage = newinfo->normal_protection / oldinfo->normal_protection; salvagecount = salvage * newinfo->base_count; newcount = other->client->pers.inventory[old_armor_index] + salvagecount; if (newcount > oldinfo->max_count) { newcount = oldinfo->max_count; } /* if we're already maxed out then we don't need the new armor */ if (other->client->pers.inventory[old_armor_index] >= newcount) { return false; } /* update current armor value */ other->client->pers.inventory[old_armor_index] = newcount; } } if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value)) { SetRespawn(ent, 20); } return true; } /* ====================================================================== */ int PowerArmorType(edict_t *ent) { if (!ent) { return POWER_ARMOR_NONE; } if (!ent->client) { return POWER_ARMOR_NONE; } if (!(ent->flags & FL_POWER_ARMOR)) { return POWER_ARMOR_NONE; } if (ent->client->pers.inventory[power_shield_index] > 0) { return POWER_ARMOR_SHIELD; } if (ent->client->pers.inventory[power_screen_index] > 0) { return POWER_ARMOR_SCREEN; } return POWER_ARMOR_NONE; } void Use_PowerArmor(edict_t *ent, gitem_t *item) { int index; if (!ent || !item) { return; } if (ent->flags & FL_POWER_ARMOR) { ent->flags &= ~FL_POWER_ARMOR; gi.sound(ent, CHAN_AUTO, gi.soundindex("misc/power2.wav"), 1, ATTN_NORM, 0); } else { index = ITEM_INDEX(FindItem("cells")); if (!ent->client->pers.inventory[index]) { gi.cprintf(ent, PRINT_HIGH, "No cells for power armor.\n"); return; } ent->flags |= FL_POWER_ARMOR; gi.sound(ent, CHAN_AUTO, gi.soundindex( "misc/power1.wav"), 1, ATTN_NORM, 0); } } qboolean Pickup_PowerArmor(edict_t *ent, edict_t *other) { int quantity; if (!ent || !other) { return false; } quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)]; other->client->pers.inventory[ITEM_INDEX(ent->item)]++; if (deathmatch->value) { if (!(ent->spawnflags & DROPPED_ITEM)) { SetRespawn(ent, ent->item->quantity); } /* auto-use for DM only if we didn't already have one */ if (!quantity) { ent->item->use(other, ent->item); } } return true; } void Drop_PowerArmor(edict_t *ent, gitem_t *item) { if (!ent || !item) { return; } if ((ent->flags & FL_POWER_ARMOR) && (ent->client->pers.inventory[ITEM_INDEX(item)] == 1)) { Use_PowerArmor(ent, item); } Drop_General(ent, item); } /* ====================================================================== */ void Touch_Item(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf) { qboolean taken; if (!ent || !other) { return; } if (!other->client) { return; } if (other->health < 1) { return; /* dead people can't pickup */ } if (!ent->item->pickup) { return; /* not a grabbable item? */ } taken = ent->item->pickup(ent, other); if (taken) { /* flash the screen */ other->client->bonus_alpha = 0.25; /* show icon and name on status bar */ other->client->ps.stats[STAT_PICKUP_ICON] = gi.imageindex(ent->item->icon); other->client->ps.stats[STAT_PICKUP_STRING] = CS_ITEMS + ITEM_INDEX(ent->item); other->client->pickup_msg_time = level.time + 3.0; /* change selected item */ if (ent->item->use) { other->client->pers.selected_item = other->client->ps.stats[STAT_SELECTED_ITEM] = ITEM_INDEX( ent->item); } if (ent->item->pickup == Pickup_Health) { if (ent->count == 2) { gi.sound(other, CHAN_ITEM, gi.soundindex( "items/s_health.wav"), 1, ATTN_NORM, 0); } else if (ent->count == 10) { gi.sound(other, CHAN_ITEM, gi.soundindex( "items/n_health.wav"), 1, ATTN_NORM, 0); } else if (ent->count == 25) { gi.sound(other, CHAN_ITEM, gi.soundindex( "items/l_health.wav"), 1, ATTN_NORM, 0); } else { gi.sound(other, CHAN_ITEM, gi.soundindex( "items/m_health.wav"), 1, ATTN_NORM, 0); } } else if (ent->item->pickup_sound) { gi.sound(other, CHAN_ITEM, gi.soundindex( ent->item->pickup_sound), 1, ATTN_NORM, 0); } /* activate item instantly if appropriate */ /* moved down here so activation sounds override the pickup sound */ if (deathmatch->value) { if ((((int)dmflags->value & DF_INSTANT_ITEMS) && (ent->item->flags & IT_INSTANT_USE)) || (((ent->item->use == Use_Quad) || (ent->item->use == Use_QuadFire)) && (ent->spawnflags & DROPPED_PLAYER_ITEM))) { if (ent->spawnflags & DROPPED_PLAYER_ITEM) { if (ent->item->use == Use_Quad) { quad_drop_timeout_hack = (ent->nextthink - level.time) / FRAMETIME; } else if (ent->item->use == Use_QuadFire) { quad_fire_drop_timeout_hack = (ent->nextthink - level.time) / FRAMETIME; } } if (ent->item->use) { ent->item->use(other, ent->item); } } } } if (!(ent->spawnflags & ITEM_TARGETS_USED)) { G_UseTargets(ent, other); ent->spawnflags |= ITEM_TARGETS_USED; } if (!taken) { return; } if (!((coop->value) && (ent->item->flags & IT_STAY_COOP)) || (ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM))) { if (ent->flags & FL_RESPAWN) { ent->flags &= ~FL_RESPAWN; } else { G_FreeEdict(ent); } } } /* ====================================================================== */ void drop_temp_touch(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf) { if (!ent || !other) { return; } if (other == ent->owner) { return; } /* plane and surf are unused in Touch_Item but since the function is part of the game <-> client interface dropping them is too much pain. */ Touch_Item(ent, other, plane, surf); } void drop_make_touchable(edict_t *ent) { if (!ent) { return; } ent->touch = Touch_Item; if (deathmatch->value) { ent->nextthink = level.time + 29; ent->think = G_FreeEdict; } } edict_t * Drop_Item(edict_t *ent, gitem_t *item) { edict_t *dropped; vec3_t forward, right; vec3_t offset; if (!ent || !item) { return NULL; } dropped = G_Spawn(); dropped->classname = item->classname; dropped->item = item; dropped->spawnflags = DROPPED_ITEM; dropped->s.effects = item->world_model_flags; dropped->s.renderfx = RF_GLOW; if (random() > 0.5) { dropped->s.angles[1] += random()*45; } else { dropped->s.angles[1] -= random()*45; } VectorSet (dropped->mins, -16, -16, -16); VectorSet (dropped->maxs, 16, 16, 16); gi.setmodel(dropped, dropped->item->world_model); dropped->solid = SOLID_TRIGGER; dropped->movetype = MOVETYPE_TOSS; dropped->touch = drop_temp_touch; dropped->owner = ent; if (ent->client) { trace_t trace; AngleVectors(ent->client->v_angle, forward, right, NULL); VectorSet(offset, 24, 0, -16); G_ProjectSource(ent->s.origin, offset, forward, right, dropped->s.origin); trace = gi.trace(ent->s.origin, dropped->mins, dropped->maxs, dropped->s.origin, ent, CONTENTS_SOLID); VectorCopy(trace.endpos, dropped->s.origin); } else { AngleVectors(ent->s.angles, forward, right, NULL); VectorCopy(ent->s.origin, dropped->s.origin); } VectorScale(forward, 100, dropped->velocity); dropped->velocity[2] = 300; dropped->think = drop_make_touchable; dropped->nextthink = level.time + 1; gi.linkentity(dropped); return dropped; } void Use_Item(edict_t *ent, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!ent) { return; } ent->svflags &= ~SVF_NOCLIENT; ent->use = NULL; if (ent->spawnflags & ITEM_NO_TOUCH) { ent->solid = SOLID_BBOX; ent->touch = NULL; } else { ent->solid = SOLID_TRIGGER; ent->touch = Touch_Item; } gi.linkentity(ent); } /* ====================================================================== */ void droptofloor(edict_t *ent) { trace_t tr; vec3_t dest; float *v; if (!ent) { return; } v = tv(-15, -15, -15); VectorCopy(v, ent->mins); v = tv(15, 15, 15); VectorCopy(v, ent->maxs); if (ent->model) { gi.setmodel(ent, ent->model); } else { gi.setmodel(ent, ent->item->world_model); } ent->solid = SOLID_TRIGGER; ent->movetype = MOVETYPE_TOSS; ent->touch = Touch_Item; v = tv(0, 0, -128); VectorAdd(ent->s.origin, v, dest); tr = gi.trace(ent->s.origin, ent->mins, ent->maxs, dest, ent, MASK_SOLID); if (tr.startsolid) { if (strcmp(ent->classname, "foodcube") == 0) { VectorCopy(ent->s.origin, tr.endpos); ent->velocity[2] = 0; } else { gi.dprintf("droptofloor: %s startsolid at %s\n", ent->classname, vtos(ent->s.origin)); G_FreeEdict(ent); return; } } VectorCopy(tr.endpos, ent->s.origin); if (ent->team) { ent->flags &= ~FL_TEAMSLAVE; ent->chain = ent->teamchain; ent->teamchain = NULL; ent->svflags |= SVF_NOCLIENT; ent->solid = SOLID_NOT; if (ent == ent->teammaster) { ent->nextthink = level.time + FRAMETIME; ent->think = DoRespawn; } } if (ent->spawnflags & ITEM_NO_TOUCH) { ent->solid = SOLID_BBOX; ent->touch = NULL; ent->s.effects &= ~EF_ROTATE; ent->s.renderfx &= ~RF_GLOW; } if (ent->spawnflags & ITEM_TRIGGER_SPAWN) { ent->svflags |= SVF_NOCLIENT; ent->solid = SOLID_NOT; ent->use = Use_Item; } gi.linkentity(ent); } /* * Precaches all data needed for a given item. * This will be called for each item spawned in a level, * and for each item in each client's inventory. */ void PrecacheItem(gitem_t *it) { char *s, *start; char data[MAX_QPATH]; int len; gitem_t *ammo; if (!it) { return; } if (it->pickup_sound) { gi.soundindex(it->pickup_sound); } if (it->world_model) { gi.modelindex(it->world_model); } if (it->view_model) { gi.modelindex(it->view_model); } if (it->icon) { gi.imageindex(it->icon); } /* parse everything for its ammo */ if (it->ammo && it->ammo[0]) { ammo = FindItem(it->ammo); if (ammo != it) { PrecacheItem(ammo); } } /* parse the space seperated precache string for other items */ s = it->precaches; if (!s || !s[0]) { return; } while (*s) { start = s; while (*s && *s != ' ') { s++; } len = s - start; if ((len >= MAX_QPATH) || (len < 5)) { gi.error("PrecacheItem: %s has bad precache string", it->classname); } memcpy(data, start, len); data[len] = 0; if (*s) { s++; } /* determine type based on extension */ if (!strcmp(data + len - 3, "md2")) { gi.modelindex(data); } else if (!strcmp(data + len - 3, "sp2")) { gi.modelindex(data); } else if (!strcmp(data + len - 3, "wav")) { gi.soundindex(data); } if (!strcmp(data + len - 3, "pcx")) { gi.imageindex(data); } } } /* * Sets the clipping size and plants the object on the floor. * Items can't be immediately dropped to floor, because they might * be on an entity that hasn't spawned yet. */ void SpawnItem(edict_t *ent, gitem_t *item) { if (!ent || !item) { return; } PrecacheItem(item); if (ent->spawnflags) { if (strcmp(ent->classname, "key_power_cube") != 0) { ent->spawnflags = 0; gi.dprintf("%s at %s has invalid spawnflags set\n", ent->classname, vtos(ent->s.origin)); } } /* some items will be prevented in deathmatch */ if (deathmatch->value) { if ((int)dmflags->value & DF_NO_ARMOR) { if ((item->pickup == Pickup_Armor) || (item->pickup == Pickup_PowerArmor)) { G_FreeEdict(ent); return; } } if ((int)dmflags->value & DF_NO_ITEMS) { if (item->pickup == Pickup_Powerup) { G_FreeEdict(ent); return; } } if ((int)dmflags->value & DF_NO_HEALTH) { if ((item->pickup == Pickup_Health) || (item->pickup == Pickup_Adrenaline) || (item->pickup == Pickup_AncientHead)) { G_FreeEdict(ent); return; } } if ((int)dmflags->value & DF_INFINITE_AMMO) { if ((item->flags == IT_AMMO) || (strcmp(ent->classname, "weapon_bfg") == 0)) { G_FreeEdict(ent); return; } } } if (coop->value && !(ent->spawnflags & ITEM_NO_TOUCH) && (strcmp(ent->classname, "key_power_cube") == 0)) { ent->spawnflags |= (1 << (8 + level.power_cubes)); level.power_cubes++; } /* don't let them drop items that stay in a coop game */ if ((coop->value) && (item->flags & IT_STAY_COOP)) { item->drop = NULL; } ent->item = item; ent->nextthink = level.time + 2 * FRAMETIME; /* items start after other solids */ ent->think = droptofloor; ent->s.effects = item->world_model_flags; ent->s.renderfx = RF_GLOW; if (ent->model) { gi.modelindex(ent->model); } } /* ====================================================================== */ gitem_t itemlist[] = { { NULL }, /* * QUAKED item_armor_body (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "item_armor_body", Pickup_Armor, NULL, NULL, NULL, "misc/ar1_pkup.wav", "models/items/armor/body/tris.md2", EF_ROTATE, NULL, "i_bodyarmor", "Body Armor", 3, 0, NULL, IT_ARMOR, 0, &bodyarmor_info, ARMOR_BODY, "" }, /* * QUAKED item_armor_combat (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "item_armor_combat", Pickup_Armor, NULL, NULL, NULL, "misc/ar1_pkup.wav", "models/items/armor/combat/tris.md2", EF_ROTATE, NULL, "i_combatarmor", "Combat Armor", 3, 0, NULL, IT_ARMOR, 0, &combatarmor_info, ARMOR_COMBAT, "" }, /* * QUAKED item_armor_jacket (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "item_armor_jacket", Pickup_Armor, NULL, NULL, NULL, "misc/ar1_pkup.wav", "models/items/armor/jacket/tris.md2", EF_ROTATE, NULL, "i_jacketarmor", "Jacket Armor", 3, 0, NULL, IT_ARMOR, 0, &jacketarmor_info, ARMOR_JACKET, "" }, /* * QUAKED item_armor_shard (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "item_armor_shard", Pickup_Armor, NULL, NULL, NULL, "misc/ar2_pkup.wav", "models/items/armor/shard/tris.md2", EF_ROTATE, NULL, "i_jacketarmor", "Armor Shard", 3, 0, NULL, IT_ARMOR, 0, NULL, ARMOR_SHARD, "" }, /* * QUAKED item_power_screen (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "item_power_screen", Pickup_PowerArmor, Use_PowerArmor, Drop_PowerArmor, NULL, "misc/ar3_pkup.wav", "models/items/armor/screen/tris.md2", EF_ROTATE, NULL, "i_powerscreen", "Power Screen", 0, 60, NULL, IT_ARMOR, 0, NULL, 0, "" }, /* * QUAKED item_power_shield (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "item_power_shield", Pickup_PowerArmor, Use_PowerArmor, Drop_PowerArmor, NULL, "misc/ar3_pkup.wav", "models/items/armor/shield/tris.md2", EF_ROTATE, NULL, "i_powershield", "Power Shield", 0, 60, NULL, IT_ARMOR, 0, NULL, 0, "misc/power2.wav misc/power1.wav" }, /* * weapon_blaster (.3 .3 1) (-16 -16 -16) (16 16 16) * always owned, never in the world */ { "weapon_blaster", NULL, Use_Weapon, NULL, Weapon_Blaster, "misc/w_pkup.wav", NULL, 0, "models/weapons/v_blast/tris.md2", "w_blaster", "Blaster", 0, 0, NULL, IT_WEAPON | IT_STAY_COOP, WEAP_BLASTER, NULL, 0, "weapons/blastf1a.wav misc/lasfly.wav" }, /* * QUAKED weapon_shotgun (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "weapon_shotgun", Pickup_Weapon, Use_Weapon, Drop_Weapon, Weapon_Shotgun, "misc/w_pkup.wav", "models/weapons/g_shotg/tris.md2", EF_ROTATE, "models/weapons/v_shotg/tris.md2", "w_shotgun", "Shotgun", 0, 1, "Shells", IT_WEAPON | IT_STAY_COOP, WEAP_SHOTGUN, NULL, 0, "weapons/shotgf1b.wav weapons/shotgr1b.wav" }, /* * QUAKED weapon_supershotgun (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "weapon_supershotgun", Pickup_Weapon, Use_Weapon, Drop_Weapon, Weapon_SuperShotgun, "misc/w_pkup.wav", "models/weapons/g_shotg2/tris.md2", EF_ROTATE, "models/weapons/v_shotg2/tris.md2", "w_sshotgun", "Super Shotgun", 0, 2, "Shells", IT_WEAPON | IT_STAY_COOP, WEAP_SUPERSHOTGUN, NULL, 0, "weapons/sshotf1b.wav" }, /* * QUAKED weapon_machinegun (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "weapon_machinegun", Pickup_Weapon, Use_Weapon, Drop_Weapon, Weapon_Machinegun, "misc/w_pkup.wav", "models/weapons/g_machn/tris.md2", EF_ROTATE, "models/weapons/v_machn/tris.md2", "w_machinegun", "Machinegun", 0, 1, "Bullets", IT_WEAPON | IT_STAY_COOP, WEAP_MACHINEGUN, NULL, 0, "weapons/machgf1b.wav weapons/machgf2b.wav weapons/machgf3b.wav weapons/machgf4b.wav weapons/machgf5b.wav" }, /* * QUAKED weapon_chaingun (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "weapon_chaingun", Pickup_Weapon, Use_Weapon, Drop_Weapon, Weapon_Chaingun, "misc/w_pkup.wav", "models/weapons/g_chain/tris.md2", EF_ROTATE, "models/weapons/v_chain/tris.md2", "w_chaingun", "Chaingun", 0, 1, "Bullets", IT_WEAPON | IT_STAY_COOP, WEAP_CHAINGUN, NULL, 0, "weapons/chngnu1a.wav weapons/chngnl1a.wav weapons/machgf3b.wav` weapons/chngnd1a.wav" }, /* * QUAKED ammo_grenades (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "ammo_grenades", Pickup_Ammo, Use_Weapon, Drop_Ammo, Weapon_Grenade, "misc/am_pkup.wav", "models/items/ammo/grenades/medium/tris.md2", 0, "models/weapons/v_handgr/tris.md2", "a_grenades", "Grenades", 3, 5, "grenades", IT_AMMO | IT_WEAPON, WEAP_GRENADES, NULL, AMMO_GRENADES, "weapons/hgrent1a.wav weapons/hgrena1b.wav weapons/hgrenc1b.wav weapons/hgrenb1a.wav weapons/hgrenb2a.wav " }, /* * QUAKED ammo_trap (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "ammo_trap", Pickup_Ammo, Use_Weapon, Drop_Ammo, Weapon_Trap, "misc/am_pkup.wav", "models/weapons/g_trap/tris.md2", EF_ROTATE, "models/weapons/v_trap/tris.md2", "a_trap", "Trap", 3, 1, "trap", IT_AMMO | IT_WEAPON, 0, NULL, AMMO_TRAP, "weapons/trapcock.wav weapons/traploop.wav weapons/trapsuck.wav weapons/trapdown.wav" }, /* * QUAKED weapon_grenadelauncher (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "weapon_grenadelauncher", Pickup_Weapon, Use_Weapon, Drop_Weapon, Weapon_GrenadeLauncher, "misc/w_pkup.wav", "models/weapons/g_launch/tris.md2", EF_ROTATE, "models/weapons/v_launch/tris.md2", "w_glauncher", "Grenade Launcher", 0, 1, "Grenades", IT_WEAPON | IT_STAY_COOP, WEAP_GRENADELAUNCHER, NULL, 0, "models/objects/grenade/tris.md2 weapons/grenlf1a.wav weapons/grenlr1b.wav weapons/grenlb1b.wav" }, /* * QUAKED weapon_rocketlauncher (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "weapon_rocketlauncher", Pickup_Weapon, Use_Weapon, Drop_Weapon, Weapon_RocketLauncher, "misc/w_pkup.wav", "models/weapons/g_rocket/tris.md2", EF_ROTATE, "models/weapons/v_rocket/tris.md2", "w_rlauncher", "Rocket Launcher", 0, 1, "Rockets", IT_WEAPON | IT_STAY_COOP, WEAP_ROCKETLAUNCHER, NULL, 0, "models/objects/rocket/tris.md2 weapons/rockfly.wav weapons/rocklf1a.wav weapons/rocklr1b.wav models/objects/debris2/tris.md2" }, /* * QUAKED weapon_hyperblaster (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "weapon_hyperblaster", Pickup_Weapon, Use_Weapon2, Drop_Weapon, Weapon_HyperBlaster, "misc/w_pkup.wav", "models/weapons/g_hyperb/tris.md2", EF_ROTATE, "models/weapons/v_hyperb/tris.md2", "w_hyperblaster", "HyperBlaster", 0, 1, "Cells", IT_WEAPON | IT_STAY_COOP, WEAP_HYPERBLASTER, NULL, 0, "weapons/hyprbu1a.wav weapons/hyprbl1a.wav weapons/hyprbf1a.wav weapons/hyprbd1a.wav misc/lasfly.wav" }, /* * QUAKED weapon_boomer (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "weapon_boomer", Pickup_Weapon, Use_Weapon, Drop_Weapon, Weapon_Ionripper, "misc/w_pkup.wav", "models/weapons/g_boom/tris.md2", EF_ROTATE, "models/weapons/v_boomer/tris.md2", "w_ripper", "Ionripper", 0, 2, "Cells", IT_WEAPON, WEAP_BOOMER, NULL, 0, "weapons/rg_hum.wav weapons/rippfire.wav" }, /* * QUAKED weapon_railgun (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "weapon_railgun", Pickup_Weapon, Use_Weapon2, Drop_Weapon, Weapon_Railgun, "misc/w_pkup.wav", "models/weapons/g_rail/tris.md2", EF_ROTATE, "models/weapons/v_rail/tris.md2", "w_railgun", "Railgun", 0, 1, "Slugs", IT_WEAPON | IT_STAY_COOP, WEAP_RAILGUN, NULL, 0, "weapons/rg_hum.wav" }, /* * QUAKED weapon_phalanx (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "weapon_phalanx", Pickup_Weapon, Use_Weapon, Drop_Weapon, Weapon_Phalanx, "misc/w_pkup.wav", "models/weapons/g_shotx/tris.md2", EF_ROTATE, "models/weapons/v_shotx/tris.md2", "w_phallanx", "Phalanx", 0, 1, "Mag Slug", IT_WEAPON, WEAP_PHALANX, NULL, 0, "weapons/plasshot.wav" }, /* * QUAKED weapon_bfg (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "weapon_bfg", Pickup_Weapon, Use_Weapon, Drop_Weapon, Weapon_BFG, "misc/w_pkup.wav", "models/weapons/g_bfg/tris.md2", EF_ROTATE, "models/weapons/v_bfg/tris.md2", "w_bfg", "BFG10K", 0, 50, "Cells", IT_WEAPON | IT_STAY_COOP, WEAP_BFG, NULL, 0, "sprites/s_bfg1.sp2 sprites/s_bfg2.sp2 sprites/s_bfg3.sp2 weapons/bfg__f1y.wav weapons/bfg__l1a.wav weapons/bfg__x1b.wav weapons/bfg_hum.wav" }, /* * QUAKED ammo_shells (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "ammo_shells", Pickup_Ammo, NULL, Drop_Ammo, NULL, "misc/am_pkup.wav", "models/items/ammo/shells/medium/tris.md2", 0, NULL, "a_shells", "Shells", 3, 10, NULL, IT_AMMO, 0, NULL, AMMO_SHELLS, "" }, /* * QUAKED ammo_bullets (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "ammo_bullets", Pickup_Ammo, NULL, Drop_Ammo, NULL, "misc/am_pkup.wav", "models/items/ammo/bullets/medium/tris.md2", 0, NULL, "a_bullets", "Bullets", 3, 50, NULL, IT_AMMO, 0, NULL, AMMO_BULLETS, "" }, /* * QUAKED ammo_cells (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "ammo_cells", Pickup_Ammo, NULL, Drop_Ammo, NULL, "misc/am_pkup.wav", "models/items/ammo/cells/medium/tris.md2", 0, NULL, "a_cells", "Cells", 3, 50, NULL, IT_AMMO, 0, NULL, AMMO_CELLS, "" }, /* * QUAKED ammo_rockets (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "ammo_rockets", Pickup_Ammo, NULL, Drop_Ammo, NULL, "misc/am_pkup.wav", "models/items/ammo/rockets/medium/tris.md2", 0, NULL, "a_rockets", "Rockets", 3, 5, NULL, IT_AMMO, 0, NULL, AMMO_ROCKETS, "" }, /* * QUAKED ammo_slugs (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "ammo_slugs", Pickup_Ammo, NULL, Drop_Ammo, NULL, "misc/am_pkup.wav", "models/items/ammo/slugs/medium/tris.md2", 0, NULL, "a_slugs", "Slugs", 3, 10, NULL, IT_AMMO, 0, NULL, AMMO_SLUGS, "" }, /* * QUAKED ammo_magslug (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "ammo_magslug", Pickup_Ammo, NULL, Drop_Ammo, NULL, "misc/am_pkup.wav", "models/objects/ammo/tris.md2", 0, NULL, "a_mslugs", "Mag Slug", 3, 10, NULL, IT_AMMO, 0, NULL, AMMO_MAGSLUG, "" }, /* * QUAKED item_quad (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "item_quad", Pickup_Powerup, Use_Quad, Drop_General, NULL, "items/pkup.wav", "models/items/quaddama/tris.md2", EF_ROTATE, NULL, "p_quad", "Quad Damage", 2, 60, NULL, IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, "items/damage.wav items/damage2.wav items/damage3.wav" }, /* * QUAKED item_quadfire (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "item_quadfire", Pickup_Powerup, Use_QuadFire, Drop_General, NULL, "items/pkup.wav", "models/items/quadfire/tris.md2", EF_ROTATE, NULL, "p_quadfire", "DualFire Damage", 2, 60, NULL, IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, "items/quadfire1.wav items/quadfire2.wav items/quadfire3.wav" }, /* * QUAKED item_invulnerability (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "item_invulnerability", Pickup_Powerup, Use_Invulnerability, Drop_General, NULL, "items/pkup.wav", "models/items/invulner/tris.md2", EF_ROTATE, NULL, "p_invulnerability", "Invulnerability", 2, 300, NULL, IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, "items/protect.wav items/protect2.wav items/protect4.wav" }, /* * QUAKED item_silencer (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "item_silencer", Pickup_Powerup, Use_Silencer, Drop_General, NULL, "items/pkup.wav", "models/items/silencer/tris.md2", EF_ROTATE, NULL, "p_silencer", "Silencer", 2, 60, NULL, IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, "" }, /* * QUAKED item_breather (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "item_breather", Pickup_Powerup, Use_Breather, Drop_General, NULL, "items/pkup.wav", "models/items/breather/tris.md2", EF_ROTATE, NULL, "p_rebreather", "Rebreather", 2, 60, NULL, IT_STAY_COOP | IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, "items/airout.wav" }, /* * QUAKED item_enviro (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "item_enviro", Pickup_Powerup, Use_Envirosuit, Drop_General, NULL, "items/pkup.wav", "models/items/enviro/tris.md2", EF_ROTATE, NULL, "p_envirosuit", "Environment Suit", 2, 60, NULL, IT_STAY_COOP | IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, "items/airout.wav" }, /* * QUAKED item_ancient_head (.3 .3 1) (-16 -16 -16) (16 16 16) * Special item that gives +2 to maximum health */ { "item_ancient_head", Pickup_AncientHead, NULL, NULL, NULL, "items/pkup.wav", "models/items/c_head/tris.md2", EF_ROTATE, NULL, "i_fixme", "Ancient Head", 2, 60, NULL, 0, 0, NULL, 0, "" }, /* * QUAKED item_adrenaline (.3 .3 1) (-16 -16 -16) (16 16 16) * gives +1 to maximum health */ { "item_adrenaline", Pickup_Adrenaline, NULL, NULL, NULL, "items/pkup.wav", "models/items/adrenal/tris.md2", EF_ROTATE, NULL, "p_adrenaline", "Adrenaline", 2, 60, NULL, 0, 0, NULL, 0, "" }, /* * QUAKED item_bandolier (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "item_bandolier", Pickup_Bandolier, NULL, NULL, NULL, "items/pkup.wav", "models/items/band/tris.md2", EF_ROTATE, NULL, "p_bandolier", "Bandolier", 2, 60, NULL, 0, 0, NULL, 0, "" }, /* * QUAKED item_pack (.3 .3 1) (-16 -16 -16) (16 16 16) */ { "item_pack", Pickup_Pack, NULL, NULL, NULL, "items/pkup.wav", "models/items/pack/tris.md2", EF_ROTATE, NULL, "i_pack", "Ammo Pack", 2, 180, NULL, 0, 0, NULL, 0, "" }, /* * QUAKED key_data_cd (0 .5 .8) (-16 -16 -16) (16 16 16) * key for computer centers */ { "key_data_cd", Pickup_Key, NULL, Drop_General, NULL, "items/pkup.wav", "models/items/keys/data_cd/tris.md2", EF_ROTATE, NULL, "k_datacd", "Data CD", 2, 0, NULL, IT_STAY_COOP | IT_KEY, 0, NULL, 0, "" }, /* * QUAKED key_power_cube (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN NO_TOUCH * warehouse circuits */ { "key_power_cube", Pickup_Key, NULL, Drop_General, NULL, "items/pkup.wav", "models/items/keys/power/tris.md2", EF_ROTATE, NULL, "k_powercube", "Power Cube", 2, 0, NULL, IT_STAY_COOP | IT_KEY, 0, NULL, 0, "" }, /* * QUAKED key_pyramid (0 .5 .8) (-16 -16 -16) (16 16 16) * key for the entrance of jail3 */ { "key_pyramid", Pickup_Key, NULL, Drop_General, NULL, "items/pkup.wav", "models/items/keys/pyramid/tris.md2", EF_ROTATE, NULL, "k_pyramid", "Pyramid Key", 2, 0, NULL, IT_STAY_COOP | IT_KEY, 0, NULL, 0, "" }, /* * QUAKED key_data_spinner (0 .5 .8) (-16 -16 -16) (16 16 16) * key for the city computer */ { "key_data_spinner", Pickup_Key, NULL, Drop_General, NULL, "items/pkup.wav", "models/items/keys/spinner/tris.md2", EF_ROTATE, NULL, "k_dataspin", "Data Spinner", 2, 0, NULL, IT_STAY_COOP | IT_KEY, 0, NULL, 0, "" }, /* * QUAKED key_pass (0 .5 .8) (-16 -16 -16) (16 16 16) * security pass for the security level */ { "key_pass", Pickup_Key, NULL, Drop_General, NULL, "items/pkup.wav", "models/items/keys/pass/tris.md2", EF_ROTATE, NULL, "k_security", "Security Pass", 2, 0, NULL, IT_STAY_COOP | IT_KEY, 0, NULL, 0, "" }, /* * QUAKED key_blue_key (0 .5 .8) (-16 -16 -16) (16 16 16) * normal door key - blue */ { "key_blue_key", Pickup_Key, NULL, Drop_General, NULL, "items/pkup.wav", "models/items/keys/key/tris.md2", EF_ROTATE, NULL, "k_bluekey", "Blue Key", 2, 0, NULL, IT_STAY_COOP | IT_KEY, 0, NULL, 0, "" }, /* * QUAKED key_red_key (0 .5 .8) (-16 -16 -16) (16 16 16) * normal door key - red */ { "key_red_key", Pickup_Key, NULL, Drop_General, NULL, "items/pkup.wav", "models/items/keys/red_key/tris.md2", EF_ROTATE, NULL, "k_redkey", "Red Key", 2, 0, NULL, IT_STAY_COOP | IT_KEY, 0, NULL, 0, "" }, /* * QUAKED key_green_key (0 .5 .8) (-16 -16 -16) (16 16 16) * normal door key - blue */ { "key_green_key", Pickup_Key, NULL, Drop_General, NULL, "items/pkup.wav", "models/items/keys/green_key/tris.md2", EF_ROTATE, NULL, "k_green", "Green Key", 2, 0, NULL, IT_STAY_COOP | IT_KEY, 0, NULL, 0, "" }, /* * QUAKED key_commander_head (0 .5 .8) (-16 -16 -16) (16 16 16) * tank commander's head */ { "key_commander_head", Pickup_Key, NULL, Drop_General, NULL, "items/pkup.wav", "models/monsters/commandr/head/tris.md2", EF_GIB, NULL, "k_comhead", "Commander's Head", 2, 0, NULL, IT_STAY_COOP | IT_KEY, 0, NULL, 0, "" }, /* * QUAKED key_airstrike_target (0 .5 .8) (-16 -16 -16) (16 16 16) * tank commander's head */ { "key_airstrike_target", Pickup_Key, NULL, Drop_General, NULL, "items/pkup.wav", "models/items/keys/target/tris.md2", EF_ROTATE, NULL, "i_airstrike", "Airstrike Marker", 2, 0, NULL, IT_STAY_COOP | IT_KEY, 0, NULL, 0, "" }, { NULL, Pickup_Health, NULL, NULL, NULL, "items/pkup.wav", NULL, 0, NULL, "i_health", "Health", 3, 0, NULL, 0, 0, NULL, 0, "items/s_health.wav items/n_health.wav items/l_health.wav items/m_health.wav" }, /* end of list marker */ {NULL} }; /* * QUAKED item_health (.3 .3 1) (-16 -16 -16) (16 16 16) */ void SP_item_health(edict_t *self) { if (!self) { return; } if (deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH)) { G_FreeEdict(self); return; } self->model = "models/items/healing/medium/tris.md2"; self->count = 10; SpawnItem(self, FindItem("Health")); gi.soundindex("items/n_health.wav"); } /* * QUAKED item_health_small (.3 .3 1) (-16 -16 -16) (16 16 16) */ void SP_item_health_small(edict_t *self) { if (!self) { return; } if (deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH)) { G_FreeEdict(self); return; } self->model = "models/items/healing/stimpack/tris.md2"; self->count = 2; SpawnItem(self, FindItem("Health")); self->style = HEALTH_IGNORE_MAX; gi.soundindex("items/s_health.wav"); } /* * QUAKED item_health_large (.3 .3 1) (-16 -16 -16) (16 16 16) */ void SP_item_health_large(edict_t *self) { if (!self) { return; } if (deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH)) { G_FreeEdict(self); return; } self->model = "models/items/healing/large/tris.md2"; self->count = 25; SpawnItem(self, FindItem("Health")); gi.soundindex("items/l_health.wav"); } /* * QUAKED item_health_mega (.3 .3 1) (-16 -16 -16) (16 16 16) */ void SP_item_health_mega(edict_t *self) { if (!self) { return; } if (deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH)) { G_FreeEdict(self); return; } self->model = "models/items/mega_h/tris.md2"; self->count = 100; SpawnItem(self, FindItem("Health")); gi.soundindex("items/m_health.wav"); self->style = HEALTH_IGNORE_MAX | HEALTH_TIMED; } void SP_item_foodcube(edict_t *self) { if (!self) { return; } if (deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH)) { G_FreeEdict(self); return; } self->model = "models/objects/trapfx/tris.md2"; SpawnItem(self, FindItem("Health")); self->spawnflags |= DROPPED_ITEM; self->style = HEALTH_IGNORE_MAX; gi.soundindex("items/s_health.wav"); self->classname = "foodcube"; } void InitItems(void) { game.num_items = sizeof(itemlist) / sizeof(itemlist[0]) - 1; } /* * Called by worldspawn */ void SetItemNames(void) { int i; gitem_t *it; for (i = 0; i < game.num_items; i++) { it = &itemlist[i]; gi.configstring(CS_ITEMS + i, it->pickup_name); } jacket_armor_index = ITEM_INDEX(FindItem("Jacket Armor")); combat_armor_index = ITEM_INDEX(FindItem("Combat Armor")); body_armor_index = ITEM_INDEX(FindItem("Body Armor")); power_screen_index = ITEM_INDEX(FindItem("Power Screen")); power_shield_index = ITEM_INDEX(FindItem("Power Shield")); } xatrix-XATRIX_2_14/src/g_main.c000066400000000000000000000203031477320050300163230ustar00rootroot00000000000000/* * ======================================================================= * * Jump in into the game.so and support functions. * * ======================================================================= */ #include "header/local.h" game_locals_t game; level_locals_t level; game_import_t gi; game_export_t globals; spawn_temp_t st; int sm_meat_index; int snd_fry; int meansOfDeath; edict_t *g_edicts; cvar_t *deathmatch; cvar_t *coop; cvar_t *coop_elevator_delay; cvar_t *coop_pickup_weapons; cvar_t *dmflags; cvar_t *skill; cvar_t *fraglimit; cvar_t *timelimit; cvar_t *password; cvar_t *spectator_password; cvar_t *needpass; cvar_t *maxclients; cvar_t *maxspectators; cvar_t *maxentities; cvar_t *g_select_empty; cvar_t *dedicated; cvar_t *g_footsteps; cvar_t *g_monsterfootsteps; cvar_t *g_fix_triggered; cvar_t *filterban; cvar_t *sv_maxvelocity; cvar_t *sv_gravity; cvar_t *sv_rollspeed; cvar_t *sv_rollangle; cvar_t *gun_x; cvar_t *gun_y; cvar_t *gun_z; cvar_t *run_pitch; cvar_t *run_roll; cvar_t *bob_up; cvar_t *bob_pitch; cvar_t *bob_roll; cvar_t *sv_cheats; cvar_t *flood_msgs; cvar_t *flood_persecond; cvar_t *flood_waitdelay; cvar_t *sv_maplist; cvar_t *gib_on; cvar_t *aimfix; cvar_t *g_machinegun_norecoil; cvar_t *g_quick_weap; cvar_t *g_swap_speed; void SpawnEntities(char *mapname, char *entities, char *spawnpoint); void ClientThink(edict_t *ent, usercmd_t *cmd); qboolean ClientConnect(edict_t *ent, char *userinfo); void ClientUserinfoChanged(edict_t *ent, char *userinfo); void ClientDisconnect(edict_t *ent); void ClientBegin(edict_t *ent); void ClientCommand(edict_t *ent); void RunEntity(edict_t *ent); void WriteGame(char *filename, qboolean autosave); void ReadGame(char *filename); void WriteLevel(char *filename); void ReadLevel(char *filename); void InitGame(void); void G_RunFrame(void); /* =================================================================== */ void ShutdownGame(void) { gi.dprintf("==== ShutdownGame ====\n"); gi.FreeTags(TAG_LEVEL); gi.FreeTags(TAG_GAME); } /* * Returns a pointer to the structure with * all entry points and global variables */ game_export_t * GetGameAPI(game_import_t *import) { gi = *import; globals.apiversion = GAME_API_VERSION; globals.Init = InitGame; globals.Shutdown = ShutdownGame; globals.SpawnEntities = SpawnEntities; globals.WriteGame = WriteGame; globals.ReadGame = ReadGame; globals.WriteLevel = WriteLevel; globals.ReadLevel = ReadLevel; globals.ClientThink = ClientThink; globals.ClientConnect = ClientConnect; globals.ClientUserinfoChanged = ClientUserinfoChanged; globals.ClientDisconnect = ClientDisconnect; globals.ClientBegin = ClientBegin; globals.ClientCommand = ClientCommand; globals.RunFrame = G_RunFrame; globals.ServerCommand = ServerCommand; globals.edict_size = sizeof(edict_t); /* Initalize the PRNG */ randk_seed(); return &globals; } void Sys_Error(char *error, ...) { va_list argptr; char text[1024]; va_start(argptr, error); vsprintf(text, error, argptr); va_end(argptr); gi.error("%s", text); } void Com_Printf(char *msg, ...) { va_list argptr; char text[1024]; va_start(argptr, msg); vsprintf(text, msg, argptr); va_end(argptr); gi.dprintf("%s", text); } /* ====================================================================== */ void ClientEndServerFrames(void) { int i; edict_t *ent; /* calc the player views now that all pushing and damage has been added */ for (i = 0; i < maxclients->value; i++) { ent = g_edicts + 1 + i; if (!ent->inuse || !ent->client) { continue; } ClientEndServerFrame(ent); } } /* * Returns the created target changelevel */ edict_t * CreateTargetChangeLevel(char *map) { edict_t *ent; if (!map) { return NULL; } ent = G_Spawn(); ent->classname = "target_changelevel"; Com_sprintf(level.nextmap, sizeof(level.nextmap), "%s", map); ent->map = level.nextmap; return ent; } /* * The timelimit or fraglimit has been exceeded */ void EndDMLevel(void) { edict_t *ent; char *s, *t, *f; static const char *seps = " ,\n\r"; /* stay on same level flag */ if ((int)dmflags->value & DF_SAME_LEVEL) { BeginIntermission(CreateTargetChangeLevel(level.mapname)); return; } /* see if it's in the map list */ if (*sv_maplist->string) { s = strdup(sv_maplist->string); f = NULL; t = strtok(s, seps); while (t != NULL) { if (Q_stricmp(t, level.mapname) == 0) { /* it's in the list, go to the next one */ t = strtok(NULL, seps); if (t == NULL) /* end of list, go to first one */ { if (f == NULL) /* there isn't a first one, same level */ { BeginIntermission(CreateTargetChangeLevel(level.mapname)); } else { BeginIntermission(CreateTargetChangeLevel(f)); } } else { BeginIntermission(CreateTargetChangeLevel(t)); } free(s); return; } if (!f) { f = t; } t = strtok(NULL, seps); } free(s); } if (level.nextmap[0]) /* go to a specific map */ { BeginIntermission(CreateTargetChangeLevel(level.nextmap)); } else /* search for a changelevel */ { ent = G_Find(NULL, FOFS(classname), "target_changelevel"); if (!ent) { /* the map designer didn't include a changelevel, so create a fake ent that goes back to the same level */ BeginIntermission(CreateTargetChangeLevel(level.mapname)); return; } BeginIntermission(ent); } } void CheckNeedPass(void) { int need; /* if password or spectator_password has changed, update needpass as needed */ if (password->modified || spectator_password->modified) { password->modified = spectator_password->modified = false; need = 0; if (*password->string && Q_stricmp(password->string, "none")) { need |= 1; } if (*spectator_password->string && Q_stricmp(spectator_password->string, "none")) { need |= 2; } gi.cvar_set("needpass", va("%d", need)); } } void CheckDMRules(void) { int i; gclient_t *cl; if (level.intermissiontime) { return; } if (!deathmatch->value) { return; } if (timelimit->value) { if (level.time >= timelimit->value * 60) { gi.bprintf(PRINT_HIGH, "Timelimit hit.\n"); EndDMLevel(); return; } } if (fraglimit->value) { for (i = 0; i < maxclients->value; i++) { cl = game.clients + i; if (!g_edicts[i + 1].inuse) { continue; } if (cl->resp.score >= fraglimit->value) { gi.bprintf(PRINT_HIGH, "Fraglimit hit.\n"); EndDMLevel(); return; } } } } void ExitLevel(void) { int i; edict_t *ent; char command[256]; Com_sprintf(command, sizeof(command), "gamemap \"%s\"\n", level.changemap); gi.AddCommandString(command); level.changemap = NULL; level.exitintermission = 0; level.intermissiontime = 0; ClientEndServerFrames(); /* clear some things before going to next level */ for (i = 0; i < maxclients->value; i++) { ent = g_edicts + 1 + i; if (!ent->inuse) { continue; } if (ent->health > ent->max_health) { ent->health = ent->max_health; } } debristhisframe = 0; gibsthisframe = 0; } /* * Advances the world by 0.1 seconds */ void G_RunFrame(void) { int i; edict_t *ent; level.framenum++; level.time = level.framenum * FRAMETIME; debristhisframe = 0; gibsthisframe = 0; /* choose a client for monsters to target this frame */ AI_SetSightClient(); /* exit intermissions */ if (level.exitintermission) { ExitLevel(); return; } /* treat each object in turn even the world gets a chance to think */ ent = &g_edicts[0]; for (i = 0; i < globals.num_edicts; i++, ent++) { if (!ent->inuse) { continue; } level.current_entity = ent; VectorCopy(ent->s.origin, ent->s.old_origin); /* if the ground entity moved, make sure we are still on it */ if ((ent->groundentity) && (ent->groundentity->linkcount != ent->groundentity_linkcount)) { ent->groundentity = NULL; if (!(ent->flags & (FL_SWIM | FL_FLY)) && (ent->svflags & SVF_MONSTER)) { M_CheckGround(ent); } } if ((i > 0) && (i <= maxclients->value)) { ClientBeginServerFrame(ent); continue; } G_RunEntity(ent); } /* see if it is time to end a deathmatch */ CheckDMRules(); /* see if needpass needs updated */ CheckNeedPass(); /* build the playerstate_t structures for all players */ ClientEndServerFrames(); } xatrix-XATRIX_2_14/src/g_misc.c000066400000000000000000001561661477320050300163530ustar00rootroot00000000000000/* ======================================================================= * * Miscellaneos entities, functs and functions. * * ======================================================================= */ #include "header/local.h" int debristhisframe; int gibsthisframe; /* * QUAKED func_group (0 0 0) ? * Used to group brushes together just for editor convenience. */ /* ===================================================== */ void Use_Areaportal(edict_t *ent, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!ent) { return; } ent->count ^= 1; /* toggle state */ gi.SetAreaPortalState(ent->style, ent->count); } /* * QUAKED func_areaportal (0 0 0) ? * * This is a non-visible object that divides the world into * areas that are seperated when this portal is not activated. * Usually enclosed in the middle of a door. */ void SP_func_areaportal(edict_t *ent) { if (!ent) { return; } ent->use = Use_Areaportal; ent->count = 0; /* always start closed; */ } /* ===================================================== */ void VelocityForDamage(int damage, vec3_t v) { v[0] = 100.0 * crandom(); v[1] = 100.0 * crandom(); v[2] = 200.0 + 100.0 * random(); if (damage < 50) { VectorScale(v, 0.7, v); } else { VectorScale(v, 1.2, v); } } void ClipGibVelocity(edict_t *ent) { if (!ent) { return; } if (ent->velocity[0] < -300) { ent->velocity[0] = -300; } else if (ent->velocity[0] > 300) { ent->velocity[0] = 300; } if (ent->velocity[1] < -300) { ent->velocity[1] = -300; } else if (ent->velocity[1] > 300) { ent->velocity[1] = 300; } if (ent->velocity[2] < 200) { ent->velocity[2] = 200; /* always some upwards */ } else if (ent->velocity[2] > 500) { ent->velocity[2] = 500; } } void gib_think(edict_t *self) { if (!self) { return; } self->s.frame++; self->nextthink = level.time + FRAMETIME; if (self->s.frame == 10) { self->think = G_FreeEdict; self->nextthink = level.time + 8 + random() * 10; } } void gib_touch(edict_t *self, edict_t *other /* unused */, cplane_t *plane, csurface_t *surf /* unused */) { vec3_t normal_angles, right; if (!self) { return; } if (!self->groundentity) { return; } self->touch = NULL; if (plane) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/fhit3.wav"), 1, ATTN_NORM, 0); vectoangles(plane->normal, normal_angles); AngleVectors(normal_angles, NULL, right, NULL); vectoangles(right, self->s.angles); if (self->s.modelindex == sm_meat_index) { self->s.frame++; self->think = gib_think; self->nextthink = level.time + FRAMETIME; } } } void gib_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage /* unused */, vec3_t point /* unused */) { if (!self) { return; } G_FreeEdict(self); } void ThrowGib(edict_t *self, char *gibname, int damage, int type) { edict_t *gib; vec3_t vd; vec3_t origin; vec3_t size; float vscale; if (!self || !gibname) { return; } if (gibsthisframe > MAX_GIBS) { return; } gib = G_SpawnOptional(); if (!gib) { return; } gibsthisframe++; VectorScale(self->size, 0.5, size); VectorAdd(self->absmin, size, origin); gib->s.origin[0] = origin[0] + crandom() * size[0]; gib->s.origin[1] = origin[1] + crandom() * size[1]; gib->s.origin[2] = origin[2] + crandom() * size[2]; gi.setmodel(gib, gibname); gib->solid = SOLID_BBOX; gib->svflags = SVF_DEADMONSTER; gib->s.effects |= EF_GIB; gib->flags |= FL_NO_KNOCKBACK; gib->takedamage = DAMAGE_YES; gib->die = gib_die; gib->health = 250; if (type == GIB_ORGANIC) { gib->movetype = MOVETYPE_TOSS; gib->touch = gib_touch; vscale = 0.5; } else { gib->movetype = MOVETYPE_BOUNCE; vscale = 1.0; } VelocityForDamage(damage, vd); VectorMA(self->velocity, vscale, vd, gib->velocity); ClipGibVelocity(gib); gib->avelocity[0] = random() * 600; gib->avelocity[1] = random() * 600; gib->avelocity[2] = random() * 600; gib->think = G_FreeEdict; gib->nextthink = level.time + 10 + random() * 10; gi.linkentity(gib); } void ThrowHead(edict_t *self, char *gibname, int damage, int type) { vec3_t vd; float vscale; if (!self || !gibname) { return; } self->s.skinnum = 0; self->s.frame = 0; VectorClear(self->mins); VectorClear(self->maxs); self->s.modelindex2 = 0; gi.setmodel(self, gibname); self->solid = SOLID_BBOX; self->s.effects |= EF_GIB; self->s.effects &= ~EF_FLIES; self->s.sound = 0; self->flags |= FL_NO_KNOCKBACK; self->svflags &= ~SVF_MONSTER; self->takedamage = DAMAGE_YES; self->die = gib_die; // The entity still has the monsters clipmaks. // Reset it to MASK_SHOT to be on the save side. self->clipmask = MASK_SHOT; if (type == GIB_ORGANIC) { self->movetype = MOVETYPE_TOSS; self->touch = gib_touch; vscale = 0.5; } else { self->movetype = MOVETYPE_BOUNCE; vscale = 1.0; } VelocityForDamage(damage, vd); VectorMA(self->velocity, vscale, vd, self->velocity); ClipGibVelocity(self); self->avelocity[YAW] = crandom() * 600; self->think = G_FreeEdict; self->nextthink = level.time + 10 + random() * 10; gi.linkentity(self); } void ThrowGibACID(edict_t *self, char *gibname, int damage, int type) { edict_t *gib; vec3_t vd; vec3_t origin; vec3_t size; float vscale; if (!self || !gibname) { return; } gibsthisframe++; if (gibsthisframe > MAX_GIBS) { return; } gib = G_Spawn(); VectorScale(self->size, 0.5, size); VectorAdd(self->absmin, size, origin); gib->s.origin[0] = origin[0] + crandom() * size[0]; gib->s.origin[1] = origin[1] + crandom() * size[1]; gib->s.origin[2] = origin[2] + crandom() * size[2]; /* gi.setmodel (gib, gibname); */ gib->s.modelindex = gi.modelindex(gibname); gib->clipmask = MASK_SHOT; gib->solid = SOLID_BBOX; gib->s.effects |= EF_GREENGIB; /* note to self check this */ gib->s.renderfx |= RF_FULLBRIGHT; gib->flags |= FL_NO_KNOCKBACK; gib->takedamage = DAMAGE_YES; gib->die = gib_die; gib->dmg = 2; gib->health = 250; if (type == GIB_ORGANIC) { gib->movetype = MOVETYPE_TOSS; vscale = 3.0; } else { gib->movetype = MOVETYPE_BOUNCE; vscale = 1.0; } VelocityForDamage(damage, vd); VectorMA(self->velocity, vscale, vd, gib->velocity); ClipGibVelocity(gib); gib->avelocity[0] = random() * 600; gib->avelocity[1] = random() * 600; gib->avelocity[2] = random() * 600; gib->think = G_FreeEdict; gib->nextthink = level.time + 10 + random() * 10; gi.linkentity(gib); } void ThrowHeadACID(edict_t *self, char *gibname, int damage, int type) { vec3_t vd; float vscale; if (!self || !gibname) { return; } self->s.skinnum = 0; self->s.frame = 0; VectorClear(self->mins); VectorClear(self->maxs); self->s.modelindex2 = 0; gi.setmodel(self, gibname); self->clipmask = MASK_SHOT; self->solid = SOLID_BBOX; self->s.effects |= EF_GREENGIB; self->s.effects &= ~EF_FLIES; self->s.effects |= RF_FULLBRIGHT; self->s.sound = 0; self->flags |= FL_NO_KNOCKBACK; self->svflags &= ~SVF_MONSTER; self->takedamage = DAMAGE_YES; self->die = gib_die; self->dmg = 2; if (type == GIB_ORGANIC) { self->movetype = MOVETYPE_TOSS; vscale = 0.5; } else { self->movetype = MOVETYPE_BOUNCE; vscale = 1.0; } VelocityForDamage(damage, vd); VectorMA(self->velocity, vscale, vd, self->velocity); ClipGibVelocity(self); self->avelocity[YAW] = crandom() * 600; self->think = G_FreeEdict; self->nextthink = level.time + 10 + random() * 10; gi.linkentity(self); } void ThrowClientHead(edict_t *self, int damage) { vec3_t vd; char *gibname; if (!self) { return; } if (rand() & 1) { gibname = "models/objects/gibs/head2/tris.md2"; self->s.skinnum = 1; /* second skin is player */ } else { gibname = "models/objects/gibs/skull/tris.md2"; self->s.skinnum = 0; } self->s.origin[2] += 32; self->s.frame = 0; gi.setmodel(self, gibname); VectorSet(self->mins, -16, -16, 0); VectorSet(self->maxs, 16, 16, 16); self->takedamage = DAMAGE_NO; self->solid = SOLID_BBOX; self->s.effects = EF_GIB; self->s.sound = 0; self->flags |= FL_NO_KNOCKBACK; // The entity still has the monsters clipmaks. // Reset it to MASK_SHOT to be on the save side. self->clipmask = MASK_SHOT; self->movetype = MOVETYPE_BOUNCE; VelocityForDamage(damage, vd); VectorAdd(self->velocity, vd, self->velocity); if (self->client) /* bodies in the queue don't have a client anymore */ { self->client->anim_priority = ANIM_DEATH; self->client->anim_end = self->s.frame; } else { self->think = NULL; self->nextthink = 0; } gi.linkentity(self); } void debris_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage /* unused */, vec3_t point /* unused */) { if (!self) { return; } G_FreeEdict(self); } void ThrowDebris(edict_t *self, char *modelname, float speed, vec3_t origin) { edict_t *chunk; vec3_t v; if (!self || !modelname) { return; } if (debristhisframe > MAX_DEBRIS) { return; } chunk = G_SpawnOptional(); if (!chunk) { return; } debristhisframe++; VectorCopy(origin, chunk->s.origin); gi.setmodel(chunk, modelname); v[0] = 100 * crandom(); v[1] = 100 * crandom(); v[2] = 100 + 100 * crandom(); VectorMA(self->velocity, speed, v, chunk->velocity); chunk->movetype = MOVETYPE_BOUNCE; chunk->solid = SOLID_NOT; chunk->avelocity[0] = random() * 600; chunk->avelocity[1] = random() * 600; chunk->avelocity[2] = random() * 600; chunk->think = G_FreeEdict; chunk->nextthink = level.time + 5 + random() * 5; chunk->s.frame = 0; chunk->flags = 0; chunk->classname = "debris"; chunk->takedamage = DAMAGE_YES; chunk->die = debris_die; chunk->health = 250; gi.linkentity(chunk); } void BecomeExplosion1(edict_t *self) { if (!self) { return; } gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_EXPLOSION1); gi.WritePosition(self->s.origin); gi.multicast(self->s.origin, MULTICAST_PVS); G_FreeEdict(self); } void BecomeExplosion2(edict_t *self) { if (!self) { return; } gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_EXPLOSION2); gi.WritePosition(self->s.origin); gi.multicast(self->s.origin, MULTICAST_PVS); G_FreeEdict(self); } /* ===================================================== */ /* * QUAKED path_corner (.5 .3 0) (-8 -8 -8) (8 8 8) TELEPORT * Target: next path corner * Pathtarget: gets used when an entity that has * this path_corner targeted touches it */ void path_corner_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf /* unused */) { vec3_t v; edict_t *next; if (!self || !other) { return; } if (other->movetarget != self) { return; } if (other->enemy) { return; } if (self->pathtarget) { char *savetarget; savetarget = self->target; self->target = self->pathtarget; G_UseTargets(self, other); self->target = savetarget; } if (self->target) { next = G_PickTarget(self->target); } else { next = NULL; } if ((next) && (next->spawnflags & 1)) { VectorCopy(next->s.origin, v); v[2] += next->mins[2]; v[2] -= other->mins[2]; VectorCopy(v, other->s.origin); next = G_PickTarget(next->target); other->s.event = EV_OTHER_TELEPORT; } other->goalentity = other->movetarget = next; if (self->wait) { other->monsterinfo.pausetime = level.time + self->wait; other->monsterinfo.stand(other); return; } if (!other->movetarget) { other->monsterinfo.pausetime = level.time + 100000000; other->monsterinfo.stand(other); } else { VectorSubtract(other->goalentity->s.origin, other->s.origin, v); other->ideal_yaw = vectoyaw(v); } } void SP_path_corner(edict_t *self) { if (!self) { return; } if (!self->targetname) { gi.dprintf("path_corner with no targetname at %s\n", vtos(self->s.origin)); G_FreeEdict(self); return; } self->solid = SOLID_TRIGGER; self->touch = path_corner_touch; VectorSet(self->mins, -8, -8, -8); VectorSet(self->maxs, 8, 8, 8); self->svflags |= SVF_NOCLIENT; gi.linkentity(self); } /* ===================================================== */ /* * QUAKED point_combat (0.5 0.3 0) (-8 -8 -8) (8 8 8) Hold * * Makes this the target of a monster and it will head here * when first activated before going after the activator. If * hold is selected, it will stay here. */ void point_combat_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf /* unused */) { edict_t *activator; if (!self || !other) { return; } if (other->movetarget != self) { return; } if (self->target) { other->target = self->target; other->goalentity = other->movetarget = G_PickTarget(other->target); if (!other->goalentity) { gi.dprintf("%s at %s target %s does not exist\n", self->classname, vtos(self->s.origin), self->target); other->movetarget = self; } self->target = NULL; } else if ((self->spawnflags & 1) && !(other->flags & (FL_SWIM | FL_FLY))) { other->monsterinfo.pausetime = level.time + 100000000; other->monsterinfo.aiflags |= AI_STAND_GROUND; other->monsterinfo.stand(other); } if (other->movetarget == self) { other->target = NULL; other->movetarget = NULL; other->goalentity = other->enemy; other->monsterinfo.aiflags &= ~AI_COMBAT_POINT; } if (self->pathtarget) { char *savetarget; savetarget = self->target; self->target = self->pathtarget; if (other->enemy && other->enemy->client) { activator = other->enemy; } else if (other->oldenemy && other->oldenemy->client) { activator = other->oldenemy; } else if (other->activator && other->activator->client) { activator = other->activator; } else { activator = other; } G_UseTargets(self, activator); self->target = savetarget; } } void SP_point_combat(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } self->solid = SOLID_TRIGGER; self->touch = point_combat_touch; VectorSet(self->mins, -8, -8, -16); VectorSet(self->maxs, 8, 8, 16); self->svflags = SVF_NOCLIENT; gi.linkentity(self); } /* ===================================================== */ /* * QUAKED viewthing (0 .5 .8) (-8 -8 -8) (8 8 8) * Just for the debugging level. Don't use */ void TH_viewthing(edict_t *ent) { if (!ent) { return; } ent->s.frame = (ent->s.frame + 1) % 7; ent->nextthink = level.time + FRAMETIME; } void SP_viewthing(edict_t *ent) { if (!ent) { return; } gi.dprintf("viewthing spawned\n"); ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; ent->s.renderfx = RF_FRAMELERP; VectorSet(ent->mins, -16, -16, -24); VectorSet(ent->maxs, 16, 16, 32); ent->s.modelindex = gi.modelindex("models/objects/banner/tris.md2"); gi.linkentity(ent); ent->nextthink = level.time + 0.5; ent->think = TH_viewthing; return; } /* ===================================================== */ /* * QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4) * Used as a positional target for spotlights, etc. */ void SP_info_null(edict_t *self) { if (!self) { return; } G_FreeEdict(self); } /* * QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4) * Used as a positional target for lighting. */ void SP_info_notnull(edict_t *self) { if (!self) { return; } VectorCopy(self->s.origin, self->absmin); VectorCopy(self->s.origin, self->absmax); } /* * QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) START_OFF * Non-displayed light. * Default light value is 300. * Default style is 0. * If targeted, will toggle between on and off. * Default _cone value is 10 (used to set size of light for spotlights) */ #define START_OFF 1 void light_use(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!self) { return; } if (self->spawnflags & START_OFF) { gi.configstring(CS_LIGHTS + self->style, "m"); self->spawnflags &= ~START_OFF; } else { gi.configstring(CS_LIGHTS + self->style, "a"); self->spawnflags |= START_OFF; } } void SP_light(edict_t *self) { if (!self) { return; } /* no targeted lights in deathmatch, because they cause global messages */ if (!self->targetname || deathmatch->value) { G_FreeEdict(self); return; } if (self->style >= 32) { self->use = light_use; if (self->spawnflags & START_OFF) { gi.configstring(CS_LIGHTS + self->style, "a"); } else { gi.configstring(CS_LIGHTS + self->style, "m"); } } } /* ===================================================== */ /* * QUAKED func_wall (0 .5 .8) ? TRIGGER_SPAWN TOGGLE START_ON ANIMATED ANIMATED_FAST * This is just a solid wall if not inhibited * * TRIGGER_SPAWN the wall will not be present until triggered * it will then blink in to existance; it will * kill anything that was in it's way * * TOGGLE only valid for TRIGGER_SPAWN walls * this allows the wall to be turned on and off * * START_ON only valid for TRIGGER_SPAWN walls * the wall will initially be present */ void func_wall_use(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!self) { return; } if (self->solid == SOLID_NOT) { self->solid = SOLID_BSP; self->svflags &= ~SVF_NOCLIENT; KillBox(self); } else { self->solid = SOLID_NOT; self->svflags |= SVF_NOCLIENT; } gi.linkentity(self); if (!(self->spawnflags & 2)) { self->use = NULL; } } void SP_func_wall(edict_t *self) { if (!self) { return; } self->movetype = MOVETYPE_PUSH; gi.setmodel(self, self->model); if (self->spawnflags & 8) { self->s.effects |= EF_ANIM_ALL; } if (self->spawnflags & 16) { self->s.effects |= EF_ANIM_ALLFAST; } /* just a wall */ if ((self->spawnflags & 7) == 0) { self->solid = SOLID_BSP; gi.linkentity(self); return; } /* it must be TRIGGER_SPAWN */ if (!(self->spawnflags & 1)) { self->spawnflags |= 1; } /* yell if the spawnflags are odd */ if (self->spawnflags & 4) { if (!(self->spawnflags & 2)) { gi.dprintf("func_wall START_ON without TOGGLE\n"); self->spawnflags |= 2; } } self->use = func_wall_use; if (self->spawnflags & 4) { self->solid = SOLID_BSP; } else { self->solid = SOLID_NOT; self->svflags |= SVF_NOCLIENT; } gi.linkentity(self); } /* ===================================================== */ /* * QUAKED func_object (0 .5 .8) ? TRIGGER_SPAWN ANIMATED ANIMATED_FAST * This is solid bmodel that will fall if it's support it removed. */ void func_object_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf /* unused */) { if (!self || !other || !plane) { return; } if (plane->normal[2] < 1.0) { return; } if (other->takedamage == DAMAGE_NO) { return; } T_Damage(other, self, self, vec3_origin, self->s.origin, vec3_origin, self->dmg, 1, 0, MOD_CRUSH); } void func_object_release(edict_t *self) { if (!self) { return; } self->movetype = MOVETYPE_TOSS; self->touch = func_object_touch; } void func_object_use(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!self) { return; } self->solid = SOLID_BSP; self->svflags &= ~SVF_NOCLIENT; self->use = NULL; KillBox(self); func_object_release(self); } void SP_func_object(edict_t *self) { if (!self) { return; } gi.setmodel(self, self->model); self->mins[0] += 1; self->mins[1] += 1; self->mins[2] += 1; self->maxs[0] -= 1; self->maxs[1] -= 1; self->maxs[2] -= 1; if (!self->dmg) { self->dmg = 100; } if (self->spawnflags == 0) { self->solid = SOLID_BSP; self->movetype = MOVETYPE_PUSH; self->think = func_object_release; self->nextthink = level.time + 2 * FRAMETIME; } else { self->solid = SOLID_NOT; self->movetype = MOVETYPE_PUSH; self->use = func_object_use; self->svflags |= SVF_NOCLIENT; } if (self->spawnflags & 2) { self->s.effects |= EF_ANIM_ALL; } if (self->spawnflags & 4) { self->s.effects |= EF_ANIM_ALLFAST; } self->clipmask = MASK_MONSTERSOLID; gi.linkentity(self); } /* ===================================================== */ /* * QUAKED func_explosive (0 .5 .8) ? Trigger_Spawn ANIMATED ANIMATED_FAST * Any brush that you want to explode or break apart. If you want an * explosion, set dmg and it will do a radius explosion of that amount * at the center of the bursh. * * If targeted it will not be shootable. * * health defaults to 100. * * mass defaults to 75. This determines how much debris is emitted when * it explodes. You get one large chunk per 100 of mass (up to 8) and * one small chunk per 25 of mass (up to 16). So 800 gives the most. */ void func_explosive_explode(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage /* unused */, vec3_t point /* unused */) { vec3_t origin; vec3_t chunkorigin; vec3_t size; int count; int mass; if (!self || !inflictor || !attacker) { return; } /* bmodel origins are (0 0 0), we need to adjust that here */ VectorScale(self->size, 0.5, size); VectorAdd(self->absmin, size, origin); VectorCopy(origin, self->s.origin); self->takedamage = DAMAGE_NO; if (self->dmg) { T_RadiusDamage(self, attacker, self->dmg, NULL, self->dmg + 40, MOD_EXPLOSIVE); } VectorSubtract(self->s.origin, inflictor->s.origin, self->velocity); VectorNormalize(self->velocity); VectorScale(self->velocity, 150, self->velocity); /* start chunks towards the center */ VectorScale(size, 0.5, size); mass = self->mass; if (!mass) { mass = 75; } /* big chunks */ if (mass >= 100) { count = mass / 100; if (count > 8) { count = 8; } while (count--) { chunkorigin[0] = origin[0] + crandom() * size[0]; chunkorigin[1] = origin[1] + crandom() * size[1]; chunkorigin[2] = origin[2] + crandom() * size[2]; ThrowDebris(self, "models/objects/debris1/tris.md2", 1, chunkorigin); } } /* small chunks */ count = mass / 25; if (count > 16) { count = 16; } while (count--) { chunkorigin[0] = origin[0] + crandom() * size[0]; chunkorigin[1] = origin[1] + crandom() * size[1]; chunkorigin[2] = origin[2] + crandom() * size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", 2, chunkorigin); } G_UseTargets(self, attacker); if (self->dmg) { BecomeExplosion1(self); } else { G_FreeEdict(self); } } void func_explosive_use(edict_t *self, edict_t *other, edict_t *activator) { func_explosive_explode(self, self, other, self->health, vec3_origin); } void func_explosive_spawn(edict_t *self, edict_t *other, edict_t *activator) { self->solid = SOLID_BSP; self->svflags &= ~SVF_NOCLIENT; self->use = NULL; KillBox(self); gi.linkentity(self); } void SP_func_explosive(edict_t *self) { if (!self) { return; } if (deathmatch->value) { /* auto-remove for deathmatch */ G_FreeEdict(self); return; } self->movetype = MOVETYPE_PUSH; gi.modelindex("models/objects/debris1/tris.md2"); gi.modelindex("models/objects/debris2/tris.md2"); gi.setmodel(self, self->model); if (self->spawnflags & 1) { self->svflags |= SVF_NOCLIENT; self->solid = SOLID_NOT; self->use = func_explosive_spawn; } else { self->solid = SOLID_BSP; if (self->targetname) { self->use = func_explosive_use; } } if (self->spawnflags & 2) { self->s.effects |= EF_ANIM_ALL; } if (self->spawnflags & 4) { self->s.effects |= EF_ANIM_ALLFAST; } if (self->use != func_explosive_use) { if (!self->health) { self->health = 100; } self->die = func_explosive_explode; self->takedamage = DAMAGE_YES; } gi.linkentity(self); } /* ===================================================== */ /* * QUAKED misc_explobox (0 .5 .8) (-16 -16 0) (16 16 40) * Large exploding box. You can override its mass (100), * health (80), and dmg (150). */ void barrel_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf /*unused */) { float ratio; vec3_t v; if (!self || !other) { return; } if ((!other->groundentity) || (other->groundentity == self)) { return; } ratio = (float)other->mass / (float)self->mass; VectorSubtract(self->s.origin, other->s.origin, v); M_walkmove(self, vectoyaw(v), 20 * ratio * FRAMETIME); } void barrel_explode(edict_t *self) { vec3_t org; float spd; vec3_t save; if (!self) { return; } T_RadiusDamage(self, self->activator, self->dmg, NULL, self->dmg + 40, MOD_BARREL); VectorCopy(self->s.origin, save); VectorMA(self->absmin, 0.5, self->size, self->s.origin); /* a few big chunks */ spd = 1.5 * (float)self->dmg / 200.0; org[0] = self->s.origin[0] + crandom() * self->size[0]; org[1] = self->s.origin[1] + crandom() * self->size[1]; org[2] = self->s.origin[2] + crandom() * self->size[2]; ThrowDebris(self, "models/objects/debris1/tris.md2", spd, org); org[0] = self->s.origin[0] + crandom() * self->size[0]; org[1] = self->s.origin[1] + crandom() * self->size[1]; org[2] = self->s.origin[2] + crandom() * self->size[2]; ThrowDebris(self, "models/objects/debris1/tris.md2", spd, org); /* bottom corners */ spd = 1.75 * (float)self->dmg / 200.0; VectorCopy(self->absmin, org); ThrowDebris(self, "models/objects/debris3/tris.md2", spd, org); VectorCopy(self->absmin, org); org[0] += self->size[0]; ThrowDebris(self, "models/objects/debris3/tris.md2", spd, org); VectorCopy(self->absmin, org); org[1] += self->size[1]; ThrowDebris(self, "models/objects/debris3/tris.md2", spd, org); VectorCopy(self->absmin, org); org[0] += self->size[0]; org[1] += self->size[1]; ThrowDebris(self, "models/objects/debris3/tris.md2", spd, org); /* a bunch of little chunks */ spd = (float)(2 * self->dmg / 200); org[0] = self->s.origin[0] + crandom() * self->size[0]; org[1] = self->s.origin[1] + crandom() * self->size[1]; org[2] = self->s.origin[2] + crandom() * self->size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); org[0] = self->s.origin[0] + crandom() * self->size[0]; org[1] = self->s.origin[1] + crandom() * self->size[1]; org[2] = self->s.origin[2] + crandom() * self->size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); org[0] = self->s.origin[0] + crandom() * self->size[0]; org[1] = self->s.origin[1] + crandom() * self->size[1]; org[2] = self->s.origin[2] + crandom() * self->size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); org[0] = self->s.origin[0] + crandom() * self->size[0]; org[1] = self->s.origin[1] + crandom() * self->size[1]; org[2] = self->s.origin[2] + crandom() * self->size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); org[0] = self->s.origin[0] + crandom() * self->size[0]; org[1] = self->s.origin[1] + crandom() * self->size[1]; org[2] = self->s.origin[2] + crandom() * self->size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); org[0] = self->s.origin[0] + crandom() * self->size[0]; org[1] = self->s.origin[1] + crandom() * self->size[1]; org[2] = self->s.origin[2] + crandom() * self->size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); org[0] = self->s.origin[0] + crandom() * self->size[0]; org[1] = self->s.origin[1] + crandom() * self->size[1]; org[2] = self->s.origin[2] + crandom() * self->size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); org[0] = self->s.origin[0] + crandom() * self->size[0]; org[1] = self->s.origin[1] + crandom() * self->size[1]; org[2] = self->s.origin[2] + crandom() * self->size[2]; ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); VectorCopy(save, self->s.origin); if (self->groundentity) { BecomeExplosion2(self); } else { BecomeExplosion1(self); } } void barrel_delay(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker, int damage /* unused */, vec3_t point /* unused */) { if (!self || !attacker) { return; } self->takedamage = DAMAGE_NO; self->nextthink = level.time + 2 * FRAMETIME; self->think = barrel_explode; self->activator = attacker; } void SP_misc_explobox(edict_t *self) { if (!self) { return; } if (deathmatch->value) { /* auto-remove for deathmatch */ G_FreeEdict(self); return; } gi.modelindex("models/objects/debris1/tris.md2"); gi.modelindex("models/objects/debris2/tris.md2"); gi.modelindex("models/objects/debris3/tris.md2"); self->solid = SOLID_BBOX; self->movetype = MOVETYPE_STEP; self->model = "models/objects/barrels/tris.md2"; self->s.modelindex = gi.modelindex(self->model); VectorSet(self->mins, -16, -16, 0); VectorSet(self->maxs, 16, 16, 40); if (!self->mass) { self->mass = 400; } if (!self->health) { self->health = 10; } if (!self->dmg) { self->dmg = 150; } self->die = barrel_delay; self->takedamage = DAMAGE_YES; self->monsterinfo.aiflags = AI_NOSTEP; self->touch = barrel_touch; self->think = M_droptofloor; self->nextthink = level.time + 2 * FRAMETIME; gi.linkentity(self); } /* ===================================================== */ /* * QUAKED misc_blackhole (1 .5 0) (-8 -8 -8) (8 8 8) */ void misc_blackhole_use(edict_t *ent, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!ent) { return; } G_FreeEdict(ent); } void misc_blackhole_think(edict_t *self) { if (!self) { return; } if (++self->s.frame < 19) { self->nextthink = level.time + FRAMETIME; } else { self->s.frame = 0; self->nextthink = level.time + FRAMETIME; } } void misc_blackhole_transparent (edict_t *ent) { ent->s.renderfx = RF_TRANSLUCENT|RF_NOSHADOW; ent->prethink = NULL; gi.linkentity(ent); } void SP_misc_blackhole(edict_t *ent) { if (!ent) { return; } ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_NOT; VectorSet(ent->mins, -64, -64, 0); VectorSet(ent->maxs, 64, 64, 8); ent->s.modelindex = gi.modelindex("models/objects/black/tris.md2"); ent->s.renderfx = RF_TRANSLUCENT; ent->use = misc_blackhole_use; ent->think = misc_blackhole_think; ent->prethink = misc_blackhole_transparent; ent->nextthink = level.time + 2 * FRAMETIME; gi.linkentity(ent); } /* ===================================================== */ /* * QUAKED misc_eastertank (1 .5 0) (-32 -32 -16) (32 32 32) */ void misc_eastertank_think(edict_t *self) { if (!self) { return; } if (++self->s.frame < 293) { self->nextthink = level.time + FRAMETIME; } else { self->s.frame = 254; self->nextthink = level.time + FRAMETIME; } } void SP_misc_eastertank(edict_t *ent) { if (!ent) { return; } ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; VectorSet(ent->mins, -32, -32, -16); VectorSet(ent->maxs, 32, 32, 32); ent->s.modelindex = gi.modelindex("models/monsters/tank/tris.md2"); ent->s.frame = 254; ent->think = misc_eastertank_think; ent->nextthink = level.time + 2 * FRAMETIME; gi.linkentity(ent); } /* ===================================================== */ /* * QUAKED misc_easterchick (1 .5 0) (-32 -32 0) (32 32 32) */ void misc_easterchick_think(edict_t *self) { if (!self) { return; } if (++self->s.frame < 247) { self->nextthink = level.time + FRAMETIME; } else { self->s.frame = 208; self->nextthink = level.time + FRAMETIME; } } void SP_misc_easterchick(edict_t *ent) { if (!ent) { return; } ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; VectorSet(ent->mins, -32, -32, 0); VectorSet(ent->maxs, 32, 32, 32); ent->s.modelindex = gi.modelindex("models/monsters/bitch/tris.md2"); ent->s.frame = 208; ent->think = misc_easterchick_think; ent->nextthink = level.time + 2 * FRAMETIME; gi.linkentity(ent); } /* * QUAKED misc_easterchick2 (1 .5 0) (-32 -32 0) (32 32 32) */ void misc_easterchick2_think(edict_t *self) { if (!self) { return; } if (++self->s.frame < 287) { self->nextthink = level.time + FRAMETIME; } else { self->s.frame = 248; self->nextthink = level.time + FRAMETIME; } } void SP_misc_easterchick2(edict_t *ent) { if (!ent) { return; } ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; VectorSet(ent->mins, -32, -32, 0); VectorSet(ent->maxs, 32, 32, 32); ent->s.modelindex = gi.modelindex("models/monsters/bitch/tris.md2"); ent->s.frame = 248; ent->think = misc_easterchick2_think; ent->nextthink = level.time + 2 * FRAMETIME; gi.linkentity(ent); } /* ===================================================== */ /* * QUAKED monster_commander_body (1 .5 0) (-32 -32 0) (32 32 48) * Not really a monster, this is the Tank Commander's decapitated body. * There should be a item_commander_head that has this as it's target. */ void commander_body_think(edict_t *self) { if (!self) { return; } if (++self->s.frame < 24) { self->nextthink = level.time + FRAMETIME; } else { self->nextthink = 0; } if (self->s.frame == 22) { gi.sound(self, CHAN_BODY, gi.soundindex( "tank/thud.wav"), 1, ATTN_NORM, 0); } } void commander_body_use(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!self) { return; } self->think = commander_body_think; self->nextthink = level.time + FRAMETIME; gi.sound(self, CHAN_BODY, gi.soundindex("tank/pain.wav"), 1, ATTN_NORM, 0); } void commander_body_drop(edict_t *self) { if (!self) { return; } self->movetype = MOVETYPE_TOSS; self->s.origin[2] += 2; } void SP_monster_commander_body(edict_t *self) { if (!self) { return; } self->movetype = MOVETYPE_NONE; self->solid = SOLID_BBOX; self->model = "models/monsters/commandr/tris.md2"; self->s.modelindex = gi.modelindex(self->model); VectorSet(self->mins, -32, -32, 0); VectorSet(self->maxs, 32, 32, 48); self->use = commander_body_use; self->takedamage = DAMAGE_YES; self->flags = FL_GODMODE; self->s.renderfx |= RF_FRAMELERP; gi.linkentity(self); gi.soundindex("tank/thud.wav"); gi.soundindex("tank/pain.wav"); self->think = commander_body_drop; self->nextthink = level.time + 5 * FRAMETIME; } /* ===================================================== */ /* * QUAKED misc_banner (1 .5 0) (-4 -4 -4) (4 4 4) * The origin is the bottom of the banner. * The banner is 128 tall. */ void misc_banner_think(edict_t *ent) { if (!ent) { return; } ent->s.frame = (ent->s.frame + 1) % 16; ent->nextthink = level.time + FRAMETIME; } void SP_misc_banner(edict_t *ent) { if (!ent) { return; } ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_NOT; ent->s.modelindex = gi.modelindex("models/objects/banner/tris.md2"); ent->s.frame = rand() % 16; gi.linkentity(ent); ent->think = misc_banner_think; ent->nextthink = level.time + FRAMETIME; } /* ===================================================== */ /* * QUAKED misc_deadsoldier (1 .5 0) (-16 -16 0) (16 16 16) ON_BACK ON_STOMACH BACK_DECAP FETAL_POS SIT_DECAP IMPALED * This is the dead player model. Comes in 6 exciting different poses! */ void misc_deadsoldier_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point /* unused */) { int n; if (!self) { return; } if (self->health > -80) { return; } gi.sound(self, CHAN_BODY, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); } void SP_misc_deadsoldier(edict_t *ent) { if (!ent) { return; } if (deathmatch->value) { /* auto-remove for deathmatch */ G_FreeEdict(ent); return; } ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; ent->s.modelindex = gi.modelindex("models/deadbods/dude/tris.md2"); /* Defaults to frame 0 */ if (ent->spawnflags & 2) { ent->s.frame = 1; } else if (ent->spawnflags & 4) { ent->s.frame = 2; } else if (ent->spawnflags & 8) { ent->s.frame = 3; } else if (ent->spawnflags & 16) { ent->s.frame = 4; } else if (ent->spawnflags & 32) { ent->s.frame = 5; } else { ent->s.frame = 0; } VectorSet(ent->mins, -16, -16, 0); VectorSet(ent->maxs, 16, 16, 16); ent->deadflag = DEAD_DEAD; ent->takedamage = DAMAGE_YES; ent->svflags |= SVF_MONSTER | SVF_DEADMONSTER; ent->die = misc_deadsoldier_die; ent->monsterinfo.aiflags |= AI_GOOD_GUY; gi.linkentity(ent); } /* ===================================================== */ /* * QUAKED misc_viper (1 .5 0) (-16 -16 0) (16 16 32) * This is the Viper for the flyby bombing. * It is trigger_spawned, so you must have something use it for it to show up. * There must be a path for it to follow once it is activated. * * "speed" How fast the Viper should fly */ extern void train_use(edict_t *self, edict_t *other, edict_t *activator); extern void func_train_find(edict_t *self); void misc_viper_use(edict_t *self, edict_t *other, edict_t *activator) { if (!self || !other || !activator) { return; } self->svflags &= ~SVF_NOCLIENT; self->use = train_use; train_use(self, other, activator); } void SP_misc_viper(edict_t *ent) { if (!ent) { return; } if (!ent->target) { gi.dprintf("misc_viper without a target at %s\n", vtos(ent->absmin)); G_FreeEdict(ent); return; } if (!ent->speed) { ent->speed = 300; } ent->movetype = MOVETYPE_PUSH; ent->solid = SOLID_NOT; ent->s.modelindex = gi.modelindex("models/ships/viper/tris.md2"); VectorSet(ent->mins, -16, -16, 0); VectorSet(ent->maxs, 16, 16, 32); ent->think = func_train_find; ent->nextthink = level.time + FRAMETIME; ent->use = misc_viper_use; ent->svflags |= SVF_NOCLIENT; ent->moveinfo.accel = ent->moveinfo.decel = ent->moveinfo.speed = ent->speed; gi.linkentity(ent); } /* * QUAKED misc_crashviper (1 .5 0) (-176 -120 -24) (176 120 72) * This is a large viper about to crash */ void SP_misc_crashviper(edict_t *ent) { if (!ent) { return; } if (!ent->target) { gi.dprintf("misc_viper without a target at %s\n", vtos(ent->absmin)); G_FreeEdict(ent); return; } if (!ent->speed) { ent->speed = 300; } ent->movetype = MOVETYPE_PUSH; ent->solid = SOLID_NOT; ent->s.modelindex = gi.modelindex("models/ships/bigviper/tris.md2"); VectorSet(ent->mins, -16, -16, 0); VectorSet(ent->maxs, 16, 16, 32); ent->think = func_train_find; ent->nextthink = level.time + FRAMETIME; ent->use = misc_viper_use; ent->svflags |= SVF_NOCLIENT; ent->moveinfo.accel = ent->moveinfo.decel = ent->moveinfo.speed = ent->speed; gi.linkentity(ent); } /* * QUAKED misc_bigviper (1 .5 0) (-176 -120 -24) (176 120 72) * This is a large stationary viper as seen in Paul's intro */ void SP_misc_bigviper(edict_t *ent) { ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; VectorSet(ent->mins, -176, -120, -24); VectorSet(ent->maxs, 176, 120, 72); ent->s.modelindex = gi.modelindex("models/ships/bigviper/tris.md2"); gi.linkentity(ent); } /* ===================================================== */ /* * QUAKED misc_viper_bomb (1 0 0) (-8 -8 -8) (8 8 8) * "dmg" how much boom should the bomb make? */ void misc_viper_bomb_touch(edict_t *self, edict_t *other /* unused */, cplane_t *plane /* unused */, csurface_t *surf /* unused */) { if (!self) { return; } G_UseTargets(self, self->activator); self->s.origin[2] = self->absmin[2] + 1; T_RadiusDamage(self, self, self->dmg, NULL, self->dmg + 40, MOD_BOMB); BecomeExplosion2(self); } void misc_viper_bomb_prethink(edict_t *self) { vec3_t v; float diff; if (!self) { return; } self->groundentity = NULL; diff = self->timestamp - level.time; if (diff < -1.0) { diff = -1.0; } VectorScale(self->moveinfo.dir, 1.0 + diff, v); v[2] = diff; diff = self->s.angles[2]; vectoangles(v, self->s.angles); self->s.angles[2] = diff + 10; } void misc_viper_bomb_use(edict_t *self, edict_t *other /* unused */, edict_t *activator) { edict_t *viper; if (!self || !activator) { return; } self->solid = SOLID_BBOX; self->svflags &= ~SVF_NOCLIENT; self->s.effects |= EF_ROCKET; self->use = NULL; self->movetype = MOVETYPE_TOSS; self->prethink = misc_viper_bomb_prethink; self->touch = misc_viper_bomb_touch; self->activator = activator; viper = G_Find(NULL, FOFS(classname), "misc_viper"); VectorScale(viper->moveinfo.dir, viper->moveinfo.speed, self->velocity); self->timestamp = level.time; VectorCopy(viper->moveinfo.dir, self->moveinfo.dir); } void SP_misc_viper_bomb(edict_t *self) { if (!self) { return; } self->movetype = MOVETYPE_NONE; self->solid = SOLID_NOT; VectorSet(self->mins, -8, -8, -8); VectorSet(self->maxs, 8, 8, 8); self->s.modelindex = gi.modelindex("models/objects/bomb/tris.md2"); if (!self->dmg) { self->dmg = 1000; } self->use = misc_viper_bomb_use; self->svflags |= SVF_NOCLIENT; gi.linkentity(self); } /* * QUAKED misc_viper_missile (1 0 0) (-8 -8 -8) (8 8 8) * "dmg" how much boom should the bomb make? the default value is 250 */ void misc_viper_missile_use(edict_t *self, edict_t *other, edict_t *activator) { vec3_t forward, right, up; vec3_t start, dir; vec3_t vec; if (!self) { return; } AngleVectors(self->s.angles, forward, right, up); self->enemy = G_Find(NULL, FOFS(targetname), self->target); VectorCopy(self->enemy->s.origin, vec); VectorCopy(self->s.origin, start); VectorSubtract(vec, start, dir); VectorNormalize(dir); monster_fire_rocket(self, start, dir, self->dmg, 500, MZ2_CHICK_ROCKET_1); self->nextthink = level.time + 0.1; self->think = G_FreeEdict; } void SP_misc_viper_missile(edict_t *self) { if (!self) { return; } self->movetype = MOVETYPE_NONE; self->solid = SOLID_NOT; VectorSet(self->mins, -8, -8, -8); VectorSet(self->maxs, 8, 8, 8); if (!self->dmg) { self->dmg = 250; } self->s.modelindex = gi.modelindex("models/objects/bomb/tris.md2"); self->use = misc_viper_missile_use; self->svflags |= SVF_NOCLIENT; gi.linkentity(self); } /* * QUAKED misc_strogg_ship (1 .5 0) (-16 -16 0) (16 16 32) * This is a Storgg ship for the flybys. * It is trigger_spawned, so you must have something use it for it to show up. * There must be a path for it to follow once it is activated. * * "speed" How fast it should fly */ extern void train_use(edict_t *self, edict_t *other, edict_t *activator); extern void func_train_find(edict_t *self); void misc_strogg_ship_use(edict_t *self, edict_t *other /* other */, edict_t *activator) { if (!self || !activator) { return; } self->svflags &= ~SVF_NOCLIENT; self->use = train_use; train_use(self, other, activator); } void SP_misc_strogg_ship(edict_t *ent) { if (!ent) { return; } if (!ent->target) { gi.dprintf("%s without a target at %s\n", ent->classname, vtos(ent->absmin)); G_FreeEdict(ent); return; } if (!ent->speed) { ent->speed = 300; } ent->movetype = MOVETYPE_PUSH; ent->solid = SOLID_NOT; ent->s.modelindex = gi.modelindex("models/ships/strogg1/tris.md2"); VectorSet(ent->mins, -16, -16, 0); VectorSet(ent->maxs, 16, 16, 32); ent->think = func_train_find; ent->nextthink = level.time + FRAMETIME; ent->use = misc_strogg_ship_use; ent->svflags |= SVF_NOCLIENT; ent->moveinfo.accel = ent->moveinfo.decel = ent->moveinfo.speed = ent->speed; gi.linkentity(ent); } /* * QUAKED misc_transport (1 0 0) (-8 -8 -8) (8 8 8) TRIGGER_SPAWN * Maxx's transport at end of game */ void SP_misc_transport(edict_t *ent) { if (!ent) { return; } if (!ent->target) { gi.dprintf("%s without a target at %s\n", ent->classname, vtos(ent->absmin)); G_FreeEdict(ent); return; } if (!ent->speed) { ent->speed = 300; } ent->movetype = MOVETYPE_PUSH; ent->solid = SOLID_NOT; ent->s.modelindex = gi.modelindex("models/objects/ship/tris.md2"); VectorSet(ent->mins, -16, -16, 0); VectorSet(ent->maxs, 16, 16, 32); ent->think = func_train_find; ent->nextthink = level.time + FRAMETIME; ent->use = misc_strogg_ship_use; ent->svflags |= SVF_NOCLIENT; ent->moveinfo.accel = ent->moveinfo.decel = ent->moveinfo.speed = ent->speed; if (!(ent->spawnflags & 1)) { ent->spawnflags |= 1; } gi.linkentity(ent); } /* ===================================================== */ /* * QUAKED misc_satellite_dish (1 .5 0) (-64 -64 0) (64 64 128) */ void misc_satellite_dish_think(edict_t *self) { if (!self) { return; } self->s.frame++; if (self->s.frame < 38) { self->nextthink = level.time + FRAMETIME; } } void misc_satellite_dish_use(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!self) { return; } self->s.frame = 0; self->think = misc_satellite_dish_think; self->nextthink = level.time + FRAMETIME; } void SP_misc_satellite_dish(edict_t *ent) { if (!ent) { return; } ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; VectorSet(ent->mins, -64, -64, 0); VectorSet(ent->maxs, 64, 64, 128); ent->s.modelindex = gi.modelindex("models/objects/satellite/tris.md2"); ent->use = misc_satellite_dish_use; gi.linkentity(ent); } /* ===================================================== */ /* * QUAKED light_mine1 (0 1 0) (-2 -2 -12) (2 2 12) */ void SP_light_mine1(edict_t *ent) { if (!ent) { return; } ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; ent->s.modelindex = gi.modelindex("models/objects/minelite/light1/tris.md2"); gi.linkentity(ent); } /* * QUAKED light_mine2 (0 1 0) (-2 -2 -12) (2 2 12) */ void SP_light_mine2(edict_t *ent) { if (!ent) { return; } ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; ent->s.modelindex = gi.modelindex("models/objects/minelite/light2/tris.md2"); gi.linkentity(ent); } /* ===================================================== */ /* * QUAKED misc_gib_arm (1 0 0) (-8 -8 -8) (8 8 8) * Intended for use with the target_spawner */ void SP_misc_gib_arm(edict_t *ent) { if (!ent) { return; } gi.setmodel(ent, "models/objects/gibs/arm/tris.md2"); ent->solid = SOLID_BBOX; ent->s.effects |= EF_GIB; ent->takedamage = DAMAGE_YES; ent->die = gib_die; ent->movetype = MOVETYPE_TOSS; ent->svflags |= SVF_MONSTER; ent->deadflag = DEAD_DEAD; ent->avelocity[0] = random() * 200; ent->avelocity[1] = random() * 200; ent->avelocity[2] = random() * 200; ent->think = G_FreeEdict; ent->nextthink = level.time + 30; gi.linkentity(ent); } /* * QUAKED misc_gib_leg (1 0 0) (-8 -8 -8) (8 8 8) * Intended for use with the target_spawner */ void SP_misc_gib_leg(edict_t *ent) { if (!ent) { return; } gi.setmodel(ent, "models/objects/gibs/leg/tris.md2"); ent->solid = SOLID_BBOX; ent->s.effects |= EF_GIB; ent->takedamage = DAMAGE_YES; ent->die = gib_die; ent->movetype = MOVETYPE_TOSS; ent->svflags |= SVF_MONSTER; ent->deadflag = DEAD_DEAD; ent->avelocity[0] = random() * 200; ent->avelocity[1] = random() * 200; ent->avelocity[2] = random() * 200; ent->think = G_FreeEdict; ent->nextthink = level.time + 30; gi.linkentity(ent); } /* * QUAKED misc_gib_head (1 0 0) (-8 -8 -8) (8 8 8) * Intended for use with the target_spawner */ void SP_misc_gib_head(edict_t *ent) { if (!ent) { return; } gi.setmodel(ent, "models/objects/gibs/head/tris.md2"); ent->solid = SOLID_BBOX; ent->s.effects |= EF_GIB; ent->takedamage = DAMAGE_YES; ent->die = gib_die; ent->movetype = MOVETYPE_TOSS; ent->svflags |= SVF_MONSTER; ent->deadflag = DEAD_DEAD; ent->avelocity[0] = random() * 200; ent->avelocity[1] = random() * 200; ent->avelocity[2] = random() * 200; ent->think = G_FreeEdict; ent->nextthink = level.time + 30; gi.linkentity(ent); } /* ===================================================== */ /* * QUAKED target_character (0 0 1) ? * used with target_string (must be on same "team") * "count" is position in the string (starts at 1) */ void SP_target_character(edict_t *self) { if (!self) { return; } self->movetype = MOVETYPE_PUSH; gi.setmodel(self, self->model); self->solid = SOLID_BSP; self->s.frame = 12; gi.linkentity(self); return; } /* ===================================================== */ /* * QUAKED target_string (0 0 1) (-8 -8 -8) (8 8 8) */ void target_string_use(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { edict_t *e; int n, l; char c; if (!self) { return; } l = strlen(self->message); for (e = self->teammaster; e; e = e->teamchain) { if (!e->count) { continue; } n = e->count - 1; if (n > l) { e->s.frame = 12; continue; } c = self->message[n]; if ((c >= '0') && (c <= '9')) { e->s.frame = c - '0'; } else if (c == '-') { e->s.frame = 10; } else if (c == ':') { e->s.frame = 11; } else { e->s.frame = 12; } } } void SP_target_string(edict_t *self) { if (!self->message) { self->message = ""; } self->use = target_string_use; } /* ===================================================== */ /* * QUAKED func_clock (0 0 1) (-8 -8 -8) (8 8 8) TIMER_UP TIMER_DOWN START_OFF MULTI_USE * target a target_string with this * * The default is to be a time of day clock * * TIMER_UP and TIMER_DOWN run for "count" seconds and the fire "pathtarget" * If START_OFF, this entity must be used before it starts * * "style" 0 "xx" * 1 "xx:xx" * 2 "xx:xx:xx" */ #define CLOCK_MESSAGE_SIZE 16 /* don't let field width of any clock messages change, or it could cause an overwrite after a game load */ void func_clock_reset(edict_t *self) { if (!self) { return; } self->activator = NULL; if (self->spawnflags & 1) { self->health = 0; self->wait = self->count; } else if (self->spawnflags & 2) { self->health = self->count; self->wait = 0; } } void func_clock_format_countdown(edict_t *self) { if (!self) { return; } if (self->style == 0) { Com_sprintf(self->message, CLOCK_MESSAGE_SIZE, "%2i", self->health); return; } if (self->style == 1) { Com_sprintf(self->message, CLOCK_MESSAGE_SIZE, "%2i:%2i", self->health / 60, self->health % 60); if (self->message[3] == ' ') { self->message[3] = '0'; } return; } if (self->style == 2) { Com_sprintf(self->message, CLOCK_MESSAGE_SIZE, "%2i:%2i:%2i", self->health / 3600, (self->health - (self->health / 3600) * 3600) / 60, self->health % 60); if (self->message[3] == ' ') { self->message[3] = '0'; } if (self->message[6] == ' ') { self->message[6] = '0'; } return; } } void func_clock_think(edict_t *self) { if (!self) { return; } if (!self->enemy) { self->enemy = G_Find(NULL, FOFS(targetname), self->target); if (!self->enemy) { return; } } if (self->spawnflags & 1) { func_clock_format_countdown(self); self->health++; } else if (self->spawnflags & 2) { func_clock_format_countdown(self); self->health--; } else { struct tm *ltime; time_t gmtime; time(&gmtime); ltime = localtime(&gmtime); Com_sprintf(self->message, CLOCK_MESSAGE_SIZE, "%2i:%2i:%2i", ltime->tm_hour, ltime->tm_min, ltime->tm_sec); if (self->message[3] == ' ') { self->message[3] = '0'; } if (self->message[6] == ' ') { self->message[6] = '0'; } } self->enemy->message = self->message; self->enemy->use(self->enemy, self, self); if (((self->spawnflags & 1) && (self->health > self->wait)) || ((self->spawnflags & 2) && (self->health < self->wait))) { if (self->pathtarget) { char *savetarget; char *savemessage; savetarget = self->target; savemessage = self->message; self->target = self->pathtarget; self->message = NULL; G_UseTargets(self, self->activator); self->target = savetarget; self->message = savemessage; } if (!(self->spawnflags & 8)) { self->think = G_FreeEdict; self->nextthink = level.time + 1; return; } func_clock_reset(self); if (self->spawnflags & 4) { return; } } self->nextthink = level.time + 1; } void func_clock_use(edict_t *self, edict_t *other /* unused */, edict_t *activator) { if (!self || !activator) { return; } if (!(self->spawnflags & 8)) { self->use = NULL; } if (self->activator) { return; } self->activator = activator; self->think(self); } void SP_func_clock(edict_t *self) { if (!self) { return; } if (!self->target) { gi.dprintf("%s with no target at %s\n", self->classname, vtos(self->s.origin)); G_FreeEdict(self); return; } if ((self->spawnflags & 2) && (!self->count)) { gi.dprintf("%s with no count at %s\n", self->classname, vtos(self->s.origin)); G_FreeEdict(self); return; } if ((self->spawnflags & 1) && (!self->count)) { self->count = 60 * 60; } func_clock_reset(self); self->message = gi.TagMalloc(CLOCK_MESSAGE_SIZE, TAG_LEVEL); self->think = func_clock_think; if (self->spawnflags & 4) { self->use = func_clock_use; } else { self->nextthink = level.time + 1; } } /* ================================================================================= */ void teleporter_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf /* unused */) { edict_t *dest; int i; if (!self || !other) { return; } if (!other->client) { return; } dest = G_Find(NULL, FOFS(targetname), self->target); if (!dest) { gi.dprintf("Couldn't find destination\n"); return; } /* unlink to make sure it can't possibly interfere with KillBox */ gi.unlinkentity(other); VectorCopy(dest->s.origin, other->s.origin); VectorCopy(dest->s.origin, other->s.old_origin); other->s.origin[2] += 10; /* clear the velocity and hold them in place briefly */ VectorClear(other->velocity); other->client->ps.pmove.pm_time = 160 >> 3; /* hold time */ other->client->ps.pmove.pm_flags |= PMF_TIME_TELEPORT; /* draw the teleport splash at source and on the player */ self->owner->s.event = EV_PLAYER_TELEPORT; other->s.event = EV_PLAYER_TELEPORT; /* set angles */ for (i = 0; i < 3; i++) { other->client->ps.pmove.delta_angles[i] = ANGLE2SHORT( dest->s.angles[i] - other->client->resp.cmd_angles[i]); } VectorClear(other->s.angles); VectorClear(other->client->ps.viewangles); VectorClear(other->client->v_angle); /* kill anything at the destination */ KillBox(other); gi.linkentity(other); } /* * QUAKED misc_teleporter (1 0 0) (-32 -32 -24) (32 32 -16) * Stepping onto this disc will teleport players to the targeted misc_teleporter_dest object. */ void SP_misc_teleporter(edict_t *ent) { if (!ent) { return; } edict_t *trig; if (!ent->target) { gi.dprintf("teleporter without a target.\n"); G_FreeEdict(ent); return; } gi.setmodel(ent, "models/objects/dmspot/tris.md2"); ent->s.skinnum = 1; ent->s.effects = EF_TELEPORTER; ent->s.sound = gi.soundindex("world/amb10.wav"); ent->solid = SOLID_BBOX; VectorSet(ent->mins, -32, -32, -24); VectorSet(ent->maxs, 32, 32, -16); gi.linkentity(ent); trig = G_Spawn(); trig->touch = teleporter_touch; trig->solid = SOLID_TRIGGER; trig->target = ent->target; trig->owner = ent; VectorCopy(ent->s.origin, trig->s.origin); VectorSet(trig->mins, -8, -8, 8); VectorSet(trig->maxs, 8, 8, 24); gi.linkentity(trig); } /* * QUAKED misc_teleporter_dest (1 0 0) (-32 -32 -24) (32 32 -16) * Point teleporters at these. */ void SP_misc_teleporter_dest(edict_t *ent) { if (!ent) { return; } gi.setmodel(ent, "models/objects/dmspot/tris.md2"); ent->s.skinnum = 0; ent->solid = SOLID_BBOX; VectorSet(ent->mins, -32, -32, -24); VectorSet(ent->maxs, 32, 32, -16); gi.linkentity(ent); } /* * QUAKED misc_amb4 (1 0 0) (-16 -16 -16) (16 16 16) * Mal's amb4 loop entity */ static int amb4sound; void amb4_think(edict_t *ent) { if (!ent) { return; } ent->nextthink = level.time + 2.0; gi.sound(ent, CHAN_VOICE, amb4sound, 1, ATTN_NONE, 0); } void SP_misc_amb4(edict_t *ent) { if (!ent) { return; } ent->think = amb4_think; ent->nextthink = level.time + 1; amb4sound = gi.soundindex("world/amb4.wav"); gi.linkentity(ent); } /* * QUAKED misc_nuke (1 0 0) (-16 -16 -16) (16 16 16) */ void use_nuke(edict_t *self, edict_t *other, edict_t *activator) { edict_t *from = g_edicts; if (!self) { return; } for ( ; from < &g_edicts[globals.num_edicts]; from++) { if (from == self) { continue; } if (from->client) { T_Damage(from, self, self, vec3_origin, from->s.origin, vec3_origin, 100000, 1, 0, MOD_TRAP); } else if (from->svflags & SVF_MONSTER) { G_FreeEdict(from); } } self->use = NULL; } void SP_misc_nuke(edict_t *ent) { if (!ent) { return; } ent->use = use_nuke; } xatrix-XATRIX_2_14/src/g_monster.c000066400000000000000000000533041477320050300170750ustar00rootroot00000000000000/* ======================================================================= * * Monster utility functions. * * ======================================================================= */ #include "header/local.h" void monster_start_go(edict_t *self); /* Monster weapons */ void monster_fire_bullet(edict_t *self, vec3_t start, vec3_t dir, int damage, int kick, int hspread, int vspread, int flashtype) { if (!self) { return; } fire_bullet(self, start, dir, damage, kick, hspread, vspread, MOD_UNKNOWN); gi.WriteByte(svc_muzzleflash2); gi.WriteShort(self - g_edicts); gi.WriteByte(flashtype); gi.multicast(start, MULTICAST_PVS); } void monster_fire_shotgun(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count, int flashtype) { if (!self) { return; } fire_shotgun(self, start, aimdir, damage, kick, hspread, vspread, count, MOD_UNKNOWN); gi.WriteByte(svc_muzzleflash2); gi.WriteShort(self - g_edicts); gi.WriteByte(flashtype); gi.multicast(start, MULTICAST_PVS); } void monster_fire_blaster(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, int effect) { if (!self) { return; } fire_blaster(self, start, dir, damage, speed, effect, false); gi.WriteByte(svc_muzzleflash2); gi.WriteShort(self - g_edicts); gi.WriteByte(flashtype); gi.multicast(start, MULTICAST_PVS); } void monster_fire_blueblaster(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, int effect) { if (!self) { return; } fire_blueblaster(self, start, dir, damage, speed, effect); gi.WriteByte(svc_muzzleflash2); gi.WriteShort(self - g_edicts); gi.WriteByte(MZ_BLUEHYPERBLASTER); gi.multicast(start, MULTICAST_PVS); } void monster_fire_ionripper(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, int effect) { if (!self) { return; } fire_ionripper(self, start, dir, damage, speed, effect); gi.WriteByte(svc_muzzleflash2); gi.WriteShort(self - g_edicts); gi.WriteByte(flashtype); gi.multicast(start, MULTICAST_PVS); } void monster_fire_heat(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype) { if (!self) { return; } fire_heat(self, start, dir, damage, speed, damage, damage); gi.WriteByte(svc_muzzleflash2); gi.WriteShort(self - g_edicts); gi.WriteByte(flashtype); gi.multicast(start, MULTICAST_PVS); } void dabeam_hit(edict_t *self) { edict_t *ignore; vec3_t start; vec3_t end; trace_t tr; if (!self) { return; } ignore = self; VectorCopy(self->s.origin, start); VectorMA(start, 2048, self->movedir, end); while (1) { tr = gi.trace(start, NULL, NULL, end, ignore, CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_DEADMONSTER); if (!tr.ent) { break; } /* hurt it if we can */ if ((tr.ent->takedamage) && !(tr.ent->flags & FL_IMMUNE_LASER) && (tr.ent != self->owner)) { T_Damage(tr.ent, self, self->owner, self->movedir, tr.endpos, vec3_origin, self->dmg, skill->value, DAMAGE_ENERGY, MOD_TARGET_LASER); } if (self->dmg < 0) /* healer ray */ { /* when player is at 100 health just undo health fix */ if (tr.ent->client && (tr.ent->health > 100)) { tr.ent->health += self->dmg; } } /* if we hit something that's not a monster or player or is immune to lasers, we're done */ if (!(tr.ent->svflags & SVF_MONSTER) && (!tr.ent->client)) { if (self->spawnflags & 0x80000000) { self->spawnflags &= ~0x80000000; gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_LASER_SPARKS); gi.WriteByte(10); gi.WritePosition(tr.endpos); gi.WriteDir(tr.plane.normal); gi.WriteByte(self->s.skinnum); gi.multicast(tr.endpos, MULTICAST_PVS); } break; } ignore = tr.ent; VectorCopy(tr.endpos, start); } VectorCopy(tr.endpos, self->s.old_origin); self->nextthink = level.time + 0.1; self->think = G_FreeEdict; } void monster_dabeam(edict_t *self) { vec3_t last_movedir; vec3_t point; if (!self) { return; } self->movetype = MOVETYPE_NONE; self->solid = SOLID_NOT; self->s.renderfx |= RF_BEAM | RF_TRANSLUCENT; self->s.modelindex = 1; self->s.frame = 2; if (self->owner->monsterinfo.aiflags & AI_MEDIC) { self->s.skinnum = 0xf3f3f1f1; } else { self->s.skinnum = 0xf2f2f0f0; } if (self->enemy) { VectorCopy(self->movedir, last_movedir); VectorMA(self->enemy->absmin, 0.5, self->enemy->size, point); if (self->owner->monsterinfo.aiflags & AI_MEDIC) { point[0] += sin(level.time) * 8; } VectorSubtract(point, self->s.origin, self->movedir); VectorNormalize(self->movedir); if (!VectorCompare(self->movedir, last_movedir)) { self->spawnflags |= 0x80000000; } } else { G_SetMovedir(self->s.angles, self->movedir); } self->think = dabeam_hit; self->nextthink = level.time + 0.1; VectorSet(self->mins, -8, -8, -8); VectorSet(self->maxs, 8, 8, 8); gi.linkentity(self); self->spawnflags |= 0x80000001; self->svflags &= ~SVF_NOCLIENT; } void monster_fire_grenade(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int flashtype) { if (!self) { return; } fire_grenade(self, start, aimdir, damage, speed, 2.5, damage + 40); gi.WriteByte(svc_muzzleflash2); gi.WriteShort(self - g_edicts); gi.WriteByte(flashtype); gi.multicast(start, MULTICAST_PVS); } void monster_fire_rocket(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype) { if (!self) { return; } fire_rocket(self, start, dir, damage, speed, damage + 20, damage); gi.WriteByte(svc_muzzleflash2); gi.WriteShort(self - g_edicts); gi.WriteByte(flashtype); gi.multicast(start, MULTICAST_PVS); } void monster_fire_railgun(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int flashtype) { if (!self) { return; } fire_rail(self, start, aimdir, damage, kick); gi.WriteByte(svc_muzzleflash2); gi.WriteShort(self - g_edicts); gi.WriteByte(flashtype); gi.multicast(start, MULTICAST_PVS); } void monster_fire_bfg(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int kick, float damage_radius, int flashtype) { if (!self) { return; } fire_bfg(self, start, aimdir, damage, speed, damage_radius); gi.WriteByte(svc_muzzleflash2); gi.WriteShort(self - g_edicts); gi.WriteByte(flashtype); gi.multicast(start, MULTICAST_PVS); } /* Monster utility functions */ void M_FliesOff(edict_t *self) { if (!self) { return; } self->s.effects &= ~EF_FLIES; self->s.sound = 0; } void M_FliesOn(edict_t *self) { if (!self) { return; } if (self->waterlevel) { return; } self->s.effects |= EF_FLIES; self->s.sound = gi.soundindex("infantry/inflies1.wav"); self->think = M_FliesOff; self->nextthink = level.time + 60; } void M_FlyCheck(edict_t *self) { if (!self) { return; } if (self->waterlevel) { return; } if (random() > 0.5) { return; } self->think = M_FliesOn; self->nextthink = level.time + 5 + 10 * random(); } void AttackFinished(edict_t *self, float time) { if (!self) { return; } self->monsterinfo.attack_finished = level.time + time; } void M_CheckGround(edict_t *ent) { vec3_t point; trace_t trace; if (!ent) { return; } if (ent->flags & (FL_SWIM | FL_FLY)) { return; } if (ent->velocity[2] > 100) { ent->groundentity = NULL; return; } /* if the hull point one-quarter unit down is solid the entity is on ground */ point[0] = ent->s.origin[0]; point[1] = ent->s.origin[1]; point[2] = ent->s.origin[2] - 0.25; trace = gi.trace(ent->s.origin, ent->mins, ent->maxs, point, ent, MASK_MONSTERSOLID); /* check steepness */ if ((trace.plane.normal[2] < 0.7) && !trace.startsolid) { ent->groundentity = NULL; return; } if (!trace.startsolid && !trace.allsolid) { VectorCopy(trace.endpos, ent->s.origin); ent->groundentity = trace.ent; ent->groundentity_linkcount = trace.ent->linkcount; ent->velocity[2] = 0; } } void M_CatagorizePosition(edict_t *ent) { vec3_t point; int cont; if (!ent) { return; } /* get waterlevel */ point[0] = (ent->absmax[0] + ent->absmin[0])/2; point[1] = (ent->absmax[1] + ent->absmin[1])/2; point[2] = ent->absmin[2] + 2; cont = gi.pointcontents(point); if (!(cont & MASK_WATER)) { ent->waterlevel = 0; ent->watertype = 0; return; } ent->watertype = cont; ent->waterlevel = 1; point[2] += 26; cont = gi.pointcontents(point); if (!(cont & MASK_WATER)) { return; } ent->waterlevel = 2; point[2] += 22; cont = gi.pointcontents(point); if (cont & MASK_WATER) { ent->waterlevel = 3; } } void M_WorldEffects(edict_t *ent) { int dmg; if (!ent) { return; } if (ent->health > 0) { if (!(ent->flags & FL_SWIM)) { if (ent->waterlevel < 3) { ent->air_finished = level.time + 12; } else if (ent->air_finished < level.time) { /* drown! */ if (ent->pain_debounce_time < level.time) { dmg = 2 + 2 * floor(level.time - ent->air_finished); if (dmg > 15) { dmg = 15; } T_Damage(ent, world, world, vec3_origin, ent->s.origin, vec3_origin, dmg, 0, DAMAGE_NO_ARMOR, MOD_WATER); ent->pain_debounce_time = level.time + 1; } } } else { if (ent->waterlevel > 0) { ent->air_finished = level.time + 9; } else if (ent->air_finished < level.time) { /* suffocate! */ if (ent->pain_debounce_time < level.time) { dmg = 2 + 2 * floor(level.time - ent->air_finished); if (dmg > 15) { dmg = 15; } T_Damage(ent, world, world, vec3_origin, ent->s.origin, vec3_origin, dmg, 0, DAMAGE_NO_ARMOR, MOD_WATER); ent->pain_debounce_time = level.time + 1; } } } } if (ent->waterlevel == 0) { if (ent->flags & FL_INWATER) { gi.sound(ent, CHAN_BODY, gi.soundindex( "player/watr_out.wav"), 1, ATTN_NORM, 0); ent->flags &= ~FL_INWATER; } return; } if ((ent->watertype & CONTENTS_LAVA) && !(ent->flags & FL_IMMUNE_LAVA)) { if (ent->damage_debounce_time < level.time) { ent->damage_debounce_time = level.time + 0.2; T_Damage(ent, world, world, vec3_origin, ent->s.origin, vec3_origin, 10 * ent->waterlevel, 0, 0, MOD_LAVA); } } if ((ent->watertype & CONTENTS_SLIME) && !(ent->flags & FL_IMMUNE_SLIME)) { if (ent->damage_debounce_time < level.time) { ent->damage_debounce_time = level.time + 1; T_Damage(ent, world, world, vec3_origin, ent->s.origin, vec3_origin, 4 * ent->waterlevel, 0, 0, MOD_SLIME); } } if (!(ent->flags & FL_INWATER)) { if (!(ent->svflags & SVF_DEADMONSTER)) { if (ent->watertype & CONTENTS_LAVA) { if (random() <= 0.5) { gi.sound(ent, CHAN_BODY, gi.soundindex( "player/lava1.wav"), 1, ATTN_NORM, 0); } else { gi.sound(ent, CHAN_BODY, gi.soundindex("player/lava2.wav"), 1, ATTN_NORM, 0); } } else if (ent->watertype & CONTENTS_SLIME) { gi.sound(ent, CHAN_BODY, gi.soundindex("player/watr_in.wav"), 1, ATTN_NORM, 0); } else if (ent->watertype & CONTENTS_WATER) { gi.sound(ent, CHAN_BODY, gi.soundindex("player/watr_in.wav"), 1, ATTN_NORM, 0); } } ent->flags |= FL_INWATER; ent->damage_debounce_time = 0; } } void M_droptofloor(edict_t *ent) { vec3_t end; trace_t trace; if (!ent) { return; } ent->s.origin[2] += 1; VectorCopy(ent->s.origin, end); end[2] -= 256; trace = gi.trace(ent->s.origin, ent->mins, ent->maxs, end, ent, MASK_MONSTERSOLID); if ((trace.fraction == 1) || trace.allsolid) { return; } VectorCopy(trace.endpos, ent->s.origin); gi.linkentity(ent); M_CheckGround(ent); M_CatagorizePosition(ent); } void M_SetEffects(edict_t *ent) { if (!ent) { return; } ent->s.effects &= ~(EF_COLOR_SHELL | EF_POWERSCREEN); ent->s.renderfx &= ~(RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE); if (ent->monsterinfo.aiflags & AI_RESURRECTING) { ent->s.effects |= EF_COLOR_SHELL; ent->s.renderfx |= RF_SHELL_RED; } if (ent->health <= 0) { return; } if (ent->powerarmor_time > level.time) { if (ent->monsterinfo.power_armor_type == POWER_ARMOR_SCREEN) { ent->s.effects |= EF_POWERSCREEN; } else if (ent->monsterinfo.power_armor_type == POWER_ARMOR_SHIELD) { ent->s.effects |= EF_COLOR_SHELL; ent->s.renderfx |= RF_SHELL_GREEN; } } } void M_MoveFrame(edict_t *self) { mmove_t *move; int index; if (!self) { return; } move = self->monsterinfo.currentmove; self->nextthink = level.time + FRAMETIME; if ((self->monsterinfo.nextframe) && (self->monsterinfo.nextframe >= move->firstframe) && (self->monsterinfo.nextframe <= move->lastframe)) { if (self->s.frame != self->monsterinfo.nextframe) { self->s.frame = self->monsterinfo.nextframe; self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; } self->monsterinfo.nextframe = 0; } else { /* prevent nextframe from leaking into a future move */ self->monsterinfo.nextframe = 0; if (self->s.frame == move->lastframe) { if (move->endfunc) { move->endfunc(self); /* regrab move, endfunc is very likely to change it */ move = self->monsterinfo.currentmove; /* check for death */ if (self->svflags & SVF_DEADMONSTER) { return; } } } if ((self->s.frame < move->firstframe) || (self->s.frame > move->lastframe)) { self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; self->s.frame = move->firstframe; } else { if (!(self->monsterinfo.aiflags & AI_HOLD_FRAME)) { self->s.frame++; if (self->s.frame > move->lastframe) { self->s.frame = move->firstframe; } } } } index = self->s.frame - move->firstframe; if (move->frame[index].aifunc) { if (!(self->monsterinfo.aiflags & AI_HOLD_FRAME)) { move->frame[index].aifunc(self, move->frame[index].dist * self->monsterinfo.scale); } else { move->frame[index].aifunc(self, 0); } } if (move->frame[index].thinkfunc) { move->frame[index].thinkfunc(self); } } void monster_think(edict_t *self) { if (!self) { return; } M_MoveFrame(self); if (self->linkcount != self->monsterinfo.linkcount) { self->monsterinfo.linkcount = self->linkcount; M_CheckGround(self); } M_CatagorizePosition(self); M_WorldEffects(self); M_SetEffects(self); } /* * Using a monster makes it angry * at the current activator */ void monster_use(edict_t *self, edict_t *other /* unused */, edict_t *activator) { if (!self || !activator) { return; } if (self->enemy) { return; } if (self->health <= 0) { return; } if (activator->flags & FL_NOTARGET) { return; } if (!(activator->client) && !(activator->monsterinfo.aiflags & AI_GOOD_GUY)) { return; } /* delay reaction so if the monster is teleported, its sound is still heard */ self->enemy = activator; FoundTarget(self); } void monster_triggered_spawn(edict_t *self) { if (!self) { return; } self->s.origin[2] += 1; KillBox(self); self->solid = SOLID_BBOX; self->movetype = MOVETYPE_STEP; self->svflags &= ~SVF_NOCLIENT; self->air_finished = level.time + 12; gi.linkentity(self); monster_start_go(self); if (strcmp(self->classname, "monster_fixbot") == 0) { if (self->spawnflags & 16 || self->spawnflags & 8 || self->spawnflags & 4) { self->enemy = NULL; return; } } if (self->enemy && !(self->spawnflags & 1) && !(self->enemy->flags & FL_NOTARGET)) { FoundTarget(self); } else { self->enemy = NULL; } } void monster_triggered_spawn_use(edict_t *self, edict_t *other /* unused */, edict_t *activator) { if (!self || !activator) { return; } /* we have a one frame delay here so we don't telefrag the guy who activated us */ self->think = monster_triggered_spawn; self->nextthink = level.time + FRAMETIME; if (activator->client) { self->enemy = activator; } self->use = monster_use; } void monster_triggered_start(edict_t *self) { if (!self) { return; } self->solid = SOLID_NOT; self->movetype = MOVETYPE_NONE; self->svflags |= SVF_NOCLIENT; self->nextthink = 0; self->use = monster_triggered_spawn_use; } /* * When a monster dies, it fires all of its * targets with the current enemy as activator. */ void monster_death_use(edict_t *self) { if (!self) { return; } self->flags &= ~(FL_FLY | FL_SWIM); self->monsterinfo.aiflags &= AI_GOOD_GUY; if (self->item) { Drop_Item(self, self->item); self->item = NULL; } if (self->deathtarget) { self->target = self->deathtarget; } if (!self->target) { return; } G_UseTargets(self, self->enemy); } qboolean monster_start(edict_t *self) { if (!self) { return false; } if (deathmatch->value) { G_FreeEdict(self); return false; } if ((self->spawnflags & 4) && !(self->monsterinfo.aiflags & AI_GOOD_GUY)) { self->spawnflags &= ~4; self->spawnflags |= 1; } if ((self->spawnflags & 2) && !self->targetname) { if (g_fix_triggered->value) { self->spawnflags &= ~2; } gi.dprintf ("triggered %s at %s has no targetname\n", self->classname, vtos (self->s.origin)); } if (!(self->monsterinfo.aiflags & AI_GOOD_GUY)) { level.total_monsters++; } self->nextthink = level.time + FRAMETIME; self->svflags |= SVF_MONSTER; self->s.renderfx |= RF_FRAMELERP; self->takedamage = DAMAGE_AIM; self->air_finished = level.time + 12; self->use = monster_use; if(!self->max_health) { self->max_health = self->health; } self->clipmask = MASK_MONSTERSOLID; self->s.skinnum = 0; self->deadflag = DEAD_NO; self->svflags &= ~SVF_DEADMONSTER; if (!self->monsterinfo.checkattack) { self->monsterinfo.checkattack = M_CheckAttack; } VectorCopy(self->s.origin, self->s.old_origin); if (st.item) { self->item = FindItemByClassname(st.item); if (!self->item) { gi.dprintf("%s at %s has bad item: %s\n", self->classname, vtos(self->s.origin), st.item); } } /* randomize what frame they start on */ if (self->monsterinfo.currentmove) { self->s.frame = self->monsterinfo.currentmove->firstframe + (rand() % (self->monsterinfo.currentmove->lastframe - self->monsterinfo.currentmove->firstframe + 1)); } return true; } void monster_start_go(edict_t *self) { vec3_t v; if (!self) { return; } if (self->health <= 0) { return; } /* check for target to combat_point and change to combattarget */ if (self->target) { qboolean notcombat; qboolean fixup; edict_t *target; target = NULL; notcombat = false; fixup = false; while ((target = G_Find(target, FOFS(targetname), self->target)) != NULL) { if (strcmp(target->classname, "point_combat") == 0) { self->combattarget = self->target; fixup = true; } else { notcombat = true; } } if (notcombat && self->combattarget) { gi.dprintf("%s at %s has target with mixed types\n", self->classname, vtos(self->s.origin)); } if (fixup) { self->target = NULL; } } /* validate combattarget */ if (self->combattarget) { edict_t *target; target = NULL; while ((target = G_Find(target, FOFS(targetname), self->combattarget)) != NULL) { if (strcmp(target->classname, "point_combat") != 0) { gi.dprintf("%s at (%i %i %i) has a bad combattarget %s : %s at (%i %i %i)\n", self->classname, (int)self->s.origin[0], (int)self->s.origin[1], (int)self->s.origin[2], self->combattarget, target->classname, (int)target->s.origin[0], (int)target->s.origin[1], (int)target->s.origin[2]); } } } if (self->target) { self->goalentity = self->movetarget = G_PickTarget(self->target); if (!self->movetarget) { gi.dprintf("%s can't find target %s at %s\n", self->classname, self->target, vtos(self->s.origin)); self->target = NULL; self->monsterinfo.pausetime = 100000000; self->monsterinfo.stand(self); } else if (strcmp(self->movetarget->classname, "path_corner") == 0) { VectorSubtract(self->goalentity->s.origin, self->s.origin, v); self->ideal_yaw = self->s.angles[YAW] = vectoyaw(v); self->monsterinfo.walk(self); self->target = NULL; } else { self->goalentity = self->movetarget = NULL; self->monsterinfo.pausetime = 100000000; self->monsterinfo.stand(self); } } else { self->monsterinfo.pausetime = 100000000; self->monsterinfo.stand(self); } self->think = monster_think; self->nextthink = level.time + FRAMETIME; } void walkmonster_start_go(edict_t *self) { if (!self) { return; } if (!(self->spawnflags & 2) && (level.time < 1)) { M_droptofloor(self); if (self->groundentity) { if (!M_walkmove(self, 0, 0)) { gi.dprintf("%s in solid at %s\n", self->classname, vtos(self->s.origin)); } } } if (!self->yaw_speed) { self->yaw_speed = 20; } if (!self->viewheight) { self->viewheight = 25; } if (self->spawnflags & 2) { monster_triggered_start(self); } else { monster_start_go(self); } } void walkmonster_start(edict_t *self) { if (!self) { return; } self->think = walkmonster_start_go; monster_start(self); } void flymonster_start_go(edict_t *self) { if (!self) { return; } if (!M_walkmove(self, 0, 0)) { gi.dprintf("%s in solid at %s\n", self->classname, vtos(self->s.origin)); } if (!self->yaw_speed) { self->yaw_speed = 10; } if (!self->viewheight) { self->viewheight = 25; } if (self->spawnflags & 2) { monster_triggered_start(self); } else { monster_start_go(self); } } void flymonster_start(edict_t *self) { if (!self) { return; } self->flags |= FL_FLY; self->think = flymonster_start_go; monster_start(self); } void swimmonster_start_go(edict_t *self) { if (!self) { return; } if (!self->yaw_speed) { self->yaw_speed = 10; } if (!self->viewheight) { self->viewheight = 10; } if (self->spawnflags & 2) { monster_triggered_start(self); } else { monster_start_go(self); } } void swimmonster_start(edict_t *self) { if (!self) { return; } self->flags |= FL_SWIM; self->think = swimmonster_start_go; monster_start(self); } xatrix-XATRIX_2_14/src/g_phys.c000066400000000000000000000603371477320050300163750ustar00rootroot00000000000000/* ======================================================================= * * Quake IIs legendary physic engine. * * ======================================================================= */ #include "header/local.h" #define STOP_EPSILON 0.1 #define MAX_CLIP_PLANES 5 #define sv_stopspeed 100 #define sv_friction 6 #define sv_waterfriction 1 /* * pushmove objects do not obey gravity, and do not interact * with each other or trigger fields, but block normal movement * and push normal objects when they move. * * onground is set for toss objects when they come to a complete * rest. It is set for steping or walking objects. * * doors, plats, etc are SOLID_BSP, and MOVETYPE_PUSH * bonus items are SOLID_TRIGGER touch, and MOVETYPE_TOSS * corpses are SOLID_NOT and MOVETYPE_TOSS * crates are SOLID_BBOX and MOVETYPE_TOSS * walking monsters are SOLID_SLIDEBOX and MOVETYPE_STEP * flying/floating monsters are SOLID_SLIDEBOX and MOVETYPE_FLY * * solid_edge items only clip against bsp models. */ edict_t * SV_TestEntityPosition(edict_t *ent) { trace_t trace; int mask; if (!ent) { return NULL; } /* dead bodies are supposed to not be solid so lets ensure they only collide with BSP during pushmoves */ if (ent->clipmask && !(ent->svflags & SVF_MONSTER)) { mask = ent->clipmask; } else { mask = MASK_SOLID; } trace = gi.trace(ent->s.origin, ent->mins, ent->maxs, ent->s.origin, ent, mask); if (trace.startsolid) { return g_edicts; } return NULL; } void SV_CheckVelocity(edict_t *ent) { if (!ent) { return; } if (VectorLength(ent->velocity) > sv_maxvelocity->value) { VectorNormalize(ent->velocity); VectorScale(ent->velocity, sv_maxvelocity->value, ent->velocity); } } /* * Runs thinking code for * this frame if necessary */ qboolean SV_RunThink(edict_t *ent) { float thinktime; if (!ent) { return false; } thinktime = ent->nextthink; if (thinktime <= 0) { return true; } if (thinktime > level.time + 0.001) { return true; } ent->nextthink = 0; if (!ent->think) { gi.error("NULL ent->think"); } ent->think(ent); return false; } /* * Two entities have touched, so * run their touch functions */ void SV_Impact(edict_t *e1, trace_t *trace) { edict_t *e2; if (!e1 || !trace) { return; } e2 = trace->ent; if (e1->touch && (e1->solid != SOLID_NOT)) { e1->touch(e1, e2, &trace->plane, trace->surface); } if (e2->touch && (e2->solid != SOLID_NOT)) { e2->touch(e2, e1, NULL, NULL); } } /* * Slide off of the impacting object * returns the blocked flags: * 1 = floor * 2 = step / wall */ int ClipVelocity(vec3_t in, vec3_t normal, vec3_t out, float overbounce) { float backoff; float change; int i, blocked; blocked = 0; if (normal[2] > 0) { blocked |= 1; /* floor */ } if (!normal[2]) { blocked |= 2; /* step */ } backoff = DotProduct(in, normal) * overbounce; for (i = 0; i < 3; i++) { change = normal[i] * backoff; out[i] = in[i] - change; if ((out[i] > -STOP_EPSILON) && (out[i] < STOP_EPSILON)) { out[i] = 0; } } return blocked; } /* * The basic solid body movement clip that slides * along multiple planes. Returns the clipflags if * the velocity was modified (hit something solid): * 1 = floor * 2 = wall / step * 4 = dead stop */ int SV_FlyMove(edict_t *ent, float time, int mask) { edict_t *hit; int bumpcount, numbumps; vec3_t dir; float d; int numplanes; vec3_t planes[MAX_CLIP_PLANES]; vec3_t primal_velocity, original_velocity, new_velocity; int i, j; trace_t trace; vec3_t end; float time_left; int blocked; if (!ent) { return 0; } numbumps = 4; blocked = 0; VectorCopy(ent->velocity, original_velocity); VectorCopy(ent->velocity, primal_velocity); numplanes = 0; time_left = time; ent->groundentity = NULL; for (bumpcount = 0; bumpcount < numbumps; bumpcount++) { for (i = 0; i < 3; i++) { end[i] = ent->s.origin[i] + time_left * ent->velocity[i]; } trace = gi.trace(ent->s.origin, ent->mins, ent->maxs, end, ent, mask); if (trace.allsolid) { /* entity is trapped in another solid */ VectorCopy(vec3_origin, ent->velocity); return 3; } if (trace.fraction > 0) { /* actually covered some distance */ VectorCopy(trace.endpos, ent->s.origin); VectorCopy(ent->velocity, original_velocity); numplanes = 0; } if (trace.fraction == 1) { break; /* moved the entire distance */ } hit = trace.ent; if (trace.plane.normal[2] > 0.7) { blocked |= 1; /* floor */ if (hit->solid == SOLID_BSP) { ent->groundentity = hit; ent->groundentity_linkcount = hit->linkcount; } } if (!trace.plane.normal[2]) { blocked |= 2; /* step */ } /* run the impact function */ SV_Impact(ent, &trace); if (!ent->inuse) { break; /* removed by the impact function */ } time_left -= time_left * trace.fraction; /* cliped to another plane */ if (numplanes >= MAX_CLIP_PLANES) { /* this shouldn't really happen */ VectorCopy(vec3_origin, ent->velocity); return 3; } VectorCopy(trace.plane.normal, planes[numplanes]); numplanes++; /* modify original_velocity so it parallels all of the clip planes */ for (i = 0; i < numplanes; i++) { ClipVelocity(original_velocity, planes[i], new_velocity, 1); for (j = 0; j < numplanes; j++) { if ((j != i) && !VectorCompare(planes[i], planes[j])) { if (DotProduct(new_velocity, planes[j]) < 0) { break; /* not ok */ } } } if (j == numplanes) { break; } } if (i != numplanes) { /* go along this plane */ VectorCopy(new_velocity, ent->velocity); } else { /* go along the crease */ if (numplanes != 2) { VectorCopy(vec3_origin, ent->velocity); return 7; } CrossProduct(planes[0], planes[1], dir); d = DotProduct(dir, ent->velocity); VectorScale(dir, d, ent->velocity); } /* If original velocity is against the original velocity, stop dead to avoid tiny occilations in sloping corners */ if (DotProduct(ent->velocity, primal_velocity) <= 0) { VectorCopy(vec3_origin, ent->velocity); return blocked; } } return blocked; } void SV_AddGravity(edict_t *ent) { if (!ent) { return; } ent->velocity[2] -= ent->gravity * sv_gravity->value * FRAMETIME; } /* * Returns the actual bounding box of a bmodel. * This is a big improvement over what q2 normally * does with rotating bmodels - q2 sets absmin, * absmax to a cube that will completely contain * the bmodel at *any* rotation on *any* axis, whether * the bmodel can actually rotate to that angle or not. * This leads to a lot of false block tests in SV_Push * if another bmodel is in the vicinity. */ void RealBoundingBox(edict_t *ent, vec3_t mins, vec3_t maxs) { vec3_t forward, left, up, f1, l1, u1; vec3_t p[8]; int i, j, k, j2, k4; for (k = 0; k < 2; k++) { k4 = k * 4; if (k) { p[k4][2] = ent->maxs[2]; } else { p[k4][2] = ent->mins[2]; } p[k4 + 1][2] = p[k4][2]; p[k4 + 2][2] = p[k4][2]; p[k4 + 3][2] = p[k4][2]; for (j = 0; j < 2; j++) { j2 = j * 2; if (j) { p[j2 + k4][1] = ent->maxs[1]; } else { p[j2 + k4][1] = ent->mins[1]; } p[j2 + k4 + 1][1] = p[j2 + k4][1]; for (i = 0; i < 2; i++) { if (i) { p[i + j2 + k4][0] = ent->maxs[0]; } else { p[i + j2 + k4][0] = ent->mins[0]; } } } } AngleVectors(ent->s.angles, forward, left, up); for (i = 0; i < 8; i++) { VectorScale(forward, p[i][0], f1); VectorScale(left, -p[i][1], l1); VectorScale(up, p[i][2], u1); VectorAdd(ent->s.origin, f1, p[i]); VectorAdd(p[i], l1, p[i]); VectorAdd(p[i], u1, p[i]); } VectorCopy(p[0], mins); VectorCopy(p[0], maxs); for (i = 1; i < 8; i++) { if (mins[0] > p[i][0]) { mins[0] = p[i][0]; } if (mins[1] > p[i][1]) { mins[1] = p[i][1]; } if (mins[2] > p[i][2]) { mins[2] = p[i][2]; } if (maxs[0] < p[i][0]) { maxs[0] = p[i][0]; } if (maxs[1] < p[i][1]) { maxs[1] = p[i][1]; } if (maxs[2] < p[i][2]) { maxs[2] = p[i][2]; } } } /* =============================================================================== */ /* PUSHMOVE */ /* * Does not change the entities velocity at all */ trace_t SV_PushEntity(edict_t *ent, vec3_t push) { trace_t trace; vec3_t start; vec3_t end; int mask; VectorCopy(ent->s.origin, start); VectorAdd(start, push, end); retry: if (ent->clipmask) { mask = ent->clipmask; } else { mask = MASK_SOLID; } trace = gi.trace(start, ent->mins, ent->maxs, end, ent, mask); /* startsolid treats different-content volumes as continuous, like the bbox of a monster/player and the floor of an elevator. So do another trace that only collides with BSP so that we make a best effort to keep these entities inside non-solid space */ if (trace.startsolid && (mask & ~MASK_SOLID)) { trace = gi.trace (start, ent->mins, ent->maxs, end, ent, MASK_SOLID); } VectorCopy(trace.endpos, ent->s.origin); gi.linkentity(ent); /* Push slightly away from non-horizontal surfaces, prevent origin stuck in the plane which causes the entity to be rendered in full black. */ if (trace.plane.type != 2) { /* Limit the fix to gibs, debris and dead monsters. Everything else may break existing maps. Items may slide to unreachable locations, monsters may get stuck, etc. */ if (((strncmp(ent->classname, "monster_", 8) == 0) && ent->health < 1) || (strcmp(ent->classname, "debris") == 0) || (ent->s.effects & EF_GIB)) { VectorAdd(ent->s.origin, trace.plane.normal, ent->s.origin); } } if (trace.fraction != 1.0) { SV_Impact(ent, &trace); /* if the pushed entity went away and the pusher is still there */ if (!trace.ent->inuse && ent->inuse) { /* move the pusher back and try again */ VectorCopy(start, ent->s.origin); gi.linkentity(ent); goto retry; } } if (ent->inuse) { G_TouchTriggers(ent); } return trace; } typedef struct { edict_t *ent; vec3_t origin; vec3_t angles; } pushed_t; pushed_t pushed[MAX_EDICTS], *pushed_p; edict_t *obstacle; /* * Objects need to be moved back on a failed push, * otherwise riders would continue to slide. */ qboolean SV_Push(edict_t *pusher, vec3_t move, vec3_t amove) { int i, e; edict_t *check, *block; pushed_t *p; vec3_t org, org2, move2, forward, right, up; vec3_t realmins, realmaxs; if (!pusher) { return false; } /* clamp the move to 1/8 units, so the position will be accurate for client side prediction */ for (i = 0; i < 3; i++) { float temp; temp = move[i] * 8.0; if (temp > 0.0) { temp += 0.5; } else { temp -= 0.5; } move[i] = 0.125 * (int)temp; } /* we need this for pushing things later */ VectorSubtract(vec3_origin, amove, org); AngleVectors(org, forward, right, up); /* save the pusher's original position */ pushed_p->ent = pusher; VectorCopy(pusher->s.origin, pushed_p->origin); VectorCopy(pusher->s.angles, pushed_p->angles); pushed_p++; /* move the pusher to it's final position */ VectorAdd(pusher->s.origin, move, pusher->s.origin); VectorAdd(pusher->s.angles, amove, pusher->s.angles); gi.linkentity(pusher); /* Create a real bounding box for rotating brush models. */ RealBoundingBox(pusher, realmins, realmaxs); /* see if any solid entities are inside the final position */ check = g_edicts + 1; for (e = 1; e < globals.num_edicts; e++, check++) { if (!check->inuse) { continue; } if ((check->movetype == MOVETYPE_PUSH) || (check->movetype == MOVETYPE_STOP) || (check->movetype == MOVETYPE_NONE) || (check->movetype == MOVETYPE_NOCLIP)) { continue; } if (!check->area.prev) { continue; /* not linked in anywhere */ } /* if the entity is standing on the pusher, it will definitely be moved */ if (check->groundentity != pusher) { /* see if the ent needs to be tested */ if ((check->absmin[0] >= realmaxs[0]) || (check->absmin[1] >= realmaxs[1]) || (check->absmin[2] >= realmaxs[2]) || (check->absmax[0] <= realmins[0]) || (check->absmax[1] <= realmins[1]) || (check->absmax[2] <= realmins[2])) { continue; } /* see if the ent's bbox is inside the pusher's final position */ if (!SV_TestEntityPosition(check)) { continue; } } if ((pusher->movetype == MOVETYPE_PUSH) || (check->groundentity == pusher)) { /* move this entity */ pushed_p->ent = check; VectorCopy(check->s.origin, pushed_p->origin); VectorCopy(check->s.angles, pushed_p->angles); pushed_p++; /* try moving the contacted entity */ VectorAdd(check->s.origin, move, check->s.origin); /* figure movement due to the pusher's amove */ VectorSubtract(check->s.origin, pusher->s.origin, org); org2[0] = DotProduct(org, forward); org2[1] = -DotProduct(org, right); /* Quirk for blocking Elevators when running under amd64. This is most likey caused by a too high float precision. -_- */ if (((pusher->s.number == 285) && (Q_strcasecmp(level.mapname, "xcompnd2") == 0)) || ((pusher->s.number == 520) && (Q_strcasecmp(level.mapname, "xsewer2") == 0))) { org2[2] = DotProduct(org, up) + 2; } else { org2[2] = DotProduct(org, up); } VectorSubtract(org2, org, move2); VectorAdd(check->s.origin, move2, check->s.origin); /* may have pushed them off an edge */ if (check->groundentity != pusher) { check->groundentity = NULL; } block = SV_TestEntityPosition(check); if (!block) { /* pushed ok */ gi.linkentity(check); /* impact? */ continue; } /* if it is ok to leave in the old position, do it this is only relevent for riding entities, not pushed */ VectorSubtract(check->s.origin, move, check->s.origin); block = SV_TestEntityPosition(check); if (!block) { pushed_p--; continue; } } /* save off the obstacle so we can call the block function */ obstacle = check; /* move back any entities we already moved go backwards, so if the same entity was pushed twice, it goes back to the original position */ for (p = pushed_p - 1; p >= pushed; p--) { VectorCopy(p->origin, p->ent->s.origin); VectorCopy(p->angles, p->ent->s.angles); gi.linkentity(p->ent); } return false; } /* see if anything we moved has touched a trigger */ for (p = pushed_p - 1; p >= pushed; p--) { G_TouchTriggers(p->ent); } return true; } /* * Bmodel objects don't interact with each * other, but push all box objects */ void SV_Physics_Pusher(edict_t *ent) { vec3_t move, amove; edict_t *part, *mv; if (!ent) { return; } /* if not a team captain, so movement will be handled elsewhere */ if (ent->flags & FL_TEAMSLAVE) { return; } /* make sure all team slaves can move before commiting any moves or calling any think functions. if the move is blocked, all moved objects will be backed out */ pushed_p = pushed; for (part = ent; part; part = part->teamchain) { if (part->velocity[0] || part->velocity[1] || part->velocity[2] || part->avelocity[0] || part->avelocity[1] || part->avelocity[2]) { /* object is moving */ VectorScale(part->velocity, FRAMETIME, move); VectorScale(part->avelocity, FRAMETIME, amove); if (!SV_Push(part, move, amove)) { break; /* move was blocked */ } } } if (pushed_p > &pushed[MAX_EDICTS-1]) { gi.error("pushed_p > &pushed[MAX_EDICTS-1], memory corrupted"); } if (part) { /* the move failed, bump all nextthink times and back out moves */ for (mv = ent; mv; mv = mv->teamchain) { if (mv->nextthink > 0) { mv->nextthink += FRAMETIME; } } /* if the pusher has a "blocked" function, call it otherwise, just stay in place until the obstacle is gone */ if (part->blocked) { part->blocked(part, obstacle); } } else { /* the move succeeded, so call all think functions */ for (part = ent; part; part = part->teamchain) { SV_RunThink(part); } } } /* ================================================================== */ /* * Non moving objects can only think */ void SV_Physics_None(edict_t *ent) { if (!ent) { return; } /* regular thinking */ SV_RunThink(ent); } /* * A moving object that doesn't obey physics */ void SV_Physics_Noclip(edict_t *ent) { if (!ent) { return; } /* regular thinking */ if (!SV_RunThink(ent)) { return; } VectorMA(ent->s.angles, FRAMETIME, ent->avelocity, ent->s.angles); VectorMA(ent->s.origin, FRAMETIME, ent->velocity, ent->s.origin); gi.linkentity(ent); } /* ============================================================================== */ /* TOSS / BOUNCE */ /* * Toss, bounce, and fly movement. When onground, do nothing. */ void SV_Physics_Toss(edict_t *ent) { trace_t trace; vec3_t move; float backoff; edict_t *slave; qboolean wasinwater; qboolean isinwater; vec3_t old_origin; if (!ent) { return; } /* regular thinking */ SV_RunThink(ent); /* entities are very often freed during thinking */ if (!ent->inuse) { return; } /* if not a team captain, so movement will be handled elsewhere */ if (ent->flags & FL_TEAMSLAVE) { return; } if (ent->velocity[2] > 0) { ent->groundentity = NULL; } /* check for the groundentity going away */ if (ent->groundentity) { if (!ent->groundentity->inuse) { ent->groundentity = NULL; } } /* if onground, return without moving */ if (ent->groundentity) { return; } VectorCopy(ent->s.origin, old_origin); SV_CheckVelocity(ent); /* add gravity */ if ((ent->movetype != MOVETYPE_FLY) && (ent->movetype != MOVETYPE_FLYMISSILE) && (ent->movetype != MOVETYPE_WALLBOUNCE)) { SV_AddGravity(ent); } /* move angles */ VectorMA(ent->s.angles, FRAMETIME, ent->avelocity, ent->s.angles); /* move origin */ VectorScale(ent->velocity, FRAMETIME, move); trace = SV_PushEntity(ent, move); if (!ent->inuse) { return; } if (trace.fraction < 1) { if (ent->movetype == MOVETYPE_WALLBOUNCE) { backoff = 2.0; } else if (ent->movetype == MOVETYPE_BOUNCE) { backoff = 1.5; } else { backoff = 1; } ClipVelocity(ent->velocity, trace.plane.normal, ent->velocity, backoff); if (ent->movetype == MOVETYPE_WALLBOUNCE) { vectoangles(ent->velocity, ent->s.angles); } /* stop if on ground */ if ((trace.plane.normal[2] > 0.7) && (ent->movetype != MOVETYPE_WALLBOUNCE)) { if ((ent->velocity[2] < 60) || (ent->movetype != MOVETYPE_BOUNCE)) { ent->groundentity = trace.ent; ent->groundentity_linkcount = trace.ent->linkcount; VectorCopy(vec3_origin, ent->velocity); VectorCopy(vec3_origin, ent->avelocity); } } } /* check for water transition */ wasinwater = (ent->watertype & MASK_WATER); ent->watertype = gi.pointcontents(ent->s.origin); isinwater = ent->watertype & MASK_WATER; if (isinwater) { ent->waterlevel = 1; } else { ent->waterlevel = 0; } if (!wasinwater && isinwater) { /* don't play splash sound for entities already in water on level start */ if (level.framenum > 3) { gi.positioned_sound(old_origin, g_edicts, CHAN_AUTO, gi.soundindex("misc/h2ohit1.wav"), 1, 1, 0); } } else if (wasinwater && !isinwater) { gi.positioned_sound(ent->s.origin, g_edicts, CHAN_AUTO, gi.soundindex("misc/h2ohit1.wav"), 1, 1, 0); } /* move teamslaves */ for (slave = ent->teamchain; slave; slave = slave->teamchain) { VectorCopy(ent->s.origin, slave->s.origin); gi.linkentity(slave); } } /* =============================================================================== */ /* STEPPING MOVEMENT */ /* * Monsters freefall when they don't have a ground entity, otherwise * all movement is done with discrete steps. * * This is also used for objects that have become still on the ground, but * will fall if the floor is pulled out from under them. */ void SV_AddRotationalFriction(edict_t *ent) { int n; float adjustment; if (!ent) { return; } VectorMA(ent->s.angles, FRAMETIME, ent->avelocity, ent->s.angles); adjustment = FRAMETIME * sv_stopspeed * sv_friction; for (n = 0; n < 3; n++) { if (ent->avelocity[n] > 0) { ent->avelocity[n] -= adjustment; if (ent->avelocity[n] < 0) { ent->avelocity[n] = 0; } } else { ent->avelocity[n] += adjustment; if (ent->avelocity[n] > 0) { ent->avelocity[n] = 0; } } } } void SV_Physics_Step(edict_t *ent) { qboolean wasonground; qboolean hitsound = false; float *vel; float speed, newspeed, control; float friction; edict_t *groundentity; int mask; vec3_t oldorig; trace_t tr; if (!ent) { return; } /* airborn monsters should always check for ground */ if (!ent->groundentity) { M_CheckGround(ent); } groundentity = ent->groundentity; SV_CheckVelocity(ent); if (groundentity) { wasonground = true; } else { wasonground = false; } if (ent->avelocity[0] || ent->avelocity[1] || ent->avelocity[2]) { SV_AddRotationalFriction(ent); } /* add gravity except: - flying monsters - swimming monsters who are in the water */ if (!wasonground) { if (!(ent->flags & FL_FLY)) { if (!((ent->flags & FL_SWIM) && (ent->waterlevel > 2))) { if (ent->velocity[2] < sv_gravity->value * -0.1) { hitsound = true; } if (ent->waterlevel == 0) { SV_AddGravity(ent); } } } } /* friction for flying monsters that have been given vertical velocity */ if ((ent->flags & FL_FLY) && (ent->velocity[2] != 0)) { speed = fabs(ent->velocity[2]); control = speed < sv_stopspeed ? sv_stopspeed : speed; friction = sv_friction / 3; newspeed = speed - (FRAMETIME * control * friction); if (newspeed < 0) { newspeed = 0; } newspeed /= speed; ent->velocity[2] *= newspeed; } /* friction for flying monsters that have been given vertical velocity */ if ((ent->flags & FL_SWIM) && (ent->velocity[2] != 0)) { speed = fabs(ent->velocity[2]); control = speed < sv_stopspeed ? sv_stopspeed : speed; newspeed = speed - (FRAMETIME * control * sv_waterfriction * ent->waterlevel); if (newspeed < 0) { newspeed = 0; } newspeed /= speed; ent->velocity[2] *= newspeed; } if (ent->velocity[2] || ent->velocity[1] || ent->velocity[0]) { /* let dead monsters who aren't completely onground slide */ if ((wasonground) || (ent->flags & (FL_SWIM | FL_FLY))) { if (!((ent->health <= 0.0) && !M_CheckBottom(ent))) { vel = ent->velocity; speed = sqrt(vel[0] * vel[0] + vel[1] * vel[1]); if (speed) { friction = sv_friction; control = speed < sv_stopspeed ? sv_stopspeed : speed; newspeed = speed - FRAMETIME * control * friction; if (newspeed < 0) { newspeed = 0; } newspeed /= speed; vel[0] *= newspeed; vel[1] *= newspeed; } } } if (ent->svflags & SVF_MONSTER) { mask = MASK_MONSTERSOLID; } else { mask = MASK_SOLID; } VectorCopy(ent->s.origin, oldorig); SV_FlyMove(ent, FRAMETIME, mask); /* Evil hack to work around dead parasites (and maybe other monster) falling through the worldmodel into the void. We copy the current origin (see above) and after the SV_FlyMove() was performend we checl if we're stuck in the world model. If yes we're undoing the move. */ if (!VectorCompare(ent->s.origin, oldorig)) { tr = gi.trace(ent->s.origin, ent->mins, ent->maxs, ent->s.origin, ent, mask); if (tr.startsolid) { VectorCopy(oldorig, ent->s.origin); } } gi.linkentity(ent); G_TouchTriggers(ent); if (!ent->inuse) { return; } if (ent->groundentity) { if (!wasonground) { if (hitsound) { gi.sound(ent, 0, gi.soundindex("world/land.wav"), 1, 1, 0); } } } } /* regular thinking */ SV_RunThink(ent); } /* ============================================================================ */ void G_RunEntity(edict_t *ent) { if (!ent) { return; } if (ent->prethink) { ent->prethink(ent); } switch ((int)ent->movetype) { case MOVETYPE_PUSH: case MOVETYPE_STOP: SV_Physics_Pusher(ent); break; case MOVETYPE_NONE: SV_Physics_None(ent); break; case MOVETYPE_NOCLIP: SV_Physics_Noclip(ent); break; case MOVETYPE_STEP: SV_Physics_Step(ent); break; case MOVETYPE_TOSS: case MOVETYPE_BOUNCE: case MOVETYPE_FLY: case MOVETYPE_FLYMISSILE: case MOVETYPE_WALLBOUNCE: SV_Physics_Toss(ent); break; default: gi.error("SV_Physics: bad movetype %i", (int)ent->movetype); } } xatrix-XATRIX_2_14/src/g_spawn.c000066400000000000000000000621061477320050300165360ustar00rootroot00000000000000/* ======================================================================= * * Item spawning. * * ======================================================================= */ #include "header/local.h" typedef struct { char *name; void (*spawn)(edict_t *ent); } spawn_t; void SP_item_health(edict_t *self); void SP_item_health_small(edict_t *self); void SP_item_health_large(edict_t *self); void SP_item_health_mega(edict_t *self); void SP_info_player_start(edict_t *ent); void SP_info_player_deathmatch(edict_t *ent); void SP_info_player_coop(edict_t *ent); void SP_info_player_intermission(edict_t *ent); void SP_func_plat(edict_t *ent); void SP_func_rotating(edict_t *ent); void SP_func_button(edict_t *ent); void SP_func_door(edict_t *ent); void SP_func_door_secret(edict_t *ent); void SP_func_door_rotating(edict_t *ent); void SP_func_water(edict_t *ent); void SP_func_train(edict_t *ent); void SP_func_conveyor(edict_t *self); void SP_func_wall(edict_t *self); void SP_func_object(edict_t *self); void SP_func_explosive(edict_t *self); void SP_func_timer(edict_t *self); void SP_func_areaportal(edict_t *ent); void SP_func_clock(edict_t *ent); void SP_func_killbox(edict_t *ent); void SP_trigger_always(edict_t *ent); void SP_trigger_once(edict_t *ent); void SP_trigger_multiple(edict_t *ent); void SP_trigger_relay(edict_t *ent); void SP_trigger_push(edict_t *ent); void SP_trigger_hurt(edict_t *ent); void SP_trigger_key(edict_t *ent); void SP_trigger_counter(edict_t *ent); void SP_trigger_elevator(edict_t *ent); void SP_trigger_gravity(edict_t *ent); void SP_trigger_monsterjump(edict_t *ent); void SP_target_temp_entity(edict_t *ent); void SP_target_speaker(edict_t *ent); void SP_target_explosion(edict_t *ent); void SP_target_changelevel(edict_t *ent); void SP_target_secret(edict_t *ent); void SP_target_goal(edict_t *ent); void SP_target_splash(edict_t *ent); void SP_target_spawner(edict_t *ent); void SP_target_blaster(edict_t *ent); void SP_target_crosslevel_trigger(edict_t *ent); void SP_target_crosslevel_target(edict_t *ent); void SP_target_laser(edict_t *self); void SP_target_help(edict_t *ent); void SP_target_lightramp(edict_t *self); void SP_target_earthquake(edict_t *ent); void SP_target_character(edict_t *ent); void SP_target_string(edict_t *ent); void SP_worldspawn(edict_t *ent); void SP_viewthing(edict_t *ent); void SP_light(edict_t *self); void SP_light_mine1(edict_t *ent); void SP_light_mine2(edict_t *ent); void SP_info_null(edict_t *self); void SP_info_notnull(edict_t *self); void SP_path_corner(edict_t *self); void SP_point_combat(edict_t *self); void SP_misc_explobox(edict_t *self); void SP_misc_banner(edict_t *self); void SP_misc_satellite_dish(edict_t *self); void SP_misc_gib_arm(edict_t *self); void SP_misc_gib_leg(edict_t *self); void SP_misc_gib_head(edict_t *self); void SP_misc_insane(edict_t *self); void SP_misc_deadsoldier(edict_t *self); void SP_misc_viper(edict_t *self); void SP_misc_viper_bomb(edict_t *self); void SP_misc_bigviper(edict_t *self); void SP_misc_strogg_ship(edict_t *self); void SP_misc_teleporter(edict_t *self); void SP_misc_teleporter_dest(edict_t *self); void SP_misc_blackhole(edict_t *self); void SP_misc_eastertank(edict_t *self); void SP_misc_easterchick(edict_t *self); void SP_misc_easterchick2(edict_t *self); void SP_monster_berserk(edict_t *self); void SP_monster_gladiator(edict_t *self); void SP_monster_gunner(edict_t *self); void SP_monster_infantry(edict_t *self); void SP_monster_soldier_light(edict_t *self); void SP_monster_soldier(edict_t *self); void SP_monster_soldier_ss(edict_t *self); void SP_monster_tank(edict_t *self); void SP_monster_medic(edict_t *self); void SP_monster_flipper(edict_t *self); void SP_monster_chick(edict_t *self); void SP_monster_parasite(edict_t *self); void SP_monster_flyer(edict_t *self); void SP_monster_brain(edict_t *self); void SP_monster_floater(edict_t *self); void SP_monster_hover(edict_t *self); void SP_monster_mutant(edict_t *self); void SP_monster_supertank(edict_t *self); void SP_monster_boss2(edict_t *self); void SP_monster_jorg(edict_t *self); void SP_monster_makron(edict_t *self); void SP_monster_boss3_stand(edict_t *self); void SP_monster_commander_body(edict_t *self); void SP_turret_breach(edict_t *self); void SP_turret_base(edict_t *self); void SP_turret_driver(edict_t *self); void SP_monster_soldier_hypergun(edict_t *self); void SP_monster_soldier_lasergun(edict_t *self); void SP_monster_soldier_ripper(edict_t *self); void SP_monster_fixbot(edict_t *self); void SP_monster_gekk(edict_t *self); void SP_monster_chick_heat(edict_t *self); void SP_monster_gladb(edict_t *self); void SP_monster_boss5(edict_t *self); void SP_rotating_light(edict_t *self); void SP_object_repair(edict_t *self); void SP_misc_crashviper(edict_t *ent); void SP_misc_viper_missile(edict_t *self); void SP_misc_amb4(edict_t *ent); void SP_target_mal_laser(edict_t *ent); void SP_misc_transport(edict_t *ent); void SP_misc_nuke(edict_t *ent); spawn_t spawns[] = { {"item_health", SP_item_health}, {"item_health_small", SP_item_health_small}, {"item_health_large", SP_item_health_large}, {"item_health_mega", SP_item_health_mega}, {"info_player_start", SP_info_player_start}, {"info_player_deathmatch", SP_info_player_deathmatch}, {"info_player_coop", SP_info_player_coop}, {"info_player_intermission", SP_info_player_intermission}, {"func_plat", SP_func_plat}, {"func_button", SP_func_button}, {"func_door", SP_func_door}, {"func_door_secret", SP_func_door_secret}, {"func_door_rotating", SP_func_door_rotating}, {"func_rotating", SP_func_rotating}, {"func_train", SP_func_train}, {"func_water", SP_func_water}, {"func_conveyor", SP_func_conveyor}, {"func_areaportal", SP_func_areaportal}, {"func_clock", SP_func_clock}, {"func_wall", SP_func_wall}, {"func_object", SP_func_object}, {"func_timer", SP_func_timer}, {"func_explosive", SP_func_explosive}, {"func_killbox", SP_func_killbox}, {"func_object_repair", SP_object_repair}, {"rotating_light", SP_rotating_light}, {"trigger_always", SP_trigger_always}, {"trigger_once", SP_trigger_once}, {"trigger_multiple", SP_trigger_multiple}, {"trigger_relay", SP_trigger_relay}, {"trigger_push", SP_trigger_push}, {"trigger_hurt", SP_trigger_hurt}, {"trigger_key", SP_trigger_key}, {"trigger_counter", SP_trigger_counter}, {"trigger_elevator", SP_trigger_elevator}, {"trigger_gravity", SP_trigger_gravity}, {"trigger_monsterjump", SP_trigger_monsterjump}, {"target_temp_entity", SP_target_temp_entity}, {"target_speaker", SP_target_speaker}, {"target_explosion", SP_target_explosion}, {"target_changelevel", SP_target_changelevel}, {"target_secret", SP_target_secret}, {"target_goal", SP_target_goal}, {"target_splash", SP_target_splash}, {"target_spawner", SP_target_spawner}, {"target_blaster", SP_target_blaster}, {"target_crosslevel_trigger", SP_target_crosslevel_trigger}, {"target_crosslevel_target", SP_target_crosslevel_target}, {"target_laser", SP_target_laser}, {"target_help", SP_target_help}, {"target_lightramp", SP_target_lightramp}, {"target_earthquake", SP_target_earthquake}, {"target_character", SP_target_character}, {"target_string", SP_target_string}, {"target_mal_laser", SP_target_mal_laser}, {"worldspawn", SP_worldspawn}, {"viewthing", SP_viewthing}, {"light", SP_light}, {"light_mine1", SP_light_mine1}, {"light_mine2", SP_light_mine2}, {"info_null", SP_info_null}, {"func_group", SP_info_null}, {"info_notnull", SP_info_notnull}, {"path_corner", SP_path_corner}, {"point_combat", SP_point_combat}, {"misc_explobox", SP_misc_explobox}, {"misc_banner", SP_misc_banner}, {"misc_satellite_dish", SP_misc_satellite_dish}, {"misc_gib_arm", SP_misc_gib_arm}, {"misc_gib_leg", SP_misc_gib_leg}, {"misc_gib_head", SP_misc_gib_head}, {"misc_insane", SP_misc_insane}, {"misc_deadsoldier", SP_misc_deadsoldier}, {"misc_viper", SP_misc_viper}, {"misc_viper_bomb", SP_misc_viper_bomb}, {"misc_bigviper", SP_misc_bigviper}, {"misc_strogg_ship", SP_misc_strogg_ship}, {"misc_teleporter", SP_misc_teleporter}, {"misc_teleporter_dest", SP_misc_teleporter_dest}, {"misc_blackhole", SP_misc_blackhole}, {"misc_eastertank", SP_misc_eastertank}, {"misc_easterchick", SP_misc_easterchick}, {"misc_easterchick2", SP_misc_easterchick2}, {"misc_crashviper", SP_misc_crashviper}, {"misc_viper_missile", SP_misc_viper_missile}, {"misc_amb4", SP_misc_amb4}, {"misc_transport", SP_misc_transport}, {"misc_nuke", SP_misc_nuke}, {"monster_berserk", SP_monster_berserk}, {"monster_gladiator", SP_monster_gladiator}, {"monster_gunner", SP_monster_gunner}, {"monster_infantry", SP_monster_infantry}, {"monster_soldier_light", SP_monster_soldier_light}, {"monster_soldier", SP_monster_soldier}, {"monster_soldier_ss", SP_monster_soldier_ss}, {"monster_tank", SP_monster_tank}, {"monster_tank_commander", SP_monster_tank}, {"monster_medic", SP_monster_medic}, {"monster_flipper", SP_monster_flipper}, {"monster_chick", SP_monster_chick}, {"monster_parasite", SP_monster_parasite}, {"monster_flyer", SP_monster_flyer}, {"monster_brain", SP_monster_brain}, {"monster_floater", SP_monster_floater}, {"monster_hover", SP_monster_hover}, {"monster_mutant", SP_monster_mutant}, {"monster_supertank", SP_monster_supertank}, {"monster_boss2", SP_monster_boss2}, {"monster_boss3_stand", SP_monster_boss3_stand}, {"monster_makron", SP_monster_makron}, {"monster_jorg", SP_monster_jorg}, {"monster_commander_body", SP_monster_commander_body}, {"monster_soldier_hypergun", SP_monster_soldier_hypergun}, {"monster_soldier_lasergun", SP_monster_soldier_lasergun}, {"monster_soldier_ripper", SP_monster_soldier_ripper}, {"monster_fixbot", SP_monster_fixbot}, {"monster_gekk", SP_monster_gekk}, {"monster_chick_heat", SP_monster_chick_heat}, {"monster_gladb", SP_monster_gladb}, {"monster_boss5", SP_monster_boss5}, {"turret_breach", SP_turret_breach}, {"turret_base", SP_turret_base}, {"turret_driver", SP_turret_driver}, {NULL, NULL} }; qboolean Spawn_CheckCoop_MapHacks (edict_t *ent) { if(!coop->value || !ent) { return false; } if(!Q_stricmp(level.mapname, "xsewer1")) { if(ent->classname && !Q_stricmp(ent->classname, "trigger_relay") && ent->target && !Q_stricmp(ent->target, "t3") && ent->targetname && !Q_stricmp(ent->targetname, "t2")) { return true; } if(ent->classname && !Q_stricmp(ent->classname, "func_button") && ent->target && !Q_stricmp(ent->target, "t16") && ent->model && !Q_stricmp(ent->model, "*71")) { ent->message = "Overflow valve maintenance\nhatch A opened."; return false; } if(ent->classname && !Q_stricmp(ent->classname, "trigger_once") && ent->model && !Q_stricmp(ent->model, "*3")) { ent->message = "Overflow valve maintenance\nhatch B opened."; return false; } } return false; } /* * Finds the spawn function for * the entity and calls it */ void ED_CallSpawn(edict_t *ent) { spawn_t *s; gitem_t *item; int i; if (!ent) { return; } if (!ent->classname) { gi.dprintf("ED_CallSpawn: NULL classname\n"); return; } /* check item spawn functions */ for (i = 0, item = itemlist; i < game.num_items; i++, item++) { if (!item->classname) { continue; } if (!strcmp(item->classname, ent->classname)) { /* found it */ SpawnItem(ent, item); return; } } /* check normal spawn functions */ for (s = spawns; s->name; s++) { if (!strcmp(s->name, ent->classname)) { /* found it */ s->spawn(ent); return; } } gi.dprintf("%s doesn't have a spawn function\n", ent->classname); } char * ED_NewString(const char *string) { char *newb, *new_p; int i, l; if (!string) { return NULL; } l = strlen(string) + 1; newb = gi.TagMalloc(l, TAG_LEVEL); new_p = newb; for (i = 0; i < l; i++) { if ((string[i] == '\\') && (i < l - 1)) { i++; if (string[i] == 'n') { *new_p++ = '\n'; } else { *new_p++ = '\\'; } } else { *new_p++ = string[i]; } } return newb; } /* * Takes a key/value pair and sets * the binary values in an edict */ void ED_ParseField(const char *key, const char *value, edict_t *ent) { field_t *f; byte *b; float v; vec3_t vec; if (!key || !value) { return; } for (f = fields; f->name; f++) { if (!(f->flags & FFL_NOSPAWN) && !Q_strcasecmp(f->name, (char *)key)) { /* found it */ if (f->flags & FFL_SPAWNTEMP) { b = (byte *)&st; } else { b = (byte *)ent; } switch (f->type) { case F_LSTRING: *(char **)(b + f->ofs) = ED_NewString(value); break; case F_VECTOR: sscanf(value, "%f %f %f", &vec[0], &vec[1], &vec[2]); ((float *)(b + f->ofs))[0] = vec[0]; ((float *)(b + f->ofs))[1] = vec[1]; ((float *)(b + f->ofs))[2] = vec[2]; break; case F_INT: *(int *)(b + f->ofs) = (int)strtol(value, (char **)NULL, 10); break; case F_FLOAT: *(float *)(b + f->ofs) = (float)strtod(value, (char **)NULL); break; case F_ANGLEHACK: v = (float)strtod(value, (char **)NULL); ((float *)(b + f->ofs))[0] = 0; ((float *)(b + f->ofs))[1] = v; ((float *)(b + f->ofs))[2] = 0; break; case F_IGNORE: break; default: break; } return; } } gi.dprintf("%s is not a field\n", key); } /* * Parses an edict out of the given string, * returning the new position. ed should be * a properly initialized empty edict. */ char * ED_ParseEdict(char *data, edict_t *ent) { qboolean init; char keyname[256]; const char *com_token; if (!ent) { return NULL; } init = false; memset(&st, 0, sizeof(st)); /* go through all the dictionary pairs */ while (1) { /* parse key */ com_token = COM_Parse(&data); if (com_token[0] == '}') { break; } if (!data) { gi.error("ED_ParseEntity: EOF without closing brace"); } strncpy(keyname, com_token, sizeof(keyname) - 1); /* parse value */ com_token = COM_Parse(&data); if (!data) { gi.error("ED_ParseEntity: EOF without closing brace"); } if (com_token[0] == '}') { gi.error("ED_ParseEntity: closing brace without data"); } init = true; /* keynames with a leading underscore are used for utility comments, and are immediately discarded by quake */ if (keyname[0] == '_') { continue; } ED_ParseField(keyname, com_token, ent); } if (!init) { memset(ent, 0, sizeof(*ent)); } return data; } /* * Chain together all entities with a matching team field. * * All but the first will have the FL_TEAMSLAVE flag set. * All but the last will have the teamchain field set to the next one */ void G_FindTeams(void) { edict_t *e, *e2, *chain; int i, j; int c, c2; c = 0; c2 = 0; for (i = 1, e = g_edicts + i; i < globals.num_edicts; i++, e++) { if (!e->inuse) { continue; } if (!e->team) { continue; } if (e->flags & FL_TEAMSLAVE) { continue; } chain = e; e->teammaster = e; c++; c2++; for (j = i + 1, e2 = e + 1; j < globals.num_edicts; j++, e2++) { if (!e2->inuse) { continue; } if (!e2->team) { continue; } if (e2->flags & FL_TEAMSLAVE) { continue; } if (!strcmp(e->team, e2->team)) { c2++; chain->teamchain = e2; e2->teammaster = e; chain = e2; e2->flags |= FL_TEAMSLAVE; } } } gi.dprintf("%i teams with %i entities.\n", c, c2); } /* * Creates a server's entity / program execution context by * parsing textual entity definitions out of an ent file. */ void SpawnEntities(const char *mapname, char *entities, const char *spawnpoint) { edict_t *ent; int inhibit; const char *com_token; int i; float skill_level; if (!mapname || !entities || !spawnpoint) { return; } skill_level = floor(skill->value); if (skill_level < 0) { skill_level = 0; } if (skill_level > 3) { skill_level = 3; } if (skill->value != skill_level) { gi.cvar_forceset("skill", va("%f", skill_level)); } SaveClientData(); gi.FreeTags(TAG_LEVEL); memset(&level, 0, sizeof(level)); memset(g_edicts, 0, game.maxentities * sizeof(g_edicts[0])); strncpy(level.mapname, mapname, sizeof(level.mapname) - 1); strncpy(game.spawnpoint, spawnpoint, sizeof(game.spawnpoint) - 1); /* set client fields on player ents */ for (i = 0; i < game.maxclients; i++) { g_edicts[i + 1].client = game.clients + i; } ent = NULL; inhibit = 0; /* parse ents */ while (1) { /* parse the opening brace */ com_token = COM_Parse(&entities); if (!entities) { break; } if (com_token[0] != '{') { gi.error("ED_LoadFromFile: found %s when expecting {", com_token); } if (!ent) { ent = g_edicts; } else { ent = G_Spawn(); } entities = ED_ParseEdict(entities, ent); /* yet another map hack */ if (!Q_stricmp(level.mapname, "command") && !Q_stricmp(ent->classname, "trigger_once") && !Q_stricmp(ent->model, "*27")) { ent->spawnflags &= ~SPAWNFLAG_NOT_HARD; } /* remove things (except the world) from different skill levels or deathmatch */ if (ent != g_edicts) { if (deathmatch->value) { if (ent->spawnflags & SPAWNFLAG_NOT_DEATHMATCH) { G_FreeEdict(ent); inhibit++; continue; } } else { if (Spawn_CheckCoop_MapHacks(ent) || ( ((skill->value == SKILL_EASY) && (ent->spawnflags & SPAWNFLAG_NOT_EASY)) || ((skill->value == SKILL_MEDIUM) && (ent->spawnflags & SPAWNFLAG_NOT_MEDIUM)) || (((skill->value == SKILL_HARD) || (skill->value == SKILL_HARDPLUS)) && (ent->spawnflags & SPAWNFLAG_NOT_HARD))) ) { G_FreeEdict(ent); inhibit++; continue; } } ent->spawnflags &= ~(SPAWNFLAG_NOT_EASY | SPAWNFLAG_NOT_MEDIUM | SPAWNFLAG_NOT_HARD | SPAWNFLAG_NOT_COOP | SPAWNFLAG_NOT_DEATHMATCH); } ED_CallSpawn(ent); } /* in case the last entity in the entstring has spawntemp fields */ memset(&st, 0, sizeof(st)); gi.dprintf("%i entities inhibited.\n", inhibit); G_FindTeams(); PlayerTrail_Init(); } /* =================================================================== */ char *single_statusbar = "yb -24 " /* health */ "xv 0 " "hnum " "xv 50 " "pic 0 " /* ammo */ "if 2 " " xv 100 " " anum " " xv 150 " " pic 2 " "endif " /* armor */ "if 4 " " xv 200 " " rnum " " xv 250 " " pic 4 " "endif " /* selected item */ "if 6 " " xv 296 " " pic 6 " "endif " "yb -50 " /* picked up item */ "if 7 " " xv 0 " " pic 7 " " xv 26 " " yb -42 " " stat_string 8 " " yb -50 " "endif " /* timer */ "if 9 " " xv 262 " " num 2 10 " " xv 296 " " pic 9 " "endif " /* help / weapon icon */ "if 11 " " xv 148 " " pic 11 " "endif " ; char *dm_statusbar = "yb -24 " /* health */ "xv 0 " "hnum " "xv 50 " "pic 0 " /* ammo */ "if 2 " " xv 100 " " anum " " xv 150 " " pic 2 " "endif " /* armor */ "if 4 " " xv 200 " " rnum " " xv 250 " " pic 4 " "endif " /* selected item */ "if 6 " " xv 296 " " pic 6 " "endif " "yb -50 " /* picked up item */ "if 7 " " xv 0 " " pic 7 " " xv 26 " " yb -42 " " stat_string 8 " " yb -50 " "endif " /* timer */ "if 9 " " xv 246 " " num 2 10 " " xv 296 " " pic 9 " "endif " /* help / weapon icon */ "if 11 " " xv 148 " " pic 11 " "endif " /* frags */ "xr -50 " "yt 2 " "num 3 14 " /* spectator */ "if 17 " "xv 0 " "yb -58 " "string2 \"SPECTATOR MODE\" " "endif " /* chase camera */ "if 16 " "xv 0 " "yb -68 " "string \"Chasing\" " "xv 64 " "stat_string 16 " "endif " ; /*QUAKED worldspawn (0 0 0) ? * * Only used for the world. * "sky" environment map name * "skyaxis" vector axis for rotating sky * "skyrotate" speed of rotation in degrees/second * "sounds" music cd track number * "gravity" 800 is default gravity * "message" text to print at user logon */ void SP_worldspawn(edict_t *ent) { if (!ent) { return; } ent->movetype = MOVETYPE_PUSH; ent->solid = SOLID_BSP; ent->inuse = true; /* since the world doesn't use G_Spawn() */ ent->s.modelindex = 1; /* world model is always index 1 */ /* reserve some spots for dead player bodies for coop / deathmatch */ InitBodyQue(); /* set configstrings for items */ SetItemNames(); if (st.nextmap) { strcpy(level.nextmap, st.nextmap); } /* make some data visible to the server */ if (ent->message && ent->message[0]) { gi.configstring(CS_NAME, ent->message); Q_strlcpy(level.level_name, ent->message, sizeof(level.level_name)); } else { Q_strlcpy(level.level_name, level.mapname, sizeof(level.level_name)); } if (st.sky && st.sky[0]) { gi.configstring(CS_SKY, st.sky); } else { gi.configstring(CS_SKY, "unit1_"); } gi.configstring(CS_SKYROTATE, va("%f", st.skyrotate)); gi.configstring(CS_SKYAXIS, va("%f %f %f", st.skyaxis[0], st.skyaxis[1], st.skyaxis[2])); gi.configstring(CS_CDTRACK, va("%i", ent->sounds)); gi.configstring(CS_MAXCLIENTS, va("%i", (int)(maxclients->value))); /* status bar program */ if (deathmatch->value) { gi.configstring(CS_STATUSBAR, dm_statusbar); } else { gi.configstring(CS_STATUSBAR, single_statusbar); } /* help icon for statusbar */ gi.imageindex("i_help"); level.pic_health = gi.imageindex("i_health"); gi.imageindex("help"); gi.imageindex("field_3"); if (!st.gravity) { gi.cvar_set("sv_gravity", "800"); } else { gi.cvar_set("sv_gravity", st.gravity); } snd_fry = gi.soundindex("player/fry.wav"); /* standing in lava / slime */ PrecacheItem(FindItem("Blaster")); gi.soundindex("player/lava1.wav"); gi.soundindex("player/lava2.wav"); gi.soundindex("misc/pc_up.wav"); gi.soundindex("misc/talk1.wav"); gi.soundindex("misc/udeath.wav"); /* gibs */ gi.soundindex("items/respawn1.wav"); /* sexed sounds */ gi.soundindex("*death1.wav"); gi.soundindex("*death2.wav"); gi.soundindex("*death3.wav"); gi.soundindex("*death4.wav"); gi.soundindex("*fall1.wav"); gi.soundindex("*fall2.wav"); gi.soundindex("*gurp1.wav"); /* drowning damage */ gi.soundindex("*gurp2.wav"); gi.soundindex("*jump1.wav"); /* player jump */ gi.soundindex("*pain25_1.wav"); gi.soundindex("*pain25_2.wav"); gi.soundindex("*pain50_1.wav"); gi.soundindex("*pain50_2.wav"); gi.soundindex("*pain75_1.wav"); gi.soundindex("*pain75_2.wav"); gi.soundindex("*pain100_1.wav"); gi.soundindex("*pain100_2.wav"); /* sexed models. you can add more, max 19 THIS ORDER MUST MATCH THE DEFINES IN g_local.h these models are only loaded in coop or deathmatch. not singleplayer. */ if (coop->value || deathmatch->value) { gi.modelindex("#w_blaster.md2"); gi.modelindex("#w_shotgun.md2"); gi.modelindex("#w_sshotgun.md2"); gi.modelindex("#w_machinegun.md2"); gi.modelindex("#w_chaingun.md2"); gi.modelindex("#a_grenades.md2"); gi.modelindex("#w_glauncher.md2"); gi.modelindex("#w_rlauncher.md2"); gi.modelindex("#w_hyperblaster.md2"); gi.modelindex("#w_railgun.md2"); gi.modelindex("#w_bfg.md2"); gi.modelindex("#w_phalanx.md2"); gi.modelindex("#w_ripper.md2"); } /* ------------------- */ gi.soundindex("player/gasp1.wav"); /* gasping for air */ gi.soundindex("player/gasp2.wav"); /* head breaking surface, not gasping */ gi.soundindex("player/watr_in.wav"); /* feet hitting water */ gi.soundindex("player/watr_out.wav"); /* feet leaving water */ gi.soundindex("player/watr_un.wav"); /* head going underwater */ gi.soundindex("player/u_breath1.wav"); gi.soundindex("player/u_breath2.wav"); gi.soundindex("items/pkup.wav"); /* bonus item pickup */ gi.soundindex("world/land.wav"); /* landing thud */ gi.soundindex("misc/h2ohit1.wav"); /* landing splash */ gi.soundindex("items/damage.wav"); gi.soundindex("items/protect.wav"); gi.soundindex("items/protect4.wav"); gi.soundindex("weapons/noammo.wav"); gi.soundindex("infantry/inflies1.wav"); sm_meat_index = gi.modelindex("models/objects/gibs/sm_meat/tris.md2"); gi.modelindex("models/objects/gibs/arm/tris.md2"); gi.modelindex("models/objects/gibs/bone/tris.md2"); gi.modelindex("models/objects/gibs/bone2/tris.md2"); gi.modelindex("models/objects/gibs/chest/tris.md2"); gi.modelindex("models/objects/gibs/skull/tris.md2"); gi.modelindex("models/objects/gibs/head2/tris.md2"); /* Setup light animation tables. 'a' is total darkness, 'z' is doublebright. */ /* 0 normal */ gi.configstring(CS_LIGHTS + 0, "m"); /* 1 FLICKER (first variety) */ gi.configstring(CS_LIGHTS + 1, "mmnmmommommnonmmonqnmmo"); /* 2 SLOW STRONG PULSE */ gi.configstring(CS_LIGHTS + 2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"); /* 3 CANDLE (first variety) */ gi.configstring(CS_LIGHTS + 3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg"); /* 4 FAST STROBE */ gi.configstring(CS_LIGHTS + 4, "mamamamamama"); /* 5 GENTLE PULSE 1 */ gi.configstring(CS_LIGHTS + 5, "jklmnopqrstuvwxyzyxwvutsrqponmlkj"); /* 6 FLICKER (second variety) */ gi.configstring(CS_LIGHTS + 6, "nmonqnmomnmomomno"); /* 7 CANDLE (second variety) */ gi.configstring(CS_LIGHTS + 7, "mmmaaaabcdefgmmmmaaaammmaamm"); /* 8 CANDLE (third variety) */ gi.configstring(CS_LIGHTS + 8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa"); /* 9 SLOW STROBE (fourth variety) */ gi.configstring(CS_LIGHTS + 9, "aaaaaaaazzzzzzzz"); /* 10 FLUORESCENT FLICKER */ gi.configstring(CS_LIGHTS + 10, "mmamammmmammamamaaamammma"); /* 11 SLOW PULSE NOT FADE TO BLACK */ gi.configstring(CS_LIGHTS + 11, "abcdefghijklmnopqrrqponmlkjihgfedcba"); /* styles 32-62 are assigned by the light program for switchable lights */ /* 63 testing */ gi.configstring(CS_LIGHTS + 63, "a"); } xatrix-XATRIX_2_14/src/g_svcmds.c000066400000000000000000000130441477320050300167020ustar00rootroot00000000000000/* ======================================================================= * * Game side of server CMDs. At this time only the ipfilter. * * ======================================================================= */ #include "header/local.h" #define MAX_IPFILTERS 1024 void Svcmd_Test_f(void) { gi.cprintf(NULL, PRINT_HIGH, "Svcmd_Test_f()\n"); } /* * ============================================================================== * * PACKET FILTERING * * * You can add or remove addresses from the filter list with: * * addip * removeip * * The ip address is specified in dot format, and any unspecified * digits will match any value, so you can specify an entire class * C network with "addip 192.246.40". * * Removeip will only remove an address specified exactly the same * way. You cannot addip a subnet, then removeip a single host. * * listip * Prints the current list of filters. * * writeip * Dumps "addip " commands to listip.cfg so it can be execed * at a later date. The filter lists are not saved and restored * by default, because I belive it would cause too much confusion. * * filterban <0 or 1> * If 1 (the default), then ip addresses matching the current list * will be prohibited from entering the game.This is the default * setting. * If 0, then only addresses matching the list will be allowed. * This lets you easily set up a private game, or a game that only * allows players from your local network. * * ============================================================================== */ typedef struct { unsigned mask; unsigned compare; } ipfilter_t; ipfilter_t ipfilters[MAX_IPFILTERS]; int numipfilters; qboolean StringToFilter(char *s, ipfilter_t *f) { char num[128]; int i, j; byte b[4]; byte m[4]; if (!s || !f) { return false; } for (i = 0; i < 4; i++) { b[i] = 0; m[i] = 0; } for (i = 0; i < 4; i++) { if ((*s < '0') || (*s > '9')) { gi.cprintf(NULL, PRINT_HIGH, "Bad filter address: %s\n", s); return false; } j = 0; while (*s >= '0' && *s <= '9') { num[j++] = *s++; } num[j] = 0; b[i] = atoi(num); if (b[i] != 0) { m[i] = 255; } if (!*s) { break; } s++; } /* PVS NOTE: maybe use memcpy here instead? */ f->mask = *(unsigned *)m; f->compare = *(unsigned *)b; return true; } qboolean SV_FilterPacket(char *from) { int i; unsigned in; byte m[4]; char *p; if (!from) { return false; } i = 0; p = from; while (*p && i < 4) { m[i] = 0; while (*p >= '0' && *p <= '9') { m[i] = m[i] * 10 + (*p - '0'); p++; } if (!*p || (*p == ':')) { break; } i++, p++; } /* PVS NOTE: maybe use memcpy instead? */ in = *(unsigned *)m; for (i = 0; i < numipfilters; i++) { if ((in & ipfilters[i].mask) == ipfilters[i].compare) { return (filterban->value != 0); } } return (filterban->value == 0); } void SVCmd_AddIP_f(void) { int i; if (gi.argc() < 3) { gi.cprintf(NULL, PRINT_HIGH, "Usage: addip \n"); return; } for (i = 0; i < numipfilters; i++) { if (ipfilters[i].compare == 0xffffffff) { break; /* free spot */ } } if (i == numipfilters) { if (numipfilters == MAX_IPFILTERS) { gi.cprintf(NULL, PRINT_HIGH, "IP filter list is full\n"); return; } numipfilters++; } if (!StringToFilter(gi.argv(2), &ipfilters[i])) { ipfilters[i].compare = 0xffffffff; } } void SVCmd_RemoveIP_f(void) { ipfilter_t f; int i, j; if (gi.argc() < 3) { gi.cprintf(NULL, PRINT_HIGH, "Usage: sv removeip \n"); return; } if (!StringToFilter(gi.argv(2), &f)) { return; } for (i = 0; i < numipfilters; i++) { if ((ipfilters[i].mask == f.mask) && (ipfilters[i].compare == f.compare)) { for (j = i + 1; j < numipfilters; j++) { ipfilters[j - 1] = ipfilters[j]; } numipfilters--; gi.cprintf(NULL, PRINT_HIGH, "Removed.\n"); return; } } gi.cprintf(NULL, PRINT_HIGH, "Didn't find %s.\n", gi.argv(2)); } void SVCmd_ListIP_f(void) { int i; byte b[4]; gi.cprintf(NULL, PRINT_HIGH, "Filter list:\n"); for (i = 0; i < numipfilters; i++) { /* PVS NOTE: maybe use memcpy instead? */ *(unsigned *)b = ipfilters[i].compare; gi.cprintf(NULL, PRINT_HIGH, "%3i.%3i.%3i.%3i\n", b[0], b[1], b[2], b[3]); } } void SVCmd_WriteIP_f(void) { FILE *f; char name[MAX_OSPATH]; byte b[4]; int i; cvar_t *game; game = gi.cvar("game", "", 0); if (!*game->string) { sprintf(name, "%s/listip.cfg", GAMEVERSION); } else { sprintf(name, "%s/listip.cfg", game->string); } gi.cprintf(NULL, PRINT_HIGH, "Writing %s.\n", name); f = fopen(name, "wb"); if (!f) { gi.cprintf(NULL, PRINT_HIGH, "Couldn't open %s\n", name); return; } fprintf(f, "set filterban %d\n", (int)filterban->value); for (i = 0; i < numipfilters; i++) { /* PVS NOTE: maybe use memcpy instead? */ *(unsigned *)b = ipfilters[i].compare; fprintf(f, "sv addip %i.%i.%i.%i\n", b[0], b[1], b[2], b[3]); } fclose(f); } /* * ServerCommand will be called when an "sv" command is issued. * The game can issue gi.argc() / gi.argv() commands to get the rest * of the parameters */ void ServerCommand(void) { char *cmd; cmd = gi.argv(1); if (Q_stricmp(cmd, "test") == 0) { Svcmd_Test_f(); } else if (Q_stricmp(cmd, "addip") == 0) { SVCmd_AddIP_f(); } else if (Q_stricmp(cmd, "removeip") == 0) { SVCmd_RemoveIP_f(); } else if (Q_stricmp(cmd, "listip") == 0) { SVCmd_ListIP_f(); } else if (Q_stricmp(cmd, "writeip") == 0) { SVCmd_WriteIP_f(); } else { gi.cprintf(NULL, PRINT_HIGH, "Unknown server command \"%s\"\n", cmd); } } xatrix-XATRIX_2_14/src/g_target.c000066400000000000000000000605411477320050300166750ustar00rootroot00000000000000/* ======================================================================= * * Targets. * * ======================================================================= */ #include "header/local.h" #define TARGET_HELP_PRIMARY 1 #define TARGET_HELP_THINK_DELAY 0.3f /* QUAKED target_temp_entity (1 0 0) (-8 -8 -8) (8 8 8) * Fire an origin based temp entity event to the clients. * * "style" type byte */ void Use_Target_Tent(edict_t *ent, edict_t *other /* unused */ , edict_t *activator /* unused */) { if (!ent) { return; } gi.WriteByte(svc_temp_entity); gi.WriteByte(ent->style); gi.WritePosition(ent->s.origin); gi.multicast(ent->s.origin, MULTICAST_PVS); } void SP_target_temp_entity(edict_t *ent) { ent->use = Use_Target_Tent; } /* ========================================================== */ /* * QUAKED target_speaker (1 0 0) (-8 -8 -8) (8 8 8) looped-on looped-off reliable * * "noise" wav file to play * * "attenuation" * -1 = none, send to whole level * 1 = normal fighting sounds * 2 = idle sound level * 3 = ambient sound level * * "volume" 0.0 to 1.0 * * Normal sounds play each time the target is used. * The reliable flag can be set for crucial voiceovers. * * Looped sounds are always atten 3 / vol 1, and the use function toggles it on/off. * Multiple identical looping sounds will just increase volume without any speed cost. */ void Use_Target_Speaker(edict_t *ent, edict_t *other /* unused */ , edict_t *activator /* unused */) { int chan; if (!ent) { return; } if (ent->spawnflags & 3) { /* looping sound toggles */ if (ent->s.sound) { ent->s.sound = 0; /* turn it off */ } else { ent->s.sound = ent->noise_index; /* start it */ } } else { /* normal sound */ if (ent->spawnflags & 4) { chan = CHAN_VOICE | CHAN_RELIABLE; } else { chan = CHAN_VOICE; } /* use a positioned_sound, because this entity won't normally be sent to any clients because it is invisible */ gi.positioned_sound(ent->s.origin, ent, chan, ent->noise_index, ent->volume, ent->attenuation, 0); } } void SP_target_speaker(edict_t *ent) { char buffer[MAX_QPATH]; if (!ent) { return; } if (!st.noise) { gi.dprintf("target_speaker with no noise set at %s\n", vtos(ent->s.origin)); return; } if (!strstr(st.noise, ".wav")) { Com_sprintf(buffer, sizeof(buffer), "%s.wav", st.noise); } else { Q_strlcpy(buffer, st.noise, sizeof(buffer)); } ent->noise_index = gi.soundindex(buffer); if (!ent->volume) { ent->volume = 1.0; } if (!ent->attenuation) { ent->attenuation = 1.0; } else if (ent->attenuation == -1) /* use -1 so 0 defaults to 1 */ { ent->attenuation = 0; } /* check for prestarted looping sound */ if (ent->spawnflags & 1) { ent->s.sound = ent->noise_index; } ent->use = Use_Target_Speaker; /* must link the entity so we get areas and clusters so the server can determine who to send updates to */ gi.linkentity(ent); } /* ========================================================== */ static void Target_Help_Apply(const char *msg, int is_primary) { char *curr; size_t sz; if (!msg) { return; } if (is_primary) { curr = game.helpmessage1; sz = sizeof(game.helpmessage1); } else { curr = game.helpmessage2; sz = sizeof(game.helpmessage2); } if (strcmp(curr, msg) == 0) { return; } Q_strlcpy(curr, msg, sz - 1); game.helpchanged++; } void Target_Help_Think(edict_t *ent) { if (!ent) { return; } Target_Help_Apply(ent->message, ent->spawnflags & TARGET_HELP_PRIMARY); ent->think = NULL; } void Use_Target_Help(edict_t *ent, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!ent) { return; } if (level.time > TARGET_HELP_THINK_DELAY) { Target_Help_Apply(ent->message, ent->spawnflags & TARGET_HELP_PRIMARY); } else { /* The game is still pre-loading so delay the help message a bit, otherwise its changes to game structure will leak past save loads */ ent->think = Target_Help_Think; ent->nextthink = TARGET_HELP_THINK_DELAY; } } /* * QUAKED target_help (1 0 1) (-16 -16 -24) (16 16 24) help1 * When fired, the "message" key becomes the current personal computer string, * and the message light will be set on all clients status bars. */ void SP_target_help(edict_t *ent) { if (!ent) { return; } if (deathmatch->value) { /* auto-remove for deathmatch */ G_FreeEdict(ent); return; } if (!ent->message) { gi.dprintf("%s with no message at %s\n", ent->classname, vtos(ent->s.origin)); G_FreeEdict(ent); return; } ent->use = Use_Target_Help; } /* ========================================================== */ /* * QUAKED target_secret (1 0 1) (-8 -8 -8) (8 8 8) * Counts a secret found. These are single use targets. */ void use_target_secret(edict_t *ent, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!ent) { return; } gi.sound(ent, CHAN_VOICE, ent->noise_index, 1, ATTN_NORM, 0); level.found_secrets++; G_UseTargets(ent, activator); G_FreeEdict(ent); } void SP_target_secret(edict_t *ent) { if (!ent) { return; } if (deathmatch->value) { /* auto-remove for deathmatch */ G_FreeEdict(ent); return; } ent->use = use_target_secret; if (!st.noise) { st.noise = "misc/secret.wav"; } ent->noise_index = gi.soundindex(st.noise); ent->svflags = SVF_NOCLIENT; level.total_secrets++; /* Map quirk for mine3 */ if (!Q_stricmp(level.mapname, "mine3") && (ent->s.origin[0] == 280) && (ent->s.origin[1] == -2048) && (ent->s.origin[2] == -624)) { ent->message = "You have found a secret area."; } } /* ========================================================== */ /* * QUAKED target_goal (1 0 1) (-8 -8 -8) (8 8 8) * Counts a goal completed. These are single use targets. */ void use_target_goal(edict_t *ent, edict_t *other /* unused */, edict_t *activator /* unused */) { gi.sound(ent, CHAN_VOICE, ent->noise_index, 1, ATTN_NORM, 0); level.found_goals++; if (level.found_goals == level.total_goals) { gi.configstring(CS_CDTRACK, "0"); } G_UseTargets(ent, activator); G_FreeEdict(ent); } void SP_target_goal(edict_t *ent) { if (!ent) { return; } if (deathmatch->value) { /* auto-remove for deathmatch */ G_FreeEdict(ent); return; } ent->use = use_target_goal; if (!st.noise) { st.noise = "misc/secret.wav"; } ent->noise_index = gi.soundindex(st.noise); ent->svflags = SVF_NOCLIENT; level.total_goals++; } /* ========================================================== */ /* * QUAKED target_explosion (1 0 0) (-8 -8 -8) (8 8 8) * Spawns an explosion temporary entity when used. * * "delay" wait this long before going off * "dmg" how much radius damage should be done, defaults to 0 */ void target_explosion_explode(edict_t *self) { float save; if (!self) { return; } gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_EXPLOSION1); gi.WritePosition(self->s.origin); gi.multicast(self->s.origin, MULTICAST_PHS); T_RadiusDamage(self, self->activator, self->dmg, NULL, self->dmg + 40, MOD_EXPLOSIVE); save = self->delay; self->delay = 0; G_UseTargets(self, self->activator); self->delay = save; } void use_target_explosion(edict_t *self, edict_t *other /* unused */, edict_t *activator) { self->activator = activator; if (!self->delay) { target_explosion_explode(self); return; } self->think = target_explosion_explode; self->nextthink = level.time + self->delay; } void SP_target_explosion(edict_t *ent) { if (!ent) { return; } ent->use = use_target_explosion; ent->svflags = SVF_NOCLIENT; } /* ========================================================== */ /* * QUAKED target_changelevel (1 0 0) (-8 -8 -8) (8 8 8) * Changes level to "map" when fired */ void use_target_changelevel(edict_t *self, edict_t *other, edict_t *activator) { if (!self || !other || !activator) { return; } if (level.intermissiontime) { return; /* already activated */ } if (!deathmatch->value && !coop->value) { if (g_edicts[1].health <= 0) { return; } } /* if noexit, do a ton of damage to other */ if (deathmatch->value && !((int)dmflags->value & DF_ALLOW_EXIT) && (other != world)) { T_Damage(other, self, self, vec3_origin, other->s.origin, vec3_origin, 10 * other->max_health, 1000, 0, MOD_EXIT); return; } /* if multiplayer, let everyone know who hit the exit */ if (deathmatch->value) { if (activator->client) { gi.bprintf(PRINT_HIGH, "%s exited the level.\n", activator->client->pers.netname); } } /* if going to a new unit, clear cross triggers */ if (strstr(self->map, "*")) { game.serverflags &= ~(SFL_CROSS_TRIGGER_MASK); } BeginIntermission(self); } void SP_target_changelevel(edict_t *ent) { if (!ent) { return; } if (!ent->map) { gi.dprintf("target_changelevel with no map at %s\n", vtos(ent->s.origin)); G_FreeEdict(ent); return; } /* ugly hack because *SOMEBODY* screwed up their map */ if ((Q_stricmp(level.mapname, "fact1") == 0) && (Q_stricmp(ent->map, "fact3") == 0)) { ent->map = "fact3$secret1"; } ent->use = use_target_changelevel; ent->svflags = SVF_NOCLIENT; } /* ========================================================== */ /* * QUAKED target_splash (1 0 0) (-8 -8 -8) (8 8 8) * Creates a particle splash effect when used. * * Set "sounds" to one of the following: * 1) sparks * 2) blue water * 3) brown water * 4) slime * 5) lava * 6) blood * * "count" how many pixels in the splash * "dmg" if set, does a radius damage at this location when it splashes * useful for lava/sparks */ void use_target_splash(edict_t *self, edict_t *other /* unused */, edict_t *activator) { if (!self || !activator) { return; } gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_SPLASH); gi.WriteByte(self->count); gi.WritePosition(self->s.origin); gi.WriteDir(self->movedir); gi.WriteByte(self->sounds); gi.multicast(self->s.origin, MULTICAST_PVS); if (self->dmg) { T_RadiusDamage(self, activator, self->dmg, NULL, self->dmg + 40, MOD_SPLASH); } } void SP_target_splash(edict_t *self) { if (!self) { return; } self->use = use_target_splash; G_SetMovedir(self->s.angles, self->movedir); if (!self->count) { self->count = 32; } self->svflags = SVF_NOCLIENT; } /* ========================================================== */ /* * QUAKED target_spawner (1 0 0) (-8 -8 -8) (8 8 8) * Set target to the type of entity you want spawned. * Useful for spawning monsters and gibs in the factory levels. * * For monsters: * Set direction to the facing you want it to have. * * For gibs: * Set direction if you want it moving and * speed how fast it should be moving otherwise it * will just be dropped */ void ED_CallSpawn(edict_t *ent); void use_target_spawner(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { edict_t *ent; if (!self) { return; } ent = G_Spawn(); ent->classname = self->target; VectorCopy(self->s.origin, ent->s.origin); VectorCopy(self->s.angles, ent->s.angles); ED_CallSpawn(ent); gi.unlinkentity(ent); KillBox(ent); gi.linkentity(ent); if (self->speed) { VectorCopy(self->movedir, ent->velocity); } } void SP_target_spawner(edict_t *self) { if (!self) { return; } self->use = use_target_spawner; self->svflags = SVF_NOCLIENT; if (self->speed) { G_SetMovedir(self->s.angles, self->movedir); VectorScale(self->movedir, self->speed, self->movedir); } } /* ========================================================== */ /* * QUAKED target_blaster (1 0 0) (-8 -8 -8) (8 8 8) NOTRAIL NOEFFECTS * Fires a blaster bolt in the set direction when triggered. * * dmg default is 15 * speed default is 1000 */ void use_target_blaster(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!self) { return; } fire_blaster(self, self->s.origin, self->movedir, self->dmg, self->speed, EF_BLASTER, MOD_TARGET_BLASTER); gi.sound(self, CHAN_VOICE, self->noise_index, 1, ATTN_NORM, 0); } void SP_target_blaster(edict_t *self) { if (!self) { return; } self->use = use_target_blaster; G_SetMovedir(self->s.angles, self->movedir); self->noise_index = gi.soundindex("weapons/laser2.wav"); if (!self->dmg) { self->dmg = 15; } if (!self->speed) { self->speed = 1000; } self->svflags = SVF_NOCLIENT; } /* ========================================================== */ /* * QUAKED target_crosslevel_trigger (.5 .5 .5) (-8 -8 -8) (8 8 8) trigger1 trigger2 trigger3 trigger4 trigger5 trigger6 trigger7 trigger8 * Once this trigger is touched/used, any trigger_crosslevel_target with * the same trigger number is automatically used when a level is started * within the same unit. It is OK to check multiple triggers. Message, * delay, target, and killtarget also work. */ void trigger_crosslevel_trigger_use(edict_t *self, edict_t *other /* unused */, edict_t *activator) { if (!self || !activator) { return; } game.serverflags |= self->spawnflags; G_FreeEdict(self); } void SP_target_crosslevel_trigger(edict_t *self) { if (!self) { return; } self->svflags = SVF_NOCLIENT; self->use = trigger_crosslevel_trigger_use; } /* * QUAKED target_crosslevel_target (.5 .5 .5) (-8 -8 -8) (8 8 8) trigger1 trigger2 trigger3 trigger4 trigger5 trigger6 trigger7 trigger8 * Triggered by a trigger_crosslevel elsewhere within a unit. * If multiple triggers are checked, all must be true. Delay, * target and killtarget also work. * * "delay" delay before using targets if the trigger has been * activated (default 1) */ void target_crosslevel_target_think(edict_t *self) { if (!self) { return; } if (self->spawnflags == (game.serverflags & SFL_CROSS_TRIGGER_MASK & self->spawnflags)) { G_UseTargets(self, self); G_FreeEdict(self); } } void SP_target_crosslevel_target(edict_t *self) { if (!self) { return; } if (!self->delay) { self->delay = 1; } self->svflags = SVF_NOCLIENT; self->think = target_crosslevel_target_think; self->nextthink = level.time + self->delay; } /* ========================================================== */ /* * QUAKED target_laser (0 .5 .8) (-8 -8 -8) (8 8 8) START_ON RED GREEN BLUE YELLOW ORANGE FAT * When triggered, fires a laser. You can either set a target * or a direction. */ void target_laser_think(edict_t *self) { edict_t *ignore; vec3_t start; vec3_t end; trace_t tr; vec3_t point; vec3_t last_movedir; int count; if (!self) { return; } if (self->spawnflags & 0x80000000) { count = 8; } else { count = 4; } if (self->enemy) { VectorCopy(self->movedir, last_movedir); VectorMA(self->enemy->absmin, 0.5, self->enemy->size, point); VectorSubtract(point, self->s.origin, self->movedir); VectorNormalize(self->movedir); if (!VectorCompare(self->movedir, last_movedir)) { self->spawnflags |= 0x80000000; } } ignore = self; VectorCopy(self->s.origin, start); VectorMA(start, 2048, self->movedir, end); while (1) { tr = gi.trace(start, NULL, NULL, end, ignore, CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_DEADMONSTER); if (!tr.ent) { break; } /* hurt it if we can */ if ((tr.ent->takedamage) && !(tr.ent->flags & FL_IMMUNE_LASER)) { T_Damage(tr.ent, self, self->activator, self->movedir, tr.endpos, vec3_origin, self->dmg, 1, DAMAGE_ENERGY, MOD_TARGET_LASER); } /* if we hit something that's not a monster or player or is immune to lasers, we're done */ if (!(tr.ent->svflags & SVF_MONSTER) && (!tr.ent->client)) { if (self->spawnflags & 0x80000000) { self->spawnflags &= ~0x80000000; gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_LASER_SPARKS); gi.WriteByte(count); gi.WritePosition(tr.endpos); gi.WriteDir(tr.plane.normal); gi.WriteByte(self->s.skinnum); gi.multicast(tr.endpos, MULTICAST_PVS); } break; } ignore = tr.ent; VectorCopy(tr.endpos, start); } VectorCopy(tr.endpos, self->s.old_origin); self->nextthink = level.time + FRAMETIME; } void target_laser_on(edict_t *self) { if (!self) { return; } if (!self->activator) { self->activator = self; } self->spawnflags |= 0x80000001; self->svflags &= ~SVF_NOCLIENT; target_laser_think(self); } void target_laser_off(edict_t *self) { if (!self) { return; } self->spawnflags &= ~1; self->svflags |= SVF_NOCLIENT; self->nextthink = 0; } void target_laser_use(edict_t *self, edict_t *other /* unused */, edict_t *activator) { if (!self || !activator) { return; } self->activator = activator; if (self->spawnflags & 1) { target_laser_off(self); } else { target_laser_on(self); } } void target_laser_start(edict_t *self) { edict_t *ent; if (!self) { return; } self->movetype = MOVETYPE_NONE; self->solid = SOLID_NOT; self->s.renderfx |= RF_BEAM | RF_TRANSLUCENT; self->s.modelindex = 1; /* must be non-zero */ /* set the beam diameter */ if (self->spawnflags & 64) { self->s.frame = 16; } else { self->s.frame = 4; } /* set the color */ if (self->spawnflags & 2) { self->s.skinnum = 0xf2f2f0f0; } else if (self->spawnflags & 4) { self->s.skinnum = 0xd0d1d2d3; } else if (self->spawnflags & 8) { self->s.skinnum = 0xf3f3f1f1; } else if (self->spawnflags & 16) { self->s.skinnum = 0xdcdddedf; } else if (self->spawnflags & 32) { self->s.skinnum = 0xe0e1e2e3; } if (!self->enemy) { if (self->target) { ent = G_Find(NULL, FOFS(targetname), self->target); if (!ent) { gi.dprintf("%s at %s: %s is a bad target\n", self->classname, vtos(self->s.origin), self->target); } self->enemy = ent; } else { G_SetMovedir(self->s.angles, self->movedir); } } self->use = target_laser_use; self->think = target_laser_think; if (!self->dmg) { self->dmg = 1; } VectorSet(self->mins, -8, -8, -8); VectorSet(self->maxs, 8, 8, 8); gi.linkentity(self); if (self->spawnflags & 1) { target_laser_on(self); } else { target_laser_off(self); } } void SP_target_laser(edict_t *self) { if (!self) { return; } /* let everything else get spawned before we start firing */ self->think = target_laser_start; self->nextthink = level.time + 1; } /* QUAKED target_mal_laser (1 0 0) (-4 -4 -4) (4 4 4) START_ON RED GREEN BLUE YELLOW ORANGE FAT * Mal's laser */ void target_mal_laser_on(edict_t *self) { if (!self) { return; } if (!self->activator) { self->activator = self; } self->spawnflags |= 0x80000001; self->svflags &= ~SVF_NOCLIENT; self->nextthink = level.time + self->wait + self->delay; } void target_mal_laser_off(edict_t *self) { if (!self) { return; } self->spawnflags &= ~1; self->svflags |= SVF_NOCLIENT; self->nextthink = 0; } void target_mal_laser_use(edict_t *self, edict_t *other /* unused */, edict_t *activator) { if (!self || !activator) { return; } self->activator = activator; if (self->spawnflags & 1) { target_mal_laser_off(self); } else { target_mal_laser_on(self); } } void mal_laser_think(edict_t *self) { if (!self) { return; } target_laser_think(self); self->nextthink = level.time + self->wait + 0.1; self->spawnflags |= 0x80000000; } void SP_target_mal_laser(edict_t *self) { if (!self) { return; } self->movetype = MOVETYPE_NONE; self->solid = SOLID_NOT; self->s.renderfx |= RF_BEAM | RF_TRANSLUCENT; self->s.modelindex = 1; /* must be non-zero */ /* set the beam diameter */ if (self->spawnflags & 64) { self->s.frame = 16; } else { self->s.frame = 4; } /* set the color */ if (self->spawnflags & 2) { self->s.skinnum = 0xf2f2f0f0; } else if (self->spawnflags & 4) { self->s.skinnum = 0xd0d1d2d3; } else if (self->spawnflags & 8) { self->s.skinnum = 0xf3f3f1f1; } else if (self->spawnflags & 16) { self->s.skinnum = 0xdcdddedf; } else if (self->spawnflags & 32) { self->s.skinnum = 0xe0e1e2e3; } G_SetMovedir(self->s.angles, self->movedir); if (!self->delay) { self->delay = 0.1; } if (!self->wait) { self->wait = 0.1; } if (!self->dmg) { self->dmg = 5; } VectorSet(self->mins, -8, -8, -8); VectorSet(self->maxs, 8, 8, 8); self->nextthink = level.time + self->delay; self->think = mal_laser_think; self->use = target_mal_laser_use; gi.linkentity(self); if (self->spawnflags & 1) { target_mal_laser_on(self); } else { target_mal_laser_off(self); } } /* ========================================================== */ /* * QUAKED target_lightramp (0 .5 .8) (-8 -8 -8) (8 8 8) TOGGLE * speed How many seconds the ramping will take * message two letters; starting lightlevel and ending lightlevel */ void target_lightramp_think(edict_t *self) { char style[2]; if (!self) { return; } style[0] = 'a' + self->movedir[0] + (level.time - self->timestamp) / FRAMETIME * self->movedir[2]; style[1] = 0; gi.configstring(CS_LIGHTS + self->enemy->style, style); if ((level.time - self->timestamp) < self->speed) { self->nextthink = level.time + FRAMETIME; } else if (self->spawnflags & 1) { char temp; temp = self->movedir[0]; self->movedir[0] = self->movedir[1]; self->movedir[1] = temp; self->movedir[2] *= -1; } } void target_lightramp_use(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!self) { return; } if (!self->enemy) { edict_t *e; /* check all the targets */ e = NULL; while (1) { e = G_Find(e, FOFS(targetname), self->target); if (!e) { break; } if (strcmp(e->classname, "light") != 0) { gi.dprintf("%s at %s ", self->classname, vtos(self->s.origin)); gi.dprintf("target %s (%s at %s) is not a light\n", self->target, e->classname, vtos(e->s.origin)); } else { self->enemy = e; } } if (!self->enemy) { gi.dprintf("%s target %s not found at %s\n", self->classname, self->target, vtos(self->s.origin)); G_FreeEdict(self); return; } } self->timestamp = level.time; target_lightramp_think(self); } void SP_target_lightramp(edict_t *self) { if (!self) { return; } if (!self->message || (strlen(self->message) != 2) || (self->message[0] < 'a') || (self->message[0] > 'z') || (self->message[1] < 'a') || (self->message[1] > 'z') || (self->message[0] == self->message[1])) { gi.dprintf("target_lightramp has bad ramp (%s) at %s\n", self->message, vtos(self->s.origin)); G_FreeEdict(self); return; } if (deathmatch->value) { G_FreeEdict(self); return; } if (!self->target) { gi.dprintf("%s with no target at %s\n", self->classname, vtos(self->s.origin)); G_FreeEdict(self); return; } self->svflags |= SVF_NOCLIENT; self->use = target_lightramp_use; self->think = target_lightramp_think; self->movedir[0] = self->message[0] - 'a'; self->movedir[1] = self->message[1] - 'a'; self->movedir[2] = (self->movedir[1] - self->movedir[0]) / (self->speed / FRAMETIME); } /* ========================================================== */ /* * QUAKED target_earthquake (1 0 0) (-8 -8 -8) (8 8 8) * When triggered, this initiates a level-wide earthquake. * All players and monsters are affected. * "speed" severity of the quake (default:200) * "count" duration of the quake (default:5) */ void target_earthquake_think(edict_t *self) { int i; edict_t *e; if (!self) { return; } if (self->last_move_time < level.time) { gi.positioned_sound(self->s.origin, self, CHAN_AUTO, self->noise_index, 1.0, ATTN_NONE, 0); self->last_move_time = level.time + 0.5; } for (i = 1, e = g_edicts + i; i < globals.num_edicts; i++, e++) { if (!e->inuse) { continue; } if (!e->client) { continue; } if (!e->groundentity) { continue; } e->groundentity = NULL; e->velocity[0] += crandom() * 150; e->velocity[1] += crandom() * 150; e->velocity[2] = self->speed * (100.0 / e->mass); } if (level.time < self->timestamp) { self->nextthink = level.time + FRAMETIME; } } void target_earthquake_use(edict_t *self, edict_t *other /* unused */, edict_t *activator) { if (!self || !activator) { return; } self->timestamp = level.time + self->count; self->nextthink = level.time + FRAMETIME; self->activator = activator; self->last_move_time = 0; } void SP_target_earthquake(edict_t *self) { if (!self) { return; } if (!self->targetname) { gi.dprintf("untargeted %s at %s\n", self->classname, vtos(self->s.origin)); } if (!self->count) { self->count = 5; } if (!self->speed) { self->speed = 200; } self->svflags |= SVF_NOCLIENT; self->think = target_earthquake_think; self->use = target_earthquake_use; self->noise_index = gi.soundindex("world/quake.wav"); } xatrix-XATRIX_2_14/src/g_trigger.c000066400000000000000000000353711477320050300170550ustar00rootroot00000000000000/* ======================================================================= * * Trigger. * * ======================================================================= */ #include "header/local.h" #define PUSH_ONCE 1 void trigger_push_active(edict_t *self); static int windsound; void InitTrigger(edict_t *self) { if (!self) { return; } if (!VectorCompare(self->s.angles, vec3_origin)) { G_SetMovedir(self->s.angles, self->movedir); } self->solid = SOLID_TRIGGER; self->movetype = MOVETYPE_NONE; gi.setmodel(self, self->model); self->svflags = SVF_NOCLIENT; } /* * The wait time has passed, so set * back up for another activation */ void multi_wait(edict_t *ent) { if (!ent) { return; } ent->nextthink = 0; } /* * The trigger was just activated. ent->activator should * be set to the activator so it can be held through a delay * so wait for the delay time before firing */ void multi_trigger(edict_t *ent) { if (!ent) { return; } if (ent->nextthink) { return; /* already been triggered */ } G_UseTargets(ent, ent->activator); if (ent->wait > 0) { ent->think = multi_wait; ent->nextthink = level.time + ent->wait; } else { /* we can't just remove (self) here, because this is a touch function called while looping through area links... */ ent->touch = NULL; ent->nextthink = level.time + FRAMETIME; ent->think = G_FreeEdict; } } void Use_Multi(edict_t *ent, edict_t *other /* unused */, edict_t *activator) { if (!ent || !activator) { return; } ent->activator = activator; multi_trigger(ent); } void Touch_Multi(edict_t *self, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf /* unused */) { if (!self || !other) { return; } if (other->client) { if (self->spawnflags & 2) { return; } } else if (other->svflags & SVF_MONSTER) { if (!(self->spawnflags & 1)) { return; } } else { return; } if (!VectorCompare(self->movedir, vec3_origin)) { vec3_t forward; AngleVectors(other->s.angles, forward, NULL, NULL); if (_DotProduct(forward, self->movedir) < 0) { return; } } self->activator = other; multi_trigger(self); } /* * QUAKED trigger_multiple (.5 .5 .5) ? MONSTER NOT_PLAYER TRIGGERED * Variable sized repeatable trigger. Must be targeted at one or more * entities. If "delay" is set, the trigger waits some time after * activating before firing. * * "wait" : Seconds between triggerings. (.2 default) * * sounds * 1) secret * 2) beep beep * 3) large switch * 4) * * set "message" to text string */ void trigger_enable(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!self) { return; } self->solid = SOLID_TRIGGER; self->use = Use_Multi; gi.linkentity(self); } void SP_trigger_multiple(edict_t *ent) { if (!ent) { return; } if (ent->sounds == 1) { ent->noise_index = gi.soundindex("misc/secret.wav"); } else if (ent->sounds == 2) { ent->noise_index = gi.soundindex("misc/talk.wav"); } else if (ent->sounds == 3) { ent->noise_index = gi.soundindex("misc/trigger1.wav"); } if (!ent->wait) { ent->wait = 0.2; } ent->touch = Touch_Multi; ent->movetype = MOVETYPE_NONE; ent->svflags |= SVF_NOCLIENT; if (ent->spawnflags & 4) { ent->solid = SOLID_NOT; ent->use = trigger_enable; } else { ent->solid = SOLID_TRIGGER; ent->use = Use_Multi; } if (!VectorCompare(ent->s.angles, vec3_origin)) { G_SetMovedir(ent->s.angles, ent->movedir); } gi.setmodel(ent, ent->model); gi.linkentity(ent); } /* * QUAKED trigger_once (.5 .5 .5) ? x x TRIGGERED * Triggers once, then removes itself. * * You must set the key "target" to the name of another * object in the level that has a matching "targetname". * * If TRIGGERED, this trigger must be triggered before it is live. * * sounds * 1) secret * 2) beep beep * 3) large switch * * "message" string to be displayed when triggered */ void SP_trigger_once(edict_t *ent) { if (!ent) { return; } /* make old maps work because I messed up on flag assignments here. triggered was on bit 1 when it should have been on bit 4 */ if (ent->spawnflags & 1) { vec3_t v; VectorMA(ent->mins, 0.5, ent->size, v); ent->spawnflags &= ~1; ent->spawnflags |= 4; gi.dprintf("fixed TRIGGERED flag on %s at %s\n", ent->classname, vtos(v)); } ent->wait = -1; SP_trigger_multiple(ent); } /* * QUAKED trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8) * This fixed size trigger cannot be touched, * it can only be fired by other events. */ void trigger_relay_use(edict_t *self, edict_t *other /* unused */, edict_t *activator /* may be NULL */) { if (!self) { return; } G_UseTargets(self, activator); } void SP_trigger_relay(edict_t *self) { if (!self) { return; } self->use = trigger_relay_use; } /* * QUAKED trigger_key (.5 .5 .5) (-8 -8 -8) (8 8 8) * A relay trigger that only fires it's targets if player * has the proper key. Use "item" to specify the required key, * for example "key_data_cd" */ void trigger_key_use(edict_t *self, edict_t *other /* unused */, edict_t *activator) { int index; if (!self || !activator) { return; } if (!self->item) { return; } if (!activator->client) { return; } index = ITEM_INDEX(self->item); if (!activator->client->pers.inventory[index]) { if (level.time < self->touch_debounce_time) { return; } self->touch_debounce_time = level.time + 5.0; gi.centerprintf(activator, "You need the %s", self->item->pickup_name); gi.sound(activator, CHAN_AUTO, gi.soundindex( "misc/keytry.wav"), 1, ATTN_NORM, 0); return; } gi.sound(activator, CHAN_AUTO, gi.soundindex( "misc/keyuse.wav"), 1, ATTN_NORM, 0); if (coop->value) { int player; edict_t *ent; if (strcmp(self->item->classname, "key_power_cube") == 0) { int cube; for (cube = 0; cube < 8; cube++) { if (activator->client->pers.power_cubes & (1 << cube)) { break; } } for (player = 1; player <= game.maxclients; player++) { ent = &g_edicts[player]; if (!ent->inuse) { continue; } if (!ent->client) { continue; } if (ent->client->pers.power_cubes & (1 << cube)) { ent->client->pers.inventory[index]--; ent->client->pers.power_cubes &= ~(1 << cube); } } } else { for (player = 1; player <= game.maxclients; player++) { ent = &g_edicts[player]; if (!ent->inuse) { continue; } if (!ent->client) { continue; } ent->client->pers.inventory[index] = 0; } } } else { activator->client->pers.inventory[index]--; } G_UseTargets(self, activator); self->use = NULL; } void SP_trigger_key(edict_t *self) { if (!self) { return; } if (!st.item) { gi.dprintf("no key item for trigger_key at %s\n", vtos(self->s.origin)); return; } self->item = FindItemByClassname(st.item); if (!self->item) { gi.dprintf("item %s not found for trigger_key at %s\n", st.item, vtos(self->s.origin)); return; } if (!self->target) { gi.dprintf("%s at %s has no target\n", self->classname, vtos(self->s.origin)); return; } gi.soundindex("misc/keytry.wav"); gi.soundindex("misc/keyuse.wav"); self->use = trigger_key_use; } /* * QUAKED trigger_counter (.5 .5 .5) ? nomessage * Acts as an intermediary for an action that takes multiple inputs. * * If nomessage is not set, it will print "1 more.. " etc when * triggered and "sequence complete" when finished. * * After the counter has been triggered "count" times (default 2), * it will fire all of it's targets and remove itself. */ void trigger_counter_use(edict_t *self, edict_t *other /* unused */, edict_t *activator) { if (!self || !activator) { return; } if (self->count == 0) { return; } self->count--; if (self->count) { if (!(self->spawnflags & 1)) { gi.centerprintf(activator, "%i more to go...", self->count); gi.sound(activator, CHAN_AUTO, gi.soundindex( "misc/talk1.wav"), 1, ATTN_NORM, 0); } return; } if (!(self->spawnflags & 1)) { gi.centerprintf(activator, "Sequence completed!"); gi.sound(activator, CHAN_AUTO, gi.soundindex( "misc/talk1.wav"), 1, ATTN_NORM, 0); } self->activator = activator; multi_trigger(self); } void SP_trigger_counter(edict_t *self) { if (!self) { return; } self->wait = -1; if (!self->count) { self->count = 2; } self->use = trigger_counter_use; } /* * QUAKED trigger_always (.5 .5 .5) (-8 -8 -8) (8 8 8) * This trigger will always fire. It is activated by the world. */ void SP_trigger_always(edict_t *ent) { if (!ent) { return; } /* we must have some delay to make sure our use targets are present */ if (ent->delay < 0.2) { ent->delay = 0.2; } G_UseTargets(ent, ent); } void trigger_push_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf /* unused */) { if (!self || !other) { return; } if (strcmp(other->classname, "grenade") == 0) { VectorScale(self->movedir, self->speed * 10, other->velocity); } else if (other->health > 0) { VectorScale(self->movedir, self->speed * 10, other->velocity); if (other->client) { /* don't take falling damage immediately from this */ VectorCopy(other->velocity, other->client->oldvelocity); if (other->fly_sound_debounce_time < level.time) { other->fly_sound_debounce_time = level.time + 1.5; gi.sound(other, CHAN_AUTO, windsound, 1, ATTN_NORM, 0); } } } if (self->spawnflags & PUSH_ONCE) { G_FreeEdict(self); } } /* * QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE * Pushes the player * * "speed" defaults to 1000 */ void trigger_effect(edict_t *self) { vec3_t origin; vec3_t size; int i; if (!self) { return; } VectorScale(self->size, 0.5, size); VectorAdd(self->absmin, size, origin); for (i = 0; i < 10; i++) { origin[2] += (self->speed * 0.01) * (i + random()); gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_TUNNEL_SPARKS); gi.WriteByte(1); gi.WritePosition(origin); gi.WriteDir(vec3_origin); gi.WriteByte(0x74 + (rand() & 7)); gi.multicast(self->s.origin, MULTICAST_PVS); } } void trigger_push_inactive(edict_t *self) { if (!self) { return; } if (self->delay > level.time) { self->nextthink = level.time + 0.1; } else { self->touch = trigger_push_touch; self->think = trigger_push_active; self->nextthink = level.time + 0.1; self->delay = self->nextthink + self->wait; } } void trigger_push_active(edict_t *self) { if (!self) { return; } if (self->delay > level.time) { self->nextthink = level.time + 0.1; trigger_effect(self); } else { self->touch = NULL; self->think = trigger_push_inactive; self->nextthink = level.time + 0.1; self->delay = self->nextthink + self->wait; } } void SP_trigger_push(edict_t *self) { if (!self) { return; } InitTrigger(self); windsound = gi.soundindex("misc/windfly.wav"); self->touch = trigger_push_touch; if (self->spawnflags & 2) { if (!self->wait) { self->wait = 10; } self->think = trigger_push_active; self->nextthink = level.time + 0.1; self->delay = self->nextthink + self->wait; } if (!self->speed) { self->speed = 1000; } gi.linkentity(self); } /* * QUAKED trigger_hurt (.5 .5 .5) ? START_OFF TOGGLE SILENT NO_PROTECTION SLOW * Any entity that touches this will be hurt. * * It does dmg points of damage each server frame * * SILENT supresses playing the sound * SLOW changes the damage rate to once per second * NO_PROTECTION *nothing* stops the damage * * "dmg" default 5 (whole numbers only) */ void hurt_use(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!self) { return; } if (self->solid == SOLID_NOT) { self->solid = SOLID_TRIGGER; } else { self->solid = SOLID_NOT; } gi.linkentity(self); if (!(self->spawnflags & 2)) { self->use = NULL; } } void hurt_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf /* unused */) { int dflags; if (!self || !other) { return; } if (!other->takedamage) { return; } if (self->timestamp > level.time) { return; } if (self->spawnflags & 16) { self->timestamp = level.time + 1; } else { self->timestamp = level.time + FRAMETIME; } if (!(self->spawnflags & 4)) { if ((level.framenum % 10) == 0) { gi.sound(other, CHAN_AUTO, self->noise_index, 1, ATTN_NORM, 0); } } if (self->spawnflags & 8) { dflags = DAMAGE_NO_PROTECTION; } else { dflags = 0; } T_Damage(other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg, self->dmg, dflags, MOD_TRIGGER_HURT); } void SP_trigger_hurt(edict_t *self) { if (!self) { return; } InitTrigger(self); self->noise_index = gi.soundindex("world/electro.wav"); self->touch = hurt_touch; if (!self->dmg) { self->dmg = 5; } if (self->spawnflags & 1) { self->solid = SOLID_NOT; } else { self->solid = SOLID_TRIGGER; } if (self->spawnflags & 2) { self->use = hurt_use; } gi.linkentity(self); } /* * QUAKED trigger_gravity (.5 .5 .5) ? * Changes the touching entites gravity to * the value of "gravity". 1.0 is standard * gravity for the level. */ void trigger_gravity_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf /* unused */) { if (!self || !other) { return; } other->gravity = self->gravity; } void SP_trigger_gravity(edict_t *self) { if (!self) { return; } if (st.gravity == 0) { gi.dprintf("trigger_gravity without gravity set at %s\n", vtos(self->s.origin)); G_FreeEdict(self); return; } InitTrigger(self); self->gravity = (int)strtol(st.gravity, (char **)NULL, 10); self->touch = trigger_gravity_touch; } /* * QUAKED trigger_monsterjump (.5 .5 .5) ? * Walking monsters that touch this will jump in the direction of the trigger's angle * * "speed" default to 200, the speed thrown forward * "height" default to 200, the speed thrown upwards */ void trigger_monsterjump_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf /* unused */) { if (!self || !other) { return; } if (other->flags & (FL_FLY | FL_SWIM)) { return; } if (other->svflags & SVF_DEADMONSTER) { return; } if (!(other->svflags & SVF_MONSTER)) { return; } /* set XY even if not on ground, so the jump will clear lips */ other->velocity[0] = self->movedir[0] * self->speed; other->velocity[1] = self->movedir[1] * self->speed; if (!other->groundentity) { return; } other->groundentity = NULL; other->velocity[2] = self->movedir[2]; } void SP_trigger_monsterjump(edict_t *self) { if (!self) { return; } if (!self->speed) { self->speed = 200; } if (!st.height) { st.height = 200; } if (self->s.angles[YAW] == 0) { self->s.angles[YAW] = 360; } InitTrigger(self); self->touch = trigger_monsterjump_touch; self->movedir[2] = st.height; } xatrix-XATRIX_2_14/src/g_turret.c000066400000000000000000000262651477320050300167410ustar00rootroot00000000000000/* ======================================================================= * * Turrets aka big cannons with a driver. * * ======================================================================= */ #include "header/local.h" void infantry_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point); void infantry_stand(edict_t *self); void monster_use(edict_t *self, edict_t *other, edict_t *activator); qboolean FindTarget(edict_t *self); void AnglesNormalize(vec3_t vec) { while (vec[0] > 360) { vec[0] -= 360; } while (vec[0] < 0) { vec[0] += 360; } while (vec[1] > 360) { vec[1] -= 360; } while (vec[1] < 0) { vec[1] += 360; } } float SnapToEights(float x) { x *= 8.0; if (x > 0.0) { x += 0.5; } else { x -= 0.5; } return 0.125 * (int)x; } void turret_blocked(edict_t *self, edict_t *other) { edict_t *attacker; if (!self || !other) { return; } if (other->takedamage) { if (self->teammaster->owner) { attacker = self->teammaster->owner; } else { attacker = self->teammaster; } T_Damage(other, self, attacker, vec3_origin, other->s.origin, vec3_origin, self->teammaster->dmg, 10, 0, MOD_CRUSH); } } /* * QUAKED turret_breach (0 0 0) ? * This portion of the turret can change both pitch and yaw. * The model should be made with a flat pitch. * It (and the associated base) need to be oriented towards 0. * Use "angle" to set the starting angle. * * "speed" default 50 * "dmg" default 10 * "angle" point this forward * "target" point this at an info_notnull at the muzzle tip * "minpitch" min acceptable pitch angle : default -30 * "maxpitch" max acceptable pitch angle : default 30 * "minyaw" min acceptable yaw angle : default 0 * "maxyaw" max acceptable yaw angle : default 360 */ void turret_breach_fire(edict_t *self) { vec3_t f, r, u; vec3_t start; int damage; int speed; if (!self) { return; } AngleVectors(self->s.angles, f, r, u); VectorMA(self->s.origin, self->move_origin[0], f, start); VectorMA(start, self->move_origin[1], r, start); VectorMA(start, self->move_origin[2], u, start); damage = 100 + random() * 50; speed = 550 + 50 * skill->value; fire_rocket(self->teammaster->owner, start, f, damage, speed, 150, damage); gi.positioned_sound(start, self, CHAN_WEAPON, gi.soundindex("weapons/rocklf1a.wav"), 1, ATTN_NORM, 0); } void turret_breach_think(edict_t *self) { edict_t *ent; vec3_t current_angles; vec3_t delta; if (!self) { return; } VectorCopy(self->s.angles, current_angles); AnglesNormalize(current_angles); AnglesNormalize(self->move_angles); if (self->move_angles[PITCH] > 180) { self->move_angles[PITCH] -= 360; } /* clamp angles to mins & maxs */ if (self->move_angles[PITCH] > self->pos1[PITCH]) { self->move_angles[PITCH] = self->pos1[PITCH]; } else if (self->move_angles[PITCH] < self->pos2[PITCH]) { self->move_angles[PITCH] = self->pos2[PITCH]; } if ((self->move_angles[YAW] < self->pos1[YAW]) || (self->move_angles[YAW] > self->pos2[YAW])) { float dmin, dmax; dmin = fabs(self->pos1[YAW] - self->move_angles[YAW]); if (dmin < -180) { dmin += 360; } else if (dmin > 180) { dmin -= 360; } dmax = fabs(self->pos2[YAW] - self->move_angles[YAW]); if (dmax < -180) { dmax += 360; } else if (dmax > 180) { dmax -= 360; } if (fabs(dmin) < fabs(dmax)) { self->move_angles[YAW] = self->pos1[YAW]; } else { self->move_angles[YAW] = self->pos2[YAW]; } } VectorSubtract(self->move_angles, current_angles, delta); if (delta[0] < -180) { delta[0] += 360; } else if (delta[0] > 180) { delta[0] -= 360; } if (delta[1] < -180) { delta[1] += 360; } else if (delta[1] > 180) { delta[1] -= 360; } delta[2] = 0; if (delta[0] > self->speed * FRAMETIME) { delta[0] = self->speed * FRAMETIME; } if (delta[0] < -1 * self->speed * FRAMETIME) { delta[0] = -1 * self->speed * FRAMETIME; } if (delta[1] > self->speed * FRAMETIME) { delta[1] = self->speed * FRAMETIME; } if (delta[1] < -1 * self->speed * FRAMETIME) { delta[1] = -1 * self->speed * FRAMETIME; } VectorScale(delta, 1.0 / FRAMETIME, self->avelocity); self->nextthink = level.time + FRAMETIME; for (ent = self->teammaster; ent; ent = ent->teamchain) { ent->avelocity[1] = self->avelocity[1]; } /* if we have a driver, adjust his velocities */ if (self->owner) { float angle; float target_z; float diff; vec3_t target; vec3_t dir; /* angular is easy, just copy ours */ self->owner->avelocity[0] = self->avelocity[0]; self->owner->avelocity[1] = self->avelocity[1]; /* x & y */ angle = self->s.angles[1] + self->owner->move_origin[1]; angle *= (M_PI * 2 / 360); target[0] = SnapToEights(self->s.origin[0] + cos( angle) * self->owner->move_origin[0]); target[1] = SnapToEights(self->s.origin[1] + sin( angle) * self->owner->move_origin[0]); target[2] = self->owner->s.origin[2]; VectorSubtract(target, self->owner->s.origin, dir); self->owner->velocity[0] = dir[0] * 1.0 / FRAMETIME; self->owner->velocity[1] = dir[1] * 1.0 / FRAMETIME; /* z */ angle = self->s.angles[PITCH] * (M_PI * 2 / 360); target_z = SnapToEights( self->s.origin[2] + self->owner->move_origin[0] * tan( angle) + self->owner->move_origin[2]); diff = target_z - self->owner->s.origin[2]; self->owner->velocity[2] = diff * 1.0 / FRAMETIME; if (self->spawnflags & 65536) { turret_breach_fire(self); self->spawnflags &= ~65536; } } } void turret_breach_finish_init(edict_t *self) { if (!self) { return; } /* get and save info for muzzle location */ if (!self->target) { gi.dprintf("%s at %s needs a target\n", self->classname, vtos(self->s.origin)); } else { self->target_ent = G_PickTarget(self->target); VectorSubtract(self->target_ent->s.origin, self->s.origin, self->move_origin); G_FreeEdict(self->target_ent); } self->teammaster->dmg = self->dmg; self->think = turret_breach_think; self->think(self); } void SP_turret_breach(edict_t *self) { if (!self) { return; } self->solid = SOLID_BSP; self->movetype = MOVETYPE_PUSH; gi.setmodel(self, self->model); if (!self->speed) { self->speed = 50; } if (!self->dmg) { self->dmg = 10; } if (!st.minpitch) { st.minpitch = -30; } if (!st.maxpitch) { st.maxpitch = 30; } if (!st.maxyaw) { st.maxyaw = 360; } self->pos1[PITCH] = -1 * st.minpitch; self->pos1[YAW] = st.minyaw; self->pos2[PITCH] = -1 * st.maxpitch; self->pos2[YAW] = st.maxyaw; self->ideal_yaw = self->s.angles[YAW]; self->move_angles[YAW] = self->ideal_yaw; self->blocked = turret_blocked; self->think = turret_breach_finish_init; self->nextthink = level.time + FRAMETIME; gi.linkentity(self); } /* * QUAKED turret_base (0 0 0) ? * This portion of the turret changes yaw only. * MUST be teamed with a turret_breach. */ void SP_turret_base(edict_t *self) { if (!self) { return; } self->solid = SOLID_BSP; self->movetype = MOVETYPE_PUSH; gi.setmodel(self, self->model); self->blocked = turret_blocked; gi.linkentity(self); } /* * QUAKED turret_driver (1 .5 0) (-16 -16 -24) (16 16 32) * Must NOT be on the team with the rest of the turret parts. * Instead it must target the turret_breach. */ void turret_driver_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point) { edict_t *ent; if (!self || !inflictor || !attacker) { return; } /* level the gun */ self->target_ent->move_angles[0] = 0; /* remove the driver from the end of them team chain */ for (ent = self->target_ent->teammaster; ent->teamchain != self; ent = ent->teamchain) { } ent->teamchain = NULL; self->teammaster = NULL; self->flags &= ~FL_TEAMSLAVE; self->target_ent->owner = NULL; self->target_ent->teammaster->owner = NULL; infantry_die(self, inflictor, attacker, damage, point); } void turret_driver_think(edict_t *self) { vec3_t target; vec3_t dir; float reaction_time; if (!self) { return; } self->nextthink = level.time + FRAMETIME; if (self->enemy && (!self->enemy->inuse || (self->enemy->health <= 0))) { self->enemy = NULL; } if (!self->enemy) { if (!FindTarget(self)) { return; } self->monsterinfo.trail_time = level.time; self->monsterinfo.aiflags &= ~AI_LOST_SIGHT; } else { if (visible(self, self->enemy)) { if (self->monsterinfo.aiflags & AI_LOST_SIGHT) { self->monsterinfo.trail_time = level.time; self->monsterinfo.aiflags &= ~AI_LOST_SIGHT; } } else { self->monsterinfo.aiflags |= AI_LOST_SIGHT; return; } } /* let the turret know where we want it to aim */ VectorCopy(self->enemy->s.origin, target); target[2] += self->enemy->viewheight; VectorSubtract(target, self->target_ent->s.origin, dir); vectoangles(dir, self->target_ent->move_angles); /* decide if we should shoot */ if (level.time < self->monsterinfo.attack_finished) { return; } reaction_time = (3 - skill->value) * 1.0; if ((level.time - self->monsterinfo.trail_time) < reaction_time) { return; } self->monsterinfo.attack_finished = level.time + reaction_time + 1.0; self->target_ent->spawnflags |= 65536; } void turret_driver_link(edict_t *self) { vec3_t vec; edict_t *ent; if (!self) { return; } self->think = turret_driver_think; self->nextthink = level.time + FRAMETIME; self->target_ent = G_PickTarget(self->target); self->target_ent->owner = self; self->target_ent->teammaster->owner = self; VectorCopy(self->target_ent->s.angles, self->s.angles); vec[0] = self->target_ent->s.origin[0] - self->s.origin[0]; vec[1] = self->target_ent->s.origin[1] - self->s.origin[1]; vec[2] = 0; self->move_origin[0] = VectorLength(vec); VectorSubtract(self->s.origin, self->target_ent->s.origin, vec); vectoangles(vec, vec); AnglesNormalize(vec); self->move_origin[1] = vec[1]; self->move_origin[2] = self->s.origin[2] - self->target_ent->s.origin[2]; /* add the driver to the end of them team chain */ for (ent = self->target_ent->teammaster; ent->teamchain; ent = ent->teamchain) { } ent->teamchain = self; self->teammaster = self->target_ent->teammaster; self->flags |= FL_TEAMSLAVE; } void SP_turret_driver(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } self->movetype = MOVETYPE_PUSH; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/infantry/tris.md2"); VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, 32); self->health = 100; self->gib_health = 0; self->mass = 200; self->viewheight = 24; self->die = turret_driver_die; self->monsterinfo.stand = infantry_stand; self->flags |= FL_NO_KNOCKBACK; level.total_monsters++; self->svflags |= SVF_MONSTER; self->s.renderfx |= RF_FRAMELERP; self->takedamage = DAMAGE_AIM; self->use = monster_use; self->clipmask = MASK_MONSTERSOLID; VectorCopy(self->s.origin, self->s.old_origin); self->monsterinfo.aiflags |= AI_STAND_GROUND | AI_DUCKED; if (st.item) { self->item = FindItemByClassname(st.item); if (!self->item) { gi.dprintf("%s at %s has bad item: %s\n", self->classname, vtos(self->s.origin), st.item); } } self->think = turret_driver_link; self->nextthink = level.time + FRAMETIME; gi.linkentity(self); } xatrix-XATRIX_2_14/src/g_utils.c000066400000000000000000000251201477320050300165410ustar00rootroot00000000000000/* ======================================================================= * * Misc. utility functions for the game logic. * * ======================================================================= */ #include "header/local.h" #define MAXCHOICES 8 void G_ProjectSource(vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result) { result[0] = point[0] + forward[0] * distance[0] + right[0] * distance[1]; result[1] = point[1] + forward[1] * distance[0] + right[1] * distance[1]; result[2] = point[2] + forward[2] * distance[0] + right[2] * distance[1] + distance[2]; } /* * Searches all active entities for the next one that holds * the matching string at fieldofs (use the FOFS() macro) in the structure. * * Searches beginning at the edict after from, or the beginning if NULL * NULL will be returned if the end of the list is reached. */ edict_t * G_Find(edict_t *from, int fieldofs, char *match) { char *s; if (!from) { from = g_edicts; } else { from++; } for ( ; from < &g_edicts[globals.num_edicts]; from++) { if (!from->inuse) { continue; } s = *(char **)((byte *)from + fieldofs); if (!s) { continue; } if (!Q_stricmp(s, match)) { return from; } } return NULL; } /* * Returns entities that have origins within a spherical area */ edict_t * findradius(edict_t *from, vec3_t org, float rad) { vec3_t eorg; int j; if (!from) { from = g_edicts; } else { from++; } for ( ; from < &g_edicts[globals.num_edicts]; from++) { if (!from->inuse) { continue; } if (from->solid == SOLID_NOT) { continue; } for (j = 0; j < 3; j++) { eorg[j] = org[j] - (from->s.origin[j] + (from->mins[j] + from->maxs[j]) * 0.5); } if (VectorLength(eorg) > rad) { continue; } return from; } return NULL; } /* * Searches all active entities for the next one that holds * the matching string at fieldofs (use the FOFS() macro) in the structure. * * Searches beginning at the edict after from, or the beginning if NULL * NULL will be returned if the end of the list is reached. */ edict_t * G_PickTarget(char *targetname) { edict_t *ent = NULL; int num_choices = 0; edict_t *choice[MAXCHOICES]; if (!targetname) { gi.dprintf("G_PickTarget called with NULL targetname\n"); return NULL; } while (1) { ent = G_Find(ent, FOFS(targetname), targetname); if (!ent) { break; } choice[num_choices++] = ent; if (num_choices == MAXCHOICES) { break; } } if (!num_choices) { gi.dprintf("G_PickTarget: target %s not found\n", targetname); return NULL; } return choice[rand() % num_choices]; } void Think_Delay(edict_t *ent) { if (!ent) { return; } G_UseTargets(ent, ent->activator); G_FreeEdict(ent); } /* * the global "activator" should be set to the entity that initiated the firing. * * If self.delay is set, a DelayedUse entity will be created that will actually * do the SUB_UseTargets after that many seconds have passed. * * Centerprints any self.message to the activator. * * Search for (string)targetname in all entities that * match (string)self.target and call their .use function */ void G_UseTargets(edict_t *ent, edict_t *activator /* may be NULL */) { edict_t *t; if (!ent) { return; } /* check for a delay */ if (ent->delay) { /* create a temp object to fire at a later time */ t = G_Spawn(); t->classname = "DelayedUse"; t->nextthink = level.time + ent->delay; t->think = Think_Delay; t->activator = activator; if (!activator) { gi.dprintf("Think_Delay with no activator\n"); } t->message = ent->message; t->target = ent->target; t->killtarget = ent->killtarget; return; } /* print the message */ if (activator && (ent->message) && !(activator->svflags & SVF_MONSTER)) { gi.centerprintf(activator, "%s", ent->message); if (ent->noise_index) { gi.sound(activator, CHAN_AUTO, ent->noise_index, 1, ATTN_NORM, 0); } else { gi.sound(activator, CHAN_AUTO, gi.soundindex("misc/talk1.wav"), 1, ATTN_NORM, 0); } } /* kill killtargets */ if (ent->killtarget) { t = NULL; while ((t = G_Find(t, FOFS(targetname), ent->killtarget))) { G_FreeEdict(t); if (!ent->inuse) { gi.dprintf("entity was removed while using killtargets\n"); return; } } } /* fire targets */ if (ent->target) { t = NULL; while ((t = G_Find(t, FOFS(targetname), ent->target))) { /* doors fire area portals in a specific way */ if (!Q_stricmp(t->classname, "func_areaportal") && (!Q_stricmp(ent->classname, "func_door") || !Q_stricmp(ent->classname, "func_door_rotating"))) { continue; } if (t == ent) { gi.dprintf("WARNING: Entity used itself.\n"); } else { if (t->use) { t->use(t, ent, activator); } } if (!ent->inuse) { gi.dprintf("entity was removed while using targets\n"); return; } } } } /* * This is just a convenience function * for making temporary vectors for function calls */ float * tv(float x, float y, float z) { static int index; static vec3_t vecs[8]; float *v; /* use an array so that multiple tempvectors won't collide for a while */ v = vecs[index]; index = (index + 1) & 7; v[0] = x; v[1] = y; v[2] = z; return v; } /* * This is just a convenience function * for printing vectors */ char * vtos(vec3_t v) { static int index; static char str[8][32]; char *s; /* use an array so that multiple vtos won't collide */ s = str[index]; index = (index + 1) & 7; Com_sprintf(s, 32, "(%i %i %i)", (int)v[0], (int)v[1], (int)v[2]); return s; } void get_normal_vector(const cplane_t *p, vec3_t normal) { if (p) { VectorCopy(p->normal, normal); } else { VectorCopy(vec3_origin, normal); } } vec3_t VEC_UP = {0, -1, 0}; vec3_t MOVEDIR_UP = {0, 0, 1}; vec3_t VEC_DOWN = {0, -2, 0}; vec3_t MOVEDIR_DOWN = {0, 0, -1}; void G_SetMovedir(vec3_t angles, vec3_t movedir) { if (VectorCompare(angles, VEC_UP)) { VectorCopy(MOVEDIR_UP, movedir); } else if (VectorCompare(angles, VEC_DOWN)) { VectorCopy(MOVEDIR_DOWN, movedir); } else { AngleVectors(angles, movedir, NULL, NULL); } VectorClear(angles); } float vectoyaw(vec3_t vec) { float yaw; if (vec[PITCH] == 0) { yaw = 0; if (vec[YAW] > 0) { yaw = 90; } else if (vec[YAW] < 0) { yaw = -90; } } else { yaw = (int)(atan2(vec[YAW], vec[PITCH]) * 180 / M_PI); if (yaw < 0) { yaw += 360; } } return yaw; } void vectoangles(vec3_t value1, vec3_t angles) { float forward; float yaw, pitch; if ((value1[1] == 0) && (value1[0] == 0)) { yaw = 0; if (value1[2] > 0) { pitch = 90; } else { pitch = 270; } } else { if (value1[0]) { yaw = (int)(atan2(value1[1], value1[0]) * 180 / M_PI); } else if (value1[1] > 0) { yaw = 90; } else { yaw = -90; } if (yaw < 0) { yaw += 360; } forward = sqrt(value1[0] * value1[0] + value1[1] * value1[1]); pitch = (int)(atan2(value1[2], forward) * 180 / M_PI); if (pitch < 0) { pitch += 360; } } angles[PITCH] = -pitch; angles[YAW] = yaw; angles[ROLL] = 0; } char * G_CopyString(char *in) { char *out; out = gi.TagMalloc(strlen(in) + 1, TAG_LEVEL); strcpy(out, in); return out; } void G_InitEdict(edict_t *e) { e->inuse = true; e->classname = "noclass"; e->gravity = 1.0; e->s.number = e - g_edicts; } /* * Either finds a free edict, or allocates a * new one. Try to avoid reusing an entity * that was recently freed, because it can * cause the client to think the entity * morphed into something else instead of * being removed and recreated, which can * cause interpolated angles and bad trails. */ #define POLICY_DEFAULT 0 #define POLICY_DESPERATE 1 static edict_t * G_FindFreeEdict(int policy) { edict_t *e; for (e = g_edicts + game.maxclients + 1 ; e < &g_edicts[globals.num_edicts] ; e++) { /* the first couple seconds of server time can involve a lot of freeing and allocating, so relax the replacement policy */ if (!e->inuse && (policy == POLICY_DESPERATE || e->freetime < 2.0f || (level.time - e->freetime) > 0.5f)) { G_InitEdict (e); return e; } } return NULL; } edict_t * G_SpawnOptional(void) { edict_t *e = G_FindFreeEdict (POLICY_DEFAULT); if (e) { return e; } if (globals.num_edicts >= game.maxentities) { return G_FindFreeEdict (POLICY_DESPERATE); } e = &g_edicts[globals.num_edicts++]; G_InitEdict (e); return e; } edict_t * G_Spawn(void) { edict_t *e = G_SpawnOptional(); if (!e) gi.error ("ED_Alloc: no free edicts"); return e; } /* * Marks the edict as free */ void G_FreeEdict(edict_t *ed) { gi.unlinkentity(ed); /* unlink from world */ if ((ed - g_edicts) <= (maxclients->value + BODY_QUEUE_SIZE)) { return; } memset(ed, 0, sizeof(*ed)); ed->classname = "freed"; ed->freetime = level.time; ed->inuse = false; } void G_TouchTriggers(edict_t *ent) { int i, num; edict_t *touch[MAX_EDICTS], *hit; if (!ent) { return; } /* dead things don't activate triggers! */ if ((ent->client || (ent->svflags & SVF_MONSTER)) && (ent->health <= 0)) { return; } num = gi.BoxEdicts(ent->absmin, ent->absmax, touch, MAX_EDICTS, AREA_TRIGGERS); /* be careful, it is possible to have an entity in this list removed before we get to it (killtriggered) */ for (i = 0; i < num; i++) { hit = touch[i]; if (!hit->inuse) { continue; } if (!hit->touch) { continue; } hit->touch(hit, ent, NULL, NULL); } } /* * Call after linking a new trigger in during gameplay * to force all entities it covers to immediately touch it */ void G_TouchSolids(edict_t *ent) { int i, num; edict_t *touch[MAX_EDICTS], *hit; if (!ent) { return; } num = gi.BoxEdicts(ent->absmin, ent->absmax, touch, MAX_EDICTS, AREA_SOLID); /* be careful, it is possible to have an entity in this list removed before we get to it (killtriggered) */ for (i = 0; i < num; i++) { hit = touch[i]; if (!hit->inuse) { continue; } if (ent->touch) { ent->touch(hit, ent, NULL, NULL); } if (!ent->inuse) { break; } } } /* * Kills all entities that would touch the proposed new positioning * of ent. Ent should be unlinked before calling this! */ qboolean KillBox(edict_t *ent) { trace_t tr; if (!ent) { return false; } while (1) { tr = gi.trace(ent->s.origin, ent->mins, ent->maxs, ent->s.origin, NULL, MASK_PLAYERSOLID); if (!tr.ent) { break; } /* nail it */ T_Damage(tr.ent, ent, ent, vec3_origin, ent->s.origin, vec3_origin, 100000, 0, DAMAGE_NO_PROTECTION, MOD_TELEFRAG); /* if we didn't kill it, fail */ if (tr.ent->solid) { return false; } } return true; /* all clear */ } xatrix-XATRIX_2_14/src/g_weapon.c000066400000000000000000001072041477320050300166760ustar00rootroot00000000000000/* ======================================================================= * * Weapon support functions. * * ======================================================================= */ #include "header/local.h" extern void SP_item_foodcube(edict_t *best); /* * This is a support routine used when a client is firing * a non-instant attack weapon. It checks to see if a * monster's dodge function should be called. */ void check_dodge(edict_t *self, vec3_t start, vec3_t dir, int speed) { vec3_t end; vec3_t v; trace_t tr; float eta; if (!self) { return; } /* easy mode only ducks one quarter the time */ if (skill->value == SKILL_EASY) { if (random() > 0.25) { return; } } VectorMA(start, 8192, dir, end); tr = gi.trace(start, NULL, NULL, end, self, MASK_SHOT); if ((tr.ent) && (tr.ent->svflags & SVF_MONSTER) && (tr.ent->health > 0) && (tr.ent->monsterinfo.dodge) && infront(tr.ent, self)) { VectorSubtract(tr.endpos, start, v); eta = (VectorLength(v) - tr.ent->maxs[0]) / speed; tr.ent->monsterinfo.dodge(tr.ent, self, eta); } } /* * Used for all impact (hit/punch/slash) attacks */ qboolean fire_hit(edict_t *self, vec3_t aim, int damage, int kick) { trace_t tr; vec3_t forward, right, up; vec3_t v; vec3_t point; float range; vec3_t dir; if (!self) { return false; } if (!self->enemy) { return false; } /* see if enemy is in range */ VectorSubtract(self->enemy->s.origin, self->s.origin, dir); range = VectorLength(dir); if (range > aim[0]) { return false; } if ((aim[1] > self->mins[0]) && (aim[1] < self->maxs[0])) { /* the hit is straight on so back the range up to the edge of their bbox */ range -= self->enemy->maxs[0]; } else { /* this is a side hit so adjust the "right" value out to the edge of their bbox */ if (aim[1] < 0) { aim[1] = self->enemy->mins[0]; } else { aim[1] = self->enemy->maxs[0]; } } VectorMA(self->s.origin, range, dir, point); tr = gi.trace(self->s.origin, NULL, NULL, point, self, MASK_SHOT); if (tr.fraction < 1) { if (!tr.ent->takedamage) { return false; } /* if it will hit any client/monster then hit the one we wanted to hit */ if ((tr.ent->svflags & SVF_MONSTER) || (tr.ent->client)) { tr.ent = self->enemy; } } AngleVectors(self->s.angles, forward, right, up); VectorMA(self->s.origin, range, forward, point); VectorMA(point, aim[1], right, point); VectorMA(point, aim[2], up, point); VectorSubtract(point, self->enemy->s.origin, dir); /* do the damage */ T_Damage(tr.ent, self, self, dir, point, vec3_origin, damage, kick / 2, DAMAGE_NO_KNOCKBACK, MOD_HIT); if (!(tr.ent->svflags & SVF_MONSTER) && (!tr.ent->client)) { return false; } /* do our special form of knockback here */ VectorMA(self->enemy->absmin, 0.5, self->enemy->size, v); VectorSubtract(v, point, v); VectorNormalize(v); VectorMA(self->enemy->velocity, kick, v, self->enemy->velocity); if (self->enemy->velocity[2] > 0) { self->enemy->groundentity = NULL; } return true; } /* * This is an internal support routine used for bullet/pellet based weapons. */ void fire_lead(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int te_impact, int hspread, int vspread, int mod) { trace_t tr; vec3_t dir; vec3_t forward, right, up; vec3_t end; float r; float u; vec3_t water_start; qboolean water = false; int content_mask = MASK_SHOT | MASK_WATER; if (!self) { return; } tr = gi.trace(self->s.origin, NULL, NULL, start, self, MASK_SHOT); if (!(tr.fraction < 1.0)) { vectoangles(aimdir, dir); AngleVectors(dir, forward, right, up); r = crandom() * hspread; u = crandom() * vspread; VectorMA(start, 8192, forward, end); VectorMA(end, r, right, end); VectorMA(end, u, up, end); if (gi.pointcontents(start) & MASK_WATER) { water = true; VectorCopy(start, water_start); content_mask &= ~MASK_WATER; } tr = gi.trace(start, NULL, NULL, end, self, content_mask); /* see if we hit water */ if (tr.contents & MASK_WATER) { int color; water = true; VectorCopy(tr.endpos, water_start); if (!VectorCompare(start, tr.endpos)) { if (tr.contents & CONTENTS_WATER) { if (strcmp(tr.surface->name, "*brwater") == 0) { color = SPLASH_BROWN_WATER; } else { color = SPLASH_BLUE_WATER; } } else if (tr.contents & CONTENTS_SLIME) { color = SPLASH_SLIME; } else if (tr.contents & CONTENTS_LAVA) { color = SPLASH_LAVA; } else { color = SPLASH_UNKNOWN; } if (color != SPLASH_UNKNOWN) { gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_SPLASH); gi.WriteByte(8); gi.WritePosition(tr.endpos); gi.WriteDir(tr.plane.normal); gi.WriteByte(color); gi.multicast(tr.endpos, MULTICAST_PVS); } /* change bullet's course when it enters water */ VectorSubtract(end, start, dir); vectoangles(dir, dir); AngleVectors(dir, forward, right, up); r = crandom() * hspread * 2; u = crandom() * vspread * 2; VectorMA(water_start, 8192, forward, end); VectorMA(end, r, right, end); VectorMA(end, u, up, end); } /* re-trace ignoring water this time */ tr = gi.trace(water_start, NULL, NULL, end, self, MASK_SHOT); } } /* send gun puff / flash */ if (!((tr.surface) && (tr.surface->flags & SURF_SKY))) { if (tr.fraction < 1.0) { if (tr.ent->takedamage) { T_Damage(tr.ent, self, self, aimdir, tr.endpos, tr.plane.normal, damage, kick, DAMAGE_BULLET, mod); } else { if (strncmp(tr.surface->name, "sky", 3) != 0) { gi.WriteByte(svc_temp_entity); gi.WriteByte(te_impact); gi.WritePosition(tr.endpos); gi.WriteDir(tr.plane.normal); gi.multicast(tr.endpos, MULTICAST_PVS); if (self->client) { PlayerNoise(self, tr.endpos, PNOISE_IMPACT); } } } } } /* if went through water, determine where the end and make a bubble trail */ if (water) { vec3_t pos; VectorSubtract(tr.endpos, water_start, dir); VectorNormalize(dir); VectorMA(tr.endpos, -2, dir, pos); if (gi.pointcontents(pos) & MASK_WATER) { VectorCopy(pos, tr.endpos); } else { tr = gi.trace(pos, NULL, NULL, water_start, tr.ent, MASK_WATER); } VectorAdd(water_start, tr.endpos, pos); VectorScale(pos, 0.5, pos); gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_BUBBLETRAIL); gi.WritePosition(water_start); gi.WritePosition(tr.endpos); gi.multicast(pos, MULTICAST_PVS); } } /* * Fires a single round. Used for machinegun and chaingun. * Would be fine for pistols, rifles, etc.... */ void fire_bullet(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int mod) { if (!self) { return; } fire_lead(self, start, aimdir, damage, kick, TE_GUNSHOT, hspread, vspread, mod); } /* * Shoots shotgun pellets. Used by shotgun and super shotgun. */ void fire_shotgun(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count, int mod) { int i; if (!self) { return; } for (i = 0; i < count; i++) { fire_lead(self, start, aimdir, damage, kick, TE_SHOTGUN, hspread, vspread, mod); } } /* * Fires a single blaster bolt. Used by the blaster and hyper blaster. */ void blaster_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) { int mod; vec3_t normal; if (!self || !other) { G_FreeEdict(self); return; } if (other == self->owner) { return; } if (surf && (surf->flags & SURF_SKY)) { G_FreeEdict(self); return; } if (self->owner->client) { PlayerNoise(self->owner, self->s.origin, PNOISE_IMPACT); } get_normal_vector(plane, normal); if (other->takedamage) { if (self->spawnflags & 1) { mod = MOD_HYPERBLASTER; } else { mod = MOD_BLASTER; } T_Damage(other, self, self->owner, self->velocity, self->s.origin, normal, self->dmg, 1, DAMAGE_ENERGY, mod); } else { gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_BLASTER); gi.WritePosition(self->s.origin); gi.WriteDir(normal); gi.multicast(self->s.origin, MULTICAST_PVS); } G_FreeEdict(self); } void fire_blaster(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int effect, qboolean hyper) { edict_t *bolt; trace_t tr; if (!self) { return; } VectorNormalize(dir); bolt = G_Spawn(); bolt->svflags = SVF_DEADMONSTER; /* yes, I know it looks weird that projectiles are deadmonsters what this means is that when prediction is used against the object (blaster/hyperblaster shots), the player won't be solid clipped against the object. Right now trying to run into a firing hyperblaster is very jerky since you are predicted 'against' the shots. */ VectorCopy(start, bolt->s.origin); VectorCopy(start, bolt->s.old_origin); vectoangles(dir, bolt->s.angles); VectorScale(dir, speed, bolt->velocity); bolt->movetype = MOVETYPE_FLYMISSILE; bolt->clipmask = MASK_SHOT; bolt->solid = SOLID_BBOX; bolt->s.effects |= effect; VectorClear(bolt->mins); VectorClear(bolt->maxs); bolt->s.modelindex = gi.modelindex("models/objects/laser/tris.md2"); bolt->s.sound = gi.soundindex("misc/lasfly.wav"); bolt->owner = self; bolt->touch = blaster_touch; bolt->nextthink = level.time + 2; bolt->think = G_FreeEdict; bolt->dmg = damage; bolt->classname = "bolt"; if (hyper) { bolt->spawnflags = 1; } gi.linkentity(bolt); if (self->client) { check_dodge(self, bolt->s.origin, dir, speed); } tr = gi.trace(self->s.origin, NULL, NULL, bolt->s.origin, bolt, MASK_SHOT); if (tr.fraction < 1.0) { VectorMA(bolt->s.origin, -10, dir, bolt->s.origin); bolt->touch(bolt, tr.ent, NULL, NULL); } } void fire_blueblaster(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int effect) { edict_t *bolt; trace_t tr; if (!self) { return; } VectorNormalize(dir); bolt = G_Spawn(); VectorCopy(start, bolt->s.origin); VectorCopy(start, bolt->s.old_origin); vectoangles(dir, bolt->s.angles); VectorScale(dir, speed, bolt->velocity); bolt->movetype = MOVETYPE_FLYMISSILE; bolt->clipmask = MASK_SHOT; bolt->solid = SOLID_BBOX; bolt->s.effects |= effect; VectorClear(bolt->mins); VectorClear(bolt->maxs); bolt->s.modelindex = gi.modelindex("models/objects/blaser/tris.md2"); bolt->s.sound = gi.soundindex("misc/lasfly.wav"); bolt->owner = self; bolt->touch = blaster_touch; bolt->nextthink = level.time + 2; bolt->think = G_FreeEdict; bolt->dmg = damage; bolt->classname = "bolt"; gi.linkentity(bolt); if (self->client) { check_dodge(self, bolt->s.origin, dir, speed); } tr = gi.trace(self->s.origin, NULL, NULL, bolt->s.origin, bolt, MASK_SHOT); if (tr.fraction < 1.0) { VectorMA(bolt->s.origin, -10, dir, bolt->s.origin); bolt->touch(bolt, tr.ent, NULL, NULL); } } void Grenade_Explode(edict_t *ent) { vec3_t origin; int mod; if (!ent) { return; } if (ent->owner->client) { PlayerNoise(ent->owner, ent->s.origin, PNOISE_IMPACT); } if (ent->enemy) { float points; vec3_t v; vec3_t dir; VectorAdd(ent->enemy->mins, ent->enemy->maxs, v); VectorMA(ent->enemy->s.origin, 0.5, v, v); VectorSubtract(ent->s.origin, v, v); points = ent->dmg - 0.5 * VectorLength(v); VectorSubtract(ent->enemy->s.origin, ent->s.origin, dir); if (ent->spawnflags & 1) { mod = MOD_HANDGRENADE; } else { mod = MOD_GRENADE; } T_Damage(ent->enemy, ent, ent->owner, dir, ent->s.origin, vec3_origin, (int)points, (int)points, DAMAGE_RADIUS, mod); } if (ent->spawnflags & 2) { mod = MOD_HELD_GRENADE; } else if (ent->spawnflags & 1) { mod = MOD_HG_SPLASH; } else { mod = MOD_G_SPLASH; } T_RadiusDamage(ent, ent->owner, ent->dmg, ent->enemy, ent->dmg_radius, mod); VectorMA(ent->s.origin, -0.02, ent->velocity, origin); gi.WriteByte(svc_temp_entity); if (ent->waterlevel) { if (ent->groundentity) { gi.WriteByte(TE_GRENADE_EXPLOSION_WATER); } else { gi.WriteByte(TE_ROCKET_EXPLOSION_WATER); } } else { if (ent->groundentity) { gi.WriteByte(TE_GRENADE_EXPLOSION); } else { gi.WriteByte(TE_ROCKET_EXPLOSION); } } gi.WritePosition(origin); gi.multicast(ent->s.origin, MULTICAST_PHS); G_FreeEdict(ent); } void Grenade_Touch(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf) { if (!ent || !other) { G_FreeEdict(ent); return; } if (other == ent->owner) { return; } if (surf && (surf->flags & SURF_SKY)) { G_FreeEdict(ent); return; } if (!other->takedamage) { if (ent->spawnflags & 1) { if (random() > 0.5) { gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/hgrenb1a.wav"), 1, ATTN_NORM, 0); } else { gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/hgrenb2a.wav"), 1, ATTN_NORM, 0); } } else { gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/grenlb1b.wav"), 1, ATTN_NORM, 0); } return; } ent->enemy = other; Grenade_Explode(ent); } void fire_grenade(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, float timer, float damage_radius) { edict_t *grenade; vec3_t dir; vec3_t forward, right, up; if (!self) { return; } vectoangles(aimdir, dir); AngleVectors(dir, forward, right, up); grenade = G_Spawn(); VectorCopy(start, grenade->s.origin); VectorScale(aimdir, speed, grenade->velocity); VectorMA(grenade->velocity, 200 + crandom() * 10.0, up, grenade->velocity); VectorMA(grenade->velocity, crandom() * 10.0, right, grenade->velocity); VectorSet(grenade->avelocity, 300, 300, 300); grenade->movetype = MOVETYPE_BOUNCE; grenade->clipmask = MASK_SHOT; grenade->solid = SOLID_BBOX; grenade->s.effects |= EF_GRENADE; VectorClear(grenade->mins); VectorClear(grenade->maxs); grenade->s.modelindex = gi.modelindex("models/objects/grenade/tris.md2"); grenade->owner = self; grenade->touch = Grenade_Touch; grenade->nextthink = level.time + timer; grenade->think = Grenade_Explode; grenade->dmg = damage; grenade->dmg_radius = damage_radius; grenade->classname = "grenade"; gi.linkentity(grenade); } void fire_grenade2(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, float timer, float damage_radius, qboolean held) { edict_t *grenade; vec3_t dir; vec3_t forward, right, up; if (!self) { return; } vectoangles(aimdir, dir); AngleVectors(dir, forward, right, up); grenade = G_Spawn(); VectorCopy(start, grenade->s.origin); VectorScale(aimdir, speed, grenade->velocity); VectorMA(grenade->velocity, 200 + crandom() * 10.0, up, grenade->velocity); VectorMA(grenade->velocity, crandom() * 10.0, right, grenade->velocity); VectorSet(grenade->avelocity, 300, 300, 300); grenade->movetype = MOVETYPE_BOUNCE; grenade->clipmask = MASK_SHOT; grenade->solid = SOLID_BBOX; grenade->s.effects |= EF_GRENADE; VectorClear(grenade->mins); VectorClear(grenade->maxs); grenade->s.modelindex = gi.modelindex("models/objects/grenade2/tris.md2"); grenade->owner = self; grenade->touch = Grenade_Touch; grenade->nextthink = level.time + timer; grenade->think = Grenade_Explode; grenade->dmg = damage; grenade->dmg_radius = damage_radius; grenade->classname = "hgrenade"; if (held) { grenade->spawnflags = 3; } else { grenade->spawnflags = 1; } grenade->s.sound = gi.soundindex("weapons/hgrenc1b.wav"); if (timer <= 0.0) { Grenade_Explode(grenade); } else { gi.sound(self, CHAN_WEAPON, gi.soundindex("weapons/hgrent1a.wav"), 1, ATTN_NORM, 0); gi.linkentity(grenade); } } void rocket_touch(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf) { vec3_t origin; vec3_t normal; int n; if (!ent || !other) { G_FreeEdict(ent); return; } if (other == ent->owner) { return; } if (surf && (surf->flags & SURF_SKY)) { G_FreeEdict(ent); return; } if (ent->owner->client) { PlayerNoise(ent->owner, ent->s.origin, PNOISE_IMPACT); } /* calculate position for the explosion entity */ VectorMA(ent->s.origin, -0.02, ent->velocity, origin); if (other->takedamage) { get_normal_vector(plane, normal); T_Damage(other, ent, ent->owner, ent->velocity, ent->s.origin, normal, ent->dmg, 0, 0, MOD_ROCKET); } else { /* don't throw any debris in net games */ if (!deathmatch->value && !coop->value) { if ((surf) && !(surf->flags & (SURF_WARP | SURF_TRANS33 | SURF_TRANS66 | SURF_FLOWING))) { n = rand() % 5; while (n--) { ThrowDebris(ent, "models/objects/debris2/tris.md2", 2, ent->s.origin); } } } } T_RadiusDamage(ent, ent->owner, ent->radius_dmg, other, ent->dmg_radius, MOD_R_SPLASH); gi.WriteByte(svc_temp_entity); if (ent->waterlevel) { gi.WriteByte(TE_ROCKET_EXPLOSION_WATER); } else { gi.WriteByte(TE_ROCKET_EXPLOSION); } gi.WritePosition(origin); gi.multicast(ent->s.origin, MULTICAST_PHS); G_FreeEdict(ent); } void fire_rocket(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius, int radius_damage) { edict_t *rocket; if (!self) { return; } rocket = G_Spawn(); VectorCopy(start, rocket->s.origin); VectorCopy(dir, rocket->movedir); vectoangles(dir, rocket->s.angles); VectorScale(dir, speed, rocket->velocity); rocket->movetype = MOVETYPE_FLYMISSILE; rocket->clipmask = MASK_SHOT; rocket->solid = SOLID_BBOX; rocket->s.effects |= EF_ROCKET; VectorClear(rocket->mins); VectorClear(rocket->maxs); rocket->s.modelindex = gi.modelindex("models/objects/rocket/tris.md2"); rocket->owner = self; rocket->touch = rocket_touch; rocket->nextthink = level.time + (8000.0f / (float)speed); rocket->think = G_FreeEdict; rocket->dmg = damage; rocket->radius_dmg = radius_damage; rocket->dmg_radius = damage_radius; rocket->s.sound = gi.soundindex("weapons/rockfly.wav"); rocket->classname = "rocket"; if (self->client) { check_dodge(self, rocket->s.origin, dir, speed); } gi.linkentity(rocket); } void fire_rail(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick) { vec3_t from; vec3_t end; trace_t tr; edict_t *ignore; int mask; qboolean water; if (!self) { return; } VectorMA(start, 8192, aimdir, end); VectorCopy(start, from); ignore = self; water = false; mask = MASK_SHOT | CONTENTS_SLIME | CONTENTS_LAVA; while (ignore) { tr = gi.trace(from, NULL, NULL, end, ignore, mask); if (tr.contents & (CONTENTS_SLIME | CONTENTS_LAVA)) { mask &= ~(CONTENTS_SLIME | CONTENTS_LAVA); water = true; } else { /* -added so rail goes through SOLID_BBOX entities (gibs, etc) */ if ((tr.ent->svflags & SVF_MONSTER) || (tr.ent->client) || (tr.ent->solid == SOLID_BBOX)) { ignore = tr.ent; } else { ignore = NULL; } if ((tr.ent != self) && (tr.ent->takedamage)) { T_Damage(tr.ent, self, self, aimdir, tr.endpos, tr.plane.normal, damage, kick, 0, MOD_RAILGUN); } else { ignore = NULL; } } VectorCopy(tr.endpos, from); } /* send gun puff / flash */ gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_RAILTRAIL); gi.WritePosition(start); gi.WritePosition(tr.endpos); gi.multicast(self->s.origin, MULTICAST_PHS); if (water) { gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_RAILTRAIL); gi.WritePosition(start); gi.WritePosition(tr.endpos); gi.multicast(tr.endpos, MULTICAST_PHS); } if (self->client) { PlayerNoise(self, tr.endpos, PNOISE_IMPACT); } } void bfg_explode(edict_t *self) { edict_t *ent; float points; vec3_t v; float dist; if (!self) { return; } if (self->s.frame == 0) { /* the BFG effect */ ent = NULL; while ((ent = findradius(ent, self->s.origin, self->dmg_radius)) != NULL) { if (!ent->takedamage) { continue; } if (ent == self->owner) { continue; } if (!CanDamage(ent, self)) { continue; } if (!CanDamage(ent, self->owner)) { continue; } VectorAdd(ent->mins, ent->maxs, v); VectorMA(ent->s.origin, 0.5, v, v); VectorSubtract(self->s.origin, v, v); dist = VectorLength(v); points = self->radius_dmg * (1.0 - sqrt(dist / self->dmg_radius)); if (ent == self->owner) { points = points * 0.5; } gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_BFG_EXPLOSION); gi.WritePosition(ent->s.origin); gi.multicast(ent->s.origin, MULTICAST_PHS); T_Damage(ent, self, self->owner, self->velocity, ent->s.origin, vec3_origin, (int)points, 0, DAMAGE_ENERGY, MOD_BFG_EFFECT); } } self->nextthink = level.time + FRAMETIME; self->s.frame++; if (self->s.frame == 5) { self->think = G_FreeEdict; } } void bfg_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) { vec3_t normal; if (!self || !other) { G_FreeEdict(self); return; } if (other == self->owner) { return; } if (surf && (surf->flags & SURF_SKY)) { G_FreeEdict(self); return; } if (self->owner->client) { PlayerNoise(self->owner, self->s.origin, PNOISE_IMPACT); } /* core explosion - prevents firing it into the wall/floor */ if (other->takedamage) { get_normal_vector(plane, normal); T_Damage(other, self, self->owner, self->velocity, self->s.origin, normal, 200, 0, 0, MOD_BFG_BLAST); } T_RadiusDamage(self, self->owner, 200, other, 100, MOD_BFG_BLAST); gi.sound(self, CHAN_VOICE, gi.soundindex("weapons/bfg__x1b.wav"), 1, ATTN_NORM, 0); self->solid = SOLID_NOT; self->touch = NULL; /* move it back a bit from walls so the effects aren't cut off */ if (!other->takedamage) { VectorNormalize(self->velocity); VectorMA(self->s.origin, -40.0f, self->velocity, self->s.origin); } VectorClear(self->velocity); self->s.modelindex = gi.modelindex("sprites/s_bfg3.sp2"); self->s.frame = 0; self->s.sound = 0; self->s.effects &= ~EF_ANIM_ALLFAST; self->think = bfg_explode; self->nextthink = level.time + FRAMETIME; self->enemy = other; gi.linkentity(self); gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_BFG_BIGEXPLOSION); gi.WritePosition(self->s.origin); gi.multicast(self->s.origin, MULTICAST_PVS); } void bfg_think(edict_t *self) { edict_t *ent; edict_t *ignore; vec3_t point; vec3_t dir; vec3_t start; vec3_t end; int dmg; trace_t tr; if (!self) { return; } if (deathmatch->value) { dmg = 5; } else { dmg = 10; } ent = NULL; while ((ent = findradius(ent, self->s.origin, 256)) != NULL) { if (ent == self) { continue; } if (ent == self->owner) { continue; } if (!ent->takedamage) { continue; } if (!(ent->svflags & SVF_MONSTER) && (!ent->client) && (strcmp(ent->classname, "misc_explobox") != 0)) { continue; } VectorMA(ent->absmin, 0.5, ent->size, point); VectorSubtract(point, self->s.origin, dir); VectorNormalize(dir); ignore = self; VectorCopy(self->s.origin, start); VectorMA(start, 2048, dir, end); while (1) { tr = gi.trace(start, NULL, NULL, end, ignore, CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_DEADMONSTER); if (!tr.ent) { break; } /* hurt it if we can */ if ((tr.ent->takedamage) && !(tr.ent->flags & FL_IMMUNE_LASER) && (tr.ent != self->owner)) { T_Damage(tr.ent, self, self->owner, dir, tr.endpos, vec3_origin, dmg, 1, DAMAGE_ENERGY, MOD_BFG_LASER); } /* if we hit something that's not a monster or player we're done */ if (!(tr.ent->svflags & SVF_MONSTER) && (!tr.ent->client)) { gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_LASER_SPARKS); gi.WriteByte(4); gi.WritePosition(tr.endpos); gi.WriteDir(tr.plane.normal); gi.WriteByte(self->s.skinnum); gi.multicast(tr.endpos, MULTICAST_PVS); break; } ignore = tr.ent; VectorCopy(tr.endpos, start); } gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_BFG_LASER); gi.WritePosition(self->s.origin); gi.WritePosition(tr.endpos); gi.multicast(self->s.origin, MULTICAST_PHS); } self->nextthink = level.time + FRAMETIME; } void fire_bfg(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius) { edict_t *bfg; if (!self) { return; } bfg = G_Spawn(); VectorCopy(start, bfg->s.origin); VectorCopy(dir, bfg->movedir); vectoangles(dir, bfg->s.angles); VectorScale(dir, speed, bfg->velocity); bfg->movetype = MOVETYPE_FLYMISSILE; bfg->clipmask = MASK_SHOT; bfg->solid = SOLID_BBOX; bfg->s.effects |= EF_BFG | EF_ANIM_ALLFAST; VectorClear(bfg->mins); VectorClear(bfg->maxs); bfg->s.modelindex = gi.modelindex("sprites/s_bfg1.sp2"); bfg->owner = self; bfg->touch = bfg_touch; bfg->nextthink = level.time + (8000.0f / (float)speed); bfg->think = G_FreeEdict; bfg->radius_dmg = damage; bfg->dmg_radius = damage_radius; bfg->classname = "bfg blast"; bfg->s.sound = gi.soundindex("weapons/bfg__l1a.wav"); bfg->think = bfg_think; bfg->nextthink = level.time + FRAMETIME; bfg->teammaster = bfg; bfg->teamchain = NULL; if (self->client) { check_dodge(self, bfg->s.origin, dir, speed); } gi.linkentity(bfg); } void ionripper_sparks(edict_t *self) { if (!self) { return; } gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_WELDING_SPARKS); gi.WriteByte(0); gi.WritePosition(self->s.origin); gi.WriteDir(vec3_origin); gi.WriteByte(0xe4 + (rand() & 3)); gi.multicast(self->s.origin, MULTICAST_PVS); G_FreeEdict(self); } void ionripper_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) { vec3_t normal; if (!self || !other) { return; } if (other == self->owner) { return; } if (surf && (surf->flags & SURF_SKY)) { G_FreeEdict(self); return; } if (self->owner->client) { PlayerNoise(self->owner, self->s.origin, PNOISE_IMPACT); } if (other->takedamage) { get_normal_vector(plane, normal); T_Damage(other, self, self->owner, self->velocity, self->s.origin, normal, self->dmg, 1, DAMAGE_ENERGY, MOD_RIPPER); G_FreeEdict(self); } } void fire_ionripper(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int effect) { edict_t *ion; trace_t tr; if (!self) { return; } VectorNormalize(dir); ion = G_Spawn(); VectorCopy(start, ion->s.origin); VectorCopy(start, ion->s.old_origin); vectoangles(dir, ion->s.angles); VectorScale(dir, speed, ion->velocity); ion->movetype = MOVETYPE_WALLBOUNCE; ion->clipmask = MASK_SHOT; ion->solid = SOLID_BBOX; ion->s.effects |= effect; ion->s.renderfx |= RF_FULLBRIGHT; VectorClear(ion->mins); VectorClear(ion->maxs); ion->s.modelindex = gi.modelindex("models/objects/boomrang/tris.md2"); ion->s.sound = gi.soundindex("misc/lasfly.wav"); ion->owner = self; ion->touch = ionripper_touch; ion->nextthink = level.time + 3; ion->think = ionripper_sparks; ion->dmg = damage; ion->dmg_radius = 100; gi.linkentity(ion); if (self->client) { check_dodge(self, ion->s.origin, dir, speed); } tr = gi.trace(self->s.origin, NULL, NULL, ion->s.origin, ion, MASK_SHOT); if (tr.fraction < 1.0) { VectorMA(ion->s.origin, -10, dir, ion->s.origin); ion->touch(ion, tr.ent, NULL, NULL); } } void heat_think(edict_t *self) { edict_t *target = NULL; edict_t *aquire = NULL; vec3_t vec; float len; float oldlen = 0; if (!self) { return; } /* aquire new target */ while ((target = findradius(target, self->s.origin, 1024)) != NULL) { if (self->owner == target) { continue; } if (!target->client) { continue; } if (target->health <= 0) { continue; } if (!infront(self, target)) { continue; } if (!visible(self, target)) { continue; } VectorSubtract(self->s.origin, target->s.origin, vec); len = VectorLength(vec); if ((!aquire) || (len < oldlen)) { aquire = target; oldlen = len; } } if (aquire) { VectorSubtract(aquire->s.origin, self->s.origin, vec); vectoangles(vec, self->s.angles); VectorNormalize(vec); VectorScale(vec, 500, self->velocity); } self->nextthink = level.time + 0.1; } void fire_heat(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius, int radius_damage) { edict_t *heat; if (!self) { return; } heat = G_Spawn(); VectorCopy(start, heat->s.origin); VectorCopy(dir, heat->movedir); vectoangles(dir, heat->s.angles); VectorScale(dir, speed, heat->velocity); heat->movetype = MOVETYPE_FLYMISSILE; heat->clipmask = MASK_SHOT; heat->solid = SOLID_BBOX; heat->s.effects |= EF_ROCKET; VectorClear(heat->mins); VectorClear(heat->maxs); heat->s.modelindex = gi.modelindex("models/objects/rocket/tris.md2"); heat->owner = self; heat->touch = rocket_touch; heat->nextthink = level.time + 0.1; heat->think = heat_think; heat->dmg = damage; heat->radius_dmg = radius_damage; heat->dmg_radius = damage_radius; heat->s.sound = gi.soundindex("weapons/rockfly.wav"); if (self->client) { check_dodge(self, heat->s.origin, dir, speed); } gi.linkentity(heat); } void plasma_touch(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf) { vec3_t origin; vec3_t normal; if (!ent || !other) { return; } if (other == ent->owner) { return; } if (surf && (surf->flags & SURF_SKY)) { G_FreeEdict(ent); return; } if (ent->owner->client) { PlayerNoise(ent->owner, ent->s.origin, PNOISE_IMPACT); } /* calculate position for the explosion entity */ VectorMA(ent->s.origin, -0.02, ent->velocity, origin); if (other->takedamage) { get_normal_vector(plane, normal); T_Damage(other, ent, ent->owner, ent->velocity, ent->s.origin, normal, ent->dmg, 0, 0, MOD_PHALANX); } T_RadiusDamage(ent, ent->owner, ent->radius_dmg, other, ent->dmg_radius, MOD_PHALANX); gi.WriteByte(svc_temp_entity); if (ent->waterlevel) { gi.WriteByte(TE_ROCKET_EXPLOSION_WATER); } else { gi.WriteByte(TE_PLASMA_EXPLOSION); } gi.WritePosition(origin); gi.multicast(ent->s.origin, MULTICAST_PVS); G_FreeEdict(ent); } void fire_plasma(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius, int radius_damage) { edict_t *plasma; if (!self) { return; } plasma = G_Spawn(); VectorCopy(start, plasma->s.origin); VectorCopy(dir, plasma->movedir); vectoangles(dir, plasma->s.angles); VectorScale(dir, speed, plasma->velocity); plasma->movetype = MOVETYPE_FLYMISSILE; plasma->clipmask = MASK_SHOT; plasma->solid = SOLID_BBOX; VectorClear(plasma->mins); VectorClear(plasma->maxs); plasma->owner = self; plasma->touch = plasma_touch; plasma->nextthink = level.time + (8000.0f / (float)speed); plasma->think = G_FreeEdict; plasma->dmg = damage; plasma->radius_dmg = radius_damage; plasma->dmg_radius = damage_radius; plasma->s.sound = gi.soundindex("weapons/rockfly.wav"); plasma->s.modelindex = gi.modelindex("sprites/s_photon.sp2"); plasma->s.effects |= EF_PLASMA | EF_ANIM_ALLFAST; if (self->client) { check_dodge(self, plasma->s.origin, dir, speed); } gi.linkentity(plasma); } void Trap_Think(edict_t *ent) { edict_t *target = NULL; edict_t *best = NULL; vec3_t vec; int len, i; int oldlen = 8000; vec3_t forward, right, up; if (!ent) { return; } if (ent->timestamp < level.time) { BecomeExplosion1(ent); return; } ent->nextthink = level.time + 0.1; if (!ent->groundentity) { return; } /* ok lets do the blood effect */ if (ent->s.frame > 4) { if (ent->s.frame == 5) { if (ent->wait == 64) { gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/trapdown.wav"), 1, ATTN_IDLE, 0); } ent->wait -= 2; ent->delay += level.time; for (i = 0; i < 3; i++) { best = G_Spawn(); if (strcmp(ent->enemy->classname, "monster_gekk") == 0) { best->s.modelindex = gi.modelindex("models/objects/gekkgib/torso/tris.md2"); best->s.effects |= TE_GREENBLOOD; } else if (ent->mass > 200) { best->s.modelindex = gi.modelindex("models/objects/gibs/chest/tris.md2"); best->s.effects |= TE_BLOOD; } else { best->s.modelindex = gi.modelindex("models/objects/gibs/sm_meat/tris.md2"); best->s.effects |= TE_BLOOD; } AngleVectors(ent->s.angles, forward, right, up); RotatePointAroundVector(vec, up, right, ((360.0 / 3) * i) + ent->delay); VectorMA(vec, ent->wait / 2, vec, vec); VectorAdd(vec, ent->s.origin, vec); VectorAdd(vec, forward, best->s.origin); best->s.origin[2] = ent->s.origin[2] + ent->wait; VectorCopy(ent->s.angles, best->s.angles); best->solid = SOLID_NOT; best->s.effects |= EF_GIB; best->takedamage = DAMAGE_YES; best->movetype = MOVETYPE_TOSS; best->svflags |= SVF_MONSTER; best->deadflag = DEAD_DEAD; VectorClear(best->mins); VectorClear(best->maxs); best->watertype = gi.pointcontents(best->s.origin); if (best->watertype & MASK_WATER) { best->waterlevel = 1; } best->nextthink = level.time + 0.1; best->think = G_FreeEdict; gi.linkentity(best); } if (ent->wait < 19) { ent->s.frame++; } return; } ent->s.frame++; if (ent->s.frame == 8) { ent->nextthink = level.time + 1.0; ent->think = G_FreeEdict; best = G_Spawn(); SP_item_foodcube(best); VectorCopy(ent->s.origin, best->s.origin); best->s.origin[2] += 16; best->velocity[2] = 400; best->count = ent->mass; gi.linkentity(best); return; } return; } ent->s.effects &= ~EF_TRAP; if (ent->s.frame >= 4) { ent->s.effects |= EF_TRAP; VectorClear(ent->mins); VectorClear(ent->maxs); } if (ent->s.frame < 4) { ent->s.frame++; } while ((target = findradius(target, ent->s.origin, 256)) != NULL) { if (target == ent) { continue; } if (!(target->svflags & SVF_MONSTER) && !target->client) { continue; } if (target->health <= 0) { continue; } if (!visible(ent, target)) { continue; } if (!best) { best = target; continue; } VectorSubtract(ent->s.origin, target->s.origin, vec); len = VectorLength(vec); if (len < oldlen) { oldlen = len; best = target; } } /* pull the enemy in */ if (best) { vec3_t forward; if (best->groundentity) { best->s.origin[2] += 1; best->groundentity = NULL; } VectorSubtract(ent->s.origin, best->s.origin, vec); len = VectorLength(vec); if (best->client) { VectorNormalize(vec); VectorMA(best->velocity, 250, vec, best->velocity); } else { best->ideal_yaw = vectoyaw(vec); M_ChangeYaw(best); AngleVectors(best->s.angles, forward, NULL, NULL); VectorScale(forward, 256, best->velocity); } gi.sound(ent, CHAN_VOICE, gi.soundindex( "weapons/trapsuck.wav"), 1, ATTN_IDLE, 0); if (len < 32) { if (best->mass < 400) { T_Damage(best, ent, ent->owner, vec3_origin, best->s.origin, vec3_origin, 100000, 1, 0, MOD_TRAP); ent->enemy = best; ent->wait = 64; VectorCopy(ent->s.origin, ent->s.old_origin); ent->timestamp = level.time + 30; if (deathmatch->value) { ent->mass = best->mass / 4; } else { ent->mass = best->mass / 10; } /* ok spawn the food cube */ ent->s.frame = 5; } else { BecomeExplosion1(ent); return; } } } } void fire_trap(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, float timer, float damage_radius, qboolean held) { edict_t *trap; vec3_t dir; vec3_t forward, right, up; if (!self) { return; } vectoangles(aimdir, dir); AngleVectors(dir, forward, right, up); trap = G_Spawn(); VectorCopy(start, trap->s.origin); VectorScale(aimdir, speed, trap->velocity); VectorMA(trap->velocity, 200 + crandom() * 10.0, up, trap->velocity); VectorMA(trap->velocity, crandom() * 10.0, right, trap->velocity); VectorSet(trap->avelocity, 0, 300, 0); trap->movetype = MOVETYPE_BOUNCE; trap->clipmask = MASK_SHOT; trap->solid = SOLID_BBOX; VectorSet(trap->mins, -4, -4, 0); VectorSet(trap->maxs, 4, 4, 8); trap->s.modelindex = gi.modelindex("models/weapons/z_trap/tris.md2"); trap->owner = self; trap->nextthink = level.time + 1.0; trap->think = Trap_Think; trap->dmg = damage; trap->dmg_radius = damage_radius; trap->classname = "htrap"; trap->s.sound = gi.soundindex("weapons/traploop.wav"); if (held) { trap->spawnflags = 3; } else { trap->spawnflags = 1; } if (timer <= 0.0) { Grenade_Explode(trap); } else { gi.linkentity(trap); } trap->timestamp = level.time + 30; } xatrix-XATRIX_2_14/src/header/000077500000000000000000000000001477320050300161575ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/header/game.h000066400000000000000000000160601477320050300172440ustar00rootroot00000000000000/* ======================================================================= * * Here are the client, server and game are tied together. * * ======================================================================= */ /* * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * * THIS FILE IS _VERY_ FRAGILE AND THERE'S NOTHING IN IT THAT CAN OR * MUST BE CHANGED. IT'S MOST LIKELY A VERY GOOD IDEA TO CLOSE THE * EDITOR NOW AND NEVER LOOK BACK. OTHERWISE YOU MAY SCREW UP EVERYTHING! * * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ #ifndef XATRIX_GAME_H #define XATRIX_GAME_H #define GAME_API_VERSION 3 #define SVF_NOCLIENT 0x00000001 /* don't send entity to clients, even if it has effects */ #define SVF_DEADMONSTER 0x00000002 /* treat as CONTENTS_DEADMONSTER for collision */ #define SVF_MONSTER 0x00000004 /* treat as CONTENTS_MONSTER for collision */ #define MAX_ENT_CLUSTERS 16 typedef enum { SOLID_NOT, /* no interaction with other objects */ SOLID_TRIGGER, /* only touch when inside, after moving */ SOLID_BBOX, /* touch on edge */ SOLID_BSP /* bsp clip, touch on edge */ } solid_t; /* =============================================================== */ /* link_t is only used for entity area links now */ typedef struct link_s { struct link_s *prev, *next; } link_t; typedef struct edict_s edict_t; typedef struct gclient_s gclient_t; #ifndef GAME_INCLUDE struct gclient_s { player_state_t ps; /* communicated by server to clients */ int ping; /* the game dll can add anything it wants after this point in the structure */ }; struct edict_s { entity_state_t s; struct gclient_s *client; qboolean inuse; int linkcount; link_t area; /* linked to a division node or leaf */ int num_clusters; /* if -1, use headnode instead */ int clusternums[MAX_ENT_CLUSTERS]; int headnode; /* unused if num_clusters != -1 */ int areanum, areanum2; int svflags; /* SVF_NOCLIENT, SVF_DEADMONSTER, SVF_MONSTER, etc */ vec3_t mins, maxs; vec3_t absmin, absmax, size; solid_t solid; int clipmask; edict_t *owner; /* the game dll can add anything it wants after this point in the structure */ }; #endif /* GAME_INCLUDE */ /* =============================================================== */ /* functions provided by the main engine */ typedef struct { /* special messages */ void (*bprintf)(int printlevel, char *fmt, ...); void (*dprintf)(char *fmt, ...); void (*cprintf)(edict_t *ent, int printlevel, char *fmt, ...); void (*centerprintf)(edict_t *ent, char *fmt, ...); void (*sound)(edict_t *ent, int channel, int soundindex, float volume, float attenuation, float timeofs); void (*positioned_sound)(vec3_t origin, edict_t *ent, int channel, int soundinedex, float volume, float attenuation, float timeofs); /* config strings hold all the index strings, the lightstyles, and misc data like the sky definition and cdtrack. All of the current configstrings are sent to clients when they connect, and changes are sent to all connected clients. */ void (*configstring)(int num, char *string); void (*error)(char *fmt, ...); /* the *index functions create configstrings and some internal server state */ int (*modelindex)(char *name); int (*soundindex)(char *name); int (*imageindex)(char *name); void (*setmodel)(edict_t *ent, char *name); /* collision detection */ trace_t (*trace)(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, edict_t *passent, int contentmask); int (*pointcontents)(vec3_t point); qboolean (*inPVS)(vec3_t p1, vec3_t p2); qboolean (*inPHS)(vec3_t p1, vec3_t p2); void (*SetAreaPortalState)(int portalnum, qboolean open); qboolean (*AreasConnected)(int area1, int area2); /* an entity will never be sent to a client or used for collision if it is not passed to linkentity. If the size, position, or solidity changes, it must be relinked. */ void (*linkentity)(edict_t *ent); void (*unlinkentity)(edict_t *ent); /* call before removing an interactive edict */ int (*BoxEdicts)(vec3_t mins, vec3_t maxs, edict_t **list, int maxcount, int areatype); void (*Pmove)(pmove_t *pmove); /* player movement code common with client prediction */ /* network messaging */ void (*multicast)(vec3_t origin, multicast_t to); void (*unicast)(edict_t *ent, qboolean reliable); void (*WriteChar)(int c); void (*WriteByte)(int c); void (*WriteShort)(int c); void (*WriteLong)(int c); void (*WriteFloat)(float f); void (*WriteString)(char *s); void (*WritePosition)(vec3_t pos); /* some fractional bits */ void (*WriteDir)(vec3_t pos); /* single byte encoded, very coarse */ void (*WriteAngle)(float f); /* managed memory allocation */ void *(*TagMalloc)(int size, int tag); void (*TagFree)(void *block); void (*FreeTags)(int tag); /* console variable interaction */ cvar_t *(*cvar)(char *var_name, char *value, int flags); cvar_t *(*cvar_set)(char *var_name, char *value); cvar_t *(*cvar_forceset)(char *var_name, char *value); /* ClientCommand and ServerCommand parameter access */ int (*argc)(void); char *(*argv)(int n); char *(*args)(void); /* concatenation of all argv >= 1 */ /* add commands to the server console as if they were typed in for map changing, etc */ void (*AddCommandString)(char *text); void (*DebugGraph)(float value, int color); } game_import_t; /* functions exported by the game subsystem */ typedef struct { int apiversion; /* the init function will only be called when a game starts, not each time a level is loaded. Persistant data for clients and the server can be allocated in init */ void (*Init)(void); void (*Shutdown)(void); /* each new level entered will cause a call to SpawnEntities */ void (*SpawnEntities)(char *mapname, char *entstring, char *spawnpoint); /* Read/Write Game is for storing persistant cross level information about the world state and the clients. WriteGame is called every time a level is exited. ReadGame is called on a loadgame. */ void (*WriteGame)(char *filename, qboolean autosave); void (*ReadGame)(char *filename); /* ReadLevel is called after the default map information has been loaded with SpawnEntities */ void (*WriteLevel)(char *filename); void (*ReadLevel)(char *filename); qboolean (*ClientConnect)(edict_t *ent, char *userinfo); void (*ClientBegin)(edict_t *ent); void (*ClientUserinfoChanged)(edict_t *ent, char *userinfo); void (*ClientDisconnect)(edict_t *ent); void (*ClientCommand)(edict_t *ent); void (*ClientThink)(edict_t *ent, usercmd_t *cmd); void (*RunFrame)(void); /* ServerCommand will be called when an "sv " command is issued on the server console. The game can issue gi.argc() / gi.argv() commands to get the rest of the parameters */ void (*ServerCommand)(void); /* global variables shared between game and server */ /* The edict array is allocated in the game dll so it can vary in size from one game to another. The size will be fixed when ge->Init() is called */ struct edict_s *edicts; int edict_size; int num_edicts; /* current number, <= max_edicts */ int max_edicts; } game_export_t; #endif /* XATRIX_GAME_H */ xatrix-XATRIX_2_14/src/header/local.h000066400000000000000000000724221477320050300174310ustar00rootroot00000000000000/* ======================================================================= * * Main header file for the game module. * * ======================================================================= */ #ifndef XATRIX_LOCAL_H #define XATRIX_LOCAL_H #include "shared.h" /* define GAME_INCLUDE so that game.h does not define the short, server-visible gclient_t and edict_t structures, because we define the full size ones in this file */ #define GAME_INCLUDE #include "game.h" /* the "gameversion" client command will print this plus compile date */ #define GAMEVERSION "xatrix" /* protocol bytes that can be directly added to messages */ #define svc_muzzleflash 1 #define svc_muzzleflash2 2 #define svc_temp_entity 3 #define svc_layout 4 #define svc_inventory 5 #define svc_stufftext 11 /* ================================================================== */ /* view pitching times */ #define DAMAGE_TIME 0.5 #define FALL_TIME 0.3 /* these are set with checkboxes on each entity in the map editor */ #define SPAWNFLAG_NOT_EASY 0x00000100 #define SPAWNFLAG_NOT_MEDIUM 0x00000200 #define SPAWNFLAG_NOT_HARD 0x00000400 #define SPAWNFLAG_NOT_DEATHMATCH 0x00000800 #define SPAWNFLAG_NOT_COOP 0x00001000 #define FL_FLY 0x00000001 #define FL_SWIM 0x00000002 /* implied immunity to drowining */ #define FL_IMMUNE_LASER 0x00000004 #define FL_INWATER 0x00000008 #define FL_GODMODE 0x00000010 #define FL_NOTARGET 0x00000020 #define FL_IMMUNE_SLIME 0x00000040 #define FL_IMMUNE_LAVA 0x00000080 #define FL_PARTIALGROUND 0x00000100 /* not all corners are valid */ #define FL_WATERJUMP 0x00000200 /* player jumping out of water */ #define FL_TEAMSLAVE 0x00000400 /* not the first on the team */ #define FL_NO_KNOCKBACK 0x00000800 #define FL_POWER_ARMOR 0x00001000 /* power armor (if any) is active */ #define FL_COOP_TAKEN 0x00002000 /* Another client has already taken it */ #define FL_RESPAWN 0x80000000 /* used for item respawning */ #define FRAMETIME 0.1 /* memory tags to allow dynamic memory to be cleaned up */ #define TAG_GAME 765 /* clear when unloading the dll */ #define TAG_LEVEL 766 /* clear when loading a new level */ #define MELEE_DISTANCE 80 #define BODY_QUEUE_SIZE 8 typedef enum { DAMAGE_NO, DAMAGE_YES, /* will take damage if hit */ DAMAGE_AIM /* auto targeting recognizes this */ } damage_t; typedef enum { WEAPON_READY, WEAPON_ACTIVATING, WEAPON_DROPPING, WEAPON_FIRING } weaponstate_t; typedef enum { AMMO_BULLETS, AMMO_SHELLS, AMMO_ROCKETS, AMMO_GRENADES, AMMO_CELLS, AMMO_SLUGS, AMMO_MAGSLUG, AMMO_TRAP } ammo_t; /* Maximum debris / gibs per frame */ #define MAX_GIBS 20 #define MAX_DEBRIS 20 /* deadflag */ #define DEAD_NO 0 #define DEAD_DYING 1 #define DEAD_DEAD 2 #define DEAD_RESPAWNABLE 3 /* range */ #define RANGE_MELEE 0 #define RANGE_NEAR 1 #define RANGE_MID 2 #define RANGE_FAR 3 /* gib types */ #define GIB_ORGANIC 0 #define GIB_METALLIC 1 /* monster ai flags */ #define AI_STAND_GROUND 0x00000001 #define AI_TEMP_STAND_GROUND 0x00000002 #define AI_SOUND_TARGET 0x00000004 #define AI_LOST_SIGHT 0x00000008 #define AI_PURSUIT_LAST_SEEN 0x00000010 #define AI_PURSUE_NEXT 0x00000020 #define AI_PURSUE_TEMP 0x00000040 #define AI_HOLD_FRAME 0x00000080 #define AI_GOOD_GUY 0x00000100 #define AI_BRUTAL 0x00000200 #define AI_NOSTEP 0x00000400 #define AI_DUCKED 0x00000800 #define AI_COMBAT_POINT 0x00001000 #define AI_MEDIC 0x00002000 #define AI_RESURRECTING 0x00004000 #define AI_IGNORE_PAIN 0x00008000 /* monster attack state */ #define AS_STRAIGHT 1 #define AS_SLIDING 2 #define AS_MELEE 3 #define AS_MISSILE 4 /* armor types */ #define ARMOR_NONE 0 #define ARMOR_JACKET 1 #define ARMOR_COMBAT 2 #define ARMOR_BODY 3 #define ARMOR_SHARD 4 /* power armor types */ #define POWER_ARMOR_NONE 0 #define POWER_ARMOR_SCREEN 1 #define POWER_ARMOR_SHIELD 2 /* handedness values */ #define RIGHT_HANDED 0 #define LEFT_HANDED 1 #define CENTER_HANDED 2 /* game.serverflags values */ #define SFL_CROSS_TRIGGER_1 0x00000001 #define SFL_CROSS_TRIGGER_2 0x00000002 #define SFL_CROSS_TRIGGER_3 0x00000004 #define SFL_CROSS_TRIGGER_4 0x00000008 #define SFL_CROSS_TRIGGER_5 0x00000010 #define SFL_CROSS_TRIGGER_6 0x00000020 #define SFL_CROSS_TRIGGER_7 0x00000040 #define SFL_CROSS_TRIGGER_8 0x00000080 #define SFL_CROSS_TRIGGER_MASK 0x000000ff /* noise types for PlayerNoise */ #define PNOISE_SELF 0 #define PNOISE_WEAPON 1 #define PNOISE_IMPACT 2 /* edict->movetype values */ typedef enum { MOVETYPE_NONE, /* never moves */ MOVETYPE_NOCLIP, /* origin and angles change with no interaction */ MOVETYPE_PUSH, /* no clip to world, push on box contact */ MOVETYPE_STOP, /* no clip to world, stops on box contact */ MOVETYPE_WALK, /* gravity */ MOVETYPE_STEP, /* gravity, special edge handling */ MOVETYPE_FLY, MOVETYPE_TOSS, /* gravity */ MOVETYPE_FLYMISSILE, /* extra size to monsters */ MOVETYPE_BOUNCE, /* added this (the comma at the end of line) */ MOVETYPE_WALLBOUNCE } movetype_t; typedef struct { int base_count; int max_count; float normal_protection; float energy_protection; int armor; } gitem_armor_t; /* gitem_t->flags */ #define IT_WEAPON 1 /* use makes active weapon */ #define IT_AMMO 2 #define IT_ARMOR 4 #define IT_STAY_COOP 8 #define IT_KEY 16 #define IT_POWERUP 32 #define IT_INSTANT_USE 64 /* item is insta-used on pickup if dmflag is set */ /* gitem_t->weapmodel for weapons indicates model index */ #define WEAP_BLASTER 1 #define WEAP_SHOTGUN 2 #define WEAP_SUPERSHOTGUN 3 #define WEAP_MACHINEGUN 4 #define WEAP_CHAINGUN 5 #define WEAP_GRENADES 6 #define WEAP_GRENADELAUNCHER 7 #define WEAP_ROCKETLAUNCHER 8 #define WEAP_HYPERBLASTER 9 #define WEAP_RAILGUN 10 #define WEAP_BFG 11 #define WEAP_PHALANX 12 #define WEAP_BOOMER 13 typedef struct gitem_s { char *classname; /* spawning name */ qboolean (*pickup)(struct edict_s *ent, struct edict_s *other); void (*use)(struct edict_s *ent, struct gitem_s *item); void (*drop)(struct edict_s *ent, struct gitem_s *item); void (*weaponthink)(struct edict_s *ent); char *pickup_sound; char *world_model; int world_model_flags; char *view_model; /* client side info */ char *icon; char *pickup_name; /* for printing on pickup */ int count_width; /* number of digits to display by icon */ int quantity; /* for ammo how much, for weapons how much is used per shot */ char *ammo; /* for weapons */ int flags; /* IT_* flags */ int weapmodel; /* weapon model index (for weapons) */ void *info; int tag; char *precaches; /* string of all models, sounds, and images this item will use */ } gitem_t; /* this structure is left intact through an entire game it should be initialized at dll load time, and read/written to the server.ssv file for savegames */ typedef struct { char helpmessage1[512]; char helpmessage2[512]; int helpchanged; /* flash F1 icon if non 0, play sound and increment only if 1, 2, or 3 */ gclient_t *clients; /* [maxclients] */ /* can't store spawnpoint in level, because it would get overwritten by the savegame restore */ char spawnpoint[512]; /* needed for coop respawns */ /* store latched cvars here that we want to get at often */ int maxclients; int maxentities; /* cross level triggers */ int serverflags; /* items */ int num_items; qboolean autosaved; } game_locals_t; /* this structure is cleared as each map is entered it is read/written to the level.sav file for savegames */ typedef struct { int framenum; float time; char level_name[MAX_QPATH]; /* the descriptive name (Outer Base, etc) */ char mapname[MAX_QPATH]; /* the server name (base1, etc) */ char nextmap[MAX_QPATH]; /* go here when fraglimit is hit */ /* intermission state */ float intermissiontime; /* time the intermission was started */ char *changemap; int exitintermission; vec3_t intermission_origin; vec3_t intermission_angle; edict_t *sight_client; /* changed once each frame for coop games */ edict_t *sight_entity; int sight_entity_framenum; edict_t *sound_entity; int sound_entity_framenum; edict_t *sound2_entity; int sound2_entity_framenum; int pic_health; int total_secrets; int found_secrets; int total_goals; int found_goals; int total_monsters; int killed_monsters; edict_t *current_entity; /* entity running from G_RunFrame */ int body_que; /* dead bodies */ int power_cubes; /* ugly necessity for coop */ } level_locals_t; /* spawn_temp_t is only used to hold entity field values that can be set from the editor, but aren't actualy present in edict_t during gameplay */ typedef struct { /* world vars */ char *sky; float skyrotate; vec3_t skyaxis; char *nextmap; int lip; int distance; int height; char *noise; float pausetime; char *item; char *gravity; float minyaw; float maxyaw; float minpitch; float maxpitch; } spawn_temp_t; typedef struct { /* fixed data */ vec3_t start_origin; vec3_t start_angles; vec3_t end_origin; vec3_t end_angles; int sound_start; int sound_middle; int sound_end; float accel; float speed; float decel; float distance; float wait; /* state data */ int state; vec3_t dir; float current_speed; float move_speed; float next_speed; float remaining_distance; float decel_distance; void (*endfunc)(edict_t *); } moveinfo_t; typedef struct { void (*aifunc)(edict_t *self, float dist); float dist; void (*thinkfunc)(edict_t *self); } mframe_t; typedef struct { int firstframe; int lastframe; mframe_t *frame; void (*endfunc)(edict_t *self); } mmove_t; typedef struct { mmove_t *currentmove; int aiflags; int nextframe; float scale; void (*stand)(edict_t *self); void (*idle)(edict_t *self); void (*search)(edict_t *self); void (*walk)(edict_t *self); void (*run)(edict_t *self); void (*dodge)(edict_t *self, edict_t *other, float eta); void (*attack)(edict_t *self); void (*melee)(edict_t *self); void (*sight)(edict_t *self, edict_t *other); qboolean (*checkattack)(edict_t *self); float pausetime; float attack_finished; vec3_t saved_goal; float search_time; float trail_time; vec3_t last_sighting; int attack_state; int lefty; float idle_time; int linkcount; int power_armor_type; int power_armor_power; } monsterinfo_t; extern game_locals_t game; extern level_locals_t level; extern game_import_t gi; extern game_export_t globals; extern spawn_temp_t st; extern int sm_meat_index; extern int snd_fry; extern int debristhisframe; extern int gibsthisframe; /* means of death */ #define MOD_UNKNOWN 0 #define MOD_BLASTER 1 #define MOD_SHOTGUN 2 #define MOD_SSHOTGUN 3 #define MOD_MACHINEGUN 4 #define MOD_CHAINGUN 5 #define MOD_GRENADE 6 #define MOD_G_SPLASH 7 #define MOD_ROCKET 8 #define MOD_R_SPLASH 9 #define MOD_HYPERBLASTER 10 #define MOD_RAILGUN 11 #define MOD_BFG_LASER 12 #define MOD_BFG_BLAST 13 #define MOD_BFG_EFFECT 14 #define MOD_HANDGRENADE 15 #define MOD_HG_SPLASH 16 #define MOD_WATER 17 #define MOD_SLIME 18 #define MOD_LAVA 19 #define MOD_CRUSH 20 #define MOD_TELEFRAG 21 #define MOD_FALLING 22 #define MOD_SUICIDE 23 #define MOD_HELD_GRENADE 24 #define MOD_EXPLOSIVE 25 #define MOD_BARREL 26 #define MOD_BOMB 27 #define MOD_EXIT 28 #define MOD_SPLASH 29 #define MOD_TARGET_LASER 30 #define MOD_TRIGGER_HURT 31 #define MOD_HIT 32 #define MOD_TARGET_BLASTER 33 #define MOD_RIPPER 34 #define MOD_PHALANX 35 #define MOD_BRAINTENTACLE 36 #define MOD_BLASTOFF 37 #define MOD_GEKK 38 #define MOD_TRAP 39 #define MOD_FRIENDLY_FIRE 0x8000000 /* Easier handling of AI skill levels */ #define SKILL_EASY 0 #define SKILL_MEDIUM 1 #define SKILL_HARD 2 #define SKILL_HARDPLUS 3 extern int meansOfDeath; extern edict_t *g_edicts; #define FOFS(x) (size_t)&(((edict_t *)NULL)->x) #define STOFS(x) (size_t)&(((spawn_temp_t *)NULL)->x) #define LLOFS(x) (size_t)&(((level_locals_t *)NULL)->x) #define CLOFS(x) (size_t)&(((gclient_t *)NULL)->x) #define random() ((randk() & 0x7fff) / ((float)0x7fff)) #define crandom() (2.0 * (random() - 0.5)) extern cvar_t *maxentities; extern cvar_t *deathmatch; extern cvar_t *coop; extern cvar_t *coop_elevator_delay; extern cvar_t *coop_pickup_weapons; extern cvar_t *dmflags; extern cvar_t *skill; extern cvar_t *fraglimit; extern cvar_t *timelimit; extern cvar_t *password; extern cvar_t *spectator_password; extern cvar_t *needpass; extern cvar_t *g_select_empty; extern cvar_t *dedicated; extern cvar_t *g_footsteps; extern cvar_t *g_monsterfootsteps; extern cvar_t *g_fix_triggered; extern cvar_t *filterban; extern cvar_t *sv_gravity; extern cvar_t *sv_maxvelocity; extern cvar_t *gun_x, *gun_y, *gun_z; extern cvar_t *sv_rollspeed; extern cvar_t *sv_rollangle; extern cvar_t *run_pitch; extern cvar_t *run_roll; extern cvar_t *bob_up; extern cvar_t *bob_pitch; extern cvar_t *bob_roll; extern cvar_t *sv_cheats; extern cvar_t *maxclients; extern cvar_t *maxspectators; extern cvar_t *flood_msgs; extern cvar_t *flood_persecond; extern cvar_t *flood_waitdelay; extern cvar_t *sv_maplist; extern cvar_t *aimfix; extern cvar_t *g_machinegun_norecoil; extern cvar_t *g_quick_weap; extern cvar_t *g_swap_speed; #define world (&g_edicts[0]) /* item spawnflags */ #define ITEM_TRIGGER_SPAWN 0x00000001 #define ITEM_NO_TOUCH 0x00000002 /* 6 bits reserved for editor flags 8 bits used as power cube id bits for coop games */ #define DROPPED_ITEM 0x00010000 #define DROPPED_PLAYER_ITEM 0x00020000 #define ITEM_TARGETS_USED 0x00040000 /* fields are needed for spawning from the entity string and saving / loading games */ #define FFL_SPAWNTEMP 1 #define FFL_NOSPAWN 2 typedef enum { F_INT, F_FLOAT, F_LSTRING, /* string on disk, pointer in memory, TAG_LEVEL */ F_GSTRING, /* string on disk, pointer in memory, TAG_GAME */ F_VECTOR, F_ANGLEHACK, F_EDICT, /* index on disk, pointer in memory */ F_ITEM, /* index on disk, pointer in memory */ F_CLIENT, /* index on disk, pointer in memory */ F_FUNCTION, F_MMOVE, F_IGNORE } fieldtype_t; typedef struct { char *name; int ofs; fieldtype_t type; int flags; short save_ver; } field_t; extern field_t fields[]; extern gitem_t itemlist[]; /* g_cmds.c */ void Cmd_Help_f(edict_t *ent); /* g_items.c */ void PrecacheItem(gitem_t *it); void InitItems(void); void SetItemNames(void); gitem_t *FindItem(char *pickup_name); gitem_t *FindItemByClassname(char *classname); #define ITEM_INDEX(x) ((x) - itemlist) edict_t *Drop_Item(edict_t *ent, gitem_t *item); void SetRespawn(edict_t *ent, float delay); void ChangeWeapon(edict_t *ent); void SpawnItem(edict_t *ent, gitem_t *item); void Think_Weapon(edict_t *ent); int ArmorIndex(edict_t *ent); int PowerArmorType(edict_t *ent); gitem_t *GetItemByIndex(int index); qboolean Add_Ammo(edict_t *ent, gitem_t *item, int count); void Touch_Item(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf); /* g_utils.c */ qboolean KillBox(edict_t *ent); void G_ProjectSource(vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result); edict_t *G_Find(edict_t *from, int fieldofs, char *match); edict_t *findradius(edict_t *from, vec3_t org, float rad); edict_t *G_PickTarget(char *targetname); void G_UseTargets(edict_t *ent, edict_t *activator); void G_SetMovedir(vec3_t angles, vec3_t movedir); void G_InitEdict(edict_t *e); edict_t *G_SpawnOptional(void); edict_t *G_Spawn(void); void G_FreeEdict(edict_t *e); void G_TouchTriggers(edict_t *ent); void G_TouchSolids(edict_t *ent); char *G_CopyString(char *in); float *tv(float x, float y, float z); char *vtos(vec3_t v); void get_normal_vector(const cplane_t *p, vec3_t normal); float vectoyaw(vec3_t vec); void vectoangles(vec3_t vec, vec3_t angles); /* g_combat.c */ qboolean OnSameTeam(edict_t *ent1, edict_t *ent2); qboolean CanDamage(edict_t *targ, edict_t *inflictor); void T_Damage(edict_t *targ, edict_t *inflictor, edict_t *attacker, vec3_t dir, vec3_t point, vec3_t normal, int damage, int knockback, int dflags, int mod); void T_RadiusDamage(edict_t *inflictor, edict_t *attacker, float damage, edict_t *ignore, float radius, int mod); /* damage flags */ #define DAMAGE_RADIUS 0x00000001 /* damage was indirect */ #define DAMAGE_NO_ARMOR 0x00000002 /* armour does not protect from this damage */ #define DAMAGE_ENERGY 0x00000004 /* damage is from an energy based weapon */ #define DAMAGE_NO_KNOCKBACK 0x00000008 /* do not affect velocity, just view angles */ #define DAMAGE_BULLET 0x00000010 /* damage is from a bullet (used for ricochets) */ #define DAMAGE_NO_PROTECTION 0x00000020 /* armor, shields, invulnerability, and godmode have no effect */ #define DEFAULT_BULLET_HSPREAD 300 #define DEFAULT_BULLET_VSPREAD 500 #define DEFAULT_SHOTGUN_HSPREAD 1000 #define DEFAULT_SHOTGUN_VSPREAD 500 #define DEFAULT_SHOTGUN_COUNT 12 #define DEFAULT_SSHOTGUN_COUNT 20 /* g_monster.c */ void monster_fire_bullet(edict_t *self, vec3_t start, vec3_t dir, int damage, int kick, int hspread, int vspread, int flashtype); void monster_fire_shotgun(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count, int flashtype); void monster_fire_blaster(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, int effect); void monster_fire_grenade(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int flashtype); void monster_fire_rocket(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype); void monster_fire_railgun(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int flashtype); void monster_fire_bfg(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int kick, float damage_radius, int flashtype); void monster_fire_ionripper(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, int effect); void monster_fire_heat(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype); void monster_dabeam(edict_t *self); void monster_fire_blueblaster(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, int effect); void M_droptofloor(edict_t *ent); void monster_think(edict_t *self); void walkmonster_start(edict_t *self); void swimmonster_start(edict_t *self); void flymonster_start(edict_t *self); void AttackFinished(edict_t *self, float time); void monster_death_use(edict_t *self); void M_CatagorizePosition(edict_t *ent); qboolean M_CheckAttack(edict_t *self); void M_FlyCheck(edict_t *self); void M_CheckGround(edict_t *ent); /* g_misc.c */ void ThrowHead(edict_t *self, char *gibname, int damage, int type); void ThrowClientHead(edict_t *self, int damage); void ThrowGib(edict_t *self, char *gibname, int damage, int type); void BecomeExplosion1(edict_t *self); void ThrowHeadACID(edict_t *self, char *gibname, int damage, int type); void ThrowGibACID(edict_t *self, char *gibname, int damage, int type); /* g_ai.c */ void AI_SetSightClient(void); void ai_stand(edict_t *self, float dist); void ai_move(edict_t *self, float dist); void ai_walk(edict_t *self, float dist); void ai_turn(edict_t *self, float dist); void ai_run(edict_t *self, float dist); void ai_charge(edict_t *self, float dist); int range(edict_t *self, edict_t *other); void FoundTarget(edict_t *self); qboolean infront(edict_t *self, edict_t *other); qboolean visible(edict_t *self, edict_t *other); qboolean FacingIdeal(edict_t *self); /* g_weapon.c */ void ThrowDebris(edict_t *self, char *modelname, float speed, vec3_t origin); qboolean fire_hit(edict_t *self, vec3_t aim, int damage, int kick); void fire_bullet(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int mod); void fire_shotgun(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count, int mod); void fire_blaster(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int effect, qboolean hyper); void fire_grenade(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, float timer, float damage_radius); void fire_grenade2(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, float timer, float damage_radius, qboolean held); void fire_rocket(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius, int radius_damage); void fire_rail(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick); void fire_bfg(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius); void fire_ionripper(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int effect); void fire_heat(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius, int radius_damage); void fire_blueblaster(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int effect); void fire_plasma(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius, int radius_damage); void fire_trap(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, float timer, float damage_radius, qboolean held); /* g_ptrail.c */ void PlayerTrail_Init(void); void PlayerTrail_Add(vec3_t spot); void PlayerTrail_New(vec3_t spot); edict_t *PlayerTrail_PickFirst(edict_t *self); edict_t *PlayerTrail_PickNext(edict_t *self); edict_t *PlayerTrail_LastSpot(void); /* g_client.c */ void respawn(edict_t *ent); void BeginIntermission(edict_t *targ); void PutClientInServer(edict_t *ent); void InitClientPersistant(gclient_t *client); void InitClientResp(gclient_t *client); void InitBodyQue(void); void ClientBeginServerFrame(edict_t *ent); /* g_player.c */ void player_pain(edict_t *self, edict_t *other, float kick, int damage); void player_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point); /* g_svcmds.c */ void ServerCommand(void); qboolean SV_FilterPacket(char *from); /* p_view.c */ void ClientEndServerFrame(edict_t *ent); /* p_hud.c */ void MoveClientToIntermission(edict_t *client); void G_SetStats(edict_t *ent); void G_SetSpectatorStats(edict_t *ent); void G_CheckChaseStats(edict_t *ent); void ValidateSelectedItem(edict_t *ent); void DeathmatchScoreboardMessage(edict_t *client, edict_t *killer); void HelpComputerMessage(edict_t *client); void InventoryMessage(edict_t *client); /* g_pweapon.c */ void PlayerNoise(edict_t *who, vec3_t where, int type); /* m_move.c */ qboolean M_CheckBottom(edict_t *ent); qboolean M_walkmove(edict_t *ent, float yaw, float dist); void M_MoveToGoal(edict_t *ent, float dist); void M_ChangeYaw(edict_t *ent); /* g_phys.c */ void G_RunEntity(edict_t *ent); /* g_main.c */ void SaveClientData(void); void FetchClientEntData(edict_t *ent); /* g_chase.c */ void UpdateChaseCam(edict_t *ent); void ChaseNext(edict_t *ent); void ChasePrev(edict_t *ent); void GetChaseTarget(edict_t *ent); /* ============================================================================ */ /* client_t->anim_priority */ #define ANIM_BASIC 0 /* stand / run */ #define ANIM_WAVE 1 #define ANIM_JUMP 2 #define ANIM_PAIN 3 #define ANIM_ATTACK 4 #define ANIM_DEATH 5 #define ANIM_REVERSE 6 /* client data that stays across multiple level loads */ typedef struct { char userinfo[MAX_INFO_STRING]; char netname[16]; int hand; qboolean connected; /* a loadgame will leave valid entities that just don't have a connection yet */ /* values saved and restored from edicts when changing levels */ int health; int max_health; int savedFlags; int selected_item; int inventory[MAX_ITEMS]; /* ammo capacities */ int max_bullets; int max_shells; int max_rockets; int max_grenades; int max_cells; int max_slugs; int max_magslug; int max_trap; gitem_t *weapon; gitem_t *lastweapon; int power_cubes; /* used for tracking the cubes in coop games */ int score; /* for calculating total unit score in coop games */ int game_helpchanged; int helpchanged; qboolean spectator; /* client is a spectator */ } client_persistant_t; /* client data that stays across deathmatch respawns */ typedef struct { client_persistant_t coop_respawn; /* what to set client->pers to on a respawn */ int enterframe; /* level.framenum the client entered the game */ int score; /* frags, etc */ vec3_t cmd_angles; /* angles sent over in the last command */ qboolean spectator; /* client is a spectator */ } client_respawn_t; /* this structure is cleared on each PutClientInServer(), except for 'client->pers' */ struct gclient_s { /* known to server */ player_state_t ps; /* communicated by server to clients */ int ping; /* private to game */ client_persistant_t pers; client_respawn_t resp; pmove_state_t old_pmove; /* for detecting out-of-pmove changes */ qboolean showscores; /* set layout stat */ qboolean showinventory; /* set layout stat */ qboolean showhelp; qboolean showhelpicon; int ammo_index; int buttons; int oldbuttons; int latched_buttons; qboolean weapon_thunk; gitem_t *newweapon; /* sum up damage over an entire frame, so shotgun blasts give a single big kick */ int damage_armor; /* damage absorbed by armor */ int damage_parmor; /* damage absorbed by power armor */ int damage_blood; /* damage taken out of health */ int damage_knockback; /* impact damage */ vec3_t damage_from; /* origin for vector calculation */ float killer_yaw; /* when dead, look at killer */ weaponstate_t weaponstate; vec3_t kick_angles; /* weapon kicks */ vec3_t kick_origin; float v_dmg_roll, v_dmg_pitch, v_dmg_time; /* damage kicks */ float fall_time, fall_value; /* for view drop on fall */ float damage_alpha; float bonus_alpha; vec3_t damage_blend; vec3_t v_angle; /* aiming direction */ float bobtime; /* so off-ground doesn't change it */ vec3_t oldviewangles; vec3_t oldvelocity; float next_drown_time; int old_waterlevel; int breather_sound; int machinegun_shots; /* for weapon raising */ /* animation vars */ int anim_end; int anim_priority; qboolean anim_duck; qboolean anim_run; /* powerup timers */ float quad_framenum; float invincible_framenum; float breather_framenum; float enviro_framenum; qboolean grenade_blew_up; float grenade_time; float quadfire_framenum; qboolean trap_blew_up; float trap_time; int silencer_shots; int weapon_sound; float pickup_msg_time; float flood_locktill; /* locked from talking */ float flood_when[10]; /* when messages were said */ int flood_whenhead; /* head pointer for when said */ float respawn_time; /* can respawn when time > this */ edict_t *chase_target; /* player we are chasing */ qboolean update_chase; /* need to update chase info? */ }; struct edict_s { entity_state_t s; struct gclient_s *client; /* NULL if not a player */ /* the server expects the first part of gclient_s to be a player_state_t but the rest of it is opaque */ qboolean inuse; int linkcount; link_t area; /* linked to a division node or leaf */ int num_clusters; /* if -1, use headnode instead */ int clusternums[MAX_ENT_CLUSTERS]; int headnode; /* unused if num_clusters != -1 */ int areanum, areanum2; /* ================================ */ int svflags; vec3_t mins, maxs; vec3_t absmin, absmax, size; solid_t solid; int clipmask; edict_t *owner; /* DO NOT MODIFY ANYTHING ABOVE THIS, THE SERVER EXPECTS THE FIELDS IN THAT ORDER! */ /* ================================ */ int movetype; int flags; char *model; float freetime; /* sv.time when the object was freed */ /* only used locally in game, not by server */ char *message; char *classname; int spawnflags; float timestamp; float angle; /* set in qe3, -1 = up, -2 = down */ char *target; char *targetname; char *killtarget; char *team; char *pathtarget; char *deathtarget; char *combattarget; edict_t *target_ent; float speed, accel, decel; vec3_t movedir; vec3_t pos1, pos2; vec3_t velocity; vec3_t avelocity; int mass; float air_finished; float gravity; /* per entity gravity multiplier (1.0 is normal) use for lowgrav artifact, flares */ edict_t *goalentity; edict_t *movetarget; float yaw_speed; float ideal_yaw; float nextthink; void (*prethink)(edict_t *ent); void (*think)(edict_t *self); void (*blocked)(edict_t *self, edict_t *other); /* move to moveinfo? */ void (*touch)(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf); void (*use)(edict_t *self, edict_t *other, edict_t *activator); void (*pain)(edict_t *self, edict_t *other, float kick, int damage); void (*die)(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point); float touch_debounce_time; /* now also used by fixbots for timeouts when getting stuck */ float pain_debounce_time; float damage_debounce_time; float fly_sound_debounce_time; /* now also used by insane marines to store pain sound timeout */ /* and by fixbots for storing object_repair timeout when getting stuck */ float last_move_time; int health; int max_health; int gib_health; int deadflag; float show_hostile; float powerarmor_time; char *map; /* target_changelevel */ int viewheight; /* height above origin where eyesight is determined */ int takedamage; int dmg; int radius_dmg; float dmg_radius; int sounds; /* now also used for player death sound aggregation */ int count; edict_t *chain; edict_t *enemy; edict_t *oldenemy; edict_t *activator; edict_t *groundentity; int groundentity_linkcount; edict_t *teamchain; edict_t *teammaster; edict_t *mynoise; /* can go in client only */ edict_t *mynoise2; int noise_index; int noise_index2; float volume; float attenuation; /* timing variables */ float wait; float delay; /* before firing targets */ float random; float last_sound_time; int watertype; int waterlevel; vec3_t move_origin; vec3_t move_angles; /* move this to clientinfo? */ int light_level; int style; /* also used as areaportal number */ gitem_t *item; /* for bonus items */ /* common data blocks */ moveinfo_t moveinfo; monsterinfo_t monsterinfo; int orders; }; #endif /* XATRIX_LOCAL_H */ xatrix-XATRIX_2_14/src/header/shared.h000066400000000000000000001016621477320050300176040ustar00rootroot00000000000000/* * ======================================================================= * * This is the main header file shared between client, renderer, server * and the game. * * ======================================================================= */ #ifndef XATRIX_SHARED_H #define XATRIX_SHARED_H #include #include #include #include #include #include #include #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L // C23 or newer typedef bool qboolean; #else #ifdef true #undef true #endif #ifdef false #undef false #endif typedef enum {false, true} qboolean; #endif typedef unsigned char byte; #ifndef NULL #define NULL ((void *)0) #endif /* angle indexes */ #define PITCH 0 /* up / down */ #define YAW 1 /* left / right */ #define ROLL 2 /* fall over */ #define MAX_STRING_CHARS 1024 /* max length of a string passed to Cmd_TokenizeString */ #define MAX_STRING_TOKENS 80 /* max tokens resulting from Cmd_TokenizeString */ #define MAX_TOKEN_CHARS 128 /* max length of an individual token */ #define MAX_QPATH 64 /* max length of a quake game pathname */ #ifdef _WIN32 #define MAX_OSPATH 256 /* max length of a filesystem pathname (same as MAX_PATH) */ #else #define MAX_OSPATH 128 /* max length of a filesystem pathname */ #endif /* */ /* per-level limits */ /* */ #define MAX_CLIENTS 256 /* absolute limit */ #define MAX_EDICTS 1024 /* must change protocol to increase more */ #define MAX_LIGHTSTYLES 256 #define MAX_MODELS 256 /* these are sent over the net as bytes */ #define MAX_SOUNDS 256 /* so they cannot be blindly increased */ #define MAX_IMAGES 256 #define MAX_ITEMS 256 #define MAX_GENERAL (MAX_CLIENTS * 2) /* general config strings */ /* game print flags */ #define PRINT_LOW 0 /* pickup messages */ #define PRINT_MEDIUM 1 /* death messages */ #define PRINT_HIGH 2 /* critical messages */ #define PRINT_CHAT 3 /* chat messages */ #define ERR_FATAL 0 /* exit the entire game with a popup window */ #define ERR_DROP 1 /* print to console and disconnect from game */ #define ERR_DISCONNECT 2 /* don't kill server */ #define PRINT_ALL 0 #define PRINT_DEVELOPER 1 /* only print when "developer 1" */ #define PRINT_ALERT 2 /* destination class for gi.multicast() */ typedef enum { MULTICAST_ALL, MULTICAST_PHS, MULTICAST_PVS, MULTICAST_ALL_R, MULTICAST_PHS_R, MULTICAST_PVS_R } multicast_t; /* * ============================================================== * * MATHLIB * * ============================================================== */ typedef float vec_t; typedef vec_t vec3_t[3]; typedef vec_t vec5_t[5]; typedef int fixed4_t; typedef int fixed8_t; typedef int fixed16_t; #ifndef M_PI #define M_PI 3.14159265358979323846 /* matches value in gcc v2 math.h */ #endif struct cplane_s; extern vec3_t vec3_origin; #define nanmask (255 << 23) #define IS_NAN(x) (((*(int *)&x) & nanmask) == nanmask) #define Q_ftol(f) (long)(f) #define DotProduct(x, y) (x[0] * y[0] + x[1] * y[1] + x[2] * y[2]) #define VectorSubtract(a, b, c) (c[0] = a[0] - b[0], c[1] = a[1] - b[1], c[2] = \ a[2] - b[2]) #define VectorAdd(a, b, c) (c[0] = a[0] + b[0], c[1] = a[1] + b[1], c[2] = \ a[2] + b[2]) #define VectorCopy(a, b) (b[0] = a[0], b[1] = a[1], b[2] = a[2]) #define VectorClear(a) (a[0] = a[1] = a[2] = 0) #define VectorNegate(a, b) (b[0] = -a[0], b[1] = -a[1], b[2] = -a[2]) #define VectorSet(v, x, y, z) (v[0] = (x), v[1] = (y), v[2] = (z)) void VectorMA(vec3_t veca, float scale, vec3_t vecb, vec3_t vecc); /* just in case you do't want to use the macros */ vec_t _DotProduct(vec3_t v1, vec3_t v2); void _VectorSubtract(vec3_t veca, vec3_t vecb, vec3_t out); void _VectorAdd(vec3_t veca, vec3_t vecb, vec3_t out); void _VectorCopy(vec3_t in, vec3_t out); void ClearBounds(vec3_t mins, vec3_t maxs); void AddPointToBounds(vec3_t v, vec3_t mins, vec3_t maxs); int VectorCompare(vec3_t v1, vec3_t v2); vec_t VectorLength(vec3_t v); void CrossProduct(vec3_t v1, vec3_t v2, vec3_t cross); vec_t VectorNormalize(vec3_t v); /* returns vector length */ vec_t VectorNormalize2(vec3_t v, vec3_t out); void VectorInverse(vec3_t v); void VectorScale(vec3_t in, vec_t scale, vec3_t out); int Q_log2(int val); void R_ConcatRotations(float in1[3][3], float in2[3][3], float out[3][3]); void R_ConcatTransforms(float in1[3][4], float in2[3][4], float out[3][4]); void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); void AngleVectors2(vec3_t value1, vec3_t angles); int BoxOnPlaneSide(vec3_t emins, vec3_t emaxs, struct cplane_s *plane); float anglemod(float a); float LerpAngle(float a1, float a2, float frac); #define BOX_ON_PLANE_SIDE(emins, emaxs, p) \ (((p)->type < 3) ? \ ( \ ((p)->dist <= (emins)[(p)->type]) ? \ 1 \ : \ ( \ ((p)->dist >= (emaxs)[(p)->type]) ? \ 2 \ : \ 3 \ ) \ ) \ : \ BoxOnPlaneSide((emins), (emaxs), (p))) void ProjectPointOnPlane(vec3_t dst, const vec3_t p, const vec3_t normal); void PerpendicularVector(vec3_t dst, const vec3_t src); void RotatePointAroundVector(vec3_t dst, const vec3_t dir, const vec3_t point, float degrees); /* ============================================= */ char *COM_SkipPath(char *pathname); void COM_StripExtension(char *in, char *out); void COM_FileBase(char *in, char *out); void COM_FilePath(const char *in, char *out); void COM_DefaultExtension(char *path, const char *extension); char *COM_Parse(char **data_p); /* data is an in/out parm, returns a parsed out token */ void Com_sprintf(char *dest, int size, char *fmt, ...); void Com_PageInMemory(byte *buffer, int size); char *strlwr ( char *s ); /* ============================================= */ /* portable case insensitive compare */ int Q_stricmp(const char *s1, const char *s2); int Q_strcasecmp(char *s1, char *s2); int Q_strncasecmp(char *s1, char *s2, int n); /* ============================================= */ short BigShort(short l); short LittleShort(short l); int BigLong(int l); int LittleLong(int l); float BigFloat(float l); float LittleFloat(float l); void Swap_Init(void); char *va(const char *format, ...); /* ============================================= */ /* key / value info strings */ #define MAX_INFO_KEY 64 #define MAX_INFO_VALUE 64 #define MAX_INFO_STRING 512 char *Info_ValueForKey(char *s, char *key); void Info_RemoveKey(char *s, char *key); void Info_SetValueForKey(char *s, char *key, char *value); qboolean Info_Validate(char *s); /* ============================================= */ /* Random number generator */ int randk(void); float frandk(void); float crandk(void); void randk_seed(void); /* * ============================================================== * * SYSTEM SPECIFIC * * ============================================================== */ extern int curtime; /* time returned by last Sys_Milliseconds */ int Sys_Milliseconds(void); void Sys_Mkdir(char *path); char *strlwr(char *s); /* portable safe string copy/concatenate */ int Q_strlcpy(char *dst, const char *src, int size); int Q_strlcat(char *dst, const char *src, int size); /* large block stack allocation routines */ void *Hunk_Begin(int maxsize); void *Hunk_Alloc(int size); void Hunk_Free(void *buf); int Hunk_End(void); /* directory searching */ #define SFF_ARCH 0x01 #define SFF_HIDDEN 0x02 #define SFF_RDONLY 0x04 #define SFF_SUBDIR 0x08 #define SFF_SYSTEM 0x10 /* pass in an attribute mask of things you wish to REJECT */ char *Sys_FindFirst(char *path, unsigned musthave, unsigned canthave); char *Sys_FindNext(unsigned musthave, unsigned canthave); void Sys_FindClose(void); /* this is only here so the functions in q_shared.c and q_shwin.c can link */ void Sys_Error(char *error, ...); void Com_Printf(char *msg, ...); /* * ========================================================== * * CVARS (console variables) * * ========================================================== */ #ifndef CVAR #define CVAR #define CVAR_ARCHIVE 1 /* set to cause it to be saved to vars.rc */ #define CVAR_USERINFO 2 /* added to userinfo when changed */ #define CVAR_SERVERINFO 4 /* added to serverinfo when changed */ #define CVAR_NOSET 8 /* don't allow change from console at all, */ /* but can be set from the command line */ #define CVAR_LATCH 16 /* save changes until server restart */ /* nothing outside the Cvar_*() functions should modify these fields! */ typedef struct cvar_s { char *name; char *string; char *latched_string; /* for CVAR_LATCH vars */ int flags; qboolean modified; /* set each time the cvar is changed */ float value; struct cvar_s *next; } cvar_t; #endif /* CVAR */ /* * ============================================================== * * COLLISION DETECTION * * ============================================================== */ /* lower bits are stronger, and will eat weaker brushes completely */ #define CONTENTS_SOLID 1 /* an eye is never valid in a solid */ #define CONTENTS_WINDOW 2 /* translucent, but not watery */ #define CONTENTS_AUX 4 #define CONTENTS_LAVA 8 #define CONTENTS_SLIME 16 #define CONTENTS_WATER 32 #define CONTENTS_MIST 64 #define LAST_VISIBLE_CONTENTS 64 /* remaining contents are non-visible, and don't eat brushes */ #define CONTENTS_AREAPORTAL 0x8000 #define CONTENTS_PLAYERCLIP 0x10000 #define CONTENTS_MONSTERCLIP 0x20000 /* currents can be added to any other contents, and may be mixed */ #define CONTENTS_CURRENT_0 0x40000 #define CONTENTS_CURRENT_90 0x80000 #define CONTENTS_CURRENT_180 0x100000 #define CONTENTS_CURRENT_270 0x200000 #define CONTENTS_CURRENT_UP 0x400000 #define CONTENTS_CURRENT_DOWN 0x800000 #define CONTENTS_ORIGIN 0x1000000 /* removed before bsping an entity */ #define CONTENTS_MONSTER 0x2000000 /* should never be on a brush, only in game */ #define CONTENTS_DEADMONSTER 0x4000000 #define CONTENTS_DETAIL 0x8000000 /* brushes to be added after vis leafs */ #define CONTENTS_TRANSLUCENT 0x10000000 /* auto set if any surface has trans */ #define CONTENTS_LADDER 0x20000000 #define SURF_LIGHT 0x1 /* value will hold the light strength */ #define SURF_SLICK 0x2 /* effects game physics */ #define SURF_SKY 0x4 /* don't draw, but add to skybox */ #define SURF_WARP 0x8 /* turbulent water warp */ #define SURF_TRANS33 0x10 #define SURF_TRANS66 0x20 #define SURF_FLOWING 0x40 /* scroll towards angle */ #define SURF_NODRAW 0x80 /* don't bother referencing the texture */ /* content masks */ #define MASK_ALL (-1) #define MASK_SOLID (CONTENTS_SOLID | CONTENTS_WINDOW) #define MASK_PLAYERSOLID (CONTENTS_SOLID | CONTENTS_PLAYERCLIP | \ CONTENTS_WINDOW | CONTENTS_MONSTER) #define MASK_DEADSOLID (CONTENTS_SOLID | CONTENTS_PLAYERCLIP | CONTENTS_WINDOW) #define MASK_MONSTERSOLID (CONTENTS_SOLID | CONTENTS_MONSTERCLIP | \ CONTENTS_WINDOW | CONTENTS_MONSTER) #define MASK_WATER (CONTENTS_WATER | CONTENTS_LAVA | CONTENTS_SLIME) #define MASK_OPAQUE (CONTENTS_SOLID | CONTENTS_SLIME | CONTENTS_LAVA) #define MASK_SHOT (CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_WINDOW | \ CONTENTS_DEADMONSTER) #define MASK_CURRENT (CONTENTS_CURRENT_0 | CONTENTS_CURRENT_90 | \ CONTENTS_CURRENT_180 | CONTENTS_CURRENT_270 | \ CONTENTS_CURRENT_UP | \ CONTENTS_CURRENT_DOWN) /* gi.BoxEdicts() can return a list of either solid or trigger entities */ #define AREA_SOLID 1 #define AREA_TRIGGERS 2 /* plane_t structure */ typedef struct cplane_s { vec3_t normal; float dist; byte type; /* for fast side tests */ byte signbits; /* signx + (signy<<1) + (signz<<1) */ byte pad[2]; } cplane_t; /* structure offset for asm code */ #define CPLANE_NORMAL_X 0 #define CPLANE_NORMAL_Y 4 #define CPLANE_NORMAL_Z 8 #define CPLANE_DIST 12 #define CPLANE_TYPE 16 #define CPLANE_SIGNBITS 17 #define CPLANE_PAD0 18 #define CPLANE_PAD1 19 typedef struct cmodel_s { vec3_t mins, maxs; vec3_t origin; /* for sounds or lights */ int headnode; } cmodel_t; typedef struct csurface_s { char name[16]; int flags; int value; } csurface_t; typedef struct mapsurface_s /* used internally due to name len probs */ { csurface_t c; char rname[32]; } mapsurface_t; /* a trace is returned when a box is swept through the world */ typedef struct { qboolean allsolid; /* if true, plane is not valid */ qboolean startsolid; /* if true, the initial point was in a solid area */ float fraction; /* time completed, 1.0 = didn't hit anything */ vec3_t endpos; /* final position */ cplane_t plane; /* surface normal at impact */ csurface_t *surface; /* surface hit */ int contents; /* contents on other side of surface hit */ struct edict_s *ent; /* not set by CM_*() functions */ } trace_t; /* pmove_state_t is the information necessary for client side movement */ /* prediction */ typedef enum { /* can accelerate and turn */ PM_NORMAL, PM_SPECTATOR, /* no acceleration or turning */ PM_DEAD, PM_GIB, /* different bounding box */ PM_FREEZE } pmtype_t; /* pmove->pm_flags */ #define PMF_DUCKED 1 #define PMF_JUMP_HELD 2 #define PMF_ON_GROUND 4 #define PMF_TIME_WATERJUMP 8 /* pm_time is waterjump */ #define PMF_TIME_LAND 16 /* pm_time is time before rejump */ #define PMF_TIME_TELEPORT 32 /* pm_time is non-moving time */ #define PMF_NO_PREDICTION 64 /* temporarily disables prediction (used for grappling hook) */ /* this structure needs to be communicated bit-accurate/ from the server to the client to guarantee that prediction stays in sync, so no floats are used. if any part of the game code modifies this struct, it will result in a prediction error of some degree. */ typedef struct { pmtype_t pm_type; short origin[3]; /* 12.3 */ short velocity[3]; /* 12.3 */ byte pm_flags; /* ducked, jump_held, etc */ byte pm_time; /* each unit = 8 ms */ short gravity; short delta_angles[3]; /* add to command angles to get view direction changed by spawns, rotating objects, and teleporters */ } pmove_state_t; /* button bits */ #define BUTTON_ATTACK 1 #define BUTTON_USE 2 #define BUTTON_ANY 128 /* any key whatsoever */ /* usercmd_t is sent to the server each client frame */ typedef struct usercmd_s { byte msec; byte buttons; short angles[3]; short forwardmove, sidemove, upmove; byte impulse; /* remove? */ byte lightlevel; /* light level the player is standing on */ } usercmd_t; #define MAXTOUCH 32 typedef struct { /* state (in / out) */ pmove_state_t s; /* command (in) */ usercmd_t cmd; qboolean snapinitial; /* if s has been changed outside pmove */ /* results (out) */ int numtouch; struct edict_s *touchents[MAXTOUCH]; vec3_t viewangles; /* clamped */ float viewheight; vec3_t mins, maxs; /* bounding box size */ struct edict_s *groundentity; int watertype; int waterlevel; /* callbacks to test the world */ trace_t (*trace)(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end); int (*pointcontents)(vec3_t point); } pmove_t; /* entity_state_t->effects Effects are things handled on the client side (lights, particles, frame animations) that happen constantly on the given entity. An entity that has effects will be sent to the client even if it has a zero index model. */ #define EF_ROTATE 0x00000001 /* rotate (bonus items) */ #define EF_GIB 0x00000002 /* leave a trail */ #define EF_BLASTER 0x00000008 /* redlight + trail */ #define EF_ROCKET 0x00000010 /* redlight + trail */ #define EF_GRENADE 0x00000020 #define EF_HYPERBLASTER 0x00000040 #define EF_BFG 0x00000080 #define EF_COLOR_SHELL 0x00000100 #define EF_POWERSCREEN 0x00000200 #define EF_ANIM01 0x00000400 /* automatically cycle between frames 0 and 1 at 2 hz */ #define EF_ANIM23 0x00000800 /* automatically cycle between frames 2 and 3 at 2 hz */ #define EF_ANIM_ALL 0x00001000 /* automatically cycle through all frames at 2hz */ #define EF_ANIM_ALLFAST 0x00002000 /* automatically cycle through all frames at 10hz */ #define EF_FLIES 0x00004000 #define EF_QUAD 0x00008000 #define EF_PENT 0x00010000 #define EF_TELEPORTER 0x00020000 /* particle fountain */ #define EF_FLAG1 0x00040000 #define EF_FLAG2 0x00080000 #define EF_IONRIPPER 0x00100000 #define EF_GREENGIB 0x00200000 #define EF_BLUEHYPERBLASTER 0x00400000 #define EF_SPINNINGLIGHTS 0x00800000 #define EF_PLASMA 0x01000000 #define EF_TRAP 0x02000000 #define EF_TRACKER 0x04000000 #define EF_DOUBLE 0x08000000 #define EF_SPHERETRANS 0x10000000 #define EF_TAGTRAIL 0x20000000 #define EF_HALF_DAMAGE 0x40000000 #define EF_TRACKERTRAIL 0x80000000 /* entity_state_t->renderfx flags */ #define RF_MINLIGHT 1 /* allways have some light (viewmodel) */ #define RF_VIEWERMODEL 2 /* don't draw through eyes, only mirrors */ #define RF_WEAPONMODEL 4 /* only draw through eyes */ #define RF_FULLBRIGHT 8 /* allways draw full intensity */ #define RF_DEPTHHACK 16 /* for view weapon Z crunching */ #define RF_TRANSLUCENT 32 #define RF_FRAMELERP 64 #define RF_BEAM 128 #define RF_CUSTOMSKIN 256 /* skin is an index in image_precache */ #define RF_GLOW 512 /* pulse lighting for bonus items */ #define RF_SHELL_RED 1024 #define RF_SHELL_GREEN 2048 #define RF_SHELL_BLUE 4096 #define RF_NOSHADOW 8192 /* don't draw a shadow */ #define RF_IR_VISIBLE 0x00008000 /* 32768 */ #define RF_SHELL_DOUBLE 0x00010000 /* 65536 */ #define RF_SHELL_HALF_DAM 0x00020000 #define RF_USE_DISGUISE 0x00040000 /* player_state_t->refdef flags */ #define RDF_UNDERWATER 1 /* warp the screen as apropriate */ #define RDF_NOWORLDMODEL 2 /* used for player configuration screen */ #define RDF_IRGOGGLES 4 #define RDF_UVGOGGLES 8 /* muzzle flashes / player effects */ #define MZ_BLASTER 0 #define MZ_MACHINEGUN 1 #define MZ_SHOTGUN 2 #define MZ_CHAINGUN1 3 #define MZ_CHAINGUN2 4 #define MZ_CHAINGUN3 5 #define MZ_RAILGUN 6 #define MZ_ROCKET 7 #define MZ_GRENADE 8 #define MZ_LOGIN 9 #define MZ_LOGOUT 10 #define MZ_RESPAWN 11 #define MZ_BFG 12 #define MZ_SSHOTGUN 13 #define MZ_HYPERBLASTER 14 #define MZ_ITEMRESPAWN 15 #define MZ_IONRIPPER 16 #define MZ_BLUEHYPERBLASTER 17 #define MZ_PHALANX 18 #define MZ_SILENCED 128 /* bit flag ORed with one of the above numbers */ #define MZ_ETF_RIFLE 30 #define MZ_UNUSED 31 #define MZ_SHOTGUN2 32 #define MZ_HEATBEAM 33 #define MZ_BLASTER2 34 #define MZ_TRACKER 35 #define MZ_NUKE1 36 #define MZ_NUKE2 37 #define MZ_NUKE4 38 #define MZ_NUKE8 39 /* monster muzzle flashes */ #define MZ2_TANK_BLASTER_1 1 #define MZ2_TANK_BLASTER_2 2 #define MZ2_TANK_BLASTER_3 3 #define MZ2_TANK_MACHINEGUN_1 4 #define MZ2_TANK_MACHINEGUN_2 5 #define MZ2_TANK_MACHINEGUN_3 6 #define MZ2_TANK_MACHINEGUN_4 7 #define MZ2_TANK_MACHINEGUN_5 8 #define MZ2_TANK_MACHINEGUN_6 9 #define MZ2_TANK_MACHINEGUN_7 10 #define MZ2_TANK_MACHINEGUN_8 11 #define MZ2_TANK_MACHINEGUN_9 12 #define MZ2_TANK_MACHINEGUN_10 13 #define MZ2_TANK_MACHINEGUN_11 14 #define MZ2_TANK_MACHINEGUN_12 15 #define MZ2_TANK_MACHINEGUN_13 16 #define MZ2_TANK_MACHINEGUN_14 17 #define MZ2_TANK_MACHINEGUN_15 18 #define MZ2_TANK_MACHINEGUN_16 19 #define MZ2_TANK_MACHINEGUN_17 20 #define MZ2_TANK_MACHINEGUN_18 21 #define MZ2_TANK_MACHINEGUN_19 22 #define MZ2_TANK_ROCKET_1 23 #define MZ2_TANK_ROCKET_2 24 #define MZ2_TANK_ROCKET_3 25 #define MZ2_INFANTRY_MACHINEGUN_1 26 #define MZ2_INFANTRY_MACHINEGUN_2 27 #define MZ2_INFANTRY_MACHINEGUN_3 28 #define MZ2_INFANTRY_MACHINEGUN_4 29 #define MZ2_INFANTRY_MACHINEGUN_5 30 #define MZ2_INFANTRY_MACHINEGUN_6 31 #define MZ2_INFANTRY_MACHINEGUN_7 32 #define MZ2_INFANTRY_MACHINEGUN_8 33 #define MZ2_INFANTRY_MACHINEGUN_9 34 #define MZ2_INFANTRY_MACHINEGUN_10 35 #define MZ2_INFANTRY_MACHINEGUN_11 36 #define MZ2_INFANTRY_MACHINEGUN_12 37 #define MZ2_INFANTRY_MACHINEGUN_13 38 #define MZ2_SOLDIER_BLASTER_1 39 #define MZ2_SOLDIER_BLASTER_2 40 #define MZ2_SOLDIER_SHOTGUN_1 41 #define MZ2_SOLDIER_SHOTGUN_2 42 #define MZ2_SOLDIER_MACHINEGUN_1 43 #define MZ2_SOLDIER_MACHINEGUN_2 44 #define MZ2_GUNNER_MACHINEGUN_1 45 #define MZ2_GUNNER_MACHINEGUN_2 46 #define MZ2_GUNNER_MACHINEGUN_3 47 #define MZ2_GUNNER_MACHINEGUN_4 48 #define MZ2_GUNNER_MACHINEGUN_5 49 #define MZ2_GUNNER_MACHINEGUN_6 50 #define MZ2_GUNNER_MACHINEGUN_7 51 #define MZ2_GUNNER_MACHINEGUN_8 52 #define MZ2_GUNNER_GRENADE_1 53 #define MZ2_GUNNER_GRENADE_2 54 #define MZ2_GUNNER_GRENADE_3 55 #define MZ2_GUNNER_GRENADE_4 56 #define MZ2_CHICK_ROCKET_1 57 #define MZ2_FLYER_BLASTER_1 58 #define MZ2_FLYER_BLASTER_2 59 #define MZ2_MEDIC_BLASTER_1 60 #define MZ2_GLADIATOR_RAILGUN_1 61 #define MZ2_HOVER_BLASTER_1 62 #define MZ2_ACTOR_MACHINEGUN_1 63 #define MZ2_SUPERTANK_MACHINEGUN_1 64 #define MZ2_SUPERTANK_MACHINEGUN_2 65 #define MZ2_SUPERTANK_MACHINEGUN_3 66 #define MZ2_SUPERTANK_MACHINEGUN_4 67 #define MZ2_SUPERTANK_MACHINEGUN_5 68 #define MZ2_SUPERTANK_MACHINEGUN_6 69 #define MZ2_SUPERTANK_ROCKET_1 70 #define MZ2_SUPERTANK_ROCKET_2 71 #define MZ2_SUPERTANK_ROCKET_3 72 #define MZ2_BOSS2_MACHINEGUN_L1 73 #define MZ2_BOSS2_MACHINEGUN_L2 74 #define MZ2_BOSS2_MACHINEGUN_L3 75 #define MZ2_BOSS2_MACHINEGUN_L4 76 #define MZ2_BOSS2_MACHINEGUN_L5 77 #define MZ2_BOSS2_ROCKET_1 78 #define MZ2_BOSS2_ROCKET_2 79 #define MZ2_BOSS2_ROCKET_3 80 #define MZ2_BOSS2_ROCKET_4 81 #define MZ2_FLOAT_BLASTER_1 82 #define MZ2_SOLDIER_BLASTER_3 83 #define MZ2_SOLDIER_SHOTGUN_3 84 #define MZ2_SOLDIER_MACHINEGUN_3 85 #define MZ2_SOLDIER_BLASTER_4 86 #define MZ2_SOLDIER_SHOTGUN_4 87 #define MZ2_SOLDIER_MACHINEGUN_4 88 #define MZ2_SOLDIER_BLASTER_5 89 #define MZ2_SOLDIER_SHOTGUN_5 90 #define MZ2_SOLDIER_MACHINEGUN_5 91 #define MZ2_SOLDIER_BLASTER_6 92 #define MZ2_SOLDIER_SHOTGUN_6 93 #define MZ2_SOLDIER_MACHINEGUN_6 94 #define MZ2_SOLDIER_BLASTER_7 95 #define MZ2_SOLDIER_SHOTGUN_7 96 #define MZ2_SOLDIER_MACHINEGUN_7 97 #define MZ2_SOLDIER_BLASTER_8 98 #define MZ2_SOLDIER_SHOTGUN_8 99 #define MZ2_SOLDIER_MACHINEGUN_8 100 #define MZ2_MAKRON_BFG 101 #define MZ2_MAKRON_BLASTER_1 102 #define MZ2_MAKRON_BLASTER_2 103 #define MZ2_MAKRON_BLASTER_3 104 #define MZ2_MAKRON_BLASTER_4 105 #define MZ2_MAKRON_BLASTER_5 106 #define MZ2_MAKRON_BLASTER_6 107 #define MZ2_MAKRON_BLASTER_7 108 #define MZ2_MAKRON_BLASTER_8 109 #define MZ2_MAKRON_BLASTER_9 110 #define MZ2_MAKRON_BLASTER_10 111 #define MZ2_MAKRON_BLASTER_11 112 #define MZ2_MAKRON_BLASTER_12 113 #define MZ2_MAKRON_BLASTER_13 114 #define MZ2_MAKRON_BLASTER_14 115 #define MZ2_MAKRON_BLASTER_15 116 #define MZ2_MAKRON_BLASTER_16 117 #define MZ2_MAKRON_BLASTER_17 118 #define MZ2_MAKRON_RAILGUN_1 119 #define MZ2_JORG_MACHINEGUN_L1 120 #define MZ2_JORG_MACHINEGUN_L2 121 #define MZ2_JORG_MACHINEGUN_L3 122 #define MZ2_JORG_MACHINEGUN_L4 123 #define MZ2_JORG_MACHINEGUN_L5 124 #define MZ2_JORG_MACHINEGUN_L6 125 #define MZ2_JORG_MACHINEGUN_R1 126 #define MZ2_JORG_MACHINEGUN_R2 127 #define MZ2_JORG_MACHINEGUN_R3 128 #define MZ2_JORG_MACHINEGUN_R4 129 #define MZ2_JORG_MACHINEGUN_R5 130 #define MZ2_JORG_MACHINEGUN_R6 131 #define MZ2_JORG_BFG_1 132 #define MZ2_BOSS2_MACHINEGUN_R1 133 #define MZ2_BOSS2_MACHINEGUN_R2 134 #define MZ2_BOSS2_MACHINEGUN_R3 135 #define MZ2_BOSS2_MACHINEGUN_R4 136 #define MZ2_BOSS2_MACHINEGUN_R5 137 #define MZ2_CARRIER_MACHINEGUN_L1 138 #define MZ2_CARRIER_MACHINEGUN_R1 139 #define MZ2_CARRIER_GRENADE 140 #define MZ2_TURRET_MACHINEGUN 141 #define MZ2_TURRET_ROCKET 142 #define MZ2_TURRET_BLASTER 143 #define MZ2_STALKER_BLASTER 144 #define MZ2_DAEDALUS_BLASTER 145 #define MZ2_MEDIC_BLASTER_2 146 #define MZ2_CARRIER_RAILGUN 147 #define MZ2_WIDOW_DISRUPTOR 148 #define MZ2_WIDOW_BLASTER 149 #define MZ2_WIDOW_RAIL 150 #define MZ2_WIDOW_PLASMABEAM 151 #define MZ2_CARRIER_MACHINEGUN_L2 152 #define MZ2_CARRIER_MACHINEGUN_R2 153 #define MZ2_WIDOW_RAIL_LEFT 154 #define MZ2_WIDOW_RAIL_RIGHT 155 #define MZ2_WIDOW_BLASTER_SWEEP1 156 #define MZ2_WIDOW_BLASTER_SWEEP2 157 #define MZ2_WIDOW_BLASTER_SWEEP3 158 #define MZ2_WIDOW_BLASTER_SWEEP4 159 #define MZ2_WIDOW_BLASTER_SWEEP5 160 #define MZ2_WIDOW_BLASTER_SWEEP6 161 #define MZ2_WIDOW_BLASTER_SWEEP7 162 #define MZ2_WIDOW_BLASTER_SWEEP8 163 #define MZ2_WIDOW_BLASTER_SWEEP9 164 #define MZ2_WIDOW_BLASTER_100 165 #define MZ2_WIDOW_BLASTER_90 166 #define MZ2_WIDOW_BLASTER_80 167 #define MZ2_WIDOW_BLASTER_70 168 #define MZ2_WIDOW_BLASTER_60 169 #define MZ2_WIDOW_BLASTER_50 170 #define MZ2_WIDOW_BLASTER_40 171 #define MZ2_WIDOW_BLASTER_30 172 #define MZ2_WIDOW_BLASTER_20 173 #define MZ2_WIDOW_BLASTER_10 174 #define MZ2_WIDOW_BLASTER_0 175 #define MZ2_WIDOW_BLASTER_10L 176 #define MZ2_WIDOW_BLASTER_20L 177 #define MZ2_WIDOW_BLASTER_30L 178 #define MZ2_WIDOW_BLASTER_40L 179 #define MZ2_WIDOW_BLASTER_50L 180 #define MZ2_WIDOW_BLASTER_60L 181 #define MZ2_WIDOW_BLASTER_70L 182 #define MZ2_WIDOW_RUN_1 183 #define MZ2_WIDOW_RUN_2 184 #define MZ2_WIDOW_RUN_3 185 #define MZ2_WIDOW_RUN_4 186 #define MZ2_WIDOW_RUN_5 187 #define MZ2_WIDOW_RUN_6 188 #define MZ2_WIDOW_RUN_7 189 #define MZ2_WIDOW_RUN_8 190 #define MZ2_CARRIER_ROCKET_1 191 #define MZ2_CARRIER_ROCKET_2 192 #define MZ2_CARRIER_ROCKET_3 193 #define MZ2_CARRIER_ROCKET_4 194 #define MZ2_WIDOW2_BEAMER_1 195 #define MZ2_WIDOW2_BEAMER_2 196 #define MZ2_WIDOW2_BEAMER_3 197 #define MZ2_WIDOW2_BEAMER_4 198 #define MZ2_WIDOW2_BEAMER_5 199 #define MZ2_WIDOW2_BEAM_SWEEP_1 200 #define MZ2_WIDOW2_BEAM_SWEEP_2 201 #define MZ2_WIDOW2_BEAM_SWEEP_3 202 #define MZ2_WIDOW2_BEAM_SWEEP_4 203 #define MZ2_WIDOW2_BEAM_SWEEP_5 204 #define MZ2_WIDOW2_BEAM_SWEEP_6 205 #define MZ2_WIDOW2_BEAM_SWEEP_7 206 #define MZ2_WIDOW2_BEAM_SWEEP_8 207 #define MZ2_WIDOW2_BEAM_SWEEP_9 208 #define MZ2_WIDOW2_BEAM_SWEEP_10 209 #define MZ2_WIDOW2_BEAM_SWEEP_11 210 extern vec3_t monster_flash_offset[]; /* Temp entity events are for things that happen at a location seperate from any existing entity. Temporary entity messages are explicitly constructed and broadcast. */ typedef enum { TE_GUNSHOT, TE_BLOOD, TE_BLASTER, TE_RAILTRAIL, TE_SHOTGUN, TE_EXPLOSION1, TE_EXPLOSION2, TE_ROCKET_EXPLOSION, TE_GRENADE_EXPLOSION, TE_SPARKS, TE_SPLASH, TE_BUBBLETRAIL, TE_SCREEN_SPARKS, TE_SHIELD_SPARKS, TE_BULLET_SPARKS, TE_LASER_SPARKS, TE_PARASITE_ATTACK, TE_ROCKET_EXPLOSION_WATER, TE_GRENADE_EXPLOSION_WATER, TE_MEDIC_CABLE_ATTACK, TE_BFG_EXPLOSION, TE_BFG_BIGEXPLOSION, TE_BOSSTPORT, /* used as '22' in a map, so DON'T RENUMBER!!! */ TE_BFG_LASER, TE_GRAPPLE_CABLE, TE_WELDING_SPARKS, TE_GREENBLOOD, TE_BLUEHYPERBLASTER, TE_PLASMA_EXPLOSION, TE_TUNNEL_SPARKS, TE_BLASTER2, TE_RAILTRAIL2, TE_FLAME, TE_LIGHTNING, TE_DEBUGTRAIL, TE_PLAIN_EXPLOSION, TE_FLASHLIGHT, TE_FORCEWALL, TE_HEATBEAM, TE_MONSTER_HEATBEAM, TE_STEAM, TE_BUBBLETRAIL2, TE_MOREBLOOD, TE_HEATBEAM_SPARKS, TE_HEATBEAM_STEAM, TE_CHAINFIST_SMOKE, TE_ELECTRIC_SPARKS, TE_TRACKER_EXPLOSION, TE_TELEPORT_EFFECT, TE_DBALL_GOAL, TE_WIDOWBEAMOUT, TE_NUKEBLAST, TE_WIDOWSPLASH, TE_EXPLOSION1_BIG, TE_EXPLOSION1_NP, TE_FLECHETTE } temp_event_t; #define SPLASH_UNKNOWN 0 #define SPLASH_SPARKS 1 #define SPLASH_BLUE_WATER 2 #define SPLASH_BROWN_WATER 3 #define SPLASH_SLIME 4 #define SPLASH_LAVA 5 #define SPLASH_BLOOD 6 /* sound channels: channel 0 never willingly overrides other channels (1-7) allways override a playing sound on that channel */ #define CHAN_AUTO 0 #define CHAN_WEAPON 1 #define CHAN_VOICE 2 #define CHAN_ITEM 3 #define CHAN_BODY 4 /* modifier flags */ #define CHAN_NO_PHS_ADD 8 /* send to all clients, not just ones in PHS (ATTN 0 will also do this) */ #define CHAN_RELIABLE 16 /* send by reliable message, not datagram */ /* sound attenuation values */ #define ATTN_NONE 0 /* full volume the entire level */ #define ATTN_NORM 1 #define ATTN_IDLE 2 #define ATTN_STATIC 3 /* diminish very rapidly with distance */ /* player_state->stats[] indexes */ #define STAT_HEALTH_ICON 0 #define STAT_HEALTH 1 #define STAT_AMMO_ICON 2 #define STAT_AMMO 3 #define STAT_ARMOR_ICON 4 #define STAT_ARMOR 5 #define STAT_SELECTED_ICON 6 #define STAT_PICKUP_ICON 7 #define STAT_PICKUP_STRING 8 #define STAT_TIMER_ICON 9 #define STAT_TIMER 10 #define STAT_HELPICON 11 #define STAT_SELECTED_ITEM 12 #define STAT_LAYOUTS 13 #define STAT_FRAGS 14 #define STAT_FLASHES 15 /* cleared each frame, 1 = health, 2 = armor */ #define STAT_CHASE 16 #define STAT_SPECTATOR 17 #define MAX_STATS 32 /* dmflags->value flags */ #define DF_NO_HEALTH 0x00000001 /* 1 */ #define DF_NO_ITEMS 0x00000002 /* 2 */ #define DF_WEAPONS_STAY 0x00000004 /* 4 */ #define DF_NO_FALLING 0x00000008 /* 8 */ #define DF_INSTANT_ITEMS 0x00000010 /* 16 */ #define DF_SAME_LEVEL 0x00000020 /* 32 */ #define DF_SKINTEAMS 0x00000040 /* 64 */ #define DF_MODELTEAMS 0x00000080 /* 128 */ #define DF_NO_FRIENDLY_FIRE 0x00000100 /* 256 */ #define DF_SPAWN_FARTHEST 0x00000200 /* 512 */ #define DF_FORCE_RESPAWN 0x00000400 /* 1024 */ #define DF_NO_ARMOR 0x00000800 /* 2048 */ #define DF_ALLOW_EXIT 0x00001000 /* 4096 */ #define DF_INFINITE_AMMO 0x00002000 /* 8192 */ #define DF_QUAD_DROP 0x00004000 /* 16384 */ #define DF_FIXED_FOV 0x00008000 /* 32768 */ #define DF_QUADFIRE_DROP 0x00010000 /* 65536 */ #define DF_NO_MINES 0x00020000 #define DF_NO_STACK_DOUBLE 0x00040000 #define DF_NO_NUKES 0x00080000 #define DF_NO_SPHERES 0x00100000 #define ROGUE_VERSION_STRING "08/21/1998 Beta 2 for Ensemble" /* * ========================================================== * * ELEMENTS COMMUNICATED ACROSS THE NET * * ========================================================== */ #define ANGLE2SHORT(x) ((int)((x) * 65536 / 360) & 65535) #define SHORT2ANGLE(x) ((x) * (360.0 / 65536)) /* config strings are a general means of communication from the server to all connected clients. Each config string can be at most MAX_QPATH characters. */ #define CS_NAME 0 #define CS_CDTRACK 1 #define CS_SKY 2 #define CS_SKYAXIS 3 /* %f %f %f format */ #define CS_SKYROTATE 4 #define CS_STATUSBAR 5 /* display program string */ #define CS_AIRACCEL 29 /* air acceleration control */ #define CS_MAXCLIENTS 30 #define CS_MAPCHECKSUM 31 /* for catching cheater maps */ #define CS_MODELS 32 #define CS_SOUNDS (CS_MODELS + MAX_MODELS) #define CS_IMAGES (CS_SOUNDS + MAX_SOUNDS) #define CS_LIGHTS (CS_IMAGES + MAX_IMAGES) #define CS_ITEMS (CS_LIGHTS + MAX_LIGHTSTYLES) #define CS_PLAYERSKINS (CS_ITEMS + MAX_ITEMS) #define CS_GENERAL (CS_PLAYERSKINS + MAX_CLIENTS) #define MAX_CONFIGSTRINGS (CS_GENERAL + MAX_GENERAL) /* ============================================== */ /* entity_state_t->event values entity events are for effects that take place reletive to an existing entities origin. Very network efficient. All muzzle flashes really should be converted to events... */ typedef enum { EV_NONE, EV_ITEM_RESPAWN, EV_FOOTSTEP, EV_FALLSHORT, EV_FALL, EV_FALLFAR, EV_PLAYER_TELEPORT, EV_OTHER_TELEPORT } entity_event_t; /* entity_state_t is the information conveyed from the server in an update message about entities that the client will need to render in some way */ typedef struct entity_state_s { int number; /* edict index */ vec3_t origin; vec3_t angles; vec3_t old_origin; /* for lerping */ int modelindex; int modelindex2, modelindex3, modelindex4; /* weapons, CTF flags, etc */ int frame; int skinnum; unsigned int effects; int renderfx; int solid; /* for client side prediction, 8*(bits 0-4) is x/y radius */ /* 8*(bits 5-9) is z down distance, 8(bits10-15) is z up */ /* gi.linkentity sets this properly */ int sound; /* for looping sounds, to guarantee shutoff */ int event; /* impulse events -- muzzle flashes, footsteps, etc */ /* events only go out for a single frame, they */ /* are automatically cleared each frame */ } entity_state_t; /* ============================================== */ /* player_state_t is the information needed in addition to pmove_state_t to rendered a view. There will only be 10 player_state_t sent each second, but the number of pmove_state_t changes will be reletive to client frame rates */ typedef struct { pmove_state_t pmove; /* for prediction */ vec3_t viewangles; /* for fixed views */ vec3_t viewoffset; /* add to pmovestate->origin */ vec3_t kick_angles; /* add to view direction to get render angles */ /* set by weapon kicks, pain effects, etc */ vec3_t gunangles; vec3_t gunoffset; int gunindex; int gunframe; float blend[4]; /* rgba full screen effect */ float fov; /* horizontal field of view */ int rdflags; /* refdef flags */ short stats[MAX_STATS]; /* fast status bar updates */ } player_state_t; #define VIDREF_GL 1 #define VIDREF_SOFT 2 #define VIDREF_OTHER 3 extern int vidref_val; size_t verify_fread(void *, size_t, size_t, FILE *); size_t verify_fwrite(void *, size_t, size_t, FILE *); #endif /* XATRIX_SHARED_H */ xatrix-XATRIX_2_14/src/monster/000077500000000000000000000000001477320050300164165ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/berserker/000077500000000000000000000000001477320050300204025ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/berserker/berserker.c000066400000000000000000000264131477320050300225400ustar00rootroot00000000000000/* * Copyright (C) 1997-2001 Id Software, Inc. * * 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. * * ======================================================================= * * The berserker. * * ======================================================================= */ #include "../../header/local.h" #include "berserker.h" static int sound_pain; static int sound_die; static int sound_idle; static int sound_punch; static int sound_sight; static int sound_search; static int sound_step; static int sound_step2; void berserk_footstep(edict_t *self) { if (!g_monsterfootsteps->value) return; // Lazy loading for savegame compatibility. if (sound_step == 0 || sound_step2 == 0) { sound_step = gi.soundindex("berserk/step1.wav"); sound_step2 = gi.soundindex("berserk/step2.wav"); } if (randk() % 2 == 0) { gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); } } void berserk_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); } void berserk_search(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_search, 1, ATTN_NORM, 0); } void berserk_fidget(edict_t *self); static mframe_t berserk_frames_stand[] = { {ai_stand, 0, berserk_fidget}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t berserk_move_stand = { FRAME_stand1, FRAME_stand5, berserk_frames_stand, NULL }; void berserk_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &berserk_move_stand; } static mframe_t berserk_frames_stand_fidget[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t berserk_move_stand_fidget = { FRAME_standb1, FRAME_standb20, berserk_frames_stand_fidget, berserk_stand }; void berserk_fidget(edict_t *self) { if (!self) { return; } if (self->enemy) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { return; } if (random() > 0.15) { return; } self->monsterinfo.currentmove = &berserk_move_stand_fidget; gi.sound(self, CHAN_WEAPON, sound_idle, 1, ATTN_IDLE, 0); } static mframe_t berserk_frames_walk[] = { {ai_walk, 9.1, NULL}, {ai_walk, 6.3, NULL}, {ai_walk, 4.9, NULL}, {ai_walk, 6.7, berserk_footstep}, {ai_walk, 6.0, NULL}, {ai_walk, 8.2, NULL}, {ai_walk, 7.2, NULL}, {ai_walk, 6.1, NULL}, {ai_walk, 4.9, berserk_footstep}, {ai_walk, 4.7, NULL}, {ai_walk, 4.7, NULL}, {ai_walk, 4.8, NULL} }; mmove_t berserk_move_walk = { FRAME_walkc1, FRAME_walkc11, berserk_frames_walk, NULL }; void berserk_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &berserk_move_walk; } static mframe_t berserk_frames_run1[] = { {ai_run, 21, NULL}, {ai_run, 11, berserk_footstep}, {ai_run, 21, NULL}, {ai_run, 25, NULL}, {ai_run, 18, berserk_footstep}, {ai_run, 19, NULL} }; mmove_t berserk_move_run1 = { FRAME_run1, FRAME_run6, berserk_frames_run1, NULL }; void berserk_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &berserk_move_stand; } else { self->monsterinfo.currentmove = &berserk_move_run1; } } void berserk_attack_spike(edict_t *self) { static vec3_t aim = {MELEE_DISTANCE, 0, -24}; if (!self) { return; } fire_hit(self, aim, (15 + (rand() % 6)), 400); /* Faster attack -- upwards and backwards */ } void berserk_swing(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_punch, 1, ATTN_NORM, 0); } static mframe_t berserk_frames_attack_spike[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, berserk_swing}, {ai_charge, 0, berserk_attack_spike}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t berserk_move_attack_spike = { FRAME_att_c1, FRAME_att_c8, berserk_frames_attack_spike, berserk_run }; void berserk_attack_club(edict_t *self) { vec3_t aim; if (!self) { return; } VectorSet(aim, MELEE_DISTANCE, self->mins[0], -4); fire_hit(self, aim, (5 + (rand() % 6)), 400); /* Slower attack */ } static mframe_t berserk_frames_attack_club[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, berserk_footstep}, {ai_charge, 0, NULL}, {ai_charge, 0, berserk_swing}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, berserk_attack_club}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t berserk_move_attack_club = { FRAME_att_c9, FRAME_att_c20, berserk_frames_attack_club, berserk_run }; void berserk_strike(edict_t *self) { /* Unused, but removal is very PITA. Let it be... */ } static mframe_t berserk_frames_attack_strike[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, berserk_footstep}, {ai_move, 0, berserk_swing}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, berserk_strike}, {ai_move, 0, berserk_footstep}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 9.7, NULL}, {ai_move, 13.6, berserk_footstep} }; mmove_t berserk_move_attack_strike = { FRAME_att_c21, FRAME_att_c34, berserk_frames_attack_strike, berserk_run }; void berserk_melee(edict_t *self) { if (!self) { return; } if ((rand() % 2) == 0) { self->monsterinfo.currentmove = &berserk_move_attack_spike; } else { self->monsterinfo.currentmove = &berserk_move_attack_club; } } static mframe_t berserk_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t berserk_move_pain1 = { FRAME_painc1, FRAME_painc4, berserk_frames_pain1, berserk_run }; static mframe_t berserk_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t berserk_move_pain2 = { FRAME_painb1, FRAME_painb20, berserk_frames_pain2, berserk_run }; void berserk_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } self->pain_debounce_time = level.time + 3; gi.sound(self, CHAN_VOICE, sound_pain, 1, ATTN_NORM, 0); if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } if ((damage < 20) || (random() < 0.5)) { self->monsterinfo.currentmove = &berserk_move_pain1; } else { self->monsterinfo.currentmove = &berserk_move_pain2; } } void berserk_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, -8); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } static mframe_t berserk_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t berserk_move_death1 = { FRAME_death1, FRAME_death13, berserk_frames_death1, berserk_dead }; static mframe_t berserk_frames_death2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t berserk_move_death2 = { FRAME_deathc1, FRAME_deathc8, berserk_frames_death2, berserk_dead }; void berserk_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point /* unused */) { int n; if (!self) { return; } if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex( "misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 2; n++) { ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } gi.sound(self, CHAN_VOICE, sound_die, 1, ATTN_NORM, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; if (damage >= 50) { self->monsterinfo.currentmove = &berserk_move_death1; } else { self->monsterinfo.currentmove = &berserk_move_death2; } } /* * QUAKED monster_berserk (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_berserk(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } // Force recaching at next footstep to ensure // that the sound indices are correct. sound_step = 0; sound_step2 = 0; /* pre-caches */ sound_pain = gi.soundindex("berserk/berpain2.wav"); sound_die = gi.soundindex("berserk/berdeth2.wav"); sound_idle = gi.soundindex("berserk/beridle1.wav"); sound_punch = gi.soundindex("berserk/attack.wav"); sound_search = gi.soundindex("berserk/bersrch1.wav"); sound_sight = gi.soundindex("berserk/sight.wav"); self->s.modelindex = gi.modelindex("models/monsters/berserk/tris.md2"); VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, 32); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->health = 240; self->gib_health = -60; self->mass = 250; self->pain = berserk_pain; self->die = berserk_die; self->monsterinfo.stand = berserk_stand; self->monsterinfo.walk = berserk_walk; self->monsterinfo.run = berserk_run; self->monsterinfo.dodge = NULL; self->monsterinfo.attack = NULL; self->monsterinfo.melee = berserk_melee; self->monsterinfo.sight = berserk_sight; self->monsterinfo.search = berserk_search; self->monsterinfo.currentmove = &berserk_move_stand; self->monsterinfo.scale = MODEL_SCALE; gi.linkentity(self); walkmonster_start(self); } xatrix-XATRIX_2_14/src/monster/berserker/berserker.h000066400000000000000000000142341477320050300225430ustar00rootroot00000000000000/* ======================================================================= * * Berserker animations. * * ======================================================================= */ #define FRAME_stand1 0 #define FRAME_stand2 1 #define FRAME_stand3 2 #define FRAME_stand4 3 #define FRAME_stand5 4 #define FRAME_standb1 5 #define FRAME_standb2 6 #define FRAME_standb3 7 #define FRAME_standb4 8 #define FRAME_standb5 9 #define FRAME_standb6 10 #define FRAME_standb7 11 #define FRAME_standb8 12 #define FRAME_standb9 13 #define FRAME_standb10 14 #define FRAME_standb11 15 #define FRAME_standb12 16 #define FRAME_standb13 17 #define FRAME_standb14 18 #define FRAME_standb15 19 #define FRAME_standb16 20 #define FRAME_standb17 21 #define FRAME_standb18 22 #define FRAME_standb19 23 #define FRAME_standb20 24 #define FRAME_walkc1 25 #define FRAME_walkc2 26 #define FRAME_walkc3 27 #define FRAME_walkc4 28 #define FRAME_walkc5 29 #define FRAME_walkc6 30 #define FRAME_walkc7 31 #define FRAME_walkc8 32 #define FRAME_walkc9 33 #define FRAME_walkc10 34 #define FRAME_walkc11 35 #define FRAME_run1 36 #define FRAME_run2 37 #define FRAME_run3 38 #define FRAME_run4 39 #define FRAME_run5 40 #define FRAME_run6 41 #define FRAME_att_a1 42 #define FRAME_att_a2 43 #define FRAME_att_a3 44 #define FRAME_att_a4 45 #define FRAME_att_a5 46 #define FRAME_att_a6 47 #define FRAME_att_a7 48 #define FRAME_att_a8 49 #define FRAME_att_a9 50 #define FRAME_att_a10 51 #define FRAME_att_a11 52 #define FRAME_att_a12 53 #define FRAME_att_a13 54 #define FRAME_att_b1 55 #define FRAME_att_b2 56 #define FRAME_att_b3 57 #define FRAME_att_b4 58 #define FRAME_att_b5 59 #define FRAME_att_b6 60 #define FRAME_att_b7 61 #define FRAME_att_b8 62 #define FRAME_att_b9 63 #define FRAME_att_b10 64 #define FRAME_att_b11 65 #define FRAME_att_b12 66 #define FRAME_att_b13 67 #define FRAME_att_b14 68 #define FRAME_att_b15 69 #define FRAME_att_b16 70 #define FRAME_att_b17 71 #define FRAME_att_b18 72 #define FRAME_att_b19 73 #define FRAME_att_b20 74 #define FRAME_att_b21 75 #define FRAME_att_c1 76 #define FRAME_att_c2 77 #define FRAME_att_c3 78 #define FRAME_att_c4 79 #define FRAME_att_c5 80 #define FRAME_att_c6 81 #define FRAME_att_c7 82 #define FRAME_att_c8 83 #define FRAME_att_c9 84 #define FRAME_att_c10 85 #define FRAME_att_c11 86 #define FRAME_att_c12 87 #define FRAME_att_c13 88 #define FRAME_att_c14 89 #define FRAME_att_c15 90 #define FRAME_att_c16 91 #define FRAME_att_c17 92 #define FRAME_att_c18 93 #define FRAME_att_c19 94 #define FRAME_att_c20 95 #define FRAME_att_c21 96 #define FRAME_att_c22 97 #define FRAME_att_c23 98 #define FRAME_att_c24 99 #define FRAME_att_c25 100 #define FRAME_att_c26 101 #define FRAME_att_c27 102 #define FRAME_att_c28 103 #define FRAME_att_c29 104 #define FRAME_att_c30 105 #define FRAME_att_c31 106 #define FRAME_att_c32 107 #define FRAME_att_c33 108 #define FRAME_att_c34 109 #define FRAME_r_att1 110 #define FRAME_r_att2 111 #define FRAME_r_att3 112 #define FRAME_r_att4 113 #define FRAME_r_att5 114 #define FRAME_r_att6 115 #define FRAME_r_att7 116 #define FRAME_r_att8 117 #define FRAME_r_att9 118 #define FRAME_r_att10 119 #define FRAME_r_att11 120 #define FRAME_r_att12 121 #define FRAME_r_att13 122 #define FRAME_r_att14 123 #define FRAME_r_att15 124 #define FRAME_r_att16 125 #define FRAME_r_att17 126 #define FRAME_r_att18 127 #define FRAME_r_attb1 128 #define FRAME_r_attb2 129 #define FRAME_r_attb3 130 #define FRAME_r_attb4 131 #define FRAME_r_attb5 132 #define FRAME_r_attb6 133 #define FRAME_r_attb7 134 #define FRAME_r_attb8 135 #define FRAME_r_attb9 136 #define FRAME_r_attb10 137 #define FRAME_r_attb11 138 #define FRAME_r_attb12 139 #define FRAME_r_attb13 140 #define FRAME_r_attb14 141 #define FRAME_r_attb15 142 #define FRAME_r_attb16 143 #define FRAME_r_attb17 144 #define FRAME_r_attb18 145 #define FRAME_slam1 146 #define FRAME_slam2 147 #define FRAME_slam3 148 #define FRAME_slam4 149 #define FRAME_slam5 150 #define FRAME_slam6 151 #define FRAME_slam7 152 #define FRAME_slam8 153 #define FRAME_slam9 154 #define FRAME_slam10 155 #define FRAME_slam11 156 #define FRAME_slam12 157 #define FRAME_slam13 158 #define FRAME_slam14 159 #define FRAME_slam15 160 #define FRAME_slam16 161 #define FRAME_slam17 162 #define FRAME_slam18 163 #define FRAME_slam19 164 #define FRAME_slam20 165 #define FRAME_slam21 166 #define FRAME_slam22 167 #define FRAME_slam23 168 #define FRAME_duck1 169 #define FRAME_duck2 170 #define FRAME_duck3 171 #define FRAME_duck4 172 #define FRAME_duck5 173 #define FRAME_duck6 174 #define FRAME_duck7 175 #define FRAME_duck8 176 #define FRAME_duck9 177 #define FRAME_duck10 178 #define FRAME_fall1 179 #define FRAME_fall2 180 #define FRAME_fall3 181 #define FRAME_fall4 182 #define FRAME_fall5 183 #define FRAME_fall6 184 #define FRAME_fall7 185 #define FRAME_fall8 186 #define FRAME_fall9 187 #define FRAME_fall10 188 #define FRAME_fall11 189 #define FRAME_fall12 190 #define FRAME_fall13 191 #define FRAME_fall14 192 #define FRAME_fall15 193 #define FRAME_fall16 194 #define FRAME_fall17 195 #define FRAME_fall18 196 #define FRAME_fall19 197 #define FRAME_fall20 198 #define FRAME_painc1 199 #define FRAME_painc2 200 #define FRAME_painc3 201 #define FRAME_painc4 202 #define FRAME_painb1 203 #define FRAME_painb2 204 #define FRAME_painb3 205 #define FRAME_painb4 206 #define FRAME_painb5 207 #define FRAME_painb6 208 #define FRAME_painb7 209 #define FRAME_painb8 210 #define FRAME_painb9 211 #define FRAME_painb10 212 #define FRAME_painb11 213 #define FRAME_painb12 214 #define FRAME_painb13 215 #define FRAME_painb14 216 #define FRAME_painb15 217 #define FRAME_painb16 218 #define FRAME_painb17 219 #define FRAME_painb18 220 #define FRAME_painb19 221 #define FRAME_painb20 222 #define FRAME_death1 223 #define FRAME_death2 224 #define FRAME_death3 225 #define FRAME_death4 226 #define FRAME_death5 227 #define FRAME_death6 228 #define FRAME_death7 229 #define FRAME_death8 230 #define FRAME_death9 231 #define FRAME_death10 232 #define FRAME_death11 233 #define FRAME_death12 234 #define FRAME_death13 235 #define FRAME_deathc1 236 #define FRAME_deathc2 237 #define FRAME_deathc3 238 #define FRAME_deathc4 239 #define FRAME_deathc5 240 #define FRAME_deathc6 241 #define FRAME_deathc7 242 #define FRAME_deathc8 243 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/boss2/000077500000000000000000000000001477320050300174465ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/boss2/boss2.c000066400000000000000000000365101477320050300206470ustar00rootroot00000000000000/* ======================================================================= * * Boss 2 aka Hornet. * * ======================================================================= */ #include "../../header/local.h" #include "boss2.h" void BossExplode(edict_t *self); qboolean infront(edict_t *self, edict_t *other); static int sound_pain1; static int sound_pain2; static int sound_pain3; static int sound_death; static int sound_search1; void boss2_search(edict_t *self) { if (!self) { return; } if (random() < 0.5) { gi.sound(self, CHAN_VOICE, sound_search1, 1, ATTN_NONE, 0); } } void boss2_run(edict_t *self); void boss2_stand(edict_t *self); void boss2_dead(edict_t *self); void boss2_attack(edict_t *self); void boss2_attack_mg(edict_t *self); void boss2_reattack_mg(edict_t *self); void boss2_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point); void Boss2Rocket(edict_t *self) { vec3_t forward, right; vec3_t start; vec3_t dir; vec3_t vec; if (!self) { return; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_BOSS2_ROCKET_1], forward, right, start); VectorCopy(self->enemy->s.origin, vec); vec[2] += self->enemy->viewheight; VectorSubtract(vec, start, dir); VectorNormalize(dir); monster_fire_rocket(self, start, dir, 50, 500, MZ2_BOSS2_ROCKET_1); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_BOSS2_ROCKET_2], forward, right, start); VectorCopy(self->enemy->s.origin, vec); vec[2] += self->enemy->viewheight; VectorSubtract(vec, start, dir); VectorNormalize(dir); monster_fire_rocket(self, start, dir, 50, 500, MZ2_BOSS2_ROCKET_2); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_BOSS2_ROCKET_3], forward, right, start); VectorCopy(self->enemy->s.origin, vec); vec[2] += self->enemy->viewheight; VectorSubtract(vec, start, dir); VectorNormalize(dir); monster_fire_rocket(self, start, dir, 50, 500, MZ2_BOSS2_ROCKET_3); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_BOSS2_ROCKET_4], forward, right, start); VectorCopy(self->enemy->s.origin, vec); vec[2] += self->enemy->viewheight; VectorSubtract(vec, start, dir); VectorNormalize(dir); monster_fire_rocket(self, start, dir, 50, 500, MZ2_BOSS2_ROCKET_4); } void boss2_firebullet_right(edict_t *self) { vec3_t forward, right, target; vec3_t start; if (!self) { return; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_BOSS2_MACHINEGUN_R1], forward, right, start); VectorMA(self->enemy->s.origin, -0.2, self->enemy->velocity, target); target[2] += self->enemy->viewheight; VectorSubtract(target, start, forward); VectorNormalize(forward); monster_fire_bullet(self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, MZ2_BOSS2_MACHINEGUN_R1); } void boss2_firebullet_left(edict_t *self) { vec3_t forward, right, target; vec3_t start; if (!self) { return; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_BOSS2_MACHINEGUN_L1], forward, right, start); VectorMA(self->enemy->s.origin, -0.2, self->enemy->velocity, target); target[2] += self->enemy->viewheight; VectorSubtract(target, start, forward); VectorNormalize(forward); monster_fire_bullet(self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, MZ2_BOSS2_MACHINEGUN_L1); } void Boss2MachineGun(edict_t *self) { if (!self) { return; } boss2_firebullet_left(self); boss2_firebullet_right(self); } static mframe_t boss2_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t boss2_move_stand = { FRAME_stand30, FRAME_stand50, boss2_frames_stand, NULL }; static mframe_t boss2_frames_fidget[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t boss2_move_fidget = { FRAME_stand1, FRAME_stand30, boss2_frames_fidget, NULL }; static mframe_t boss2_frames_walk[] = { {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL} }; mmove_t boss2_move_walk = { FRAME_walk1, FRAME_walk20, boss2_frames_walk, NULL }; static mframe_t boss2_frames_run[] = { {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL} }; mmove_t boss2_move_run = { FRAME_walk1, FRAME_walk20, boss2_frames_run, NULL }; static mframe_t boss2_frames_attack_pre_mg[] = { {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, boss2_attack_mg} }; mmove_t boss2_move_attack_pre_mg = { FRAME_attack1, FRAME_attack9, boss2_frames_attack_pre_mg, NULL }; static mframe_t boss2_frames_attack_mg[] = { {ai_charge, 1, Boss2MachineGun}, {ai_charge, 1, Boss2MachineGun}, {ai_charge, 1, Boss2MachineGun}, {ai_charge, 1, Boss2MachineGun}, {ai_charge, 1, Boss2MachineGun}, {ai_charge, 1, boss2_reattack_mg} }; mmove_t boss2_move_attack_mg = { FRAME_attack10, FRAME_attack15, boss2_frames_attack_mg, NULL }; static mframe_t boss2_frames_attack_post_mg[] = { {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL} }; mmove_t boss2_move_attack_post_mg = { FRAME_attack16, FRAME_attack19, boss2_frames_attack_post_mg, boss2_run }; static mframe_t boss2_frames_attack_rocket[] = { {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_move, -20, Boss2Rocket}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL} }; mmove_t boss2_move_attack_rocket = { FRAME_attack20, FRAME_attack40, boss2_frames_attack_rocket, boss2_run }; static mframe_t boss2_frames_pain_heavy[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t boss2_move_pain_heavy = { FRAME_pain2, FRAME_pain19, boss2_frames_pain_heavy, boss2_run }; static mframe_t boss2_frames_pain_light[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t boss2_move_pain_light = { FRAME_pain20, FRAME_pain23, boss2_frames_pain_light, boss2_run }; static mframe_t boss2_frames_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, BossExplode} }; mmove_t boss2_move_death = { FRAME_death2, FRAME_death50, boss2_frames_death, boss2_dead }; void boss2_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &boss2_move_stand; } void boss2_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &boss2_move_stand; } else { self->monsterinfo.currentmove = &boss2_move_run; } } void boss2_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &boss2_move_walk; } void boss2_attack(edict_t *self) { vec3_t vec; float range; if (!self) { return; } VectorSubtract(self->enemy->s.origin, self->s.origin, vec); range = VectorLength(vec); if (range <= 125) { self->monsterinfo.currentmove = &boss2_move_attack_pre_mg; } else { if (random() <= 0.6) { self->monsterinfo.currentmove = &boss2_move_attack_pre_mg; } else { self->monsterinfo.currentmove = &boss2_move_attack_rocket; } } } void boss2_attack_mg(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &boss2_move_attack_mg; } void boss2_reattack_mg(edict_t *self) { if (!self) { return; } if (infront(self, self->enemy)) { if (random() <= 0.7) { self->monsterinfo.currentmove = &boss2_move_attack_mg; } else { self->monsterinfo.currentmove = &boss2_move_attack_post_mg; } } else { self->monsterinfo.currentmove = &boss2_move_attack_post_mg; } } void boss2_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } self->pain_debounce_time = level.time + 3; if (damage < 10) { gi.sound(self, CHAN_VOICE, sound_pain3, 1, ATTN_NONE, 0); self->monsterinfo.currentmove = &boss2_move_pain_light; } else if (damage < 30) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NONE, 0); self->monsterinfo.currentmove = &boss2_move_pain_light; } else { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NONE, 0); self->monsterinfo.currentmove = &boss2_move_pain_heavy; } } void boss2_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -56, -56, 0); VectorSet(self->maxs, 56, 56, 80); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } void boss2_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage /* unused */, vec3_t point /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NONE, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_NO; self->count = 0; self->monsterinfo.currentmove = &boss2_move_death; } qboolean Boss2_CheckAttack(edict_t *self) { vec3_t spot1, spot2; vec3_t temp; float chance; trace_t tr; int enemy_range; float enemy_yaw; if (!self) { return false; } if (self->enemy->health > 0) { /* see if any entities are in the way of the shot */ VectorCopy(self->s.origin, spot1); spot1[2] += self->viewheight; VectorCopy(self->enemy->s.origin, spot2); spot2[2] += self->enemy->viewheight; tr = gi.trace( spot1, NULL, NULL, spot2, self, CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_SLIME | CONTENTS_LAVA); /* do we have a clear shot? */ if (tr.ent != self->enemy) { return false; } } enemy_range = range(self, self->enemy); VectorSubtract(self->enemy->s.origin, self->s.origin, temp); enemy_yaw = vectoyaw(temp); self->ideal_yaw = enemy_yaw; /* melee attack */ if (enemy_range == RANGE_MELEE) { if (self->monsterinfo.melee) { self->monsterinfo.attack_state = AS_MELEE; } else { self->monsterinfo.attack_state = AS_MISSILE; } return true; } /* missile attack */ if (!self->monsterinfo.attack) { return false; } if (level.time < self->monsterinfo.attack_finished) { return false; } if (enemy_range == RANGE_FAR) { return false; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { chance = 0.4; } else if (enemy_range == RANGE_NEAR) { chance = 0.8; } else if (enemy_range == RANGE_MID) { chance = 0.8; } else { return false; } if (random() < chance) { self->monsterinfo.attack_state = AS_MISSILE; self->monsterinfo.attack_finished = level.time + 2 * random(); return true; } if (self->flags & FL_FLY) { if (random() < 0.3) { self->monsterinfo.attack_state = AS_SLIDING; } else { self->monsterinfo.attack_state = AS_STRAIGHT; } } return false; } /* * QUAKED monster_boss2 (1 .5 0) (-56 -56 0) (56 56 80) Ambush Trigger_Spawn Sight */ void SP_monster_boss2(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } sound_pain1 = gi.soundindex("bosshovr/bhvpain1.wav"); sound_pain2 = gi.soundindex("bosshovr/bhvpain2.wav"); sound_pain3 = gi.soundindex("bosshovr/bhvpain3.wav"); sound_death = gi.soundindex("bosshovr/bhvdeth1.wav"); sound_search1 = gi.soundindex("bosshovr/bhvunqv1.wav"); self->s.sound = gi.soundindex("bosshovr/bhvengn1.wav"); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/boss2/tris.md2"); VectorSet(self->mins, -56, -56, 0); VectorSet(self->maxs, 56, 56, 80); self->health = 2000; self->gib_health = -200; self->mass = 1000; self->flags |= FL_IMMUNE_LASER; self->pain = boss2_pain; self->die = boss2_die; self->monsterinfo.stand = boss2_stand; self->monsterinfo.walk = boss2_walk; self->monsterinfo.run = boss2_run; self->monsterinfo.attack = boss2_attack; self->monsterinfo.search = boss2_search; self->monsterinfo.checkattack = Boss2_CheckAttack; gi.linkentity(self); self->monsterinfo.currentmove = &boss2_move_stand; self->monsterinfo.scale = MODEL_SCALE; flymonster_start(self); } xatrix-XATRIX_2_14/src/monster/boss2/boss2.h000066400000000000000000000112371477320050300206530ustar00rootroot00000000000000/* ======================================================================= * * Animations for boss2. * * ======================================================================= */ #define FRAME_stand30 0 #define FRAME_stand31 1 #define FRAME_stand32 2 #define FRAME_stand33 3 #define FRAME_stand34 4 #define FRAME_stand35 5 #define FRAME_stand36 6 #define FRAME_stand37 7 #define FRAME_stand38 8 #define FRAME_stand39 9 #define FRAME_stand40 10 #define FRAME_stand41 11 #define FRAME_stand42 12 #define FRAME_stand43 13 #define FRAME_stand44 14 #define FRAME_stand45 15 #define FRAME_stand46 16 #define FRAME_stand47 17 #define FRAME_stand48 18 #define FRAME_stand49 19 #define FRAME_stand50 20 #define FRAME_stand1 21 #define FRAME_stand2 22 #define FRAME_stand3 23 #define FRAME_stand4 24 #define FRAME_stand5 25 #define FRAME_stand6 26 #define FRAME_stand7 27 #define FRAME_stand8 28 #define FRAME_stand9 29 #define FRAME_stand10 30 #define FRAME_stand11 31 #define FRAME_stand12 32 #define FRAME_stand13 33 #define FRAME_stand14 34 #define FRAME_stand15 35 #define FRAME_stand16 36 #define FRAME_stand17 37 #define FRAME_stand18 38 #define FRAME_stand19 39 #define FRAME_stand20 40 #define FRAME_stand21 41 #define FRAME_stand22 42 #define FRAME_stand23 43 #define FRAME_stand24 44 #define FRAME_stand25 45 #define FRAME_stand26 46 #define FRAME_stand27 47 #define FRAME_stand28 48 #define FRAME_stand29 49 #define FRAME_walk1 50 #define FRAME_walk2 51 #define FRAME_walk3 52 #define FRAME_walk4 53 #define FRAME_walk5 54 #define FRAME_walk6 55 #define FRAME_walk7 56 #define FRAME_walk8 57 #define FRAME_walk9 58 #define FRAME_walk10 59 #define FRAME_walk11 60 #define FRAME_walk12 61 #define FRAME_walk13 62 #define FRAME_walk14 63 #define FRAME_walk15 64 #define FRAME_walk16 65 #define FRAME_walk17 66 #define FRAME_walk18 67 #define FRAME_walk19 68 #define FRAME_walk20 69 #define FRAME_attack1 70 #define FRAME_attack2 71 #define FRAME_attack3 72 #define FRAME_attack4 73 #define FRAME_attack5 74 #define FRAME_attack6 75 #define FRAME_attack7 76 #define FRAME_attack8 77 #define FRAME_attack9 78 #define FRAME_attack10 79 #define FRAME_attack11 80 #define FRAME_attack12 81 #define FRAME_attack13 82 #define FRAME_attack14 83 #define FRAME_attack15 84 #define FRAME_attack16 85 #define FRAME_attack17 86 #define FRAME_attack18 87 #define FRAME_attack19 88 #define FRAME_attack20 89 #define FRAME_attack21 90 #define FRAME_attack22 91 #define FRAME_attack23 92 #define FRAME_attack24 93 #define FRAME_attack25 94 #define FRAME_attack26 95 #define FRAME_attack27 96 #define FRAME_attack28 97 #define FRAME_attack29 98 #define FRAME_attack30 99 #define FRAME_attack31 100 #define FRAME_attack32 101 #define FRAME_attack33 102 #define FRAME_attack34 103 #define FRAME_attack35 104 #define FRAME_attack36 105 #define FRAME_attack37 106 #define FRAME_attack38 107 #define FRAME_attack39 108 #define FRAME_attack40 109 #define FRAME_pain2 110 #define FRAME_pain3 111 #define FRAME_pain4 112 #define FRAME_pain5 113 #define FRAME_pain6 114 #define FRAME_pain7 115 #define FRAME_pain8 116 #define FRAME_pain9 117 #define FRAME_pain10 118 #define FRAME_pain11 119 #define FRAME_pain12 120 #define FRAME_pain13 121 #define FRAME_pain14 122 #define FRAME_pain15 123 #define FRAME_pain16 124 #define FRAME_pain17 125 #define FRAME_pain18 126 #define FRAME_pain19 127 #define FRAME_pain20 128 #define FRAME_pain21 129 #define FRAME_pain22 130 #define FRAME_pain23 131 #define FRAME_death2 132 #define FRAME_death3 133 #define FRAME_death4 134 #define FRAME_death5 135 #define FRAME_death6 136 #define FRAME_death7 137 #define FRAME_death8 138 #define FRAME_death9 139 #define FRAME_death10 140 #define FRAME_death11 141 #define FRAME_death12 142 #define FRAME_death13 143 #define FRAME_death14 144 #define FRAME_death15 145 #define FRAME_death16 146 #define FRAME_death17 147 #define FRAME_death18 148 #define FRAME_death19 149 #define FRAME_death20 150 #define FRAME_death21 151 #define FRAME_death22 152 #define FRAME_death23 153 #define FRAME_death24 154 #define FRAME_death25 155 #define FRAME_death26 156 #define FRAME_death27 157 #define FRAME_death28 158 #define FRAME_death29 159 #define FRAME_death30 160 #define FRAME_death31 161 #define FRAME_death32 162 #define FRAME_death33 163 #define FRAME_death34 164 #define FRAME_death35 165 #define FRAME_death36 166 #define FRAME_death37 167 #define FRAME_death38 168 #define FRAME_death39 169 #define FRAME_death40 170 #define FRAME_death41 171 #define FRAME_death42 172 #define FRAME_death43 173 #define FRAME_death44 174 #define FRAME_death45 175 #define FRAME_death46 176 #define FRAME_death47 177 #define FRAME_death48 178 #define FRAME_death49 179 #define FRAME_death50 180 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/boss3/000077500000000000000000000000001477320050300174475ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/boss3/boss3.c000066400000000000000000000024001477320050300206400ustar00rootroot00000000000000#include "../../header/local.h" #include "boss32.h" void Use_Boss3(edict_t *ent, edict_t *other /* unused */, edict_t *activator /* unused */) { if (!ent) { return; } gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_BOSSTPORT); gi.WritePosition(ent->s.origin); gi.multicast(ent->s.origin, MULTICAST_PVS); G_FreeEdict(ent); } void Think_Boss3Stand(edict_t *ent) { if (!ent) { return; } if (ent->s.frame == FRAME_stand260) { ent->s.frame = FRAME_stand201; } else { ent->s.frame++; } ent->nextthink = level.time + FRAMETIME; } /* * QUAKED monster_boss3_stand (1 .5 0) (-32 -32 0) (32 32 90) * * Just stands and cycles in one place until targeted, then teleports away. */ void SP_monster_boss3_stand(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->model = "models/monsters/boss3/rider/tris.md2"; self->s.modelindex = gi.modelindex(self->model); self->s.frame = FRAME_stand201; gi.soundindex("misc/bigtele.wav"); VectorSet(self->mins, -32, -32, 0); VectorSet(self->maxs, 32, 32, 90); self->use = Use_Boss3; self->think = Think_Boss3Stand; self->nextthink = level.time + FRAMETIME; gi.linkentity(self); } xatrix-XATRIX_2_14/src/monster/boss3/boss31.c000066400000000000000000000421571477320050300207360ustar00rootroot00000000000000/* ======================================================================= * * Final boss, stage 1 (jorg). * * ======================================================================= */ #include "../../header/local.h" #include "boss31.h" extern void SP_monster_makron(edict_t *self); qboolean visible(edict_t *self, edict_t *other); static int sound_pain1; static int sound_pain2; static int sound_pain3; static int sound_idle; static int sound_death; static int sound_search1; static int sound_search2; static int sound_search3; static int sound_attack1; static int sound_attack2; static int sound_firegun; static int sound_step_left; static int sound_step_right; static int sound_death_hit; void BossExplode(edict_t *self); void MakronToss(edict_t *self); void MakronPrecache(void); void jorg_dead(edict_t *self); void jorgBFG(edict_t *self); void jorgMachineGun(edict_t *self); void jorg_firebullet(edict_t *self); void jorg_reattack1(edict_t *self); void jorg_attack1(edict_t *self); void jorg_idle(edict_t *self); void jorg_step_left(edict_t *self); void jorg_step_right(edict_t *self); void jorg_death_hit(edict_t *self); void jorg_search(edict_t *self) { float r; if (!self) { return; } r = random(); if (r <= 0.3) { gi.sound(self, CHAN_VOICE, sound_search1, 1, ATTN_NORM, 0); } else if (r <= 0.6) { gi.sound(self, CHAN_VOICE, sound_search2, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_search3, 1, ATTN_NORM, 0); } } /* stand */ static mframe_t jorg_frames_stand[] = { {ai_stand, 0, jorg_idle}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, /* 10 */ {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, /* 20 */ {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, /* 30 */ {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 19, NULL}, {ai_stand, 11, jorg_step_left}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 6, NULL}, {ai_stand, 9, jorg_step_right}, {ai_stand, 0, NULL}, /* 40 */ {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, -2, NULL}, {ai_stand, -17, jorg_step_left}, {ai_stand, 0, NULL}, {ai_stand, -12, NULL}, /* 50 */ {ai_stand, -14, jorg_step_right} /* 51 */ }; mmove_t jorg_move_stand = { FRAME_stand01, FRAME_stand51, jorg_frames_stand, NULL }; void jorg_idle(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_NORM, 0); } void jorg_death_hit(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_BODY, sound_death_hit, 1, ATTN_NORM, 0); } void jorg_step_left(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_BODY, sound_step_left, 1, ATTN_NORM, 0); } void jorg_step_right(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_BODY, sound_step_right, 1, ATTN_NORM, 0); } void jorg_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &jorg_move_stand; } static mframe_t jorg_frames_run[] = { {ai_run, 17, jorg_step_left}, {ai_run, 0, NULL}, {ai_run, 0, NULL}, {ai_run, 0, NULL}, {ai_run, 12, NULL}, {ai_run, 8, NULL}, {ai_run, 10, NULL}, {ai_run, 33, jorg_step_right}, {ai_run, 0, NULL}, {ai_run, 0, NULL}, {ai_run, 0, NULL}, {ai_run, 9, NULL}, {ai_run, 9, NULL}, {ai_run, 9, NULL} }; mmove_t jorg_move_run = { FRAME_walk06, FRAME_walk19, jorg_frames_run, NULL }; /* walk */ static mframe_t jorg_frames_start_walk[] = { {ai_walk, 5, NULL}, {ai_walk, 6, NULL}, {ai_walk, 7, NULL}, {ai_walk, 9, NULL}, {ai_walk, 15, NULL} }; mmove_t jorg_move_start_walk = { FRAME_walk01, FRAME_walk05, jorg_frames_start_walk, NULL }; static mframe_t jorg_frames_walk[] = { {ai_walk, 17, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 12, NULL}, {ai_walk, 8, NULL}, {ai_walk, 10, NULL}, {ai_walk, 33, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 9, NULL}, {ai_walk, 9, NULL}, {ai_walk, 9, NULL} }; mmove_t jorg_move_walk = { FRAME_walk06, FRAME_walk19, jorg_frames_walk, NULL }; static mframe_t jorg_frames_end_walk[] = { {ai_walk, 11, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 8, NULL}, {ai_walk, -8, NULL} }; mmove_t jorg_move_end_walk = { FRAME_walk20, FRAME_walk25, jorg_frames_end_walk, NULL }; void jorg_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &jorg_move_walk; } void jorg_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &jorg_move_stand; } else { self->monsterinfo.currentmove = &jorg_move_run; } } static mframe_t jorg_frames_pain3[] = { {ai_move, -28, NULL}, {ai_move, -6, NULL}, {ai_move, -3, jorg_step_left}, {ai_move, -9, NULL}, {ai_move, 0, jorg_step_right}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -7, NULL}, {ai_move, 1, NULL}, {ai_move, -11, NULL}, {ai_move, -4, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 10, NULL}, {ai_move, 11, NULL}, {ai_move, 0, NULL}, {ai_move, 10, NULL}, {ai_move, 3, NULL}, {ai_move, 10, NULL}, {ai_move, 7, jorg_step_left}, {ai_move, 17, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, jorg_step_right} }; mmove_t jorg_move_pain3 = { FRAME_pain301, FRAME_pain325, jorg_frames_pain3, jorg_run }; static mframe_t jorg_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t jorg_move_pain2 = { FRAME_pain201, FRAME_pain203, jorg_frames_pain2, jorg_run }; static mframe_t jorg_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t jorg_move_pain1 = { FRAME_pain101, FRAME_pain103, jorg_frames_pain1, jorg_run }; static mframe_t jorg_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 10 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 20 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 30 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 40 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, MakronToss}, {ai_move, 0, BossExplode} /* 50 */ }; mmove_t jorg_move_death = { FRAME_death01, FRAME_death50, jorg_frames_death1, jorg_dead }; static mframe_t jorg_frames_attack2[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, jorgBFG}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t jorg_move_attack2 = { FRAME_attak201, FRAME_attak213, jorg_frames_attack2, jorg_run }; static mframe_t jorg_frames_start_attack1[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t jorg_move_start_attack1 = { FRAME_attak101, FRAME_attak108, jorg_frames_start_attack1, jorg_attack1 }; static mframe_t jorg_frames_attack1[] = { {ai_charge, 0, jorg_firebullet}, {ai_charge, 0, jorg_firebullet}, {ai_charge, 0, jorg_firebullet}, {ai_charge, 0, jorg_firebullet}, {ai_charge, 0, jorg_firebullet}, {ai_charge, 0, jorg_firebullet} }; mmove_t jorg_move_attack1 = { FRAME_attak109, FRAME_attak114, jorg_frames_attack1, jorg_reattack1 }; static mframe_t jorg_frames_end_attack1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t jorg_move_end_attack1 = { FRAME_attak115, FRAME_attak118, jorg_frames_end_attack1, jorg_run }; void jorg_reattack1(edict_t *self) { if (!self) { return; } if (visible(self, self->enemy)) { if (random() < 0.9) { self->monsterinfo.currentmove = &jorg_move_attack1; } else { self->s.sound = 0; self->monsterinfo.currentmove = &jorg_move_end_attack1; } } else { self->s.sound = 0; self->monsterinfo.currentmove = &jorg_move_end_attack1; } } void jorg_attack1(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &jorg_move_attack1; } void jorg_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } self->s.sound = 0; if (level.time < self->pain_debounce_time) { return; } /* Lessen the chance of him going into his pain frames if he takes little damage */ if (damage <= 40) { if (random() <= 0.6) { return; } } /* If he's entering his attack1 or using attack1, lessen the chance of him going into pain */ if ((self->s.frame >= FRAME_attak101) && (self->s.frame <= FRAME_attak108)) { if (random() <= 0.005) { return; } } if ((self->s.frame >= FRAME_attak109) && (self->s.frame <= FRAME_attak114)) { if (random() <= 0.00005) { return; } } if ((self->s.frame >= FRAME_attak201) && (self->s.frame <= FRAME_attak208)) { if (random() <= 0.005) { return; } } self->pain_debounce_time = level.time + 3; if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } if (damage <= 50) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &jorg_move_pain1; } else if (damage <= 100) { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &jorg_move_pain2; } else { if (random() <= 0.3) { gi.sound(self, CHAN_VOICE, sound_pain3, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &jorg_move_pain3; } } } void jorgBFG(edict_t *self) { vec3_t forward, right; vec3_t start; vec3_t dir; vec3_t vec; if (!self) { return; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_JORG_BFG_1], forward, right, start); VectorCopy(self->enemy->s.origin, vec); vec[2] += self->enemy->viewheight; VectorSubtract(vec, start, dir); VectorNormalize(dir); gi.sound(self, CHAN_VOICE, sound_attack2, 1, ATTN_NORM, 0); monster_fire_bfg(self, start, dir, 50, 300, 100, 200, MZ2_JORG_BFG_1); } void jorg_firebullet_right(edict_t *self) { vec3_t forward, right, target; vec3_t start; if (!self) { return; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_JORG_MACHINEGUN_R1], forward, right, start); VectorMA(self->enemy->s.origin, -0.2, self->enemy->velocity, target); target[2] += self->enemy->viewheight; VectorSubtract(target, start, forward); VectorNormalize(forward); monster_fire_bullet(self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, MZ2_JORG_MACHINEGUN_R1); } void jorg_firebullet_left(edict_t *self) { vec3_t forward, right, target; vec3_t start; if (!self) { return; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_JORG_MACHINEGUN_L1], forward, right, start); VectorMA(self->enemy->s.origin, -0.2, self->enemy->velocity, target); target[2] += self->enemy->viewheight; VectorSubtract(target, start, forward); VectorNormalize(forward); monster_fire_bullet(self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, MZ2_JORG_MACHINEGUN_L1); } void jorg_firebullet(edict_t *self) { if (!self) { return; } jorg_firebullet_left(self); jorg_firebullet_right(self); } void jorg_attack(edict_t *self) { if (!self) { return; } if (random() <= 0.75) { gi.sound(self, CHAN_VOICE, sound_attack1, 1, ATTN_NORM, 0); self->s.sound = gi.soundindex("boss3/w_loop.wav"); self->monsterinfo.currentmove = &jorg_move_start_attack1; } else { gi.sound(self, CHAN_VOICE, sound_attack2, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &jorg_move_attack2; } } void jorg_dead(edict_t *self /* unused */) { /* unused, but removal is PITA */ } void jorg_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage /* unused */, vec3_t point /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_NO; self->s.sound = 0; self->count = 0; self->monsterinfo.currentmove = &jorg_move_death; } qboolean Jorg_CheckAttack(edict_t *self) { vec3_t spot1, spot2; vec3_t temp; float chance; trace_t tr; int enemy_range; float enemy_yaw; if (!self) { return false; } if (self->enemy->health > 0) { /* see if any entities are in the way of the shot */ VectorCopy(self->s.origin, spot1); spot1[2] += self->viewheight; VectorCopy(self->enemy->s.origin, spot2); spot2[2] += self->enemy->viewheight; tr = gi.trace(spot1, NULL, NULL, spot2, self, CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_SLIME | CONTENTS_LAVA); /* do we have a clear shot? */ if (tr.ent != self->enemy) { return false; } } enemy_range = range(self, self->enemy); VectorSubtract(self->enemy->s.origin, self->s.origin, temp); enemy_yaw = vectoyaw(temp); self->ideal_yaw = enemy_yaw; /* melee attack */ if (enemy_range == RANGE_MELEE) { if (self->monsterinfo.melee) { self->monsterinfo.attack_state = AS_MELEE; } else { self->monsterinfo.attack_state = AS_MISSILE; } return true; } /* missile attack */ if (!self->monsterinfo.attack) { return false; } if (level.time < self->monsterinfo.attack_finished) { return false; } if (enemy_range == RANGE_FAR) { return false; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { chance = 0.4; } else if (enemy_range == RANGE_NEAR) { chance = 0.4; } else if (enemy_range == RANGE_MID) { chance = 0.2; } else { return false; } if (random() < chance) { self->monsterinfo.attack_state = AS_MISSILE; self->monsterinfo.attack_finished = level.time + 2 * random(); return true; } if (self->flags & FL_FLY) { if (random() < 0.3) { self->monsterinfo.attack_state = AS_SLIDING; } else { self->monsterinfo.attack_state = AS_STRAIGHT; } } return false; } /* * QUAKED monster_jorg (1 .5 0) (-80 -80 0) (90 90 140) Ambush Trigger_Spawn Sight */ void SP_monster_jorg(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } sound_pain1 = gi.soundindex("boss3/bs3pain1.wav"); sound_pain2 = gi.soundindex("boss3/bs3pain2.wav"); sound_pain3 = gi.soundindex("boss3/bs3pain3.wav"); sound_death = gi.soundindex("boss3/bs3deth1.wav"); sound_attack1 = gi.soundindex("boss3/bs3atck1.wav"); sound_attack2 = gi.soundindex("boss3/bs3atck2.wav"); sound_search1 = gi.soundindex("boss3/bs3srch1.wav"); sound_search2 = gi.soundindex("boss3/bs3srch2.wav"); sound_search3 = gi.soundindex("boss3/bs3srch3.wav"); sound_idle = gi.soundindex("boss3/bs3idle1.wav"); sound_step_left = gi.soundindex("boss3/step1.wav"); sound_step_right = gi.soundindex("boss3/step2.wav"); sound_firegun = gi.soundindex("boss3/xfire.wav"); sound_death_hit = gi.soundindex("boss3/d_hit.wav"); MakronPrecache(); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/boss3/jorg/tris.md2"); self->s.modelindex2 = gi.modelindex("models/monsters/boss3/rider/tris.md2"); VectorSet(self->mins, -80, -80, 0); VectorSet(self->maxs, 80, 80, 140); self->health = 3000; self->gib_health = -2000; self->mass = 1000; self->pain = jorg_pain; self->die = jorg_die; self->monsterinfo.stand = jorg_stand; self->monsterinfo.walk = jorg_walk; self->monsterinfo.run = jorg_run; self->monsterinfo.dodge = NULL; self->monsterinfo.attack = jorg_attack; self->monsterinfo.search = jorg_search; self->monsterinfo.melee = NULL; self->monsterinfo.sight = NULL; self->monsterinfo.checkattack = Jorg_CheckAttack; gi.linkentity(self); self->monsterinfo.currentmove = &jorg_move_stand; self->monsterinfo.scale = MODEL_SCALE; walkmonster_start(self); } xatrix-XATRIX_2_14/src/monster/boss3/boss31.h000066400000000000000000000116251477320050300207370ustar00rootroot00000000000000/* ======================================================================= * * Animations for final boss stage 1. * * ======================================================================= */ #define FRAME_attak101 0 #define FRAME_attak102 1 #define FRAME_attak103 2 #define FRAME_attak104 3 #define FRAME_attak105 4 #define FRAME_attak106 5 #define FRAME_attak107 6 #define FRAME_attak108 7 #define FRAME_attak109 8 #define FRAME_attak110 9 #define FRAME_attak111 10 #define FRAME_attak112 11 #define FRAME_attak113 12 #define FRAME_attak114 13 #define FRAME_attak115 14 #define FRAME_attak116 15 #define FRAME_attak117 16 #define FRAME_attak118 17 #define FRAME_attak201 18 #define FRAME_attak202 19 #define FRAME_attak203 20 #define FRAME_attak204 21 #define FRAME_attak205 22 #define FRAME_attak206 23 #define FRAME_attak207 24 #define FRAME_attak208 25 #define FRAME_attak209 26 #define FRAME_attak210 27 #define FRAME_attak211 28 #define FRAME_attak212 29 #define FRAME_attak213 30 #define FRAME_death01 31 #define FRAME_death02 32 #define FRAME_death03 33 #define FRAME_death04 34 #define FRAME_death05 35 #define FRAME_death06 36 #define FRAME_death07 37 #define FRAME_death08 38 #define FRAME_death09 39 #define FRAME_death10 40 #define FRAME_death11 41 #define FRAME_death12 42 #define FRAME_death13 43 #define FRAME_death14 44 #define FRAME_death15 45 #define FRAME_death16 46 #define FRAME_death17 47 #define FRAME_death18 48 #define FRAME_death19 49 #define FRAME_death20 50 #define FRAME_death21 51 #define FRAME_death22 52 #define FRAME_death23 53 #define FRAME_death24 54 #define FRAME_death25 55 #define FRAME_death26 56 #define FRAME_death27 57 #define FRAME_death28 58 #define FRAME_death29 59 #define FRAME_death30 60 #define FRAME_death31 61 #define FRAME_death32 62 #define FRAME_death33 63 #define FRAME_death34 64 #define FRAME_death35 65 #define FRAME_death36 66 #define FRAME_death37 67 #define FRAME_death38 68 #define FRAME_death39 69 #define FRAME_death40 70 #define FRAME_death41 71 #define FRAME_death42 72 #define FRAME_death43 73 #define FRAME_death44 74 #define FRAME_death45 75 #define FRAME_death46 76 #define FRAME_death47 77 #define FRAME_death48 78 #define FRAME_death49 79 #define FRAME_death50 80 #define FRAME_pain101 81 #define FRAME_pain102 82 #define FRAME_pain103 83 #define FRAME_pain201 84 #define FRAME_pain202 85 #define FRAME_pain203 86 #define FRAME_pain301 87 #define FRAME_pain302 88 #define FRAME_pain303 89 #define FRAME_pain304 90 #define FRAME_pain305 91 #define FRAME_pain306 92 #define FRAME_pain307 93 #define FRAME_pain308 94 #define FRAME_pain309 95 #define FRAME_pain310 96 #define FRAME_pain311 97 #define FRAME_pain312 98 #define FRAME_pain313 99 #define FRAME_pain314 100 #define FRAME_pain315 101 #define FRAME_pain316 102 #define FRAME_pain317 103 #define FRAME_pain318 104 #define FRAME_pain319 105 #define FRAME_pain320 106 #define FRAME_pain321 107 #define FRAME_pain322 108 #define FRAME_pain323 109 #define FRAME_pain324 110 #define FRAME_pain325 111 #define FRAME_stand01 112 #define FRAME_stand02 113 #define FRAME_stand03 114 #define FRAME_stand04 115 #define FRAME_stand05 116 #define FRAME_stand06 117 #define FRAME_stand07 118 #define FRAME_stand08 119 #define FRAME_stand09 120 #define FRAME_stand10 121 #define FRAME_stand11 122 #define FRAME_stand12 123 #define FRAME_stand13 124 #define FRAME_stand14 125 #define FRAME_stand15 126 #define FRAME_stand16 127 #define FRAME_stand17 128 #define FRAME_stand18 129 #define FRAME_stand19 130 #define FRAME_stand20 131 #define FRAME_stand21 132 #define FRAME_stand22 133 #define FRAME_stand23 134 #define FRAME_stand24 135 #define FRAME_stand25 136 #define FRAME_stand26 137 #define FRAME_stand27 138 #define FRAME_stand28 139 #define FRAME_stand29 140 #define FRAME_stand30 141 #define FRAME_stand31 142 #define FRAME_stand32 143 #define FRAME_stand33 144 #define FRAME_stand34 145 #define FRAME_stand35 146 #define FRAME_stand36 147 #define FRAME_stand37 148 #define FRAME_stand38 149 #define FRAME_stand39 150 #define FRAME_stand40 151 #define FRAME_stand41 152 #define FRAME_stand42 153 #define FRAME_stand43 154 #define FRAME_stand44 155 #define FRAME_stand45 156 #define FRAME_stand46 157 #define FRAME_stand47 158 #define FRAME_stand48 159 #define FRAME_stand49 160 #define FRAME_stand50 161 #define FRAME_stand51 162 #define FRAME_walk01 163 #define FRAME_walk02 164 #define FRAME_walk03 165 #define FRAME_walk04 166 #define FRAME_walk05 167 #define FRAME_walk06 168 #define FRAME_walk07 169 #define FRAME_walk08 170 #define FRAME_walk09 171 #define FRAME_walk10 172 #define FRAME_walk11 173 #define FRAME_walk12 174 #define FRAME_walk13 175 #define FRAME_walk14 176 #define FRAME_walk15 177 #define FRAME_walk16 178 #define FRAME_walk17 179 #define FRAME_walk18 180 #define FRAME_walk19 181 #define FRAME_walk20 182 #define FRAME_walk21 183 #define FRAME_walk22 184 #define FRAME_walk23 185 #define FRAME_walk24 186 #define FRAME_walk25 187 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/boss3/boss32.c000066400000000000000000000571251477320050300207400ustar00rootroot00000000000000/* ======================================================================= * * Final boss, stage 2 (makron). * * ======================================================================= */ #include "../../header/local.h" #include "boss32.h" qboolean visible(edict_t *self, edict_t *other); void MakronRailgun(edict_t *self); void MakronSaveloc(edict_t *self); void MakronHyperblaster(edict_t *self); void makron_step_left(edict_t *self); void makron_step_right(edict_t *self); void makronBFG(edict_t *self); void makron_dead(edict_t *self); static int sound_pain4; static int sound_pain5; static int sound_pain6; static int sound_death; static int sound_step_left; static int sound_step_right; static int sound_attack_bfg; static int sound_brainsplorch; static int sound_prerailgun; static int sound_popup; static int sound_taunt1; static int sound_taunt2; static int sound_taunt3; static int sound_hit; void makron_taunt(edict_t *self) { float r; if (!self) { return; } r = random(); if (r <= 0.3) { gi.sound(self, CHAN_AUTO, sound_taunt1, 1, ATTN_NONE, 0); } else if (r <= 0.6) { gi.sound(self, CHAN_AUTO, sound_taunt2, 1, ATTN_NONE, 0); } else { gi.sound(self, CHAN_AUTO, sound_taunt3, 1, ATTN_NONE, 0); } } /* stand */ static mframe_t makron_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, /* 10 */ {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, /* 20 */ {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, /* 30 */ {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, /* 40 */ {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, /* 50 */ {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} /* 60 */ }; mmove_t makron_move_stand = { FRAME_stand201, FRAME_stand260, makron_frames_stand, NULL }; void makron_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &makron_move_stand; } static mframe_t makron_frames_run[] = { {ai_run, 3, makron_step_left}, {ai_run, 12, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, makron_step_right}, {ai_run, 6, NULL}, {ai_run, 12, NULL}, {ai_run, 9, NULL}, {ai_run, 6, NULL}, {ai_run, 12, NULL} }; mmove_t makron_move_run = { FRAME_walk204, FRAME_walk213, makron_frames_run, NULL }; void makron_hit(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_AUTO, sound_hit, 1, ATTN_NONE, 0); } void makron_popup(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_BODY, sound_popup, 1, ATTN_NONE, 0); } void makron_step_left(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_BODY, sound_step_left, 1, ATTN_NORM, 0); } void makron_step_right(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_BODY, sound_step_right, 1, ATTN_NORM, 0); } void makron_brainsplorch(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_brainsplorch, 1, ATTN_NORM, 0); } void makron_prerailgun(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_prerailgun, 1, ATTN_NORM, 0); } mmove_t makron_move_walk = { FRAME_walk204, FRAME_walk213, makron_frames_run, NULL }; void makron_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &makron_move_walk; } void makron_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &makron_move_stand; } else { self->monsterinfo.currentmove = &makron_move_run; } } static mframe_t makron_frames_pain6[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 10 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, makron_popup}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 20 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, makron_taunt}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t makron_move_pain6 = { FRAME_pain601, FRAME_pain627, makron_frames_pain6, makron_run }; static mframe_t makron_frames_pain5[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t makron_move_pain5 = { FRAME_pain501, FRAME_pain504, makron_frames_pain5, makron_run }; static mframe_t makron_frames_pain4[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t makron_move_pain4 = { FRAME_pain401, FRAME_pain404, makron_frames_pain4, makron_run }; static mframe_t makron_frames_death2[] = { {ai_move, -15, NULL}, {ai_move, 3, NULL}, {ai_move, -12, NULL}, {ai_move, 0, makron_step_left}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 10 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 11, NULL}, {ai_move, 12, NULL}, {ai_move, 11, makron_step_right}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 20 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 30 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 5, NULL}, {ai_move, 7, NULL}, {ai_move, 6, makron_step_left}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -1, NULL}, {ai_move, 2, NULL}, /* 40 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 50 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -6, NULL}, {ai_move, -4, NULL}, {ai_move, -6, makron_step_right}, {ai_move, -4, NULL}, {ai_move, -4, makron_step_left}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 60 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -2, NULL}, {ai_move, -5, NULL}, {ai_move, -3, makron_step_right}, {ai_move, -8, NULL}, {ai_move, -3, makron_step_left}, {ai_move, -7, NULL}, {ai_move, -4, NULL}, {ai_move, -4, makron_step_right}, /* 70 */ {ai_move, -6, NULL}, {ai_move, -7, NULL}, {ai_move, 0, makron_step_left}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 80 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -2, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 2, NULL}, {ai_move, 0, NULL}, /* 90 */ {ai_move, 27, makron_hit}, {ai_move, 26, NULL}, {ai_move, 0, makron_brainsplorch}, {ai_move, 0, NULL}, {ai_move, 0, NULL} /* 95 */ }; mmove_t makron_move_death2 = { FRAME_death201, FRAME_death295, makron_frames_death2, makron_dead }; static mframe_t makron_frames_death3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t makron_move_death3 = { FRAME_death301, FRAME_death320, makron_frames_death3, NULL }; static mframe_t makron_frames_sight[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t makron_move_sight = { FRAME_active01, FRAME_active13, makron_frames_sight, makron_run }; void makronBFG(edict_t *self) { if (!self) { return; } vec3_t forward, right; vec3_t start; vec3_t dir; vec3_t vec; AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_MAKRON_BFG], forward, right, start); VectorCopy(self->enemy->s.origin, vec); vec[2] += self->enemy->viewheight; VectorSubtract(vec, start, dir); VectorNormalize(dir); gi.sound(self, CHAN_VOICE, sound_attack_bfg, 1, ATTN_NORM, 0); monster_fire_bfg(self, start, dir, 50, 300, 100, 300, MZ2_MAKRON_BFG); } static mframe_t makron_frames_attack3[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, makronBFG}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t makron_move_attack3 = { FRAME_attak301, FRAME_attak308, makron_frames_attack3, makron_run }; static mframe_t makron_frames_attack4[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, MakronHyperblaster}, /* fire */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t makron_move_attack4 = { FRAME_attak401, FRAME_attak426, makron_frames_attack4, makron_run }; static mframe_t makron_frames_attack5[] = { {ai_charge, 0, makron_prerailgun}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, MakronSaveloc}, {ai_move, 0, MakronRailgun}, /* Fire railgun */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t makron_move_attack5 = { FRAME_attak501, FRAME_attak516, makron_frames_attack5, makron_run }; void MakronSaveloc(edict_t *self) { if (!self) { return; } VectorCopy(self->enemy->s.origin, self->pos1); /* save for aiming the shot */ self->pos1[2] += self->enemy->viewheight; } void MakronRailgun(edict_t *self) { vec3_t start; vec3_t dir; vec3_t forward, right; if (!self) { return; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_MAKRON_RAILGUN_1], forward, right, start); /* calc direction to where we targted */ VectorSubtract(self->pos1, start, dir); VectorNormalize(dir); monster_fire_railgun(self, start, dir, 50, 100, MZ2_MAKRON_RAILGUN_1); } void MakronHyperblaster(edict_t *self) { vec3_t dir; vec3_t vec; vec3_t start; vec3_t forward, right; int flash_number; if (!self) { return; } flash_number = MZ2_MAKRON_BLASTER_1 + (self->s.frame - FRAME_attak405); AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], forward, right, start); if (self->enemy) { VectorCopy(self->enemy->s.origin, vec); vec[2] += self->enemy->viewheight; VectorSubtract(vec, start, vec); vectoangles(vec, vec); dir[0] = vec[0]; } else { dir[0] = 0; } if (self->s.frame <= FRAME_attak413) { dir[1] = self->s.angles[1] - 10 * (self->s.frame - FRAME_attak413); } else { dir[1] = self->s.angles[1] + 10 * (self->s.frame - FRAME_attak421); } dir[2] = 0; AngleVectors(dir, forward, NULL, NULL); monster_fire_blaster(self, start, forward, 15, 1000, MZ2_MAKRON_BLASTER_1, EF_BLASTER); } void makron_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } /* Lessen the chance of him going into his pain frames */ if (damage <= 25) { if (random() < 0.2) { return; } } self->pain_debounce_time = level.time + 3; if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } if (damage <= 40) { gi.sound(self, CHAN_VOICE, sound_pain4, 1, ATTN_NONE, 0); self->monsterinfo.currentmove = &makron_move_pain4; } else if (damage <= 110) { gi.sound(self, CHAN_VOICE, sound_pain5, 1, ATTN_NONE, 0); self->monsterinfo.currentmove = &makron_move_pain5; } else { if (damage <= 150) { if (random() <= 0.45) { gi.sound(self, CHAN_VOICE, sound_pain6, 1, ATTN_NONE, 0); self->monsterinfo.currentmove = &makron_move_pain6; } } else { if (random() <= 0.35) { gi.sound(self, CHAN_VOICE, sound_pain6, 1, ATTN_NONE, 0); self->monsterinfo.currentmove = &makron_move_pain6; } } } } void makron_sight(edict_t *self, edict_t *other /* unused */) { } void makron_attack(edict_t *self) { float r; if (!self) { return; } r = random(); if (r <= 0.3) { self->monsterinfo.currentmove = &makron_move_attack3; } else if (r <= 0.6) { self->monsterinfo.currentmove = &makron_move_attack4; } else { self->monsterinfo.currentmove = &makron_move_attack5; } } /* Makron Torso. This needs to be spawned in */ void makron_torso_think(edict_t *self) { if (!self) { return; } /* detach from the makron if the legs are gone completely */ if (self->owner && (!self->owner->inuse || (self->owner->health <= self->owner->gib_health))) { self->owner = NULL; } /* if the makron is revived the torso was put back on him */ if (self->owner && self->owner->deadflag != DEAD_DEAD) { G_FreeEdict(self); return; } if (++self->s.frame >= FRAME_death320) { self->s.frame = FRAME_death301; } self->nextthink = level.time + FRAMETIME; } static void makron_torso_origin(edict_t *self, edict_t *torso) { vec3_t v; trace_t tr; AngleVectors(self->s.angles, v, NULL, NULL); VectorMA(self->s.origin, -84.0f, v, v); tr = gi.trace(self->s.origin, torso->mins, torso->maxs, v, self, MASK_SOLID); VectorCopy (tr.endpos, torso->s.origin); } void makron_torso_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage /* unused */, vec3_t point /* unused */) { int n; if (self->health > self->gib_health) { return; } gi.sound(self, CHAN_VOICE, gi.soundindex( "misc/udeath.wav"), 1, ATTN_NORM, 0); ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_metal/tris.md2", damage, GIB_METALLIC); } G_FreeEdict(self); } void makron_torso(edict_t *self) { edict_t *torso; if (!self) { return; } torso = G_SpawnOptional(); if (!torso) { return; } VectorCopy(self->s.angles, torso->s.angles); VectorSet(torso->mins, -24, -24, 0); VectorSet(torso->maxs, 24, 24, 16); makron_torso_origin(self, torso); torso->gib_health = -800; torso->takedamage = DAMAGE_YES; torso->die = makron_torso_die; torso->deadflag = DEAD_DEAD; torso->owner = self; torso->movetype = MOVETYPE_TOSS; torso->solid = SOLID_BBOX; torso->svflags = SVF_MONSTER|SVF_DEADMONSTER; torso->clipmask = MASK_MONSTERSOLID; torso->s.frame = FRAME_death301; torso->s.modelindex = gi.modelindex("models/monsters/boss3/rider/tris.md2"); torso->think = makron_torso_think; torso->nextthink = level.time + 2 * FRAMETIME; torso->s.sound = gi.soundindex("makron/spine.wav"); gi.linkentity(torso); } /* death */ void makron_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -48, -48, 0); VectorSet(self->maxs, 48, 48, 24); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } void makron_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage /* unused */, vec3_t point /* unused */) { int n; if (!self) { return; } self->s.sound = 0; /* check for gib */ if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 1 /*4*/; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_metal/tris.md2", damage, GIB_METALLIC); } ThrowHead(self, "models/objects/gibs/gear/tris.md2", damage, GIB_METALLIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } /* regular death */ gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NONE, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; makron_torso(self); /* lower bbox since the torso is gone */ self->maxs[2] = 64; gi.linkentity (self); self->monsterinfo.currentmove = &makron_move_death2; } qboolean Makron_CheckAttack(edict_t *self) { vec3_t spot1, spot2; vec3_t temp; float chance; trace_t tr; int enemy_range; float enemy_yaw; if (!self) { return false; } if (self->enemy->health > 0) { /* see if any entities are in the way of the shot */ VectorCopy(self->s.origin, spot1); spot1[2] += self->viewheight; VectorCopy(self->enemy->s.origin, spot2); spot2[2] += self->enemy->viewheight; tr = gi.trace(spot1, NULL, NULL, spot2, self, CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_SLIME | CONTENTS_LAVA); /* do we have a clear shot? */ if (tr.ent != self->enemy) { return false; } } enemy_range = range(self, self->enemy); VectorSubtract(self->enemy->s.origin, self->s.origin, temp); enemy_yaw = vectoyaw(temp); self->ideal_yaw = enemy_yaw; /* melee attack */ if (enemy_range == RANGE_MELEE) { if (self->monsterinfo.melee) { self->monsterinfo.attack_state = AS_MELEE; } else { self->monsterinfo.attack_state = AS_MISSILE; } return true; } /* missile attack */ if (!self->monsterinfo.attack) { return false; } if (level.time < self->monsterinfo.attack_finished) { return false; } if (enemy_range == RANGE_FAR) { return false; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { chance = 0.4; } else if (enemy_range == RANGE_NEAR) { chance = 0.4; } else if (enemy_range == RANGE_MID) { chance = 0.2; } else { return false; } if (random() < chance) { self->monsterinfo.attack_state = AS_MISSILE; self->monsterinfo.attack_finished = level.time + 2 * random(); return true; } if (self->flags & FL_FLY) { if (random() < 0.3) { self->monsterinfo.attack_state = AS_SLIDING; } else { self->monsterinfo.attack_state = AS_STRAIGHT; } } return false; } /* monster_makron */ void MakronPrecache(void) { sound_pain4 = gi.soundindex("makron/pain3.wav"); sound_pain5 = gi.soundindex("makron/pain2.wav"); sound_pain6 = gi.soundindex("makron/pain1.wav"); sound_death = gi.soundindex("makron/death.wav"); sound_step_left = gi.soundindex("makron/step1.wav"); sound_step_right = gi.soundindex("makron/step2.wav"); sound_attack_bfg = gi.soundindex("makron/bfg_fire.wav"); sound_brainsplorch = gi.soundindex("makron/brain1.wav"); sound_prerailgun = gi.soundindex("makron/rail_up.wav"); sound_popup = gi.soundindex("makron/popup.wav"); sound_taunt1 = gi.soundindex("makron/voice4.wav"); sound_taunt2 = gi.soundindex("makron/voice3.wav"); sound_taunt3 = gi.soundindex("makron/voice.wav"); sound_hit = gi.soundindex("makron/bhit.wav"); gi.modelindex("models/monsters/boss3/rider/tris.md2"); } /* * QUAKED monster_makron (1 .5 0) (-30 -30 0) (30 30 90) Ambush Trigger_Spawn Sight */ void SP_monster_makron(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } MakronPrecache(); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/boss3/rider/tris.md2"); VectorSet(self->mins, -30, -30, 0); VectorSet(self->maxs, 30, 30, 90); self->health = 3000; self->gib_health = -2000; self->mass = 500; self->pain = makron_pain; self->die = makron_die; self->monsterinfo.stand = makron_stand; self->monsterinfo.walk = makron_walk; self->monsterinfo.run = makron_run; self->monsterinfo.dodge = NULL; self->monsterinfo.attack = makron_attack; self->monsterinfo.melee = NULL; self->monsterinfo.sight = makron_sight; self->monsterinfo.checkattack = Makron_CheckAttack; gi.linkentity(self); self->monsterinfo.currentmove = &makron_move_sight; self->monsterinfo.scale = MODEL_SCALE; walkmonster_start(self); } void MakronSpawn(edict_t *self) { vec3_t vec; edict_t *enemy; edict_t *oldenemy; if (!self) { return; } /* spawning can mess with enemy state so clear it temporarily */ enemy = self->enemy; self->enemy = NULL; oldenemy = self->oldenemy; self->oldenemy = NULL; SP_monster_makron(self); if (self->think) { self->think(self); } /* and re-link enemy state now that he's spawned */ if (enemy && enemy->inuse && enemy->deadflag != DEAD_DEAD) { self->enemy = enemy; } if (oldenemy && oldenemy->inuse && oldenemy->deadflag != DEAD_DEAD) { self->oldenemy = oldenemy; } if (!self->enemy) { self->enemy = self->oldenemy; self->oldenemy = NULL; } enemy = self->enemy; if (enemy) { FoundTarget(self); VectorCopy(self->pos1, self->monsterinfo.last_sighting); } if (enemy && visible(self, enemy)) { VectorSubtract(enemy->s.origin, self->s.origin, vec); self->s.angles[YAW] = vectoyaw(vec); VectorNormalize(vec); } else { AngleVectors(self->s.angles, vec, NULL, NULL); } VectorScale(vec, 400, self->velocity); /* the jump frames are fixed length so best to normalize the up speed */ self->velocity[2] = 200.0f * (sv_gravity->value / 800.0f); self->groundentity = NULL; self->s.origin[2] += 1; gi.linkentity(self); self->pain_debounce_time = level.time + 1; self->monsterinfo.currentmove = &makron_move_sight; } /* * Jorg is just about dead, so set up to launch Makron out */ void MakronToss(edict_t *self) { edict_t *ent; if (!self) { return; } ent = G_Spawn(); ent->classname = "monster_makron"; ent->nextthink = level.time + 0.8; ent->think = MakronSpawn; ent->target = self->target; VectorCopy(self->s.origin, ent->s.origin); VectorCopy(self->s.angles, ent->s.angles); VectorCopy(self->monsterinfo.last_sighting, ent->pos1); ent->enemy = self->enemy; ent->oldenemy = self->oldenemy; } xatrix-XATRIX_2_14/src/monster/boss3/boss32.h000066400000000000000000000314671477320050300207460ustar00rootroot00000000000000/* ======================================================================= * * Final boss, stage 2 (makron). * * ======================================================================= */ #define FRAME_attak101 0 #define FRAME_attak102 1 #define FRAME_attak103 2 #define FRAME_attak104 3 #define FRAME_attak105 4 #define FRAME_attak106 5 #define FRAME_attak107 6 #define FRAME_attak108 7 #define FRAME_attak109 8 #define FRAME_attak110 9 #define FRAME_attak111 10 #define FRAME_attak112 11 #define FRAME_attak113 12 #define FRAME_attak114 13 #define FRAME_attak115 14 #define FRAME_attak116 15 #define FRAME_attak117 16 #define FRAME_attak118 17 #define FRAME_attak201 18 #define FRAME_attak202 19 #define FRAME_attak203 20 #define FRAME_attak204 21 #define FRAME_attak205 22 #define FRAME_attak206 23 #define FRAME_attak207 24 #define FRAME_attak208 25 #define FRAME_attak209 26 #define FRAME_attak210 27 #define FRAME_attak211 28 #define FRAME_attak212 29 #define FRAME_attak213 30 #define FRAME_death01 31 #define FRAME_death02 32 #define FRAME_death03 33 #define FRAME_death04 34 #define FRAME_death05 35 #define FRAME_death06 36 #define FRAME_death07 37 #define FRAME_death08 38 #define FRAME_death09 39 #define FRAME_death10 40 #define FRAME_death11 41 #define FRAME_death12 42 #define FRAME_death13 43 #define FRAME_death14 44 #define FRAME_death15 45 #define FRAME_death16 46 #define FRAME_death17 47 #define FRAME_death18 48 #define FRAME_death19 49 #define FRAME_death20 50 #define FRAME_death21 51 #define FRAME_death22 52 #define FRAME_death23 53 #define FRAME_death24 54 #define FRAME_death25 55 #define FRAME_death26 56 #define FRAME_death27 57 #define FRAME_death28 58 #define FRAME_death29 59 #define FRAME_death30 60 #define FRAME_death31 61 #define FRAME_death32 62 #define FRAME_death33 63 #define FRAME_death34 64 #define FRAME_death35 65 #define FRAME_death36 66 #define FRAME_death37 67 #define FRAME_death38 68 #define FRAME_death39 69 #define FRAME_death40 70 #define FRAME_death41 71 #define FRAME_death42 72 #define FRAME_death43 73 #define FRAME_death44 74 #define FRAME_death45 75 #define FRAME_death46 76 #define FRAME_death47 77 #define FRAME_death48 78 #define FRAME_death49 79 #define FRAME_death50 80 #define FRAME_pain101 81 #define FRAME_pain102 82 #define FRAME_pain103 83 #define FRAME_pain201 84 #define FRAME_pain202 85 #define FRAME_pain203 86 #define FRAME_pain301 87 #define FRAME_pain302 88 #define FRAME_pain303 89 #define FRAME_pain304 90 #define FRAME_pain305 91 #define FRAME_pain306 92 #define FRAME_pain307 93 #define FRAME_pain308 94 #define FRAME_pain309 95 #define FRAME_pain310 96 #define FRAME_pain311 97 #define FRAME_pain312 98 #define FRAME_pain313 99 #define FRAME_pain314 100 #define FRAME_pain315 101 #define FRAME_pain316 102 #define FRAME_pain317 103 #define FRAME_pain318 104 #define FRAME_pain319 105 #define FRAME_pain320 106 #define FRAME_pain321 107 #define FRAME_pain322 108 #define FRAME_pain323 109 #define FRAME_pain324 110 #define FRAME_pain325 111 #define FRAME_stand01 112 #define FRAME_stand02 113 #define FRAME_stand03 114 #define FRAME_stand04 115 #define FRAME_stand05 116 #define FRAME_stand06 117 #define FRAME_stand07 118 #define FRAME_stand08 119 #define FRAME_stand09 120 #define FRAME_stand10 121 #define FRAME_stand11 122 #define FRAME_stand12 123 #define FRAME_stand13 124 #define FRAME_stand14 125 #define FRAME_stand15 126 #define FRAME_stand16 127 #define FRAME_stand17 128 #define FRAME_stand18 129 #define FRAME_stand19 130 #define FRAME_stand20 131 #define FRAME_stand21 132 #define FRAME_stand22 133 #define FRAME_stand23 134 #define FRAME_stand24 135 #define FRAME_stand25 136 #define FRAME_stand26 137 #define FRAME_stand27 138 #define FRAME_stand28 139 #define FRAME_stand29 140 #define FRAME_stand30 141 #define FRAME_stand31 142 #define FRAME_stand32 143 #define FRAME_stand33 144 #define FRAME_stand34 145 #define FRAME_stand35 146 #define FRAME_stand36 147 #define FRAME_stand37 148 #define FRAME_stand38 149 #define FRAME_stand39 150 #define FRAME_stand40 151 #define FRAME_stand41 152 #define FRAME_stand42 153 #define FRAME_stand43 154 #define FRAME_stand44 155 #define FRAME_stand45 156 #define FRAME_stand46 157 #define FRAME_stand47 158 #define FRAME_stand48 159 #define FRAME_stand49 160 #define FRAME_stand50 161 #define FRAME_stand51 162 #define FRAME_walk01 163 #define FRAME_walk02 164 #define FRAME_walk03 165 #define FRAME_walk04 166 #define FRAME_walk05 167 #define FRAME_walk06 168 #define FRAME_walk07 169 #define FRAME_walk08 170 #define FRAME_walk09 171 #define FRAME_walk10 172 #define FRAME_walk11 173 #define FRAME_walk12 174 #define FRAME_walk13 175 #define FRAME_walk14 176 #define FRAME_walk15 177 #define FRAME_walk16 178 #define FRAME_walk17 179 #define FRAME_walk18 180 #define FRAME_walk19 181 #define FRAME_walk20 182 #define FRAME_walk21 183 #define FRAME_walk22 184 #define FRAME_walk23 185 #define FRAME_walk24 186 #define FRAME_walk25 187 #define FRAME_active01 188 #define FRAME_active02 189 #define FRAME_active03 190 #define FRAME_active04 191 #define FRAME_active05 192 #define FRAME_active06 193 #define FRAME_active07 194 #define FRAME_active08 195 #define FRAME_active09 196 #define FRAME_active10 197 #define FRAME_active11 198 #define FRAME_active12 199 #define FRAME_active13 200 #define FRAME_attak301 201 #define FRAME_attak302 202 #define FRAME_attak303 203 #define FRAME_attak304 204 #define FRAME_attak305 205 #define FRAME_attak306 206 #define FRAME_attak307 207 #define FRAME_attak308 208 #define FRAME_attak401 209 #define FRAME_attak402 210 #define FRAME_attak403 211 #define FRAME_attak404 212 #define FRAME_attak405 213 #define FRAME_attak406 214 #define FRAME_attak407 215 #define FRAME_attak408 216 #define FRAME_attak409 217 #define FRAME_attak410 218 #define FRAME_attak411 219 #define FRAME_attak412 220 #define FRAME_attak413 221 #define FRAME_attak414 222 #define FRAME_attak415 223 #define FRAME_attak416 224 #define FRAME_attak417 225 #define FRAME_attak418 226 #define FRAME_attak419 227 #define FRAME_attak420 228 #define FRAME_attak421 229 #define FRAME_attak422 230 #define FRAME_attak423 231 #define FRAME_attak424 232 #define FRAME_attak425 233 #define FRAME_attak426 234 #define FRAME_attak501 235 #define FRAME_attak502 236 #define FRAME_attak503 237 #define FRAME_attak504 238 #define FRAME_attak505 239 #define FRAME_attak506 240 #define FRAME_attak507 241 #define FRAME_attak508 242 #define FRAME_attak509 243 #define FRAME_attak510 244 #define FRAME_attak511 245 #define FRAME_attak512 246 #define FRAME_attak513 247 #define FRAME_attak514 248 #define FRAME_attak515 249 #define FRAME_attak516 250 #define FRAME_death201 251 #define FRAME_death202 252 #define FRAME_death203 253 #define FRAME_death204 254 #define FRAME_death205 255 #define FRAME_death206 256 #define FRAME_death207 257 #define FRAME_death208 258 #define FRAME_death209 259 #define FRAME_death210 260 #define FRAME_death211 261 #define FRAME_death212 262 #define FRAME_death213 263 #define FRAME_death214 264 #define FRAME_death215 265 #define FRAME_death216 266 #define FRAME_death217 267 #define FRAME_death218 268 #define FRAME_death219 269 #define FRAME_death220 270 #define FRAME_death221 271 #define FRAME_death222 272 #define FRAME_death223 273 #define FRAME_death224 274 #define FRAME_death225 275 #define FRAME_death226 276 #define FRAME_death227 277 #define FRAME_death228 278 #define FRAME_death229 279 #define FRAME_death230 280 #define FRAME_death231 281 #define FRAME_death232 282 #define FRAME_death233 283 #define FRAME_death234 284 #define FRAME_death235 285 #define FRAME_death236 286 #define FRAME_death237 287 #define FRAME_death238 288 #define FRAME_death239 289 #define FRAME_death240 290 #define FRAME_death241 291 #define FRAME_death242 292 #define FRAME_death243 293 #define FRAME_death244 294 #define FRAME_death245 295 #define FRAME_death246 296 #define FRAME_death247 297 #define FRAME_death248 298 #define FRAME_death249 299 #define FRAME_death250 300 #define FRAME_death251 301 #define FRAME_death252 302 #define FRAME_death253 303 #define FRAME_death254 304 #define FRAME_death255 305 #define FRAME_death256 306 #define FRAME_death257 307 #define FRAME_death258 308 #define FRAME_death259 309 #define FRAME_death260 310 #define FRAME_death261 311 #define FRAME_death262 312 #define FRAME_death263 313 #define FRAME_death264 314 #define FRAME_death265 315 #define FRAME_death266 316 #define FRAME_death267 317 #define FRAME_death268 318 #define FRAME_death269 319 #define FRAME_death270 320 #define FRAME_death271 321 #define FRAME_death272 322 #define FRAME_death273 323 #define FRAME_death274 324 #define FRAME_death275 325 #define FRAME_death276 326 #define FRAME_death277 327 #define FRAME_death278 328 #define FRAME_death279 329 #define FRAME_death280 330 #define FRAME_death281 331 #define FRAME_death282 332 #define FRAME_death283 333 #define FRAME_death284 334 #define FRAME_death285 335 #define FRAME_death286 336 #define FRAME_death287 337 #define FRAME_death288 338 #define FRAME_death289 339 #define FRAME_death290 340 #define FRAME_death291 341 #define FRAME_death292 342 #define FRAME_death293 343 #define FRAME_death294 344 #define FRAME_death295 345 #define FRAME_death301 346 #define FRAME_death302 347 #define FRAME_death303 348 #define FRAME_death304 349 #define FRAME_death305 350 #define FRAME_death306 351 #define FRAME_death307 352 #define FRAME_death308 353 #define FRAME_death309 354 #define FRAME_death310 355 #define FRAME_death311 356 #define FRAME_death312 357 #define FRAME_death313 358 #define FRAME_death314 359 #define FRAME_death315 360 #define FRAME_death316 361 #define FRAME_death317 362 #define FRAME_death318 363 #define FRAME_death319 364 #define FRAME_death320 365 #define FRAME_jump01 366 #define FRAME_jump02 367 #define FRAME_jump03 368 #define FRAME_jump04 369 #define FRAME_jump05 370 #define FRAME_jump06 371 #define FRAME_jump07 372 #define FRAME_jump08 373 #define FRAME_jump09 374 #define FRAME_jump10 375 #define FRAME_jump11 376 #define FRAME_jump12 377 #define FRAME_jump13 378 #define FRAME_pain401 379 #define FRAME_pain402 380 #define FRAME_pain403 381 #define FRAME_pain404 382 #define FRAME_pain501 383 #define FRAME_pain502 384 #define FRAME_pain503 385 #define FRAME_pain504 386 #define FRAME_pain601 387 #define FRAME_pain602 388 #define FRAME_pain603 389 #define FRAME_pain604 390 #define FRAME_pain605 391 #define FRAME_pain606 392 #define FRAME_pain607 393 #define FRAME_pain608 394 #define FRAME_pain609 395 #define FRAME_pain610 396 #define FRAME_pain611 397 #define FRAME_pain612 398 #define FRAME_pain613 399 #define FRAME_pain614 400 #define FRAME_pain615 401 #define FRAME_pain616 402 #define FRAME_pain617 403 #define FRAME_pain618 404 #define FRAME_pain619 405 #define FRAME_pain620 406 #define FRAME_pain621 407 #define FRAME_pain622 408 #define FRAME_pain623 409 #define FRAME_pain624 410 #define FRAME_pain625 411 #define FRAME_pain626 412 #define FRAME_pain627 413 #define FRAME_stand201 414 #define FRAME_stand202 415 #define FRAME_stand203 416 #define FRAME_stand204 417 #define FRAME_stand205 418 #define FRAME_stand206 419 #define FRAME_stand207 420 #define FRAME_stand208 421 #define FRAME_stand209 422 #define FRAME_stand210 423 #define FRAME_stand211 424 #define FRAME_stand212 425 #define FRAME_stand213 426 #define FRAME_stand214 427 #define FRAME_stand215 428 #define FRAME_stand216 429 #define FRAME_stand217 430 #define FRAME_stand218 431 #define FRAME_stand219 432 #define FRAME_stand220 433 #define FRAME_stand221 434 #define FRAME_stand222 435 #define FRAME_stand223 436 #define FRAME_stand224 437 #define FRAME_stand225 438 #define FRAME_stand226 439 #define FRAME_stand227 440 #define FRAME_stand228 441 #define FRAME_stand229 442 #define FRAME_stand230 443 #define FRAME_stand231 444 #define FRAME_stand232 445 #define FRAME_stand233 446 #define FRAME_stand234 447 #define FRAME_stand235 448 #define FRAME_stand236 449 #define FRAME_stand237 450 #define FRAME_stand238 451 #define FRAME_stand239 452 #define FRAME_stand240 453 #define FRAME_stand241 454 #define FRAME_stand242 455 #define FRAME_stand243 456 #define FRAME_stand244 457 #define FRAME_stand245 458 #define FRAME_stand246 459 #define FRAME_stand247 460 #define FRAME_stand248 461 #define FRAME_stand249 462 #define FRAME_stand250 463 #define FRAME_stand251 464 #define FRAME_stand252 465 #define FRAME_stand253 466 #define FRAME_stand254 467 #define FRAME_stand255 468 #define FRAME_stand256 469 #define FRAME_stand257 470 #define FRAME_stand258 471 #define FRAME_stand259 472 #define FRAME_stand260 473 #define FRAME_walk201 474 #define FRAME_walk202 475 #define FRAME_walk203 476 #define FRAME_walk204 477 #define FRAME_walk205 478 #define FRAME_walk206 479 #define FRAME_walk207 480 #define FRAME_walk208 481 #define FRAME_walk209 482 #define FRAME_walk210 483 #define FRAME_walk211 484 #define FRAME_walk212 485 #define FRAME_walk213 486 #define FRAME_walk214 487 #define FRAME_walk215 488 #define FRAME_walk216 489 #define FRAME_walk217 490 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/boss5/000077500000000000000000000000001477320050300174515ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/boss5/boss5.c000066400000000000000000000403061477320050300206530ustar00rootroot00000000000000/* ======================================================================= * * boss 5, only found in xatrix * * ======================================================================= */ #include "../../header/local.h" #include "../supertank/supertank.h" static int sound_pain1; static int sound_pain2; static int sound_pain3; static int sound_death; static int sound_search1; static int sound_search2; static int tread_sound; qboolean visible(edict_t *self, edict_t *other); void BossExplode2(edict_t *self); void boss5_dead(edict_t *self); void boss5Rocket(edict_t *self); void boss5MachineGun(edict_t *self); void boss5_reattack1(edict_t *self); void TreadSound2(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, tread_sound, 1, ATTN_NORM, 0); } void boss5_search(edict_t *self) { if (!self) { return; } if (random() < 0.5) { gi.sound(self, CHAN_VOICE, sound_search1, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_search2, 1, ATTN_NORM, 0); } } /* stand */ static mframe_t boss5_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t boss5_move_stand = { FRAME_stand_1, FRAME_stand_60, boss5_frames_stand, NULL }; void boss5_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &boss5_move_stand; } static mframe_t boss5_frames_run[] = { {ai_run, 12, TreadSound2}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL} }; mmove_t boss5_move_run = { FRAME_forwrd_1, FRAME_forwrd_18, boss5_frames_run, NULL }; /* walk */ static mframe_t boss5_frames_forward[] = { {ai_walk, 4, TreadSound2}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL} }; mmove_t boss5_move_forward = { FRAME_forwrd_1, FRAME_forwrd_18, boss5_frames_forward, NULL }; void boss5_forward(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &boss5_move_forward; } void boss5_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &boss5_move_forward; } void boss5_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &boss5_move_stand; } else { self->monsterinfo.currentmove = &boss5_move_run; } } static mframe_t boss5_frames_turn_right[] = { {ai_move, 0, TreadSound2}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t boss5_move_turn_right = { FRAME_right_1, FRAME_right_18, boss5_frames_turn_right, boss5_run }; static mframe_t boss5_frames_turn_left[] = { {ai_move, 0, TreadSound2}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t boss5_move_turn_left = { FRAME_left_1, FRAME_left_18, boss5_frames_turn_left, boss5_run }; static mframe_t boss5_frames_pain3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t boss5_move_pain3 = { FRAME_pain3_9, FRAME_pain3_12, boss5_frames_pain3, boss5_run }; static mframe_t boss5_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t boss5_move_pain2 = { FRAME_pain2_5, FRAME_pain2_8, boss5_frames_pain2, boss5_run }; static mframe_t boss5_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t boss5_move_pain1 = { FRAME_pain1_1, FRAME_pain1_4, boss5_frames_pain1, boss5_run }; static mframe_t boss5_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, BossExplode2} }; mmove_t boss5_move_death = { FRAME_death_1, FRAME_death_24, boss5_frames_death1, boss5_dead }; static mframe_t boss5_frames_backward[] = { {ai_walk, 0, TreadSound2}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL} }; mmove_t boss5_move_backward = { FRAME_backwd_1, FRAME_backwd_18, boss5_frames_backward, NULL }; static mframe_t boss5_frames_attack4[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t boss5_move_attack4 = { FRAME_attak4_1, FRAME_attak4_6, boss5_frames_attack4, boss5_run }; static mframe_t boss5_frames_attack3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t boss5_move_attack3 = { FRAME_attak3_1, FRAME_attak3_27, boss5_frames_attack3, boss5_run }; static mframe_t boss5_frames_attack2[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, boss5Rocket}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, boss5Rocket}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, boss5Rocket}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t boss5_move_attack2 = { FRAME_attak2_1, FRAME_attak2_27, boss5_frames_attack2, boss5_run }; static mframe_t boss5_frames_attack1[] = { {ai_charge, 0, boss5MachineGun}, {ai_charge, 0, boss5MachineGun}, {ai_charge, 0, boss5MachineGun}, {ai_charge, 0, boss5MachineGun}, {ai_charge, 0, boss5MachineGun}, {ai_charge, 0, boss5MachineGun}, }; mmove_t boss5_move_attack1 = { FRAME_attak1_1, FRAME_attak1_6, boss5_frames_attack1, boss5_reattack1 }; static mframe_t boss5_frames_end_attack1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t boss5_move_end_attack1 = { FRAME_attak1_7, FRAME_attak1_20, boss5_frames_end_attack1, boss5_run }; void boss5_reattack1(edict_t *self) { if (!self) { return; } if (visible(self, self->enemy)) { if (random() < 0.9) { self->monsterinfo.currentmove = &boss5_move_attack1; } else { self->monsterinfo.currentmove = &boss5_move_end_attack1; } } else { self->monsterinfo.currentmove = &boss5_move_end_attack1; } } void boss5_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } /* Lessen the chance of him going into his pain frames */ if (damage <= 25) { if (random() < 0.2) { return; } } /* Don't go into pain if he's firing his rockets */ if (skill->value >= SKILL_HARD) { if ((self->s.frame >= FRAME_attak2_1) && (self->s.frame <= FRAME_attak2_14)) { return; } } self->pain_debounce_time = level.time + 3; if (damage <= 10) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &boss5_move_pain1; } else if (damage <= 25) { gi.sound(self, CHAN_VOICE, sound_pain3, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &boss5_move_pain2; } else { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &boss5_move_pain3; } } void boss5Rocket(edict_t *self) { vec3_t forward, right; vec3_t start; vec3_t dir; vec3_t vec; int flash_number; if (!self) { return; } if (self->s.frame == FRAME_attak2_8) { flash_number = MZ2_SUPERTANK_ROCKET_1; } else if (self->s.frame == FRAME_attak2_11) { flash_number = MZ2_SUPERTANK_ROCKET_2; } else { flash_number = MZ2_SUPERTANK_ROCKET_3; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], forward, right, start); VectorCopy(self->enemy->s.origin, vec); vec[2] += self->enemy->viewheight; VectorSubtract(vec, start, dir); VectorNormalize(dir); monster_fire_rocket(self, start, dir, 50, 500, flash_number); } void boss5MachineGun(edict_t *self) { vec3_t dir; vec3_t vec; vec3_t start; vec3_t forward, right; int flash_number; if (!self) { return; } flash_number = MZ2_SUPERTANK_MACHINEGUN_1 + (self->s.frame - FRAME_attak1_1); dir[0] = 0; dir[1] = self->s.angles[1]; dir[2] = 0; AngleVectors(dir, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], forward, right, start); if (self->enemy) { VectorCopy(self->enemy->s.origin, vec); VectorMA(vec, 0, self->enemy->velocity, vec); vec[2] += self->enemy->viewheight; VectorSubtract(vec, start, forward); VectorNormalize(forward); } monster_fire_bullet(self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_number); } void boss5_attack(edict_t *self) { vec3_t vec; float range; if (!self) { return; } VectorSubtract(self->enemy->s.origin, self->s.origin, vec); range = VectorLength(vec); if (range <= 160) { self->monsterinfo.currentmove = &boss5_move_attack1; } else { /* fire rockets more often at distance */ if (random() < 0.3) { self->monsterinfo.currentmove = &boss5_move_attack1; } else { self->monsterinfo.currentmove = &boss5_move_attack2; } } } /* death */ void boss5_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -60, -60, 0); VectorSet(self->maxs, 60, 60, 72); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } void BossExplode2(edict_t *self) { vec3_t org; int n; if (!self) { return; } self->think = BossExplode2; VectorCopy(self->s.origin, org); org[2] += 24 + (rand() & 15); switch (self->count++) { case 0: org[0] -= 24; org[1] -= 24; break; case 1: org[0] += 24; org[1] += 24; break; case 2: org[0] += 24; org[1] -= 24; break; case 3: org[0] -= 24; org[1] += 24; break; case 4: org[0] -= 48; org[1] -= 48; break; case 5: org[0] += 48; org[1] += 48; break; case 6: org[0] -= 48; org[1] += 48; break; case 7: org[0] += 48; org[1] -= 48; break; case 8: self->s.sound = 0; for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", 500, GIB_ORGANIC); } for (n = 0; n < 8; n++) { ThrowGib(self, "models/objects/gibs/sm_metal/tris.md2", 500, GIB_METALLIC); } ThrowGib(self, "models/objects/gibs/chest/tris.md2", 500, GIB_ORGANIC); ThrowHead(self, "models/objects/gibs/gear/tris.md2", 500, GIB_METALLIC); self->deadflag = DEAD_DEAD; return; } gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_EXPLOSION1); gi.WritePosition(org); gi.multicast(self->s.origin, MULTICAST_PVS); self->nextthink = level.time + 0.1; } void boss5_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage /* unused */, vec3_t point /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_NO; self->count = 0; self->monsterinfo.currentmove = &boss5_move_death; } /* * QUAKED monster_boss5 (1 .5 0) (-64 -64 0) (64 64 72) Ambush Trigger_Spawn Sight */ void SP_monster_boss5(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } sound_pain1 = gi.soundindex("bosstank/btkpain1.wav"); sound_pain2 = gi.soundindex("bosstank/btkpain2.wav"); sound_pain3 = gi.soundindex("bosstank/btkpain3.wav"); sound_death = gi.soundindex("bosstank/btkdeth1.wav"); sound_search1 = gi.soundindex("bosstank/btkunqv1.wav"); sound_search2 = gi.soundindex("bosstank/btkunqv2.wav"); tread_sound = gi.soundindex("bosstank/btkengn1.wav"); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/boss5/tris.md2"); VectorSet(self->mins, -64, -64, 0); VectorSet(self->maxs, 64, 64, 112); self->health = 1500; self->gib_health = -500; self->mass = 800; self->pain = boss5_pain; self->die = boss5_die; self->monsterinfo.stand = boss5_stand; self->monsterinfo.walk = boss5_walk; self->monsterinfo.run = boss5_run; self->monsterinfo.dodge = NULL; self->monsterinfo.attack = boss5_attack; self->monsterinfo.search = boss5_search; self->monsterinfo.melee = NULL; self->monsterinfo.sight = NULL; gi.linkentity(self); self->monsterinfo.currentmove = &boss5_move_stand; self->monsterinfo.scale = MODEL_SCALE; self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = 400; walkmonster_start(self); } xatrix-XATRIX_2_14/src/monster/brain/000077500000000000000000000000001477320050300175115ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/brain/brain.c000066400000000000000000000536441477320050300207640ustar00rootroot00000000000000/* * Copyright (C) 1997-2001 Id Software, Inc. * * 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. * * ======================================================================= * * Brain. * * ======================================================================= */ #include "../../header/local.h" #include "brain.h" static int sound_chest_open; static int sound_tentacles_extend; static int sound_tentacles_retract; static int sound_death; static int sound_idle1; static int sound_idle2; static int sound_idle3; static int sound_pain1; static int sound_pain2; static int sound_sight; static int sound_search; static int sound_melee1; static int sound_melee2; static int sound_melee3; static int sound_step; static int sound_step2; void brain_run(edict_t *self); void brain_dead(edict_t *self); void brain_footstep(edict_t *self) { if (!g_monsterfootsteps->value) return; // Lazy loading for savegame compatibility. if (sound_step == 0 || sound_step2 == 0) { sound_step = gi.soundindex("brain/step1.wav"); sound_step2 = gi.soundindex("brain/step2.wav"); } if (randk() % 2 == 0) { gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); } } void brain_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); } void brain_search(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_search, 1, ATTN_NORM, 0); } /* STAND */ static mframe_t brain_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t brain_move_stand = { FRAME_stand01, FRAME_stand30, brain_frames_stand, NULL }; void brain_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &brain_move_stand; } /* IDLE */ static mframe_t brain_frames_idle[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t brain_move_idle = { FRAME_stand31, FRAME_stand60, brain_frames_idle, brain_stand }; void brain_idle(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_AUTO, sound_idle3, 1, ATTN_IDLE, 0); self->monsterinfo.currentmove = &brain_move_idle; } /* WALK */ static mframe_t brain_frames_walk1[] = { {ai_walk, 7, NULL}, {ai_walk, 2, NULL}, {ai_walk, 3, NULL}, {ai_walk, 3, brain_footstep}, {ai_walk, 1, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 9, NULL}, {ai_walk, -4, NULL}, {ai_walk, -1, brain_footstep}, {ai_walk, 2, NULL} }; mmove_t brain_move_walk1 = { FRAME_walk101, FRAME_walk111, brain_frames_walk1, NULL }; void brain_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &brain_move_walk1; } static mframe_t brain_frames_defense[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t brain_move_defense = { FRAME_defens01, FRAME_defens08, brain_frames_defense, NULL }; static mframe_t brain_frames_pain3[] = { {ai_move, -2, NULL}, {ai_move, 2, NULL}, {ai_move, 1, NULL}, {ai_move, 3, NULL}, {ai_move, 0, NULL}, {ai_move, -4, NULL} }; mmove_t brain_move_pain3 = { FRAME_pain301, FRAME_pain306, brain_frames_pain3, brain_run }; static mframe_t brain_frames_pain2[] = { {ai_move, -2, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 3, NULL}, {ai_move, 1, NULL}, {ai_move, -2, NULL} }; mmove_t brain_move_pain2 = { FRAME_pain201, FRAME_pain208, brain_frames_pain2, brain_run }; static mframe_t brain_frames_pain1[] = { {ai_move, -6, NULL}, {ai_move, -2, NULL}, {ai_move, -6, brain_footstep}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 2, NULL}, {ai_move, 0, NULL}, {ai_move, 2, NULL}, {ai_move, 1, NULL}, {ai_move, 7, NULL}, {ai_move, 0, NULL}, {ai_move, 3, brain_footstep}, {ai_move, -1, NULL} }; mmove_t brain_move_pain1 = { FRAME_pain101, FRAME_pain121, brain_frames_pain1, brain_run }; /* DUCK */ void brain_duck_down(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_DUCKED) { return; } self->monsterinfo.aiflags |= AI_DUCKED; self->maxs[2] -= 32; self->takedamage = DAMAGE_YES; gi.linkentity(self); } void brain_duck_hold(edict_t *self) { if (!self) { return; } if (level.time >= self->monsterinfo.pausetime) { self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; } else { self->monsterinfo.aiflags |= AI_HOLD_FRAME; } } void brain_duck_up(edict_t *self) { if (!self) { return; } self->monsterinfo.aiflags &= ~AI_DUCKED; self->maxs[2] += 32; self->takedamage = DAMAGE_AIM; gi.linkentity(self); } static mframe_t brain_frames_duck[] = { {ai_move, 0, NULL}, {ai_move, -2, brain_duck_down}, {ai_move, 17, brain_duck_hold}, {ai_move, -3, brain_footstep}, {ai_move, -1, brain_duck_up}, {ai_move, -5, NULL}, {ai_move, -6, NULL}, {ai_move, -6, brain_footstep} }; mmove_t brain_move_duck = { FRAME_duck01, FRAME_duck08, brain_frames_duck, brain_run }; void brain_dodge(edict_t *self, edict_t *attacker, float eta) { if (!self || !attacker) { return; } if (random() > 0.25) { return; } if (!self->enemy) { self->enemy = attacker; FoundTarget(self); } self->monsterinfo.pausetime = level.time + eta + 0.5; self->monsterinfo.currentmove = &brain_move_duck; } static mframe_t brain_frames_death2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 9, NULL}, {ai_move, 0, NULL} }; mmove_t brain_move_death2 = { FRAME_death201, FRAME_death205, brain_frames_death2, brain_dead }; static mframe_t brain_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -2, NULL}, {ai_move, 9, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t brain_move_death1 = { FRAME_death101, FRAME_death118, brain_frames_death1, brain_dead }; /* MELEE */ void brain_swing_right(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_BODY, sound_melee1, 1, ATTN_NORM, 0); } void brain_hit_right(edict_t *self) { vec3_t aim; if (!self) { return; } VectorSet(aim, MELEE_DISTANCE, self->maxs[0], 8); if (fire_hit(self, aim, (15 + (rand() % 5)), 40)) { gi.sound(self, CHAN_WEAPON, sound_melee3, 1, ATTN_NORM, 0); } } void brain_swing_left(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_BODY, sound_melee2, 1, ATTN_NORM, 0); } void brain_hit_left(edict_t *self) { vec3_t aim; if (!self) { return; } VectorSet(aim, MELEE_DISTANCE, self->mins[0], 8); if (fire_hit(self, aim, (15 + (rand() % 5)), 40)) { gi.sound(self, CHAN_WEAPON, sound_melee3, 1, ATTN_NORM, 0); } } static mframe_t brain_frames_attack1[] = { {ai_charge, 8, NULL}, {ai_charge, 3, NULL}, {ai_charge, 5, NULL}, {ai_charge, 0, brain_footstep}, {ai_charge, -3, brain_swing_right}, {ai_charge, 0, NULL}, {ai_charge, -5, NULL}, {ai_charge, -7, brain_hit_right}, {ai_charge, 0, NULL}, {ai_charge, 6, brain_swing_left}, {ai_charge, 1, NULL}, {ai_charge, 2, brain_hit_left}, {ai_charge, -3, NULL}, {ai_charge, 6, NULL}, {ai_charge, -1, NULL}, {ai_charge, -3, NULL}, {ai_charge, 2, NULL}, {ai_charge, -11, brain_footstep} }; mmove_t brain_move_attack1 = { FRAME_attak101, FRAME_attak118, brain_frames_attack1, brain_run }; void brain_chest_open(edict_t *self) { if (!self) { return; } self->spawnflags &= ~65536; self->monsterinfo.power_armor_type = POWER_ARMOR_NONE; gi.sound(self, CHAN_BODY, sound_chest_open, 1, ATTN_NORM, 0); } void brain_tentacle_attack(edict_t *self) { vec3_t aim; if (!self) { return; } VectorSet(aim, MELEE_DISTANCE, 0, 8); if (fire_hit(self, aim, (10 + (rand() % 5)), -600) && (skill->value > SKILL_EASY)) { self->spawnflags |= 65536; } gi.sound(self, CHAN_WEAPON, sound_tentacles_retract, 1, ATTN_NORM, 0); } void brain_chest_closed(edict_t *self) { if (!self) { return; } self->monsterinfo.power_armor_type = POWER_ARMOR_SCREEN; if (self->spawnflags & 65536) { self->spawnflags &= ~65536; self->monsterinfo.currentmove = &brain_move_attack1; } } static mframe_t brain_frames_attack2[] = { {ai_charge, 5, NULL}, {ai_charge, -4, NULL}, {ai_charge, -4, NULL}, {ai_charge, -3, NULL}, {ai_charge, 0, brain_chest_open}, {ai_charge, 0, NULL}, {ai_charge, 13, brain_tentacle_attack}, {ai_charge, 0, NULL}, {ai_charge, 2, NULL}, {ai_charge, 0, NULL}, {ai_charge, -9, brain_chest_closed}, {ai_charge, 0, NULL}, {ai_charge, 4, NULL}, {ai_charge, 3, NULL}, {ai_charge, 2, NULL}, {ai_charge, -3, NULL}, {ai_charge, -6, NULL} }; mmove_t brain_move_attack2 = { FRAME_attak201, FRAME_attak217, brain_frames_attack2, brain_run }; void brain_melee(edict_t *self) { if (!self) { return; } if (random() <= 0.5) { self->monsterinfo.currentmove = &brain_move_attack1; } else { self->monsterinfo.currentmove = &brain_move_attack2; } } qboolean brain_tounge_attack_ok(vec3_t start, vec3_t end) { vec3_t dir, angles; /* check for max distance */ VectorSubtract(start, end, dir); if (VectorLength(dir) > 512) { return false; } /* check for min/max pitch */ vectoangles(dir, angles); if (angles[0] < -180) { angles[0] += 360; } if (fabs(angles[0]) > 30) { return false; } return true; } void brain_tounge_attack(edict_t *self) { vec3_t offset, start, f, r, end, dir; trace_t tr; int damage; if (!self) { return; } AngleVectors(self->s.angles, f, r, NULL); VectorSet(offset, 24, 0, 16); G_ProjectSource(self->s.origin, offset, f, r, start); VectorCopy(self->enemy->s.origin, end); if (!brain_tounge_attack_ok(start, end)) { end[2] = self->enemy->s.origin[2] + self->enemy->maxs[2] - 8; if (!brain_tounge_attack_ok(start, end)) { end[2] = self->enemy->s.origin[2] + self->enemy->mins[2] + 8; if (!brain_tounge_attack_ok(start, end)) { return; } } } VectorCopy(self->enemy->s.origin, end); tr = gi.trace(start, NULL, NULL, end, self, MASK_SHOT); if (tr.ent != self->enemy) { return; } damage = 5; gi.sound(self, CHAN_WEAPON, sound_tentacles_retract, 1, ATTN_NORM, 0); gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_PARASITE_ATTACK); gi.WriteShort(self - g_edicts); gi.WritePosition(start); gi.WritePosition(end); gi.multicast(self->s.origin, MULTICAST_PVS); VectorSubtract(start, end, dir); T_Damage(self->enemy, self, self, dir, self->enemy->s.origin, vec3_origin, damage, 0, DAMAGE_NO_KNOCKBACK, MOD_BRAINTENTACLE); /* pull the enemy in */ vec3_t forward; self->s.origin[2] += 1; AngleVectors(self->s.angles, forward, NULL, NULL); VectorScale(forward, -1200, self->enemy->velocity); } /* Brian right eye center */ struct r_eyeball { float x; float y; float z; } brain_reye[11] = { {0.746700, 0.238370, 34.167690}, {-1.076390, 0.238370, 33.386372}, {-1.335500, 5.334300, 32.177170}, {-0.175360, 8.846370, 30.635479}, {-2.757590, 7.804610, 30.150860}, {-5.575090, 5.152840, 30.056160}, {-7.017550, 3.262470, 30.552521}, {-7.915740, 0.638800, 33.176189}, {-3.915390, 8.285730, 33.976349}, {-0.913540, 10.933030, 34.141811}, {-0.369900, 8.923900, 34.189079} }; /* Brain left eye center */ struct l_eyeball { float x; float y; float z; } brain_leye[11] = { {-3.364710, 0.327750, 33.938381}, {-5.140450, 0.493480, 32.659851}, {-5.341980, 5.646980, 31.277901}, {-4.134480, 9.277440, 29.925621}, {-6.598340, 6.815090, 29.322620}, {-8.610840, 2.529650, 29.251591}, {-9.231360, 0.093280, 29.747959}, {-11.004110, 1.936930, 32.395260}, {-7.878310, 7.648190, 33.148151}, {-4.947370, 11.430050, 33.313610}, {-4.332820, 9.444570, 33.526340} }; void brain_laserbeam(edict_t *self) { vec3_t forward, right, up; vec3_t tempang, start; vec3_t dir, angles, end; edict_t *ent; if (!self) { return; } if (random() > 0.8) { gi.sound(self, CHAN_AUTO, gi.soundindex("misc/lasfly.wav"), 1, ATTN_STATIC, 0); } /* check for max distance */ VectorCopy(self->s.origin, start); VectorCopy(self->enemy->s.origin, end); VectorSubtract(end, start, dir); vectoangles(dir, angles); /* dis is my right eye */ ent = G_Spawn(); VectorCopy(self->s.origin, ent->s.origin); VectorCopy(angles, tempang); AngleVectors(tempang, forward, right, up); VectorCopy(tempang, ent->s.angles); VectorCopy(ent->s.origin, start); VectorMA(start, brain_reye[self->s.frame - FRAME_walk101].x, right, start); VectorMA(start, brain_reye[self->s.frame - FRAME_walk101].y, forward, start); VectorMA(start, brain_reye[self->s.frame - FRAME_walk101].z, up, start); VectorCopy(start, ent->s.origin); ent->enemy = self->enemy; ent->owner = self; ent->dmg = 1; monster_dabeam(ent); /* dis is me left eye */ ent = G_Spawn(); VectorCopy(self->s.origin, ent->s.origin); VectorCopy(angles, tempang); AngleVectors(tempang, forward, right, up); VectorCopy(tempang, ent->s.angles); VectorCopy(ent->s.origin, start); VectorMA(start, brain_leye[self->s.frame - FRAME_walk101].x, right, start); VectorMA(start, brain_leye[self->s.frame - FRAME_walk101].y, forward, start); VectorMA(start, brain_leye[self->s.frame - FRAME_walk101].z, up, start); VectorCopy(start, ent->s.origin); ent->enemy = self->enemy; ent->owner = self; ent->dmg = 1; monster_dabeam(ent); } void brain_laserbeam_reattack(edict_t *self) { if (!self) { return; } if (random() < 0.5) { if (visible(self, self->enemy)) { if (self->enemy->health > 0) { self->s.frame = FRAME_walk101; } } } } static mframe_t brain_frames_attack3[] = { {ai_charge, 5, NULL}, {ai_charge, -4, NULL}, {ai_charge, -4, NULL}, {ai_charge, -3, NULL}, {ai_charge, 0, brain_chest_open}, {ai_charge, 0, brain_tounge_attack}, {ai_charge, 13, NULL}, {ai_charge, 0, brain_tentacle_attack}, {ai_charge, 2, NULL}, {ai_charge, 0, brain_tounge_attack}, {ai_charge, -9, brain_chest_closed}, {ai_charge, 0, NULL}, {ai_charge, 4, NULL}, {ai_charge, 3, NULL}, {ai_charge, 2, NULL}, {ai_charge, -3, NULL}, {ai_charge, -6, NULL} }; mmove_t brain_move_attack3 = { FRAME_attak201, FRAME_attak217, brain_frames_attack3, brain_run }; static mframe_t brain_frames_attack4[] = { {ai_charge, 9, brain_laserbeam}, {ai_charge, 2, brain_laserbeam}, {ai_charge, 3, brain_laserbeam}, {ai_charge, 3, brain_laserbeam}, {ai_charge, 1, brain_laserbeam}, {ai_charge, 0, brain_laserbeam}, {ai_charge, 0, brain_laserbeam}, {ai_charge, 10, brain_laserbeam}, {ai_charge, -4, brain_laserbeam}, {ai_charge, -1, brain_laserbeam}, {ai_charge, 2, brain_laserbeam_reattack} }; mmove_t brain_move_attack4 = { FRAME_walk101, FRAME_walk111, brain_frames_attack4, brain_run }; void brain_attack(edict_t *self) { int r; if (!self) { return; } if (random() < 0.8) { r = range(self, self->enemy); if (r == RANGE_NEAR) { if (random() < 0.5) { self->monsterinfo.currentmove = &brain_move_attack3; } else { self->monsterinfo.currentmove = &brain_move_attack4; } } else if (r > RANGE_NEAR) { self->monsterinfo.currentmove = &brain_move_attack4; } } } /* RUN */ static mframe_t brain_frames_run[] = { {ai_run, 9, NULL}, {ai_run, 2, NULL}, {ai_run, 3, NULL}, {ai_run, 3, brain_footstep}, {ai_run, 1, NULL}, {ai_run, 0, NULL}, {ai_run, 0, NULL}, {ai_run, 10, NULL}, {ai_run, -4, NULL}, {ai_run, -1, brain_footstep}, {ai_run, 2, NULL} }; mmove_t brain_move_run = { FRAME_walk101, FRAME_walk111, brain_frames_run, NULL }; void brain_run(edict_t *self) { if (!self) { return; } self->monsterinfo.power_armor_type = POWER_ARMOR_SCREEN; if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &brain_move_stand; } else { self->monsterinfo.currentmove = &brain_move_run; } } void brain_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage /* unused */) { float r; if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } self->pain_debounce_time = level.time + 3; if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } r = random(); if (r < 0.33) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &brain_move_pain1; } else if (r < 0.66) { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &brain_move_pain2; } else { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &brain_move_pain3; } } void brain_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, -8); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } void brain_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point /* unused */) { int n; if (!self) { return; } self->s.effects = 0; self->monsterinfo.power_armor_type = POWER_ARMOR_NONE; /* check for gib */ if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 2; n++) { ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } /* regular death */ gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; if (random() <= 0.5) { self->monsterinfo.currentmove = &brain_move_death1; } else { self->monsterinfo.currentmove = &brain_move_death2; } } /* * QUAKED monster_brain (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_brain(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } // Force recaching at next footstep to ensure // that the sound indices are correct. sound_step = 0; sound_step2 = 0; sound_chest_open = gi.soundindex("brain/brnatck1.wav"); sound_tentacles_extend = gi.soundindex("brain/brnatck2.wav"); sound_tentacles_retract = gi.soundindex("brain/brnatck3.wav"); sound_death = gi.soundindex("brain/brndeth1.wav"); sound_idle1 = gi.soundindex("brain/brnidle1.wav"); sound_idle2 = gi.soundindex("brain/brnidle2.wav"); sound_idle3 = gi.soundindex("brain/brnlens1.wav"); sound_pain1 = gi.soundindex("brain/brnpain1.wav"); sound_pain2 = gi.soundindex("brain/brnpain2.wav"); sound_sight = gi.soundindex("brain/brnsght1.wav"); sound_search = gi.soundindex("brain/brnsrch1.wav"); sound_melee1 = gi.soundindex("brain/melee1.wav"); sound_melee2 = gi.soundindex("brain/melee2.wav"); sound_melee3 = gi.soundindex("brain/melee3.wav"); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/brain/tris.md2"); VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, 32); self->health = 300; self->gib_health = -150; self->mass = 400; self->pain = brain_pain; self->die = brain_die; self->monsterinfo.stand = brain_stand; self->monsterinfo.walk = brain_walk; self->monsterinfo.run = brain_run; self->monsterinfo.attack = brain_attack; self->monsterinfo.dodge = brain_dodge; self->monsterinfo.melee = brain_melee; self->monsterinfo.sight = brain_sight; self->monsterinfo.search = brain_search; self->monsterinfo.idle = brain_idle; self->monsterinfo.power_armor_type = POWER_ARMOR_SCREEN; self->monsterinfo.power_armor_power = 100; gi.linkentity(self); self->monsterinfo.currentmove = &brain_move_stand; self->monsterinfo.scale = MODEL_SCALE; walkmonster_start(self); } xatrix-XATRIX_2_14/src/monster/brain/brain.h000066400000000000000000000134571477320050300207670ustar00rootroot00000000000000/* ======================================================================= * * Brain animations. * * ======================================================================= * */ #define FRAME_walk101 0 #define FRAME_walk102 1 #define FRAME_walk103 2 #define FRAME_walk104 3 #define FRAME_walk105 4 #define FRAME_walk106 5 #define FRAME_walk107 6 #define FRAME_walk108 7 #define FRAME_walk109 8 #define FRAME_walk110 9 #define FRAME_walk111 10 #define FRAME_walk112 11 #define FRAME_walk113 12 #define FRAME_walk201 13 #define FRAME_walk202 14 #define FRAME_walk203 15 #define FRAME_walk204 16 #define FRAME_walk205 17 #define FRAME_walk206 18 #define FRAME_walk207 19 #define FRAME_walk208 20 #define FRAME_walk209 21 #define FRAME_walk210 22 #define FRAME_walk211 23 #define FRAME_walk212 24 #define FRAME_walk213 25 #define FRAME_walk214 26 #define FRAME_walk215 27 #define FRAME_walk216 28 #define FRAME_walk217 29 #define FRAME_walk218 30 #define FRAME_walk219 31 #define FRAME_walk220 32 #define FRAME_walk221 33 #define FRAME_walk222 34 #define FRAME_walk223 35 #define FRAME_walk224 36 #define FRAME_walk225 37 #define FRAME_walk226 38 #define FRAME_walk227 39 #define FRAME_walk228 40 #define FRAME_walk229 41 #define FRAME_walk230 42 #define FRAME_walk231 43 #define FRAME_walk232 44 #define FRAME_walk233 45 #define FRAME_walk234 46 #define FRAME_walk235 47 #define FRAME_walk236 48 #define FRAME_walk237 49 #define FRAME_walk238 50 #define FRAME_walk239 51 #define FRAME_walk240 52 #define FRAME_attak101 53 #define FRAME_attak102 54 #define FRAME_attak103 55 #define FRAME_attak104 56 #define FRAME_attak105 57 #define FRAME_attak106 58 #define FRAME_attak107 59 #define FRAME_attak108 60 #define FRAME_attak109 61 #define FRAME_attak110 62 #define FRAME_attak111 63 #define FRAME_attak112 64 #define FRAME_attak113 65 #define FRAME_attak114 66 #define FRAME_attak115 67 #define FRAME_attak116 68 #define FRAME_attak117 69 #define FRAME_attak118 70 #define FRAME_attak201 71 #define FRAME_attak202 72 #define FRAME_attak203 73 #define FRAME_attak204 74 #define FRAME_attak205 75 #define FRAME_attak206 76 #define FRAME_attak207 77 #define FRAME_attak208 78 #define FRAME_attak209 79 #define FRAME_attak210 80 #define FRAME_attak211 81 #define FRAME_attak212 82 #define FRAME_attak213 83 #define FRAME_attak214 84 #define FRAME_attak215 85 #define FRAME_attak216 86 #define FRAME_attak217 87 #define FRAME_pain101 88 #define FRAME_pain102 89 #define FRAME_pain103 90 #define FRAME_pain104 91 #define FRAME_pain105 92 #define FRAME_pain106 93 #define FRAME_pain107 94 #define FRAME_pain108 95 #define FRAME_pain109 96 #define FRAME_pain110 97 #define FRAME_pain111 98 #define FRAME_pain112 99 #define FRAME_pain113 100 #define FRAME_pain114 101 #define FRAME_pain115 102 #define FRAME_pain116 103 #define FRAME_pain117 104 #define FRAME_pain118 105 #define FRAME_pain119 106 #define FRAME_pain120 107 #define FRAME_pain121 108 #define FRAME_pain201 109 #define FRAME_pain202 110 #define FRAME_pain203 111 #define FRAME_pain204 112 #define FRAME_pain205 113 #define FRAME_pain206 114 #define FRAME_pain207 115 #define FRAME_pain208 116 #define FRAME_pain301 117 #define FRAME_pain302 118 #define FRAME_pain303 119 #define FRAME_pain304 120 #define FRAME_pain305 121 #define FRAME_pain306 122 #define FRAME_death101 123 #define FRAME_death102 124 #define FRAME_death103 125 #define FRAME_death104 126 #define FRAME_death105 127 #define FRAME_death106 128 #define FRAME_death107 129 #define FRAME_death108 130 #define FRAME_death109 131 #define FRAME_death110 132 #define FRAME_death111 133 #define FRAME_death112 134 #define FRAME_death113 135 #define FRAME_death114 136 #define FRAME_death115 137 #define FRAME_death116 138 #define FRAME_death117 139 #define FRAME_death118 140 #define FRAME_death201 141 #define FRAME_death202 142 #define FRAME_death203 143 #define FRAME_death204 144 #define FRAME_death205 145 #define FRAME_duck01 146 #define FRAME_duck02 147 #define FRAME_duck03 148 #define FRAME_duck04 149 #define FRAME_duck05 150 #define FRAME_duck06 151 #define FRAME_duck07 152 #define FRAME_duck08 153 #define FRAME_defens01 154 #define FRAME_defens02 155 #define FRAME_defens03 156 #define FRAME_defens04 157 #define FRAME_defens05 158 #define FRAME_defens06 159 #define FRAME_defens07 160 #define FRAME_defens08 161 #define FRAME_stand01 162 #define FRAME_stand02 163 #define FRAME_stand03 164 #define FRAME_stand04 165 #define FRAME_stand05 166 #define FRAME_stand06 167 #define FRAME_stand07 168 #define FRAME_stand08 169 #define FRAME_stand09 170 #define FRAME_stand10 171 #define FRAME_stand11 172 #define FRAME_stand12 173 #define FRAME_stand13 174 #define FRAME_stand14 175 #define FRAME_stand15 176 #define FRAME_stand16 177 #define FRAME_stand17 178 #define FRAME_stand18 179 #define FRAME_stand19 180 #define FRAME_stand20 181 #define FRAME_stand21 182 #define FRAME_stand22 183 #define FRAME_stand23 184 #define FRAME_stand24 185 #define FRAME_stand25 186 #define FRAME_stand26 187 #define FRAME_stand27 188 #define FRAME_stand28 189 #define FRAME_stand29 190 #define FRAME_stand30 191 #define FRAME_stand31 192 #define FRAME_stand32 193 #define FRAME_stand33 194 #define FRAME_stand34 195 #define FRAME_stand35 196 #define FRAME_stand36 197 #define FRAME_stand37 198 #define FRAME_stand38 199 #define FRAME_stand39 200 #define FRAME_stand40 201 #define FRAME_stand41 202 #define FRAME_stand42 203 #define FRAME_stand43 204 #define FRAME_stand44 205 #define FRAME_stand45 206 #define FRAME_stand46 207 #define FRAME_stand47 208 #define FRAME_stand48 209 #define FRAME_stand49 210 #define FRAME_stand50 211 #define FRAME_stand51 212 #define FRAME_stand52 213 #define FRAME_stand53 214 #define FRAME_stand54 215 #define FRAME_stand55 216 #define FRAME_stand56 217 #define FRAME_stand57 218 #define FRAME_stand58 219 #define FRAME_stand59 220 #define FRAME_stand60 221 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/chick/000077500000000000000000000000001477320050300174775ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/chick/chick.c000066400000000000000000000444421477320050300207340ustar00rootroot00000000000000/* * Copyright (C) 1997-2001 Id Software, Inc. * * 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. * * ======================================================================= * * Iron Maiden. * * ======================================================================= */ #include "../../header/local.h" #include "chick.h" qboolean visible(edict_t *self, edict_t *other); void chick_stand(edict_t *self); void chick_run(edict_t *self); void chick_reslash(edict_t *self); void chick_rerocket(edict_t *self); void chick_attack1(edict_t *self); static int sound_missile_prelaunch; static int sound_missile_launch; static int sound_melee_swing; static int sound_melee_hit; static int sound_missile_reload; static int sound_death1; static int sound_death2; static int sound_fall_down; static int sound_idle1; static int sound_idle2; static int sound_pain1; static int sound_pain2; static int sound_pain3; static int sound_sight; static int sound_search; static int sound_step; static int sound_step2; void chick_footstep(edict_t *self) { if (!g_monsterfootsteps->value) return; // Lazy loading for savegame compatibility. if (sound_step == 0 || sound_step2 == 0) { sound_step = gi.soundindex("bitch/step1.wav"); sound_step2 = gi.soundindex("bitch/step2.wav"); } if (randk() % 2 == 0) { gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); } } void ChickMoan(edict_t *self) { if (!self) { return; } if (random() < 0.5) { gi.sound(self, CHAN_VOICE, sound_idle1, 1, ATTN_IDLE, 0); } else { gi.sound(self, CHAN_VOICE, sound_idle2, 1, ATTN_IDLE, 0); } } static mframe_t chick_frames_fidget[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, ChickMoan}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t chick_move_fidget = { FRAME_stand201, FRAME_stand230, chick_frames_fidget, chick_stand }; void chick_fidget(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { return; } if (random() <= 0.3) { self->monsterinfo.currentmove = &chick_move_fidget; } } static mframe_t chick_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, chick_fidget}, }; mmove_t chick_move_stand = { FRAME_stand101, FRAME_stand130, chick_frames_stand, NULL }; void chick_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &chick_move_stand; } static mframe_t chick_frames_start_run[] = { {ai_run, 1, NULL}, {ai_run, 0, NULL}, {ai_run, 0, NULL}, {ai_run, -1, NULL}, {ai_run, -1, NULL}, {ai_run, 0, NULL}, {ai_run, 1, NULL}, {ai_run, 3, NULL}, {ai_run, 6, NULL}, {ai_run, 3, NULL} }; mmove_t chick_move_start_run = { FRAME_walk01, FRAME_walk10, chick_frames_start_run, chick_run }; static mframe_t chick_frames_run[] = { {ai_run, 6, NULL}, {ai_run, 8, chick_footstep}, {ai_run, 13, NULL}, {ai_run, 5, NULL}, {ai_run, 7, NULL}, {ai_run, 4, NULL}, {ai_run, 11, chick_footstep}, {ai_run, 5, NULL}, {ai_run, 9, NULL}, {ai_run, 7, NULL} }; mmove_t chick_move_run = { FRAME_walk11, FRAME_walk20, chick_frames_run, NULL }; static mframe_t chick_frames_walk[] = { {ai_walk, 6, NULL}, {ai_walk, 8, chick_footstep}, {ai_walk, 13, NULL}, {ai_walk, 5, NULL}, {ai_walk, 7, NULL}, {ai_walk, 4, NULL}, {ai_walk, 11, chick_footstep}, {ai_walk, 5, NULL}, {ai_walk, 9, NULL}, {ai_walk, 7, NULL} }; mmove_t chick_move_walk = { FRAME_walk11, FRAME_walk20, chick_frames_walk, NULL }; void chick_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &chick_move_walk; } void chick_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &chick_move_stand; return; } if ((self->monsterinfo.currentmove == &chick_move_walk) || (self->monsterinfo.currentmove == &chick_move_start_run)) { self->monsterinfo.currentmove = &chick_move_run; } else { self->monsterinfo.currentmove = &chick_move_start_run; } } static mframe_t chick_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t chick_move_pain1 = { FRAME_pain101, FRAME_pain105, chick_frames_pain1, chick_run }; static mframe_t chick_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t chick_move_pain2 = { FRAME_pain201, FRAME_pain205, chick_frames_pain2, chick_run }; static mframe_t chick_frames_pain3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -6, NULL}, {ai_move, 3, NULL}, {ai_move, 11, NULL}, {ai_move, 3, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 4, NULL}, {ai_move, 1, NULL}, {ai_move, 0, NULL}, {ai_move, -3, NULL}, {ai_move, -4, NULL}, {ai_move, 5, NULL}, {ai_move, 7, NULL}, {ai_move, -2, NULL}, {ai_move, 3, NULL}, {ai_move, -5, NULL}, {ai_move, -2, NULL}, {ai_move, -8, NULL}, {ai_move, 2, NULL} }; mmove_t chick_move_pain3 = { FRAME_pain301, FRAME_pain321, chick_frames_pain3, chick_run }; void chick_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { float r; if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } self->pain_debounce_time = level.time + 3; r = random(); if (r < 0.33) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); } else if (r < 0.66) { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_pain3, 1, ATTN_NORM, 0); } if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } if (damage <= 10) { self->monsterinfo.currentmove = &chick_move_pain1; } else if (damage <= 25) { self->monsterinfo.currentmove = &chick_move_pain2; } else { self->monsterinfo.currentmove = &chick_move_pain3; } } void chick_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -16, -16, 0); VectorSet(self->maxs, 16, 16, 16); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } static mframe_t chick_frames_death2[] = { {ai_move, -6, NULL}, {ai_move, 0, NULL}, {ai_move, -1, NULL}, {ai_move, -5, chick_footstep}, {ai_move, 0, NULL}, {ai_move, -1, NULL}, {ai_move, -2, NULL}, {ai_move, 1, NULL}, {ai_move, 10, NULL}, {ai_move, 2, NULL}, {ai_move, 3, chick_footstep}, {ai_move, 1, NULL}, {ai_move, 2, NULL}, {ai_move, 0, NULL}, {ai_move, 3, NULL}, {ai_move, 3, NULL}, {ai_move, 1, chick_footstep}, {ai_move, -3, NULL}, {ai_move, -5, NULL}, {ai_move, 4, NULL}, {ai_move, 15, NULL}, {ai_move, 14, NULL}, {ai_move, 1, NULL} }; mmove_t chick_move_death2 = { FRAME_death201, FRAME_death223, chick_frames_death2, chick_dead }; static mframe_t chick_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -7, NULL}, {ai_move, 4, NULL}, {ai_move, 11, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t chick_move_death1 = { FRAME_death101, FRAME_death112, chick_frames_death1, chick_dead }; void chick_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point /*unused */) { int n; if (!self) { return; } /* check for gib */ if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 2; n++) { ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } /* regular death */ self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; n = rand() % 2; if (n == 0) { self->monsterinfo.currentmove = &chick_move_death1; gi.sound(self, CHAN_VOICE, sound_death1, 1, ATTN_NORM, 0); } else { self->monsterinfo.currentmove = &chick_move_death2; gi.sound(self, CHAN_VOICE, sound_death2, 1, ATTN_NORM, 0); } } void chick_duck_down(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_DUCKED) { return; } self->monsterinfo.aiflags |= AI_DUCKED; self->maxs[2] -= 32; self->takedamage = DAMAGE_YES; self->monsterinfo.pausetime = level.time + 1; gi.linkentity(self); } void chick_duck_hold(edict_t *self) { if (!self) { return; } if (level.time >= self->monsterinfo.pausetime) { self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; } else { self->monsterinfo.aiflags |= AI_HOLD_FRAME; } } void chick_duck_up(edict_t *self) { if (!self) { return; } self->monsterinfo.aiflags &= ~AI_DUCKED; self->maxs[2] += 32; self->takedamage = DAMAGE_AIM; gi.linkentity(self); } static mframe_t chick_frames_duck[] = { {ai_move, 0, chick_duck_down}, {ai_move, 1, NULL}, {ai_move, 4, chick_duck_hold}, {ai_move, -4, NULL}, {ai_move, -5, chick_duck_up}, {ai_move, 3, NULL}, {ai_move, 1, NULL} }; mmove_t chick_move_duck = { FRAME_duck01, FRAME_duck07, chick_frames_duck, chick_run }; void chick_dodge(edict_t *self, edict_t *attacker, float eta /* unused */) { if (!self || !attacker) { return; } if (random() > 0.25) { return; } if (!self->enemy) { self->enemy = attacker; FoundTarget(self); } self->monsterinfo.currentmove = &chick_move_duck; } void ChickSlash(edict_t *self) { vec3_t aim; if (!self) { return; } VectorSet(aim, MELEE_DISTANCE, self->mins[0], 10); gi.sound(self, CHAN_WEAPON, sound_melee_swing, 1, ATTN_NORM, 0); fire_hit(self, aim, (10 + (rand() % 6)), 100); } void ChickRocket(edict_t *self) { vec3_t forward, right; vec3_t start; vec3_t dir; vec3_t vec; if (!self) { return; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_CHICK_ROCKET_1], forward, right, start); VectorCopy(self->enemy->s.origin, vec); vec[2] += self->enemy->viewheight; VectorSubtract(vec, start, dir); VectorNormalize(dir); if (!strcmp(self->classname, "monster_chick_heat")) { monster_fire_heat(self, start, dir, 50, 500, MZ2_CHICK_ROCKET_1); } else { monster_fire_rocket(self, start, dir, 50, 500, MZ2_CHICK_ROCKET_1); } } void Chick_PreAttack1(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_missile_prelaunch, 1, ATTN_NORM, 0); } void ChickReload(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_missile_reload, 1, ATTN_NORM, 0); } static mframe_t chick_frames_start_attack1[] = { {ai_charge, 0, Chick_PreAttack1}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 4, NULL}, {ai_charge, 0, NULL}, {ai_charge, -3, NULL}, {ai_charge, 3, NULL}, {ai_charge, 5, NULL}, {ai_charge, 7, chick_footstep}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, chick_attack1} }; mmove_t chick_move_start_attack1 = { FRAME_attak101, FRAME_attak113, chick_frames_start_attack1, NULL }; static mframe_t chick_frames_attack1[] = { {ai_charge, 19, ChickRocket}, {ai_charge, -6, NULL}, {ai_charge, -5, chick_footstep}, {ai_charge, -2, NULL}, {ai_charge, -7, chick_footstep}, {ai_charge, 0, NULL}, {ai_charge, 1, NULL}, {ai_charge, 10, ChickReload}, {ai_charge, 4, NULL}, {ai_charge, 5, chick_footstep}, {ai_charge, 6, NULL}, {ai_charge, 6, NULL}, {ai_charge, 4, chick_footstep}, {ai_charge, 3, chick_rerocket} }; mmove_t chick_move_attack1 = { FRAME_attak114, FRAME_attak127, chick_frames_attack1, NULL }; static mframe_t chick_frames_end_attack1[] = { {ai_charge, -3, NULL}, {ai_charge, 0, NULL}, {ai_charge, -6, NULL}, {ai_charge, -4, NULL}, {ai_charge, -2, chick_footstep} }; mmove_t chick_move_end_attack1 = { FRAME_attak128, FRAME_attak132, chick_frames_end_attack1, chick_run }; void chick_rerocket(edict_t *self) { if (!self) { return; } if (self->enemy->health > 0) { if (range(self, self->enemy) > RANGE_MELEE) { if (visible(self, self->enemy)) { if (random() <= 0.6) { self->monsterinfo.currentmove = &chick_move_attack1; return; } } } } self->monsterinfo.currentmove = &chick_move_end_attack1; } void chick_attack1(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &chick_move_attack1; } static mframe_t chick_frames_slash[] = { {ai_charge, 1, NULL}, {ai_charge, 7, ChickSlash}, {ai_charge, -7, NULL}, {ai_charge, 1, NULL}, {ai_charge, -1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 0, NULL}, {ai_charge, 1, NULL}, {ai_charge, -2, chick_reslash} }; mmove_t chick_move_slash = { FRAME_attak204, FRAME_attak212, chick_frames_slash, NULL }; static mframe_t chick_frames_end_slash[] = { {ai_charge, -6, NULL}, {ai_charge, -1, NULL}, {ai_charge, -6, NULL}, {ai_charge, 0, chick_footstep} }; mmove_t chick_move_end_slash = { FRAME_attak213, FRAME_attak216, chick_frames_end_slash, chick_run }; void chick_reslash(edict_t *self) { if (!self) { return; } if (self->enemy->health > 0) { if (range(self, self->enemy) == RANGE_MELEE) { if (random() <= 0.9) { self->monsterinfo.currentmove = &chick_move_slash; return; } else { self->monsterinfo.currentmove = &chick_move_end_slash; return; } } } self->monsterinfo.currentmove = &chick_move_end_slash; } void chick_slash(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &chick_move_slash; } static mframe_t chick_frames_start_slash[] = { {ai_charge, 1, NULL}, {ai_charge, 8, NULL}, {ai_charge, 3, chick_footstep} }; mmove_t chick_move_start_slash = { FRAME_attak201, FRAME_attak203, chick_frames_start_slash, chick_slash }; void chick_melee(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &chick_move_start_slash; } void chick_attack(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &chick_move_start_attack1; } void chick_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); } /* * QUAKED monster_chick (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_chick(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } // Force recaching at next footstep to ensure // that the sound indices are correct. sound_step = 0; sound_step2 = 0; sound_missile_prelaunch = gi.soundindex("chick/chkatck1.wav"); sound_missile_launch = gi.soundindex("chick/chkatck2.wav"); sound_melee_swing = gi.soundindex("chick/chkatck3.wav"); sound_melee_hit = gi.soundindex("chick/chkatck4.wav"); sound_missile_reload = gi.soundindex("chick/chkatck5.wav"); sound_death1 = gi.soundindex("chick/chkdeth1.wav"); sound_death2 = gi.soundindex("chick/chkdeth2.wav"); sound_fall_down = gi.soundindex("chick/chkfall1.wav"); sound_idle1 = gi.soundindex("chick/chkidle1.wav"); sound_idle2 = gi.soundindex("chick/chkidle2.wav"); sound_pain1 = gi.soundindex("chick/chkpain1.wav"); sound_pain2 = gi.soundindex("chick/chkpain2.wav"); sound_pain3 = gi.soundindex("chick/chkpain3.wav"); sound_sight = gi.soundindex("chick/chksght1.wav"); sound_search = gi.soundindex("chick/chksrch1.wav"); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/bitch/tris.md2"); VectorSet(self->mins, -16, -16, 0); VectorSet(self->maxs, 16, 16, 56); self->health = 175; self->gib_health = -70; self->mass = 200; self->pain = chick_pain; self->die = chick_die; self->monsterinfo.stand = chick_stand; self->monsterinfo.walk = chick_walk; self->monsterinfo.run = chick_run; self->monsterinfo.dodge = chick_dodge; self->monsterinfo.attack = chick_attack; self->monsterinfo.melee = chick_melee; self->monsterinfo.sight = chick_sight; gi.linkentity(self); self->monsterinfo.currentmove = &chick_move_stand; self->monsterinfo.scale = MODEL_SCALE; walkmonster_start(self); } /* * QUAKED monster_chick_heat (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_chick_heat(edict_t *self) { if (!self) { return; } SP_monster_chick(self); /* have to check this since the regular spawn function can free the entity */ if (self->inuse) { self->s.skinnum = 3; } } xatrix-XATRIX_2_14/src/monster/chick/chick.h000066400000000000000000000171511477320050300207360ustar00rootroot00000000000000/* ======================================================================= * * Iron Maiden animations. * * ======================================================================= */ #define FRAME_attak101 0 #define FRAME_attak102 1 #define FRAME_attak103 2 #define FRAME_attak104 3 #define FRAME_attak105 4 #define FRAME_attak106 5 #define FRAME_attak107 6 #define FRAME_attak108 7 #define FRAME_attak109 8 #define FRAME_attak110 9 #define FRAME_attak111 10 #define FRAME_attak112 11 #define FRAME_attak113 12 #define FRAME_attak114 13 #define FRAME_attak115 14 #define FRAME_attak116 15 #define FRAME_attak117 16 #define FRAME_attak118 17 #define FRAME_attak119 18 #define FRAME_attak120 19 #define FRAME_attak121 20 #define FRAME_attak122 21 #define FRAME_attak123 22 #define FRAME_attak124 23 #define FRAME_attak125 24 #define FRAME_attak126 25 #define FRAME_attak127 26 #define FRAME_attak128 27 #define FRAME_attak129 28 #define FRAME_attak130 29 #define FRAME_attak131 30 #define FRAME_attak132 31 #define FRAME_attak201 32 #define FRAME_attak202 33 #define FRAME_attak203 34 #define FRAME_attak204 35 #define FRAME_attak205 36 #define FRAME_attak206 37 #define FRAME_attak207 38 #define FRAME_attak208 39 #define FRAME_attak209 40 #define FRAME_attak210 41 #define FRAME_attak211 42 #define FRAME_attak212 43 #define FRAME_attak213 44 #define FRAME_attak214 45 #define FRAME_attak215 46 #define FRAME_attak216 47 #define FRAME_death101 48 #define FRAME_death102 49 #define FRAME_death103 50 #define FRAME_death104 51 #define FRAME_death105 52 #define FRAME_death106 53 #define FRAME_death107 54 #define FRAME_death108 55 #define FRAME_death109 56 #define FRAME_death110 57 #define FRAME_death111 58 #define FRAME_death112 59 #define FRAME_death201 60 #define FRAME_death202 61 #define FRAME_death203 62 #define FRAME_death204 63 #define FRAME_death205 64 #define FRAME_death206 65 #define FRAME_death207 66 #define FRAME_death208 67 #define FRAME_death209 68 #define FRAME_death210 69 #define FRAME_death211 70 #define FRAME_death212 71 #define FRAME_death213 72 #define FRAME_death214 73 #define FRAME_death215 74 #define FRAME_death216 75 #define FRAME_death217 76 #define FRAME_death218 77 #define FRAME_death219 78 #define FRAME_death220 79 #define FRAME_death221 80 #define FRAME_death222 81 #define FRAME_death223 82 #define FRAME_duck01 83 #define FRAME_duck02 84 #define FRAME_duck03 85 #define FRAME_duck04 86 #define FRAME_duck05 87 #define FRAME_duck06 88 #define FRAME_duck07 89 #define FRAME_pain101 90 #define FRAME_pain102 91 #define FRAME_pain103 92 #define FRAME_pain104 93 #define FRAME_pain105 94 #define FRAME_pain201 95 #define FRAME_pain202 96 #define FRAME_pain203 97 #define FRAME_pain204 98 #define FRAME_pain205 99 #define FRAME_pain301 100 #define FRAME_pain302 101 #define FRAME_pain303 102 #define FRAME_pain304 103 #define FRAME_pain305 104 #define FRAME_pain306 105 #define FRAME_pain307 106 #define FRAME_pain308 107 #define FRAME_pain309 108 #define FRAME_pain310 109 #define FRAME_pain311 110 #define FRAME_pain312 111 #define FRAME_pain313 112 #define FRAME_pain314 113 #define FRAME_pain315 114 #define FRAME_pain316 115 #define FRAME_pain317 116 #define FRAME_pain318 117 #define FRAME_pain319 118 #define FRAME_pain320 119 #define FRAME_pain321 120 #define FRAME_stand101 121 #define FRAME_stand102 122 #define FRAME_stand103 123 #define FRAME_stand104 124 #define FRAME_stand105 125 #define FRAME_stand106 126 #define FRAME_stand107 127 #define FRAME_stand108 128 #define FRAME_stand109 129 #define FRAME_stand110 130 #define FRAME_stand111 131 #define FRAME_stand112 132 #define FRAME_stand113 133 #define FRAME_stand114 134 #define FRAME_stand115 135 #define FRAME_stand116 136 #define FRAME_stand117 137 #define FRAME_stand118 138 #define FRAME_stand119 139 #define FRAME_stand120 140 #define FRAME_stand121 141 #define FRAME_stand122 142 #define FRAME_stand123 143 #define FRAME_stand124 144 #define FRAME_stand125 145 #define FRAME_stand126 146 #define FRAME_stand127 147 #define FRAME_stand128 148 #define FRAME_stand129 149 #define FRAME_stand130 150 #define FRAME_stand201 151 #define FRAME_stand202 152 #define FRAME_stand203 153 #define FRAME_stand204 154 #define FRAME_stand205 155 #define FRAME_stand206 156 #define FRAME_stand207 157 #define FRAME_stand208 158 #define FRAME_stand209 159 #define FRAME_stand210 160 #define FRAME_stand211 161 #define FRAME_stand212 162 #define FRAME_stand213 163 #define FRAME_stand214 164 #define FRAME_stand215 165 #define FRAME_stand216 166 #define FRAME_stand217 167 #define FRAME_stand218 168 #define FRAME_stand219 169 #define FRAME_stand220 170 #define FRAME_stand221 171 #define FRAME_stand222 172 #define FRAME_stand223 173 #define FRAME_stand224 174 #define FRAME_stand225 175 #define FRAME_stand226 176 #define FRAME_stand227 177 #define FRAME_stand228 178 #define FRAME_stand229 179 #define FRAME_stand230 180 #define FRAME_walk01 181 #define FRAME_walk02 182 #define FRAME_walk03 183 #define FRAME_walk04 184 #define FRAME_walk05 185 #define FRAME_walk06 186 #define FRAME_walk07 187 #define FRAME_walk08 188 #define FRAME_walk09 189 #define FRAME_walk10 190 #define FRAME_walk11 191 #define FRAME_walk12 192 #define FRAME_walk13 193 #define FRAME_walk14 194 #define FRAME_walk15 195 #define FRAME_walk16 196 #define FRAME_walk17 197 #define FRAME_walk18 198 #define FRAME_walk19 199 #define FRAME_walk20 200 #define FRAME_walk21 201 #define FRAME_walk22 202 #define FRAME_walk23 203 #define FRAME_walk24 204 #define FRAME_walk25 205 #define FRAME_walk26 206 #define FRAME_walk27 207 #define FRAME_recln201 208 #define FRAME_recln202 209 #define FRAME_recln203 210 #define FRAME_recln204 211 #define FRAME_recln205 212 #define FRAME_recln206 213 #define FRAME_recln207 214 #define FRAME_recln208 215 #define FRAME_recln209 216 #define FRAME_recln210 217 #define FRAME_recln211 218 #define FRAME_recln212 219 #define FRAME_recln213 220 #define FRAME_recln214 221 #define FRAME_recln215 222 #define FRAME_recln216 223 #define FRAME_recln217 224 #define FRAME_recln218 225 #define FRAME_recln219 226 #define FRAME_recln220 227 #define FRAME_recln221 228 #define FRAME_recln222 229 #define FRAME_recln223 230 #define FRAME_recln224 231 #define FRAME_recln225 232 #define FRAME_recln226 233 #define FRAME_recln227 234 #define FRAME_recln228 235 #define FRAME_recln229 236 #define FRAME_recln230 237 #define FRAME_recln231 238 #define FRAME_recln232 239 #define FRAME_recln233 240 #define FRAME_recln234 241 #define FRAME_recln235 242 #define FRAME_recln236 243 #define FRAME_recln237 244 #define FRAME_recln238 245 #define FRAME_recln239 246 #define FRAME_recln240 247 #define FRAME_recln101 248 #define FRAME_recln102 249 #define FRAME_recln103 250 #define FRAME_recln104 251 #define FRAME_recln105 252 #define FRAME_recln106 253 #define FRAME_recln107 254 #define FRAME_recln108 255 #define FRAME_recln109 256 #define FRAME_recln110 257 #define FRAME_recln111 258 #define FRAME_recln112 259 #define FRAME_recln113 260 #define FRAME_recln114 261 #define FRAME_recln115 262 #define FRAME_recln116 263 #define FRAME_recln117 264 #define FRAME_recln118 265 #define FRAME_recln119 266 #define FRAME_recln120 267 #define FRAME_recln121 268 #define FRAME_recln122 269 #define FRAME_recln123 270 #define FRAME_recln124 271 #define FRAME_recln125 272 #define FRAME_recln126 273 #define FRAME_recln127 274 #define FRAME_recln128 275 #define FRAME_recln129 276 #define FRAME_recln130 277 #define FRAME_recln131 278 #define FRAME_recln132 279 #define FRAME_recln133 280 #define FRAME_recln134 281 #define FRAME_recln135 282 #define FRAME_recln136 283 #define FRAME_recln137 284 #define FRAME_recln138 285 #define FRAME_recln139 286 #define FRAME_recln140 287 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/fixbot/000077500000000000000000000000001477320050300177115ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/fixbot/fixbot.c000066400000000000000000000762301477320050300213600ustar00rootroot00000000000000/* ============================================================== * * Fixbot * * ======================================================================= */ #include "../../header/local.h" #include "fixbot.h" #define MZ2_fixbot_BLASTER_1 MZ2_HOVER_BLASTER_1 #define FIXBOT_MAX_STUCK_FRAMES 10 #define FIXBOT_GOAL_TIMEOUT 15 #define FIXBOT_WELD_GOAL_TIMEOUT 15 qboolean visible(edict_t *self, edict_t *other); qboolean infront(edict_t *self, edict_t *other); static int sound_pain1; static int sound_die; static int sound_weld1; static int sound_weld2; static int sound_weld3; void fixbot_run(edict_t *self); void fixbot_stand(edict_t *self); void fixbot_dead(edict_t *self); void fixbot_attack(edict_t *self); void fixbot_fire_blaster(edict_t *self); void fixbot_fire_welder(edict_t *self); void fixbot_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point); void M_MoveToGoal(edict_t *ent, float dist); void use_scanner(edict_t *self); void change_to_roam(edict_t *self); void fly_vertical(edict_t *self); extern mmove_t fixbot_move_forward; extern mmove_t fixbot_move_stand; extern mmove_t fixbot_move_stand2; extern mmove_t fixbot_move_roamgoal; extern mmove_t fixbot_move_weld_start; extern mmove_t fixbot_move_weld; extern mmove_t fixbot_move_weld_end; extern mmove_t fixbot_move_takeoff; extern mmove_t fixbot_move_landing; extern mmove_t fixbot_move_turn; extern void roam_goal(edict_t *self); void ED_CallSpawn(edict_t *ent); float crand(void) { return (rand() & 32767) * (2.0 / 32767) - 1; } edict_t * fixbot_FindDeadMonster(edict_t *self) { edict_t *ent = NULL; edict_t *best = NULL; if (!self) { return NULL; } while ((ent = findradius(ent, self->s.origin, 1024)) != NULL) { if (ent == self) { continue; } if (!(ent->svflags & SVF_MONSTER)) { continue; } if (ent->monsterinfo.aiflags & AI_GOOD_GUY) { continue; } if (ent->owner) { continue; } if (ent->health > 0) { continue; } if (ent->nextthink) { continue; } if (!visible(self, ent)) { continue; } if (!best) { best = ent; continue; } if (ent->max_health <= best->max_health) { continue; } best = ent; } return best; } int fixbot_search(edict_t *self) { edict_t *ent; if (!self) { return 0; } if (!self->goalentity) { ent = fixbot_FindDeadMonster(self); if (ent) { self->oldenemy = self->enemy; self->enemy = ent; self->enemy->owner = self; self->monsterinfo.aiflags |= AI_MEDIC; FoundTarget(self); return 1; } } return 0; } void bot_goal_think(edict_t *self) { if (!self) { return; } /* clean up the bot_goal if the fixbot loses it (to avoid entity leaks) */ if (!self->owner || !self->owner->inuse || self->owner->goalentity != self) { G_FreeEdict(self); } else { self->nextthink = level.time + FRAMETIME; } } static edict_t * make_bot_goal(edict_t *self) { edict_t *ent = G_Spawn(); ent->classname = "bot_goal"; ent->solid = SOLID_BBOX; ent->owner = self; ent->think = bot_goal_think; ent->nextthink = level.time + FRAMETIME; ent->touch_debounce_time = level.time + FIXBOT_GOAL_TIMEOUT; return ent; } void landing_goal(edict_t *self) { trace_t tr; vec3_t forward, right, up; vec3_t end; edict_t *ent; if (!self) { return; } ent = make_bot_goal(self); VectorSet(ent->mins, -32, -32, -24); VectorSet(ent->maxs, 32, 32, 24); gi.linkentity(ent); AngleVectors(self->s.angles, forward, right, up); VectorMA(self->s.origin, 32, forward, end); VectorMA(self->s.origin, -8096, up, end); tr = gi.trace(self->s.origin, ent->mins, ent->maxs, end, self, MASK_MONSTERSOLID); VectorCopy(tr.endpos, ent->s.origin); gi.linkentity(ent); self->goalentity = self->enemy = ent; self->monsterinfo.currentmove = &fixbot_move_landing; } void takeoff_goal(edict_t *self) { trace_t tr; vec3_t forward, right, up; vec3_t end; edict_t *ent; if (!self) { return; } ent = make_bot_goal(self); VectorSet(ent->mins, -32, -32, -24); VectorSet(ent->maxs, 32, 32, 24); gi.linkentity(ent); AngleVectors(self->s.angles, forward, right, up); VectorMA(self->s.origin, 32, forward, end); VectorMA(self->s.origin, 128, up, end); tr = gi.trace(self->s.origin, ent->mins, ent->maxs, end, self, MASK_MONSTERSOLID); VectorCopy(tr.endpos, ent->s.origin); gi.linkentity(ent); self->goalentity = self->enemy = ent; self->monsterinfo.currentmove = &fixbot_move_takeoff; } void change_to_roam(edict_t *self) { if (!self) { return; } if (fixbot_search(self)) { return; } self->monsterinfo.currentmove = &fixbot_move_roamgoal; if (self->spawnflags & 16) { landing_goal(self); self->monsterinfo.currentmove = &fixbot_move_landing; self->spawnflags = 32; } if (self->spawnflags & 8) { takeoff_goal(self); self->monsterinfo.currentmove = &fixbot_move_takeoff; self->spawnflags = 32; } if (self->spawnflags & 4) { self->monsterinfo.currentmove = &fixbot_move_roamgoal; self->spawnflags = 32; } if (!self->spawnflags) { self->monsterinfo.currentmove = &fixbot_move_stand2; } } void roam_goal(edict_t *self) { trace_t tr; vec3_t forward; vec3_t end; edict_t *ent; vec3_t dang; int len, oldlen, i; vec3_t vec; vec3_t whichvec; if (!self) { return; } VectorClear(whichvec); oldlen = 0; for (i = 0; i < 12; i++) { VectorCopy(self->s.angles, dang); if (i < 6) { dang[YAW] += 30 * i; } else { dang[YAW] -= 30 * (i - 6); } AngleVectors(dang, forward, NULL, NULL); VectorMA(self->s.origin, 8192, forward, end); tr = gi.trace(self->s.origin, NULL, NULL, end, self, MASK_SHOT); VectorSubtract(self->s.origin, tr.endpos, vec); len = VectorLength(vec); if (len > oldlen) { oldlen = len; VectorCopy(tr.endpos, whichvec); } } ent = make_bot_goal(self); VectorCopy(whichvec, ent->s.origin); gi.linkentity(ent); self->goalentity = self->enemy = ent; self->monsterinfo.currentmove = &fixbot_move_turn; } void use_scanner(edict_t *self) { edict_t *ent = NULL; vec3_t vec; if (!self) { return; } if (self->fly_sound_debounce_time < level.time && strcmp(self->goalentity->classname, "object_repair") != 0) { while ((ent = findradius(ent, self->s.origin, 1024)) != NULL) { if (strcmp(ent->classname, "object_repair") != 0) { continue; } if (ent->health < 100) { continue; } if (!visible(self, ent)) { continue; } /* remove the old one */ if (strcmp(self->goalentity->classname, "bot_goal") == 0) { self->goalentity->nextthink = level.time + 0.1; self->goalentity->think = G_FreeEdict; } self->goalentity = self->enemy = ent; break; } } if (strcmp(self->goalentity->classname, "object_repair") == 0) { VectorSubtract(self->s.origin, self->goalentity->s.origin, vec); if (VectorLength(vec) < 56) { self->monsterinfo.currentmove = &fixbot_move_weld_start; return; } } else if (strcmp(self->goalentity->classname, "bot_goal") == 0) { VectorSubtract(self->s.origin, self->goalentity->s.origin, vec); if (self->goalentity->touch_debounce_time < level.time || VectorLength(vec) < 32) { self->goalentity->nextthink = level.time + 0.1; self->goalentity->think = G_FreeEdict; self->goalentity = self->enemy = NULL; self->monsterinfo.currentmove = &fixbot_move_stand; return; } } VectorSubtract(self->s.origin, self->s.old_origin, vec); if (VectorLength(vec) == 0) { self->count++; } else { self->count = 0; } if (self->count > FIXBOT_MAX_STUCK_FRAMES) { /* bot is stuck, get new goalentity */ self->count = 0; if (strcmp(self->goalentity->classname, "bot_goal") == 0) { self->goalentity->nextthink = level.time + 0.1; self->goalentity->think = G_FreeEdict; self->goalentity = self->enemy = NULL; } else if (strcmp(self->goalentity->classname, "object_repair") == 0) { /* don't try to go for welding targets again for a while */ self->fly_sound_debounce_time = level.time + FIXBOT_WELD_GOAL_TIMEOUT; } self->monsterinfo.currentmove = &fixbot_move_stand; } } /* * When the bot has found a landing pad * it will proceed to its goalentity * just above the landing pad and * decend translated along the z the current * frames are at 10fps */ void blastoff(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int te_impact, int hspread, int vspread) { trace_t tr; vec3_t dir; vec3_t forward, right, up; vec3_t end; float r; float u; vec3_t water_start; qboolean water = false; int content_mask = MASK_SHOT | MASK_WATER; if (!self) { return; } hspread += (self->s.frame - FRAME_takeoff_01); vspread += (self->s.frame - FRAME_takeoff_01); tr = gi.trace(self->s.origin, NULL, NULL, start, self, MASK_SHOT); if (!(tr.fraction < 1.0)) { vectoangles(aimdir, dir); AngleVectors(dir, forward, right, up); r = crandom() * hspread; u = crandom() * vspread; VectorMA(start, 8192, forward, end); VectorMA(end, r, right, end); VectorMA(end, u, up, end); if (gi.pointcontents(start) & MASK_WATER) { water = true; VectorCopy(start, water_start); content_mask &= ~MASK_WATER; } tr = gi.trace(start, NULL, NULL, end, self, content_mask); /* see if we hit water */ if (tr.contents & MASK_WATER) { int color; water = true; VectorCopy(tr.endpos, water_start); if (!VectorCompare(start, tr.endpos)) { if (tr.contents & CONTENTS_WATER) { if (strcmp(tr.surface->name, "*brwater") == 0) { color = SPLASH_BROWN_WATER; } else { color = SPLASH_BLUE_WATER; } } else if (tr.contents & CONTENTS_SLIME) { color = SPLASH_SLIME; } else if (tr.contents & CONTENTS_LAVA) { color = SPLASH_LAVA; } else { color = SPLASH_UNKNOWN; } if (color != SPLASH_UNKNOWN) { gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_SPLASH); gi.WriteByte(8); gi.WritePosition(tr.endpos); gi.WriteDir(tr.plane.normal); gi.WriteByte(color); gi.multicast(tr.endpos, MULTICAST_PVS); } /* change bullet's course when it enters water */ VectorSubtract(end, start, dir); vectoangles(dir, dir); AngleVectors(dir, forward, right, up); r = crandom() * hspread * 2; u = crandom() * vspread * 2; VectorMA(water_start, 8192, forward, end); VectorMA(end, r, right, end); VectorMA(end, u, up, end); } /* re-trace ignoring water this time */ tr = gi.trace(water_start, NULL, NULL, end, self, MASK_SHOT); } } /* send gun puff / flash */ if (!((tr.surface) && (tr.surface->flags & SURF_SKY))) { if (tr.fraction < 1.0) { if (tr.ent->takedamage) { T_Damage(tr.ent, self, self, aimdir, tr.endpos, tr.plane.normal, damage, kick, DAMAGE_BULLET, MOD_BLASTOFF); } else { if (strncmp(tr.surface->name, "sky", 3) != 0) { gi.WriteByte(svc_temp_entity); gi.WriteByte(te_impact); gi.WritePosition(tr.endpos); gi.WriteDir(tr.plane.normal); gi.multicast(tr.endpos, MULTICAST_PVS); if (self->client) { PlayerNoise(self, tr.endpos, PNOISE_IMPACT); } } } } } /* if went through water, determine where the end and make a bubble trail */ if (water) { vec3_t pos; VectorSubtract(tr.endpos, water_start, dir); VectorNormalize(dir); VectorMA(tr.endpos, -2, dir, pos); if (gi.pointcontents(pos) & MASK_WATER) { VectorCopy(pos, tr.endpos); } else { tr = gi.trace(pos, NULL, NULL, water_start, tr.ent, MASK_WATER); } VectorAdd(water_start, tr.endpos, pos); VectorScale(pos, 0.5, pos); gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_BUBBLETRAIL); gi.WritePosition(water_start); gi.WritePosition(tr.endpos); gi.multicast(pos, MULTICAST_PVS); } } void fly_vertical(edict_t *self) { int i; vec3_t v; vec3_t forward, right, up; vec3_t start; vec3_t tempvec; if (!self) { return; } VectorSubtract(self->goalentity->s.origin, self->s.origin, v); self->ideal_yaw = vectoyaw(v); M_ChangeYaw(self); if ((self->s.frame == FRAME_landing_58) || (self->s.frame == FRAME_takeoff_16)) { self->goalentity->nextthink = level.time + 0.1; self->goalentity->think = G_FreeEdict; self->monsterinfo.currentmove = &fixbot_move_stand; self->goalentity = self->enemy = NULL; } /* kick up some particles */ VectorCopy(self->s.angles, tempvec); tempvec[PITCH] += 90; AngleVectors(tempvec, forward, right, up); VectorCopy(self->s.origin, start); for (i = 0; i < 10; i++) { blastoff(self, start, forward, 2, 1, TE_SHOTGUN, DEFAULT_SHOTGUN_HSPREAD, DEFAULT_SHOTGUN_VSPREAD); } } void fly_vertical2(edict_t *self) { vec3_t v; int len; if (!self) { return; } VectorSubtract(self->goalentity->s.origin, self->s.origin, v); len = VectorLength(v); self->ideal_yaw = vectoyaw(v); M_ChangeYaw(self); if (len < 32) { self->goalentity->nextthink = level.time + 0.1; self->goalentity->think = G_FreeEdict; self->monsterinfo.currentmove = &fixbot_move_stand; self->goalentity = self->enemy = NULL; } } static mframe_t fixbot_frames_landing[] = { {ai_move, 0, NULL}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2} }; mmove_t fixbot_move_landing = { FRAME_landing_01, FRAME_landing_58, fixbot_frames_landing, NULL }; /* generic ambient stand */ static mframe_t fixbot_frames_stand[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, change_to_roam} }; mmove_t fixbot_move_stand = { FRAME_ambient_01, FRAME_ambient_19, fixbot_frames_stand, NULL }; static mframe_t fixbot_frames_stand2[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t fixbot_move_stand2 = { FRAME_ambient_01, FRAME_ambient_19, fixbot_frames_stand2, NULL }; /* * will need the pickup offset for the front pincers * object will need to stop forward of the object * and take the object with it ( this may require a * variant of liftoff and landing ) */ static mframe_t fixbot_frames_pickup[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t fixbot_move_pickup = { FRAME_pickup_01, FRAME_pickup_27, fixbot_frames_pickup, NULL }; /* generic frame to move bot */ static mframe_t fixbot_frames_roamgoal[] = { {ai_move, 0, roam_goal} }; mmove_t fixbot_move_roamgoal = { FRAME_freeze_01, FRAME_freeze_01, fixbot_frames_roamgoal, NULL }; void ai_facing(edict_t *self, float dist) { vec3_t v; if (!self) { return; } if (infront(self, self->goalentity)) { self->monsterinfo.currentmove = &fixbot_move_forward; } else { VectorSubtract(self->goalentity->s.origin, self->s.origin, v); self->ideal_yaw = vectoyaw(v); M_ChangeYaw(self); } } static mframe_t fixbot_frames_turn[] = { {ai_facing, 0, NULL} }; mmove_t fixbot_move_turn = { FRAME_freeze_01, FRAME_freeze_01, fixbot_frames_turn, NULL }; void go_roam(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &fixbot_move_stand; } /* takeoff */ static mframe_t fixbot_frames_takeoff[] = { {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical} }; mmove_t fixbot_move_takeoff = { FRAME_takeoff_01, FRAME_takeoff_16, fixbot_frames_takeoff, NULL }; /* findout what this is */ static mframe_t fixbot_frames_paina[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t fixbot_move_paina = { FRAME_paina_01, FRAME_paina_06, fixbot_frames_paina, fixbot_run }; /* findout what this is */ static mframe_t fixbot_frames_painb[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t fixbot_move_painb = { FRAME_painb_01, FRAME_painb_08, fixbot_frames_painb, fixbot_run }; /* * backup from pain * call a generic painsound * some spark effects */ static mframe_t fixbot_frames_pain3[] = { {ai_move, -1, NULL} }; mmove_t fixbot_move_pain3 = { FRAME_freeze_01, FRAME_freeze_01, fixbot_frames_pain3, fixbot_run }; /* * bot has compleated landing * and is now on the grownd * ( may need second land if the * bot is releasing jib into jib vat ) */ static mframe_t fixbot_frames_land[] = { {ai_move, 0, NULL} }; mmove_t fixbot_move_land = { FRAME_freeze_01, FRAME_freeze_01, fixbot_frames_land, NULL }; void ai_movetogoal(edict_t *self, float dist) { if (!self) { return; } M_MoveToGoal(self, dist); } static mframe_t fixbot_frames_forward[] = { {ai_movetogoal, 5, use_scanner} }; mmove_t fixbot_move_forward = { FRAME_freeze_01, FRAME_freeze_01, fixbot_frames_forward, NULL }; static mframe_t fixbot_frames_walk[] = { {ai_walk, 5, NULL} }; mmove_t fixbot_move_walk = { FRAME_freeze_01, FRAME_freeze_01, fixbot_frames_walk, NULL }; static mframe_t fixbot_frames_run[] = { {ai_run, 10, NULL} }; mmove_t fixbot_move_run = { FRAME_freeze_01, FRAME_freeze_01, fixbot_frames_run, NULL }; static mframe_t fixbot_frames_death1[] = { {ai_move, 0, NULL} }; mmove_t fixbot_move_death1 = { FRAME_freeze_01, FRAME_freeze_01, fixbot_frames_death1, fixbot_dead }; static mframe_t fixbot_frames_backward[] = { {ai_move, 0, NULL} }; mmove_t fixbot_move_backward = { FRAME_freeze_01, FRAME_freeze_01, fixbot_frames_backward, NULL }; static mframe_t fixbot_frames_start_attack[] = { {ai_charge, 0, NULL} }; mmove_t fixbot_move_start_attack = { FRAME_freeze_01, FRAME_freeze_01, fixbot_frames_start_attack, fixbot_attack }; static mframe_t fixbot_frames_attack1[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, -10, fixbot_fire_blaster} }; mmove_t fixbot_move_attack1 = { FRAME_shoot_01, FRAME_shoot_06, fixbot_frames_attack1, NULL }; int check_telefrag(edict_t *self) { vec3_t end, up; trace_t tr; if (!self) { return 0; } AngleVectors(self->enemy->s.angles, NULL, NULL, up); VectorMA(self->enemy->s.origin, 48, up, end); tr = gi.trace(self->enemy->s.origin, self->enemy->mins, self->enemy->maxs, end, self, MASK_MONSTERSOLID); if (tr.ent && tr.ent->takedamage) { tr.ent->health = 0; T_Damage(tr.ent, self, self, vec3_origin, vec3_origin, vec3_origin, 10000, 0, 0, MOD_UNKNOWN); return 0; } return 1; } void fixbot_fire_laser(edict_t *self) { vec3_t forward, right, up; vec3_t tempang, start; vec3_t dir, angles, end; edict_t *ent; if (!self) { return; } /* critter dun got blown up while bein' fixed */ if (self->enemy->health <= self->enemy->gib_health) { self->monsterinfo.currentmove = &fixbot_move_stand; self->monsterinfo.aiflags &= ~AI_MEDIC; return; } gi.sound(self, CHAN_AUTO, gi.soundindex("misc/lasfly.wav"), 1, ATTN_STATIC, 0); VectorCopy(self->s.origin, start); VectorCopy(self->enemy->s.origin, end); VectorSubtract(end, start, dir); vectoangles(dir, angles); ent = G_Spawn(); VectorCopy(self->s.origin, ent->s.origin); VectorCopy(angles, tempang); AngleVectors(tempang, forward, right, up); VectorCopy(tempang, ent->s.angles); VectorCopy(ent->s.origin, start); VectorMA(start, 16, forward, start); VectorCopy(start, ent->s.origin); ent->enemy = self->enemy; ent->owner = self; ent->dmg = -1; monster_dabeam(ent); if (self->enemy->health > (self->enemy->mass / 10)) { if (check_telefrag(self)) { self->enemy->spawnflags = 0; self->enemy->monsterinfo.aiflags = 0; self->enemy->target = NULL; self->enemy->targetname = NULL; self->enemy->combattarget = NULL; self->enemy->deathtarget = NULL; self->enemy->owner = self; ED_CallSpawn(self->enemy); self->enemy->owner = NULL; self->s.origin[2] += 1; self->enemy->monsterinfo.aiflags &= ~AI_RESURRECTING; self->monsterinfo.currentmove = &fixbot_move_stand; self->monsterinfo.aiflags &= ~AI_MEDIC; } } else { self->enemy->monsterinfo.aiflags |= AI_RESURRECTING; } } static mframe_t fixbot_frames_laserattack[] = { {ai_charge, 0, fixbot_fire_laser}, {ai_charge, 0, fixbot_fire_laser}, {ai_charge, 0, fixbot_fire_laser}, {ai_charge, 0, fixbot_fire_laser}, {ai_charge, 0, fixbot_fire_laser}, {ai_charge, 0, fixbot_fire_laser} }; mmove_t fixbot_move_laserattack = { FRAME_shoot_01, FRAME_shoot_06, fixbot_frames_laserattack, NULL }; /* need to get forward translation data for the charge attack */ static mframe_t fixbot_frames_attack2[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, -10, NULL}, {ai_charge, -10, NULL}, {ai_charge, -10, NULL}, {ai_charge, -10, NULL}, {ai_charge, -10, NULL}, {ai_charge, -10, NULL}, {ai_charge, -10, NULL}, {ai_charge, -10, NULL}, {ai_charge, -10, NULL}, {ai_charge, -10, NULL}, {ai_charge, 0, fixbot_fire_blaster}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t fixbot_move_attack2 = { FRAME_charging_01, FRAME_charging_31, fixbot_frames_attack2, fixbot_run }; void weldstate(edict_t *self) { if (!self) { return; } if (self->s.frame == FRAME_weldstart_10) { self->monsterinfo.currentmove = &fixbot_move_weld; } else if (self->s.frame == FRAME_weldmiddle_07) { if (self->goalentity->health < 0) { self->enemy->owner = NULL; self->monsterinfo.currentmove = &fixbot_move_weld_end; } else { self->goalentity->health -= 10; } } else { self->goalentity = self->enemy = NULL; self->monsterinfo.currentmove = &fixbot_move_stand; } } void ai_move2(edict_t *self, float dist) { vec3_t v; if (!self) { return; } if (dist) { M_walkmove(self, self->s.angles[YAW], dist); } VectorSubtract(self->goalentity->s.origin, self->s.origin, v); self->ideal_yaw = vectoyaw(v); M_ChangeYaw(self); } static mframe_t fixbot_frames_weld_start[] = { {ai_move2, 0, NULL}, {ai_move2, 0, NULL}, {ai_move2, 0, NULL}, {ai_move2, 0, NULL}, {ai_move2, 0, NULL}, {ai_move2, 0, NULL}, {ai_move2, 0, NULL}, {ai_move2, 0, NULL}, {ai_move2, 0, NULL}, {ai_move2, 0, weldstate} }; mmove_t fixbot_move_weld_start = { FRAME_weldstart_01, FRAME_weldstart_10, fixbot_frames_weld_start, NULL }; static mframe_t fixbot_frames_weld[] = { {ai_move2, 0, fixbot_fire_welder}, {ai_move2, 0, fixbot_fire_welder}, {ai_move2, 0, fixbot_fire_welder}, {ai_move2, 0, fixbot_fire_welder}, {ai_move2, 0, fixbot_fire_welder}, {ai_move2, 0, fixbot_fire_welder}, {ai_move2, 0, weldstate} }; mmove_t fixbot_move_weld = { FRAME_weldmiddle_01, FRAME_weldmiddle_07, fixbot_frames_weld, NULL }; static mframe_t fixbot_frames_weld_end[] = { {ai_move2, -2, NULL}, {ai_move2, -2, NULL}, {ai_move2, -2, NULL}, {ai_move2, -2, NULL}, {ai_move2, -2, NULL}, {ai_move2, -2, NULL}, {ai_move2, -2, weldstate} }; mmove_t fixbot_move_weld_end = { FRAME_weldend_01, FRAME_weldend_07, fixbot_frames_weld_end, NULL }; void fixbot_fire_welder(edict_t *self) { vec3_t start; vec3_t forward, right, up; vec3_t vec; float r; if (!self) { return; } if (!self->enemy) { return; } vec[0] = 24.0; vec[1] = -0.8; vec[2] = -10.0; AngleVectors(self->s.angles, forward, right, up); G_ProjectSource(self->s.origin, vec, forward, right, start); gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_WELDING_SPARKS); gi.WriteByte(10); gi.WritePosition(start); gi.WriteDir(vec3_origin); gi.WriteByte(0xe0 + (rand() & 7)); gi.multicast(self->s.origin, MULTICAST_PVS); if (random() > 0.8) { r = random(); if (r < 0.33) { gi.sound(self, CHAN_VOICE, sound_weld1, 1, ATTN_IDLE, 0); } else if (r < 0.66) { gi.sound(self, CHAN_VOICE, sound_weld2, 1, ATTN_IDLE, 0); } else { gi.sound(self, CHAN_VOICE, sound_weld3, 1, ATTN_IDLE, 0); } } } void fixbot_fire_blaster(edict_t *self) { vec3_t start; vec3_t forward, right, up; vec3_t end; vec3_t dir; if (!self) { return; } if (!visible(self, self->enemy)) { self->monsterinfo.currentmove = &fixbot_move_run; } AngleVectors(self->s.angles, forward, right, up); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_fixbot_BLASTER_1], forward, right, start); VectorCopy(self->enemy->s.origin, end); end[2] += self->enemy->viewheight; VectorSubtract(end, start, dir); monster_fire_blaster(self, start, dir, 15, 1000, MZ2_fixbot_BLASTER_1, EF_BLASTER); } void fixbot_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &fixbot_move_stand; } void fixbot_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &fixbot_move_stand; } else { self->monsterinfo.currentmove = &fixbot_move_run; } } void fixbot_walk(edict_t *self) { vec3_t vec; int len; if (!self) { return; } if (strcmp(self->goalentity->classname, "object_repair") == 0) { VectorSubtract(self->s.origin, self->goalentity->s.origin, vec); len = VectorLength(vec); if (len < 32) { self->monsterinfo.currentmove = &fixbot_move_weld_start; return; } } self->monsterinfo.currentmove = &fixbot_move_walk; } void fixbot_start_attack(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &fixbot_move_start_attack; } void fixbot_attack(edict_t *self) { vec3_t vec; int len; if (!self) { return; } if (self->monsterinfo.aiflags & AI_MEDIC) { if (!visible(self, self->goalentity)) { return; } VectorSubtract(self->s.origin, self->enemy->s.origin, vec); len = VectorLength(vec); if (len > 128) { return; } else { self->monsterinfo.currentmove = &fixbot_move_laserattack; } } else { self->monsterinfo.currentmove = &fixbot_move_attack2; } } void fixbot_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage /* unused */) { if (!self) { return; } if (level.time < self->pain_debounce_time) { return; } self->pain_debounce_time = level.time + 3; gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); if (damage <= 10) { self->monsterinfo.currentmove = &fixbot_move_pain3; } else if (damage <= 25) { self->monsterinfo.currentmove = &fixbot_move_painb; } else { self->monsterinfo.currentmove = &fixbot_move_paina; } } void fixbot_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, -8); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } void fixbot_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage /* unused */, vec3_t point /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_die, 1, ATTN_NORM, 0); BecomeExplosion1(self); } /* * QUAKED monster_fixbot (1 .5 0) (-32 -32 -24) (32 32 24) Ambush Trigger_Spawn Fixit Takeoff Landing */ void SP_monster_fixbot(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } sound_pain1 = gi.soundindex("flyer/flypain1.wav"); sound_die = gi.soundindex("flyer/flydeth1.wav"); sound_weld1 = gi.soundindex("misc/welder1.wav"); sound_weld2 = gi.soundindex("misc/welder2.wav"); sound_weld3 = gi.soundindex("misc/welder3.wav"); self->s.modelindex = gi.modelindex("models/monsters/fixbot/tris.md2"); VectorSet(self->mins, -32, -32, -24); VectorSet(self->maxs, 32, 32, 24); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->health = 150; self->mass = 150; self->viewheight = 16; self->pain = fixbot_pain; self->die = fixbot_die; self->monsterinfo.stand = fixbot_stand; self->monsterinfo.walk = fixbot_walk; self->monsterinfo.run = fixbot_run; self->monsterinfo.attack = fixbot_attack; gi.linkentity(self); self->monsterinfo.currentmove = &fixbot_move_stand; self->monsterinfo.scale = MODEL_SCALE; flymonster_start(self); } xatrix-XATRIX_2_14/src/monster/fixbot/fixbot.h000066400000000000000000000141761477320050300213660ustar00rootroot00000000000000/* ======================================================================= * * Fixbot animations * * ======================================================================= */ #define FRAME_charging_01 0 #define FRAME_charging_02 1 #define FRAME_charging_03 2 #define FRAME_charging_04 3 #define FRAME_charging_05 4 #define FRAME_charging_06 5 #define FRAME_charging_07 6 #define FRAME_charging_08 7 #define FRAME_charging_09 8 #define FRAME_charging_10 9 #define FRAME_charging_11 10 #define FRAME_charging_12 11 #define FRAME_charging_13 12 #define FRAME_charging_14 13 #define FRAME_charging_15 14 #define FRAME_charging_16 15 #define FRAME_charging_17 16 #define FRAME_charging_18 17 #define FRAME_charging_19 18 #define FRAME_charging_20 19 #define FRAME_charging_21 20 #define FRAME_charging_22 21 #define FRAME_charging_23 22 #define FRAME_charging_24 23 #define FRAME_charging_25 24 #define FRAME_charging_26 25 #define FRAME_charging_27 26 #define FRAME_charging_28 27 #define FRAME_charging_29 28 #define FRAME_charging_30 29 #define FRAME_charging_31 30 #define FRAME_landing_01 31 #define FRAME_landing_02 32 #define FRAME_landing_03 33 #define FRAME_landing_04 34 #define FRAME_landing_05 35 #define FRAME_landing_06 36 #define FRAME_landing_07 37 #define FRAME_landing_08 38 #define FRAME_landing_09 39 #define FRAME_landing_10 40 #define FRAME_landing_11 41 #define FRAME_landing_12 42 #define FRAME_landing_13 43 #define FRAME_landing_14 44 #define FRAME_landing_15 45 #define FRAME_landing_16 46 #define FRAME_landing_17 47 #define FRAME_landing_18 48 #define FRAME_landing_19 49 #define FRAME_landing_20 50 #define FRAME_landing_21 51 #define FRAME_landing_22 52 #define FRAME_landing_23 53 #define FRAME_landing_24 54 #define FRAME_landing_25 55 #define FRAME_landing_26 56 #define FRAME_landing_27 57 #define FRAME_landing_28 58 #define FRAME_landing_29 59 #define FRAME_landing_30 60 #define FRAME_landing_31 61 #define FRAME_landing_32 62 #define FRAME_landing_33 63 #define FRAME_landing_34 64 #define FRAME_landing_35 65 #define FRAME_landing_36 66 #define FRAME_landing_37 67 #define FRAME_landing_38 68 #define FRAME_landing_39 69 #define FRAME_landing_40 70 #define FRAME_landing_41 71 #define FRAME_landing_42 72 #define FRAME_landing_43 73 #define FRAME_landing_44 74 #define FRAME_landing_45 75 #define FRAME_landing_46 76 #define FRAME_landing_47 77 #define FRAME_landing_48 78 #define FRAME_landing_49 79 #define FRAME_landing_50 80 #define FRAME_landing_51 81 #define FRAME_landing_52 82 #define FRAME_landing_53 83 #define FRAME_landing_54 84 #define FRAME_landing_55 85 #define FRAME_landing_56 86 #define FRAME_landing_57 87 #define FRAME_landing_58 88 #define FRAME_pushback_01 89 #define FRAME_pushback_02 90 #define FRAME_pushback_03 91 #define FRAME_pushback_04 92 #define FRAME_pushback_05 93 #define FRAME_pushback_06 94 #define FRAME_pushback_07 95 #define FRAME_pushback_08 96 #define FRAME_pushback_09 97 #define FRAME_pushback_10 98 #define FRAME_pushback_11 99 #define FRAME_pushback_12 100 #define FRAME_pushback_13 101 #define FRAME_pushback_14 102 #define FRAME_pushback_15 103 #define FRAME_pushback_16 104 #define FRAME_takeoff_01 105 #define FRAME_takeoff_02 106 #define FRAME_takeoff_03 107 #define FRAME_takeoff_04 108 #define FRAME_takeoff_05 109 #define FRAME_takeoff_06 110 #define FRAME_takeoff_07 111 #define FRAME_takeoff_08 112 #define FRAME_takeoff_09 113 #define FRAME_takeoff_10 114 #define FRAME_takeoff_11 115 #define FRAME_takeoff_12 116 #define FRAME_takeoff_13 117 #define FRAME_takeoff_14 118 #define FRAME_takeoff_15 119 #define FRAME_takeoff_16 120 #define FRAME_ambient_01 121 #define FRAME_ambient_02 122 #define FRAME_ambient_03 123 #define FRAME_ambient_04 124 #define FRAME_ambient_05 125 #define FRAME_ambient_06 126 #define FRAME_ambient_07 127 #define FRAME_ambient_08 128 #define FRAME_ambient_09 129 #define FRAME_ambient_10 130 #define FRAME_ambient_11 131 #define FRAME_ambient_12 132 #define FRAME_ambient_13 133 #define FRAME_ambient_14 134 #define FRAME_ambient_15 135 #define FRAME_ambient_16 136 #define FRAME_ambient_17 137 #define FRAME_ambient_18 138 #define FRAME_ambient_19 139 #define FRAME_paina_01 140 #define FRAME_paina_02 141 #define FRAME_paina_03 142 #define FRAME_paina_04 143 #define FRAME_paina_05 144 #define FRAME_paina_06 145 #define FRAME_painb_01 146 #define FRAME_painb_02 147 #define FRAME_painb_03 148 #define FRAME_painb_04 149 #define FRAME_painb_05 150 #define FRAME_painb_06 151 #define FRAME_painb_07 152 #define FRAME_painb_08 153 #define FRAME_pickup_01 154 #define FRAME_pickup_02 155 #define FRAME_pickup_03 156 #define FRAME_pickup_04 157 #define FRAME_pickup_05 158 #define FRAME_pickup_06 159 #define FRAME_pickup_07 160 #define FRAME_pickup_08 161 #define FRAME_pickup_09 162 #define FRAME_pickup_10 163 #define FRAME_pickup_11 164 #define FRAME_pickup_12 165 #define FRAME_pickup_13 166 #define FRAME_pickup_14 167 #define FRAME_pickup_15 168 #define FRAME_pickup_16 169 #define FRAME_pickup_17 170 #define FRAME_pickup_18 171 #define FRAME_pickup_19 172 #define FRAME_pickup_20 173 #define FRAME_pickup_21 174 #define FRAME_pickup_22 175 #define FRAME_pickup_23 176 #define FRAME_pickup_24 177 #define FRAME_pickup_25 178 #define FRAME_pickup_26 179 #define FRAME_pickup_27 180 #define FRAME_freeze_01 181 #define FRAME_shoot_01 182 #define FRAME_shoot_02 183 #define FRAME_shoot_03 184 #define FRAME_shoot_04 185 #define FRAME_shoot_05 186 #define FRAME_shoot_06 187 #define FRAME_weldstart_01 188 #define FRAME_weldstart_02 189 #define FRAME_weldstart_03 190 #define FRAME_weldstart_04 191 #define FRAME_weldstart_05 192 #define FRAME_weldstart_06 193 #define FRAME_weldstart_07 194 #define FRAME_weldstart_08 195 #define FRAME_weldstart_09 196 #define FRAME_weldstart_10 197 #define FRAME_weldmiddle_01 198 #define FRAME_weldmiddle_02 199 #define FRAME_weldmiddle_03 200 #define FRAME_weldmiddle_04 201 #define FRAME_weldmiddle_05 202 #define FRAME_weldmiddle_06 203 #define FRAME_weldmiddle_07 204 #define FRAME_weldend_01 205 #define FRAME_weldend_02 206 #define FRAME_weldend_03 207 #define FRAME_weldend_04 208 #define FRAME_weldend_05 209 #define FRAME_weldend_06 210 #define FRAME_weldend_07 211 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/flipper/000077500000000000000000000000001477320050300200575ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/flipper/flipper.c000066400000000000000000000237221477320050300216720ustar00rootroot00000000000000/* ======================================================================= * * Baracuda Shark. * * ======================================================================= */ #include "../../header/local.h" #include "flipper.h" #define FLIPPER_RUN_SPEED 24 static int sound_chomp; static int sound_attack; static int sound_pain1; static int sound_pain2; static int sound_death; static int sound_idle; static int sound_search; static int sound_sight; void flipper_stand(edict_t *self); static mframe_t flipper_frames_stand[] = { {ai_stand, 0, NULL} }; mmove_t flipper_move_stand = { FRAME_flphor01, FRAME_flphor01, flipper_frames_stand, NULL }; void flipper_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &flipper_move_stand; } static mframe_t flipper_frames_run[] = { {ai_run, FLIPPER_RUN_SPEED, NULL}, /* 6 */ {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, /* 10 */ {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, /* 20 */ {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL} /* 29 */ }; mmove_t flipper_move_run_loop = { FRAME_flpver06, FRAME_flpver29, flipper_frames_run, NULL }; void flipper_run_loop(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &flipper_move_run_loop; } static mframe_t flipper_frames_run_start[] = { {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL} }; mmove_t flipper_move_run_start = { FRAME_flpver01, FRAME_flpver06, flipper_frames_run_start, flipper_run_loop }; void flipper_run(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &flipper_move_run_start; } /* Standard Swimming */ static mframe_t flipper_frames_walk[] = { {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL} }; mmove_t flipper_move_walk = { FRAME_flphor01, FRAME_flphor24, flipper_frames_walk, NULL }; void flipper_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &flipper_move_walk; } static mframe_t flipper_frames_start_run[] = { {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, flipper_run} }; mmove_t flipper_move_start_run = { FRAME_flphor01, FRAME_flphor05, flipper_frames_start_run, NULL }; void flipper_start_run(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &flipper_move_start_run; } static mframe_t flipper_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t flipper_move_pain2 = { FRAME_flppn101, FRAME_flppn105, flipper_frames_pain2, flipper_run }; static mframe_t flipper_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t flipper_move_pain1 = { FRAME_flppn201, FRAME_flppn205, flipper_frames_pain1, flipper_run }; void flipper_bite(edict_t *self) { vec3_t aim; if (!self) { return; } VectorSet(aim, MELEE_DISTANCE, 0, 0); fire_hit(self, aim, 5, 0); } void flipper_preattack(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_chomp, 1, ATTN_NORM, 0); } static mframe_t flipper_frames_attack[] = { {ai_charge, 0, flipper_preattack}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, flipper_bite}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, flipper_bite}, {ai_charge, 0, NULL} }; mmove_t flipper_move_attack = { FRAME_flpbit01, FRAME_flpbit20, flipper_frames_attack, flipper_run }; void flipper_melee(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &flipper_move_attack; } void flipper_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { int n; if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } self->pain_debounce_time = level.time + 3; if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } n = (rand() + 1) % 2; if (n == 0) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &flipper_move_pain1; } else { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &flipper_move_pain2; } } void flipper_dead(edict_t *self) { vec3_t p; trace_t tr; if (!self) { return; } /* original dead bbox was wrong - and make sure the bbox adjustment stays in solidity */ p[0] = self->s.origin[0]; p[1] = self->s.origin[1]; p[2] = self->s.origin[2] - 8; tr = gi.trace(self->s.origin, self->mins, self->maxs, p, self, self->clipmask); self->mins[2] = tr.endpos[2] - self->s.origin[2]; self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } static mframe_t flipper_frames_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t flipper_move_death = { FRAME_flpdth01, FRAME_flpdth56, flipper_frames_death, flipper_dead }; void flipper_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); } void flipper_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point /* unused */) { int n; if (!self) { return; } /* check for gib */ if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 2; n++) { ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); } for (n = 0; n < 2; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowHead(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } /* regular death */ gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; self->monsterinfo.currentmove = &flipper_move_death; } /* * QUAKED monster_flipper (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_flipper(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } sound_pain1 = gi.soundindex("flipper/flppain1.wav"); sound_pain2 = gi.soundindex("flipper/flppain2.wav"); sound_death = gi.soundindex("flipper/flpdeth1.wav"); sound_chomp = gi.soundindex("flipper/flpatck1.wav"); sound_attack = gi.soundindex("flipper/flpatck2.wav"); sound_idle = gi.soundindex("flipper/flpidle1.wav"); sound_search = gi.soundindex("flipper/flpsrch1.wav"); sound_sight = gi.soundindex("flipper/flpsght1.wav"); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/flipper/tris.md2"); VectorSet(self->mins, -16, -16, 0); VectorSet(self->maxs, 16, 16, 32); self->health = 50; self->gib_health = -30; self->mass = 100; self->pain = flipper_pain; self->die = flipper_die; self->monsterinfo.stand = flipper_stand; self->monsterinfo.walk = flipper_walk; self->monsterinfo.run = flipper_start_run; self->monsterinfo.melee = flipper_melee; self->monsterinfo.sight = flipper_sight; gi.linkentity(self); self->monsterinfo.currentmove = &flipper_move_stand; self->monsterinfo.scale = MODEL_SCALE; swimmonster_start(self); } xatrix-XATRIX_2_14/src/monster/flipper/flipper.h000066400000000000000000000105201477320050300216670ustar00rootroot00000000000000/* ======================================================================= * * Baracuda Shark animations. * * ======================================================================= */ #define FRAME_flpbit01 0 #define FRAME_flpbit02 1 #define FRAME_flpbit03 2 #define FRAME_flpbit04 3 #define FRAME_flpbit05 4 #define FRAME_flpbit06 5 #define FRAME_flpbit07 6 #define FRAME_flpbit08 7 #define FRAME_flpbit09 8 #define FRAME_flpbit10 9 #define FRAME_flpbit11 10 #define FRAME_flpbit12 11 #define FRAME_flpbit13 12 #define FRAME_flpbit14 13 #define FRAME_flpbit15 14 #define FRAME_flpbit16 15 #define FRAME_flpbit17 16 #define FRAME_flpbit18 17 #define FRAME_flpbit19 18 #define FRAME_flpbit20 19 #define FRAME_flptal01 20 #define FRAME_flptal02 21 #define FRAME_flptal03 22 #define FRAME_flptal04 23 #define FRAME_flptal05 24 #define FRAME_flptal06 25 #define FRAME_flptal07 26 #define FRAME_flptal08 27 #define FRAME_flptal09 28 #define FRAME_flptal10 29 #define FRAME_flptal11 30 #define FRAME_flptal12 31 #define FRAME_flptal13 32 #define FRAME_flptal14 33 #define FRAME_flptal15 34 #define FRAME_flptal16 35 #define FRAME_flptal17 36 #define FRAME_flptal18 37 #define FRAME_flptal19 38 #define FRAME_flptal20 39 #define FRAME_flptal21 40 #define FRAME_flphor01 41 #define FRAME_flphor02 42 #define FRAME_flphor03 43 #define FRAME_flphor04 44 #define FRAME_flphor05 45 #define FRAME_flphor06 46 #define FRAME_flphor07 47 #define FRAME_flphor08 48 #define FRAME_flphor09 49 #define FRAME_flphor10 50 #define FRAME_flphor11 51 #define FRAME_flphor12 52 #define FRAME_flphor13 53 #define FRAME_flphor14 54 #define FRAME_flphor15 55 #define FRAME_flphor16 56 #define FRAME_flphor17 57 #define FRAME_flphor18 58 #define FRAME_flphor19 59 #define FRAME_flphor20 60 #define FRAME_flphor21 61 #define FRAME_flphor22 62 #define FRAME_flphor23 63 #define FRAME_flphor24 64 #define FRAME_flpver01 65 #define FRAME_flpver02 66 #define FRAME_flpver03 67 #define FRAME_flpver04 68 #define FRAME_flpver05 69 #define FRAME_flpver06 70 #define FRAME_flpver07 71 #define FRAME_flpver08 72 #define FRAME_flpver09 73 #define FRAME_flpver10 74 #define FRAME_flpver11 75 #define FRAME_flpver12 76 #define FRAME_flpver13 77 #define FRAME_flpver14 78 #define FRAME_flpver15 79 #define FRAME_flpver16 80 #define FRAME_flpver17 81 #define FRAME_flpver18 82 #define FRAME_flpver19 83 #define FRAME_flpver20 84 #define FRAME_flpver21 85 #define FRAME_flpver22 86 #define FRAME_flpver23 87 #define FRAME_flpver24 88 #define FRAME_flpver25 89 #define FRAME_flpver26 90 #define FRAME_flpver27 91 #define FRAME_flpver28 92 #define FRAME_flpver29 93 #define FRAME_flppn101 94 #define FRAME_flppn102 95 #define FRAME_flppn103 96 #define FRAME_flppn104 97 #define FRAME_flppn105 98 #define FRAME_flppn201 99 #define FRAME_flppn202 100 #define FRAME_flppn203 101 #define FRAME_flppn204 102 #define FRAME_flppn205 103 #define FRAME_flpdth01 104 #define FRAME_flpdth02 105 #define FRAME_flpdth03 106 #define FRAME_flpdth04 107 #define FRAME_flpdth05 108 #define FRAME_flpdth06 109 #define FRAME_flpdth07 110 #define FRAME_flpdth08 111 #define FRAME_flpdth09 112 #define FRAME_flpdth10 113 #define FRAME_flpdth11 114 #define FRAME_flpdth12 115 #define FRAME_flpdth13 116 #define FRAME_flpdth14 117 #define FRAME_flpdth15 118 #define FRAME_flpdth16 119 #define FRAME_flpdth17 120 #define FRAME_flpdth18 121 #define FRAME_flpdth19 122 #define FRAME_flpdth20 123 #define FRAME_flpdth21 124 #define FRAME_flpdth22 125 #define FRAME_flpdth23 126 #define FRAME_flpdth24 127 #define FRAME_flpdth25 128 #define FRAME_flpdth26 129 #define FRAME_flpdth27 130 #define FRAME_flpdth28 131 #define FRAME_flpdth29 132 #define FRAME_flpdth30 133 #define FRAME_flpdth31 134 #define FRAME_flpdth32 135 #define FRAME_flpdth33 136 #define FRAME_flpdth34 137 #define FRAME_flpdth35 138 #define FRAME_flpdth36 139 #define FRAME_flpdth37 140 #define FRAME_flpdth38 141 #define FRAME_flpdth39 142 #define FRAME_flpdth40 143 #define FRAME_flpdth41 144 #define FRAME_flpdth42 145 #define FRAME_flpdth43 146 #define FRAME_flpdth44 147 #define FRAME_flpdth45 148 #define FRAME_flpdth46 149 #define FRAME_flpdth47 150 #define FRAME_flpdth48 151 #define FRAME_flpdth49 152 #define FRAME_flpdth50 153 #define FRAME_flpdth51 154 #define FRAME_flpdth52 155 #define FRAME_flpdth53 156 #define FRAME_flpdth54 157 #define FRAME_flpdth55 158 #define FRAME_flpdth56 159 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/float/000077500000000000000000000000001477320050300175235ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/float/float.c000066400000000000000000000375351477320050300210110ustar00rootroot00000000000000/* ======================================================================= * * Mechanic. * * ======================================================================= */ #include "../../header/local.h" #include "float.h" static int sound_attack2; static int sound_attack3; static int sound_death1; static int sound_idle; static int sound_pain1; static int sound_pain2; static int sound_sight; void floater_dead(edict_t *self); void floater_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point); void floater_run(edict_t *self); void floater_wham(edict_t *self); void floater_zap(edict_t *self); void floater_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); } void floater_idle(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); } void floater_fire_blaster(edict_t *self) { vec3_t start; vec3_t forward, right; vec3_t end; vec3_t dir; int effect; if (!self) { return; } if ((self->s.frame == FRAME_attak104) || (self->s.frame == FRAME_attak107)) { effect = EF_HYPERBLASTER; } else { effect = 0; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_FLOAT_BLASTER_1], forward, right, start); VectorCopy(self->enemy->s.origin, end); end[2] += self->enemy->viewheight; VectorSubtract(end, start, dir); monster_fire_blaster(self, start, dir, 1, 1000, MZ2_FLOAT_BLASTER_1, effect); } static mframe_t floater_frames_stand1[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t floater_move_stand1 = { FRAME_stand101, FRAME_stand152, floater_frames_stand1, NULL }; static mframe_t floater_frames_stand2[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t floater_move_stand2 = { FRAME_stand201, FRAME_stand252, floater_frames_stand2, NULL }; void floater_stand(edict_t *self) { if (!self) { return; } if (random() <= 0.5) { self->monsterinfo.currentmove = &floater_move_stand1; } else { self->monsterinfo.currentmove = &floater_move_stand2; } } static mframe_t floater_frames_activate[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t floater_move_activate = { FRAME_actvat01, FRAME_actvat31, floater_frames_activate, NULL }; static mframe_t floater_frames_attack1[] = { {ai_charge, 0, NULL}, /* Blaster attack */ {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, floater_fire_blaster}, /* BOOM (0, -25.8, 32.5) -- LOOP Starts */ {ai_charge, 0, floater_fire_blaster}, {ai_charge, 0, floater_fire_blaster}, {ai_charge, 0, floater_fire_blaster}, {ai_charge, 0, floater_fire_blaster}, {ai_charge, 0, floater_fire_blaster}, {ai_charge, 0, floater_fire_blaster}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} /* -- LOOP Ends */ }; mmove_t floater_move_attack1 = { FRAME_attak101, FRAME_attak114, floater_frames_attack1, floater_run }; static mframe_t floater_frames_attack2[] = { {ai_charge, 0, NULL}, /* Claws */ {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, floater_wham}, /* WHAM (0, -45, 29}.6) -- LOOP Starts */ {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, /* -- LOOP Ends */ {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t floater_move_attack2 = { FRAME_attak201, FRAME_attak225, floater_frames_attack2, floater_run }; static mframe_t floater_frames_attack3[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, floater_zap}, /* -- LOOP Starts */ {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, /* -- LOOP Ends */ {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t floater_move_attack3 = { FRAME_attak301, FRAME_attak334, floater_frames_attack3, floater_run }; static mframe_t floater_frames_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t floater_move_death = { FRAME_death01, FRAME_death13, floater_frames_death, floater_dead }; static mframe_t floater_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t floater_move_pain1 = { FRAME_pain101, FRAME_pain107, floater_frames_pain1, floater_run }; static mframe_t floater_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t floater_move_pain2 = { FRAME_pain201, FRAME_pain208, floater_frames_pain2, floater_run }; static mframe_t floater_frames_pain3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t floater_move_pain3 = { FRAME_pain301, FRAME_pain312, floater_frames_pain3, floater_run }; static mframe_t floater_frames_walk[] = { {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL} }; mmove_t floater_move_walk = { FRAME_stand101, FRAME_stand152, floater_frames_walk, NULL }; static mframe_t floater_frames_run[] = { {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL} }; mmove_t floater_move_run = { FRAME_stand101, FRAME_stand152, floater_frames_run, NULL }; void floater_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &floater_move_stand1; } else { self->monsterinfo.currentmove = &floater_move_run; } } void floater_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &floater_move_walk; } void floater_wham(edict_t *self) { static vec3_t aim = {MELEE_DISTANCE, 0, 0}; if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_attack3, 1, ATTN_NORM, 0); fire_hit(self, aim, 5 + rand() % 6, -50); } void floater_zap(edict_t *self) { vec3_t forward, right; vec3_t origin; vec3_t dir; vec3_t offset; if (!self) { return; } VectorSubtract(self->enemy->s.origin, self->s.origin, dir); AngleVectors(self->s.angles, forward, right, NULL); VectorSet(offset, 18.5, -0.9, 10); G_ProjectSource(self->s.origin, offset, forward, right, origin); gi.sound(self, CHAN_WEAPON, sound_attack2, 1, ATTN_NORM, 0); gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_SPLASH); gi.WriteByte(32); gi.WritePosition(origin); gi.WriteDir(dir); gi.WriteByte(1); /* sparks */ gi.multicast(origin, MULTICAST_PVS); if (range(self, self->enemy) == RANGE_MELEE && infront(self, self->enemy) && visible(self, self->enemy)) { T_Damage(self->enemy, self, self, dir, self->enemy->s.origin, vec3_origin, 5 + rand() % 6, -10, DAMAGE_ENERGY, MOD_UNKNOWN); } } void floater_attack(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &floater_move_attack1; } void floater_melee(edict_t *self) { if (!self) { return; } if (random() < 0.5) { self->monsterinfo.currentmove = &floater_move_attack3; } else { self->monsterinfo.currentmove = &floater_move_attack2; } } void floater_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { int n; if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } self->pain_debounce_time = level.time + 3; if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } n = (rand() + 1) % 3; if (n == 0) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &floater_move_pain1; } else { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &floater_move_pain2; } } void floater_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, -8); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } void floater_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage /* unused */, vec3_t point /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_death1, 1, ATTN_NORM, 0); BecomeExplosion1(self); } /* * QUAKED monster_floater (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_floater(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } sound_attack2 = gi.soundindex("floater/fltatck2.wav"); sound_attack3 = gi.soundindex("floater/fltatck3.wav"); sound_death1 = gi.soundindex("floater/fltdeth1.wav"); sound_idle = gi.soundindex("floater/fltidle1.wav"); sound_pain1 = gi.soundindex("floater/fltpain1.wav"); sound_pain2 = gi.soundindex("floater/fltpain2.wav"); sound_sight = gi.soundindex("floater/fltsght1.wav"); gi.soundindex("floater/fltatck1.wav"); self->s.sound = gi.soundindex("floater/fltsrch1.wav"); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/float/tris.md2"); VectorSet(self->mins, -24, -24, -24); VectorSet(self->maxs, 24, 24, 32); self->health = 200; self->gib_health = -80; self->mass = 300; self->pain = floater_pain; self->die = floater_die; self->monsterinfo.stand = floater_stand; self->monsterinfo.walk = floater_walk; self->monsterinfo.run = floater_run; self->monsterinfo.attack = floater_attack; self->monsterinfo.melee = floater_melee; self->monsterinfo.sight = floater_sight; self->monsterinfo.idle = floater_idle; gi.linkentity(self); if (random() <= 0.5) { self->monsterinfo.currentmove = &floater_move_stand1; } else { self->monsterinfo.currentmove = &floater_move_stand2; } self->monsterinfo.scale = MODEL_SCALE; flymonster_start(self); } xatrix-XATRIX_2_14/src/monster/float/float.h000066400000000000000000000151511477320050300210040ustar00rootroot00000000000000/* ======================================================================= * * Mechanic animations. * * ======================================================================= */ #define FRAME_actvat01 0 #define FRAME_actvat02 1 #define FRAME_actvat03 2 #define FRAME_actvat04 3 #define FRAME_actvat05 4 #define FRAME_actvat06 5 #define FRAME_actvat07 6 #define FRAME_actvat08 7 #define FRAME_actvat09 8 #define FRAME_actvat10 9 #define FRAME_actvat11 10 #define FRAME_actvat12 11 #define FRAME_actvat13 12 #define FRAME_actvat14 13 #define FRAME_actvat15 14 #define FRAME_actvat16 15 #define FRAME_actvat17 16 #define FRAME_actvat18 17 #define FRAME_actvat19 18 #define FRAME_actvat20 19 #define FRAME_actvat21 20 #define FRAME_actvat22 21 #define FRAME_actvat23 22 #define FRAME_actvat24 23 #define FRAME_actvat25 24 #define FRAME_actvat26 25 #define FRAME_actvat27 26 #define FRAME_actvat28 27 #define FRAME_actvat29 28 #define FRAME_actvat30 29 #define FRAME_actvat31 30 #define FRAME_attak101 31 #define FRAME_attak102 32 #define FRAME_attak103 33 #define FRAME_attak104 34 #define FRAME_attak105 35 #define FRAME_attak106 36 #define FRAME_attak107 37 #define FRAME_attak108 38 #define FRAME_attak109 39 #define FRAME_attak110 40 #define FRAME_attak111 41 #define FRAME_attak112 42 #define FRAME_attak113 43 #define FRAME_attak114 44 #define FRAME_attak201 45 #define FRAME_attak202 46 #define FRAME_attak203 47 #define FRAME_attak204 48 #define FRAME_attak205 49 #define FRAME_attak206 50 #define FRAME_attak207 51 #define FRAME_attak208 52 #define FRAME_attak209 53 #define FRAME_attak210 54 #define FRAME_attak211 55 #define FRAME_attak212 56 #define FRAME_attak213 57 #define FRAME_attak214 58 #define FRAME_attak215 59 #define FRAME_attak216 60 #define FRAME_attak217 61 #define FRAME_attak218 62 #define FRAME_attak219 63 #define FRAME_attak220 64 #define FRAME_attak221 65 #define FRAME_attak222 66 #define FRAME_attak223 67 #define FRAME_attak224 68 #define FRAME_attak225 69 #define FRAME_attak301 70 #define FRAME_attak302 71 #define FRAME_attak303 72 #define FRAME_attak304 73 #define FRAME_attak305 74 #define FRAME_attak306 75 #define FRAME_attak307 76 #define FRAME_attak308 77 #define FRAME_attak309 78 #define FRAME_attak310 79 #define FRAME_attak311 80 #define FRAME_attak312 81 #define FRAME_attak313 82 #define FRAME_attak314 83 #define FRAME_attak315 84 #define FRAME_attak316 85 #define FRAME_attak317 86 #define FRAME_attak318 87 #define FRAME_attak319 88 #define FRAME_attak320 89 #define FRAME_attak321 90 #define FRAME_attak322 91 #define FRAME_attak323 92 #define FRAME_attak324 93 #define FRAME_attak325 94 #define FRAME_attak326 95 #define FRAME_attak327 96 #define FRAME_attak328 97 #define FRAME_attak329 98 #define FRAME_attak330 99 #define FRAME_attak331 100 #define FRAME_attak332 101 #define FRAME_attak333 102 #define FRAME_attak334 103 #define FRAME_death01 104 #define FRAME_death02 105 #define FRAME_death03 106 #define FRAME_death04 107 #define FRAME_death05 108 #define FRAME_death06 109 #define FRAME_death07 110 #define FRAME_death08 111 #define FRAME_death09 112 #define FRAME_death10 113 #define FRAME_death11 114 #define FRAME_death12 115 #define FRAME_death13 116 #define FRAME_pain101 117 #define FRAME_pain102 118 #define FRAME_pain103 119 #define FRAME_pain104 120 #define FRAME_pain105 121 #define FRAME_pain106 122 #define FRAME_pain107 123 #define FRAME_pain201 124 #define FRAME_pain202 125 #define FRAME_pain203 126 #define FRAME_pain204 127 #define FRAME_pain205 128 #define FRAME_pain206 129 #define FRAME_pain207 130 #define FRAME_pain208 131 #define FRAME_pain301 132 #define FRAME_pain302 133 #define FRAME_pain303 134 #define FRAME_pain304 135 #define FRAME_pain305 136 #define FRAME_pain306 137 #define FRAME_pain307 138 #define FRAME_pain308 139 #define FRAME_pain309 140 #define FRAME_pain310 141 #define FRAME_pain311 142 #define FRAME_pain312 143 #define FRAME_stand101 144 #define FRAME_stand102 145 #define FRAME_stand103 146 #define FRAME_stand104 147 #define FRAME_stand105 148 #define FRAME_stand106 149 #define FRAME_stand107 150 #define FRAME_stand108 151 #define FRAME_stand109 152 #define FRAME_stand110 153 #define FRAME_stand111 154 #define FRAME_stand112 155 #define FRAME_stand113 156 #define FRAME_stand114 157 #define FRAME_stand115 158 #define FRAME_stand116 159 #define FRAME_stand117 160 #define FRAME_stand118 161 #define FRAME_stand119 162 #define FRAME_stand120 163 #define FRAME_stand121 164 #define FRAME_stand122 165 #define FRAME_stand123 166 #define FRAME_stand124 167 #define FRAME_stand125 168 #define FRAME_stand126 169 #define FRAME_stand127 170 #define FRAME_stand128 171 #define FRAME_stand129 172 #define FRAME_stand130 173 #define FRAME_stand131 174 #define FRAME_stand132 175 #define FRAME_stand133 176 #define FRAME_stand134 177 #define FRAME_stand135 178 #define FRAME_stand136 179 #define FRAME_stand137 180 #define FRAME_stand138 181 #define FRAME_stand139 182 #define FRAME_stand140 183 #define FRAME_stand141 184 #define FRAME_stand142 185 #define FRAME_stand143 186 #define FRAME_stand144 187 #define FRAME_stand145 188 #define FRAME_stand146 189 #define FRAME_stand147 190 #define FRAME_stand148 191 #define FRAME_stand149 192 #define FRAME_stand150 193 #define FRAME_stand151 194 #define FRAME_stand152 195 #define FRAME_stand201 196 #define FRAME_stand202 197 #define FRAME_stand203 198 #define FRAME_stand204 199 #define FRAME_stand205 200 #define FRAME_stand206 201 #define FRAME_stand207 202 #define FRAME_stand208 203 #define FRAME_stand209 204 #define FRAME_stand210 205 #define FRAME_stand211 206 #define FRAME_stand212 207 #define FRAME_stand213 208 #define FRAME_stand214 209 #define FRAME_stand215 210 #define FRAME_stand216 211 #define FRAME_stand217 212 #define FRAME_stand218 213 #define FRAME_stand219 214 #define FRAME_stand220 215 #define FRAME_stand221 216 #define FRAME_stand222 217 #define FRAME_stand223 218 #define FRAME_stand224 219 #define FRAME_stand225 220 #define FRAME_stand226 221 #define FRAME_stand227 222 #define FRAME_stand228 223 #define FRAME_stand229 224 #define FRAME_stand230 225 #define FRAME_stand231 226 #define FRAME_stand232 227 #define FRAME_stand233 228 #define FRAME_stand234 229 #define FRAME_stand235 230 #define FRAME_stand236 231 #define FRAME_stand237 232 #define FRAME_stand238 233 #define FRAME_stand239 234 #define FRAME_stand240 235 #define FRAME_stand241 236 #define FRAME_stand242 237 #define FRAME_stand243 238 #define FRAME_stand244 239 #define FRAME_stand245 240 #define FRAME_stand246 241 #define FRAME_stand247 242 #define FRAME_stand248 243 #define FRAME_stand249 244 #define FRAME_stand250 245 #define FRAME_stand251 246 #define FRAME_stand252 247 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/flyer/000077500000000000000000000000001477320050300175375ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/flyer/flyer.c000066400000000000000000000353751477320050300210410ustar00rootroot00000000000000/* ======================================================================= * * Flyer. * * ======================================================================= */ #include "../../header/local.h" #include "flyer.h" qboolean visible(edict_t *self, edict_t *other); static int nextmove; /* Used for start/stop frames */ static int sound_sight; static int sound_idle; static int sound_pain1; static int sound_pain2; static int sound_slash; static int sound_sproing; static int sound_die; void flyer_check_melee(edict_t *self); void flyer_loop_melee(edict_t *self); void flyer_melee(edict_t *self); void flyer_setstart(edict_t *self); void flyer_stand(edict_t *self); void flyer_nextmove(edict_t *self); void flyer_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); } void flyer_idle(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); } void flyer_pop_blades(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sproing, 1, ATTN_NORM, 0); } static mframe_t flyer_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t flyer_move_stand = { FRAME_stand01, FRAME_stand45, flyer_frames_stand, NULL }; static mframe_t flyer_frames_walk[] = { {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL} }; mmove_t flyer_move_walk = { FRAME_stand01, FRAME_stand45, flyer_frames_walk, NULL }; static mframe_t flyer_frames_run[] = { {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL} }; mmove_t flyer_move_run = { FRAME_stand01, FRAME_stand45, flyer_frames_run, NULL }; void flyer_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &flyer_move_stand; } else { self->monsterinfo.currentmove = &flyer_move_run; } } void flyer_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &flyer_move_walk; } void flyer_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &flyer_move_stand; } static mframe_t flyer_frames_start[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, flyer_nextmove} }; mmove_t flyer_move_start = { FRAME_start01, FRAME_start06, flyer_frames_start, NULL }; static mframe_t flyer_frames_stop[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, flyer_nextmove} }; mmove_t flyer_move_stop = { FRAME_stop01, FRAME_stop07, flyer_frames_stop, NULL }; void flyer_stop(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &flyer_move_stop; } void flyer_start(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &flyer_move_start; } static mframe_t flyer_frames_rollright[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t flyer_move_rollright = { FRAME_rollr01, FRAME_rollr09, flyer_frames_rollright, NULL }; static mframe_t flyer_frames_rollleft[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t flyer_move_rollleft = { FRAME_rollf01, FRAME_rollf09, flyer_frames_rollleft, NULL }; static mframe_t flyer_frames_pain3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t flyer_move_pain3 = { FRAME_pain301, FRAME_pain304, flyer_frames_pain3, flyer_run }; static mframe_t flyer_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t flyer_move_pain2 = { FRAME_pain201, FRAME_pain204, flyer_frames_pain2, flyer_run }; static mframe_t flyer_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t flyer_move_pain1 = { FRAME_pain101, FRAME_pain109, flyer_frames_pain1, flyer_run }; static mframe_t flyer_frames_defense[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* Hold this frame */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t flyer_move_defense = { FRAME_defens01, FRAME_defens06, flyer_frames_defense, NULL }; static mframe_t flyer_frames_bankright[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t flyer_move_bankright = { FRAME_bankr01, FRAME_bankr07, flyer_frames_bankright, NULL }; static mframe_t flyer_frames_bankleft[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t flyer_move_bankleft = { FRAME_bankl01, FRAME_bankl07, flyer_frames_bankleft, NULL }; void flyer_fire(edict_t *self, int flash_number) { vec3_t start; vec3_t forward, right; vec3_t end; vec3_t dir; int effect; if (!self) { return; } if ((self->s.frame == FRAME_attak204) || (self->s.frame == FRAME_attak207) || (self->s.frame == FRAME_attak210)) { effect = EF_HYPERBLASTER; } else { effect = 0; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], forward, right, start); VectorCopy(self->enemy->s.origin, end); end[2] += self->enemy->viewheight; VectorSubtract(end, start, dir); monster_fire_blaster(self, start, dir, 1, 1000, flash_number, effect); } void flyer_fireleft(edict_t *self) { if (!self) { return; } flyer_fire(self, MZ2_FLYER_BLASTER_1); } void flyer_fireright(edict_t *self) { if (!self) { return; } flyer_fire(self, MZ2_FLYER_BLASTER_2); } static mframe_t flyer_frames_attack2[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, -10, flyer_fireleft}, /* left gun */ {ai_charge, -10, flyer_fireright}, /* right gun */ {ai_charge, -10, flyer_fireleft}, /* left gun */ {ai_charge, -10, flyer_fireright}, /* right gun */ {ai_charge, -10, flyer_fireleft}, /* left gun */ {ai_charge, -10, flyer_fireright}, /* right gun */ {ai_charge, -10, flyer_fireleft}, /* left gun */ {ai_charge, -10, flyer_fireright}, /* right gun */ {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t flyer_move_attack2 = { FRAME_attak201, FRAME_attak217, flyer_frames_attack2, flyer_run }; void flyer_slash_left(edict_t *self) { vec3_t aim; if (!self) { return; } VectorSet(aim, MELEE_DISTANCE, self->mins[0], 0); fire_hit(self, aim, 5, 0); gi.sound(self, CHAN_WEAPON, sound_slash, 1, ATTN_NORM, 0); } void flyer_slash_right(edict_t *self) { vec3_t aim; if (!self) { return; } VectorSet(aim, MELEE_DISTANCE, self->maxs[0], 0); fire_hit(self, aim, 5, 0); gi.sound(self, CHAN_WEAPON, sound_slash, 1, ATTN_NORM, 0); } static mframe_t flyer_frames_start_melee[] = { {ai_charge, 0, flyer_pop_blades}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t flyer_move_start_melee = { FRAME_attak101, FRAME_attak106, flyer_frames_start_melee, flyer_loop_melee }; static mframe_t flyer_frames_end_melee[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t flyer_move_end_melee = { FRAME_attak119, FRAME_attak121, flyer_frames_end_melee, flyer_run }; static mframe_t flyer_frames_loop_melee[] = { {ai_charge, 0, NULL}, /* Loop Start */ {ai_charge, 0, NULL}, {ai_charge, 0, flyer_slash_left}, /* Left Wing Strike */ {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, flyer_slash_right}, /* Right Wing Strike */ {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} /* Loop Ends */ }; mmove_t flyer_move_loop_melee = { FRAME_attak107, FRAME_attak118, flyer_frames_loop_melee, flyer_check_melee }; void flyer_loop_melee(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &flyer_move_loop_melee; } void flyer_attack(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &flyer_move_attack2; } void flyer_setstart(edict_t *self) { if (!self) { return; } nextmove = ACTION_run; self->monsterinfo.currentmove = &flyer_move_start; } void flyer_nextmove(edict_t *self) { if (!self) { return; } if (nextmove == ACTION_attack1) { self->monsterinfo.currentmove = &flyer_move_start_melee; } else if (nextmove == ACTION_attack2) { self->monsterinfo.currentmove = &flyer_move_attack2; } else if (nextmove == ACTION_run) { self->monsterinfo.currentmove = &flyer_move_run; } } void flyer_melee(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &flyer_move_start_melee; } void flyer_check_melee(edict_t *self) { if (!self) { return; } if (range(self, self->enemy) == RANGE_MELEE) { if (random() <= 0.8) { self->monsterinfo.currentmove = &flyer_move_loop_melee; } else { self->monsterinfo.currentmove = &flyer_move_end_melee; } } else { self->monsterinfo.currentmove = &flyer_move_end_melee; } } void flyer_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { int n; if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } self->pain_debounce_time = level.time + 3; if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } n = rand() % 3; if (n == 0) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &flyer_move_pain1; } else if (n == 1) { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &flyer_move_pain2; } else { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &flyer_move_pain3; } } void flyer_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage /* unused */, vec3_t point /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_die, 1, ATTN_NORM, 0); BecomeExplosion1(self); } /* * QUAKED monster_flyer (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_flyer(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } sound_sight = gi.soundindex("flyer/flysght1.wav"); sound_idle = gi.soundindex("flyer/flysrch1.wav"); sound_pain1 = gi.soundindex("flyer/flypain1.wav"); sound_pain2 = gi.soundindex("flyer/flypain2.wav"); sound_slash = gi.soundindex("flyer/flyatck2.wav"); sound_sproing = gi.soundindex("flyer/flyatck1.wav"); sound_die = gi.soundindex("flyer/flydeth1.wav"); gi.soundindex("flyer/flyatck3.wav"); self->s.modelindex = gi.modelindex("models/monsters/flyer/tris.md2"); VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, 32); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.sound = gi.soundindex("flyer/flyidle1.wav"); self->health = 50; self->mass = 50; self->pain = flyer_pain; self->die = flyer_die; self->monsterinfo.stand = flyer_stand; self->monsterinfo.walk = flyer_walk; self->monsterinfo.run = flyer_run; self->monsterinfo.attack = flyer_attack; self->monsterinfo.melee = flyer_melee; self->monsterinfo.sight = flyer_sight; self->monsterinfo.idle = flyer_idle; gi.linkentity(self); self->monsterinfo.currentmove = &flyer_move_stand; self->monsterinfo.scale = MODEL_SCALE; flymonster_start(self); } xatrix-XATRIX_2_14/src/monster/flyer/flyer.h000066400000000000000000000101301477320050300210240ustar00rootroot00000000000000/* ======================================================================= * * Flyer animations. * * ======================================================================= */ #define ACTION_nothing 0 #define ACTION_attack1 1 #define ACTION_attack2 2 #define ACTION_run 3 #define ACTION_walk 4 #define FRAME_start01 0 #define FRAME_start02 1 #define FRAME_start03 2 #define FRAME_start04 3 #define FRAME_start05 4 #define FRAME_start06 5 #define FRAME_stop01 6 #define FRAME_stop02 7 #define FRAME_stop03 8 #define FRAME_stop04 9 #define FRAME_stop05 10 #define FRAME_stop06 11 #define FRAME_stop07 12 #define FRAME_stand01 13 #define FRAME_stand02 14 #define FRAME_stand03 15 #define FRAME_stand04 16 #define FRAME_stand05 17 #define FRAME_stand06 18 #define FRAME_stand07 19 #define FRAME_stand08 20 #define FRAME_stand09 21 #define FRAME_stand10 22 #define FRAME_stand11 23 #define FRAME_stand12 24 #define FRAME_stand13 25 #define FRAME_stand14 26 #define FRAME_stand15 27 #define FRAME_stand16 28 #define FRAME_stand17 29 #define FRAME_stand18 30 #define FRAME_stand19 31 #define FRAME_stand20 32 #define FRAME_stand21 33 #define FRAME_stand22 34 #define FRAME_stand23 35 #define FRAME_stand24 36 #define FRAME_stand25 37 #define FRAME_stand26 38 #define FRAME_stand27 39 #define FRAME_stand28 40 #define FRAME_stand29 41 #define FRAME_stand30 42 #define FRAME_stand31 43 #define FRAME_stand32 44 #define FRAME_stand33 45 #define FRAME_stand34 46 #define FRAME_stand35 47 #define FRAME_stand36 48 #define FRAME_stand37 49 #define FRAME_stand38 50 #define FRAME_stand39 51 #define FRAME_stand40 52 #define FRAME_stand41 53 #define FRAME_stand42 54 #define FRAME_stand43 55 #define FRAME_stand44 56 #define FRAME_stand45 57 #define FRAME_attak101 58 #define FRAME_attak102 59 #define FRAME_attak103 60 #define FRAME_attak104 61 #define FRAME_attak105 62 #define FRAME_attak106 63 #define FRAME_attak107 64 #define FRAME_attak108 65 #define FRAME_attak109 66 #define FRAME_attak110 67 #define FRAME_attak111 68 #define FRAME_attak112 69 #define FRAME_attak113 70 #define FRAME_attak114 71 #define FRAME_attak115 72 #define FRAME_attak116 73 #define FRAME_attak117 74 #define FRAME_attak118 75 #define FRAME_attak119 76 #define FRAME_attak120 77 #define FRAME_attak121 78 #define FRAME_attak201 79 #define FRAME_attak202 80 #define FRAME_attak203 81 #define FRAME_attak204 82 #define FRAME_attak205 83 #define FRAME_attak206 84 #define FRAME_attak207 85 #define FRAME_attak208 86 #define FRAME_attak209 87 #define FRAME_attak210 88 #define FRAME_attak211 89 #define FRAME_attak212 90 #define FRAME_attak213 91 #define FRAME_attak214 92 #define FRAME_attak215 93 #define FRAME_attak216 94 #define FRAME_attak217 95 #define FRAME_bankl01 96 #define FRAME_bankl02 97 #define FRAME_bankl03 98 #define FRAME_bankl04 99 #define FRAME_bankl05 100 #define FRAME_bankl06 101 #define FRAME_bankl07 102 #define FRAME_bankr01 103 #define FRAME_bankr02 104 #define FRAME_bankr03 105 #define FRAME_bankr04 106 #define FRAME_bankr05 107 #define FRAME_bankr06 108 #define FRAME_bankr07 109 #define FRAME_rollf01 110 #define FRAME_rollf02 111 #define FRAME_rollf03 112 #define FRAME_rollf04 113 #define FRAME_rollf05 114 #define FRAME_rollf06 115 #define FRAME_rollf07 116 #define FRAME_rollf08 117 #define FRAME_rollf09 118 #define FRAME_rollr01 119 #define FRAME_rollr02 120 #define FRAME_rollr03 121 #define FRAME_rollr04 122 #define FRAME_rollr05 123 #define FRAME_rollr06 124 #define FRAME_rollr07 125 #define FRAME_rollr08 126 #define FRAME_rollr09 127 #define FRAME_defens01 128 #define FRAME_defens02 129 #define FRAME_defens03 130 #define FRAME_defens04 131 #define FRAME_defens05 132 #define FRAME_defens06 133 #define FRAME_pain101 134 #define FRAME_pain102 135 #define FRAME_pain103 136 #define FRAME_pain104 137 #define FRAME_pain105 138 #define FRAME_pain106 139 #define FRAME_pain107 140 #define FRAME_pain108 141 #define FRAME_pain109 142 #define FRAME_pain201 143 #define FRAME_pain202 144 #define FRAME_pain203 145 #define FRAME_pain204 146 #define FRAME_pain301 147 #define FRAME_pain302 148 #define FRAME_pain303 149 #define FRAME_pain304 150 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/gekk/000077500000000000000000000000001477320050300173375ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/gekk/gekk.c000066400000000000000000001146221477320050300204320ustar00rootroot00000000000000/* ======================================================================= * * Gekk (only found in Xatrix). * * ======================================================================= */ #include "../../header/local.h" #include "gekk.h" #define SPAWNFLAG_CHANT 8 static int sound_swing; static int sound_hit; static int sound_hit2; static int sound_death; static int sound_pain1; static int sound_sight; static int sound_search; static int sound_step1; static int sound_step2; static int sound_step3; static int sound_thud; static int sound_chantlow; static int sound_chantmid; static int sound_chanthigh; mmove_t gekk_move_attack1; mmove_t gekk_move_attack2; mmove_t gekk_move_swim_start; mmove_t gekk_move_swim_loop; mmove_t gekk_move_spit; mmove_t gekk_move_run_start; mmove_t gekk_move_run; qboolean gekk_check_jump(edict_t *self); void gekk_swim(edict_t *self); void gekk_jump_takeoff(edict_t *self); void gekk_jump_takeoff2(edict_t *self); void gekk_check_landing(edict_t *self); void gekk_stop_skid(edict_t *self); void water_to_land(edict_t *self); void land_to_water(edict_t *self); void gekk_check_underwater(edict_t *self); void gekk_bite(edict_t *self); void gekk_hit_left(edict_t *self); void gekk_hit_right(edict_t *self); void gekk_run_start(edict_t *self); void gekk_walk(edict_t *self); qboolean gekk_check_melee(edict_t *self) { if (!self) { return false; } if (!self->enemy || (self->enemy->health <= 0)) { return false; } if (range(self, self->enemy) == RANGE_MELEE) { return true; } return false; } qboolean gekk_check_jump(edict_t *self) { vec3_t v; float distance; if (!self) { return false; } if (self->absmin[2] > (self->enemy->absmin[2] + 0.75 * self->enemy->size[2])) { return false; } if (self->absmax[2] < (self->enemy->absmin[2] + 0.25 * self->enemy->size[2])) { return false; } v[0] = self->s.origin[0] - self->enemy->s.origin[0]; v[1] = self->s.origin[1] - self->enemy->s.origin[1]; v[2] = 0; distance = VectorLength(v); if (distance < 100) { return false; } if (distance > 100) { if (random() < 0.9) { return false; } } return true; } qboolean gekk_check_jump_close(edict_t *self) { vec3_t v; float distance; if (!self) { return false; } v[0] = self->s.origin[0] - self->enemy->s.origin[0]; v[1] = self->s.origin[1] - self->enemy->s.origin[1]; v[2] = 0; distance = VectorLength(v); if (distance < 100) { if (self->s.origin[2] < self->enemy->s.origin[2]) { return true; } else { return false; } } return true; } qboolean gekk_checkattack(edict_t *self) { if (!self) { return false; } if (!self->enemy || (self->enemy->health <= 0)) { return false; } if (gekk_check_melee(self)) { self->monsterinfo.attack_state = AS_MELEE; return true; } if (gekk_check_jump(self)) { self->monsterinfo.attack_state = AS_MISSILE; return true; } if (gekk_check_jump_close(self) && !self->waterlevel) { self->monsterinfo.attack_state = AS_MISSILE; return true; } return false; } void gekk_step(edict_t *self) { int n; if (!self) { return; } n = (rand() + 1) % 3; if (n == 0) { gi.sound(self, CHAN_VOICE, sound_step1, 1, ATTN_NORM, 0); } else if (n == 1) { gi.sound(self, CHAN_VOICE, sound_step2, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_step3, 1, ATTN_NORM, 0); } } void gekk_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); } void gekk_search(edict_t *self) { float r; if (!self) { return; } if (self->spawnflags & SPAWNFLAG_CHANT) { r = random(); if (r < 0.33) { gi.sound(self, CHAN_VOICE, sound_chantlow, 1, ATTN_NORM, 0); } else if (r < 0.66) { gi.sound(self, CHAN_VOICE, sound_chantmid, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_chanthigh, 1, ATTN_NORM, 0); } } else { gi.sound(self, CHAN_VOICE, sound_search, 1, ATTN_NORM, 0); } self->health += 10 + (10 * random()); if (self->health > self->max_health) { self->health = self->max_health; } if (self->health < (self->max_health / 4)) { self->s.skinnum = 2; } else if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } else { self->s.skinnum = 0; } } void gekk_swing(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_swing, 1, ATTN_NORM, 0); } void gekk_face(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &gekk_move_run; } void ai_stand2(edict_t *self, float dist) { if (!self) { return; } if (self->spawnflags & SPAWNFLAG_CHANT) { ai_move(self, dist); if (!(self->spawnflags & 1) && (self->monsterinfo.idle) && (level.time > self->monsterinfo.idle_time)) { if (self->monsterinfo.idle_time) { self->monsterinfo.idle(self); self->monsterinfo.idle_time = level.time + 15 + random() * 15; } else { self->monsterinfo.idle_time = level.time + random() * 15; } } } else if (self->enemy) { ai_move(self, dist); } else { ai_stand(self, dist); } } static mframe_t gekk_frames_stand[] = { {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, /* 10 */ {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, /* 20 */ {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, /* 30 */ {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, gekk_check_underwater}, }; mmove_t gekk_move_stand = { FRAME_stand_01, FRAME_stand_39, gekk_frames_stand, NULL }; static mframe_t gekk_frames_standunderwater[] = { {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, gekk_check_underwater} }; mmove_t gekk_move_standunderwater = { FRAME_amb_01, FRAME_amb_04, gekk_frames_standunderwater, NULL }; void gekk_swim_loop(edict_t *self) { if (!self) { return; } self->flags |= FL_SWIM; self->monsterinfo.currentmove = &gekk_move_swim_loop; } static mframe_t gekk_frames_swim[] = { {ai_run, 16, NULL}, {ai_run, 16, NULL}, {ai_run, 16, NULL}, {ai_run, 16, gekk_swim} }; mmove_t gekk_move_swim_loop = { FRAME_amb_01, FRAME_amb_04, gekk_frames_swim, gekk_swim_loop }; static mframe_t gekk_frames_swim_start[] = { {ai_run, 14, NULL}, {ai_run, 14, NULL}, {ai_run, 14, NULL}, {ai_run, 14, NULL}, {ai_run, 16, NULL}, {ai_run, 16, NULL}, {ai_run, 16, NULL}, {ai_run, 18, NULL}, {ai_run, 18, gekk_hit_left}, {ai_run, 18, NULL}, {ai_run, 20, NULL}, {ai_run, 20, NULL}, {ai_run, 22, NULL}, {ai_run, 22, NULL}, {ai_run, 24, gekk_hit_right}, {ai_run, 24, NULL}, {ai_run, 26, NULL}, {ai_run, 26, NULL}, {ai_run, 24, NULL}, {ai_run, 24, NULL}, {ai_run, 22, gekk_bite}, {ai_run, 22, NULL}, {ai_run, 22, NULL}, {ai_run, 22, NULL}, {ai_run, 22, NULL}, {ai_run, 22, NULL}, {ai_run, 22, NULL}, {ai_run, 22, NULL}, {ai_run, 18, NULL}, {ai_run, 18, NULL}, {ai_run, 18, NULL}, {ai_run, 18, NULL} }; mmove_t gekk_move_swim_start = { FRAME_swim_01, FRAME_swim_32, gekk_frames_swim_start, gekk_swim_loop }; void gekk_swim(edict_t *self) { if (!self) { return; } if (!self->enemy) { return; } if (!self->enemy->waterlevel && (random() > 0.7)) { water_to_land(self); } } void gekk_stand(edict_t *self) { if (!self) { return; } if (self->waterlevel) { self->monsterinfo.currentmove = &gekk_move_standunderwater; } else { self->monsterinfo.currentmove = &gekk_move_stand; } } void gekk_idle_loop(edict_t *self) { if (!self) { return; } if ((random() > 0.75) && (self->health < self->max_health)) { self->monsterinfo.nextframe = FRAME_idle_01; } } static mframe_t gekk_frames_idle[] = { {ai_stand2, 0, gekk_search}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, gekk_idle_loop} }; mmove_t gekk_move_idle = { FRAME_idle_01, FRAME_idle_32, gekk_frames_idle, gekk_stand }; mmove_t gekk_move_idle2 = { FRAME_idle_01, FRAME_idle_32, gekk_frames_idle, gekk_face }; void gekk_idle(edict_t *self) { if (!self) { return; } if (!self->waterlevel) { self->monsterinfo.currentmove = &gekk_move_idle; } else { self->monsterinfo.currentmove = &gekk_move_swim_start; } } static mframe_t gekk_frames_walk[] = { {ai_walk, 3.849, gekk_check_underwater}, /* frame 0 */ {ai_walk, 19.606, NULL}, /* frame 1 */ {ai_walk, 25.583, NULL}, /* frame 2 */ {ai_walk, 34.625, gekk_step}, /* frame 3 */ {ai_walk, 27.365, NULL}, /* frame 4 */ {ai_walk, 28.480, NULL}, /* frame 5 */ }; mmove_t gekk_move_walk = { FRAME_run_01, FRAME_run_06, gekk_frames_walk, NULL }; void gekk_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &gekk_move_walk; } void gekk_run_start(edict_t *self) { if (!self) { return; } if (self->waterlevel) { self->monsterinfo.currentmove = &gekk_move_swim_start; } else { self->monsterinfo.currentmove = &gekk_move_run_start; } } void gekk_run(edict_t *self) { if (!self) { return; } if (self->waterlevel) { self->monsterinfo.currentmove = &gekk_move_swim_start; return; } else { if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &gekk_move_stand; } else { self->monsterinfo.currentmove = &gekk_move_run; } } } static mframe_t gekk_frames_run[] = { {ai_run, 3.849, gekk_check_underwater}, /* frame 0 */ {ai_run, 19.606, NULL}, /* frame 1 */ {ai_run, 25.583, NULL}, /* frame 2 */ {ai_run, 34.625, gekk_step}, /* frame 3 */ {ai_run, 27.365, NULL}, /* frame 4 */ {ai_run, 28.480, NULL}, /* frame 5 */ }; mmove_t gekk_move_run = { FRAME_run_01, FRAME_run_06, gekk_frames_run, NULL }; static mframe_t gekk_frames_run_st[] = { {ai_run, 0.212, NULL}, /* frame 0 */ {ai_run, 19.753, NULL}, /* frame 1 */ }; mmove_t gekk_move_run_start = { FRAME_stand_01, FRAME_stand_02, gekk_frames_run_st, gekk_run }; void gekk_hit_left(edict_t *self) { vec3_t aim; if (!self) { return; } VectorSet(aim, MELEE_DISTANCE, self->mins[0], 8); if (fire_hit(self, aim, (15 + (rand() % 5)), 100)) { gi.sound(self, CHAN_WEAPON, sound_hit, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_WEAPON, sound_swing, 1, ATTN_NORM, 0); } } void gekk_hit_right(edict_t *self) { vec3_t aim; if (!self) { return; } VectorSet(aim, MELEE_DISTANCE, self->maxs[0], 8); if (fire_hit(self, aim, (15 + (rand() % 5)), 100)) { gi.sound(self, CHAN_WEAPON, sound_hit2, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_WEAPON, sound_swing, 1, ATTN_NORM, 0); } } void gekk_check_refire(edict_t *self) { if (!self) { return; } if (!self->enemy || !self->enemy->inuse || (self->enemy->health <= 0)) { return; } if (random() < (skill->value * 0.1)) { if (range(self, self->enemy) == RANGE_MELEE) { if (self->s.frame == FRAME_clawatk3_09) { self->monsterinfo.currentmove = &gekk_move_attack2; } else if (self->s.frame == FRAME_clawatk5_09) { self->monsterinfo.currentmove = &gekk_move_attack1; } } } } void loogie_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) { vec3_t normal; if (!self || !other) { return; } if (other == self->owner) { return; } if (surf && (surf->flags & SURF_SKY)) { G_FreeEdict(self); return; } if (self->owner->client) { PlayerNoise(self->owner, self->s.origin, PNOISE_IMPACT); } if (other->takedamage) { get_normal_vector(plane, normal); T_Damage(other, self, self->owner, self->velocity, self->s.origin, normal, self->dmg, 1, DAMAGE_ENERGY, MOD_GEKK); } G_FreeEdict(self); } void fire_loogie(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed) { edict_t *loogie; trace_t tr; if (!self) { return; } VectorNormalize(dir); loogie = G_Spawn(); VectorCopy(start, loogie->s.origin); VectorCopy(start, loogie->s.old_origin); vectoangles(dir, loogie->s.angles); VectorScale(dir, speed, loogie->velocity); loogie->movetype = MOVETYPE_FLYMISSILE; loogie->clipmask = MASK_SHOT; loogie->solid = SOLID_BBOX; loogie->s.effects |= RF_FULLBRIGHT; VectorClear(loogie->mins); VectorClear(loogie->maxs); loogie->s.modelindex = gi.modelindex("models/objects/loogy/tris.md2"); loogie->owner = self; loogie->touch = loogie_touch; loogie->nextthink = level.time + 2; loogie->think = G_FreeEdict; loogie->dmg = damage; gi.linkentity(loogie); tr = gi.trace(self->s.origin, NULL, NULL, loogie->s.origin, loogie, MASK_SHOT); if (tr.fraction < 1.0) { VectorMA(loogie->s.origin, -10, dir, loogie->s.origin); loogie->touch(loogie, tr.ent, NULL, NULL); } } void loogie(edict_t *self) { vec3_t start; vec3_t forward, right, up; vec3_t end; vec3_t dir; vec3_t gekkoffset; if (!self) { return; } VectorSet(gekkoffset, -18, -0.8, 24); if (!self->enemy || (self->enemy->health <= 0)) { return; } AngleVectors(self->s.angles, forward, right, up); G_ProjectSource(self->s.origin, gekkoffset, forward, right, start); VectorMA(start, 2, up, start); VectorCopy(self->enemy->s.origin, end); end[2] += self->enemy->viewheight; VectorSubtract(end, start, dir); fire_loogie(self, start, dir, 5, 550); } void reloogie(edict_t *self) { if (!self) { return; } if ((random() > 0.8) && (self->health < self->max_health)) { self->monsterinfo.currentmove = &gekk_move_idle2; return; } if (self->enemy->health >= 0) { if ((random() > 0.7) && (range(self, self->enemy) == RANGE_NEAR)) { self->monsterinfo.currentmove = &gekk_move_spit; } } } static mframe_t gekk_frames_spit[] = { {ai_charge, 0.000, NULL}, {ai_charge, 0.000, NULL}, {ai_charge, 0.000, NULL}, {ai_charge, 0.000, NULL}, {ai_charge, 0.000, NULL}, {ai_charge, 0.000, loogie}, {ai_charge, 0.000, reloogie} }; mmove_t gekk_move_spit = { FRAME_spit_01, FRAME_spit_07, gekk_frames_spit, gekk_run_start }; static mframe_t gekk_frames_attack1[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, gekk_hit_left}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, gekk_check_refire} }; mmove_t gekk_move_attack1 = { FRAME_clawatk3_01, FRAME_clawatk3_09, gekk_frames_attack1, gekk_run_start }; static mframe_t gekk_frames_attack2[] = { {ai_charge, 0.000, NULL}, {ai_charge, 0.000, NULL}, {ai_charge, 0.000, gekk_hit_left}, {ai_charge, 0.000, NULL}, {ai_charge, 0.000, NULL}, {ai_charge, 0.000, gekk_hit_right}, {ai_charge, 0.000, NULL}, {ai_charge, 0.000, NULL}, {ai_charge, 0.000, gekk_check_refire} }; mmove_t gekk_move_attack2 = { FRAME_clawatk5_01, FRAME_clawatk5_09, gekk_frames_attack2, gekk_run_start }; void gekk_check_underwater(edict_t *self) { if (!self) { return; } if (self->waterlevel) { land_to_water(self); } } static mframe_t gekk_frames_leapatk[] = { {ai_charge, 0.000, NULL}, /* frame 0 */ {ai_charge, -0.387, NULL}, /* frame 1 */ {ai_charge, -1.113, NULL}, /* frame 2 */ {ai_charge, -0.237, NULL}, /* frame 3 */ {ai_charge, 6.720, gekk_jump_takeoff}, /* frame 4 last frame on ground */ {ai_charge, 6.414, NULL}, /* frame 5 leaves ground */ {ai_charge, 0.163, NULL}, /* frame 6 */ {ai_charge, 28.316, NULL}, /* frame 7 */ {ai_charge, 24.198, NULL}, /* frame 8 */ {ai_charge, 31.742, NULL}, /* frame 9 */ {ai_charge, 35.977, gekk_check_landing}, /* frame 10 last frame in air */ {ai_charge, 12.303, gekk_stop_skid}, /* frame 11 feet back on ground */ {ai_charge, 20.122, gekk_stop_skid}, /* frame 12 */ {ai_charge, -1.042, gekk_stop_skid}, /* frame 13 */ {ai_charge, 2.556, gekk_stop_skid}, /* frame 14 */ {ai_charge, 0.544, gekk_stop_skid}, /* frame 15 */ {ai_charge, 1.862, gekk_stop_skid}, /* frame 16 */ {ai_charge, 1.224, gekk_stop_skid}, /* frame 17 */ {ai_charge, -0.457, gekk_check_underwater}, /* frame 18 */ }; mmove_t gekk_move_leapatk = { FRAME_leapatk_01, FRAME_leapatk_19, gekk_frames_leapatk, gekk_run_start }; static mframe_t gekk_frames_leapatk2[] = { {ai_charge, 0.000, NULL}, /* frame 0 */ {ai_charge, -0.387, NULL}, /* frame 1 */ {ai_charge, -1.113, NULL}, /* frame 2 */ {ai_charge, -0.237, NULL}, /* frame 3 */ {ai_charge, 6.720, gekk_jump_takeoff2}, /* frame 4 last frame on ground */ {ai_charge, 6.414, NULL}, /* frame 5 leaves ground */ {ai_charge, 0.163, NULL}, /* frame 6 */ {ai_charge, 28.316, NULL}, /* frame 7 */ {ai_charge, 24.198, NULL}, /* frame 8 */ {ai_charge, 31.742, NULL}, /* frame 9 */ {ai_charge, 35.977, gekk_check_landing}, /* frame 10 last frame in air */ {ai_charge, 12.303, gekk_stop_skid}, /* frame 11 feet back on ground */ {ai_charge, 20.122, gekk_stop_skid}, /* frame 12 */ {ai_charge, -1.042, gekk_stop_skid}, /* frame 13 */ {ai_charge, 2.556, gekk_stop_skid}, /* frame 14 */ {ai_charge, 0.544, gekk_stop_skid}, /* frame 15 */ {ai_charge, 1.862, gekk_stop_skid}, /* frame 16 */ {ai_charge, 1.224, gekk_stop_skid}, /* frame 17 */ {ai_charge, -0.457, gekk_check_underwater}, /* frame 18 */ }; mmove_t gekk_move_leapatk2 = { FRAME_leapatk_01, FRAME_leapatk_19, gekk_frames_leapatk2, gekk_run_start }; void gekk_bite(edict_t *self) { vec3_t aim; if (!self) { return; } VectorSet(aim, MELEE_DISTANCE, 0, 0); fire_hit(self, aim, 5, 0); } void gekk_preattack(edict_t *self) { /* Unused but PITA to remove */ } static mframe_t gekk_frames_attack[] = { {ai_charge, 16, gekk_preattack}, {ai_charge, 16, NULL}, {ai_charge, 16, NULL}, {ai_charge, 16, NULL}, {ai_charge, 16, gekk_bite}, {ai_charge, 16, NULL}, {ai_charge, 16, NULL}, {ai_charge, 16, NULL}, {ai_charge, 16, NULL}, {ai_charge, 16, gekk_bite}, {ai_charge, 16, NULL}, {ai_charge, 16, NULL}, {ai_charge, 16, NULL}, {ai_charge, 16, gekk_hit_left}, {ai_charge, 16, NULL}, {ai_charge, 16, NULL}, {ai_charge, 16, NULL}, {ai_charge, 16, NULL}, {ai_charge, 16, gekk_hit_right}, {ai_charge, 16, NULL}, {ai_charge, 16, NULL} }; mmove_t gekk_move_attack = { FRAME_attack_01, FRAME_attack_21, gekk_frames_attack, gekk_run_start }; void gekk_melee(edict_t *self) { float r; if (!self) { return; } if (self->waterlevel) { self->monsterinfo.currentmove = &gekk_move_attack; } else { r = random(); if (r > 0.66) { self->monsterinfo.currentmove = &gekk_move_attack1; } else { self->monsterinfo.currentmove = &gekk_move_attack2; } } } void gekk_jump_touch(edict_t *self, edict_t *other, cplane_t *plane /* unsued */, csurface_t *surf /* unused */) { if (!self) { return; } if (self->health <= 0) { self->touch = NULL; return; } if (other && other->takedamage) { if (VectorLength(self->velocity) > 200) { vec3_t point; vec3_t normal; int damage; VectorCopy(self->velocity, normal); VectorNormalize(normal); VectorMA(self->s.origin, self->maxs[0], normal, point); damage = 10 + 10 * random(); T_Damage(other, self, self, self->velocity, point, normal, damage, damage, 0, MOD_GEKK); } } if (!M_CheckBottom(self)) { if (self->groundentity) { self->monsterinfo.nextframe = FRAME_leapatk_11; self->monsterinfo.aiflags &= ~AI_IGNORE_PAIN; self->touch = NULL; } return; } self->monsterinfo.aiflags &= ~AI_IGNORE_PAIN; self->touch = NULL; } void gekk_jump_takeoff(edict_t *self) { vec3_t forward; if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); AngleVectors(self->s.angles, forward, NULL, NULL); self->s.origin[2] += 1; /* high jump */ if (gekk_check_jump(self)) { VectorScale(forward, 700, self->velocity); self->velocity[2] = 250; } else { VectorScale(forward, 250, self->velocity); self->velocity[2] = 400; } self->groundentity = NULL; self->monsterinfo.aiflags |= AI_IGNORE_PAIN; self->monsterinfo.attack_finished = level.time + 3; self->touch = gekk_jump_touch; } void gekk_jump_takeoff2(edict_t *self) { vec3_t forward; if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); AngleVectors(self->s.angles, forward, NULL, NULL); self->s.origin[2] = self->enemy->s.origin[2]; if (gekk_check_jump(self)) { VectorScale(forward, 300, self->velocity); self->velocity[2] = 250; } else { VectorScale(forward, 150, self->velocity); self->velocity[2] = 300; } self->groundentity = NULL; self->monsterinfo.aiflags |= AI_IGNORE_PAIN; self->monsterinfo.attack_finished = level.time + 3; self->touch = gekk_jump_touch; } void gekk_stop_skid(edict_t *self) { if (!self) { return; } if (self->groundentity) { VectorClear(self->velocity); } } void gekk_check_landing(edict_t *self) { if (!self) { return; } if (self->groundentity) { gi.sound(self, CHAN_WEAPON, sound_thud, 1, ATTN_NORM, 0); self->monsterinfo.attack_finished = 0; self->monsterinfo.aiflags &= ~AI_IGNORE_PAIN; VectorClear(self->velocity); return; } if (level.time > self->monsterinfo.attack_finished) { self->monsterinfo.nextframe = FRAME_leapatk_11; } else { self->monsterinfo.nextframe = FRAME_leapatk_12; } } void gekk_jump(edict_t *self) { if (!self) { return; } if (self->flags & FL_SWIM || self->waterlevel) { return; } else { { if ((random() > 0.5) && (range(self, self->enemy) >= RANGE_NEAR)) { self->monsterinfo.currentmove = &gekk_move_spit; } else if (random() > 0.8) { self->monsterinfo.currentmove = &gekk_move_spit; } else { self->monsterinfo.currentmove = &gekk_move_leapatk; } } } } static mframe_t gekk_frames_pain[] = { {ai_move, 0.000, NULL}, /* frame 0 */ {ai_move, 0.000, NULL}, /* frame 1 */ {ai_move, 0.000, NULL}, /* frame 2 */ {ai_move, 0.000, NULL}, /* frame 3 */ {ai_move, 0.000, NULL}, /* frame 4 */ {ai_move, 0.000, NULL}, /* frame 5 */ }; mmove_t gekk_move_pain = { FRAME_pain_01, FRAME_pain_06, gekk_frames_pain, gekk_run_start }; static mframe_t gekk_frames_pain1[] = { {ai_move, 0.000, NULL}, /* frame 0 */ {ai_move, 0.000, NULL}, /* frame 1 */ {ai_move, 0.000, NULL}, /* frame 2 */ {ai_move, 0.000, NULL}, /* frame 3 */ {ai_move, 0.000, NULL}, /* frame 4 */ {ai_move, 0.000, NULL}, /* frame 5 */ {ai_move, 0.000, NULL}, /* frame 6 */ {ai_move, 0.000, NULL}, /* frame 7 */ {ai_move, 0.000, NULL}, /* frame 8 */ {ai_move, 0.000, NULL}, /* frame 9 */ {ai_move, 0.000, gekk_check_underwater} }; mmove_t gekk_move_pain1 = { FRAME_pain3_01, FRAME_pain3_11, gekk_frames_pain1, gekk_run_start }; static mframe_t gekk_frames_pain2[] = { {ai_move, 0.000, NULL}, /* frame 0 */ {ai_move, 0.000, NULL}, /* frame 1 */ {ai_move, 0.000, NULL}, /* frame 2 */ {ai_move, 0.000, NULL}, /* frame 3 */ {ai_move, 0.000, NULL}, /* frame 4 */ {ai_move, 0.000, NULL}, /* frame 5 */ {ai_move, 0.000, NULL}, /* frame 6 */ {ai_move, 0.000, NULL}, /* frame 7 */ {ai_move, 0.000, NULL}, /* frame 8 */ {ai_move, 0.000, NULL}, /* frame 9 */ {ai_move, 0.000, NULL}, /* frame 10 */ {ai_move, 0.000, NULL}, /* frame 11 */ {ai_move, 0.000, gekk_check_underwater}, }; mmove_t gekk_move_pain2 = { FRAME_pain4_01, FRAME_pain4_13, gekk_frames_pain2, gekk_run_start }; void gekk_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage /* unused */) { float r; if (!self) { return; } if (self->spawnflags & SPAWNFLAG_CHANT) { self->spawnflags &= ~SPAWNFLAG_CHANT; return; } if (self->health < (self->max_health / 4)) { self->s.skinnum = 2; } else if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } self->pain_debounce_time = level.time + 3; gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); if (self->waterlevel) { if ((!self->flags) & FL_SWIM) { self->flags |= FL_SWIM; } self->monsterinfo.currentmove = &gekk_move_pain; } else { r = random(); if (r > 0.5) { self->monsterinfo.currentmove = &gekk_move_pain1; } else { self->monsterinfo.currentmove = &gekk_move_pain2; } } } void gekk_dead(edict_t *self) { if (!self) { return; } /* fix this because of no blocking problem */ if (self->waterlevel) { return; } else { VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, -8); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } } void gekk_gibfest(edict_t *self) { int damage = 20; if (!self) { return; } gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); ThrowGibACID(self, "models/objects/gekkgib/pelvis/tris.md2", damage, GIB_ORGANIC); ThrowGibACID(self, "models/objects/gekkgib/arm/tris.md2", damage, GIB_ORGANIC); ThrowGibACID(self, "models/objects/gekkgib/arm/tris.md2", damage, GIB_ORGANIC); ThrowGibACID(self, "models/objects/gekkgib/torso/tris.md2", damage, GIB_ORGANIC); ThrowGibACID(self, "models/objects/gekkgib/claw/tris.md2", damage, GIB_ORGANIC); ThrowGibACID(self, "models/objects/gekkgib/leg/tris.md2", damage, GIB_ORGANIC); ThrowGibACID(self, "models/objects/gekkgib/leg/tris.md2", damage, GIB_ORGANIC); ThrowHeadACID(self, "models/objects/gekkgib/head/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; } void isgibfest(edict_t *self) { if (!self) { return; } if (random() > 0.9) { gekk_gibfest(self); } } static mframe_t gekk_frames_death1[] = { {ai_move, -5.151, NULL}, /* frame 0 */ {ai_move, -12.223, NULL}, /* frame 1 */ {ai_move, -11.484, NULL}, /* frame 2 */ {ai_move, -17.952, NULL}, /* frame 3 */ {ai_move, -6.953, NULL}, /* frame 4 */ {ai_move, -7.393, NULL}, /* frame 5 */ {ai_move, -10.713, NULL}, /* frame 6 */ {ai_move, -17.464, NULL}, /* frame 7 */ {ai_move, -11.678, NULL}, /* frame 8 */ {ai_move, -11.678, NULL} /* frame 9 */ }; mmove_t gekk_move_death1 = { FRAME_death1_01, FRAME_death1_10, gekk_frames_death1, gekk_dead }; static mframe_t gekk_frames_death3[] = { {ai_move, 0.000, NULL}, /* frame 0 */ {ai_move, 0.022, NULL}, /* frame 1 */ {ai_move, 0.169, NULL}, /* frame 2 */ {ai_move, -0.710, NULL}, /* frame 3 */ {ai_move, -13.446, NULL}, /* frame 4 */ {ai_move, -7.654, isgibfest}, /* frame 5 */ {ai_move, -31.951, NULL}, /* frame 6 */ }; mmove_t gekk_move_death3 = { FRAME_death3_01, FRAME_death3_07, gekk_frames_death3, gekk_dead }; static mframe_t gekk_frames_death4[] = { {ai_move, 5.103, NULL}, /* frame 0 */ {ai_move, -4.808, NULL}, /* frame 1 */ {ai_move, -10.509, NULL}, /* frame 2 */ {ai_move, -9.899, NULL}, /* frame 3 */ {ai_move, 4.033, isgibfest}, /* frame 4 */ {ai_move, -5.197, NULL}, /* frame 5 */ {ai_move, -0.919, NULL}, /* frame 6 */ {ai_move, -8.821, NULL}, /* frame 7 */ {ai_move, -5.626, NULL}, /* frame 8 */ {ai_move, -8.865, isgibfest}, /* frame 9 */ {ai_move, -0.845, NULL}, /* frame 10 */ {ai_move, 1.986, NULL}, /* frame 11 */ {ai_move, 0.170, NULL}, /* frame 12 */ {ai_move, 1.339, isgibfest}, /* frame 13 */ {ai_move, -0.922, NULL}, /* frame 14 */ {ai_move, 0.818, NULL}, /* frame 15 */ {ai_move, -1.288, NULL}, /* frame 16 */ {ai_move, -1.408, isgibfest}, /* frame 17 */ {ai_move, -7.787, NULL}, /* frame 18 */ {ai_move, -3.995, NULL}, /* frame 19 */ {ai_move, -4.604, NULL}, /* frame 20 */ {ai_move, -1.715, isgibfest}, /* frame 21 */ {ai_move, -0.564, NULL}, /* frame 22 */ {ai_move, -0.597, NULL}, /* frame 23 */ {ai_move, 0.074, NULL}, /* frame 24 */ {ai_move, -0.309, isgibfest}, /* frame 25 */ {ai_move, -0.395, NULL}, /* frame 26 */ {ai_move, -0.501, NULL}, /* frame 27 */ {ai_move, -0.325, NULL}, /* frame 28 */ {ai_move, -0.931, isgibfest}, /* frame 29 */ {ai_move, -1.433, NULL}, /* frame 30 */ {ai_move, -1.626, NULL}, /* frame 31 */ {ai_move, 4.680, NULL}, /* frame 32 */ {ai_move, 0.560, NULL}, /* frame 33 */ {ai_move, -0.549, gekk_gibfest} /* frame 34 */ }; mmove_t gekk_move_death4 = { FRAME_death4_01, FRAME_death4_35, gekk_frames_death4, gekk_dead }; static mframe_t gekk_frames_wdeath[] = { {ai_move, 0.000, NULL}, /* frame 0 */ {ai_move, 0.000, NULL}, /* frame 1 */ {ai_move, 0.000, NULL}, /* frame 2 */ {ai_move, 0.000, NULL}, /* frame 3 */ {ai_move, 0.000, NULL}, /* frame 4 */ {ai_move, 0.000, NULL}, /* frame 5 */ {ai_move, 0.000, NULL}, /* frame 6 */ {ai_move, 0.000, NULL}, /* frame 7 */ {ai_move, 0.000, NULL}, /* frame 8 */ {ai_move, 0.000, NULL}, /* frame 9 */ {ai_move, 0.000, NULL}, /* frame 10 */ {ai_move, 0.000, NULL}, /* frame 11 */ {ai_move, 0.000, NULL}, /* frame 12 */ {ai_move, 0.000, NULL}, /* frame 13 */ {ai_move, 0.000, NULL}, /* frame 14 */ {ai_move, 0.000, NULL}, /* frame 15 */ {ai_move, 0.000, NULL}, /* frame 16 */ {ai_move, 0.000, NULL}, /* frame 17 */ {ai_move, 0.000, NULL}, /* frame 18 */ {ai_move, 0.000, NULL}, /* frame 19 */ {ai_move, 0.000, NULL}, /* frame 20 */ {ai_move, 0.000, NULL}, /* frame 21 */ {ai_move, 0.000, NULL}, /* frame 22 */ {ai_move, 0.000, NULL}, /* frame 23 */ {ai_move, 0.000, NULL}, /* frame 24 */ {ai_move, 0.000, NULL}, /* frame 25 */ {ai_move, 0.000, NULL}, /* frame 26 */ {ai_move, 0.000, NULL}, /* frame 27 */ {ai_move, 0.000, NULL}, /* frame 28 */ {ai_move, 0.000, NULL}, /* frame 29 */ {ai_move, 0.000, NULL}, /* frame 30 */ {ai_move, 0.000, NULL}, /* frame 31 */ {ai_move, 0.000, NULL}, /* frame 32 */ {ai_move, 0.000, NULL}, /* frame 33 */ {ai_move, 0.000, NULL}, /* frame 34 */ {ai_move, 0.000, NULL}, /* frame 35 */ {ai_move, 0.000, NULL}, /* frame 36 */ {ai_move, 0.000, NULL}, /* frame 37 */ {ai_move, 0.000, NULL}, /* frame 38 */ {ai_move, 0.000, NULL}, /* frame 39 */ {ai_move, 0.000, NULL}, /* frame 40 */ {ai_move, 0.000, NULL}, /* frame 41 */ {ai_move, 0.000, NULL}, /* frame 42 */ {ai_move, 0.000, NULL}, /* frame 43 */ {ai_move, 0.000, NULL} /* frame 44 */ }; mmove_t gekk_move_wdeath = { FRAME_wdeath_01, FRAME_wdeath_45, gekk_frames_wdeath, gekk_dead }; void gekk_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point /* unused */) { float r; if (!self) { return; } if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); ThrowGibACID(self, "models/objects/gekkgib/pelvis/tris.md2", damage, GIB_ORGANIC); ThrowGibACID(self, "models/objects/gekkgib/arm/tris.md2", damage, GIB_ORGANIC); ThrowGibACID(self, "models/objects/gekkgib/arm/tris.md2", damage, GIB_ORGANIC); ThrowGibACID(self, "models/objects/gekkgib/torso/tris.md2", damage, GIB_ORGANIC); ThrowGibACID(self, "models/objects/gekkgib/claw/tris.md2", damage, GIB_ORGANIC); ThrowGibACID(self, "models/objects/gekkgib/leg/tris.md2", damage, GIB_ORGANIC); ThrowGibACID(self, "models/objects/gekkgib/leg/tris.md2", damage, GIB_ORGANIC); ThrowHeadACID(self, "models/objects/gekkgib/head/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; self->s.skinnum = 2; if (self->waterlevel) { self->monsterinfo.currentmove = &gekk_move_wdeath; } else { r = random(); if (r > 0.66) { self->monsterinfo.currentmove = &gekk_move_death1; } else if (r > 0.33) { self->monsterinfo.currentmove = &gekk_move_death3; } else { self->monsterinfo.currentmove = &gekk_move_death4; } } } void gekk_duck_down(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_DUCKED) { return; } self->monsterinfo.aiflags |= AI_DUCKED; self->maxs[2] -= 32; self->takedamage = DAMAGE_YES; self->monsterinfo.pausetime = level.time + 1; gi.linkentity(self); } void gekk_duck_up(edict_t *self) { if (!self) { return; } self->monsterinfo.aiflags &= ~AI_DUCKED; self->maxs[2] += 32; self->takedamage = DAMAGE_AIM; gi.linkentity(self); } void gekk_duck_hold(edict_t *self) { if (!self) { return; } if (level.time >= self->monsterinfo.pausetime) { self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; } else { self->monsterinfo.aiflags |= AI_HOLD_FRAME; } } static mframe_t gekk_frames_lduck[] = { {ai_move, 0.000, NULL}, /* frame 0 */ {ai_move, 0.000, NULL}, /* frame 1 */ {ai_move, 0.000, NULL}, /* frame 2 */ {ai_move, 0.000, NULL}, /* frame 3 */ {ai_move, 0.000, NULL}, /* frame 4 */ {ai_move, 0.000, NULL}, /* frame 5 */ {ai_move, 0.000, NULL}, /* frame 6 */ {ai_move, 0.000, NULL}, /* frame 7 */ {ai_move, 0.000, NULL}, /* frame 8 */ {ai_move, 0.000, NULL}, /* frame 9 */ {ai_move, 0.000, NULL}, /* frame 10 */ {ai_move, 0.000, NULL}, /* frame 11 */ {ai_move, 0.000, NULL} /* frame 12 */ }; mmove_t gekk_move_lduck = { FRAME_lduck_01, FRAME_lduck_13, gekk_frames_lduck, gekk_run_start }; static mframe_t gekk_frames_rduck[] = { {ai_move, 0.000, NULL}, /* frame 0 */ {ai_move, 0.000, NULL}, /* frame 1 */ {ai_move, 0.000, NULL}, /* frame 2 */ {ai_move, 0.000, NULL}, /* frame 3 */ {ai_move, 0.000, NULL}, /* frame 4 */ {ai_move, 0.000, NULL}, /* frame 5 */ {ai_move, 0.000, NULL}, /* frame 6 */ {ai_move, 0.000, NULL}, /* frame 7 */ {ai_move, 0.000, NULL}, /* frame 8 */ {ai_move, 0.000, NULL}, /* frame 9 */ {ai_move, 0.000, NULL}, /* frame 10 */ {ai_move, 0.000, NULL}, /* frame 11 */ {ai_move, 0.000, NULL} /* frame 12 */ }; mmove_t gekk_move_rduck = { FRAME_rduck_01, FRAME_rduck_13, gekk_frames_rduck, gekk_run_start }; void gekk_dodge(edict_t *self, edict_t *attacker, float eta) { float r; if (!self || !attacker) { return; } r = random(); if (r > 0.25) { return; } if (!self->enemy) { self->enemy = attacker; FoundTarget(self); } if (self->waterlevel) { self->monsterinfo.currentmove = &gekk_move_attack; return; } if (skill->value == SKILL_EASY) { r = random(); if (r > 0.5) { self->monsterinfo.currentmove = &gekk_move_lduck; } else { self->monsterinfo.currentmove = &gekk_move_rduck; } return; } self->monsterinfo.pausetime = level.time + eta + 0.3; r = random(); if (skill->value == SKILL_MEDIUM) { if (r > 0.33) { r = random(); if (r > 0.5) { self->monsterinfo.currentmove = &gekk_move_lduck; } else { self->monsterinfo.currentmove = &gekk_move_rduck; } } else { r = random(); if (r > 0.66) { self->monsterinfo.currentmove = &gekk_move_attack1; } else { self->monsterinfo.currentmove = &gekk_move_attack2; } } return; } if (skill->value == SKILL_HARD) { if (r > 0.66) { r = random(); if (r > 0.5) { self->monsterinfo.currentmove = &gekk_move_lduck; } else { self->monsterinfo.currentmove = &gekk_move_rduck; } } else { r = random(); if (r > 0.66) { self->monsterinfo.currentmove = &gekk_move_attack1; } else { self->monsterinfo.currentmove = &gekk_move_attack2; } } return; } r = random(); if (r > 0.66) { self->monsterinfo.currentmove = &gekk_move_attack1; } else { self->monsterinfo.currentmove = &gekk_move_attack2; } } /* * QUAKED monster_gekk (1 .5 0) (-24 -24 -24) (24 24 24) Ambush Trigger_Spawn Sight Chant */ void SP_monster_gekk(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } sound_swing = gi.soundindex("gek/gk_atck1.wav"); sound_hit = gi.soundindex("gek/gk_atck2.wav"); sound_hit2 = gi.soundindex("gek/gk_atck3.wav"); sound_death = gi.soundindex("gek/gk_deth1.wav"); sound_pain1 = gi.soundindex("gek/gk_pain1.wav"); sound_sight = gi.soundindex("gek/gk_sght1.wav"); sound_search = gi.soundindex("gek/gk_idle1.wav"); sound_step1 = gi.soundindex("gek/gk_step1.wav"); sound_step2 = gi.soundindex("gek/gk_step2.wav"); sound_step3 = gi.soundindex("gek/gk_step3.wav"); sound_thud = gi.soundindex("mutant/thud1.wav"); sound_chantlow = gi.soundindex("gek/gek_low.wav"); sound_chantmid = gi.soundindex("gek/gek_mid.wav"); sound_chanthigh = gi.soundindex("gek/gek_high.wav"); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/gekk/tris.md2"); VectorSet(self->mins, -24, -24, -24); VectorSet(self->maxs, 24, 24, 24); gi.modelindex("models/objects/gekkgib/pelvis/tris.md2"); gi.modelindex("models/objects/gekkgib/arm/tris.md2"); gi.modelindex("models/objects/gekkgib/torso/tris.md2"); gi.modelindex("models/objects/gekkgib/claw/tris.md2"); gi.modelindex("models/objects/gekkgib/leg/tris.md2"); gi.modelindex("models/objects/gekkgib/head/tris.md2"); self->health = 125; self->gib_health = -30; self->mass = 300; self->pain = gekk_pain; self->die = gekk_die; self->monsterinfo.stand = gekk_stand; self->monsterinfo.walk = gekk_walk; self->monsterinfo.run = gekk_run_start; self->monsterinfo.dodge = gekk_dodge; self->monsterinfo.attack = gekk_jump; self->monsterinfo.melee = gekk_melee; self->monsterinfo.sight = gekk_sight; self->monsterinfo.search = gekk_search; self->monsterinfo.idle = gekk_idle; self->monsterinfo.checkattack = gekk_checkattack; gi.linkentity(self); self->monsterinfo.currentmove = &gekk_move_stand; self->monsterinfo.scale = MODEL_SCALE; walkmonster_start(self); } void water_to_land(edict_t *self) { if (!self) { return; } self->flags &= ~FL_SWIM; self->yaw_speed = 20; self->viewheight = 25; self->monsterinfo.currentmove = &gekk_move_leapatk2; VectorSet(self->mins, -24, -24, -24); VectorSet(self->maxs, 24, 24, 24); } void land_to_water(edict_t *self) { if (!self) { return; } self->flags |= FL_SWIM; self->yaw_speed = 10; self->viewheight = 10; self->monsterinfo.currentmove = &gekk_move_swim_start; VectorSet(self->mins, -24, -24, -24); VectorSet(self->maxs, 24, 24, 16); } xatrix-XATRIX_2_14/src/monster/gekk/gekk.h000066400000000000000000000227441477320050300204420ustar00rootroot00000000000000/* ======================================================================= * * Gekk animations. * * ======================================================================= */ #define FRAME_stand_01 0 #define FRAME_stand_02 1 #define FRAME_stand_03 2 #define FRAME_stand_04 3 #define FRAME_stand_05 4 #define FRAME_stand_06 5 #define FRAME_stand_07 6 #define FRAME_stand_08 7 #define FRAME_stand_09 8 #define FRAME_stand_10 9 #define FRAME_stand_11 10 #define FRAME_stand_12 11 #define FRAME_stand_13 12 #define FRAME_stand_14 13 #define FRAME_stand_15 14 #define FRAME_stand_16 15 #define FRAME_stand_17 16 #define FRAME_stand_18 17 #define FRAME_stand_19 18 #define FRAME_stand_20 19 #define FRAME_stand_21 20 #define FRAME_stand_22 21 #define FRAME_stand_23 22 #define FRAME_stand_24 23 #define FRAME_stand_25 24 #define FRAME_stand_26 25 #define FRAME_stand_27 26 #define FRAME_stand_28 27 #define FRAME_stand_29 28 #define FRAME_stand_30 29 #define FRAME_stand_31 30 #define FRAME_stand_32 31 #define FRAME_stand_33 32 #define FRAME_stand_34 33 #define FRAME_stand_35 34 #define FRAME_stand_36 35 #define FRAME_stand_37 36 #define FRAME_stand_38 37 #define FRAME_stand_39 38 #define FRAME_run_01 39 #define FRAME_run_02 40 #define FRAME_run_03 41 #define FRAME_run_04 42 #define FRAME_run_05 43 #define FRAME_run_06 44 #define FRAME_clawatk3_01 45 #define FRAME_clawatk3_02 46 #define FRAME_clawatk3_03 47 #define FRAME_clawatk3_04 48 #define FRAME_clawatk3_05 49 #define FRAME_clawatk3_06 50 #define FRAME_clawatk3_07 51 #define FRAME_clawatk3_08 52 #define FRAME_clawatk3_09 53 #define FRAME_clawatk4_01 54 #define FRAME_clawatk4_02 55 #define FRAME_clawatk4_03 56 #define FRAME_clawatk4_04 57 #define FRAME_clawatk4_05 58 #define FRAME_clawatk4_06 59 #define FRAME_clawatk4_07 60 #define FRAME_clawatk4_08 61 #define FRAME_clawatk5_01 62 #define FRAME_clawatk5_02 63 #define FRAME_clawatk5_03 64 #define FRAME_clawatk5_04 65 #define FRAME_clawatk5_05 66 #define FRAME_clawatk5_06 67 #define FRAME_clawatk5_07 68 #define FRAME_clawatk5_08 69 #define FRAME_clawatk5_09 70 #define FRAME_leapatk_01 71 #define FRAME_leapatk_02 72 #define FRAME_leapatk_03 73 #define FRAME_leapatk_04 74 #define FRAME_leapatk_05 75 #define FRAME_leapatk_06 76 #define FRAME_leapatk_07 77 #define FRAME_leapatk_08 78 #define FRAME_leapatk_09 79 #define FRAME_leapatk_10 80 #define FRAME_leapatk_11 81 #define FRAME_leapatk_12 82 #define FRAME_leapatk_13 83 #define FRAME_leapatk_14 84 #define FRAME_leapatk_15 85 #define FRAME_leapatk_16 86 #define FRAME_leapatk_17 87 #define FRAME_leapatk_18 88 #define FRAME_leapatk_19 89 #define FRAME_pain3_01 90 #define FRAME_pain3_02 91 #define FRAME_pain3_03 92 #define FRAME_pain3_04 93 #define FRAME_pain3_05 94 #define FRAME_pain3_06 95 #define FRAME_pain3_07 96 #define FRAME_pain3_08 97 #define FRAME_pain3_09 98 #define FRAME_pain3_10 99 #define FRAME_pain3_11 100 #define FRAME_pain4_01 101 #define FRAME_pain4_02 102 #define FRAME_pain4_03 103 #define FRAME_pain4_04 104 #define FRAME_pain4_05 105 #define FRAME_pain4_06 106 #define FRAME_pain4_07 107 #define FRAME_pain4_08 108 #define FRAME_pain4_09 109 #define FRAME_pain4_10 110 #define FRAME_pain4_11 111 #define FRAME_pain4_12 112 #define FRAME_pain4_13 113 #define FRAME_death1_01 114 #define FRAME_death1_02 115 #define FRAME_death1_03 116 #define FRAME_death1_04 117 #define FRAME_death1_05 118 #define FRAME_death1_06 119 #define FRAME_death1_07 120 #define FRAME_death1_08 121 #define FRAME_death1_09 122 #define FRAME_death1_10 123 #define FRAME_death2_01 124 #define FRAME_death2_02 125 #define FRAME_death2_03 126 #define FRAME_death2_04 127 #define FRAME_death2_05 128 #define FRAME_death2_06 129 #define FRAME_death2_07 130 #define FRAME_death2_08 131 #define FRAME_death2_09 132 #define FRAME_death2_10 133 #define FRAME_death2_11 134 #define FRAME_death3_01 135 #define FRAME_death3_02 136 #define FRAME_death3_03 137 #define FRAME_death3_04 138 #define FRAME_death3_05 139 #define FRAME_death3_06 140 #define FRAME_death3_07 141 #define FRAME_death4_01 142 #define FRAME_death4_02 143 #define FRAME_death4_03 144 #define FRAME_death4_04 145 #define FRAME_death4_05 146 #define FRAME_death4_06 147 #define FRAME_death4_07 148 #define FRAME_death4_08 149 #define FRAME_death4_09 150 #define FRAME_death4_10 151 #define FRAME_death4_11 152 #define FRAME_death4_12 153 #define FRAME_death4_13 154 #define FRAME_death4_14 155 #define FRAME_death4_15 156 #define FRAME_death4_16 157 #define FRAME_death4_17 158 #define FRAME_death4_18 159 #define FRAME_death4_19 160 #define FRAME_death4_20 161 #define FRAME_death4_21 162 #define FRAME_death4_22 163 #define FRAME_death4_23 164 #define FRAME_death4_24 165 #define FRAME_death4_25 166 #define FRAME_death4_26 167 #define FRAME_death4_27 168 #define FRAME_death4_28 169 #define FRAME_death4_29 170 #define FRAME_death4_30 171 #define FRAME_death4_31 172 #define FRAME_death4_32 173 #define FRAME_death4_33 174 #define FRAME_death4_34 175 #define FRAME_death4_35 176 #define FRAME_rduck_01 177 #define FRAME_rduck_02 178 #define FRAME_rduck_03 179 #define FRAME_rduck_04 180 #define FRAME_rduck_05 181 #define FRAME_rduck_06 182 #define FRAME_rduck_07 183 #define FRAME_rduck_08 184 #define FRAME_rduck_09 185 #define FRAME_rduck_10 186 #define FRAME_rduck_11 187 #define FRAME_rduck_12 188 #define FRAME_rduck_13 189 #define FRAME_lduck_01 190 #define FRAME_lduck_02 191 #define FRAME_lduck_03 192 #define FRAME_lduck_04 193 #define FRAME_lduck_05 194 #define FRAME_lduck_06 195 #define FRAME_lduck_07 196 #define FRAME_lduck_08 197 #define FRAME_lduck_09 198 #define FRAME_lduck_10 199 #define FRAME_lduck_11 200 #define FRAME_lduck_12 201 #define FRAME_lduck_13 202 #define FRAME_idle_01 203 #define FRAME_idle_02 204 #define FRAME_idle_03 205 #define FRAME_idle_04 206 #define FRAME_idle_05 207 #define FRAME_idle_06 208 #define FRAME_idle_07 209 #define FRAME_idle_08 210 #define FRAME_idle_09 211 #define FRAME_idle_10 212 #define FRAME_idle_11 213 #define FRAME_idle_12 214 #define FRAME_idle_13 215 #define FRAME_idle_14 216 #define FRAME_idle_15 217 #define FRAME_idle_16 218 #define FRAME_idle_17 219 #define FRAME_idle_18 220 #define FRAME_idle_19 221 #define FRAME_idle_20 222 #define FRAME_idle_21 223 #define FRAME_idle_22 224 #define FRAME_idle_23 225 #define FRAME_idle_24 226 #define FRAME_idle_25 227 #define FRAME_idle_26 228 #define FRAME_idle_27 229 #define FRAME_idle_28 230 #define FRAME_idle_29 231 #define FRAME_idle_30 232 #define FRAME_idle_31 233 #define FRAME_idle_32 234 #define FRAME_spit_01 235 #define FRAME_spit_02 236 #define FRAME_spit_03 237 #define FRAME_spit_04 238 #define FRAME_spit_05 239 #define FRAME_spit_06 240 #define FRAME_spit_07 241 #define FRAME_amb_01 242 #define FRAME_amb_02 243 #define FRAME_amb_03 244 #define FRAME_amb_04 245 #define FRAME_wdeath_01 246 #define FRAME_wdeath_02 247 #define FRAME_wdeath_03 248 #define FRAME_wdeath_04 249 #define FRAME_wdeath_05 250 #define FRAME_wdeath_06 251 #define FRAME_wdeath_07 252 #define FRAME_wdeath_08 253 #define FRAME_wdeath_09 254 #define FRAME_wdeath_10 255 #define FRAME_wdeath_11 256 #define FRAME_wdeath_12 257 #define FRAME_wdeath_13 258 #define FRAME_wdeath_14 259 #define FRAME_wdeath_15 260 #define FRAME_wdeath_16 261 #define FRAME_wdeath_17 262 #define FRAME_wdeath_18 263 #define FRAME_wdeath_19 264 #define FRAME_wdeath_20 265 #define FRAME_wdeath_21 266 #define FRAME_wdeath_22 267 #define FRAME_wdeath_23 268 #define FRAME_wdeath_24 269 #define FRAME_wdeath_25 270 #define FRAME_wdeath_26 271 #define FRAME_wdeath_27 272 #define FRAME_wdeath_28 273 #define FRAME_wdeath_29 274 #define FRAME_wdeath_30 275 #define FRAME_wdeath_31 276 #define FRAME_wdeath_32 277 #define FRAME_wdeath_33 278 #define FRAME_wdeath_34 279 #define FRAME_wdeath_35 280 #define FRAME_wdeath_36 281 #define FRAME_wdeath_37 282 #define FRAME_wdeath_38 283 #define FRAME_wdeath_39 284 #define FRAME_wdeath_40 285 #define FRAME_wdeath_41 286 #define FRAME_wdeath_42 287 #define FRAME_wdeath_43 288 #define FRAME_wdeath_44 289 #define FRAME_wdeath_45 290 #define FRAME_swim_01 291 #define FRAME_swim_02 292 #define FRAME_swim_03 293 #define FRAME_swim_04 294 #define FRAME_swim_05 295 #define FRAME_swim_06 296 #define FRAME_swim_07 297 #define FRAME_swim_08 298 #define FRAME_swim_09 299 #define FRAME_swim_10 300 #define FRAME_swim_11 301 #define FRAME_swim_12 302 #define FRAME_swim_13 303 #define FRAME_swim_14 304 #define FRAME_swim_15 305 #define FRAME_swim_16 306 #define FRAME_swim_17 307 #define FRAME_swim_18 308 #define FRAME_swim_19 309 #define FRAME_swim_20 310 #define FRAME_swim_21 311 #define FRAME_swim_22 312 #define FRAME_swim_23 313 #define FRAME_swim_24 314 #define FRAME_swim_25 315 #define FRAME_swim_26 316 #define FRAME_swim_27 317 #define FRAME_swim_28 318 #define FRAME_swim_29 319 #define FRAME_swim_30 320 #define FRAME_swim_31 321 #define FRAME_swim_32 322 #define FRAME_attack_01 323 #define FRAME_attack_02 324 #define FRAME_attack_03 325 #define FRAME_attack_04 326 #define FRAME_attack_05 327 #define FRAME_attack_06 328 #define FRAME_attack_07 329 #define FRAME_attack_08 330 #define FRAME_attack_09 331 #define FRAME_attack_10 332 #define FRAME_attack_11 333 #define FRAME_attack_12 334 #define FRAME_attack_13 335 #define FRAME_attack_14 336 #define FRAME_attack_15 337 #define FRAME_attack_16 338 #define FRAME_attack_17 339 #define FRAME_attack_18 340 #define FRAME_attack_19 341 #define FRAME_attack_20 342 #define FRAME_attack_21 343 #define FRAME_pain_01 344 #define FRAME_pain_02 345 #define FRAME_pain_03 346 #define FRAME_pain_04 347 #define FRAME_pain_05 348 #define FRAME_pain_06 349 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/gladiator/000077500000000000000000000000001477320050300203645ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/gladiator/gladb.c000066400000000000000000000236431477320050300216110ustar00rootroot00000000000000/* ======================================================================= * * Gladiator B. (Special variant of gladiator only found in Xatrix) * * ======================================================================= */ #include "../../header/local.h" #include "gladiator.h" static int sound_pain1; static int sound_pain2; static int sound_die; static int sound_gun; static int sound_cleaver_swing; static int sound_cleaver_hit; static int sound_cleaver_miss; static int sound_idle; static int sound_search; static int sound_sight; void gladb_idle(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); } void gladb_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); } void gladb_search(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_search, 1, ATTN_NORM, 0); } void gladb_cleaver_swing(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_cleaver_swing, 1, ATTN_NORM, 0); } static mframe_t gladb_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t gladb_move_stand = { FRAME_stand1, FRAME_stand7, gladb_frames_stand, NULL }; void gladb_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &gladb_move_stand; } static mframe_t gladb_frames_walk[] = { {ai_walk, 15, NULL}, {ai_walk, 7, NULL}, {ai_walk, 6, NULL}, {ai_walk, 5, NULL}, {ai_walk, 2, NULL}, {ai_walk, 0, NULL}, {ai_walk, 2, NULL}, {ai_walk, 8, NULL}, {ai_walk, 12, NULL}, {ai_walk, 8, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 2, NULL}, {ai_walk, 2, NULL}, {ai_walk, 1, NULL}, {ai_walk, 8, NULL} }; mmove_t gladb_move_walk = { FRAME_walk1, FRAME_walk16, gladb_frames_walk, NULL }; void gladb_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &gladb_move_walk; } static mframe_t gladb_frames_run[] = { {ai_run, 23, NULL}, {ai_run, 14, NULL}, {ai_run, 14, NULL}, {ai_run, 21, NULL}, {ai_run, 12, NULL}, {ai_run, 13, NULL} }; mmove_t gladb_move_run = { FRAME_run1, FRAME_run6, gladb_frames_run, NULL }; void gladb_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &gladb_move_stand; } else { self->monsterinfo.currentmove = &gladb_move_run; } } void GladbMelee(edict_t *self) { vec3_t aim; if (!self) { return; } VectorSet(aim, MELEE_DISTANCE, self->mins[0], -4); if (fire_hit(self, aim, (20 + (rand() % 5)), 300)) { gi.sound(self, CHAN_AUTO, sound_cleaver_hit, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_AUTO, sound_cleaver_miss, 1, ATTN_NORM, 0); } } static mframe_t gladb_frames_attack_melee[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, gladb_cleaver_swing}, {ai_charge, 0, NULL}, {ai_charge, 0, GladbMelee}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, gladb_cleaver_swing}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, GladbMelee}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t gladb_move_attack_melee = { FRAME_melee1, FRAME_melee17, gladb_frames_attack_melee, gladb_run }; void gladb_melee(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &gladb_move_attack_melee; } void gladbGun(edict_t *self) { vec3_t start; vec3_t dir; vec3_t forward, right; if (!self) { return; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_GLADIATOR_RAILGUN_1], forward, right, start); /* calc direction to where we targted */ VectorSubtract(self->pos1, start, dir); VectorNormalize(dir); fire_plasma(self, start, dir, 100, 725, 60, 60); } void gladbGun_check(edict_t *self) { if (!self) { return; } if (skill->value == SKILL_HARDPLUS) { gladbGun(self); } } static mframe_t gladb_frames_attack_gun[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, gladbGun}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, gladbGun}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, gladbGun_check} }; mmove_t gladb_move_attack_gun = { FRAME_attack1, FRAME_attack9, gladb_frames_attack_gun, gladb_run }; void gladb_attack(edict_t *self) { float range; vec3_t v; if (!self) { return; } /* a small safe zone but not for stand-ground ones since players can abuse it by standing still inside this range */ if (!(self->monsterinfo.aiflags & AI_STAND_GROUND)) { VectorSubtract(self->s.origin, self->enemy->s.origin, v); range = VectorLength(v); if (range <= (MELEE_DISTANCE + 32)) { return; } } /* charge up the railgun */ gi.sound(self, CHAN_WEAPON, sound_gun, 1, ATTN_NORM, 0); VectorCopy(self->enemy->s.origin, self->pos1); /* save for aiming the shot */ self->pos1[2] += self->enemy->viewheight; self->monsterinfo.currentmove = &gladb_move_attack_gun; } static mframe_t gladb_frames_pain[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t gladb_move_pain = { FRAME_pain1, FRAME_pain6, gladb_frames_pain, gladb_run }; static mframe_t gladb_frames_pain_air[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t gladb_move_pain_air = { FRAME_painup1, FRAME_painup7, gladb_frames_pain_air, gladb_run }; void gladb_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { if ((self->velocity[2] > 100) && (self->monsterinfo.currentmove == &gladb_move_pain)) { self->monsterinfo.currentmove = &gladb_move_pain_air; } return; } self->pain_debounce_time = level.time + 3; if (random() < 0.5) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); } if (self->velocity[2] > 100) { self->monsterinfo.currentmove = &gladb_move_pain_air; } else { self->monsterinfo.currentmove = &gladb_move_pain; } } void gladb_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, -8); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } static mframe_t gladb_frames_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t gladb_move_death = { FRAME_death1, FRAME_death22, gladb_frames_death, gladb_dead }; void gladb_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage /*unused */, vec3_t point) { int n; if (!self) { return; } /* check for gib */ if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 2; n++) { ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } /* regular death */ gi.sound(self, CHAN_VOICE, sound_die, 1, ATTN_NORM, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; self->monsterinfo.currentmove = &gladb_move_death; } /* * QUAKED monster_gladb (1 .5 0) (-32 -32 -24) (32 32 64) Ambush Trigger_Spawn Sight */ void SP_monster_gladb(edict_t *self) { if (deathmatch->value) { G_FreeEdict(self); return; } sound_pain1 = gi.soundindex("gladiator/pain.wav"); sound_pain2 = gi.soundindex("gladiator/gldpain2.wav"); sound_die = gi.soundindex("gladiator/glddeth2.wav"); sound_gun = gi.soundindex("weapons/plasshot.wav"); sound_cleaver_swing = gi.soundindex("gladiator/melee1.wav"); sound_cleaver_hit = gi.soundindex("gladiator/melee2.wav"); sound_cleaver_miss = gi.soundindex("gladiator/melee3.wav"); sound_idle = gi.soundindex("gladiator/gldidle1.wav"); sound_search = gi.soundindex("gladiator/gldsrch1.wav"); sound_sight = gi.soundindex("gladiator/sight.wav"); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/gladb/tris.md2"); VectorSet(self->mins, -32, -32, -24); VectorSet(self->maxs, 32, 32, 64); self->health = 800; self->gib_health = -175; self->mass = 350; self->pain = gladb_pain; self->die = gladb_die; self->monsterinfo.stand = gladb_stand; self->monsterinfo.walk = gladb_walk; self->monsterinfo.run = gladb_run; self->monsterinfo.dodge = NULL; self->monsterinfo.attack = gladb_attack; self->monsterinfo.melee = gladb_melee; self->monsterinfo.sight = gladb_sight; self->monsterinfo.idle = gladb_idle; self->monsterinfo.search = gladb_search; gi.linkentity(self); self->monsterinfo.currentmove = &gladb_move_stand; self->monsterinfo.scale = MODEL_SCALE; self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = 400; walkmonster_start(self); } xatrix-XATRIX_2_14/src/monster/gladiator/gladiator.c000066400000000000000000000266031477320050300225050ustar00rootroot00000000000000/* * Copyright (C) 1997-2001 Id Software, Inc. * * 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. * * ======================================================================= * * Gladiator. * * ======================================================================= */ #include "../../header/local.h" #include "gladiator.h" static int sound_pain1; static int sound_pain2; static int sound_die; static int sound_gun; static int sound_cleaver_swing; static int sound_cleaver_hit; static int sound_cleaver_miss; static int sound_idle; static int sound_search; static int sound_sight; static int sound_step; static int sound_step2; void gladiator_footstep(edict_t *self) { if (!g_monsterfootsteps->value) return; // Lazy loading for savegame compatibility. if (sound_step == 0 || sound_step2 == 0) { sound_step = gi.soundindex("gladiator/step1.wav"); sound_step2 = gi.soundindex("gladiator/step2.wav"); } if (randk() % 2 == 0) { gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); } } void gladiator_idle(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); } void gladiator_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); } void gladiator_search(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_search, 1, ATTN_NORM, 0); } void gladiator_cleaver_swing(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_cleaver_swing, 1, ATTN_NORM, 0); } static mframe_t gladiator_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t gladiator_move_stand = { FRAME_stand1, FRAME_stand7, gladiator_frames_stand, NULL }; void gladiator_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &gladiator_move_stand; } static mframe_t gladiator_frames_walk[] = { {ai_walk, 15, NULL}, {ai_walk, 7, NULL}, {ai_walk, 6, NULL}, {ai_walk, 5, NULL}, {ai_walk, 2, gladiator_footstep}, {ai_walk, 0, NULL}, {ai_walk, 2, NULL}, {ai_walk, 8, NULL}, {ai_walk, 12, NULL}, {ai_walk, 8, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 2, gladiator_footstep}, {ai_walk, 2, NULL}, {ai_walk, 1, NULL}, {ai_walk, 8, NULL} }; mmove_t gladiator_move_walk = { FRAME_walk1, FRAME_walk16, gladiator_frames_walk, NULL }; void gladiator_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &gladiator_move_walk; } static mframe_t gladiator_frames_run[] = { {ai_run, 23, NULL}, {ai_run, 14, NULL}, {ai_run, 14, gladiator_footstep}, {ai_run, 21, NULL}, {ai_run, 12, NULL}, {ai_run, 13, gladiator_footstep} }; mmove_t gladiator_move_run = { FRAME_run1, FRAME_run6, gladiator_frames_run, NULL }; void gladiator_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &gladiator_move_stand; } else { self->monsterinfo.currentmove = &gladiator_move_run; } } void GaldiatorMelee(edict_t *self) { vec3_t aim; if (!self) { return; } VectorSet(aim, MELEE_DISTANCE, self->mins[0], -4); if (fire_hit(self, aim, (20 + (rand() % 5)), 300)) { gi.sound(self, CHAN_AUTO, sound_cleaver_hit, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_AUTO, sound_cleaver_miss, 1, ATTN_NORM, 0); } } static mframe_t gladiator_frames_attack_melee[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, gladiator_cleaver_swing}, {ai_charge, 0, NULL}, {ai_charge, 0, GaldiatorMelee}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, gladiator_cleaver_swing}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, GaldiatorMelee}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t gladiator_move_attack_melee = { FRAME_melee1, FRAME_melee17, gladiator_frames_attack_melee, gladiator_run }; void gladiator_melee(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &gladiator_move_attack_melee; } void GladiatorGun(edict_t *self) { vec3_t start; vec3_t dir; vec3_t forward, right; if (!self) { return; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_GLADIATOR_RAILGUN_1], forward, right, start); /* calc direction to where we targted */ VectorSubtract(self->pos1, start, dir); VectorNormalize(dir); monster_fire_railgun(self, start, dir, 50, 100, MZ2_GLADIATOR_RAILGUN_1); } static mframe_t gladiator_frames_attack_gun[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, GladiatorGun}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t gladiator_move_attack_gun = { FRAME_attack1, FRAME_attack9, gladiator_frames_attack_gun, gladiator_run }; void gladiator_attack(edict_t *self) { float range; vec3_t v; if (!self) { return; } /* a small safe zone but not for stand-ground ones since players can abuse it by standing still inside this range */ if (!(self->monsterinfo.aiflags & AI_STAND_GROUND)) { VectorSubtract(self->s.origin, self->enemy->s.origin, v); range = VectorLength(v); if (range <= (MELEE_DISTANCE + 32)) { return; } } /* charge up the railgun */ gi.sound(self, CHAN_WEAPON, sound_gun, 1, ATTN_NORM, 0); VectorCopy(self->enemy->s.origin, self->pos1); /* save for aiming the shot */ self->pos1[2] += self->enemy->viewheight; self->monsterinfo.currentmove = &gladiator_move_attack_gun; } static mframe_t gladiator_frames_pain[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t gladiator_move_pain = { FRAME_pain1, FRAME_pain6, gladiator_frames_pain, gladiator_run }; static mframe_t gladiator_frames_pain_air[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t gladiator_move_pain_air = { FRAME_painup1, FRAME_painup7, gladiator_frames_pain_air, gladiator_run }; void gladiator_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { if ((self->velocity[2] > 100) && (self->monsterinfo.currentmove == &gladiator_move_pain)) { self->monsterinfo.currentmove = &gladiator_move_pain_air; } return; } self->pain_debounce_time = level.time + 3; if (random() < 0.5) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); } if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } if (self->velocity[2] > 100) { self->monsterinfo.currentmove = &gladiator_move_pain_air; } else { self->monsterinfo.currentmove = &gladiator_move_pain; } } void gladiator_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, -8); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } static mframe_t gladiator_frames_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t gladiator_move_death = { FRAME_death1, FRAME_death22, gladiator_frames_death, gladiator_dead }; void gladiator_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage /*unused */, vec3_t point) { int n; if (!self) { return; } /* check for gib */ if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex( "misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 2; n++) { ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } /* regular death */ gi.sound(self, CHAN_VOICE, sound_die, 1, ATTN_NORM, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; self->monsterinfo.currentmove = &gladiator_move_death; } /* * QUAKED monster_gladiator (1 .5 0) (-32 -32 -24) (32 32 64) Ambush Trigger_Spawn Sight */ void SP_monster_gladiator(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } // Force recaching at next footstep to ensure // that the sound indices are correct. sound_step = 0; sound_step2 = 0; sound_pain1 = gi.soundindex("gladiator/pain.wav"); sound_pain2 = gi.soundindex("gladiator/gldpain2.wav"); sound_die = gi.soundindex("gladiator/glddeth2.wav"); sound_gun = gi.soundindex("gladiator/railgun.wav"); sound_cleaver_swing = gi.soundindex("gladiator/melee1.wav"); sound_cleaver_hit = gi.soundindex("gladiator/melee2.wav"); sound_cleaver_miss = gi.soundindex("gladiator/melee3.wav"); sound_idle = gi.soundindex("gladiator/gldidle1.wav"); sound_search = gi.soundindex("gladiator/gldsrch1.wav"); sound_sight = gi.soundindex("gladiator/sight.wav"); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/gladiatr/tris.md2"); VectorSet(self->mins, -32, -32, -24); VectorSet(self->maxs, 32, 32, 64); self->health = 400; self->gib_health = -175; self->mass = 400; self->pain = gladiator_pain; self->die = gladiator_die; self->monsterinfo.stand = gladiator_stand; self->monsterinfo.walk = gladiator_walk; self->monsterinfo.run = gladiator_run; self->monsterinfo.dodge = NULL; self->monsterinfo.attack = gladiator_attack; self->monsterinfo.melee = gladiator_melee; self->monsterinfo.sight = gladiator_sight; self->monsterinfo.idle = gladiator_idle; self->monsterinfo.search = gladiator_search; gi.linkentity(self); self->monsterinfo.currentmove = &gladiator_move_stand; self->monsterinfo.scale = MODEL_SCALE; walkmonster_start(self); } xatrix-XATRIX_2_14/src/monster/gladiator/gladiator.h000066400000000000000000000045101477320050300225030ustar00rootroot00000000000000/* ======================================================================= * * Gladiator animations. * * ======================================================================= */ #define FRAME_stand1 0 #define FRAME_stand2 1 #define FRAME_stand3 2 #define FRAME_stand4 3 #define FRAME_stand5 4 #define FRAME_stand6 5 #define FRAME_stand7 6 #define FRAME_walk1 7 #define FRAME_walk2 8 #define FRAME_walk3 9 #define FRAME_walk4 10 #define FRAME_walk5 11 #define FRAME_walk6 12 #define FRAME_walk7 13 #define FRAME_walk8 14 #define FRAME_walk9 15 #define FRAME_walk10 16 #define FRAME_walk11 17 #define FRAME_walk12 18 #define FRAME_walk13 19 #define FRAME_walk14 20 #define FRAME_walk15 21 #define FRAME_walk16 22 #define FRAME_run1 23 #define FRAME_run2 24 #define FRAME_run3 25 #define FRAME_run4 26 #define FRAME_run5 27 #define FRAME_run6 28 #define FRAME_melee1 29 #define FRAME_melee2 30 #define FRAME_melee3 31 #define FRAME_melee4 32 #define FRAME_melee5 33 #define FRAME_melee6 34 #define FRAME_melee7 35 #define FRAME_melee8 36 #define FRAME_melee9 37 #define FRAME_melee10 38 #define FRAME_melee11 39 #define FRAME_melee12 40 #define FRAME_melee13 41 #define FRAME_melee14 42 #define FRAME_melee15 43 #define FRAME_melee16 44 #define FRAME_melee17 45 #define FRAME_attack1 46 #define FRAME_attack2 47 #define FRAME_attack3 48 #define FRAME_attack4 49 #define FRAME_attack5 50 #define FRAME_attack6 51 #define FRAME_attack7 52 #define FRAME_attack8 53 #define FRAME_attack9 54 #define FRAME_pain1 55 #define FRAME_pain2 56 #define FRAME_pain3 57 #define FRAME_pain4 58 #define FRAME_pain5 59 #define FRAME_pain6 60 #define FRAME_death1 61 #define FRAME_death2 62 #define FRAME_death3 63 #define FRAME_death4 64 #define FRAME_death5 65 #define FRAME_death6 66 #define FRAME_death7 67 #define FRAME_death8 68 #define FRAME_death9 69 #define FRAME_death10 70 #define FRAME_death11 71 #define FRAME_death12 72 #define FRAME_death13 73 #define FRAME_death14 74 #define FRAME_death15 75 #define FRAME_death16 76 #define FRAME_death17 77 #define FRAME_death18 78 #define FRAME_death19 79 #define FRAME_death20 80 #define FRAME_death21 81 #define FRAME_death22 82 #define FRAME_painup1 83 #define FRAME_painup2 84 #define FRAME_painup3 85 #define FRAME_painup4 86 #define FRAME_painup5 87 #define FRAME_painup6 88 #define FRAME_painup7 89 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/gunner/000077500000000000000000000000001477320050300177145ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/gunner/gunner.c000066400000000000000000000411541477320050300213630ustar00rootroot00000000000000/* * Copyright (C) 1997-2001 Id Software, Inc. * * 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. * * ======================================================================= * * Gunner. * * ======================================================================= */ #include "../../header/local.h" #include "gunner.h" static int sound_pain; static int sound_pain2; static int sound_death; static int sound_idle; static int sound_open; static int sound_search; static int sound_sight; static int sound_step; static int sound_step2; qboolean visible(edict_t *self, edict_t *other); void GunnerGrenade(edict_t *self); void GunnerFire(edict_t *self); void gunner_fire_chain(edict_t *self); void gunner_refire_chain(edict_t *self); void gunner_stand(edict_t *self); void gunner_footstep(edict_t *self) { if (!g_monsterfootsteps->value) return; // Lazy loading for savegame compatibility. if (sound_step == 0 || sound_step2 == 0) { sound_step = gi.soundindex("gunner/step1.wav"); sound_step2 = gi.soundindex("gunner/step2.wav"); } if (randk() % 2 == 0) { gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); } } void gunner_idlesound(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); } void gunner_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); } void gunner_search(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_search, 1, ATTN_NORM, 0); } static mframe_t gunner_frames_fidget[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, gunner_idlesound}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t gunner_move_fidget = { FRAME_stand31, FRAME_stand70, gunner_frames_fidget, gunner_stand }; void gunner_fidget(edict_t *self) { if (!self) { return; } if (self->enemy) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { return; } if (random() <= 0.05) { self->monsterinfo.currentmove = &gunner_move_fidget; } } static mframe_t gunner_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, gunner_fidget}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, gunner_fidget}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, gunner_fidget} }; mmove_t gunner_move_stand = { FRAME_stand01, FRAME_stand30, gunner_frames_stand, NULL }; void gunner_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &gunner_move_stand; } static mframe_t gunner_frames_walk[] = { {ai_walk, 0, gunner_footstep}, {ai_walk, 3, NULL}, {ai_walk, 4, NULL}, {ai_walk, 5, NULL}, {ai_walk, 7, NULL}, {ai_walk, 2, gunner_footstep}, {ai_walk, 6, NULL}, {ai_walk, 4, NULL}, {ai_walk, 2, NULL}, {ai_walk, 7, NULL}, {ai_walk, 5, NULL}, {ai_walk, 7, NULL}, {ai_walk, 4, gunner_footstep} }; mmove_t gunner_move_walk = { FRAME_walk07, FRAME_walk19, gunner_frames_walk, NULL }; void gunner_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &gunner_move_walk; } static mframe_t gunner_frames_run[] = { {ai_run, 26, NULL}, {ai_run, 9, gunner_footstep}, {ai_run, 9, NULL}, {ai_run, 9, NULL}, {ai_run, 15, NULL}, {ai_run, 10, gunner_footstep}, {ai_run, 13, NULL}, {ai_run, 6, NULL} }; mmove_t gunner_move_run = { FRAME_run01, FRAME_run08, gunner_frames_run, NULL }; void gunner_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &gunner_move_stand; } else { self->monsterinfo.currentmove = &gunner_move_run; } } static mframe_t gunner_frames_runandshoot[] = { {ai_run, 32, NULL}, {ai_run, 15, gunner_footstep}, {ai_run, 10, NULL}, {ai_run, 18, NULL}, {ai_run, 8, gunner_footstep}, {ai_run, 20, NULL} }; mmove_t gunner_move_runandshoot = { FRAME_runs01, FRAME_runs06, gunner_frames_runandshoot, NULL }; void gunner_runandshoot(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &gunner_move_runandshoot; } static mframe_t gunner_frames_pain3[] = { {ai_move, -3, NULL}, {ai_move, 1, NULL}, {ai_move, 1, NULL}, {ai_move, 0, NULL}, {ai_move, 1, NULL} }; mmove_t gunner_move_pain3 = { FRAME_pain301, FRAME_pain305, gunner_frames_pain3, gunner_run }; static mframe_t gunner_frames_pain2[] = { {ai_move, -2, NULL}, {ai_move, 11, NULL}, {ai_move, 6, gunner_footstep}, {ai_move, 2, NULL}, {ai_move, -1, NULL}, {ai_move, -7, NULL}, {ai_move, -2, NULL}, {ai_move, -7, gunner_footstep} }; mmove_t gunner_move_pain2 = { FRAME_pain201, FRAME_pain208, gunner_frames_pain2, gunner_run }; static mframe_t gunner_frames_pain1[] = { {ai_move, 2, NULL}, {ai_move, 0, NULL}, {ai_move, -5, gunner_footstep}, {ai_move, 3, NULL}, {ai_move, -1, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 1, NULL}, {ai_move, 1, NULL}, {ai_move, 2, NULL}, {ai_move, 1, gunner_footstep}, {ai_move, 0, NULL}, {ai_move, -2, NULL}, {ai_move, -2, NULL}, {ai_move, 0, gunner_footstep}, {ai_move, 0, NULL} }; mmove_t gunner_move_pain1 = { FRAME_pain101, FRAME_pain118, gunner_frames_pain1, gunner_run }; void gunner_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } self->pain_debounce_time = level.time + 3; if (rand() & 1) { gi.sound(self, CHAN_VOICE, sound_pain, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); } if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } if (damage <= 10) { self->monsterinfo.currentmove = &gunner_move_pain3; } else if (damage <= 25) { self->monsterinfo.currentmove = &gunner_move_pain2; } else { self->monsterinfo.currentmove = &gunner_move_pain1; } } void gunner_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, -8); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } static mframe_t gunner_frames_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -7, NULL}, {ai_move, -3, NULL}, {ai_move, -5, NULL}, {ai_move, 8, NULL}, {ai_move, 6, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t gunner_move_death = { FRAME_death01, FRAME_death11, gunner_frames_death, gunner_dead }; void gunner_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage /* unused */, vec3_t point) { int n; if (!self) { return; } /* check for gib */ if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 2; n++) { ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } /* regular death */ gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; self->monsterinfo.currentmove = &gunner_move_death; } void gunner_duck_down(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_DUCKED) { return; } self->monsterinfo.aiflags |= AI_DUCKED; if (skill->value >= SKILL_HARD) { if (random() > 0.5) { GunnerGrenade(self); } } self->maxs[2] -= 32; self->takedamage = DAMAGE_YES; self->monsterinfo.pausetime = level.time + 1; gi.linkentity(self); } void gunner_duck_hold(edict_t *self) { if (!self) { return; } if (level.time >= self->monsterinfo.pausetime) { self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; } else { self->monsterinfo.aiflags |= AI_HOLD_FRAME; } } void gunner_duck_up(edict_t *self) { if (!self) { return; } self->monsterinfo.aiflags &= ~AI_DUCKED; self->maxs[2] += 32; self->takedamage = DAMAGE_AIM; gi.linkentity(self); } static mframe_t gunner_frames_duck[] = { {ai_move, 1, gunner_duck_down}, {ai_move, 1, NULL}, {ai_move, 1, gunner_duck_hold}, {ai_move, 0, NULL}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, 0, gunner_duck_up}, {ai_move, -1, NULL} }; mmove_t gunner_move_duck = { FRAME_duck01, FRAME_duck08, gunner_frames_duck, gunner_run }; void gunner_dodge(edict_t *self, edict_t *attacker, float eta /* unused */) { if (!self || !attacker) { return; } if (random() > 0.25) { return; } if (!self->enemy) { self->enemy = attacker; FoundTarget(self); } self->monsterinfo.currentmove = &gunner_move_duck; } void gunner_opengun(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_open, 1, ATTN_IDLE, 0); } void GunnerFire(edict_t *self) { vec3_t start; vec3_t forward, right; vec3_t target; vec3_t aim; int flash_number; if (!self) { return; } flash_number = MZ2_GUNNER_MACHINEGUN_1 + (self->s.frame - FRAME_attak216); AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], forward, right, start); /* project enemy back a bit and target there */ VectorCopy(self->enemy->s.origin, target); VectorMA(target, -0.2, self->enemy->velocity, target); target[2] += self->enemy->viewheight; VectorSubtract(target, start, aim); VectorNormalize(aim); monster_fire_bullet(self, start, aim, 3, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_number); } void GunnerGrenade(edict_t *self) { vec3_t start; vec3_t forward, right; vec3_t aim; int flash_number; if (!self) { return; } if (self->s.frame == FRAME_attak105) { flash_number = MZ2_GUNNER_GRENADE_1; } else if (self->s.frame == FRAME_attak108) { flash_number = MZ2_GUNNER_GRENADE_2; } else if (self->s.frame == FRAME_attak111) { flash_number = MZ2_GUNNER_GRENADE_3; } else { flash_number = MZ2_GUNNER_GRENADE_4; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], forward, right, start); VectorCopy(forward, aim); monster_fire_grenade(self, start, aim, 50, 600, flash_number); } static mframe_t gunner_frames_attack_chain[] = { {ai_charge, 0, gunner_opengun}, {ai_charge, 0, gunner_footstep}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t gunner_move_attack_chain = { FRAME_attak209, FRAME_attak215, gunner_frames_attack_chain, gunner_fire_chain }; static mframe_t gunner_frames_fire_chain[] = { {ai_charge, 0, GunnerFire}, {ai_charge, 0, GunnerFire}, {ai_charge, 0, GunnerFire}, {ai_charge, 0, GunnerFire}, {ai_charge, 0, GunnerFire}, {ai_charge, 0, GunnerFire}, {ai_charge, 0, GunnerFire}, {ai_charge, 0, GunnerFire} }; mmove_t gunner_move_fire_chain = { FRAME_attak216, FRAME_attak223, gunner_frames_fire_chain, gunner_refire_chain }; static mframe_t gunner_frames_endfire_chain[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, gunner_footstep} }; mmove_t gunner_move_endfire_chain = { FRAME_attak224, FRAME_attak230, gunner_frames_endfire_chain, gunner_run }; static mframe_t gunner_frames_attack_grenade[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, GunnerGrenade}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, GunnerGrenade}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, GunnerGrenade}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, GunnerGrenade}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t gunner_move_attack_grenade = { FRAME_attak101, FRAME_attak121, gunner_frames_attack_grenade, gunner_run }; void gunner_attack(edict_t *self) { if (!self) { return; } if (range(self, self->enemy) == RANGE_MELEE) { self->monsterinfo.currentmove = &gunner_move_attack_chain; } else { if (random() <= 0.5) { self->monsterinfo.currentmove = &gunner_move_attack_grenade; } else { self->monsterinfo.currentmove = &gunner_move_attack_chain; } } } void gunner_fire_chain(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &gunner_move_fire_chain; } void gunner_refire_chain(edict_t *self) { if (!self) { return; } if (self->enemy->health > 0) { if (visible(self, self->enemy)) { if (random() <= 0.5) { self->monsterinfo.currentmove = &gunner_move_fire_chain; return; } } } self->monsterinfo.currentmove = &gunner_move_endfire_chain; } /* * QUAKED monster_gunner (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_gunner(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } // Force recaching at next footstep to ensure // that the sound indices are correct. sound_step = 0; sound_step2 = 0; sound_death = gi.soundindex("gunner/death1.wav"); sound_pain = gi.soundindex("gunner/gunpain2.wav"); sound_pain2 = gi.soundindex("gunner/gunpain1.wav"); sound_idle = gi.soundindex("gunner/gunidle1.wav"); sound_open = gi.soundindex("gunner/gunatck1.wav"); sound_search = gi.soundindex("gunner/gunsrch1.wav"); sound_sight = gi.soundindex("gunner/sight1.wav"); gi.soundindex("gunner/gunatck2.wav"); gi.soundindex("gunner/gunatck3.wav"); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/gunner/tris.md2"); VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, 32); self->health = 175; self->gib_health = -70; self->mass = 200; self->pain = gunner_pain; self->die = gunner_die; self->monsterinfo.stand = gunner_stand; self->monsterinfo.walk = gunner_walk; self->monsterinfo.run = gunner_run; self->monsterinfo.dodge = gunner_dodge; self->monsterinfo.attack = gunner_attack; self->monsterinfo.melee = NULL; self->monsterinfo.sight = gunner_sight; self->monsterinfo.search = gunner_search; gi.linkentity(self); self->monsterinfo.currentmove = &gunner_move_stand; self->monsterinfo.scale = MODEL_SCALE; walkmonster_start(self); } xatrix-XATRIX_2_14/src/monster/gunner/gunner.h000066400000000000000000000126361477320050300213730ustar00rootroot00000000000000/* ======================================================================= * * Gunner animations. * * ======================================================================= */ #define FRAME_stand01 0 #define FRAME_stand02 1 #define FRAME_stand03 2 #define FRAME_stand04 3 #define FRAME_stand05 4 #define FRAME_stand06 5 #define FRAME_stand07 6 #define FRAME_stand08 7 #define FRAME_stand09 8 #define FRAME_stand10 9 #define FRAME_stand11 10 #define FRAME_stand12 11 #define FRAME_stand13 12 #define FRAME_stand14 13 #define FRAME_stand15 14 #define FRAME_stand16 15 #define FRAME_stand17 16 #define FRAME_stand18 17 #define FRAME_stand19 18 #define FRAME_stand20 19 #define FRAME_stand21 20 #define FRAME_stand22 21 #define FRAME_stand23 22 #define FRAME_stand24 23 #define FRAME_stand25 24 #define FRAME_stand26 25 #define FRAME_stand27 26 #define FRAME_stand28 27 #define FRAME_stand29 28 #define FRAME_stand30 29 #define FRAME_stand31 30 #define FRAME_stand32 31 #define FRAME_stand33 32 #define FRAME_stand34 33 #define FRAME_stand35 34 #define FRAME_stand36 35 #define FRAME_stand37 36 #define FRAME_stand38 37 #define FRAME_stand39 38 #define FRAME_stand40 39 #define FRAME_stand41 40 #define FRAME_stand42 41 #define FRAME_stand43 42 #define FRAME_stand44 43 #define FRAME_stand45 44 #define FRAME_stand46 45 #define FRAME_stand47 46 #define FRAME_stand48 47 #define FRAME_stand49 48 #define FRAME_stand50 49 #define FRAME_stand51 50 #define FRAME_stand52 51 #define FRAME_stand53 52 #define FRAME_stand54 53 #define FRAME_stand55 54 #define FRAME_stand56 55 #define FRAME_stand57 56 #define FRAME_stand58 57 #define FRAME_stand59 58 #define FRAME_stand60 59 #define FRAME_stand61 60 #define FRAME_stand62 61 #define FRAME_stand63 62 #define FRAME_stand64 63 #define FRAME_stand65 64 #define FRAME_stand66 65 #define FRAME_stand67 66 #define FRAME_stand68 67 #define FRAME_stand69 68 #define FRAME_stand70 69 #define FRAME_walk01 70 #define FRAME_walk02 71 #define FRAME_walk03 72 #define FRAME_walk04 73 #define FRAME_walk05 74 #define FRAME_walk06 75 #define FRAME_walk07 76 #define FRAME_walk08 77 #define FRAME_walk09 78 #define FRAME_walk10 79 #define FRAME_walk11 80 #define FRAME_walk12 81 #define FRAME_walk13 82 #define FRAME_walk14 83 #define FRAME_walk15 84 #define FRAME_walk16 85 #define FRAME_walk17 86 #define FRAME_walk18 87 #define FRAME_walk19 88 #define FRAME_walk20 89 #define FRAME_walk21 90 #define FRAME_walk22 91 #define FRAME_walk23 92 #define FRAME_walk24 93 #define FRAME_run01 94 #define FRAME_run02 95 #define FRAME_run03 96 #define FRAME_run04 97 #define FRAME_run05 98 #define FRAME_run06 99 #define FRAME_run07 100 #define FRAME_run08 101 #define FRAME_runs01 102 #define FRAME_runs02 103 #define FRAME_runs03 104 #define FRAME_runs04 105 #define FRAME_runs05 106 #define FRAME_runs06 107 #define FRAME_attak101 108 #define FRAME_attak102 109 #define FRAME_attak103 110 #define FRAME_attak104 111 #define FRAME_attak105 112 #define FRAME_attak106 113 #define FRAME_attak107 114 #define FRAME_attak108 115 #define FRAME_attak109 116 #define FRAME_attak110 117 #define FRAME_attak111 118 #define FRAME_attak112 119 #define FRAME_attak113 120 #define FRAME_attak114 121 #define FRAME_attak115 122 #define FRAME_attak116 123 #define FRAME_attak117 124 #define FRAME_attak118 125 #define FRAME_attak119 126 #define FRAME_attak120 127 #define FRAME_attak121 128 #define FRAME_attak201 129 #define FRAME_attak202 130 #define FRAME_attak203 131 #define FRAME_attak204 132 #define FRAME_attak205 133 #define FRAME_attak206 134 #define FRAME_attak207 135 #define FRAME_attak208 136 #define FRAME_attak209 137 #define FRAME_attak210 138 #define FRAME_attak211 139 #define FRAME_attak212 140 #define FRAME_attak213 141 #define FRAME_attak214 142 #define FRAME_attak215 143 #define FRAME_attak216 144 #define FRAME_attak217 145 #define FRAME_attak218 146 #define FRAME_attak219 147 #define FRAME_attak220 148 #define FRAME_attak221 149 #define FRAME_attak222 150 #define FRAME_attak223 151 #define FRAME_attak224 152 #define FRAME_attak225 153 #define FRAME_attak226 154 #define FRAME_attak227 155 #define FRAME_attak228 156 #define FRAME_attak229 157 #define FRAME_attak230 158 #define FRAME_pain101 159 #define FRAME_pain102 160 #define FRAME_pain103 161 #define FRAME_pain104 162 #define FRAME_pain105 163 #define FRAME_pain106 164 #define FRAME_pain107 165 #define FRAME_pain108 166 #define FRAME_pain109 167 #define FRAME_pain110 168 #define FRAME_pain111 169 #define FRAME_pain112 170 #define FRAME_pain113 171 #define FRAME_pain114 172 #define FRAME_pain115 173 #define FRAME_pain116 174 #define FRAME_pain117 175 #define FRAME_pain118 176 #define FRAME_pain201 177 #define FRAME_pain202 178 #define FRAME_pain203 179 #define FRAME_pain204 180 #define FRAME_pain205 181 #define FRAME_pain206 182 #define FRAME_pain207 183 #define FRAME_pain208 184 #define FRAME_pain301 185 #define FRAME_pain302 186 #define FRAME_pain303 187 #define FRAME_pain304 188 #define FRAME_pain305 189 #define FRAME_death01 190 #define FRAME_death02 191 #define FRAME_death03 192 #define FRAME_death04 193 #define FRAME_death05 194 #define FRAME_death06 195 #define FRAME_death07 196 #define FRAME_death08 197 #define FRAME_death09 198 #define FRAME_death10 199 #define FRAME_death11 200 #define FRAME_duck01 201 #define FRAME_duck02 202 #define FRAME_duck03 203 #define FRAME_duck04 204 #define FRAME_duck05 205 #define FRAME_duck06 206 #define FRAME_duck07 207 #define FRAME_duck08 208 #define MODEL_SCALE 1.150000 xatrix-XATRIX_2_14/src/monster/hover/000077500000000000000000000000001477320050300175415ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/hover/hover.c000066400000000000000000000350051477320050300210330ustar00rootroot00000000000000/* ======================================================================= * * Icarus. * * ======================================================================= */ #include "../../header/local.h" #include "hover.h" qboolean visible(edict_t *self, edict_t *other); static int sound_pain1; static int sound_pain2; static int sound_death1; static int sound_death2; static int sound_sight; static int sound_search1; static int sound_search2; void hover_run(edict_t *self); void hover_stand(edict_t *self); void hover_dead(edict_t *self); void hover_attack(edict_t *self); void hover_reattack(edict_t *self); void hover_fire_blaster(edict_t *self); void hover_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point); void hover_sight(edict_t *self, edict_t *other) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); } void hover_search(edict_t *self) { if (!self) { return; } if (random() < 0.5) { gi.sound(self, CHAN_VOICE, sound_search1, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_search2, 1, ATTN_NORM, 0); } } static mframe_t hover_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t hover_move_stand = { FRAME_stand01, FRAME_stand30, hover_frames_stand, NULL }; static mframe_t hover_frames_stop1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t hover_move_stop1 = { FRAME_stop101, FRAME_stop109, hover_frames_stop1, NULL }; static mframe_t hover_frames_stop2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t hover_move_stop2 = { FRAME_stop201, FRAME_stop208, hover_frames_stop2, NULL }; static mframe_t hover_frames_takeoff[] = { {ai_move, 0, NULL}, {ai_move, -2, NULL}, {ai_move, 5, NULL}, {ai_move, -1, NULL}, {ai_move, 1, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, 0, NULL}, {ai_move, 2, NULL}, {ai_move, 2, NULL}, {ai_move, 1, NULL}, {ai_move, 1, NULL}, {ai_move, -6, NULL}, {ai_move, -9, NULL}, {ai_move, 1, NULL}, {ai_move, 0, NULL}, {ai_move, 2, NULL}, {ai_move, 2, NULL}, {ai_move, 1, NULL}, {ai_move, 1, NULL}, {ai_move, 1, NULL}, {ai_move, 2, NULL}, {ai_move, 0, NULL}, {ai_move, 2, NULL}, {ai_move, 3, NULL}, {ai_move, 2, NULL}, {ai_move, 0, NULL} }; mmove_t hover_move_takeoff = { FRAME_takeof01, FRAME_takeof30, hover_frames_takeoff, NULL }; static mframe_t hover_frames_pain3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t hover_move_pain3 = { FRAME_pain301, FRAME_pain309, hover_frames_pain3, hover_run }; static mframe_t hover_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t hover_move_pain2 = { FRAME_pain201, FRAME_pain212, hover_frames_pain2, hover_run }; static mframe_t hover_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 2, NULL}, {ai_move, -8, NULL}, {ai_move, -4, NULL}, {ai_move, -6, NULL}, {ai_move, -4, NULL}, {ai_move, -3, NULL}, {ai_move, 1, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 3, NULL}, {ai_move, 1, NULL}, {ai_move, 0, NULL}, {ai_move, 2, NULL}, {ai_move, 3, NULL}, {ai_move, 2, NULL}, {ai_move, 7, NULL}, {ai_move, 1, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 2, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 5, NULL}, {ai_move, 3, NULL}, {ai_move, 4, NULL} }; mmove_t hover_move_pain1 = { FRAME_pain101, FRAME_pain128, hover_frames_pain1, hover_run }; static mframe_t hover_frames_land[] = { {ai_move, 0, NULL} }; mmove_t hover_move_land = { FRAME_land01, FRAME_land01, hover_frames_land, NULL }; static mframe_t hover_frames_forward[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t hover_move_forward = { FRAME_forwrd01, FRAME_forwrd35, hover_frames_forward, NULL }; static mframe_t hover_frames_walk[] = { {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL} }; mmove_t hover_move_walk = { FRAME_forwrd01, FRAME_forwrd35, hover_frames_walk, NULL }; static mframe_t hover_frames_run[] = { {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL} }; mmove_t hover_move_run = { FRAME_forwrd01, FRAME_forwrd35, hover_frames_run, NULL }; static mframe_t hover_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -10, NULL}, {ai_move, 3, NULL}, {ai_move, 5, NULL}, {ai_move, 4, NULL}, {ai_move, 7, NULL} }; mmove_t hover_move_death1 = { FRAME_death101, FRAME_death111, hover_frames_death1, hover_dead }; static mframe_t hover_frames_backward[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t hover_move_backward = { FRAME_backwd01, FRAME_backwd24, hover_frames_backward, NULL }; static mframe_t hover_frames_start_attack[] = { {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL} }; mmove_t hover_move_start_attack = { FRAME_attak101, FRAME_attak103, hover_frames_start_attack, hover_attack }; static mframe_t hover_frames_attack1[] = { {ai_charge, -10, hover_fire_blaster}, {ai_charge, -10, hover_fire_blaster}, {ai_charge, 0, hover_reattack}, }; mmove_t hover_move_attack1 = { FRAME_attak104, FRAME_attak106, hover_frames_attack1, NULL }; static mframe_t hover_frames_end_attack[] = { {ai_charge, 1, NULL}, {ai_charge, 1, NULL} }; mmove_t hover_move_end_attack = { FRAME_attak107, FRAME_attak108, hover_frames_end_attack, hover_run }; void hover_reattack(edict_t *self) { if (!self) { return; } if (self->enemy->health > 0) { if (visible(self, self->enemy)) { if (random() <= 0.6) { self->monsterinfo.currentmove = &hover_move_attack1; return; } } } self->monsterinfo.currentmove = &hover_move_end_attack; } void hover_fire_blaster(edict_t *self) { vec3_t start; vec3_t forward, right; vec3_t end; vec3_t dir; int effect; if (!self) { return; } if (self->s.frame == FRAME_attak104) { effect = EF_HYPERBLASTER; } else { effect = 0; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_HOVER_BLASTER_1], forward, right, start); VectorCopy(self->enemy->s.origin, end); end[2] += self->enemy->viewheight; VectorSubtract(end, start, dir); monster_fire_blaster(self, start, dir, 1, 1000, MZ2_HOVER_BLASTER_1, effect); } void hover_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &hover_move_stand; } void hover_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &hover_move_stand; } else { self->monsterinfo.currentmove = &hover_move_run; } } void hover_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &hover_move_walk; } void hover_start_attack(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &hover_move_start_attack; } void hover_attack(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &hover_move_attack1; } void hover_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } self->pain_debounce_time = level.time + 3; if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } if (damage <= 25) { if (random() < 0.5) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &hover_move_pain3; } else { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &hover_move_pain2; } } else { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &hover_move_pain1; } } void hover_deadthink(edict_t *self) { if (!self) { return; } if (!self->groundentity && (level.time < self->timestamp)) { self->nextthink = level.time + FRAMETIME; return; } BecomeExplosion1(self); } void hover_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, -8); self->movetype = MOVETYPE_TOSS; self->think = hover_deadthink; self->nextthink = level.time + FRAMETIME; self->timestamp = level.time + 15; gi.linkentity(self); } void hover_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point /* unused */) { int n; if (!self) { return; } /* check for gib */ if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 2; n++) { ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); } for (n = 0; n < 2; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowHead(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } /* regular death */ if (random() < 0.5) { gi.sound(self, CHAN_VOICE, sound_death1, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_death2, 1, ATTN_NORM, 0); } self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; self->monsterinfo.currentmove = &hover_move_death1; } /* * QUAKED monster_hover (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_hover(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } sound_pain1 = gi.soundindex("hover/hovpain1.wav"); sound_pain2 = gi.soundindex("hover/hovpain2.wav"); sound_death1 = gi.soundindex("hover/hovdeth1.wav"); sound_death2 = gi.soundindex("hover/hovdeth2.wav"); sound_sight = gi.soundindex("hover/hovsght1.wav"); sound_search1 = gi.soundindex("hover/hovsrch1.wav"); sound_search2 = gi.soundindex("hover/hovsrch2.wav"); gi.soundindex("hover/hovatck1.wav"); self->s.sound = gi.soundindex("hover/hovidle1.wav"); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/hover/tris.md2"); VectorSet(self->mins, -24, -24, -24); VectorSet(self->maxs, 24, 24, 32); self->health = 240; self->gib_health = -100; self->mass = 150; self->pain = hover_pain; self->die = hover_die; self->monsterinfo.stand = hover_stand; self->monsterinfo.walk = hover_walk; self->monsterinfo.run = hover_run; self->monsterinfo.attack = hover_start_attack; self->monsterinfo.sight = hover_sight; self->monsterinfo.search = hover_search; gi.linkentity(self); self->monsterinfo.currentmove = &hover_move_stand; self->monsterinfo.scale = MODEL_SCALE; flymonster_start(self); } xatrix-XATRIX_2_14/src/monster/hover/hover.h000066400000000000000000000126441477320050300210440ustar00rootroot00000000000000/* ======================================================================= * * Icarus animations. * * ======================================================================= */ #define FRAME_stand01 0 #define FRAME_stand02 1 #define FRAME_stand03 2 #define FRAME_stand04 3 #define FRAME_stand05 4 #define FRAME_stand06 5 #define FRAME_stand07 6 #define FRAME_stand08 7 #define FRAME_stand09 8 #define FRAME_stand10 9 #define FRAME_stand11 10 #define FRAME_stand12 11 #define FRAME_stand13 12 #define FRAME_stand14 13 #define FRAME_stand15 14 #define FRAME_stand16 15 #define FRAME_stand17 16 #define FRAME_stand18 17 #define FRAME_stand19 18 #define FRAME_stand20 19 #define FRAME_stand21 20 #define FRAME_stand22 21 #define FRAME_stand23 22 #define FRAME_stand24 23 #define FRAME_stand25 24 #define FRAME_stand26 25 #define FRAME_stand27 26 #define FRAME_stand28 27 #define FRAME_stand29 28 #define FRAME_stand30 29 #define FRAME_forwrd01 30 #define FRAME_forwrd02 31 #define FRAME_forwrd03 32 #define FRAME_forwrd04 33 #define FRAME_forwrd05 34 #define FRAME_forwrd06 35 #define FRAME_forwrd07 36 #define FRAME_forwrd08 37 #define FRAME_forwrd09 38 #define FRAME_forwrd10 39 #define FRAME_forwrd11 40 #define FRAME_forwrd12 41 #define FRAME_forwrd13 42 #define FRAME_forwrd14 43 #define FRAME_forwrd15 44 #define FRAME_forwrd16 45 #define FRAME_forwrd17 46 #define FRAME_forwrd18 47 #define FRAME_forwrd19 48 #define FRAME_forwrd20 49 #define FRAME_forwrd21 50 #define FRAME_forwrd22 51 #define FRAME_forwrd23 52 #define FRAME_forwrd24 53 #define FRAME_forwrd25 54 #define FRAME_forwrd26 55 #define FRAME_forwrd27 56 #define FRAME_forwrd28 57 #define FRAME_forwrd29 58 #define FRAME_forwrd30 59 #define FRAME_forwrd31 60 #define FRAME_forwrd32 61 #define FRAME_forwrd33 62 #define FRAME_forwrd34 63 #define FRAME_forwrd35 64 #define FRAME_stop101 65 #define FRAME_stop102 66 #define FRAME_stop103 67 #define FRAME_stop104 68 #define FRAME_stop105 69 #define FRAME_stop106 70 #define FRAME_stop107 71 #define FRAME_stop108 72 #define FRAME_stop109 73 #define FRAME_stop201 74 #define FRAME_stop202 75 #define FRAME_stop203 76 #define FRAME_stop204 77 #define FRAME_stop205 78 #define FRAME_stop206 79 #define FRAME_stop207 80 #define FRAME_stop208 81 #define FRAME_takeof01 82 #define FRAME_takeof02 83 #define FRAME_takeof03 84 #define FRAME_takeof04 85 #define FRAME_takeof05 86 #define FRAME_takeof06 87 #define FRAME_takeof07 88 #define FRAME_takeof08 89 #define FRAME_takeof09 90 #define FRAME_takeof10 91 #define FRAME_takeof11 92 #define FRAME_takeof12 93 #define FRAME_takeof13 94 #define FRAME_takeof14 95 #define FRAME_takeof15 96 #define FRAME_takeof16 97 #define FRAME_takeof17 98 #define FRAME_takeof18 99 #define FRAME_takeof19 100 #define FRAME_takeof20 101 #define FRAME_takeof21 102 #define FRAME_takeof22 103 #define FRAME_takeof23 104 #define FRAME_takeof24 105 #define FRAME_takeof25 106 #define FRAME_takeof26 107 #define FRAME_takeof27 108 #define FRAME_takeof28 109 #define FRAME_takeof29 110 #define FRAME_takeof30 111 #define FRAME_land01 112 #define FRAME_pain101 113 #define FRAME_pain102 114 #define FRAME_pain103 115 #define FRAME_pain104 116 #define FRAME_pain105 117 #define FRAME_pain106 118 #define FRAME_pain107 119 #define FRAME_pain108 120 #define FRAME_pain109 121 #define FRAME_pain110 122 #define FRAME_pain111 123 #define FRAME_pain112 124 #define FRAME_pain113 125 #define FRAME_pain114 126 #define FRAME_pain115 127 #define FRAME_pain116 128 #define FRAME_pain117 129 #define FRAME_pain118 130 #define FRAME_pain119 131 #define FRAME_pain120 132 #define FRAME_pain121 133 #define FRAME_pain122 134 #define FRAME_pain123 135 #define FRAME_pain124 136 #define FRAME_pain125 137 #define FRAME_pain126 138 #define FRAME_pain127 139 #define FRAME_pain128 140 #define FRAME_pain201 141 #define FRAME_pain202 142 #define FRAME_pain203 143 #define FRAME_pain204 144 #define FRAME_pain205 145 #define FRAME_pain206 146 #define FRAME_pain207 147 #define FRAME_pain208 148 #define FRAME_pain209 149 #define FRAME_pain210 150 #define FRAME_pain211 151 #define FRAME_pain212 152 #define FRAME_pain301 153 #define FRAME_pain302 154 #define FRAME_pain303 155 #define FRAME_pain304 156 #define FRAME_pain305 157 #define FRAME_pain306 158 #define FRAME_pain307 159 #define FRAME_pain308 160 #define FRAME_pain309 161 #define FRAME_death101 162 #define FRAME_death102 163 #define FRAME_death103 164 #define FRAME_death104 165 #define FRAME_death105 166 #define FRAME_death106 167 #define FRAME_death107 168 #define FRAME_death108 169 #define FRAME_death109 170 #define FRAME_death110 171 #define FRAME_death111 172 #define FRAME_backwd01 173 #define FRAME_backwd02 174 #define FRAME_backwd03 175 #define FRAME_backwd04 176 #define FRAME_backwd05 177 #define FRAME_backwd06 178 #define FRAME_backwd07 179 #define FRAME_backwd08 180 #define FRAME_backwd09 181 #define FRAME_backwd10 182 #define FRAME_backwd11 183 #define FRAME_backwd12 184 #define FRAME_backwd13 185 #define FRAME_backwd14 186 #define FRAME_backwd15 187 #define FRAME_backwd16 188 #define FRAME_backwd17 189 #define FRAME_backwd18 190 #define FRAME_backwd19 191 #define FRAME_backwd20 192 #define FRAME_backwd21 193 #define FRAME_backwd22 194 #define FRAME_backwd23 195 #define FRAME_backwd24 196 #define FRAME_attak101 197 #define FRAME_attak102 198 #define FRAME_attak103 199 #define FRAME_attak104 200 #define FRAME_attak105 201 #define FRAME_attak106 202 #define FRAME_attak107 203 #define FRAME_attak108 204 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/infantry/000077500000000000000000000000001477320050300202505ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/infantry/infantry.c000066400000000000000000000410351477320050300222510ustar00rootroot00000000000000/* * Copyright (C) 1997-2001 Id Software, Inc. * * 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. * * ======================================================================= * * Infantry. * * ======================================================================= */ #include "../../header/local.h" #include "infantry.h" void InfantryMachineGun(edict_t *self); static int sound_pain1; static int sound_pain2; static int sound_die1; static int sound_die2; static int sound_gunshot; static int sound_weapon_cock; static int sound_punch_swing; static int sound_punch_hit; static int sound_sight; static int sound_search; static int sound_idle; static int sound_step; static int sound_step2; void infantry_footstep(edict_t *self) { if (!g_monsterfootsteps->value) return; // Lazy loading for savegame compatibility. if (sound_step == 0 || sound_step2 == 0) { sound_step = gi.soundindex("infantry/step1.wav"); sound_step2 = gi.soundindex("infantry/step2.wav"); } if (randk() % 2 == 0) { gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); } } static mframe_t infantry_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t infantry_move_stand = { FRAME_stand50, FRAME_stand71, infantry_frames_stand, NULL }; void infantry_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &infantry_move_stand; } static mframe_t infantry_frames_fidget[] = { {ai_stand, 1, NULL}, {ai_stand, 0, NULL}, {ai_stand, 1, NULL}, {ai_stand, 3, NULL}, {ai_stand, 6, NULL}, {ai_stand, 3, infantry_footstep}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 1, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 1, NULL}, {ai_stand, 0, NULL}, {ai_stand, -1, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 1, NULL}, {ai_stand, 0, NULL}, {ai_stand, -2, NULL}, {ai_stand, 1, NULL}, {ai_stand, 1, NULL}, {ai_stand, 1, NULL}, {ai_stand, -1, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, -1, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, -1, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 1, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, -1, NULL}, {ai_stand, -1, NULL}, {ai_stand, 0, NULL}, {ai_stand, -3, NULL}, {ai_stand, -2, NULL}, {ai_stand, -3, NULL}, {ai_stand, -3, infantry_footstep}, {ai_stand, -2, NULL} }; mmove_t infantry_move_fidget = { FRAME_stand01, FRAME_stand49, infantry_frames_fidget, infantry_stand }; void infantry_fidget(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &infantry_move_fidget; gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); } static mframe_t infantry_frames_walk[] = { {ai_walk, 5, infantry_footstep}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 5, NULL}, {ai_walk, 4, NULL}, {ai_walk, 5, NULL}, {ai_walk, 6, infantry_footstep}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 5, NULL} }; mmove_t infantry_move_walk = { FRAME_walk03, FRAME_walk14, infantry_frames_walk, NULL }; void infantry_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &infantry_move_walk; } static mframe_t infantry_frames_run[] = { {ai_run, 10, NULL}, {ai_run, 20, infantry_footstep}, {ai_run, 5, NULL}, {ai_run, 7, NULL}, {ai_run, 30, NULL}, {ai_run, 35, infantry_footstep}, {ai_run, 2, NULL}, {ai_run, 6, NULL} }; mmove_t infantry_move_run = { FRAME_run01, FRAME_run08, infantry_frames_run, NULL }; void infantry_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &infantry_move_stand; } else { self->monsterinfo.currentmove = &infantry_move_run; } } static mframe_t infantry_frames_pain1[] = { {ai_move, -3, NULL}, {ai_move, -2, NULL}, {ai_move, -1, NULL}, {ai_move, -2, NULL}, {ai_move, -1, infantry_footstep}, {ai_move, 1, NULL}, {ai_move, -1, NULL}, {ai_move, 1, NULL}, {ai_move, 6, NULL}, {ai_move, 2, infantry_footstep} }; mmove_t infantry_move_pain1 = { FRAME_pain101, FRAME_pain110, infantry_frames_pain1, infantry_run }; static mframe_t infantry_frames_pain2[] = { {ai_move, -3, NULL}, {ai_move, -3, NULL}, {ai_move, 0, NULL}, {ai_move, -1, NULL}, {ai_move, -2, infantry_footstep}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 2, NULL}, {ai_move, 5, NULL}, {ai_move, 2, infantry_footstep} }; mmove_t infantry_move_pain2 = { FRAME_pain201, FRAME_pain210, infantry_frames_pain2, infantry_run }; void infantry_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { int n; if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } self->pain_debounce_time = level.time + 3; if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } n = rand() % 2; if (n == 0) { self->monsterinfo.currentmove = &infantry_move_pain1; gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); } else { self->monsterinfo.currentmove = &infantry_move_pain2; gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); } } vec3_t aimangles[] = { {0.0, 5.0, 0.0}, {10.0, 15.0, 0.0}, {20.0, 25.0, 0.0}, {25.0, 35.0, 0.0}, {30.0, 40.0, 0.0}, {30.0, 45.0, 0.0}, {25.0, 50.0, 0.0}, {20.0, 40.0, 0.0}, {15.0, 35.0, 0.0}, {40.0, 35.0, 0.0}, {70.0, 35.0, 0.0}, {90.0, 35.0, 0.0} }; void InfantryMachineGun(edict_t *self) { vec3_t start, target; vec3_t forward, right; vec3_t vec; int flash_number; if (!self) { return; } if (self->s.frame == FRAME_attak103) { flash_number = MZ2_INFANTRY_MACHINEGUN_1; AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], forward, right, start); if (self->enemy) { VectorMA(self->enemy->s.origin, -0.2, self->enemy->velocity, target); target[2] += self->enemy->viewheight; VectorSubtract(target, start, forward); VectorNormalize(forward); } else { AngleVectors(self->s.angles, forward, right, NULL); } } else { flash_number = MZ2_INFANTRY_MACHINEGUN_2 + (self->s.frame - FRAME_death211); AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], forward, right, start); VectorSubtract(self->s.angles, aimangles[flash_number - MZ2_INFANTRY_MACHINEGUN_2], vec); AngleVectors(vec, forward, NULL, NULL); } monster_fire_bullet(self, start, forward, 3, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_number); } void infantry_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } gi.sound(self, CHAN_BODY, sound_sight, 1, ATTN_NORM, 0); } void infantry_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, -8); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; gi.linkentity(self); M_FlyCheck(self); } static mframe_t infantry_frames_death1[] = { {ai_move, -4, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -1, NULL}, {ai_move, -4, infantry_footstep}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -1, infantry_footstep}, {ai_move, 3, NULL}, {ai_move, 1, NULL}, {ai_move, 1, NULL}, {ai_move, -2, NULL}, {ai_move, 2, NULL}, {ai_move, 2, NULL}, {ai_move, 9, NULL}, {ai_move, 9, NULL}, {ai_move, 5, NULL}, {ai_move, -3, NULL}, {ai_move, -3, NULL} }; mmove_t infantry_move_death1 = { FRAME_death101, FRAME_death120, infantry_frames_death1, infantry_dead }; /* Off with his head */ static mframe_t infantry_frames_death2[] = { {ai_move, 0, NULL}, {ai_move, 1, NULL}, {ai_move, 5, NULL}, {ai_move, -1, NULL}, {ai_move, 0, NULL}, {ai_move, 1, infantry_footstep}, {ai_move, 1, infantry_footstep}, {ai_move, 4, NULL}, {ai_move, 3, NULL}, {ai_move, 0, NULL}, {ai_move, -2, InfantryMachineGun}, {ai_move, -2, InfantryMachineGun}, {ai_move, -3, InfantryMachineGun}, {ai_move, -1, InfantryMachineGun}, {ai_move, -2, InfantryMachineGun}, {ai_move, 0, InfantryMachineGun}, {ai_move, 2, InfantryMachineGun}, {ai_move, 2, InfantryMachineGun}, {ai_move, 3, InfantryMachineGun}, {ai_move, -10, InfantryMachineGun}, {ai_move, -7, InfantryMachineGun}, {ai_move, -8, InfantryMachineGun}, {ai_move, -6, NULL}, {ai_move, 4, NULL}, {ai_move, 0, NULL} }; mmove_t infantry_move_death2 = { FRAME_death201, FRAME_death225, infantry_frames_death2, infantry_dead }; static mframe_t infantry_frames_death3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -6, NULL}, {ai_move, -11, NULL}, {ai_move, -3, NULL}, {ai_move, -11, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t infantry_move_death3 = { FRAME_death301, FRAME_death309, infantry_frames_death3, infantry_dead }; void infantry_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point /* unused */) { int n; if (!self) { return; } /* check for gib */ if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 2; n++) { ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } /* regular death */ self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; self->s.skinnum = 1; /* switch to bloody skin */ n = rand() % 3; if (n == 0) { self->monsterinfo.currentmove = &infantry_move_death1; gi.sound(self, CHAN_VOICE, sound_die2, 1, ATTN_NORM, 0); } else if (n == 1) { self->monsterinfo.currentmove = &infantry_move_death2; gi.sound(self, CHAN_VOICE, sound_die1, 1, ATTN_NORM, 0); } else { self->monsterinfo.currentmove = &infantry_move_death3; gi.sound(self, CHAN_VOICE, sound_die2, 1, ATTN_NORM, 0); } } void infantry_duck_down(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_DUCKED) { return; } self->monsterinfo.aiflags |= AI_DUCKED; self->maxs[2] -= 32; self->takedamage = DAMAGE_YES; self->monsterinfo.pausetime = level.time + 1; gi.linkentity(self); } void infantry_duck_hold(edict_t *self) { if (!self) { return; } if (level.time >= self->monsterinfo.pausetime) { self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; } else { self->monsterinfo.aiflags |= AI_HOLD_FRAME; } } void infantry_duck_up(edict_t *self) { if (!self) { return; } self->monsterinfo.aiflags &= ~AI_DUCKED; self->maxs[2] += 32; self->takedamage = DAMAGE_AIM; gi.linkentity(self); } static mframe_t infantry_frames_duck[] = { {ai_move, -2, infantry_duck_down}, {ai_move, -5, infantry_duck_hold}, {ai_move, 3, NULL}, {ai_move, 4, infantry_duck_up}, {ai_move, 0, infantry_footstep} }; mmove_t infantry_move_duck = { FRAME_duck01, FRAME_duck05, infantry_frames_duck, infantry_run }; void infantry_dodge(edict_t *self, edict_t *attacker, float eta /* unused */) { if (!self || !attacker) { return; } if (random() > 0.25) { return; } if (!self->enemy) { self->enemy = attacker; FoundTarget(self); } self->monsterinfo.currentmove = &infantry_move_duck; } void infantry_set_firetime(edict_t *self) { int n; if (!self) { return; } n = (rand() & 15) + 5; self->monsterinfo.pausetime = level.time + n * FRAMETIME; } void infantry_cock_gun(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_weapon_cock, 1, ATTN_NORM, 0); } void infantry_fire(edict_t *self) { if (!self) { return; } InfantryMachineGun(self); if (level.time >= self->monsterinfo.pausetime) { self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; } else { self->monsterinfo.aiflags |= AI_HOLD_FRAME; } } static mframe_t infantry_frames_attack1[] = { {ai_charge, 10, infantry_set_firetime}, {ai_charge, 6, NULL}, {ai_charge, 0, infantry_fire}, {ai_charge, 0, NULL}, {ai_charge, 1, NULL}, {ai_charge, -7, NULL}, {ai_charge, -6, NULL}, {ai_charge, -1, NULL}, {ai_charge, 0, infantry_cock_gun}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, -1, NULL}, {ai_charge, -1, NULL} }; mmove_t infantry_move_attack1 = { FRAME_attak101, FRAME_attak115, infantry_frames_attack1, infantry_run }; void infantry_swing(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_punch_swing, 1, ATTN_NORM, 0); } void infantry_smack(edict_t *self) { vec3_t aim; if (!self) { return; } VectorSet(aim, MELEE_DISTANCE, 0, 0); if (fire_hit(self, aim, (5 + (rand() % 5)), 50)) { gi.sound(self, CHAN_WEAPON, sound_punch_hit, 1, ATTN_NORM, 0); } } static mframe_t infantry_frames_attack2[] = { {ai_charge, 3, NULL}, {ai_charge, 6, NULL}, {ai_charge, 0, infantry_swing}, {ai_charge, 8, infantry_footstep}, {ai_charge, 5, NULL}, {ai_charge, 8, infantry_smack}, {ai_charge, 6, NULL}, {ai_charge, 3, NULL}, }; mmove_t infantry_move_attack2 = { FRAME_attak201, FRAME_attak208, infantry_frames_attack2, infantry_run }; void infantry_attack(edict_t *self) { if (!self) { return; } if (range(self, self->enemy) == RANGE_MELEE) { self->monsterinfo.currentmove = &infantry_move_attack2; } else { self->monsterinfo.currentmove = &infantry_move_attack1; } } /* * QUAKED monster_infantry (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_infantry(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } // Force recaching at next footstep to ensure // that the sound indices are correct. sound_step = 0; sound_step2 = 0; sound_pain1 = gi.soundindex("infantry/infpain1.wav"); sound_pain2 = gi.soundindex("infantry/infpain2.wav"); sound_die1 = gi.soundindex("infantry/infdeth1.wav"); sound_die2 = gi.soundindex("infantry/infdeth2.wav"); sound_gunshot = gi.soundindex("infantry/infatck1.wav"); sound_weapon_cock = gi.soundindex("infantry/infatck3.wav"); sound_punch_swing = gi.soundindex("infantry/infatck2.wav"); sound_punch_hit = gi.soundindex("infantry/melee2.wav"); sound_sight = gi.soundindex("infantry/infsght1.wav"); sound_search = gi.soundindex("infantry/infsrch1.wav"); sound_idle = gi.soundindex("infantry/infidle1.wav"); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/infantry/tris.md2"); VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, 32); self->health = 100; self->gib_health = -40; self->mass = 200; self->pain = infantry_pain; self->die = infantry_die; self->monsterinfo.stand = infantry_stand; self->monsterinfo.walk = infantry_walk; self->monsterinfo.run = infantry_run; self->monsterinfo.dodge = infantry_dodge; self->monsterinfo.attack = infantry_attack; self->monsterinfo.melee = NULL; self->monsterinfo.sight = infantry_sight; self->monsterinfo.idle = infantry_fidget; gi.linkentity(self); self->monsterinfo.currentmove = &infantry_move_stand; self->monsterinfo.scale = MODEL_SCALE; walkmonster_start(self); } xatrix-XATRIX_2_14/src/monster/infantry/infantry.h000066400000000000000000000126211477320050300222550ustar00rootroot00000000000000/* ======================================================================= * * Infantry animations. * * ======================================================================= */ #define FRAME_gun02 0 #define FRAME_stand01 1 #define FRAME_stand02 2 #define FRAME_stand03 3 #define FRAME_stand04 4 #define FRAME_stand05 5 #define FRAME_stand06 6 #define FRAME_stand07 7 #define FRAME_stand08 8 #define FRAME_stand09 9 #define FRAME_stand10 10 #define FRAME_stand11 11 #define FRAME_stand12 12 #define FRAME_stand13 13 #define FRAME_stand14 14 #define FRAME_stand15 15 #define FRAME_stand16 16 #define FRAME_stand17 17 #define FRAME_stand18 18 #define FRAME_stand19 19 #define FRAME_stand20 20 #define FRAME_stand21 21 #define FRAME_stand22 22 #define FRAME_stand23 23 #define FRAME_stand24 24 #define FRAME_stand25 25 #define FRAME_stand26 26 #define FRAME_stand27 27 #define FRAME_stand28 28 #define FRAME_stand29 29 #define FRAME_stand30 30 #define FRAME_stand31 31 #define FRAME_stand32 32 #define FRAME_stand33 33 #define FRAME_stand34 34 #define FRAME_stand35 35 #define FRAME_stand36 36 #define FRAME_stand37 37 #define FRAME_stand38 38 #define FRAME_stand39 39 #define FRAME_stand40 40 #define FRAME_stand41 41 #define FRAME_stand42 42 #define FRAME_stand43 43 #define FRAME_stand44 44 #define FRAME_stand45 45 #define FRAME_stand46 46 #define FRAME_stand47 47 #define FRAME_stand48 48 #define FRAME_stand49 49 #define FRAME_stand50 50 #define FRAME_stand51 51 #define FRAME_stand52 52 #define FRAME_stand53 53 #define FRAME_stand54 54 #define FRAME_stand55 55 #define FRAME_stand56 56 #define FRAME_stand57 57 #define FRAME_stand58 58 #define FRAME_stand59 59 #define FRAME_stand60 60 #define FRAME_stand61 61 #define FRAME_stand62 62 #define FRAME_stand63 63 #define FRAME_stand64 64 #define FRAME_stand65 65 #define FRAME_stand66 66 #define FRAME_stand67 67 #define FRAME_stand68 68 #define FRAME_stand69 69 #define FRAME_stand70 70 #define FRAME_stand71 71 #define FRAME_walk01 72 #define FRAME_walk02 73 #define FRAME_walk03 74 #define FRAME_walk04 75 #define FRAME_walk05 76 #define FRAME_walk06 77 #define FRAME_walk07 78 #define FRAME_walk08 79 #define FRAME_walk09 80 #define FRAME_walk10 81 #define FRAME_walk11 82 #define FRAME_walk12 83 #define FRAME_walk13 84 #define FRAME_walk14 85 #define FRAME_walk15 86 #define FRAME_walk16 87 #define FRAME_walk17 88 #define FRAME_walk18 89 #define FRAME_walk19 90 #define FRAME_walk20 91 #define FRAME_run01 92 #define FRAME_run02 93 #define FRAME_run03 94 #define FRAME_run04 95 #define FRAME_run05 96 #define FRAME_run06 97 #define FRAME_run07 98 #define FRAME_run08 99 #define FRAME_pain101 100 #define FRAME_pain102 101 #define FRAME_pain103 102 #define FRAME_pain104 103 #define FRAME_pain105 104 #define FRAME_pain106 105 #define FRAME_pain107 106 #define FRAME_pain108 107 #define FRAME_pain109 108 #define FRAME_pain110 109 #define FRAME_pain201 110 #define FRAME_pain202 111 #define FRAME_pain203 112 #define FRAME_pain204 113 #define FRAME_pain205 114 #define FRAME_pain206 115 #define FRAME_pain207 116 #define FRAME_pain208 117 #define FRAME_pain209 118 #define FRAME_pain210 119 #define FRAME_duck01 120 #define FRAME_duck02 121 #define FRAME_duck03 122 #define FRAME_duck04 123 #define FRAME_duck05 124 #define FRAME_death101 125 #define FRAME_death102 126 #define FRAME_death103 127 #define FRAME_death104 128 #define FRAME_death105 129 #define FRAME_death106 130 #define FRAME_death107 131 #define FRAME_death108 132 #define FRAME_death109 133 #define FRAME_death110 134 #define FRAME_death111 135 #define FRAME_death112 136 #define FRAME_death113 137 #define FRAME_death114 138 #define FRAME_death115 139 #define FRAME_death116 140 #define FRAME_death117 141 #define FRAME_death118 142 #define FRAME_death119 143 #define FRAME_death120 144 #define FRAME_death201 145 #define FRAME_death202 146 #define FRAME_death203 147 #define FRAME_death204 148 #define FRAME_death205 149 #define FRAME_death206 150 #define FRAME_death207 151 #define FRAME_death208 152 #define FRAME_death209 153 #define FRAME_death210 154 #define FRAME_death211 155 #define FRAME_death212 156 #define FRAME_death213 157 #define FRAME_death214 158 #define FRAME_death215 159 #define FRAME_death216 160 #define FRAME_death217 161 #define FRAME_death218 162 #define FRAME_death219 163 #define FRAME_death220 164 #define FRAME_death221 165 #define FRAME_death222 166 #define FRAME_death223 167 #define FRAME_death224 168 #define FRAME_death225 169 #define FRAME_death301 170 #define FRAME_death302 171 #define FRAME_death303 172 #define FRAME_death304 173 #define FRAME_death305 174 #define FRAME_death306 175 #define FRAME_death307 176 #define FRAME_death308 177 #define FRAME_death309 178 #define FRAME_block01 179 #define FRAME_block02 180 #define FRAME_block03 181 #define FRAME_block04 182 #define FRAME_block05 183 #define FRAME_attak101 184 #define FRAME_attak102 185 #define FRAME_attak103 186 #define FRAME_attak104 187 #define FRAME_attak105 188 #define FRAME_attak106 189 #define FRAME_attak107 190 #define FRAME_attak108 191 #define FRAME_attak109 192 #define FRAME_attak110 193 #define FRAME_attak111 194 #define FRAME_attak112 195 #define FRAME_attak113 196 #define FRAME_attak114 197 #define FRAME_attak115 198 #define FRAME_attak201 199 #define FRAME_attak202 200 #define FRAME_attak203 201 #define FRAME_attak204 202 #define FRAME_attak205 203 #define FRAME_attak206 204 #define FRAME_attak207 205 #define FRAME_attak208 206 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/insane/000077500000000000000000000000001477320050300176735ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/insane/insane.c000066400000000000000000000473261477320050300213300ustar00rootroot00000000000000/* * Copyright (C) 1997-2001 Id Software, Inc. * * 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. * * ======================================================================= * * The insane earth soldiers. * * ======================================================================= */ #include "../../header/local.h" #include "insane.h" #define SPAWNFLAG_CRUSIFIED 8 static int sound_fist; static int sound_shake; static int sound_moan; static int sound_scream[8]; static int sound_step; static int sound_step2; static int sound_step3; static int sound_step4; void insane_stand(edict_t *self); void insane_dead(edict_t *self); void insane_cross(edict_t *self); void insane_walk(edict_t *self); void insane_run(edict_t *self); void insane_checkdown(edict_t *self); void insane_checkup(edict_t *self); void insane_onground(edict_t *self); void insane_footstep(edict_t *self) { if (!g_monsterfootsteps->value) return; // Lazy loading for savegame compatibility. if (sound_step == 0 || sound_step2 == 0 || sound_step3 == 0 || sound_step4 == 0) { sound_step = gi.soundindex("player/step1.wav"); sound_step2 = gi.soundindex("player/step2.wav"); sound_step3 = gi.soundindex("player/step3.wav"); sound_step4 = gi.soundindex("player/step4.wav"); } int i; i = randk() % 4; if (i == 0) { gi.sound(self, CHAN_BODY, sound_step, 0.7, ATTN_NORM, 0); } else if (i == 1) { gi.sound(self, CHAN_BODY, sound_step2, 0.7, ATTN_NORM, 0); } else if (i == 2) { gi.sound(self, CHAN_BODY, sound_step3, 0.7, ATTN_NORM, 0); } else if (i == 3) { gi.sound(self, CHAN_BODY, sound_step4, 0.7, ATTN_NORM, 0); } } void insane_fist(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_fist, 1, ATTN_IDLE, 0); } void insane_shake(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_shake, 1, ATTN_IDLE, 0); } void insane_moan(edict_t *self) { if (!self) { return; } /* suppress screaming so pain sound can play */ if (self->fly_sound_debounce_time > level.time) { return; } gi.sound(self, CHAN_VOICE, sound_moan, 1, ATTN_IDLE, 0); } void insane_scream(edict_t *self) { if (!self) { return; } /* suppress screaming so pain sound can play */ if (self->fly_sound_debounce_time > level.time) { return; } gi.sound(self, CHAN_VOICE, sound_scream[rand() % 8], 1, ATTN_IDLE, 0); } static mframe_t insane_frames_stand_normal[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, insane_checkdown} }; mmove_t insane_move_stand_normal = { FRAME_stand60, FRAME_stand65, insane_frames_stand_normal, insane_stand }; static mframe_t insane_frames_stand_insane[] = { {ai_stand, 0, insane_shake}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, insane_checkdown} }; mmove_t insane_move_stand_insane = { FRAME_stand65, FRAME_stand94, insane_frames_stand_insane, insane_stand }; static mframe_t insane_frames_uptodown[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, insane_moan}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 2.7, NULL}, {ai_move, 4.1, NULL}, {ai_move, 6, NULL}, {ai_move, 7.6, NULL}, {ai_move, 3.6, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, insane_fist}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, insane_fist}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t insane_move_uptodown = { FRAME_stand1, FRAME_stand40, insane_frames_uptodown, insane_onground }; static mframe_t insane_frames_downtoup[] = { {ai_move, -0.7, NULL}, /* 41 */ {ai_move, -1.2, NULL}, /* 42 */ {ai_move, -1.5, NULL}, /* 43 */ {ai_move, -4.5, NULL}, /* 44 */ {ai_move, -3.5, NULL}, /* 45 */ {ai_move, -0.2, NULL}, /* 46 */ {ai_move, 0, NULL}, /* 47 */ {ai_move, -1.3, NULL}, /* 48 */ {ai_move, -3, NULL}, /* 49 */ {ai_move, -2, NULL}, /* 50 */ {ai_move, 0, NULL}, /* 51 */ {ai_move, 0, NULL}, /* 52 */ {ai_move, 0, NULL}, /* 53 */ {ai_move, -3.3, NULL}, /* 54 */ {ai_move, -1.6, NULL}, /* 55 */ {ai_move, -0.3, NULL}, /* 56 */ {ai_move, 0, NULL}, /* 57 */ {ai_move, 0, NULL}, /* 58 */ {ai_move, 0, NULL} /* 59 */ }; mmove_t insane_move_downtoup = { FRAME_stand41, FRAME_stand59, insane_frames_downtoup, insane_stand }; static mframe_t insane_frames_jumpdown[] = { {ai_move, 0.2, NULL}, {ai_move, 11.5, NULL}, {ai_move, 5.1, NULL}, {ai_move, 7.1, NULL}, {ai_move, 0, NULL} }; mmove_t insane_move_jumpdown = { FRAME_stand96, FRAME_stand100, insane_frames_jumpdown, insane_onground }; static mframe_t insane_frames_down[] = { {ai_move, 0, NULL}, /* 100 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 110 */ {ai_move, -1.7, NULL}, {ai_move, -1.6, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, insane_fist}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 120 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 130 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, insane_moan}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 140 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* 150 */ {ai_move, 0.5, NULL}, {ai_move, 0, NULL}, {ai_move, -0.2, insane_scream}, {ai_move, 0, NULL}, {ai_move, 0.2, NULL}, {ai_move, 0.4, NULL}, {ai_move, 0.6, NULL}, {ai_move, 0.8, NULL}, {ai_move, 0.7, NULL}, {ai_move, 0, insane_checkup} /* 160 */ }; mmove_t insane_move_down = { FRAME_stand100, FRAME_stand160, insane_frames_down, insane_onground }; static mframe_t insane_frames_walk_normal[] = { {ai_walk, 0, insane_scream}, {ai_walk, 2.5, NULL}, {ai_walk, 3.5, NULL}, {ai_walk, 1.7, NULL}, {ai_walk, 2.3, NULL}, {ai_walk, 2.4, NULL}, {ai_walk, 2.2, insane_footstep}, {ai_walk, 4.2, NULL}, {ai_walk, 5.6, NULL}, {ai_walk, 3.3, NULL}, {ai_walk, 2.4, NULL}, {ai_walk, 0.9, NULL}, {ai_walk, 0, insane_footstep} }; mmove_t insane_move_walk_normal = { FRAME_walk27, FRAME_walk39, insane_frames_walk_normal, insane_walk }; mmove_t insane_move_run_normal = { FRAME_walk27, FRAME_walk39, insane_frames_walk_normal, insane_run }; static mframe_t insane_frames_walk_insane[] = { {ai_walk, 0, insane_scream}, /* walk 1 */ {ai_walk, 3.4, NULL}, /* walk 2 */ {ai_walk, 3.6, NULL}, /* 3 */ {ai_walk, 2.9, NULL}, /* 4 */ {ai_walk, 2.2, NULL}, /* 5 */ {ai_walk, 2.6, NULL}, /* 6 */ {ai_walk, 0, insane_footstep}, /* 7 */ {ai_walk, 0.7, NULL}, /* 8 */ {ai_walk, 4.8, NULL}, /* 9 */ {ai_walk, 5.3, NULL}, /* 10 */ {ai_walk, 1.1, NULL}, /* 11 */ {ai_walk, 2, insane_footstep}, /* 12 */ {ai_walk, 0.5, NULL}, /* 13 */ {ai_walk, 0, NULL}, /* 14 */ {ai_walk, 0, NULL}, /* 15 */ {ai_walk, 4.9, NULL}, /* 16 */ {ai_walk, 6.7, NULL}, /* 17 */ {ai_walk, 3.8, NULL}, /* 18 */ {ai_walk, 2, insane_footstep}, /* 19 */ {ai_walk, 0.2, NULL}, /* 20 */ {ai_walk, 0, NULL}, /* 21 */ {ai_walk, 3.4, NULL}, /* 22 */ {ai_walk, 6.4, NULL}, /* 23 */ {ai_walk, 5, NULL}, /* 24 */ {ai_walk, 1.8, insane_footstep}, /* 25 */ {ai_walk, 0, NULL} /* 26 */ }; mmove_t insane_move_walk_insane = { FRAME_walk1, FRAME_walk26, insane_frames_walk_insane, insane_walk }; mmove_t insane_move_run_insane = { FRAME_walk1, FRAME_walk26, insane_frames_walk_insane, insane_run }; static mframe_t insane_frames_stand_pain[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, insane_footstep}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t insane_move_stand_pain = { FRAME_st_pain2, FRAME_st_pain12, insane_frames_stand_pain, insane_run }; static mframe_t insane_frames_stand_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t insane_move_stand_death = { FRAME_st_death2, FRAME_st_death18, insane_frames_stand_death, insane_dead }; static mframe_t insane_frames_crawl[] = { {ai_walk, 0, insane_scream}, {ai_walk, 1.5, NULL}, {ai_walk, 2.1, NULL}, {ai_walk, 3.6, NULL}, {ai_walk, 2, NULL}, {ai_walk, 0.9, NULL}, {ai_walk, 3, NULL}, {ai_walk, 3.4, NULL}, {ai_walk, 2.4, NULL} }; mmove_t insane_move_crawl = { FRAME_crawl1, FRAME_crawl9, insane_frames_crawl, NULL }; mmove_t insane_move_runcrawl = { FRAME_crawl1, FRAME_crawl9, insane_frames_crawl, NULL }; static mframe_t insane_frames_crawl_pain[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t insane_move_crawl_pain = { FRAME_cr_pain2, FRAME_cr_pain10, insane_frames_crawl_pain, insane_run }; static mframe_t insane_frames_crawl_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t insane_move_crawl_death = { FRAME_cr_death10, FRAME_cr_death16, insane_frames_crawl_death, insane_dead }; static mframe_t insane_frames_cross[] = { {ai_move, 0, insane_moan}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t insane_move_cross = { FRAME_cross1, FRAME_cross15, insane_frames_cross, insane_cross }; static mframe_t insane_frames_struggle_cross[] = { {ai_move, 0, insane_scream}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t insane_move_struggle_cross = { FRAME_cross16, FRAME_cross30, insane_frames_struggle_cross, insane_cross }; void insane_cross(edict_t *self) { if (!self) { return; } if (random() < 0.8) { self->monsterinfo.currentmove = &insane_move_cross; } else { self->monsterinfo.currentmove = &insane_move_struggle_cross; } } void insane_walk(edict_t *self) { if (!self) { return; } if (self->spawnflags & 16) /* Hold Ground? */ { if (self->s.frame == FRAME_cr_pain10) { self->monsterinfo.currentmove = &insane_move_down; return; } } if (self->spawnflags & 4) { self->monsterinfo.currentmove = &insane_move_crawl; } else if (random() <= 0.5) { self->monsterinfo.currentmove = &insane_move_walk_normal; } else { self->monsterinfo.currentmove = &insane_move_walk_insane; } } void insane_run(edict_t *self) { if (!self) { return; } if (self->spawnflags & 16) /* Hold Ground? */ { if (self->s.frame == FRAME_cr_pain10) { self->monsterinfo.currentmove = &insane_move_down; return; } } if (self->spawnflags & 4) /* Crawling? */ { self->monsterinfo.currentmove = &insane_move_runcrawl; } else if (random() <= 0.5) /* Else, mix it up */ { self->monsterinfo.currentmove = &insane_move_run_normal; } else { self->monsterinfo.currentmove = &insane_move_run_insane; } } void insane_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { int l, r; if (!self) { return; } if (level.time < self->pain_debounce_time) { return; } self->pain_debounce_time = level.time + 3; r = 1 + (rand() & 1); if (self->health < 25) { l = 25; } else if (self->health < 50) { l = 50; } else if (self->health < 75) { l = 75; } else { l = 100; } gi.sound(self, CHAN_VOICE, gi.soundindex(va("player/male/pain%i_%i.wav", l, r)), 1, ATTN_IDLE, 0); /* suppress screaming and moaning for 1 second so pain sound plays */ self->fly_sound_debounce_time = level.time + 1; if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } /* Don't go into pain frames if crucified. */ if (self->spawnflags & SPAWNFLAG_CRUSIFIED) { self->monsterinfo.currentmove = &insane_move_struggle_cross; return; } if (((self->s.frame >= FRAME_crawl1) && (self->s.frame <= FRAME_crawl9)) || ((self->s.frame >= FRAME_stand99) && (self->s.frame <= FRAME_stand160))) { self->monsterinfo.currentmove = &insane_move_crawl_pain; } else { self->monsterinfo.currentmove = &insane_move_stand_pain; } } void insane_onground(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &insane_move_down; } void insane_checkdown(edict_t *self) { if (!self) { return; } if (self->spawnflags & 32) /* Always stand */ { return; } if (random() < 0.3) { if (random() < 0.5) { self->monsterinfo.currentmove = &insane_move_uptodown; } else { self->monsterinfo.currentmove = &insane_move_jumpdown; } } } void insane_checkup(edict_t *self) { if (!self) { return; } /* If Hold_Ground and Crawl are set */ if ((self->spawnflags & 4) && (self->spawnflags & 16)) { return; } if (random() < 0.5) { self->monsterinfo.currentmove = &insane_move_downtoup; } } void insane_stand(edict_t *self) { if (!self) { return; } if (self->spawnflags & SPAWNFLAG_CRUSIFIED) /* If crucified */ { self->monsterinfo.currentmove = &insane_move_cross; self->monsterinfo.aiflags |= AI_STAND_GROUND; } /* If Hold_Ground and Crawl are set */ else if ((self->spawnflags & 4) && (self->spawnflags & 16)) { self->monsterinfo.currentmove = &insane_move_down; } else if (random() < 0.5) { self->monsterinfo.currentmove = &insane_move_stand_normal; } else { self->monsterinfo.currentmove = &insane_move_stand_insane; } } void insane_dead(edict_t *self) { if (!self) { return; } if (self->spawnflags & SPAWNFLAG_CRUSIFIED) { self->flags |= FL_FLY; } else { VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, -8); self->movetype = MOVETYPE_TOSS; } self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } void insane_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point /* unused */) { int n; if (!self) { return; } if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_IDLE, 0); for (n = 0; n < 2; n++) { ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } gi.sound(self, CHAN_VOICE, gi.soundindex(va("player/male/death%i.wav", (rand() % 4) + 1)), 1, ATTN_IDLE, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; if (self->spawnflags & SPAWNFLAG_CRUSIFIED) { insane_dead(self); } else { if (((self->s.frame >= FRAME_crawl1) && (self->s.frame <= FRAME_crawl9)) || ((self->s.frame >= FRAME_stand99) && (self->s.frame <= FRAME_stand160))) { self->monsterinfo.currentmove = &insane_move_crawl_death; } else { self->monsterinfo.currentmove = &insane_move_stand_death; } } } /* * QUAKED misc_insane (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn CRAWL CRUCIFIED STAND_GROUND ALWAYS_STAND */ void SP_misc_insane(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } // Force recaching at next footstep to ensure // that the sound indices are correct. sound_step = 0; sound_step2 = 0; sound_step3 = 0; sound_step4 = 0; sound_fist = gi.soundindex("insane/insane11.wav"); sound_shake = gi.soundindex("insane/insane5.wav"); sound_moan = gi.soundindex("insane/insane7.wav"); sound_scream[0] = gi.soundindex("insane/insane1.wav"); sound_scream[1] = gi.soundindex("insane/insane2.wav"); sound_scream[2] = gi.soundindex("insane/insane3.wav"); sound_scream[3] = gi.soundindex("insane/insane4.wav"); sound_scream[4] = gi.soundindex("insane/insane6.wav"); sound_scream[5] = gi.soundindex("insane/insane8.wav"); sound_scream[6] = gi.soundindex("insane/insane9.wav"); sound_scream[7] = gi.soundindex("insane/insane10.wav"); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/insane/tris.md2"); VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, 32); self->health = 100; self->gib_health = -50; self->mass = 300; self->pain = insane_pain; self->die = insane_die; self->monsterinfo.stand = insane_stand; self->monsterinfo.walk = insane_walk; self->monsterinfo.run = insane_run; self->monsterinfo.dodge = NULL; self->monsterinfo.attack = NULL; self->monsterinfo.melee = NULL; self->monsterinfo.sight = NULL; self->monsterinfo.aiflags |= AI_GOOD_GUY; gi.linkentity(self); if (self->spawnflags & 16) /* Stand Ground */ { self->monsterinfo.aiflags |= AI_STAND_GROUND; } self->monsterinfo.currentmove = &insane_move_stand_normal; self->monsterinfo.scale = MODEL_SCALE; if (self->spawnflags & SPAWNFLAG_CRUSIFIED) /* Crucified ? */ { VectorSet(self->mins, -16, 0, 0); VectorSet(self->maxs, 16, 8, 32); self->flags |= FL_NO_KNOCKBACK; flymonster_start(self); } else { walkmonster_start(self); self->s.skinnum = rand() % 3; } } xatrix-XATRIX_2_14/src/monster/insane/insane.h000066400000000000000000000165241477320050300213310ustar00rootroot00000000000000/* ======================================================================= * * Insane animations * * ======================================================================= */ #define FRAME_stand1 0 #define FRAME_stand2 1 #define FRAME_stand3 2 #define FRAME_stand4 3 #define FRAME_stand5 4 #define FRAME_stand6 5 #define FRAME_stand7 6 #define FRAME_stand8 7 #define FRAME_stand9 8 #define FRAME_stand10 9 #define FRAME_stand11 10 #define FRAME_stand12 11 #define FRAME_stand13 12 #define FRAME_stand14 13 #define FRAME_stand15 14 #define FRAME_stand16 15 #define FRAME_stand17 16 #define FRAME_stand18 17 #define FRAME_stand19 18 #define FRAME_stand20 19 #define FRAME_stand21 20 #define FRAME_stand22 21 #define FRAME_stand23 22 #define FRAME_stand24 23 #define FRAME_stand25 24 #define FRAME_stand26 25 #define FRAME_stand27 26 #define FRAME_stand28 27 #define FRAME_stand29 28 #define FRAME_stand30 29 #define FRAME_stand31 30 #define FRAME_stand32 31 #define FRAME_stand33 32 #define FRAME_stand34 33 #define FRAME_stand35 34 #define FRAME_stand36 35 #define FRAME_stand37 36 #define FRAME_stand38 37 #define FRAME_stand39 38 #define FRAME_stand40 39 #define FRAME_stand41 40 #define FRAME_stand42 41 #define FRAME_stand43 42 #define FRAME_stand44 43 #define FRAME_stand45 44 #define FRAME_stand46 45 #define FRAME_stand47 46 #define FRAME_stand48 47 #define FRAME_stand49 48 #define FRAME_stand50 49 #define FRAME_stand51 50 #define FRAME_stand52 51 #define FRAME_stand53 52 #define FRAME_stand54 53 #define FRAME_stand55 54 #define FRAME_stand56 55 #define FRAME_stand57 56 #define FRAME_stand58 57 #define FRAME_stand59 58 #define FRAME_stand60 59 #define FRAME_stand61 60 #define FRAME_stand62 61 #define FRAME_stand63 62 #define FRAME_stand64 63 #define FRAME_stand65 64 #define FRAME_stand66 65 #define FRAME_stand67 66 #define FRAME_stand68 67 #define FRAME_stand69 68 #define FRAME_stand70 69 #define FRAME_stand71 70 #define FRAME_stand72 71 #define FRAME_stand73 72 #define FRAME_stand74 73 #define FRAME_stand75 74 #define FRAME_stand76 75 #define FRAME_stand77 76 #define FRAME_stand78 77 #define FRAME_stand79 78 #define FRAME_stand80 79 #define FRAME_stand81 80 #define FRAME_stand82 81 #define FRAME_stand83 82 #define FRAME_stand84 83 #define FRAME_stand85 84 #define FRAME_stand86 85 #define FRAME_stand87 86 #define FRAME_stand88 87 #define FRAME_stand89 88 #define FRAME_stand90 89 #define FRAME_stand91 90 #define FRAME_stand92 91 #define FRAME_stand93 92 #define FRAME_stand94 93 #define FRAME_stand95 94 #define FRAME_stand96 95 #define FRAME_stand97 96 #define FRAME_stand98 97 #define FRAME_stand99 98 #define FRAME_stand100 99 #define FRAME_stand101 100 #define FRAME_stand102 101 #define FRAME_stand103 102 #define FRAME_stand104 103 #define FRAME_stand105 104 #define FRAME_stand106 105 #define FRAME_stand107 106 #define FRAME_stand108 107 #define FRAME_stand109 108 #define FRAME_stand110 109 #define FRAME_stand111 110 #define FRAME_stand112 111 #define FRAME_stand113 112 #define FRAME_stand114 113 #define FRAME_stand115 114 #define FRAME_stand116 115 #define FRAME_stand117 116 #define FRAME_stand118 117 #define FRAME_stand119 118 #define FRAME_stand120 119 #define FRAME_stand121 120 #define FRAME_stand122 121 #define FRAME_stand123 122 #define FRAME_stand124 123 #define FRAME_stand125 124 #define FRAME_stand126 125 #define FRAME_stand127 126 #define FRAME_stand128 127 #define FRAME_stand129 128 #define FRAME_stand130 129 #define FRAME_stand131 130 #define FRAME_stand132 131 #define FRAME_stand133 132 #define FRAME_stand134 133 #define FRAME_stand135 134 #define FRAME_stand136 135 #define FRAME_stand137 136 #define FRAME_stand138 137 #define FRAME_stand139 138 #define FRAME_stand140 139 #define FRAME_stand141 140 #define FRAME_stand142 141 #define FRAME_stand143 142 #define FRAME_stand144 143 #define FRAME_stand145 144 #define FRAME_stand146 145 #define FRAME_stand147 146 #define FRAME_stand148 147 #define FRAME_stand149 148 #define FRAME_stand150 149 #define FRAME_stand151 150 #define FRAME_stand152 151 #define FRAME_stand153 152 #define FRAME_stand154 153 #define FRAME_stand155 154 #define FRAME_stand156 155 #define FRAME_stand157 156 #define FRAME_stand158 157 #define FRAME_stand159 158 #define FRAME_stand160 159 #define FRAME_walk27 160 #define FRAME_walk28 161 #define FRAME_walk29 162 #define FRAME_walk30 163 #define FRAME_walk31 164 #define FRAME_walk32 165 #define FRAME_walk33 166 #define FRAME_walk34 167 #define FRAME_walk35 168 #define FRAME_walk36 169 #define FRAME_walk37 170 #define FRAME_walk38 171 #define FRAME_walk39 172 #define FRAME_walk1 173 #define FRAME_walk2 174 #define FRAME_walk3 175 #define FRAME_walk4 176 #define FRAME_walk5 177 #define FRAME_walk6 178 #define FRAME_walk7 179 #define FRAME_walk8 180 #define FRAME_walk9 181 #define FRAME_walk10 182 #define FRAME_walk11 183 #define FRAME_walk12 184 #define FRAME_walk13 185 #define FRAME_walk14 186 #define FRAME_walk15 187 #define FRAME_walk16 188 #define FRAME_walk17 189 #define FRAME_walk18 190 #define FRAME_walk19 191 #define FRAME_walk20 192 #define FRAME_walk21 193 #define FRAME_walk22 194 #define FRAME_walk23 195 #define FRAME_walk24 196 #define FRAME_walk25 197 #define FRAME_walk26 198 #define FRAME_st_pain2 199 #define FRAME_st_pain3 200 #define FRAME_st_pain4 201 #define FRAME_st_pain5 202 #define FRAME_st_pain6 203 #define FRAME_st_pain7 204 #define FRAME_st_pain8 205 #define FRAME_st_pain9 206 #define FRAME_st_pain10 207 #define FRAME_st_pain11 208 #define FRAME_st_pain12 209 #define FRAME_st_death2 210 #define FRAME_st_death3 211 #define FRAME_st_death4 212 #define FRAME_st_death5 213 #define FRAME_st_death6 214 #define FRAME_st_death7 215 #define FRAME_st_death8 216 #define FRAME_st_death9 217 #define FRAME_st_death10 218 #define FRAME_st_death11 219 #define FRAME_st_death12 220 #define FRAME_st_death13 221 #define FRAME_st_death14 222 #define FRAME_st_death15 223 #define FRAME_st_death16 224 #define FRAME_st_death17 225 #define FRAME_st_death18 226 #define FRAME_crawl1 227 #define FRAME_crawl2 228 #define FRAME_crawl3 229 #define FRAME_crawl4 230 #define FRAME_crawl5 231 #define FRAME_crawl6 232 #define FRAME_crawl7 233 #define FRAME_crawl8 234 #define FRAME_crawl9 235 #define FRAME_cr_pain2 236 #define FRAME_cr_pain3 237 #define FRAME_cr_pain4 238 #define FRAME_cr_pain5 239 #define FRAME_cr_pain6 240 #define FRAME_cr_pain7 241 #define FRAME_cr_pain8 242 #define FRAME_cr_pain9 243 #define FRAME_cr_pain10 244 #define FRAME_cr_death10 245 #define FRAME_cr_death11 246 #define FRAME_cr_death12 247 #define FRAME_cr_death13 248 #define FRAME_cr_death14 249 #define FRAME_cr_death15 250 #define FRAME_cr_death16 251 #define FRAME_cross1 252 #define FRAME_cross2 253 #define FRAME_cross3 254 #define FRAME_cross4 255 #define FRAME_cross5 256 #define FRAME_cross6 257 #define FRAME_cross7 258 #define FRAME_cross8 259 #define FRAME_cross9 260 #define FRAME_cross10 261 #define FRAME_cross11 262 #define FRAME_cross12 263 #define FRAME_cross13 264 #define FRAME_cross14 265 #define FRAME_cross15 266 #define FRAME_cross16 267 #define FRAME_cross17 268 #define FRAME_cross18 269 #define FRAME_cross19 270 #define FRAME_cross20 271 #define FRAME_cross21 272 #define FRAME_cross22 273 #define FRAME_cross23 274 #define FRAME_cross24 275 #define FRAME_cross25 276 #define FRAME_cross26 277 #define FRAME_cross27 278 #define FRAME_cross28 279 #define FRAME_cross29 280 #define FRAME_cross30 281 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/medic/000077500000000000000000000000001477320050300174775ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/medic/medic.c000066400000000000000000000476161477320050300207420ustar00rootroot00000000000000/* * Copyright (C) 1997-2001 Id Software, Inc. * * 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. * * ======================================================================= * * Medic. * * ======================================================================= */ #include "../../header/local.h" #include "medic.h" qboolean visible(edict_t *self, edict_t *other); static int sound_idle1; static int sound_pain1; static int sound_pain2; static int sound_die; static int sound_sight; static int sound_search; static int sound_hook_launch; static int sound_hook_hit; static int sound_hook_heal; static int sound_hook_retract; static int sound_step; static int sound_step2; void ED_CallSpawn(edict_t *ent); void medic_footstep(edict_t *self) { if (!g_monsterfootsteps->value) return; // Lazy loading for savegame compatibility. if (sound_step == 0 || sound_step2 == 0) { sound_step = gi.soundindex("medic/step1.wav"); sound_step2 = gi.soundindex("medic/step2.wav"); } if (randk() % 2 == 0) { gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); } } edict_t * medic_FindDeadMonster(edict_t *self) { edict_t *ent = NULL; edict_t *best = NULL; if (!self) { return NULL; } while ((ent = findradius(ent, self->s.origin, 1024)) != NULL) { if (ent == self) { continue; } if (!(ent->svflags & SVF_MONSTER)) { continue; } if (ent->monsterinfo.aiflags & AI_GOOD_GUY) { continue; } if (ent->owner) { continue; } if (ent->health > 0) { continue; } if (ent->nextthink) { continue; } if (!visible(self, ent)) { continue; } if (!best) { best = ent; continue; } if (ent->max_health <= best->max_health) { continue; } best = ent; } return best; } void medic_idle(edict_t *self) { edict_t *ent; if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_idle1, 1, ATTN_IDLE, 0); ent = medic_FindDeadMonster(self); if (ent) { self->enemy = ent; self->enemy->owner = self; self->monsterinfo.aiflags |= AI_MEDIC; FoundTarget(self); } } void medic_search(edict_t *self) { edict_t *ent; if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_search, 1, ATTN_IDLE, 0); if (!self->oldenemy) { ent = medic_FindDeadMonster(self); if (ent) { self->oldenemy = self->enemy; self->enemy = ent; self->enemy->owner = self; self->monsterinfo.aiflags |= AI_MEDIC; FoundTarget(self); } } } void medic_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); } static mframe_t medic_frames_stand[] = { {ai_stand, 0, medic_idle}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, }; mmove_t medic_move_stand = { FRAME_wait1, FRAME_wait90, medic_frames_stand, NULL }; void medic_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &medic_move_stand; } static mframe_t medic_frames_walk[] = { {ai_walk, 6.2, NULL}, {ai_walk, 18.1, medic_footstep}, {ai_walk, 1, NULL}, {ai_walk, 9, NULL}, {ai_walk, 10, NULL}, {ai_walk, 9, NULL}, {ai_walk, 11, NULL}, {ai_walk, 11.6, medic_footstep}, {ai_walk, 2, NULL}, {ai_walk, 9.9, NULL}, {ai_walk, 14, NULL}, {ai_walk, 9.3, NULL} }; mmove_t medic_move_walk = { FRAME_walk1, FRAME_walk12, medic_frames_walk, NULL }; void medic_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &medic_move_walk; } static mframe_t medic_frames_run[] = { {ai_run, 18, medic_footstep}, {ai_run, 22.5, NULL}, {ai_run, 25.4, NULL}, {ai_run, 23.4, NULL}, {ai_run, 24, medic_footstep}, {ai_run, 35.6, NULL} }; mmove_t medic_move_run = { FRAME_run1, FRAME_run6, medic_frames_run, NULL }; void medic_run(edict_t *self) { if (!self) { return; } if (!(self->monsterinfo.aiflags & AI_MEDIC)) { edict_t *ent; ent = medic_FindDeadMonster(self); if (ent) { self->oldenemy = self->enemy; self->enemy = ent; self->enemy->owner = self; self->monsterinfo.aiflags |= AI_MEDIC; FoundTarget(self); return; } } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &medic_move_stand; } else { self->monsterinfo.currentmove = &medic_move_run; } } static mframe_t medic_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t medic_move_pain1 = { FRAME_paina1, FRAME_paina8, medic_frames_pain1, medic_run }; static mframe_t medic_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, medic_footstep}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, medic_footstep} }; mmove_t medic_move_pain2 = { FRAME_painb1, FRAME_painb15, medic_frames_pain2, medic_run }; void medic_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage /* unused */) { if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } self->pain_debounce_time = level.time + 3; if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } if (random() < 0.5) { self->monsterinfo.currentmove = &medic_move_pain1; gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); } else { self->monsterinfo.currentmove = &medic_move_pain2; gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); } } void medic_fire_blaster(edict_t *self) { vec3_t start; vec3_t forward, right; vec3_t end; vec3_t dir; int effect; if (!self) { return; } if ((self->s.frame == FRAME_attack9) || (self->s.frame == FRAME_attack12)) { effect = EF_BLASTER; } else if ((self->s.frame == FRAME_attack19) || (self->s.frame == FRAME_attack22) || (self->s.frame == FRAME_attack25) || (self->s.frame == FRAME_attack28)) { effect = EF_HYPERBLASTER; } else { effect = 0; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_MEDIC_BLASTER_1], forward, right, start); VectorCopy(self->enemy->s.origin, end); end[2] += self->enemy->viewheight; VectorSubtract(end, start, dir); monster_fire_blaster(self, start, dir, 2, 1000, MZ2_MEDIC_BLASTER_1, effect); } void medic_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, -8); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } static mframe_t medic_frames_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t medic_move_death = { FRAME_death1, FRAME_death30, medic_frames_death, medic_dead }; void medic_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point /* unused */) { int n; if (!self) { return; } /* if we had a pending patient, free him up for another medic */ if ((self->enemy) && (self->enemy->owner == self)) { self->enemy->owner = NULL; } /* check for gib */ if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 2; n++) { ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } /* regular death */ gi.sound(self, CHAN_VOICE, sound_die, 1, ATTN_NORM, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; self->monsterinfo.currentmove = &medic_move_death; } void medic_duck_down(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_DUCKED) { return; } self->monsterinfo.aiflags |= AI_DUCKED; self->maxs[2] -= 32; self->takedamage = DAMAGE_YES; self->monsterinfo.pausetime = level.time + 1; gi.linkentity(self); } void medic_duck_hold(edict_t *self) { if (!self) { return; } if (level.time >= self->monsterinfo.pausetime) { self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; } else { self->monsterinfo.aiflags |= AI_HOLD_FRAME; } } void medic_duck_up(edict_t *self) { if (!self) { return; } self->monsterinfo.aiflags &= ~AI_DUCKED; self->maxs[2] += 32; self->takedamage = DAMAGE_AIM; gi.linkentity(self); } static mframe_t medic_frames_duck[] = { {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, -1, medic_duck_down}, {ai_move, -1, medic_duck_hold}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, -1, medic_duck_up}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, -1, NULL} }; mmove_t medic_move_duck = { FRAME_duck1, FRAME_duck16, medic_frames_duck, medic_run }; void medic_dodge(edict_t *self, edict_t *attacker, float eta /* unused */) { if (!self || !attacker) { return; } if (random() > 0.25) { return; } if (!self->enemy) { self->enemy = attacker; FoundTarget(self); } self->monsterinfo.currentmove = &medic_move_duck; } static mframe_t medic_frames_attackHyperBlaster[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, medic_fire_blaster}, {ai_charge, 0, medic_fire_blaster}, {ai_charge, 0, medic_fire_blaster}, {ai_charge, 0, medic_fire_blaster}, {ai_charge, 0, medic_fire_blaster}, {ai_charge, 0, medic_fire_blaster}, {ai_charge, 0, medic_fire_blaster}, {ai_charge, 0, medic_fire_blaster}, {ai_charge, 0, medic_fire_blaster}, {ai_charge, 0, medic_fire_blaster}, {ai_charge, 0, medic_fire_blaster}, {ai_charge, 0, medic_fire_blaster} }; mmove_t medic_move_attackHyperBlaster = { FRAME_attack15, FRAME_attack30, medic_frames_attackHyperBlaster, medic_run }; void medic_continue(edict_t *self) { if (!self) { return; } if (visible(self, self->enemy)) { if (random() <= 0.95) { self->monsterinfo.currentmove = &medic_move_attackHyperBlaster; } } } static mframe_t medic_frames_attackBlaster[] = { {ai_charge, 0, NULL}, {ai_charge, 5, NULL}, {ai_charge, 5, NULL}, {ai_charge, 3, NULL}, {ai_charge, 2, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, medic_fire_blaster}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, medic_fire_blaster}, {ai_charge, 0, NULL}, {ai_charge, 0, medic_continue} }; mmove_t medic_move_attackBlaster = { FRAME_attack1, FRAME_attack14, medic_frames_attackBlaster, medic_run }; void medic_hook_launch(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_hook_launch, 1, ATTN_NORM, 0); } static vec3_t medic_cable_offsets[] = { {45.0, -9.2, 15.5}, {48.4, -9.7, 15.2}, {47.8, -9.8, 15.8}, {47.3, -9.3, 14.3}, {45.4, -10.1, 13.1}, {41.9, -12.7, 12.0}, {37.8, -15.8, 11.2}, {34.3, -18.4, 10.7}, {32.7, -19.7, 10.4}, {32.7, -19.7, 10.4} }; void medic_cable_attack(edict_t *self) { vec3_t offset, start, end, f, r; trace_t tr; vec3_t dir, angles; float distance; if (!self) { return; } if (!self->enemy->inuse) { return; } AngleVectors(self->s.angles, f, r, NULL); VectorCopy(medic_cable_offsets[self->s.frame - FRAME_attack42], offset); G_ProjectSource(self->s.origin, offset, f, r, start); /* check for max distance */ VectorSubtract(start, self->enemy->s.origin, dir); distance = VectorLength(dir); if (distance > 256) { return; } /* check for min/max pitch */ vectoangles(dir, angles); if (angles[0] < -180) { angles[0] += 360; } if (fabs(angles[0]) > 45) { return; } tr = gi.trace(start, NULL, NULL, self->enemy->s.origin, self, MASK_SHOT); if ((tr.fraction != 1.0) && (tr.ent != self->enemy)) { return; } if (self->s.frame == FRAME_attack43) { gi.sound(self->enemy, CHAN_AUTO, sound_hook_hit, 1, ATTN_NORM, 0); self->enemy->monsterinfo.aiflags |= AI_RESURRECTING; } else if (self->s.frame == FRAME_attack50) { self->enemy->spawnflags = 0; self->enemy->monsterinfo.aiflags = 0; self->enemy->target = NULL; self->enemy->targetname = NULL; self->enemy->combattarget = NULL; self->enemy->deathtarget = NULL; self->enemy->owner = self; ED_CallSpawn(self->enemy); self->enemy->owner = NULL; if (self->enemy->think) { self->enemy->nextthink = level.time; self->enemy->think(self->enemy); } self->enemy->monsterinfo.aiflags |= AI_RESURRECTING; if (self->oldenemy && self->oldenemy->client) { self->enemy->enemy = self->oldenemy; FoundTarget(self->enemy); } } else { if (self->s.frame == FRAME_attack44) { gi.sound(self, CHAN_WEAPON, sound_hook_heal, 1, ATTN_NORM, 0); } } /* adjust start for beam origin being in middle of a segment */ VectorMA(start, 8, f, start); /* adjust end z for end spot since the monster is currently dead */ VectorCopy(self->enemy->s.origin, end); end[2] = self->enemy->absmin[2] + self->enemy->size[2] / 2; gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_MEDIC_CABLE_ATTACK); gi.WriteShort(self - g_edicts); gi.WritePosition(start); gi.WritePosition(end); gi.multicast(self->s.origin, MULTICAST_PVS); } void medic_hook_retract(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_hook_retract, 1, ATTN_NORM, 0); self->enemy->monsterinfo.aiflags &= ~AI_RESURRECTING; } static mframe_t medic_frames_attackCable[] = { {ai_move, 2, NULL}, {ai_move, 3, NULL}, {ai_move, 5, NULL}, {ai_move, 4.4, NULL}, {ai_charge, 4.7, NULL}, {ai_charge, 5, NULL}, {ai_charge, 6, NULL}, {ai_charge, 4, medic_footstep}, {ai_charge, 0, NULL}, {ai_move, 0, medic_hook_launch}, {ai_move, 0, medic_cable_attack}, {ai_move, 0, medic_cable_attack}, {ai_move, 0, medic_cable_attack}, {ai_move, 0, medic_cable_attack}, {ai_move, 0, medic_cable_attack}, {ai_move, 0, medic_cable_attack}, {ai_move, 0, medic_cable_attack}, {ai_move, 0, medic_cable_attack}, {ai_move, 0, medic_cable_attack}, {ai_move, -15, medic_hook_retract}, {ai_move, -1.5, NULL}, {ai_move, -1.2, medic_footstep}, {ai_move, -3, NULL}, {ai_move, -2, NULL}, {ai_move, 0.3, NULL}, {ai_move, 0.7, NULL}, {ai_move, 1.2, NULL}, {ai_move, 1.3, NULL} }; mmove_t medic_move_attackCable = { FRAME_attack33, FRAME_attack60, medic_frames_attackCable, medic_run }; void medic_attack(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_MEDIC) { self->monsterinfo.currentmove = &medic_move_attackCable; } else { self->monsterinfo.currentmove = &medic_move_attackBlaster; } } qboolean medic_checkattack(edict_t *self) { if (!self) { return false; } if (self->monsterinfo.aiflags & AI_MEDIC) { medic_attack(self); return true; } return M_CheckAttack(self); } /* * QUAKED monster_medic (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_medic(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } // Force recaching at next footstep to ensure // that the sound indices are correct. sound_step = 0; sound_step2 = 0; sound_idle1 = gi.soundindex("medic/idle.wav"); sound_pain1 = gi.soundindex("medic/medpain1.wav"); sound_pain2 = gi.soundindex("medic/medpain2.wav"); sound_die = gi.soundindex("medic/meddeth1.wav"); sound_sight = gi.soundindex("medic/medsght1.wav"); sound_search = gi.soundindex("medic/medsrch1.wav"); sound_hook_launch = gi.soundindex("medic/medatck2.wav"); sound_hook_hit = gi.soundindex("medic/medatck3.wav"); sound_hook_heal = gi.soundindex("medic/medatck4.wav"); sound_hook_retract = gi.soundindex("medic/medatck5.wav"); gi.soundindex("medic/medatck1.wav"); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/medic/tris.md2"); VectorSet(self->mins, -24, -24, -24); VectorSet(self->maxs, 24, 24, 32); self->health = 300; self->gib_health = -130; self->mass = 400; self->pain = medic_pain; self->die = medic_die; self->monsterinfo.stand = medic_stand; self->monsterinfo.walk = medic_walk; self->monsterinfo.run = medic_run; self->monsterinfo.dodge = medic_dodge; self->monsterinfo.attack = medic_attack; self->monsterinfo.melee = NULL; self->monsterinfo.sight = medic_sight; self->monsterinfo.idle = medic_idle; self->monsterinfo.search = medic_search; self->monsterinfo.checkattack = medic_checkattack; gi.linkentity(self); self->monsterinfo.currentmove = &medic_move_stand; self->monsterinfo.scale = MODEL_SCALE; walkmonster_start(self); } xatrix-XATRIX_2_14/src/monster/medic/medic.h000066400000000000000000000137561477320050300207450ustar00rootroot00000000000000/* ======================================================================= * * Medic animations. * * ======================================================================= */ #define FRAME_walk1 0 #define FRAME_walk2 1 #define FRAME_walk3 2 #define FRAME_walk4 3 #define FRAME_walk5 4 #define FRAME_walk6 5 #define FRAME_walk7 6 #define FRAME_walk8 7 #define FRAME_walk9 8 #define FRAME_walk10 9 #define FRAME_walk11 10 #define FRAME_walk12 11 #define FRAME_wait1 12 #define FRAME_wait2 13 #define FRAME_wait3 14 #define FRAME_wait4 15 #define FRAME_wait5 16 #define FRAME_wait6 17 #define FRAME_wait7 18 #define FRAME_wait8 19 #define FRAME_wait9 20 #define FRAME_wait10 21 #define FRAME_wait11 22 #define FRAME_wait12 23 #define FRAME_wait13 24 #define FRAME_wait14 25 #define FRAME_wait15 26 #define FRAME_wait16 27 #define FRAME_wait17 28 #define FRAME_wait18 29 #define FRAME_wait19 30 #define FRAME_wait20 31 #define FRAME_wait21 32 #define FRAME_wait22 33 #define FRAME_wait23 34 #define FRAME_wait24 35 #define FRAME_wait25 36 #define FRAME_wait26 37 #define FRAME_wait27 38 #define FRAME_wait28 39 #define FRAME_wait29 40 #define FRAME_wait30 41 #define FRAME_wait31 42 #define FRAME_wait32 43 #define FRAME_wait33 44 #define FRAME_wait34 45 #define FRAME_wait35 46 #define FRAME_wait36 47 #define FRAME_wait37 48 #define FRAME_wait38 49 #define FRAME_wait39 50 #define FRAME_wait40 51 #define FRAME_wait41 52 #define FRAME_wait42 53 #define FRAME_wait43 54 #define FRAME_wait44 55 #define FRAME_wait45 56 #define FRAME_wait46 57 #define FRAME_wait47 58 #define FRAME_wait48 59 #define FRAME_wait49 60 #define FRAME_wait50 61 #define FRAME_wait51 62 #define FRAME_wait52 63 #define FRAME_wait53 64 #define FRAME_wait54 65 #define FRAME_wait55 66 #define FRAME_wait56 67 #define FRAME_wait57 68 #define FRAME_wait58 69 #define FRAME_wait59 70 #define FRAME_wait60 71 #define FRAME_wait61 72 #define FRAME_wait62 73 #define FRAME_wait63 74 #define FRAME_wait64 75 #define FRAME_wait65 76 #define FRAME_wait66 77 #define FRAME_wait67 78 #define FRAME_wait68 79 #define FRAME_wait69 80 #define FRAME_wait70 81 #define FRAME_wait71 82 #define FRAME_wait72 83 #define FRAME_wait73 84 #define FRAME_wait74 85 #define FRAME_wait75 86 #define FRAME_wait76 87 #define FRAME_wait77 88 #define FRAME_wait78 89 #define FRAME_wait79 90 #define FRAME_wait80 91 #define FRAME_wait81 92 #define FRAME_wait82 93 #define FRAME_wait83 94 #define FRAME_wait84 95 #define FRAME_wait85 96 #define FRAME_wait86 97 #define FRAME_wait87 98 #define FRAME_wait88 99 #define FRAME_wait89 100 #define FRAME_wait90 101 #define FRAME_run1 102 #define FRAME_run2 103 #define FRAME_run3 104 #define FRAME_run4 105 #define FRAME_run5 106 #define FRAME_run6 107 #define FRAME_paina1 108 #define FRAME_paina2 109 #define FRAME_paina3 110 #define FRAME_paina4 111 #define FRAME_paina5 112 #define FRAME_paina6 113 #define FRAME_paina7 114 #define FRAME_paina8 115 #define FRAME_painb1 116 #define FRAME_painb2 117 #define FRAME_painb3 118 #define FRAME_painb4 119 #define FRAME_painb5 120 #define FRAME_painb6 121 #define FRAME_painb7 122 #define FRAME_painb8 123 #define FRAME_painb9 124 #define FRAME_painb10 125 #define FRAME_painb11 126 #define FRAME_painb12 127 #define FRAME_painb13 128 #define FRAME_painb14 129 #define FRAME_painb15 130 #define FRAME_duck1 131 #define FRAME_duck2 132 #define FRAME_duck3 133 #define FRAME_duck4 134 #define FRAME_duck5 135 #define FRAME_duck6 136 #define FRAME_duck7 137 #define FRAME_duck8 138 #define FRAME_duck9 139 #define FRAME_duck10 140 #define FRAME_duck11 141 #define FRAME_duck12 142 #define FRAME_duck13 143 #define FRAME_duck14 144 #define FRAME_duck15 145 #define FRAME_duck16 146 #define FRAME_death1 147 #define FRAME_death2 148 #define FRAME_death3 149 #define FRAME_death4 150 #define FRAME_death5 151 #define FRAME_death6 152 #define FRAME_death7 153 #define FRAME_death8 154 #define FRAME_death9 155 #define FRAME_death10 156 #define FRAME_death11 157 #define FRAME_death12 158 #define FRAME_death13 159 #define FRAME_death14 160 #define FRAME_death15 161 #define FRAME_death16 162 #define FRAME_death17 163 #define FRAME_death18 164 #define FRAME_death19 165 #define FRAME_death20 166 #define FRAME_death21 167 #define FRAME_death22 168 #define FRAME_death23 169 #define FRAME_death24 170 #define FRAME_death25 171 #define FRAME_death26 172 #define FRAME_death27 173 #define FRAME_death28 174 #define FRAME_death29 175 #define FRAME_death30 176 #define FRAME_attack1 177 #define FRAME_attack2 178 #define FRAME_attack3 179 #define FRAME_attack4 180 #define FRAME_attack5 181 #define FRAME_attack6 182 #define FRAME_attack7 183 #define FRAME_attack8 184 #define FRAME_attack9 185 #define FRAME_attack10 186 #define FRAME_attack11 187 #define FRAME_attack12 188 #define FRAME_attack13 189 #define FRAME_attack14 190 #define FRAME_attack15 191 #define FRAME_attack16 192 #define FRAME_attack17 193 #define FRAME_attack18 194 #define FRAME_attack19 195 #define FRAME_attack20 196 #define FRAME_attack21 197 #define FRAME_attack22 198 #define FRAME_attack23 199 #define FRAME_attack24 200 #define FRAME_attack25 201 #define FRAME_attack26 202 #define FRAME_attack27 203 #define FRAME_attack28 204 #define FRAME_attack29 205 #define FRAME_attack30 206 #define FRAME_attack31 207 #define FRAME_attack32 208 #define FRAME_attack33 209 #define FRAME_attack34 210 #define FRAME_attack35 211 #define FRAME_attack36 212 #define FRAME_attack37 213 #define FRAME_attack38 214 #define FRAME_attack39 215 #define FRAME_attack40 216 #define FRAME_attack41 217 #define FRAME_attack42 218 #define FRAME_attack43 219 #define FRAME_attack44 220 #define FRAME_attack45 221 #define FRAME_attack46 222 #define FRAME_attack47 223 #define FRAME_attack48 224 #define FRAME_attack49 225 #define FRAME_attack50 226 #define FRAME_attack51 227 #define FRAME_attack52 228 #define FRAME_attack53 229 #define FRAME_attack54 230 #define FRAME_attack55 231 #define FRAME_attack56 232 #define FRAME_attack57 233 #define FRAME_attack58 234 #define FRAME_attack59 235 #define FRAME_attack60 236 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/misc/000077500000000000000000000000001477320050300173515ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/misc/move.c000066400000000000000000000270401477320050300204660ustar00rootroot00000000000000/* ======================================================================= * * Monster movement support functions. * * ======================================================================= */ #include "../../header/local.h" #define DI_NODIR -1 #define STEPSIZE 18 /* * Returns false if any part of the bottom * of the entity is off an edge that is not * a staircase. */ qboolean M_CheckBottom(edict_t *ent) { vec3_t mins, maxs, start, stop; trace_t trace; int x, y; float mid, bottom; if (!ent) { return false; } VectorAdd(ent->s.origin, ent->mins, mins); VectorAdd(ent->s.origin, ent->maxs, maxs); /* if all of the points under the corners are solid world, don't bother with the tougher checks the corners must be within 16 of the midpoint */ start[2] = mins[2] - 1; for (x = 0; x <= 1; x++) { for (y = 0; y <= 1; y++) { start[0] = x ? maxs[0] : mins[0]; start[1] = y ? maxs[1] : mins[1]; if (gi.pointcontents(start) != CONTENTS_SOLID) { goto realcheck; } } } return true; /* we got out easy */ realcheck: /* check it for real... */ start[2] = mins[2]; /* the midpoint must be within 16 of the bottom */ start[0] = stop[0] = (mins[0] + maxs[0]) * 0.5; start[1] = stop[1] = (mins[1] + maxs[1]) * 0.5; stop[2] = start[2] - 2 * STEPSIZE; trace = gi.trace(start, vec3_origin, vec3_origin, stop, ent, MASK_MONSTERSOLID); if (trace.fraction == 1.0) { return false; } mid = bottom = trace.endpos[2]; /* the corners must be within 16 of the midpoint */ for (x = 0; x <= 1; x++) { for (y = 0; y <= 1; y++) { start[0] = stop[0] = x ? maxs[0] : mins[0]; start[1] = stop[1] = y ? maxs[1] : mins[1]; trace = gi.trace(start, vec3_origin, vec3_origin, stop, ent, MASK_MONSTERSOLID); if ((trace.fraction != 1.0) && (trace.endpos[2] > bottom)) { bottom = trace.endpos[2]; } if ((trace.fraction == 1.0) || (mid - trace.endpos[2] > STEPSIZE)) { return false; } } } return true; } /* * Called by monster program code. * The move will be adjusted for slopes * and stairs, but if the move isn't * possible, no move is done, false is * returned, and pr_global_struct->trace_normal * is set to the normal of the blocking wall */ qboolean SV_movestep(edict_t *ent, vec3_t move, qboolean relink) { float dz; vec3_t oldorg, neworg, end; trace_t trace; int i; float stepsize; vec3_t test; int contents; if (!ent) { return false; } /* try the move */ VectorCopy(ent->s.origin, oldorg); VectorAdd(ent->s.origin, move, neworg); /* flying monsters don't step up */ if (ent->flags & (FL_SWIM | FL_FLY)) { /* try one move with vertical motion, then one without */ for (i = 0; i < 2; i++) { VectorAdd(ent->s.origin, move, neworg); if ((i == 0) && ent->enemy) { if (!ent->goalentity) { ent->goalentity = ent->enemy; } dz = ent->s.origin[2] - ent->goalentity->s.origin[2]; if (ent->goalentity->client) { if (dz > 40) { neworg[2] -= 8; } if (!((ent->flags & FL_SWIM) && (ent->waterlevel < 2))) { if (dz < 30) { neworg[2] += 8; } } } else { if (strcmp(ent->classname, "monster_fixbot") == 0) { if ((ent->s.frame >= 105) && (ent->s.frame <= 120)) { if (dz > 12) { neworg[2]--; } else if (dz < -12) { neworg[2]++; } } else if ((ent->s.frame >= 31) && (ent->s.frame <= 88)) { if (dz > 12) { neworg[2] -= 12; } else if (dz < -12) { neworg[2] += 12; } } else { if (dz > 12) { neworg[2] -= 8; } else if (dz < -12) { neworg[2] += 8; } } } else { if (dz > 8) { neworg[2] -= 8; } else if (dz > 0) { neworg[2] -= dz; } else if (dz < -8) { neworg[2] += 8; } else { neworg[2] += dz; } } } } trace = gi.trace(ent->s.origin, ent->mins, ent->maxs, neworg, ent, MASK_MONSTERSOLID); /* fly monsters don't enter water voluntarily */ if (ent->flags & FL_FLY) { if (!ent->waterlevel) { test[0] = trace.endpos[0]; test[1] = trace.endpos[1]; test[2] = trace.endpos[2] + ent->mins[2] + 1; contents = gi.pointcontents(test); if (contents & MASK_WATER) { return false; } } } /* swim monsters don't exit water voluntarily */ if (ent->flags & FL_SWIM) { if (ent->waterlevel < 2) { test[0] = trace.endpos[0]; test[1] = trace.endpos[1]; test[2] = trace.endpos[2] + ent->mins[2] + 1; contents = gi.pointcontents(test); if (!(contents & MASK_WATER)) { return false; } } } if (trace.fraction == 1) { VectorCopy(trace.endpos, ent->s.origin); if (relink) { gi.linkentity(ent); G_TouchTriggers(ent); } return true; } if (!ent->enemy) { break; } } return false; } /* push down from a step height above the wished position */ if (!(ent->monsterinfo.aiflags & AI_NOSTEP)) { stepsize = STEPSIZE; } else { stepsize = 1; } neworg[2] += stepsize; VectorCopy(neworg, end); end[2] -= stepsize * 2; trace = gi.trace(neworg, ent->mins, ent->maxs, end, ent, MASK_MONSTERSOLID); if (trace.allsolid) { return false; } if (trace.startsolid) { neworg[2] -= stepsize; trace = gi.trace(neworg, ent->mins, ent->maxs, end, ent, MASK_MONSTERSOLID); if (trace.allsolid || trace.startsolid) { return false; } } /* don't go in to water */ if (ent->waterlevel == 0) { test[0] = trace.endpos[0]; test[1] = trace.endpos[1]; test[2] = trace.endpos[2] + ent->mins[2] + 1; contents = gi.pointcontents(test); if (contents & MASK_WATER) { return false; } } if (trace.fraction == 1) { /* if monster had the ground pulled out, go ahead and fall */ if (ent->flags & FL_PARTIALGROUND) { VectorAdd(ent->s.origin, move, ent->s.origin); if (relink) { gi.linkentity(ent); G_TouchTriggers(ent); } ent->groundentity = NULL; return true; } return false; /* walked off an edge */ } /* check point traces down for dangling corners */ VectorCopy(trace.endpos, ent->s.origin); if (!M_CheckBottom(ent)) { if (ent->flags & FL_PARTIALGROUND) { /* entity had floor mostly pulled out from underneath it and is trying to correct */ if (relink) { gi.linkentity(ent); G_TouchTriggers(ent); } return true; } VectorCopy(oldorg, ent->s.origin); return false; } if (ent->flags & FL_PARTIALGROUND) { ent->flags &= ~FL_PARTIALGROUND; } ent->groundentity = trace.ent; ent->groundentity_linkcount = trace.ent->linkcount; /* the move is ok */ if (relink) { gi.linkentity(ent); G_TouchTriggers(ent); } return true; } /* ============================================================================ */ void M_ChangeYaw(edict_t *ent) { float ideal; float current; float move; float speed; if (!ent) { return; } current = anglemod(ent->s.angles[YAW]); ideal = ent->ideal_yaw; if (current == ideal) { return; } move = ideal - current; speed = ent->yaw_speed; if (ideal > current) { if (move >= 180) { move = move - 360; } } else { if (move <= -180) { move = move + 360; } } if (move > 0) { if (move > speed) { move = speed; } } else { if (move < -speed) { move = -speed; } } ent->s.angles[YAW] = anglemod(current + move); } /* * Turns to the movement direction, and * walks the current distance if facing it. */ qboolean SV_StepDirection(edict_t *ent, float yaw, float dist) { vec3_t move, oldorigin; float delta; if (!ent) { return false; } ent->ideal_yaw = yaw; M_ChangeYaw(ent); yaw = yaw * M_PI * 2 / 360; move[0] = cos(yaw) * dist; move[1] = sin(yaw) * dist; move[2] = 0; VectorCopy(ent->s.origin, oldorigin); if (SV_movestep(ent, move, false)) { delta = ent->s.angles[YAW] - ent->ideal_yaw; if ((delta > 45) && (delta < 315)) { /* not turned far enough, so don't take the step */ VectorCopy(oldorigin, ent->s.origin); } gi.linkentity(ent); G_TouchTriggers(ent); return true; } gi.linkentity(ent); G_TouchTriggers(ent); return false; } void SV_FixCheckBottom(edict_t *ent) { if (!ent) { return; } ent->flags |= FL_PARTIALGROUND; } void SV_NewChaseDir(edict_t *actor, edict_t *enemy, float dist) { float deltax, deltay; float d[3]; float tdir, olddir, turnaround; if (!actor || !enemy) { return; } olddir = anglemod((int)(actor->ideal_yaw / 45) * 45); turnaround = anglemod(olddir - 180); deltax = enemy->s.origin[0] - actor->s.origin[0]; deltay = enemy->s.origin[1] - actor->s.origin[1]; if (deltax > 10) { d[1] = 0; } else if (deltax < -10) { d[1] = 180; } else { d[1] = DI_NODIR; } if (deltay < -10) { d[2] = 270; } else if (deltay > 10) { d[2] = 90; } else { d[2] = DI_NODIR; } /* try direct route */ if ((d[1] != DI_NODIR) && (d[2] != DI_NODIR)) { if (d[1] == 0) { tdir = d[2] == 90 ? 45 : 315; } else { tdir = d[2] == 90 ? 135 : 215; } if ((tdir != turnaround) && SV_StepDirection(actor, tdir, dist)) { return; } } /* try other directions */ if (((rand() & 3) & 1) || (fabsf(deltay) > fabsf(deltax))) { tdir = d[1]; d[1] = d[2]; d[2] = tdir; } if ((d[1] != DI_NODIR) && (d[1] != turnaround) && SV_StepDirection(actor, d[1], dist)) { return; } if ((d[2] != DI_NODIR) && (d[2] != turnaround) && SV_StepDirection(actor, d[2], dist)) { return; } /* there is no direct path to the player, so pick another direction */ if ((olddir != DI_NODIR) && SV_StepDirection(actor, olddir, dist)) { return; } if (rand() & 1) /*randomly determine direction of search*/ { for (tdir = 0; tdir <= 315; tdir += 45) { if ((tdir != turnaround) && SV_StepDirection(actor, tdir, dist)) { return; } } } else { for (tdir = 315; tdir >= 0; tdir -= 45) { if ((tdir != turnaround) && SV_StepDirection(actor, tdir, dist)) { return; } } } if ((turnaround != DI_NODIR) && SV_StepDirection(actor, turnaround, dist)) { return; } actor->ideal_yaw = olddir; /* can't move */ /* if a bridge was pulled out from underneath a monster, it may not have a valid standing position at all */ if (!M_CheckBottom(actor)) { SV_FixCheckBottom(actor); } } qboolean SV_CloseEnough(edict_t *ent, edict_t *goal, float dist) { int i; if (!ent || !goal) { return false; } for (i = 0; i < 3; i++) { if (goal->absmin[i] > ent->absmax[i] + dist) { return false; } if (goal->absmax[i] < ent->absmin[i] - dist) { return false; } } return true; } void M_MoveToGoal(edict_t *ent, float dist) { edict_t *goal; if (!ent) { return; } goal = ent->goalentity; if (!ent->groundentity && !(ent->flags & (FL_FLY | FL_SWIM))) { return; } /* if the next step hits the enemy, return immediately */ if (ent->enemy && SV_CloseEnough(ent, ent->enemy, dist)) { return; } /* bump around... */ if (((rand() & 3) == 1) || !SV_StepDirection(ent, ent->ideal_yaw, dist)) { if (ent->inuse) { SV_NewChaseDir(ent, goal, dist); } } } qboolean M_walkmove(edict_t *ent, float yaw, float dist) { vec3_t move; if (!ent) { return false; } if (!ent->groundentity && !(ent->flags & (FL_FLY | FL_SWIM))) { return false; } yaw = yaw * M_PI * 2 / 360; move[0] = cos(yaw) * dist; move[1] = sin(yaw) * dist; move[2] = 0; return SV_movestep(ent, move, true); } xatrix-XATRIX_2_14/src/monster/misc/player.h000066400000000000000000000122471477320050300210240ustar00rootroot00000000000000/* ======================================================================= * * Player (the arm and the weapons) animation. * * ======================================================================= */ #define FRAME_stand01 0 #define FRAME_stand02 1 #define FRAME_stand03 2 #define FRAME_stand04 3 #define FRAME_stand05 4 #define FRAME_stand06 5 #define FRAME_stand07 6 #define FRAME_stand08 7 #define FRAME_stand09 8 #define FRAME_stand10 9 #define FRAME_stand11 10 #define FRAME_stand12 11 #define FRAME_stand13 12 #define FRAME_stand14 13 #define FRAME_stand15 14 #define FRAME_stand16 15 #define FRAME_stand17 16 #define FRAME_stand18 17 #define FRAME_stand19 18 #define FRAME_stand20 19 #define FRAME_stand21 20 #define FRAME_stand22 21 #define FRAME_stand23 22 #define FRAME_stand24 23 #define FRAME_stand25 24 #define FRAME_stand26 25 #define FRAME_stand27 26 #define FRAME_stand28 27 #define FRAME_stand29 28 #define FRAME_stand30 29 #define FRAME_stand31 30 #define FRAME_stand32 31 #define FRAME_stand33 32 #define FRAME_stand34 33 #define FRAME_stand35 34 #define FRAME_stand36 35 #define FRAME_stand37 36 #define FRAME_stand38 37 #define FRAME_stand39 38 #define FRAME_stand40 39 #define FRAME_run1 40 #define FRAME_run2 41 #define FRAME_run3 42 #define FRAME_run4 43 #define FRAME_run5 44 #define FRAME_run6 45 #define FRAME_attack1 46 #define FRAME_attack2 47 #define FRAME_attack3 48 #define FRAME_attack4 49 #define FRAME_attack5 50 #define FRAME_attack6 51 #define FRAME_attack7 52 #define FRAME_attack8 53 #define FRAME_pain101 54 #define FRAME_pain102 55 #define FRAME_pain103 56 #define FRAME_pain104 57 #define FRAME_pain201 58 #define FRAME_pain202 59 #define FRAME_pain203 60 #define FRAME_pain204 61 #define FRAME_pain301 62 #define FRAME_pain302 63 #define FRAME_pain303 64 #define FRAME_pain304 65 #define FRAME_jump1 66 #define FRAME_jump2 67 #define FRAME_jump3 68 #define FRAME_jump4 69 #define FRAME_jump5 70 #define FRAME_jump6 71 #define FRAME_flip01 72 #define FRAME_flip02 73 #define FRAME_flip03 74 #define FRAME_flip04 75 #define FRAME_flip05 76 #define FRAME_flip06 77 #define FRAME_flip07 78 #define FRAME_flip08 79 #define FRAME_flip09 80 #define FRAME_flip10 81 #define FRAME_flip11 82 #define FRAME_flip12 83 #define FRAME_salute01 84 #define FRAME_salute02 85 #define FRAME_salute03 86 #define FRAME_salute04 87 #define FRAME_salute05 88 #define FRAME_salute06 89 #define FRAME_salute07 90 #define FRAME_salute08 91 #define FRAME_salute09 92 #define FRAME_salute10 93 #define FRAME_salute11 94 #define FRAME_taunt01 95 #define FRAME_taunt02 96 #define FRAME_taunt03 97 #define FRAME_taunt04 98 #define FRAME_taunt05 99 #define FRAME_taunt06 100 #define FRAME_taunt07 101 #define FRAME_taunt08 102 #define FRAME_taunt09 103 #define FRAME_taunt10 104 #define FRAME_taunt11 105 #define FRAME_taunt12 106 #define FRAME_taunt13 107 #define FRAME_taunt14 108 #define FRAME_taunt15 109 #define FRAME_taunt16 110 #define FRAME_taunt17 111 #define FRAME_wave01 112 #define FRAME_wave02 113 #define FRAME_wave03 114 #define FRAME_wave04 115 #define FRAME_wave05 116 #define FRAME_wave06 117 #define FRAME_wave07 118 #define FRAME_wave08 119 #define FRAME_wave09 120 #define FRAME_wave10 121 #define FRAME_wave11 122 #define FRAME_point01 123 #define FRAME_point02 124 #define FRAME_point03 125 #define FRAME_point04 126 #define FRAME_point05 127 #define FRAME_point06 128 #define FRAME_point07 129 #define FRAME_point08 130 #define FRAME_point09 131 #define FRAME_point10 132 #define FRAME_point11 133 #define FRAME_point12 134 #define FRAME_crstnd01 135 #define FRAME_crstnd02 136 #define FRAME_crstnd03 137 #define FRAME_crstnd04 138 #define FRAME_crstnd05 139 #define FRAME_crstnd06 140 #define FRAME_crstnd07 141 #define FRAME_crstnd08 142 #define FRAME_crstnd09 143 #define FRAME_crstnd10 144 #define FRAME_crstnd11 145 #define FRAME_crstnd12 146 #define FRAME_crstnd13 147 #define FRAME_crstnd14 148 #define FRAME_crstnd15 149 #define FRAME_crstnd16 150 #define FRAME_crstnd17 151 #define FRAME_crstnd18 152 #define FRAME_crstnd19 153 #define FRAME_crwalk1 154 #define FRAME_crwalk2 155 #define FRAME_crwalk3 156 #define FRAME_crwalk4 157 #define FRAME_crwalk5 158 #define FRAME_crwalk6 159 #define FRAME_crattak1 160 #define FRAME_crattak2 161 #define FRAME_crattak3 162 #define FRAME_crattak4 163 #define FRAME_crattak5 164 #define FRAME_crattak6 165 #define FRAME_crattak7 166 #define FRAME_crattak8 167 #define FRAME_crattak9 168 #define FRAME_crpain1 169 #define FRAME_crpain2 170 #define FRAME_crpain3 171 #define FRAME_crpain4 172 #define FRAME_crdeath1 173 #define FRAME_crdeath2 174 #define FRAME_crdeath3 175 #define FRAME_crdeath4 176 #define FRAME_crdeath5 177 #define FRAME_death101 178 #define FRAME_death102 179 #define FRAME_death103 180 #define FRAME_death104 181 #define FRAME_death105 182 #define FRAME_death106 183 #define FRAME_death201 184 #define FRAME_death202 185 #define FRAME_death203 186 #define FRAME_death204 187 #define FRAME_death205 188 #define FRAME_death206 189 #define FRAME_death301 190 #define FRAME_death302 191 #define FRAME_death303 192 #define FRAME_death304 193 #define FRAME_death305 194 #define FRAME_death306 195 #define FRAME_death307 196 #define FRAME_death308 197 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/mutant/000077500000000000000000000000001477320050300177265ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/mutant/mutant.c000066400000000000000000000357071477320050300214160ustar00rootroot00000000000000/* ======================================================================= * * Mutant. * * ======================================================================= */ #include "../../header/local.h" #include "mutant.h" static int sound_swing; static int sound_hit; static int sound_hit2; static int sound_death; static int sound_idle; static int sound_pain1; static int sound_pain2; static int sound_sight; static int sound_search; static int sound_step1; static int sound_step2; static int sound_step3; static int sound_thud; void mutant_walk(edict_t *self); void mutant_step(edict_t *self) { int n; if (!self) { return; } n = (rand() + 1) % 3; if (n == 0) { gi.sound(self, CHAN_VOICE, sound_step1, 1, ATTN_NORM, 0); } else if (n == 1) { gi.sound(self, CHAN_VOICE, sound_step2, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_step3, 1, ATTN_NORM, 0); } } void mutant_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); } void mutant_search(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_search, 1, ATTN_NORM, 0); } void mutant_swing(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_swing, 1, ATTN_NORM, 0); } static mframe_t mutant_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, /* 10 */ {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, /* 20 */ {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, /* 30 */ {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, /* 40 */ {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, /* 50 */ {ai_stand, 0, NULL} }; mmove_t mutant_move_stand = { FRAME_stand101, FRAME_stand151, mutant_frames_stand, NULL }; void mutant_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &mutant_move_stand; } void mutant_idle_loop(edict_t *self) { if (!self) { return; } if (random() < 0.75) { self->monsterinfo.nextframe = FRAME_stand155; } } static mframe_t mutant_frames_idle[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, /* scratch loop start */ {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, mutant_idle_loop}, /* scratch loop end */ {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t mutant_move_idle = { FRAME_stand152, FRAME_stand164, mutant_frames_idle, mutant_stand }; void mutant_idle(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &mutant_move_idle; gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); } static mframe_t mutant_frames_walk[] = { {ai_walk, 3, NULL}, {ai_walk, 1, NULL}, {ai_walk, 5, NULL}, {ai_walk, 10, NULL}, {ai_walk, 13, NULL}, {ai_walk, 10, NULL}, {ai_walk, 0, NULL}, {ai_walk, 5, NULL}, {ai_walk, 6, NULL}, {ai_walk, 16, NULL}, {ai_walk, 15, NULL}, {ai_walk, 6, NULL} }; mmove_t mutant_move_walk = { FRAME_walk05, FRAME_walk16, mutant_frames_walk, NULL }; void mutant_walk_loop(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &mutant_move_walk; } static mframe_t mutant_frames_start_walk[] = { {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, -2, NULL}, {ai_walk, 1, NULL} }; mmove_t mutant_move_start_walk = { FRAME_walk01, FRAME_walk04, mutant_frames_start_walk, mutant_walk_loop }; void mutant_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &mutant_move_start_walk; } static mframe_t mutant_frames_run[] = { {ai_run, 40, NULL}, {ai_run, 40, mutant_step}, {ai_run, 24, NULL}, {ai_run, 5, mutant_step}, {ai_run, 17, NULL}, {ai_run, 10, NULL} }; mmove_t mutant_move_run = { FRAME_run03, FRAME_run08, mutant_frames_run, NULL }; void mutant_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &mutant_move_stand; } else { self->monsterinfo.currentmove = &mutant_move_run; } } void mutant_hit_left(edict_t *self) { vec3_t aim; if (!self) { return; } VectorSet(aim, MELEE_DISTANCE, self->mins[0], 8); if (fire_hit(self, aim, (10 + (rand() % 5)), 100)) { gi.sound(self, CHAN_WEAPON, sound_hit, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_WEAPON, sound_swing, 1, ATTN_NORM, 0); } } void mutant_hit_right(edict_t *self) { vec3_t aim; if (!self) { return; } VectorSet(aim, MELEE_DISTANCE, self->maxs[0], 8); if (fire_hit(self, aim, (10 + (rand() % 5)), 100)) { gi.sound(self, CHAN_WEAPON, sound_hit2, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_WEAPON, sound_swing, 1, ATTN_NORM, 0); } } void mutant_check_refire(edict_t *self) { if (!self) { return; } if (!self->enemy || !self->enemy->inuse || (self->enemy->health <= 0)) { return; } if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attack09; } } static mframe_t mutant_frames_attack[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, mutant_hit_left}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, mutant_hit_right}, {ai_charge, 0, mutant_check_refire} }; mmove_t mutant_move_attack = { FRAME_attack09, FRAME_attack15, mutant_frames_attack, mutant_run }; void mutant_melee(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &mutant_move_attack; } void mutant_jump_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf /* unused */) { if (!self) { return; } if (self->health <= 0) { self->touch = NULL; return; } if (other->takedamage) { if (VectorLength(self->velocity) > 400) { vec3_t point; vec3_t normal; int damage; VectorCopy(self->velocity, normal); VectorNormalize(normal); VectorMA(self->s.origin, self->maxs[0], normal, point); damage = 40 + 10 * random(); T_Damage(other, self, self, self->velocity, point, normal, damage, damage, 0, MOD_UNKNOWN); } } if (!M_CheckBottom(self)) { if (self->groundentity) { self->monsterinfo.nextframe = FRAME_attack02; self->touch = NULL; } return; } self->touch = NULL; } void mutant_jump_takeoff(edict_t *self) { vec3_t forward; if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); AngleVectors(self->s.angles, forward, NULL, NULL); self->s.origin[2] += 1; VectorScale(forward, 600, self->velocity); self->velocity[2] = 250; self->groundentity = NULL; self->monsterinfo.aiflags |= AI_DUCKED; self->monsterinfo.attack_finished = level.time + 3; self->touch = mutant_jump_touch; } void mutant_check_landing(edict_t *self) { if (!self) { return; } if (self->groundentity) { gi.sound(self, CHAN_WEAPON, sound_thud, 1, ATTN_NORM, 0); self->monsterinfo.attack_finished = 0; self->monsterinfo.aiflags &= ~AI_DUCKED; return; } if (level.time > self->monsterinfo.attack_finished) { self->monsterinfo.nextframe = FRAME_attack02; } else { self->monsterinfo.nextframe = FRAME_attack05; } } static mframe_t mutant_frames_jump[] = { {ai_charge, 0, NULL}, {ai_charge, 17, NULL}, {ai_charge, 15, mutant_jump_takeoff}, {ai_charge, 15, NULL}, {ai_charge, 15, mutant_check_landing}, {ai_charge, 0, NULL}, {ai_charge, 3, NULL}, {ai_charge, 0, NULL} }; mmove_t mutant_move_jump = { FRAME_attack01, FRAME_attack08, mutant_frames_jump, mutant_run }; void mutant_jump(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &mutant_move_jump; } qboolean mutant_check_melee(edict_t *self) { if (!self) { return false; } if (range(self, self->enemy) == RANGE_MELEE) { return true; } return false; } qboolean mutant_check_jump(edict_t *self) { vec3_t v; float distance; if (!self) { return false; } if (self->absmin[2] > (self->enemy->absmin[2] + 0.75 * self->enemy->size[2])) { return false; } if (self->absmax[2] < (self->enemy->absmin[2] + 0.25 * self->enemy->size[2])) { return false; } v[0] = self->s.origin[0] - self->enemy->s.origin[0]; v[1] = self->s.origin[1] - self->enemy->s.origin[1]; v[2] = 0; distance = VectorLength(v); if (distance < 100) { return false; } if (distance > 100) { if (random() < 0.9) { return false; } } return true; } qboolean mutant_checkattack(edict_t *self) { if (!self) { return false; } if (!self->enemy || (self->enemy->health <= 0)) { return false; } if (mutant_check_melee(self)) { self->monsterinfo.attack_state = AS_MELEE; return true; } if (mutant_check_jump(self)) { self->monsterinfo.attack_state = AS_MISSILE; return true; } return false; } static mframe_t mutant_frames_pain1[] = { {ai_move, 4, NULL}, {ai_move, -3, NULL}, {ai_move, -8, NULL}, {ai_move, 2, NULL}, {ai_move, 5, NULL} }; mmove_t mutant_move_pain1 = { FRAME_pain101, FRAME_pain105, mutant_frames_pain1, mutant_run }; static mframe_t mutant_frames_pain2[] = { {ai_move, -24, NULL}, {ai_move, 11, NULL}, {ai_move, 5, NULL}, {ai_move, -2, NULL}, {ai_move, 6, NULL}, {ai_move, 4, NULL} }; mmove_t mutant_move_pain2 = { FRAME_pain201, FRAME_pain206, mutant_frames_pain2, mutant_run }; static mframe_t mutant_frames_pain3[] = { {ai_move, -22, NULL}, {ai_move, 3, NULL}, {ai_move, 3, NULL}, {ai_move, 2, NULL}, {ai_move, 1, NULL}, {ai_move, 1, NULL}, {ai_move, 6, NULL}, {ai_move, 3, NULL}, {ai_move, 2, NULL}, {ai_move, 0, NULL}, {ai_move, 1, NULL} }; mmove_t mutant_move_pain3 = { FRAME_pain301, FRAME_pain311, mutant_frames_pain3, mutant_run }; void mutant_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage /* unused */) { float r; if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } self->pain_debounce_time = level.time + 3; if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } r = random(); if (r < 0.33) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &mutant_move_pain1; } else if (r < 0.66) { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &mutant_move_pain2; } else { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &mutant_move_pain3; } } void mutant_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, -8); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; gi.linkentity(self); M_FlyCheck(self); } static mframe_t mutant_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t mutant_move_death1 = { FRAME_death101, FRAME_death109, mutant_frames_death1, mutant_dead }; static mframe_t mutant_frames_death2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t mutant_move_death2 = { FRAME_death201, FRAME_death210, mutant_frames_death2, mutant_dead }; void mutant_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point /* unused */) { int n; if (!self) { return; } if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 2; n++) { ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; self->s.skinnum = 1; if (random() < 0.5) { self->monsterinfo.currentmove = &mutant_move_death1; } else { self->monsterinfo.currentmove = &mutant_move_death2; } } /* * QUAKED monster_mutant (1 .5 0) (-32 -32 -24) (32 32 32) Ambush Trigger_Spawn Sight */ void SP_monster_mutant(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } sound_swing = gi.soundindex("mutant/mutatck1.wav"); sound_hit = gi.soundindex("mutant/mutatck2.wav"); sound_hit2 = gi.soundindex("mutant/mutatck3.wav"); sound_death = gi.soundindex("mutant/mutdeth1.wav"); sound_idle = gi.soundindex("mutant/mutidle1.wav"); sound_pain1 = gi.soundindex("mutant/mutpain1.wav"); sound_pain2 = gi.soundindex("mutant/mutpain2.wav"); sound_sight = gi.soundindex("mutant/mutsght1.wav"); sound_search = gi.soundindex("mutant/mutsrch1.wav"); sound_step1 = gi.soundindex("mutant/step1.wav"); sound_step2 = gi.soundindex("mutant/step2.wav"); sound_step3 = gi.soundindex("mutant/step3.wav"); sound_thud = gi.soundindex("mutant/thud1.wav"); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/mutant/tris.md2"); VectorSet(self->mins, -32, -32, -24); VectorSet(self->maxs, 32, 32, 48); self->health = 300; self->gib_health = -120; self->mass = 300; self->pain = mutant_pain; self->die = mutant_die; self->monsterinfo.stand = mutant_stand; self->monsterinfo.walk = mutant_walk; self->monsterinfo.run = mutant_run; self->monsterinfo.dodge = NULL; self->monsterinfo.attack = mutant_jump; self->monsterinfo.melee = mutant_melee; self->monsterinfo.sight = mutant_sight; self->monsterinfo.search = mutant_search; self->monsterinfo.idle = mutant_idle; self->monsterinfo.checkattack = mutant_checkattack; gi.linkentity(self); self->monsterinfo.currentmove = &mutant_move_stand; self->monsterinfo.scale = MODEL_SCALE; walkmonster_start(self); } xatrix-XATRIX_2_14/src/monster/mutant/mutant.h000066400000000000000000000077111477320050300214150ustar00rootroot00000000000000/* ======================================================================= * * Mutant animations. * * ======================================================================= */ #define FRAME_attack01 0 #define FRAME_attack02 1 #define FRAME_attack03 2 #define FRAME_attack04 3 #define FRAME_attack05 4 #define FRAME_attack06 5 #define FRAME_attack07 6 #define FRAME_attack08 7 #define FRAME_attack09 8 #define FRAME_attack10 9 #define FRAME_attack11 10 #define FRAME_attack12 11 #define FRAME_attack13 12 #define FRAME_attack14 13 #define FRAME_attack15 14 #define FRAME_death101 15 #define FRAME_death102 16 #define FRAME_death103 17 #define FRAME_death104 18 #define FRAME_death105 19 #define FRAME_death106 20 #define FRAME_death107 21 #define FRAME_death108 22 #define FRAME_death109 23 #define FRAME_death201 24 #define FRAME_death202 25 #define FRAME_death203 26 #define FRAME_death204 27 #define FRAME_death205 28 #define FRAME_death206 29 #define FRAME_death207 30 #define FRAME_death208 31 #define FRAME_death209 32 #define FRAME_death210 33 #define FRAME_pain101 34 #define FRAME_pain102 35 #define FRAME_pain103 36 #define FRAME_pain104 37 #define FRAME_pain105 38 #define FRAME_pain201 39 #define FRAME_pain202 40 #define FRAME_pain203 41 #define FRAME_pain204 42 #define FRAME_pain205 43 #define FRAME_pain206 44 #define FRAME_pain301 45 #define FRAME_pain302 46 #define FRAME_pain303 47 #define FRAME_pain304 48 #define FRAME_pain305 49 #define FRAME_pain306 50 #define FRAME_pain307 51 #define FRAME_pain308 52 #define FRAME_pain309 53 #define FRAME_pain310 54 #define FRAME_pain311 55 #define FRAME_run03 56 #define FRAME_run04 57 #define FRAME_run05 58 #define FRAME_run06 59 #define FRAME_run07 60 #define FRAME_run08 61 #define FRAME_stand101 62 #define FRAME_stand102 63 #define FRAME_stand103 64 #define FRAME_stand104 65 #define FRAME_stand105 66 #define FRAME_stand106 67 #define FRAME_stand107 68 #define FRAME_stand108 69 #define FRAME_stand109 70 #define FRAME_stand110 71 #define FRAME_stand111 72 #define FRAME_stand112 73 #define FRAME_stand113 74 #define FRAME_stand114 75 #define FRAME_stand115 76 #define FRAME_stand116 77 #define FRAME_stand117 78 #define FRAME_stand118 79 #define FRAME_stand119 80 #define FRAME_stand120 81 #define FRAME_stand121 82 #define FRAME_stand122 83 #define FRAME_stand123 84 #define FRAME_stand124 85 #define FRAME_stand125 86 #define FRAME_stand126 87 #define FRAME_stand127 88 #define FRAME_stand128 89 #define FRAME_stand129 90 #define FRAME_stand130 91 #define FRAME_stand131 92 #define FRAME_stand132 93 #define FRAME_stand133 94 #define FRAME_stand134 95 #define FRAME_stand135 96 #define FRAME_stand136 97 #define FRAME_stand137 98 #define FRAME_stand138 99 #define FRAME_stand139 100 #define FRAME_stand140 101 #define FRAME_stand141 102 #define FRAME_stand142 103 #define FRAME_stand143 104 #define FRAME_stand144 105 #define FRAME_stand145 106 #define FRAME_stand146 107 #define FRAME_stand147 108 #define FRAME_stand148 109 #define FRAME_stand149 110 #define FRAME_stand150 111 #define FRAME_stand151 112 #define FRAME_stand152 113 #define FRAME_stand153 114 #define FRAME_stand154 115 #define FRAME_stand155 116 #define FRAME_stand156 117 #define FRAME_stand157 118 #define FRAME_stand158 119 #define FRAME_stand159 120 #define FRAME_stand160 121 #define FRAME_stand161 122 #define FRAME_stand162 123 #define FRAME_stand163 124 #define FRAME_stand164 125 #define FRAME_walk01 126 #define FRAME_walk02 127 #define FRAME_walk03 128 #define FRAME_walk04 129 #define FRAME_walk05 130 #define FRAME_walk06 131 #define FRAME_walk07 132 #define FRAME_walk08 133 #define FRAME_walk09 134 #define FRAME_walk10 135 #define FRAME_walk11 136 #define FRAME_walk12 137 #define FRAME_walk13 138 #define FRAME_walk14 139 #define FRAME_walk15 140 #define FRAME_walk16 141 #define FRAME_walk17 142 #define FRAME_walk18 143 #define FRAME_walk19 144 #define FRAME_walk20 145 #define FRAME_walk21 146 #define FRAME_walk22 147 #define FRAME_walk23 148 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/parasite/000077500000000000000000000000001477320050300202265ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/parasite/parasite.c000066400000000000000000000355201477320050300222070ustar00rootroot00000000000000/* * Copyright (C) 1997-2001 Id Software, Inc. * * 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. * * ======================================================================= * * Parasite. * * ======================================================================= */ #include "../../header/local.h" #include "parasite.h" static int sound_pain1; static int sound_pain2; static int sound_die; static int sound_launch; static int sound_impact; static int sound_suck; static int sound_reelin; static int sound_sight; static int sound_tap; static int sound_scratch; static int sound_search; void parasite_stand(edict_t *self); void parasite_start_run(edict_t *self); void parasite_run(edict_t *self); void parasite_walk(edict_t *self); void parasite_start_walk(edict_t *self); void parasite_end_fidget(edict_t *self); void parasite_do_fidget(edict_t *self); void parasite_refidget(edict_t *self); void parasite_launch(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_launch, 1, ATTN_NORM, 0); } void parasite_reel_in(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_reelin, 1, ATTN_NORM, 0); } void parasite_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_sight, 1, ATTN_NORM, 0); } void parasite_tap(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_tap, 1, ATTN_IDLE, 0); } void parasite_footstep(edict_t *self) { if (g_monsterfootsteps->value) { parasite_tap(self); } } void parasite_scratch(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_scratch, 1, ATTN_IDLE, 0); } void parasite_search(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_search, 1, ATTN_IDLE, 0); } static mframe_t parasite_frames_start_fidget[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t parasite_move_start_fidget = { FRAME_stand18, FRAME_stand21, parasite_frames_start_fidget, parasite_do_fidget }; static mframe_t parasite_frames_fidget[] = { {ai_stand, 0, parasite_scratch}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, parasite_scratch}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t parasite_move_fidget = { FRAME_stand22, FRAME_stand27, parasite_frames_fidget, parasite_refidget }; static mframe_t parasite_frames_end_fidget[] = { {ai_stand, 0, parasite_scratch}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t parasite_move_end_fidget = { FRAME_stand28, FRAME_stand35, parasite_frames_end_fidget, parasite_stand }; void parasite_end_fidget(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = ¶site_move_end_fidget; } void parasite_do_fidget(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = ¶site_move_fidget; } void parasite_refidget(edict_t *self) { if (!self) { return; } if (random() <= 0.8) { self->monsterinfo.currentmove = ¶site_move_fidget; } else { self->monsterinfo.currentmove = ¶site_move_end_fidget; } } void parasite_idle(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = ¶site_move_start_fidget; } static mframe_t parasite_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, parasite_tap}, {ai_stand, 0, NULL}, {ai_stand, 0, parasite_tap}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, parasite_tap}, {ai_stand, 0, NULL}, {ai_stand, 0, parasite_tap}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, parasite_tap}, {ai_stand, 0, NULL}, {ai_stand, 0, parasite_tap} }; mmove_t parasite_move_stand = { FRAME_stand01, FRAME_stand17, parasite_frames_stand, parasite_stand }; void parasite_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = ¶site_move_stand; } static mframe_t parasite_frames_run[] = { {ai_run, 30, NULL}, {ai_run, 30, NULL}, {ai_run, 22, parasite_footstep}, {ai_run, 19, parasite_footstep}, {ai_run, 24, NULL}, {ai_run, 28, parasite_footstep}, {ai_run, 25, NULL} }; mmove_t parasite_move_run = { FRAME_run03, FRAME_run09, parasite_frames_run, NULL }; static mframe_t parasite_frames_start_run[] = { {ai_run, 0, NULL}, {ai_run, 30, NULL}, }; mmove_t parasite_move_start_run = { FRAME_run01, FRAME_run02, parasite_frames_start_run, parasite_run }; static mframe_t parasite_frames_stop_run[] = { {ai_run, 20, NULL}, {ai_run, 20, NULL}, {ai_run, 12, parasite_footstep}, {ai_run, 10, NULL}, {ai_run, 0, NULL}, {ai_run, 0, NULL} }; mmove_t parasite_move_stop_run = { FRAME_run10, FRAME_run15, parasite_frames_stop_run, NULL }; void parasite_start_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = ¶site_move_stand; } else { self->monsterinfo.currentmove = ¶site_move_start_run; } } void parasite_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = ¶site_move_stand; } else { self->monsterinfo.currentmove = ¶site_move_run; } } static mframe_t parasite_frames_walk[] = { {ai_walk, 30, NULL}, {ai_walk, 30, NULL}, {ai_walk, 22, parasite_footstep}, {ai_walk, 19, NULL}, {ai_walk, 24, parasite_footstep}, {ai_walk, 28, parasite_footstep}, {ai_walk, 25, NULL} }; mmove_t parasite_move_walk = { FRAME_run03, FRAME_run09, parasite_frames_walk, parasite_walk }; static mframe_t parasite_frames_start_walk[] = { {ai_walk, 0, NULL}, {ai_walk, 30, parasite_walk} }; mmove_t parasite_move_start_walk = { FRAME_run01, FRAME_run02, parasite_frames_start_walk, NULL }; static mframe_t parasite_frames_stop_walk[] = { {ai_walk, 20, NULL}, {ai_walk, 20, NULL}, {ai_walk, 12, parasite_footstep}, {ai_walk, 10, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL} }; mmove_t parasite_move_stop_walk = { FRAME_run10, FRAME_run15, parasite_frames_stop_walk, NULL }; void parasite_start_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = ¶site_move_start_walk; } void parasite_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = ¶site_move_walk; } static mframe_t parasite_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 6, NULL}, {ai_move, 16, NULL}, {ai_move, -6, NULL}, {ai_move, -7, NULL}, {ai_move, 0, NULL} }; mmove_t parasite_move_pain1 = { FRAME_pain101, FRAME_pain111, parasite_frames_pain1, parasite_start_run }; void parasite_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage /* unused */) { if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } self->pain_debounce_time = level.time + 3; if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } if (random() < 0.5) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); } self->monsterinfo.currentmove = ¶site_move_pain1; } qboolean parasite_drain_attack_ok(vec3_t start, vec3_t end) { vec3_t dir, angles; /* check for max distance */ VectorSubtract(start, end, dir); if (VectorLength(dir) > 256) { return false; } /* check for min/max pitch */ vectoangles(dir, angles); if (angles[0] < -180) { angles[0] += 360; } if (fabs(angles[0]) > 30) { return false; } return true; } void parasite_drain_attack(edict_t *self) { vec3_t offset, start, f, r, end, dir; trace_t tr; int damage; if (!self) { return; } AngleVectors(self->s.angles, f, r, NULL); VectorSet(offset, 24, 0, 6); G_ProjectSource(self->s.origin, offset, f, r, start); VectorCopy(self->enemy->s.origin, end); if (!parasite_drain_attack_ok(start, end)) { end[2] = self->enemy->s.origin[2] + self->enemy->maxs[2] - 8; if (!parasite_drain_attack_ok(start, end)) { end[2] = self->enemy->s.origin[2] + self->enemy->mins[2] + 8; if (!parasite_drain_attack_ok(start, end)) { return; } } } VectorCopy(self->enemy->s.origin, end); tr = gi.trace(start, NULL, NULL, end, self, MASK_SHOT); if (tr.ent != self->enemy) { return; } if (self->s.frame == FRAME_drain03) { damage = 5; gi.sound(self->enemy, CHAN_AUTO, sound_impact, 1, ATTN_NORM, 0); } else { if (self->s.frame == FRAME_drain04) { gi.sound(self, CHAN_WEAPON, sound_suck, 1, ATTN_NORM, 0); } damage = 2; } gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_PARASITE_ATTACK); gi.WriteShort(self - g_edicts); gi.WritePosition(start); gi.WritePosition(end); gi.multicast(self->s.origin, MULTICAST_PVS); VectorSubtract(start, end, dir); T_Damage(self->enemy, self, self, dir, self->enemy->s.origin, vec3_origin, damage, 0, DAMAGE_NO_KNOCKBACK, MOD_UNKNOWN); } static mframe_t parasite_frames_drain[] = { {ai_charge, 0, parasite_launch}, {ai_charge, 0, NULL}, {ai_charge, 15, parasite_drain_attack}, /* Target hits */ {ai_charge, 0, parasite_drain_attack}, /* drain */ {ai_charge, 0, parasite_drain_attack}, /* drain */ {ai_charge, 0, parasite_drain_attack}, /* drain */ {ai_charge, 0, parasite_drain_attack}, /* drain */ {ai_charge, -2, parasite_drain_attack}, /* drain */ {ai_charge, -2, parasite_drain_attack}, /* drain */ {ai_charge, -3, parasite_drain_attack}, /* drain */ {ai_charge, -2, parasite_drain_attack}, /* drain */ {ai_charge, 0, parasite_drain_attack}, /* drain */ {ai_charge, -1, parasite_drain_attack}, /* drain */ {ai_charge, 0, parasite_reel_in}, /* let go */ {ai_charge, -2, NULL}, {ai_charge, -2, NULL}, {ai_charge, -3, NULL}, {ai_charge, 0, NULL} }; mmove_t parasite_move_drain = { FRAME_drain01, FRAME_drain18, parasite_frames_drain, parasite_start_run }; static mframe_t parasite_frames_break[] = { {ai_charge, 0, NULL}, {ai_charge, -3, NULL}, {ai_charge, 1, NULL}, {ai_charge, 2, NULL}, {ai_charge, -3, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 3, NULL}, {ai_charge, 0, NULL}, {ai_charge, -18, NULL}, {ai_charge, 3, NULL}, {ai_charge, 9, NULL}, {ai_charge, 6, NULL}, {ai_charge, 0, NULL}, {ai_charge, -18, NULL}, {ai_charge, 0, NULL}, {ai_charge, 8, NULL}, {ai_charge, 9, NULL}, {ai_charge, 0, NULL}, {ai_charge, -18, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, /* airborne */ {ai_charge, 0, NULL}, /* airborne */ {ai_charge, 0, NULL}, /* slides */ {ai_charge, 0, NULL}, /* slides */ {ai_charge, 0, NULL}, /* slides */ {ai_charge, 0, NULL}, /* slides */ {ai_charge, 4, NULL}, {ai_charge, 11, NULL}, {ai_charge, -2, NULL}, {ai_charge, -5, NULL}, {ai_charge, 1, NULL} }; mmove_t parasite_move_break = { FRAME_break01, FRAME_break32, parasite_frames_break, parasite_start_run }; void parasite_attack(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = ¶site_move_drain; } void parasite_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, -8); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } static mframe_t parasite_frames_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t parasite_move_death = { FRAME_death101, FRAME_death107, parasite_frames_death, parasite_dead }; void parasite_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point /* unused */) { int n; if (!self) { return; } /* check for gib */ if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 2; n++) { ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } /* regular death */ gi.sound(self, CHAN_VOICE, sound_die, 1, ATTN_NORM, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; self->monsterinfo.currentmove = ¶site_move_death; } /* * QUAKED monster_parasite (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_parasite(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } sound_pain1 = gi.soundindex("parasite/parpain1.wav"); sound_pain2 = gi.soundindex("parasite/parpain2.wav"); sound_die = gi.soundindex("parasite/pardeth1.wav"); sound_launch = gi.soundindex("parasite/paratck1.wav"); sound_impact = gi.soundindex("parasite/paratck2.wav"); sound_suck = gi.soundindex("parasite/paratck3.wav"); sound_reelin = gi.soundindex("parasite/paratck4.wav"); sound_sight = gi.soundindex("parasite/parsght1.wav"); sound_tap = gi.soundindex("parasite/paridle1.wav"); sound_scratch = gi.soundindex("parasite/paridle2.wav"); sound_search = gi.soundindex("parasite/parsrch1.wav"); self->s.modelindex = gi.modelindex("models/monsters/parasite/tris.md2"); VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, 24); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->health = 175; self->gib_health = -50; self->mass = 250; self->viewheight = 16; self->pain = parasite_pain; self->die = parasite_die; self->monsterinfo.stand = parasite_stand; self->monsterinfo.walk = parasite_start_walk; self->monsterinfo.run = parasite_start_run; self->monsterinfo.attack = parasite_attack; self->monsterinfo.sight = parasite_sight; self->monsterinfo.idle = parasite_idle; gi.linkentity(self); self->monsterinfo.currentmove = ¶site_move_stand; self->monsterinfo.scale = MODEL_SCALE; walkmonster_start(self); } xatrix-XATRIX_2_14/src/monster/parasite/parasite.h000066400000000000000000000061161477320050300222130ustar00rootroot00000000000000/* ======================================================================= * * Parasite animations. * * ======================================================================= */ #define FRAME_break01 0 #define FRAME_break02 1 #define FRAME_break03 2 #define FRAME_break04 3 #define FRAME_break05 4 #define FRAME_break06 5 #define FRAME_break07 6 #define FRAME_break08 7 #define FRAME_break09 8 #define FRAME_break10 9 #define FRAME_break11 10 #define FRAME_break12 11 #define FRAME_break13 12 #define FRAME_break14 13 #define FRAME_break15 14 #define FRAME_break16 15 #define FRAME_break17 16 #define FRAME_break18 17 #define FRAME_break19 18 #define FRAME_break20 19 #define FRAME_break21 20 #define FRAME_break22 21 #define FRAME_break23 22 #define FRAME_break24 23 #define FRAME_break25 24 #define FRAME_break26 25 #define FRAME_break27 26 #define FRAME_break28 27 #define FRAME_break29 28 #define FRAME_break30 29 #define FRAME_break31 30 #define FRAME_break32 31 #define FRAME_death101 32 #define FRAME_death102 33 #define FRAME_death103 34 #define FRAME_death104 35 #define FRAME_death105 36 #define FRAME_death106 37 #define FRAME_death107 38 #define FRAME_drain01 39 #define FRAME_drain02 40 #define FRAME_drain03 41 #define FRAME_drain04 42 #define FRAME_drain05 43 #define FRAME_drain06 44 #define FRAME_drain07 45 #define FRAME_drain08 46 #define FRAME_drain09 47 #define FRAME_drain10 48 #define FRAME_drain11 49 #define FRAME_drain12 50 #define FRAME_drain13 51 #define FRAME_drain14 52 #define FRAME_drain15 53 #define FRAME_drain16 54 #define FRAME_drain17 55 #define FRAME_drain18 56 #define FRAME_pain101 57 #define FRAME_pain102 58 #define FRAME_pain103 59 #define FRAME_pain104 60 #define FRAME_pain105 61 #define FRAME_pain106 62 #define FRAME_pain107 63 #define FRAME_pain108 64 #define FRAME_pain109 65 #define FRAME_pain110 66 #define FRAME_pain111 67 #define FRAME_run01 68 #define FRAME_run02 69 #define FRAME_run03 70 #define FRAME_run04 71 #define FRAME_run05 72 #define FRAME_run06 73 #define FRAME_run07 74 #define FRAME_run08 75 #define FRAME_run09 76 #define FRAME_run10 77 #define FRAME_run11 78 #define FRAME_run12 79 #define FRAME_run13 80 #define FRAME_run14 81 #define FRAME_run15 82 #define FRAME_stand01 83 #define FRAME_stand02 84 #define FRAME_stand03 85 #define FRAME_stand04 86 #define FRAME_stand05 87 #define FRAME_stand06 88 #define FRAME_stand07 89 #define FRAME_stand08 90 #define FRAME_stand09 91 #define FRAME_stand10 92 #define FRAME_stand11 93 #define FRAME_stand12 94 #define FRAME_stand13 95 #define FRAME_stand14 96 #define FRAME_stand15 97 #define FRAME_stand16 98 #define FRAME_stand17 99 #define FRAME_stand18 100 #define FRAME_stand19 101 #define FRAME_stand20 102 #define FRAME_stand21 103 #define FRAME_stand22 104 #define FRAME_stand23 105 #define FRAME_stand24 106 #define FRAME_stand25 107 #define FRAME_stand26 108 #define FRAME_stand27 109 #define FRAME_stand28 110 #define FRAME_stand29 111 #define FRAME_stand30 112 #define FRAME_stand31 113 #define FRAME_stand32 114 #define FRAME_stand33 115 #define FRAME_stand34 116 #define FRAME_stand35 117 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/soldier/000077500000000000000000000000001477320050300200575ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/soldier/soldier.c000066400000000000000000001706501477320050300216750ustar00rootroot00000000000000/* * Copyright (C) 1997-2001 Id Software, Inc. * * 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. * * ======================================================================= * * Soldier aka "Guard". This is the most complex enemy in Quake 2, since * it uses all AI features (dodging, sight, crouching, etc) and comes * in a myriad of variants. In Xatrix it's even more complex due to * another 4 variants added. * * ======================================================================= */ #include "../../header/local.h" #include "soldier.h" #include "soldierh.h" static int sound_idle; static int sound_sight1; static int sound_sight2; static int sound_pain_light; static int sound_pain; static int sound_pain_ss; static int sound_death_light; static int sound_death; static int sound_death_ss; static int sound_cock; static int sound_step; static int sound_step2; static int sound_step3; static int sound_step4; void soldier_stand(edict_t *self); void soldier_run(edict_t *self); void soldierh_stand(edict_t *self); void soldierh_run(edict_t *self); extern void brain_dabeam(edict_t *self); void soldier_footstep(edict_t *self) { if (!g_monsterfootsteps->value) return; // Lazy loading for savegame compatibility. if (sound_step == 0 || sound_step2 == 0 || sound_step3 == 0 || sound_step4 == 0) { sound_step = gi.soundindex("player/step1.wav"); sound_step2 = gi.soundindex("player/step2.wav"); sound_step3 = gi.soundindex("player/step3.wav"); sound_step4 = gi.soundindex("player/step4.wav"); } int i; i = randk() % 4; if (i == 0) { gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); } else if (i == 1) { gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); } else if (i == 2) { gi.sound(self, CHAN_BODY, sound_step3, 1, ATTN_NORM, 0); } else if (i == 3) { gi.sound(self, CHAN_BODY, sound_step4, 1, ATTN_NORM, 0); } } void soldier_idle(edict_t *self) { if (!self) { return; } if (random() > 0.8) { gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); } } void soldier_cock(edict_t *self) { if (!self) { return; } if (self->s.frame == FRAME_stand322) { gi.sound(self, CHAN_WEAPON, sound_cock, 1, ATTN_IDLE, 0); } else { gi.sound(self, CHAN_WEAPON, sound_cock, 1, ATTN_NORM, 0); } } static mframe_t soldier_frames_stand1[] = { {ai_stand, 0, soldier_idle}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t soldier_move_stand1 = { FRAME_stand101, FRAME_stand130, soldier_frames_stand1, soldier_stand }; static mframe_t soldier_frames_stand3[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, soldier_cock}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t soldier_move_stand3 = { FRAME_stand301, FRAME_stand339, soldier_frames_stand3, soldier_stand }; void soldier_stand(edict_t *self) { if (!self) { return; } if ((self->monsterinfo.currentmove == &soldier_move_stand3) || (random() < 0.8)) { self->monsterinfo.currentmove = &soldier_move_stand1; } else { self->monsterinfo.currentmove = &soldier_move_stand3; } } void soldier_walk1_random(edict_t *self) { if (!self) { return; } if (random() > 0.1) { self->monsterinfo.nextframe = FRAME_walk101; } } static mframe_t soldier_frames_walk1[] = { {ai_walk, 3, NULL}, {ai_walk, 6, NULL}, {ai_walk, 2, NULL}, {ai_walk, 2, soldier_footstep}, {ai_walk, 2, NULL}, {ai_walk, 1, NULL}, {ai_walk, 6, NULL}, {ai_walk, 5, NULL}, {ai_walk, 3, soldier_footstep}, {ai_walk, -1, soldier_walk1_random}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL} }; mmove_t soldier_move_walk1 = { FRAME_walk101, FRAME_walk133, soldier_frames_walk1, NULL }; static mframe_t soldier_frames_walk2[] = { {ai_walk, 4, soldier_footstep}, {ai_walk, 4, NULL}, {ai_walk, 9, NULL}, {ai_walk, 8, NULL}, {ai_walk, 5, soldier_footstep}, {ai_walk, 1, NULL}, {ai_walk, 3, NULL}, {ai_walk, 7, NULL}, {ai_walk, 6, NULL}, {ai_walk, 7, NULL} }; mmove_t soldier_move_walk2 = { FRAME_walk209, FRAME_walk218, soldier_frames_walk2, NULL }; void soldier_walk(edict_t *self) { if (!self) { return; } if (random() < 0.5) { self->monsterinfo.currentmove = &soldier_move_walk1; } else { self->monsterinfo.currentmove = &soldier_move_walk2; } } static mframe_t soldier_frames_start_run[] = { {ai_run, 7, NULL}, {ai_run, 5, NULL} }; mmove_t soldier_move_start_run = { FRAME_run01, FRAME_run02, soldier_frames_start_run, soldier_run }; static mframe_t soldier_frames_run[] = { {ai_run, 10, NULL}, {ai_run, 11, soldier_footstep}, {ai_run, 11, NULL}, {ai_run, 16, NULL}, {ai_run, 10, soldier_footstep}, {ai_run, 15, NULL} }; mmove_t soldier_move_run = { FRAME_run03, FRAME_run08, soldier_frames_run, NULL }; void soldier_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &soldier_move_stand1; return; } if ((self->monsterinfo.currentmove == &soldier_move_walk1) || (self->monsterinfo.currentmove == &soldier_move_walk2) || (self->monsterinfo.currentmove == &soldier_move_start_run)) { self->monsterinfo.currentmove = &soldier_move_run; } else { self->monsterinfo.currentmove = &soldier_move_start_run; } } static mframe_t soldier_frames_pain1[] = { {ai_move, -3, NULL}, {ai_move, 4, NULL}, {ai_move, 1, NULL}, {ai_move, 1, NULL}, {ai_move, 0, NULL} }; mmove_t soldier_move_pain1 = { FRAME_pain101, FRAME_pain105, soldier_frames_pain1, soldier_run }; static mframe_t soldier_frames_pain2[] = { {ai_move, -13, NULL}, {ai_move, -1, NULL}, {ai_move, 2, NULL}, {ai_move, 4, NULL}, {ai_move, 2, NULL}, {ai_move, 3, NULL}, {ai_move, 2, NULL} }; mmove_t soldier_move_pain2 = { FRAME_pain201, FRAME_pain207, soldier_frames_pain2, soldier_run }; static mframe_t soldier_frames_pain3[] = { {ai_move, -8, NULL}, {ai_move, 10, NULL}, {ai_move, -4, soldier_footstep}, {ai_move, -1, NULL}, {ai_move, -3, NULL}, {ai_move, 0, NULL}, {ai_move, 3, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 1, NULL}, {ai_move, 0, NULL}, {ai_move, 1, NULL}, {ai_move, 2, NULL}, {ai_move, 4, NULL}, {ai_move, 3, NULL}, {ai_move, 2, soldier_footstep} }; mmove_t soldier_move_pain3 = { FRAME_pain301, FRAME_pain318, soldier_frames_pain3, soldier_run }; static mframe_t soldier_frames_pain4[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -10, NULL}, {ai_move, -6, NULL}, {ai_move, 8, NULL}, {ai_move, 4, NULL}, {ai_move, 1, NULL}, {ai_move, 0, NULL}, {ai_move, 2, NULL}, {ai_move, 5, NULL}, {ai_move, 2, NULL}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, 3, NULL}, {ai_move, 2, NULL}, {ai_move, 0, NULL} }; mmove_t soldier_move_pain4 = { FRAME_pain401, FRAME_pain417, soldier_frames_pain4, soldier_run }; void soldier_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage /* unused */) { float r; int n; if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum |= 1; } if (level.time < self->pain_debounce_time) { if ((self->velocity[2] > 100) && ((self->monsterinfo.currentmove == &soldier_move_pain1) || (self->monsterinfo.currentmove == &soldier_move_pain2) || (self->monsterinfo.currentmove == &soldier_move_pain3))) { self->monsterinfo.currentmove = &soldier_move_pain4; } return; } self->pain_debounce_time = level.time + 3; n = self->s.skinnum | 1; if (n == 1) { gi.sound(self, CHAN_VOICE, sound_pain_light, 1, ATTN_NORM, 0); } else if (n == 3) { gi.sound(self, CHAN_VOICE, sound_pain, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_pain_ss, 1, ATTN_NORM, 0); } if (self->velocity[2] > 100) { self->monsterinfo.currentmove = &soldier_move_pain4; return; } if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } r = random(); if (r < 0.33) { self->monsterinfo.currentmove = &soldier_move_pain1; } else if (r < 0.66) { self->monsterinfo.currentmove = &soldier_move_pain2; } else { self->monsterinfo.currentmove = &soldier_move_pain3; } } static int blaster_flash[] = { MZ2_SOLDIER_BLASTER_1, MZ2_SOLDIER_BLASTER_2, MZ2_SOLDIER_BLASTER_3, MZ2_SOLDIER_BLASTER_4, MZ2_SOLDIER_BLASTER_5, MZ2_SOLDIER_BLASTER_6, MZ2_SOLDIER_BLASTER_7, MZ2_SOLDIER_BLASTER_8 }; static int shotgun_flash[] = { MZ2_SOLDIER_SHOTGUN_1, MZ2_SOLDIER_SHOTGUN_2, MZ2_SOLDIER_SHOTGUN_3, MZ2_SOLDIER_SHOTGUN_4, MZ2_SOLDIER_SHOTGUN_5, MZ2_SOLDIER_SHOTGUN_6, MZ2_SOLDIER_SHOTGUN_7, MZ2_SOLDIER_SHOTGUN_8 }; static int machinegun_flash[] = { MZ2_SOLDIER_MACHINEGUN_1, MZ2_SOLDIER_MACHINEGUN_2, MZ2_SOLDIER_MACHINEGUN_3, MZ2_SOLDIER_MACHINEGUN_4, MZ2_SOLDIER_MACHINEGUN_5, MZ2_SOLDIER_MACHINEGUN_6, MZ2_SOLDIER_MACHINEGUN_7, MZ2_SOLDIER_MACHINEGUN_8 }; void soldier_fire(edict_t *self, int flash_number) { vec3_t start; vec3_t forward, right, up; vec3_t aim; vec3_t dir; vec3_t end; float r, u; int flash_index; if (!self) { return; } if (self->s.skinnum < 2) { flash_index = blaster_flash[flash_number]; } else if (self->s.skinnum < 4) { flash_index = shotgun_flash[flash_number]; } else { flash_index = machinegun_flash[flash_number]; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_index], forward, right, start); if ((flash_number == 5) || (flash_number == 6)) { VectorCopy(forward, aim); } else { VectorCopy(self->enemy->s.origin, end); end[2] += self->enemy->viewheight; VectorSubtract(end, start, aim); vectoangles(aim, dir); AngleVectors(dir, forward, right, up); r = crandom() * 1000; u = crandom() * 500; VectorMA(start, 8192, forward, end); VectorMA(end, r, right, end); VectorMA(end, u, up, end); VectorSubtract(end, start, aim); VectorNormalize(aim); } if (self->s.skinnum <= 1) { monster_fire_blaster(self, start, aim, 5, 600, flash_index, EF_BLASTER); } else if (self->s.skinnum <= 3) { monster_fire_shotgun(self, start, aim, 2, 1, DEFAULT_SHOTGUN_HSPREAD, DEFAULT_SHOTGUN_VSPREAD, DEFAULT_SHOTGUN_COUNT, flash_index); } else { if (!(self->monsterinfo.aiflags & AI_HOLD_FRAME)) { self->monsterinfo.pausetime = level.time + (3 + rand() % 8) * FRAMETIME; } monster_fire_bullet(self, start, aim, 2, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_index); if (level.time >= self->monsterinfo.pausetime) { self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; } else { self->monsterinfo.aiflags |= AI_HOLD_FRAME; } } } void soldier_fire1(edict_t *self) { if (!self) { return; } soldier_fire(self, 0); } void soldier_attack1_refire1(edict_t *self) { if (!self) { return; } if (self->s.skinnum > 1) { return; } if (self->enemy->health <= 0) { return; } if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak102; } else { self->monsterinfo.nextframe = FRAME_attak110; } } void soldier_attack1_refire2(edict_t *self) { if (!self) { return; } if (self->s.skinnum < 2) { return; } if (self->enemy->health <= 0) { return; } if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak102; } } static mframe_t soldier_frames_attack1[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldier_fire1}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldier_attack1_refire1}, {ai_charge, 0, NULL}, {ai_charge, 0, soldier_cock}, {ai_charge, 0, soldier_attack1_refire2}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t soldier_move_attack1 = { FRAME_attak101, FRAME_attak112, soldier_frames_attack1, soldier_run }; void soldier_fire2(edict_t *self) { if (!self) { return; } soldier_fire(self, 1); } void soldier_attack2_refire1(edict_t *self) { if (!self) { return; } if (!self->enemy) { return; } if (self->s.skinnum > 1) { return; } if (self->enemy->health <= 0) { return; } if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak204; } else { self->monsterinfo.nextframe = FRAME_attak216; } } void soldier_attack2_refire2(edict_t *self) { if (!self) { return; } if (!self->enemy) { return; } if (self->s.skinnum < 2) { return; } if (self->enemy->health <= 0) { return; } if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak204; } } static mframe_t soldier_frames_attack2[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldier_fire2}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldier_attack2_refire1}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldier_cock}, {ai_charge, 0, NULL}, {ai_charge, 0, soldier_attack2_refire2}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t soldier_move_attack2 = { FRAME_attak201, FRAME_attak218, soldier_frames_attack2, soldier_run }; void soldier_duck_down(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_DUCKED) { return; } self->monsterinfo.aiflags |= AI_DUCKED; self->maxs[2] -= 32; self->takedamage = DAMAGE_YES; self->monsterinfo.pausetime = level.time + 1; gi.linkentity(self); } void soldier_duck_up(edict_t *self) { if (!self) { return; } self->monsterinfo.aiflags &= ~AI_DUCKED; self->maxs[2] += 32; self->takedamage = DAMAGE_AIM; gi.linkentity(self); } void soldier_fire3(edict_t *self) { if (!self) { return; } soldier_duck_down(self); soldier_fire(self, 2); } void soldier_attack3_refire(edict_t *self) { if (!self) { return; } if ((level.time + 0.4) < self->monsterinfo.pausetime) { self->monsterinfo.nextframe = FRAME_attak303; } } static mframe_t soldier_frames_attack3[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldier_fire3}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldier_attack3_refire}, {ai_charge, 0, soldier_duck_up}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t soldier_move_attack3 = { FRAME_attak301, FRAME_attak309, soldier_frames_attack3, soldier_run }; void soldier_fire4(edict_t *self) { if (!self) { return; } soldier_fire(self, 3); } static mframe_t soldier_frames_attack4[] = { {ai_charge, 0, NULL}, {ai_charge, 0, soldier_footstep}, {ai_charge, 0, soldier_fire4}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldier_footstep} }; mmove_t soldier_move_attack4 = { FRAME_attak401, FRAME_attak406, soldier_frames_attack4, soldier_run }; void soldier_fire8(edict_t *self) { if (!self) { return; } soldier_fire(self, 7); } void soldier_attack6_refire(edict_t *self) { if (!self) { return; } if (self->enemy->health <= 0) { return; } if (range(self, self->enemy) < RANGE_MID) { return; } if (skill->value == SKILL_HARDPLUS) { self->monsterinfo.nextframe = FRAME_runs03; } } static mframe_t soldier_frames_attack6[] = { {ai_charge, 10, NULL}, {ai_charge, 4, NULL}, {ai_charge, 12, soldier_footstep}, {ai_charge, 11, soldier_fire8}, {ai_charge, 13, NULL}, {ai_charge, 18, NULL}, {ai_charge, 15, soldier_footstep}, {ai_charge, 14, NULL}, {ai_charge, 11, NULL}, {ai_charge, 8, soldier_footstep}, {ai_charge, 11, NULL}, {ai_charge, 12, NULL}, {ai_charge, 12, soldier_footstep}, {ai_charge, 17, soldier_attack6_refire} }; mmove_t soldier_move_attack6 = { FRAME_runs01, FRAME_runs14, soldier_frames_attack6, soldier_run }; void soldier_attack(edict_t *self) { if (!self) { return; } if (self->s.skinnum < 4) { if (random() < 0.5) { self->monsterinfo.currentmove = &soldier_move_attack1; } else { self->monsterinfo.currentmove = &soldier_move_attack2; } } else { self->monsterinfo.currentmove = &soldier_move_attack4; } } void soldier_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } if (random() < 0.5) { gi.sound(self, CHAN_VOICE, sound_sight1, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_sight2, 1, ATTN_NORM, 0); } if ((skill->value > SKILL_EASY) && (range(self, self->enemy) >= RANGE_MID)) { if (random() > 0.5) { self->monsterinfo.currentmove = &soldier_move_attack6; } } } void soldier_duck_hold(edict_t *self) { if (!self) { return; } if (level.time >= self->monsterinfo.pausetime) { self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; } else { self->monsterinfo.aiflags |= AI_HOLD_FRAME; } } static mframe_t soldier_frames_duck[] = { {ai_move, 5, soldier_duck_down}, {ai_move, -1, soldier_duck_hold}, {ai_move, 1, NULL}, {ai_move, 0, soldier_duck_up}, {ai_move, 5, NULL} }; mmove_t soldier_move_duck = { FRAME_duck01, FRAME_duck05, soldier_frames_duck, soldier_run }; void soldier_dodge(edict_t *self, edict_t *attacker, float eta) { float r; if (!self || !attacker) { return; } r = random(); if (r > 0.25) { return; } if (!self->enemy) { self->enemy = attacker; FoundTarget(self); } if (skill->value == SKILL_EASY) { self->monsterinfo.currentmove = &soldier_move_duck; return; } self->monsterinfo.pausetime = level.time + eta + 0.3; r = random(); if (skill->value == SKILL_MEDIUM) { if (r > 0.33) { self->monsterinfo.currentmove = &soldier_move_duck; } else { self->monsterinfo.currentmove = &soldier_move_attack3; } return; } if (skill->value >= SKILL_HARD) { if (r > 0.66) { self->monsterinfo.currentmove = &soldier_move_duck; } else { self->monsterinfo.currentmove = &soldier_move_attack3; } return; } self->monsterinfo.currentmove = &soldier_move_attack3; } void soldier_fire6(edict_t *self) { if (!self) { return; } soldier_fire(self, 5); } void soldier_fire7(edict_t *self) { if (!self) { return; } soldier_fire(self, 6); } void soldier_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, -8); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } static mframe_t soldier_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, -10, NULL}, {ai_move, -10, NULL}, {ai_move, -10, NULL}, {ai_move, -5, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, soldier_fire6}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, soldier_fire7}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t soldier_move_death1 = { FRAME_death101, FRAME_death136, soldier_frames_death1, soldier_dead }; static mframe_t soldier_frames_death2[] = { {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t soldier_move_death2 = { FRAME_death201, FRAME_death235, soldier_frames_death2, soldier_dead }; static mframe_t soldier_frames_death3[] = { {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, }; mmove_t soldier_move_death3 = { FRAME_death301, FRAME_death345, soldier_frames_death3, soldier_dead }; static mframe_t soldier_frames_death4[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t soldier_move_death4 = { FRAME_death401, FRAME_death453, soldier_frames_death4, soldier_dead }; static mframe_t soldier_frames_death5[] = { {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t soldier_move_death5 = { FRAME_death501, FRAME_death524, soldier_frames_death5, soldier_dead }; static mframe_t soldier_frames_death6[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t soldier_move_death6 = { FRAME_death601, FRAME_death610, soldier_frames_death6, soldier_dead }; void soldier_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point /* unused */) { int n; if (!self) { return; } /* check for gib */ if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 3; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowGib(self, "models/objects/gibs/chest/tris.md2", damage, GIB_ORGANIC); ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } /* regular death */ self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; self->s.skinnum |= 1; if (self->s.skinnum == 1) { gi.sound(self, CHAN_VOICE, sound_death_light, 1, ATTN_NORM, 0); } else if (self->s.skinnum == 3) { gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_death_ss, 1, ATTN_NORM, 0); } if (fabs((self->s.origin[2] + self->viewheight) - point[2]) <= 4) { /* head shot */ self->monsterinfo.currentmove = &soldier_move_death3; return; } n = rand() % 5; if (n == 0) { self->monsterinfo.currentmove = &soldier_move_death1; } else if (n == 1) { self->monsterinfo.currentmove = &soldier_move_death2; } else if (n == 2) { self->monsterinfo.currentmove = &soldier_move_death4; } else if (n == 3) { self->monsterinfo.currentmove = &soldier_move_death5; } else { self->monsterinfo.currentmove = &soldier_move_death6; } } void SP_monster_soldier_x(edict_t *self) { if (!self) { return; } // Force recaching at next footstep to ensure // that the sound indices are correct. sound_step = 0; sound_step2 = 0; sound_step3 = 0; sound_step4 = 0; self->s.modelindex = gi.modelindex("models/monsters/soldier/tris.md2"); self->monsterinfo.scale = MODEL_SCALE; VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, 32); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; sound_idle = gi.soundindex("soldier/solidle1.wav"); sound_sight1 = gi.soundindex("soldier/solsght1.wav"); sound_sight2 = gi.soundindex("soldier/solsrch1.wav"); sound_cock = gi.soundindex("infantry/infatck3.wav"); self->mass = 100; self->pain = soldier_pain; self->die = soldier_die; self->monsterinfo.stand = soldier_stand; self->monsterinfo.walk = soldier_walk; self->monsterinfo.run = soldier_run; self->monsterinfo.dodge = soldier_dodge; self->monsterinfo.attack = soldier_attack; self->monsterinfo.melee = NULL; self->monsterinfo.sight = soldier_sight; gi.linkentity(self); self->monsterinfo.stand(self); walkmonster_start(self); } /* * QUAKED monster_soldier_light (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_soldier_light(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } self->health = 20; self->gib_health = -30; SP_monster_soldier_x(self); sound_pain_light = gi.soundindex("soldier/solpain2.wav"); sound_death_light = gi.soundindex("soldier/soldeth2.wav"); sound_step = gi.soundindex("player/step1.wav"); sound_step2 = gi.soundindex("player/step2.wav"); sound_step3 = gi.soundindex("player/step3.wav"); sound_step4 = gi.soundindex("player/step4.wav"); gi.modelindex("models/objects/laser/tris.md2"); gi.soundindex("misc/lasfly.wav"); gi.soundindex("soldier/solatck2.wav"); self->s.skinnum = 0; } /* * QUAKED monster_soldier (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_soldier(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } self->health = 30; self->gib_health = -30; SP_monster_soldier_x(self); sound_pain = gi.soundindex("soldier/solpain1.wav"); sound_death = gi.soundindex("soldier/soldeth1.wav"); sound_step = gi.soundindex("player/step1.wav"); sound_step2 = gi.soundindex("player/step2.wav"); sound_step3 = gi.soundindex("player/step3.wav"); sound_step4 = gi.soundindex("player/step4.wav"); gi.soundindex("soldier/solatck1.wav"); self->s.skinnum = 2; } /* * QUAKED monster_soldier_ss (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_soldier_ss(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } self->health = 40; self->gib_health = -30; SP_monster_soldier_x(self); sound_pain_ss = gi.soundindex("soldier/solpain3.wav"); sound_death_ss = gi.soundindex("soldier/soldeth3.wav"); sound_step = gi.soundindex("player/step1.wav"); sound_step2 = gi.soundindex("player/step2.wav"); sound_step3 = gi.soundindex("player/step3.wav"); sound_step4 = gi.soundindex("player/step4.wav"); gi.soundindex("soldier/solatck3.wav"); self->s.skinnum = 4; } void soldierh_idle(edict_t *self) { if (!self) { return; } if (random() > 0.8) { gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); } } void soldierh_cock(edict_t *self) { if (!self) { return; } if (self->s.frame == FRAME_stand322) { gi.sound(self, CHAN_WEAPON, sound_cock, 1, ATTN_IDLE, 0); } else { gi.sound(self, CHAN_WEAPON, sound_cock, 1, ATTN_NORM, 0); } } static mframe_t soldierh_frames_stand1[] = { {ai_stand, 0, soldierh_idle}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t soldierh_move_stand1 = { FRAME_stand101, FRAME_stand130, soldierh_frames_stand1, soldierh_stand }; static mframe_t soldierh_frames_stand3[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, soldierh_cock}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t soldierh_move_stand3 = { FRAME_stand301, FRAME_stand339, soldierh_frames_stand3, soldierh_stand }; void soldierh_stand(edict_t *self) { if (!self) { return; } if ((self->monsterinfo.currentmove == &soldierh_move_stand3) || (random() < 0.8)) { self->monsterinfo.currentmove = &soldierh_move_stand1; } else { self->monsterinfo.currentmove = &soldierh_move_stand3; } } void soldierh_walk1_random(edict_t *self) { if (!self) { return; } if (random() > 0.1) { self->monsterinfo.nextframe = FRAME_walk101; } } static mframe_t soldierh_frames_walk1[] = { {ai_walk, 3, NULL}, {ai_walk, 6, NULL}, {ai_walk, 2, NULL}, {ai_walk, 2, NULL}, {ai_walk, 2, NULL}, {ai_walk, 1, NULL}, {ai_walk, 6, NULL}, {ai_walk, 5, NULL}, {ai_walk, 3, NULL}, {ai_walk, -1, soldierh_walk1_random}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL} }; mmove_t soldierh_move_walk1 = { FRAME_walk101, FRAME_walk133, soldierh_frames_walk1, NULL }; static mframe_t soldierh_frames_walk2[] = { {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 9, NULL}, {ai_walk, 8, NULL}, {ai_walk, 5, NULL}, {ai_walk, 1, NULL}, {ai_walk, 3, NULL}, {ai_walk, 7, NULL}, {ai_walk, 6, NULL}, {ai_walk, 7, NULL} }; mmove_t soldierh_move_walk2 = { FRAME_walk209, FRAME_walk218, soldierh_frames_walk2, NULL }; void soldierh_walk(edict_t *self) { if (!self) { return; } if (random() < 0.5) { self->monsterinfo.currentmove = &soldierh_move_walk1; } else { self->monsterinfo.currentmove = &soldierh_move_walk2; } } static mframe_t soldierh_frames_start_run[] = { {ai_run, 7, NULL}, {ai_run, 5, NULL} }; mmove_t soldierh_move_start_run = { FRAME_run01, FRAME_run02, soldierh_frames_start_run, soldierh_run }; static mframe_t soldierh_frames_run[] = { {ai_run, 10, NULL}, {ai_run, 11, NULL}, {ai_run, 11, NULL}, {ai_run, 16, NULL}, {ai_run, 10, NULL}, {ai_run, 15, NULL} }; mmove_t soldierh_move_run = { FRAME_run03, FRAME_run08, soldierh_frames_run, NULL }; void soldierh_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &soldierh_move_stand1; return; } if ((self->monsterinfo.currentmove == &soldierh_move_walk1) || (self->monsterinfo.currentmove == &soldierh_move_walk2) || (self->monsterinfo.currentmove == &soldierh_move_start_run)) { self->monsterinfo.currentmove = &soldierh_move_run; } else { self->monsterinfo.currentmove = &soldierh_move_start_run; } } static mframe_t soldierh_frames_pain1[] = { {ai_move, -3, NULL}, {ai_move, 4, NULL}, {ai_move, 1, NULL}, {ai_move, 1, NULL}, {ai_move, 0, NULL} }; mmove_t soldierh_move_pain1 = { FRAME_pain101, FRAME_pain105, soldierh_frames_pain1, soldierh_run }; static mframe_t soldierh_frames_pain2[] = { {ai_move, -13, NULL}, {ai_move, -1, NULL}, {ai_move, 2, NULL}, {ai_move, 4, NULL}, {ai_move, 2, NULL}, {ai_move, 3, NULL}, {ai_move, 2, NULL} }; mmove_t soldierh_move_pain2 = { FRAME_pain201, FRAME_pain207, soldierh_frames_pain2, soldierh_run }; static mframe_t soldierh_frames_pain3[] = { {ai_move, -8, NULL}, {ai_move, 10, NULL}, {ai_move, -4, NULL}, {ai_move, -1, NULL}, {ai_move, -3, NULL}, {ai_move, 0, NULL}, {ai_move, 3, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 1, NULL}, {ai_move, 0, NULL}, {ai_move, 1, NULL}, {ai_move, 2, NULL}, {ai_move, 4, NULL}, {ai_move, 3, NULL}, {ai_move, 2, NULL} }; mmove_t soldierh_move_pain3 = { FRAME_pain301, FRAME_pain318, soldierh_frames_pain3, soldierh_run }; static mframe_t soldierh_frames_pain4[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -10, NULL}, {ai_move, -6, NULL}, {ai_move, 8, NULL}, {ai_move, 4, NULL}, {ai_move, 1, NULL}, {ai_move, 0, NULL}, {ai_move, 2, NULL}, {ai_move, 5, NULL}, {ai_move, 2, NULL}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, 3, NULL}, {ai_move, 2, NULL}, {ai_move, 0, NULL} }; mmove_t soldierh_move_pain4 = { FRAME_pain401, FRAME_pain417, soldierh_frames_pain4, soldierh_run }; void soldierh_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage /* unused */) { float r; int n; if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum |= 1; } if (level.time < self->pain_debounce_time) { if ((self->velocity[2] > 100) && ((self->monsterinfo.currentmove == &soldierh_move_pain1) || (self->monsterinfo.currentmove == &soldierh_move_pain2) || (self->monsterinfo.currentmove == &soldierh_move_pain3))) { self->monsterinfo.currentmove = &soldierh_move_pain4; } return; } self->pain_debounce_time = level.time + 3; n = self->s.skinnum | 1; if (n == 1) { gi.sound(self, CHAN_VOICE, sound_pain_light, 1, ATTN_NORM, 0); } else if (n == 3) { gi.sound(self, CHAN_VOICE, sound_pain, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_pain_ss, 1, ATTN_NORM, 0); } if (self->velocity[2] > 100) { self->monsterinfo.currentmove = &soldierh_move_pain4; return; } if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } r = random(); if (r < 0.33) { self->monsterinfo.currentmove = &soldierh_move_pain1; } else if (r < 0.66) { self->monsterinfo.currentmove = &soldierh_move_pain2; } else { self->monsterinfo.currentmove = &soldierh_move_pain3; } } void soldierh_laserbeam(edict_t *self, int flash_index) { vec3_t forward, right, up; vec3_t tempang, start; vec3_t dir, angles, end; vec3_t tempvec; edict_t *ent; if (!self) { return; } if (random() > 0.8) { gi.sound(self, CHAN_AUTO, gi.soundindex("misc/lasfly.wav"), 1, ATTN_STATIC, 0); } VectorCopy(self->s.origin, start); VectorCopy(self->enemy->s.origin, end); VectorSubtract(end, start, dir); vectoangles(dir, angles); VectorCopy(monster_flash_offset[flash_index], tempvec); ent = G_Spawn(); VectorCopy(self->s.origin, ent->s.origin); VectorCopy(angles, tempang); AngleVectors(tempang, forward, right, up); VectorCopy(tempang, ent->s.angles); VectorCopy(ent->s.origin, start); if (flash_index == 85) { VectorMA(start, tempvec[0] - 14, right, start); VectorMA(start, tempvec[2] + 8, up, start); VectorMA(start, tempvec[1], forward, start); } else { VectorMA(start, tempvec[0] + 2, right, start); VectorMA(start, tempvec[2] + 8, up, start); VectorMA(start, tempvec[1], forward, start); } VectorCopy(start, ent->s.origin); ent->enemy = self->enemy; ent->owner = self; ent->dmg = 1; monster_dabeam(ent); } void soldierh_fire(edict_t *self, int flash_number) { vec3_t start; vec3_t forward, right, up; vec3_t aim; vec3_t dir; vec3_t end; float r, u; int flash_index; if (!self) { return; } if (self->s.skinnum < 2) { flash_index = blaster_flash[flash_number]; /* ripper */ } else if (self->s.skinnum < 4) { flash_index = blaster_flash[flash_number]; /* hyperblaster */ } else { flash_index = machinegun_flash[flash_number]; /* laserbeam */ } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_index], forward, right, start); if ((flash_number == 5) || (flash_number == 6)) { VectorCopy(forward, aim); } else { VectorCopy(self->enemy->s.origin, end); end[2] += self->enemy->viewheight; VectorSubtract(end, start, aim); vectoangles(aim, dir); AngleVectors(dir, forward, right, up); r = crandom() * 100; u = crandom() * 50; VectorMA(start, 8192, forward, end); VectorMA(end, r, right, end); VectorMA(end, u, up, end); VectorSubtract(end, start, aim); VectorNormalize(aim); } if (self->s.skinnum <= 1) { monster_fire_ionripper(self, start, aim, 5, 600, flash_index, EF_IONRIPPER); } else if (self->s.skinnum <= 3) { monster_fire_blueblaster(self, start, aim, 1, 600, MZ_BLUEHYPERBLASTER, EF_BLUEHYPERBLASTER); } else { if (!(self->monsterinfo.aiflags & AI_HOLD_FRAME)) { self->monsterinfo.pausetime = level.time + (3 + rand() % 8) * FRAMETIME; } soldierh_laserbeam(self, flash_index); if (level.time >= self->monsterinfo.pausetime) { self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; } else { self->monsterinfo.aiflags |= AI_HOLD_FRAME; } } } void soldierh_hyper_refire1(edict_t *self) { if (!self) { return; } if (self->s.skinnum < 2) { return; } else if (self->s.skinnum < 4) { if (random() < 0.7) { self->s.frame = FRAME_attak103; } else { gi.sound(self, CHAN_AUTO, gi.soundindex("weapons/hyprbd1a.wav"), 1, ATTN_NORM, 0); } } } void soldierh_ripper1(edict_t *self) { if (!self) { return; } if (self->s.skinnum < 2) { soldierh_fire(self, 0); } else if (self->s.skinnum < 4) { soldierh_fire(self, 0); } } void soldierh_fire1(edict_t *self) { if (!self) { return; } soldierh_fire(self, 0); } void soldierh_attack1_refire1(edict_t *self) { if (!self) { return; } if (self->s.skinnum > 1) { return; } if (self->enemy->health <= 0) { return; } if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak102; } else { self->monsterinfo.nextframe = FRAME_attak110; } } void soldierh_attack1_refire2(edict_t *self) { if (!self) { return; } if (self->s.skinnum < 2) { return; } if (self->enemy->health <= 0) { return; } if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak102; } } void soldierh_hyper_sound(edict_t *self) { if (!self) { return; } if (self->s.skinnum < 2) { return; } else if (self->s.skinnum < 4) { gi.sound(self, CHAN_AUTO, gi.soundindex("weapons/hyprbl1a.wav"), 1, ATTN_NORM, 0); } else { return; } } static mframe_t soldierh_frames_attack1[] = { {ai_charge, 0, NULL}, {ai_charge, 0, soldierh_hyper_sound}, {ai_charge, 0, soldierh_fire1}, {ai_charge, 0, soldierh_ripper1}, {ai_charge, 0, soldierh_ripper1}, {ai_charge, 0, soldierh_attack1_refire1}, {ai_charge, 0, soldierh_hyper_refire1}, {ai_charge, 0, soldierh_cock}, {ai_charge, 0, soldierh_attack1_refire2}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t soldierh_move_attack1 = { FRAME_attak101, FRAME_attak112, soldierh_frames_attack1, soldierh_run }; void soldierh_hyper_refire2(edict_t *self) { if (!self) { return; } if (self->s.skinnum < 2) { return; } else if (self->s.skinnum < 4) { if (random() < 0.7) { self->s.frame = FRAME_attak205; } else { gi.sound(self, CHAN_AUTO, gi.soundindex("weapons/hyprbd1a.wav"), 1, ATTN_NORM, 0); } } } void soldierh_ripper2(edict_t *self) { if (!self) { return; } if (self->s.skinnum < 2) { soldierh_fire(self, 1); } else if (self->s.skinnum < 4) { soldierh_fire(self, 1); } } void soldierh_fire2(edict_t *self) { if (!self) { return; } soldierh_fire(self, 1); } void soldierh_attack2_refire1(edict_t *self) { if (!self) { return; } if (self->s.skinnum > 1) { return; } if (self->enemy->health <= 0) { return; } if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak204; } else { self->monsterinfo.nextframe = FRAME_attak216; } } void soldierh_attack2_refire2(edict_t *self) { if (!self) { return; } if (self->s.skinnum < 2) { return; } if (self->enemy->health <= 0) { return; } if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || ((range(self, self->enemy) == RANGE_MELEE) && (self->s.skinnum < 4))) { self->monsterinfo.nextframe = FRAME_attak204; } } static mframe_t soldierh_frames_attack2[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldierh_hyper_sound}, {ai_charge, 0, soldierh_fire2}, {ai_charge, 0, soldierh_ripper2}, {ai_charge, 0, soldierh_ripper2}, {ai_charge, 0, soldierh_attack2_refire1}, {ai_charge, 0, soldierh_hyper_refire2}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldierh_cock}, {ai_charge, 0, NULL}, {ai_charge, 0, soldierh_attack2_refire2}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t soldierh_move_attack2 = { FRAME_attak201, FRAME_attak218, soldierh_frames_attack2, soldierh_run }; void soldierh_duck_down(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_DUCKED) { return; } self->monsterinfo.aiflags |= AI_DUCKED; self->maxs[2] -= 32; self->takedamage = DAMAGE_YES; self->monsterinfo.pausetime = level.time + 1; gi.linkentity(self); } void soldierh_duck_up(edict_t *self) { if (!self) { return; } self->monsterinfo.aiflags &= ~AI_DUCKED; self->maxs[2] += 32; self->takedamage = DAMAGE_AIM; gi.linkentity(self); } void soldierh_fire3(edict_t *self) { if (!self) { return; } soldierh_duck_down(self); soldierh_fire(self, 2); } void soldierh_attack3_refire(edict_t *self) { if (!self) { return; } if ((level.time + 0.4) < self->monsterinfo.pausetime) { self->monsterinfo.nextframe = FRAME_attak303; } } static mframe_t soldierh_frames_attack3[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldierh_fire3}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldierh_attack3_refire}, {ai_charge, 0, soldierh_duck_up}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t soldierh_move_attack3 = { FRAME_attak301, FRAME_attak309, soldierh_frames_attack3, soldierh_run }; void soldierh_fire4(edict_t *self) { if (!self) { return; } soldierh_fire(self, 3); } static mframe_t soldierh_frames_attack4[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldierh_fire4}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t soldierh_move_attack4 = { FRAME_attak401, FRAME_attak406, soldierh_frames_attack4, soldierh_run }; void soldierh_fire8(edict_t *self) { if (!self) { return; } soldierh_fire(self, 7); } void soldierh_attack6_refire(edict_t *self) { if (!self) { return; } if (self->enemy->health <= 0) { return; } if (range(self, self->enemy) < RANGE_MID) { return; } if (skill->value == SKILL_HARDPLUS) { self->monsterinfo.nextframe = FRAME_runs03; } } static mframe_t soldierh_frames_attack6[] = { {ai_charge, 10, NULL}, {ai_charge, 4, NULL}, {ai_charge, 12, NULL}, {ai_charge, 11, soldierh_fire8}, {ai_charge, 13, NULL}, {ai_charge, 18, NULL}, {ai_charge, 15, NULL}, {ai_charge, 14, NULL}, {ai_charge, 11, NULL}, {ai_charge, 8, NULL}, {ai_charge, 11, NULL}, {ai_charge, 12, NULL}, {ai_charge, 12, NULL}, {ai_charge, 17, soldierh_attack6_refire} }; mmove_t soldierh_move_attack6 = { FRAME_runs01, FRAME_runs14, soldierh_frames_attack6, soldierh_run }; void soldierh_attack(edict_t *self) { if (!self) { return; } if (self->s.skinnum < 4) { if (random() < 0.5) { self->monsterinfo.currentmove = &soldierh_move_attack1; } else { self->monsterinfo.currentmove = &soldierh_move_attack2; } } else { self->monsterinfo.currentmove = &soldierh_move_attack4; } } void soldierh_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } if (random() < 0.5) { gi.sound(self, CHAN_VOICE, sound_sight1, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_sight2, 1, ATTN_NORM, 0); } if ((skill->value > SKILL_EASY) && (range(self, self->enemy) >= RANGE_MID)) { if (random() > 0.5) { if (self->s.skinnum < 4) { self->monsterinfo.currentmove = &soldierh_move_attack6; } else { self->monsterinfo.currentmove = &soldierh_move_attack4; } } } } void soldierh_duck_hold(edict_t *self) { if (!self) { return; } if (level.time >= self->monsterinfo.pausetime) { self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; } else { self->monsterinfo.aiflags |= AI_HOLD_FRAME; } } static mframe_t soldierh_frames_duck[] = { {ai_move, 5, soldierh_duck_down}, {ai_move, -1, soldierh_duck_hold}, {ai_move, 1, NULL}, {ai_move, 0, soldierh_duck_up}, {ai_move, 5, NULL} }; mmove_t soldierh_move_duck = { FRAME_duck01, FRAME_duck05, soldierh_frames_duck, soldierh_run }; void soldierh_dodge(edict_t *self, edict_t *attacker, float eta) { float r; if (!self || !attacker) { return; } r = random(); if (r > 0.25) { return; } if (!self->enemy) { self->enemy = attacker; } if (skill->value == SKILL_EASY) { self->monsterinfo.currentmove = &soldierh_move_duck; return; } self->monsterinfo.pausetime = level.time + eta + 0.3; r = random(); if (skill->value == SKILL_MEDIUM) { if (r > 0.33) { self->monsterinfo.currentmove = &soldierh_move_duck; } else { self->monsterinfo.currentmove = &soldierh_move_attack3; } return; } if (skill->value >= SKILL_HARD) { if (r > 0.66) { self->monsterinfo.currentmove = &soldierh_move_duck; } else { self->monsterinfo.currentmove = &soldierh_move_attack3; } return; } self->monsterinfo.currentmove = &soldierh_move_attack3; } void soldierh_fire6(edict_t *self) { if (!self) { return; } /* no fire laser */ if (self->s.skinnum < 4) { soldierh_fire(self, 5); } } void soldierh_fire7(edict_t *self) { if (!self) { return; } /* no fire laser */ if (self->s.skinnum < 4) { soldierh_fire(self, 6); } } void soldierh_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, -8); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } static mframe_t soldierh_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, -10, NULL}, {ai_move, -10, NULL}, {ai_move, -10, NULL}, {ai_move, -5, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, soldierh_fire6}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, soldierh_fire7}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t soldierh_move_death1 = { FRAME_death101, FRAME_death136, soldierh_frames_death1, soldierh_dead }; static mframe_t soldierh_frames_death2[] = { {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t soldierh_move_death2 = { FRAME_death201, FRAME_death235, soldierh_frames_death2, soldierh_dead }; static mframe_t soldierh_frames_death3[] = { {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, }; mmove_t soldierh_move_death3 = { FRAME_death301, FRAME_death345, soldierh_frames_death3, soldierh_dead }; static mframe_t soldierh_frames_death4[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t soldierh_move_death4 = { FRAME_death401, FRAME_death453, soldierh_frames_death4, soldierh_dead }; static mframe_t soldierh_frames_death5[] = { {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t soldierh_move_death5 = { FRAME_death501, FRAME_death524, soldierh_frames_death5, soldierh_dead }; static mframe_t soldierh_frames_death6[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t soldierh_move_death6 = { FRAME_death601, FRAME_death610, soldierh_frames_death6, soldierh_dead }; void soldierh_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point) { int n; if (!self) { return; } /* check for gib */ if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 3; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowGib(self, "models/objects/gibs/chest/tris.md2", damage, GIB_ORGANIC); ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } /* regular death */ self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; self->s.skinnum |= 1; if (self->s.skinnum == 1) { gi.sound(self, CHAN_VOICE, sound_death_light, 1, ATTN_NORM, 0); } else if (self->s.skinnum == 3) { gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_death_ss, 1, ATTN_NORM, 0); } if (fabs((self->s.origin[2] + self->viewheight) - point[2]) <= 4) { /* head shot */ self->monsterinfo.currentmove = &soldierh_move_death3; return; } n = (self->s.skinnum < 4) ? (rand() % 5) : (1 + (rand() % 4)); if (n == 0) { self->monsterinfo.currentmove = &soldierh_move_death1; } else if (n == 1) { self->monsterinfo.currentmove = &soldierh_move_death2; } else if (n == 2) { self->monsterinfo.currentmove = &soldierh_move_death4; } else if (n == 3) { self->monsterinfo.currentmove = &soldierh_move_death5; } else { self->monsterinfo.currentmove = &soldierh_move_death6; } } void SP_monster_soldier_h(edict_t *self) { if (!self) { return; } // Force recaching at next footstep to ensure // that the sound indices are correct. sound_step = 0; sound_step2 = 0; sound_step3 = 0; sound_step4 = 0; self->s.modelindex = gi.modelindex("models/monsters/soldierh/tris.md2"); self->monsterinfo.scale = MODEL_SCALE; VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, 32); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; sound_idle = gi.soundindex("soldier/solidle1.wav"); sound_sight1 = gi.soundindex("soldier/solsght1.wav"); sound_sight2 = gi.soundindex("soldier/solsrch1.wav"); sound_cock = gi.soundindex("infantry/infatck3.wav"); self->mass = 100; self->pain = soldierh_pain; self->die = soldierh_die; self->monsterinfo.stand = soldierh_stand; self->monsterinfo.walk = soldierh_walk; self->monsterinfo.run = soldierh_run; self->monsterinfo.dodge = soldierh_dodge; self->monsterinfo.attack = soldierh_attack; self->monsterinfo.melee = NULL; self->monsterinfo.sight = soldierh_sight; gi.linkentity(self); /* self->monsterinfo.stand (self); */ self->monsterinfo.currentmove = &soldierh_move_stand3; walkmonster_start(self); } /* * QUAKED monster_soldier_ripper (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_soldier_ripper(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } self->health = 50; self->gib_health = -30; SP_monster_soldier_h(self); sound_pain_light = gi.soundindex("soldier/solpain2.wav"); sound_death_light = gi.soundindex("soldier/soldeth2.wav"); gi.modelindex("models/objects/boomrang/tris.md2"); gi.soundindex("misc/lasfly.wav"); gi.soundindex("soldier/solatck2.wav"); self->s.skinnum = 0; } /* * QUAKED monster_soldier_hypergun (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_soldier_hypergun(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } self->health = 60; self->gib_health = -30; SP_monster_soldier_h(self); gi.modelindex("models/objects/blaser/tris.md2"); sound_pain = gi.soundindex("soldier/solpain1.wav"); sound_death = gi.soundindex("soldier/soldeth1.wav"); gi.soundindex("soldier/solatck1.wav"); self->s.skinnum = 2; } /* * QUAKED monster_soldier_lasergun (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ void SP_monster_soldier_lasergun(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } self->health = 70; self->gib_health = -30; SP_monster_soldier_h(self); sound_pain_ss = gi.soundindex("soldier/solpain3.wav"); sound_death_ss = gi.soundindex("soldier/soldeth3.wav"); gi.soundindex("soldier/solatck3.wav"); self->s.skinnum = 4; } xatrix-XATRIX_2_14/src/monster/soldier/soldier.h000066400000000000000000000306551477320050300217020ustar00rootroot00000000000000/* ======================================================================= * * Soldier aka "Guard" animations. * * ======================================================================= */ #define FRAME_attak101 0 #define FRAME_attak102 1 #define FRAME_attak103 2 #define FRAME_attak104 3 #define FRAME_attak105 4 #define FRAME_attak106 5 #define FRAME_attak107 6 #define FRAME_attak108 7 #define FRAME_attak109 8 #define FRAME_attak110 9 #define FRAME_attak111 10 #define FRAME_attak112 11 #define FRAME_attak201 12 #define FRAME_attak202 13 #define FRAME_attak203 14 #define FRAME_attak204 15 #define FRAME_attak205 16 #define FRAME_attak206 17 #define FRAME_attak207 18 #define FRAME_attak208 19 #define FRAME_attak209 20 #define FRAME_attak210 21 #define FRAME_attak211 22 #define FRAME_attak212 23 #define FRAME_attak213 24 #define FRAME_attak214 25 #define FRAME_attak215 26 #define FRAME_attak216 27 #define FRAME_attak217 28 #define FRAME_attak218 29 #define FRAME_attak301 30 #define FRAME_attak302 31 #define FRAME_attak303 32 #define FRAME_attak304 33 #define FRAME_attak305 34 #define FRAME_attak306 35 #define FRAME_attak307 36 #define FRAME_attak308 37 #define FRAME_attak309 38 #define FRAME_attak401 39 #define FRAME_attak402 40 #define FRAME_attak403 41 #define FRAME_attak404 42 #define FRAME_attak405 43 #define FRAME_attak406 44 #define FRAME_duck01 45 #define FRAME_duck02 46 #define FRAME_duck03 47 #define FRAME_duck04 48 #define FRAME_duck05 49 #define FRAME_pain101 50 #define FRAME_pain102 51 #define FRAME_pain103 52 #define FRAME_pain104 53 #define FRAME_pain105 54 #define FRAME_pain201 55 #define FRAME_pain202 56 #define FRAME_pain203 57 #define FRAME_pain204 58 #define FRAME_pain205 59 #define FRAME_pain206 60 #define FRAME_pain207 61 #define FRAME_pain301 62 #define FRAME_pain302 63 #define FRAME_pain303 64 #define FRAME_pain304 65 #define FRAME_pain305 66 #define FRAME_pain306 67 #define FRAME_pain307 68 #define FRAME_pain308 69 #define FRAME_pain309 70 #define FRAME_pain310 71 #define FRAME_pain311 72 #define FRAME_pain312 73 #define FRAME_pain313 74 #define FRAME_pain314 75 #define FRAME_pain315 76 #define FRAME_pain316 77 #define FRAME_pain317 78 #define FRAME_pain318 79 #define FRAME_pain401 80 #define FRAME_pain402 81 #define FRAME_pain403 82 #define FRAME_pain404 83 #define FRAME_pain405 84 #define FRAME_pain406 85 #define FRAME_pain407 86 #define FRAME_pain408 87 #define FRAME_pain409 88 #define FRAME_pain410 89 #define FRAME_pain411 90 #define FRAME_pain412 91 #define FRAME_pain413 92 #define FRAME_pain414 93 #define FRAME_pain415 94 #define FRAME_pain416 95 #define FRAME_pain417 96 #define FRAME_run01 97 #define FRAME_run02 98 #define FRAME_run03 99 #define FRAME_run04 100 #define FRAME_run05 101 #define FRAME_run06 102 #define FRAME_run07 103 #define FRAME_run08 104 #define FRAME_run09 105 #define FRAME_run10 106 #define FRAME_run11 107 #define FRAME_run12 108 #define FRAME_runs01 109 #define FRAME_runs02 110 #define FRAME_runs03 111 #define FRAME_runs04 112 #define FRAME_runs05 113 #define FRAME_runs06 114 #define FRAME_runs07 115 #define FRAME_runs08 116 #define FRAME_runs09 117 #define FRAME_runs10 118 #define FRAME_runs11 119 #define FRAME_runs12 120 #define FRAME_runs13 121 #define FRAME_runs14 122 #define FRAME_runs15 123 #define FRAME_runs16 124 #define FRAME_runs17 125 #define FRAME_runs18 126 #define FRAME_runt01 127 #define FRAME_runt02 128 #define FRAME_runt03 129 #define FRAME_runt04 130 #define FRAME_runt05 131 #define FRAME_runt06 132 #define FRAME_runt07 133 #define FRAME_runt08 134 #define FRAME_runt09 135 #define FRAME_runt10 136 #define FRAME_runt11 137 #define FRAME_runt12 138 #define FRAME_runt13 139 #define FRAME_runt14 140 #define FRAME_runt15 141 #define FRAME_runt16 142 #define FRAME_runt17 143 #define FRAME_runt18 144 #define FRAME_runt19 145 #define FRAME_stand101 146 #define FRAME_stand102 147 #define FRAME_stand103 148 #define FRAME_stand104 149 #define FRAME_stand105 150 #define FRAME_stand106 151 #define FRAME_stand107 152 #define FRAME_stand108 153 #define FRAME_stand109 154 #define FRAME_stand110 155 #define FRAME_stand111 156 #define FRAME_stand112 157 #define FRAME_stand113 158 #define FRAME_stand114 159 #define FRAME_stand115 160 #define FRAME_stand116 161 #define FRAME_stand117 162 #define FRAME_stand118 163 #define FRAME_stand119 164 #define FRAME_stand120 165 #define FRAME_stand121 166 #define FRAME_stand122 167 #define FRAME_stand123 168 #define FRAME_stand124 169 #define FRAME_stand125 170 #define FRAME_stand126 171 #define FRAME_stand127 172 #define FRAME_stand128 173 #define FRAME_stand129 174 #define FRAME_stand130 175 #define FRAME_stand301 176 #define FRAME_stand302 177 #define FRAME_stand303 178 #define FRAME_stand304 179 #define FRAME_stand305 180 #define FRAME_stand306 181 #define FRAME_stand307 182 #define FRAME_stand308 183 #define FRAME_stand309 184 #define FRAME_stand310 185 #define FRAME_stand311 186 #define FRAME_stand312 187 #define FRAME_stand313 188 #define FRAME_stand314 189 #define FRAME_stand315 190 #define FRAME_stand316 191 #define FRAME_stand317 192 #define FRAME_stand318 193 #define FRAME_stand319 194 #define FRAME_stand320 195 #define FRAME_stand321 196 #define FRAME_stand322 197 #define FRAME_stand323 198 #define FRAME_stand324 199 #define FRAME_stand325 200 #define FRAME_stand326 201 #define FRAME_stand327 202 #define FRAME_stand328 203 #define FRAME_stand329 204 #define FRAME_stand330 205 #define FRAME_stand331 206 #define FRAME_stand332 207 #define FRAME_stand333 208 #define FRAME_stand334 209 #define FRAME_stand335 210 #define FRAME_stand336 211 #define FRAME_stand337 212 #define FRAME_stand338 213 #define FRAME_stand339 214 #define FRAME_walk101 215 #define FRAME_walk102 216 #define FRAME_walk103 217 #define FRAME_walk104 218 #define FRAME_walk105 219 #define FRAME_walk106 220 #define FRAME_walk107 221 #define FRAME_walk108 222 #define FRAME_walk109 223 #define FRAME_walk110 224 #define FRAME_walk111 225 #define FRAME_walk112 226 #define FRAME_walk113 227 #define FRAME_walk114 228 #define FRAME_walk115 229 #define FRAME_walk116 230 #define FRAME_walk117 231 #define FRAME_walk118 232 #define FRAME_walk119 233 #define FRAME_walk120 234 #define FRAME_walk121 235 #define FRAME_walk122 236 #define FRAME_walk123 237 #define FRAME_walk124 238 #define FRAME_walk125 239 #define FRAME_walk126 240 #define FRAME_walk127 241 #define FRAME_walk128 242 #define FRAME_walk129 243 #define FRAME_walk130 244 #define FRAME_walk131 245 #define FRAME_walk132 246 #define FRAME_walk133 247 #define FRAME_walk201 248 #define FRAME_walk202 249 #define FRAME_walk203 250 #define FRAME_walk204 251 #define FRAME_walk205 252 #define FRAME_walk206 253 #define FRAME_walk207 254 #define FRAME_walk208 255 #define FRAME_walk209 256 #define FRAME_walk210 257 #define FRAME_walk211 258 #define FRAME_walk212 259 #define FRAME_walk213 260 #define FRAME_walk214 261 #define FRAME_walk215 262 #define FRAME_walk216 263 #define FRAME_walk217 264 #define FRAME_walk218 265 #define FRAME_walk219 266 #define FRAME_walk220 267 #define FRAME_walk221 268 #define FRAME_walk222 269 #define FRAME_walk223 270 #define FRAME_walk224 271 #define FRAME_death101 272 #define FRAME_death102 273 #define FRAME_death103 274 #define FRAME_death104 275 #define FRAME_death105 276 #define FRAME_death106 277 #define FRAME_death107 278 #define FRAME_death108 279 #define FRAME_death109 280 #define FRAME_death110 281 #define FRAME_death111 282 #define FRAME_death112 283 #define FRAME_death113 284 #define FRAME_death114 285 #define FRAME_death115 286 #define FRAME_death116 287 #define FRAME_death117 288 #define FRAME_death118 289 #define FRAME_death119 290 #define FRAME_death120 291 #define FRAME_death121 292 #define FRAME_death122 293 #define FRAME_death123 294 #define FRAME_death124 295 #define FRAME_death125 296 #define FRAME_death126 297 #define FRAME_death127 298 #define FRAME_death128 299 #define FRAME_death129 300 #define FRAME_death130 301 #define FRAME_death131 302 #define FRAME_death132 303 #define FRAME_death133 304 #define FRAME_death134 305 #define FRAME_death135 306 #define FRAME_death136 307 #define FRAME_death201 308 #define FRAME_death202 309 #define FRAME_death203 310 #define FRAME_death204 311 #define FRAME_death205 312 #define FRAME_death206 313 #define FRAME_death207 314 #define FRAME_death208 315 #define FRAME_death209 316 #define FRAME_death210 317 #define FRAME_death211 318 #define FRAME_death212 319 #define FRAME_death213 320 #define FRAME_death214 321 #define FRAME_death215 322 #define FRAME_death216 323 #define FRAME_death217 324 #define FRAME_death218 325 #define FRAME_death219 326 #define FRAME_death220 327 #define FRAME_death221 328 #define FRAME_death222 329 #define FRAME_death223 330 #define FRAME_death224 331 #define FRAME_death225 332 #define FRAME_death226 333 #define FRAME_death227 334 #define FRAME_death228 335 #define FRAME_death229 336 #define FRAME_death230 337 #define FRAME_death231 338 #define FRAME_death232 339 #define FRAME_death233 340 #define FRAME_death234 341 #define FRAME_death235 342 #define FRAME_death301 343 #define FRAME_death302 344 #define FRAME_death303 345 #define FRAME_death304 346 #define FRAME_death305 347 #define FRAME_death306 348 #define FRAME_death307 349 #define FRAME_death308 350 #define FRAME_death309 351 #define FRAME_death310 352 #define FRAME_death311 353 #define FRAME_death312 354 #define FRAME_death313 355 #define FRAME_death314 356 #define FRAME_death315 357 #define FRAME_death316 358 #define FRAME_death317 359 #define FRAME_death318 360 #define FRAME_death319 361 #define FRAME_death320 362 #define FRAME_death321 363 #define FRAME_death322 364 #define FRAME_death323 365 #define FRAME_death324 366 #define FRAME_death325 367 #define FRAME_death326 368 #define FRAME_death327 369 #define FRAME_death328 370 #define FRAME_death329 371 #define FRAME_death330 372 #define FRAME_death331 373 #define FRAME_death332 374 #define FRAME_death333 375 #define FRAME_death334 376 #define FRAME_death335 377 #define FRAME_death336 378 #define FRAME_death337 379 #define FRAME_death338 380 #define FRAME_death339 381 #define FRAME_death340 382 #define FRAME_death341 383 #define FRAME_death342 384 #define FRAME_death343 385 #define FRAME_death344 386 #define FRAME_death345 387 #define FRAME_death401 388 #define FRAME_death402 389 #define FRAME_death403 390 #define FRAME_death404 391 #define FRAME_death405 392 #define FRAME_death406 393 #define FRAME_death407 394 #define FRAME_death408 395 #define FRAME_death409 396 #define FRAME_death410 397 #define FRAME_death411 398 #define FRAME_death412 399 #define FRAME_death413 400 #define FRAME_death414 401 #define FRAME_death415 402 #define FRAME_death416 403 #define FRAME_death417 404 #define FRAME_death418 405 #define FRAME_death419 406 #define FRAME_death420 407 #define FRAME_death421 408 #define FRAME_death422 409 #define FRAME_death423 410 #define FRAME_death424 411 #define FRAME_death425 412 #define FRAME_death426 413 #define FRAME_death427 414 #define FRAME_death428 415 #define FRAME_death429 416 #define FRAME_death430 417 #define FRAME_death431 418 #define FRAME_death432 419 #define FRAME_death433 420 #define FRAME_death434 421 #define FRAME_death435 422 #define FRAME_death436 423 #define FRAME_death437 424 #define FRAME_death438 425 #define FRAME_death439 426 #define FRAME_death440 427 #define FRAME_death441 428 #define FRAME_death442 429 #define FRAME_death443 430 #define FRAME_death444 431 #define FRAME_death445 432 #define FRAME_death446 433 #define FRAME_death447 434 #define FRAME_death448 435 #define FRAME_death449 436 #define FRAME_death450 437 #define FRAME_death451 438 #define FRAME_death452 439 #define FRAME_death453 440 #define FRAME_death501 441 #define FRAME_death502 442 #define FRAME_death503 443 #define FRAME_death504 444 #define FRAME_death505 445 #define FRAME_death506 446 #define FRAME_death507 447 #define FRAME_death508 448 #define FRAME_death509 449 #define FRAME_death510 450 #define FRAME_death511 451 #define FRAME_death512 452 #define FRAME_death513 453 #define FRAME_death514 454 #define FRAME_death515 455 #define FRAME_death516 456 #define FRAME_death517 457 #define FRAME_death518 458 #define FRAME_death519 459 #define FRAME_death520 460 #define FRAME_death521 461 #define FRAME_death522 462 #define FRAME_death523 463 #define FRAME_death524 464 #define FRAME_death601 465 #define FRAME_death602 466 #define FRAME_death603 467 #define FRAME_death604 468 #define FRAME_death605 469 #define FRAME_death606 470 #define FRAME_death607 471 #define FRAME_death608 472 #define FRAME_death609 473 #define FRAME_death610 474 #define MODEL_SCALE 1.200000 xatrix-XATRIX_2_14/src/monster/soldier/soldierh.h000066400000000000000000000307771477320050300220570ustar00rootroot00000000000000/* ======================================================================= * * Soldier aka "Guard" animations. This is the new model added in * Xatrix, used for the new variants of the enemy. * * ======================================================================= */ #define FRAME_attak101 0 #define FRAME_attak102 1 #define FRAME_attak103 2 #define FRAME_attak104 3 #define FRAME_attak105 4 #define FRAME_attak106 5 #define FRAME_attak107 6 #define FRAME_attak108 7 #define FRAME_attak109 8 #define FRAME_attak110 9 #define FRAME_attak111 10 #define FRAME_attak112 11 #define FRAME_attak201 12 #define FRAME_attak202 13 #define FRAME_attak203 14 #define FRAME_attak204 15 #define FRAME_attak205 16 #define FRAME_attak206 17 #define FRAME_attak207 18 #define FRAME_attak208 19 #define FRAME_attak209 20 #define FRAME_attak210 21 #define FRAME_attak211 22 #define FRAME_attak212 23 #define FRAME_attak213 24 #define FRAME_attak214 25 #define FRAME_attak215 26 #define FRAME_attak216 27 #define FRAME_attak217 28 #define FRAME_attak218 29 #define FRAME_attak301 30 #define FRAME_attak302 31 #define FRAME_attak303 32 #define FRAME_attak304 33 #define FRAME_attak305 34 #define FRAME_attak306 35 #define FRAME_attak307 36 #define FRAME_attak308 37 #define FRAME_attak309 38 #define FRAME_attak401 39 #define FRAME_attak402 40 #define FRAME_attak403 41 #define FRAME_attak404 42 #define FRAME_attak405 43 #define FRAME_attak406 44 #define FRAME_duck01 45 #define FRAME_duck02 46 #define FRAME_duck03 47 #define FRAME_duck04 48 #define FRAME_duck05 49 #define FRAME_pain101 50 #define FRAME_pain102 51 #define FRAME_pain103 52 #define FRAME_pain104 53 #define FRAME_pain105 54 #define FRAME_pain201 55 #define FRAME_pain202 56 #define FRAME_pain203 57 #define FRAME_pain204 58 #define FRAME_pain205 59 #define FRAME_pain206 60 #define FRAME_pain207 61 #define FRAME_pain301 62 #define FRAME_pain302 63 #define FRAME_pain303 64 #define FRAME_pain304 65 #define FRAME_pain305 66 #define FRAME_pain306 67 #define FRAME_pain307 68 #define FRAME_pain308 69 #define FRAME_pain309 70 #define FRAME_pain310 71 #define FRAME_pain311 72 #define FRAME_pain312 73 #define FRAME_pain313 74 #define FRAME_pain314 75 #define FRAME_pain315 76 #define FRAME_pain316 77 #define FRAME_pain317 78 #define FRAME_pain318 79 #define FRAME_pain401 80 #define FRAME_pain402 81 #define FRAME_pain403 82 #define FRAME_pain404 83 #define FRAME_pain405 84 #define FRAME_pain406 85 #define FRAME_pain407 86 #define FRAME_pain408 87 #define FRAME_pain409 88 #define FRAME_pain410 89 #define FRAME_pain411 90 #define FRAME_pain412 91 #define FRAME_pain413 92 #define FRAME_pain414 93 #define FRAME_pain415 94 #define FRAME_pain416 95 #define FRAME_pain417 96 #define FRAME_run01 97 #define FRAME_run02 98 #define FRAME_run03 99 #define FRAME_run04 100 #define FRAME_run05 101 #define FRAME_run06 102 #define FRAME_run07 103 #define FRAME_run08 104 #define FRAME_run09 105 #define FRAME_run10 106 #define FRAME_run11 107 #define FRAME_run12 108 #define FRAME_runs01 109 #define FRAME_runs02 110 #define FRAME_runs03 111 #define FRAME_runs04 112 #define FRAME_runs05 113 #define FRAME_runs06 114 #define FRAME_runs07 115 #define FRAME_runs08 116 #define FRAME_runs09 117 #define FRAME_runs10 118 #define FRAME_runs11 119 #define FRAME_runs12 120 #define FRAME_runs13 121 #define FRAME_runs14 122 #define FRAME_runs15 123 #define FRAME_runs16 124 #define FRAME_runs17 125 #define FRAME_runs18 126 #define FRAME_runt01 127 #define FRAME_runt02 128 #define FRAME_runt03 129 #define FRAME_runt04 130 #define FRAME_runt05 131 #define FRAME_runt06 132 #define FRAME_runt07 133 #define FRAME_runt08 134 #define FRAME_runt09 135 #define FRAME_runt10 136 #define FRAME_runt11 137 #define FRAME_runt12 138 #define FRAME_runt13 139 #define FRAME_runt14 140 #define FRAME_runt15 141 #define FRAME_runt16 142 #define FRAME_runt17 143 #define FRAME_runt18 144 #define FRAME_runt19 145 #define FRAME_stand101 146 #define FRAME_stand102 147 #define FRAME_stand103 148 #define FRAME_stand104 149 #define FRAME_stand105 150 #define FRAME_stand106 151 #define FRAME_stand107 152 #define FRAME_stand108 153 #define FRAME_stand109 154 #define FRAME_stand110 155 #define FRAME_stand111 156 #define FRAME_stand112 157 #define FRAME_stand113 158 #define FRAME_stand114 159 #define FRAME_stand115 160 #define FRAME_stand116 161 #define FRAME_stand117 162 #define FRAME_stand118 163 #define FRAME_stand119 164 #define FRAME_stand120 165 #define FRAME_stand121 166 #define FRAME_stand122 167 #define FRAME_stand123 168 #define FRAME_stand124 169 #define FRAME_stand125 170 #define FRAME_stand126 171 #define FRAME_stand127 172 #define FRAME_stand128 173 #define FRAME_stand129 174 #define FRAME_stand130 175 #define FRAME_stand301 176 #define FRAME_stand302 177 #define FRAME_stand303 178 #define FRAME_stand304 179 #define FRAME_stand305 180 #define FRAME_stand306 181 #define FRAME_stand307 182 #define FRAME_stand308 183 #define FRAME_stand309 184 #define FRAME_stand310 185 #define FRAME_stand311 186 #define FRAME_stand312 187 #define FRAME_stand313 188 #define FRAME_stand314 189 #define FRAME_stand315 190 #define FRAME_stand316 191 #define FRAME_stand317 192 #define FRAME_stand318 193 #define FRAME_stand319 194 #define FRAME_stand320 195 #define FRAME_stand321 196 #define FRAME_stand322 197 #define FRAME_stand323 198 #define FRAME_stand324 199 #define FRAME_stand325 200 #define FRAME_stand326 201 #define FRAME_stand327 202 #define FRAME_stand328 203 #define FRAME_stand329 204 #define FRAME_stand330 205 #define FRAME_stand331 206 #define FRAME_stand332 207 #define FRAME_stand333 208 #define FRAME_stand334 209 #define FRAME_stand335 210 #define FRAME_stand336 211 #define FRAME_stand337 212 #define FRAME_stand338 213 #define FRAME_stand339 214 #define FRAME_walk101 215 #define FRAME_walk102 216 #define FRAME_walk103 217 #define FRAME_walk104 218 #define FRAME_walk105 219 #define FRAME_walk106 220 #define FRAME_walk107 221 #define FRAME_walk108 222 #define FRAME_walk109 223 #define FRAME_walk110 224 #define FRAME_walk111 225 #define FRAME_walk112 226 #define FRAME_walk113 227 #define FRAME_walk114 228 #define FRAME_walk115 229 #define FRAME_walk116 230 #define FRAME_walk117 231 #define FRAME_walk118 232 #define FRAME_walk119 233 #define FRAME_walk120 234 #define FRAME_walk121 235 #define FRAME_walk122 236 #define FRAME_walk123 237 #define FRAME_walk124 238 #define FRAME_walk125 239 #define FRAME_walk126 240 #define FRAME_walk127 241 #define FRAME_walk128 242 #define FRAME_walk129 243 #define FRAME_walk130 244 #define FRAME_walk131 245 #define FRAME_walk132 246 #define FRAME_walk133 247 #define FRAME_walk201 248 #define FRAME_walk202 249 #define FRAME_walk203 250 #define FRAME_walk204 251 #define FRAME_walk205 252 #define FRAME_walk206 253 #define FRAME_walk207 254 #define FRAME_walk208 255 #define FRAME_walk209 256 #define FRAME_walk210 257 #define FRAME_walk211 258 #define FRAME_walk212 259 #define FRAME_walk213 260 #define FRAME_walk214 261 #define FRAME_walk215 262 #define FRAME_walk216 263 #define FRAME_walk217 264 #define FRAME_walk218 265 #define FRAME_walk219 266 #define FRAME_walk220 267 #define FRAME_walk221 268 #define FRAME_walk222 269 #define FRAME_walk223 270 #define FRAME_walk224 271 #define FRAME_death101 272 #define FRAME_death102 273 #define FRAME_death103 274 #define FRAME_death104 275 #define FRAME_death105 276 #define FRAME_death106 277 #define FRAME_death107 278 #define FRAME_death108 279 #define FRAME_death109 280 #define FRAME_death110 281 #define FRAME_death111 282 #define FRAME_death112 283 #define FRAME_death113 284 #define FRAME_death114 285 #define FRAME_death115 286 #define FRAME_death116 287 #define FRAME_death117 288 #define FRAME_death118 289 #define FRAME_death119 290 #define FRAME_death120 291 #define FRAME_death121 292 #define FRAME_death122 293 #define FRAME_death123 294 #define FRAME_death124 295 #define FRAME_death125 296 #define FRAME_death126 297 #define FRAME_death127 298 #define FRAME_death128 299 #define FRAME_death129 300 #define FRAME_death130 301 #define FRAME_death131 302 #define FRAME_death132 303 #define FRAME_death133 304 #define FRAME_death134 305 #define FRAME_death135 306 #define FRAME_death136 307 #define FRAME_death201 308 #define FRAME_death202 309 #define FRAME_death203 310 #define FRAME_death204 311 #define FRAME_death205 312 #define FRAME_death206 313 #define FRAME_death207 314 #define FRAME_death208 315 #define FRAME_death209 316 #define FRAME_death210 317 #define FRAME_death211 318 #define FRAME_death212 319 #define FRAME_death213 320 #define FRAME_death214 321 #define FRAME_death215 322 #define FRAME_death216 323 #define FRAME_death217 324 #define FRAME_death218 325 #define FRAME_death219 326 #define FRAME_death220 327 #define FRAME_death221 328 #define FRAME_death222 329 #define FRAME_death223 330 #define FRAME_death224 331 #define FRAME_death225 332 #define FRAME_death226 333 #define FRAME_death227 334 #define FRAME_death228 335 #define FRAME_death229 336 #define FRAME_death230 337 #define FRAME_death231 338 #define FRAME_death232 339 #define FRAME_death233 340 #define FRAME_death234 341 #define FRAME_death235 342 #define FRAME_death301 343 #define FRAME_death302 344 #define FRAME_death303 345 #define FRAME_death304 346 #define FRAME_death305 347 #define FRAME_death306 348 #define FRAME_death307 349 #define FRAME_death308 350 #define FRAME_death309 351 #define FRAME_death310 352 #define FRAME_death311 353 #define FRAME_death312 354 #define FRAME_death313 355 #define FRAME_death314 356 #define FRAME_death315 357 #define FRAME_death316 358 #define FRAME_death317 359 #define FRAME_death318 360 #define FRAME_death319 361 #define FRAME_death320 362 #define FRAME_death321 363 #define FRAME_death322 364 #define FRAME_death323 365 #define FRAME_death324 366 #define FRAME_death325 367 #define FRAME_death326 368 #define FRAME_death327 369 #define FRAME_death328 370 #define FRAME_death329 371 #define FRAME_death330 372 #define FRAME_death331 373 #define FRAME_death332 374 #define FRAME_death333 375 #define FRAME_death334 376 #define FRAME_death335 377 #define FRAME_death336 378 #define FRAME_death337 379 #define FRAME_death338 380 #define FRAME_death339 381 #define FRAME_death340 382 #define FRAME_death341 383 #define FRAME_death342 384 #define FRAME_death343 385 #define FRAME_death344 386 #define FRAME_death345 387 #define FRAME_death401 388 #define FRAME_death402 389 #define FRAME_death403 390 #define FRAME_death404 391 #define FRAME_death405 392 #define FRAME_death406 393 #define FRAME_death407 394 #define FRAME_death408 395 #define FRAME_death409 396 #define FRAME_death410 397 #define FRAME_death411 398 #define FRAME_death412 399 #define FRAME_death413 400 #define FRAME_death414 401 #define FRAME_death415 402 #define FRAME_death416 403 #define FRAME_death417 404 #define FRAME_death418 405 #define FRAME_death419 406 #define FRAME_death420 407 #define FRAME_death421 408 #define FRAME_death422 409 #define FRAME_death423 410 #define FRAME_death424 411 #define FRAME_death425 412 #define FRAME_death426 413 #define FRAME_death427 414 #define FRAME_death428 415 #define FRAME_death429 416 #define FRAME_death430 417 #define FRAME_death431 418 #define FRAME_death432 419 #define FRAME_death433 420 #define FRAME_death434 421 #define FRAME_death435 422 #define FRAME_death436 423 #define FRAME_death437 424 #define FRAME_death438 425 #define FRAME_death439 426 #define FRAME_death440 427 #define FRAME_death441 428 #define FRAME_death442 429 #define FRAME_death443 430 #define FRAME_death444 431 #define FRAME_death445 432 #define FRAME_death446 433 #define FRAME_death447 434 #define FRAME_death448 435 #define FRAME_death449 436 #define FRAME_death450 437 #define FRAME_death451 438 #define FRAME_death452 439 #define FRAME_death453 440 #define FRAME_death501 441 #define FRAME_death502 442 #define FRAME_death503 443 #define FRAME_death504 444 #define FRAME_death505 445 #define FRAME_death506 446 #define FRAME_death507 447 #define FRAME_death508 448 #define FRAME_death509 449 #define FRAME_death510 450 #define FRAME_death511 451 #define FRAME_death512 452 #define FRAME_death513 453 #define FRAME_death514 454 #define FRAME_death515 455 #define FRAME_death516 456 #define FRAME_death517 457 #define FRAME_death518 458 #define FRAME_death519 459 #define FRAME_death520 460 #define FRAME_death521 461 #define FRAME_death522 462 #define FRAME_death523 463 #define FRAME_death524 464 #define FRAME_death601 465 #define FRAME_death602 466 #define FRAME_death603 467 #define FRAME_death604 468 #define FRAME_death605 469 #define FRAME_death606 470 #define FRAME_death607 471 #define FRAME_death608 472 #define FRAME_death609 473 #define FRAME_death610 474 #define MODEL_SCALE 1.200000 xatrix-XATRIX_2_14/src/monster/supertank/000077500000000000000000000000001477320050300204325ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/supertank/supertank.c000066400000000000000000000413171477320050300226200ustar00rootroot00000000000000/* ======================================================================= * * Supertank aka "Boss1". This enhanced version features a nice * powershield. * * ======================================================================= */ #include "../../header/local.h" #include "supertank.h" qboolean visible(edict_t *self, edict_t *other); static int sound_pain1; static int sound_pain2; static int sound_pain3; static int sound_death; static int sound_search1; static int sound_search2; static int tread_sound; void BossExplode(edict_t *self); void supertank_dead(edict_t *self); void supertankRocket(edict_t *self); void supertankMachineGun(edict_t *self); void supertank_reattack1(edict_t *self); void TreadSound(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, tread_sound, 1, ATTN_NORM, 0); } void supertank_search(edict_t *self) { if (!self) { return; } if (random() < 0.5) { gi.sound(self, CHAN_VOICE, sound_search1, 1, ATTN_NORM, 0); } else { gi.sound(self, CHAN_VOICE, sound_search2, 1, ATTN_NORM, 0); } } static mframe_t supertank_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t supertank_move_stand = { FRAME_stand_1, FRAME_stand_60, supertank_frames_stand, NULL }; void supertank_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &supertank_move_stand; } static mframe_t supertank_frames_run[] = { {ai_run, 12, TreadSound}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, {ai_run, 12, NULL} }; mmove_t supertank_move_run = { FRAME_forwrd_1, FRAME_forwrd_18, supertank_frames_run, NULL }; static mframe_t supertank_frames_forward[] = { {ai_walk, 4, TreadSound}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL} }; mmove_t supertank_move_forward = { FRAME_forwrd_1, FRAME_forwrd_18, supertank_frames_forward, NULL }; void supertank_forward(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &supertank_move_forward; } void supertank_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &supertank_move_forward; } void supertank_run(edict_t *self) { if (!self) { return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &supertank_move_stand; } else { self->monsterinfo.currentmove = &supertank_move_run; } } static mframe_t supertank_frames_turn_right[] = { {ai_move, 0, TreadSound}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t supertank_move_turn_right = { FRAME_right_1, FRAME_right_18, supertank_frames_turn_right, supertank_run }; static mframe_t supertank_frames_turn_left[] = { {ai_move, 0, TreadSound}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t supertank_move_turn_left = { FRAME_left_1, FRAME_left_18, supertank_frames_turn_left, supertank_run }; static mframe_t supertank_frames_pain3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t supertank_move_pain3 = { FRAME_pain3_9, FRAME_pain3_12, supertank_frames_pain3, supertank_run }; static mframe_t supertank_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t supertank_move_pain2 = { FRAME_pain2_5, FRAME_pain2_8, supertank_frames_pain2, supertank_run }; static mframe_t supertank_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t supertank_move_pain1 = { FRAME_pain1_1, FRAME_pain1_4, supertank_frames_pain1, supertank_run }; static mframe_t supertank_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, BossExplode} }; mmove_t supertank_move_death = { FRAME_death_1, FRAME_death_24, supertank_frames_death1, supertank_dead }; static mframe_t supertank_frames_backward[] = { {ai_walk, 0, TreadSound}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL} }; mmove_t supertank_move_backward = { FRAME_backwd_1, FRAME_backwd_18, supertank_frames_backward, NULL }; static mframe_t supertank_frames_attack4[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t supertank_move_attack4 = { FRAME_attak4_1, FRAME_attak4_6, supertank_frames_attack4, supertank_run }; static mframe_t supertank_frames_attack3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t supertank_move_attack3 = { FRAME_attak3_1, FRAME_attak3_27, supertank_frames_attack3, supertank_run }; static mframe_t supertank_frames_attack2[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, supertankRocket}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, supertankRocket}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, supertankRocket}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t supertank_move_attack2 = { FRAME_attak2_1, FRAME_attak2_27, supertank_frames_attack2, supertank_run }; static mframe_t supertank_frames_attack1[] = { {ai_charge, 0, supertankMachineGun}, {ai_charge, 0, supertankMachineGun}, {ai_charge, 0, supertankMachineGun}, {ai_charge, 0, supertankMachineGun}, {ai_charge, 0, supertankMachineGun}, {ai_charge, 0, supertankMachineGun}, }; mmove_t supertank_move_attack1 = { FRAME_attak1_1, FRAME_attak1_6, supertank_frames_attack1, supertank_reattack1 }; static mframe_t supertank_frames_end_attack1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t supertank_move_end_attack1 = { FRAME_attak1_7, FRAME_attak1_20, supertank_frames_end_attack1, supertank_run }; void supertank_reattack1(edict_t *self) { if (!self) { return; } if (visible(self, self->enemy)) { if (random() < 0.9) { self->monsterinfo.currentmove = &supertank_move_attack1; } else { self->monsterinfo.currentmove = &supertank_move_end_attack1; } } else { self->monsterinfo.currentmove = &supertank_move_end_attack1; } } void supertank_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum = 1; } if (level.time < self->pain_debounce_time) { return; } /* Lessen the chance of him going into his pain frames */ if (damage <= 25) { if (random() < 0.2) { return; } } /* Don't go into pain if he's firing his rockets */ if (skill->value >= SKILL_HARD) { if ((self->s.frame >= FRAME_attak2_1) && (self->s.frame <= FRAME_attak2_14)) { return; } } self->pain_debounce_time = level.time + 3; if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } if (damage <= 10) { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &supertank_move_pain1; } else if (damage <= 25) { gi.sound(self, CHAN_VOICE, sound_pain3, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &supertank_move_pain2; } else { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); self->monsterinfo.currentmove = &supertank_move_pain3; } } void supertankRocket(edict_t *self) { vec3_t forward, right; vec3_t start; vec3_t dir; vec3_t vec; int flash_number; if (!self) { return; } if (self->s.frame == FRAME_attak2_8) { flash_number = MZ2_SUPERTANK_ROCKET_1; } else if (self->s.frame == FRAME_attak2_11) { flash_number = MZ2_SUPERTANK_ROCKET_2; } else { flash_number = MZ2_SUPERTANK_ROCKET_3; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], forward, right, start); VectorCopy(self->enemy->s.origin, vec); vec[2] += self->enemy->viewheight; VectorSubtract(vec, start, dir); VectorNormalize(dir); monster_fire_rocket(self, start, dir, 50, 500, flash_number); } void supertankMachineGun(edict_t *self) { vec3_t dir; vec3_t vec; vec3_t start; vec3_t forward, right; int flash_number; if (!self) { return; } flash_number = MZ2_SUPERTANK_MACHINEGUN_1 + (self->s.frame - FRAME_attak1_1); dir[0] = 0; dir[1] = self->s.angles[1]; dir[2] = 0; AngleVectors(dir, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], forward, right, start); if (self->enemy) { VectorCopy(self->enemy->s.origin, vec); VectorMA(vec, 0, self->enemy->velocity, vec); vec[2] += self->enemy->viewheight; VectorSubtract(vec, start, forward); VectorNormalize(forward); } monster_fire_bullet(self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_number); } void supertank_attack(edict_t *self) { vec3_t vec; float range; if (!self) { return; } VectorSubtract(self->enemy->s.origin, self->s.origin, vec); range = VectorLength(vec); if (range <= 160) { self->monsterinfo.currentmove = &supertank_move_attack1; } else { /* fire rockets more often at distance */ if (random() < 0.3) { self->monsterinfo.currentmove = &supertank_move_attack1; } else { self->monsterinfo.currentmove = &supertank_move_attack2; } } } void supertank_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -60, -60, 0); VectorSet(self->maxs, 60, 60, 72); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } void BossExplode(edict_t *self) { vec3_t org; int n; if (!self) { return; } self->think = BossExplode; VectorCopy(self->s.origin, org); org[2] += 24 + (rand() & 15); switch (self->count++) { case 0: org[0] -= 24; org[1] -= 24; break; case 1: org[0] += 24; org[1] += 24; break; case 2: org[0] += 24; org[1] -= 24; break; case 3: org[0] -= 24; org[1] += 24; break; case 4: org[0] -= 48; org[1] -= 48; break; case 5: org[0] += 48; org[1] += 48; break; case 6: org[0] -= 48; org[1] += 48; break; case 7: org[0] += 48; org[1] -= 48; break; case 8: self->s.sound = 0; for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", 500, GIB_ORGANIC); } for (n = 0; n < 8; n++) { ThrowGib(self, "models/objects/gibs/sm_metal/tris.md2", 500, GIB_METALLIC); } ThrowGib(self, "models/objects/gibs/chest/tris.md2", 500, GIB_ORGANIC); ThrowHead(self, "models/objects/gibs/gear/tris.md2", 500, GIB_METALLIC); self->deadflag = DEAD_DEAD; return; } gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_EXPLOSION1); gi.WritePosition(org); gi.multicast(self->s.origin, MULTICAST_PVS); self->nextthink = level.time + 0.1; } void supertank_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage /* unused */, vec3_t point /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_NO; self->count = 0; self->monsterinfo.currentmove = &supertank_move_death; } /* * QUAKED monster_supertank (1 .5 0) (-64 -64 0) (64 64 72) Ambush Trigger_Spawn Sight Powershield */ void SP_monster_supertank(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } sound_pain1 = gi.soundindex("bosstank/btkpain1.wav"); sound_pain2 = gi.soundindex("bosstank/btkpain2.wav"); sound_pain3 = gi.soundindex("bosstank/btkpain3.wav"); sound_death = gi.soundindex("bosstank/btkdeth1.wav"); sound_search1 = gi.soundindex("bosstank/btkunqv1.wav"); sound_search2 = gi.soundindex("bosstank/btkunqv2.wav"); tread_sound = gi.soundindex("bosstank/btkengn1.wav"); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/boss1/tris.md2"); VectorSet(self->mins, -64, -64, 0); VectorSet(self->maxs, 64, 64, 112); self->health = 1500; self->gib_health = -500; self->mass = 800; self->pain = supertank_pain; self->die = supertank_die; self->monsterinfo.stand = supertank_stand; self->monsterinfo.walk = supertank_walk; self->monsterinfo.run = supertank_run; self->monsterinfo.dodge = NULL; self->monsterinfo.attack = supertank_attack; self->monsterinfo.search = supertank_search; self->monsterinfo.melee = NULL; self->monsterinfo.sight = NULL; gi.linkentity(self); self->monsterinfo.currentmove = &supertank_move_stand; self->monsterinfo.scale = MODEL_SCALE; if (self->spawnflags & 8) { self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = 400; } walkmonster_start(self); } xatrix-XATRIX_2_14/src/monster/supertank/supertank.h000066400000000000000000000155031477320050300226230ustar00rootroot00000000000000/* ======================================================================= * * Supertank aka "Boss1" animations. * * ======================================================================= */ #define FRAME_attak1_1 0 #define FRAME_attak1_2 1 #define FRAME_attak1_3 2 #define FRAME_attak1_4 3 #define FRAME_attak1_5 4 #define FRAME_attak1_6 5 #define FRAME_attak1_7 6 #define FRAME_attak1_8 7 #define FRAME_attak1_9 8 #define FRAME_attak1_10 9 #define FRAME_attak1_11 10 #define FRAME_attak1_12 11 #define FRAME_attak1_13 12 #define FRAME_attak1_14 13 #define FRAME_attak1_15 14 #define FRAME_attak1_16 15 #define FRAME_attak1_17 16 #define FRAME_attak1_18 17 #define FRAME_attak1_19 18 #define FRAME_attak1_20 19 #define FRAME_attak2_1 20 #define FRAME_attak2_2 21 #define FRAME_attak2_3 22 #define FRAME_attak2_4 23 #define FRAME_attak2_5 24 #define FRAME_attak2_6 25 #define FRAME_attak2_7 26 #define FRAME_attak2_8 27 #define FRAME_attak2_9 28 #define FRAME_attak2_10 29 #define FRAME_attak2_11 30 #define FRAME_attak2_12 31 #define FRAME_attak2_13 32 #define FRAME_attak2_14 33 #define FRAME_attak2_15 34 #define FRAME_attak2_16 35 #define FRAME_attak2_17 36 #define FRAME_attak2_18 37 #define FRAME_attak2_19 38 #define FRAME_attak2_20 39 #define FRAME_attak2_21 40 #define FRAME_attak2_22 41 #define FRAME_attak2_23 42 #define FRAME_attak2_24 43 #define FRAME_attak2_25 44 #define FRAME_attak2_26 45 #define FRAME_attak2_27 46 #define FRAME_attak3_1 47 #define FRAME_attak3_2 48 #define FRAME_attak3_3 49 #define FRAME_attak3_4 50 #define FRAME_attak3_5 51 #define FRAME_attak3_6 52 #define FRAME_attak3_7 53 #define FRAME_attak3_8 54 #define FRAME_attak3_9 55 #define FRAME_attak3_10 56 #define FRAME_attak3_11 57 #define FRAME_attak3_12 58 #define FRAME_attak3_13 59 #define FRAME_attak3_14 60 #define FRAME_attak3_15 61 #define FRAME_attak3_16 62 #define FRAME_attak3_17 63 #define FRAME_attak3_18 64 #define FRAME_attak3_19 65 #define FRAME_attak3_20 66 #define FRAME_attak3_21 67 #define FRAME_attak3_22 68 #define FRAME_attak3_23 69 #define FRAME_attak3_24 70 #define FRAME_attak3_25 71 #define FRAME_attak3_26 72 #define FRAME_attak3_27 73 #define FRAME_attak4_1 74 #define FRAME_attak4_2 75 #define FRAME_attak4_3 76 #define FRAME_attak4_4 77 #define FRAME_attak4_5 78 #define FRAME_attak4_6 79 #define FRAME_backwd_1 80 #define FRAME_backwd_2 81 #define FRAME_backwd_3 82 #define FRAME_backwd_4 83 #define FRAME_backwd_5 84 #define FRAME_backwd_6 85 #define FRAME_backwd_7 86 #define FRAME_backwd_8 87 #define FRAME_backwd_9 88 #define FRAME_backwd_10 89 #define FRAME_backwd_11 90 #define FRAME_backwd_12 91 #define FRAME_backwd_13 92 #define FRAME_backwd_14 93 #define FRAME_backwd_15 94 #define FRAME_backwd_16 95 #define FRAME_backwd_17 96 #define FRAME_backwd_18 97 #define FRAME_death_1 98 #define FRAME_death_2 99 #define FRAME_death_3 100 #define FRAME_death_4 101 #define FRAME_death_5 102 #define FRAME_death_6 103 #define FRAME_death_7 104 #define FRAME_death_8 105 #define FRAME_death_9 106 #define FRAME_death_10 107 #define FRAME_death_11 108 #define FRAME_death_12 109 #define FRAME_death_13 110 #define FRAME_death_14 111 #define FRAME_death_15 112 #define FRAME_death_16 113 #define FRAME_death_17 114 #define FRAME_death_18 115 #define FRAME_death_19 116 #define FRAME_death_20 117 #define FRAME_death_21 118 #define FRAME_death_22 119 #define FRAME_death_23 120 #define FRAME_death_24 121 #define FRAME_death_31 122 #define FRAME_death_32 123 #define FRAME_death_33 124 #define FRAME_death_45 125 #define FRAME_death_46 126 #define FRAME_death_47 127 #define FRAME_forwrd_1 128 #define FRAME_forwrd_2 129 #define FRAME_forwrd_3 130 #define FRAME_forwrd_4 131 #define FRAME_forwrd_5 132 #define FRAME_forwrd_6 133 #define FRAME_forwrd_7 134 #define FRAME_forwrd_8 135 #define FRAME_forwrd_9 136 #define FRAME_forwrd_10 137 #define FRAME_forwrd_11 138 #define FRAME_forwrd_12 139 #define FRAME_forwrd_13 140 #define FRAME_forwrd_14 141 #define FRAME_forwrd_15 142 #define FRAME_forwrd_16 143 #define FRAME_forwrd_17 144 #define FRAME_forwrd_18 145 #define FRAME_left_1 146 #define FRAME_left_2 147 #define FRAME_left_3 148 #define FRAME_left_4 149 #define FRAME_left_5 150 #define FRAME_left_6 151 #define FRAME_left_7 152 #define FRAME_left_8 153 #define FRAME_left_9 154 #define FRAME_left_10 155 #define FRAME_left_11 156 #define FRAME_left_12 157 #define FRAME_left_13 158 #define FRAME_left_14 159 #define FRAME_left_15 160 #define FRAME_left_16 161 #define FRAME_left_17 162 #define FRAME_left_18 163 #define FRAME_pain1_1 164 #define FRAME_pain1_2 165 #define FRAME_pain1_3 166 #define FRAME_pain1_4 167 #define FRAME_pain2_5 168 #define FRAME_pain2_6 169 #define FRAME_pain2_7 170 #define FRAME_pain2_8 171 #define FRAME_pain3_9 172 #define FRAME_pain3_10 173 #define FRAME_pain3_11 174 #define FRAME_pain3_12 175 #define FRAME_right_1 176 #define FRAME_right_2 177 #define FRAME_right_3 178 #define FRAME_right_4 179 #define FRAME_right_5 180 #define FRAME_right_6 181 #define FRAME_right_7 182 #define FRAME_right_8 183 #define FRAME_right_9 184 #define FRAME_right_10 185 #define FRAME_right_11 186 #define FRAME_right_12 187 #define FRAME_right_13 188 #define FRAME_right_14 189 #define FRAME_right_15 190 #define FRAME_right_16 191 #define FRAME_right_17 192 #define FRAME_right_18 193 #define FRAME_stand_1 194 #define FRAME_stand_2 195 #define FRAME_stand_3 196 #define FRAME_stand_4 197 #define FRAME_stand_5 198 #define FRAME_stand_6 199 #define FRAME_stand_7 200 #define FRAME_stand_8 201 #define FRAME_stand_9 202 #define FRAME_stand_10 203 #define FRAME_stand_11 204 #define FRAME_stand_12 205 #define FRAME_stand_13 206 #define FRAME_stand_14 207 #define FRAME_stand_15 208 #define FRAME_stand_16 209 #define FRAME_stand_17 210 #define FRAME_stand_18 211 #define FRAME_stand_19 212 #define FRAME_stand_20 213 #define FRAME_stand_21 214 #define FRAME_stand_22 215 #define FRAME_stand_23 216 #define FRAME_stand_24 217 #define FRAME_stand_25 218 #define FRAME_stand_26 219 #define FRAME_stand_27 220 #define FRAME_stand_28 221 #define FRAME_stand_29 222 #define FRAME_stand_30 223 #define FRAME_stand_31 224 #define FRAME_stand_32 225 #define FRAME_stand_33 226 #define FRAME_stand_34 227 #define FRAME_stand_35 228 #define FRAME_stand_36 229 #define FRAME_stand_37 230 #define FRAME_stand_38 231 #define FRAME_stand_39 232 #define FRAME_stand_40 233 #define FRAME_stand_41 234 #define FRAME_stand_42 235 #define FRAME_stand_43 236 #define FRAME_stand_44 237 #define FRAME_stand_45 238 #define FRAME_stand_46 239 #define FRAME_stand_47 240 #define FRAME_stand_48 241 #define FRAME_stand_49 242 #define FRAME_stand_50 243 #define FRAME_stand_51 244 #define FRAME_stand_52 245 #define FRAME_stand_53 246 #define FRAME_stand_54 247 #define FRAME_stand_55 248 #define FRAME_stand_56 249 #define FRAME_stand_57 250 #define FRAME_stand_58 251 #define FRAME_stand_59 252 #define FRAME_stand_60 253 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/monster/tank/000077500000000000000000000000001477320050300173535ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/monster/tank/tank.c000066400000000000000000000504461477320050300204650ustar00rootroot00000000000000/* ======================================================================= * * Tank and Tank Commander. * * ======================================================================= */ #include "../../header/local.h" #include "tank.h" void tank_refire_rocket(edict_t *self); void tank_doattack_rocket(edict_t *self); void tank_reattack_blaster(edict_t *self); void tank_walk(edict_t *self); void tank_run(edict_t *self); static int sound_thud; static int sound_pain; static int sound_idle; static int sound_die; static int sound_step; static int sound_sight; static int sound_windup; static int sound_strike; void tank_sight(edict_t *self, edict_t *other /* unused */) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); } void tank_footstep(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); } void tank_thud(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_BODY, sound_thud, 1, ATTN_NORM, 0); } void tank_windup(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_windup, 1, ATTN_NORM, 0); } void tank_idle(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); } static mframe_t tank_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; mmove_t tank_move_stand = { FRAME_stand01, FRAME_stand30, tank_frames_stand, NULL }; void tank_stand(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &tank_move_stand; } static mframe_t tank_frames_start_walk[] = { {ai_walk, 0, NULL}, {ai_walk, 6, NULL}, {ai_walk, 6, NULL}, {ai_walk, 11, tank_footstep} }; mmove_t tank_move_start_walk = { FRAME_walk01, FRAME_walk04, tank_frames_start_walk, tank_walk }; static mframe_t tank_frames_walk[] = { {ai_walk, 4, NULL}, {ai_walk, 5, NULL}, {ai_walk, 3, NULL}, {ai_walk, 2, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, tank_footstep}, {ai_walk, 3, NULL}, {ai_walk, 5, NULL}, {ai_walk, 4, NULL}, {ai_walk, 5, NULL}, {ai_walk, 7, NULL}, {ai_walk, 7, NULL}, {ai_walk, 6, NULL}, {ai_walk, 6, tank_footstep} }; mmove_t tank_move_walk = { FRAME_walk05, FRAME_walk20, tank_frames_walk, NULL }; static mframe_t tank_frames_stop_walk[] = { {ai_walk, 3, NULL}, {ai_walk, 3, NULL}, {ai_walk, 2, NULL}, {ai_walk, 2, NULL}, {ai_walk, 4, tank_footstep} }; mmove_t tank_move_stop_walk = { FRAME_walk21, FRAME_walk25, tank_frames_stop_walk, tank_stand }; void tank_walk(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &tank_move_walk; } static mframe_t tank_frames_start_run[] = { {ai_run, 0, NULL}, {ai_run, 6, NULL}, {ai_run, 6, NULL}, {ai_run, 11, tank_footstep} }; mmove_t tank_move_start_run = { FRAME_walk01, FRAME_walk04, tank_frames_start_run, tank_run }; static mframe_t tank_frames_run[] = { {ai_run, 4, NULL}, {ai_run, 5, NULL}, {ai_run, 3, NULL}, {ai_run, 2, NULL}, {ai_run, 5, NULL}, {ai_run, 5, NULL}, {ai_run, 4, NULL}, {ai_run, 4, tank_footstep}, {ai_run, 3, NULL}, {ai_run, 5, NULL}, {ai_run, 4, NULL}, {ai_run, 5, NULL}, {ai_run, 7, NULL}, {ai_run, 7, NULL}, {ai_run, 6, NULL}, {ai_run, 6, tank_footstep} }; mmove_t tank_move_run = { FRAME_walk05, FRAME_walk20, tank_frames_run, NULL }; static mframe_t tank_frames_stop_run[] = { {ai_run, 3, NULL}, {ai_run, 3, NULL}, {ai_run, 2, NULL}, {ai_run, 2, NULL}, {ai_run, 4, tank_footstep} }; mmove_t tank_move_stop_run = { FRAME_walk21, FRAME_walk25, tank_frames_stop_run, tank_walk }; void tank_run(edict_t *self) { if (!self) { return; } if (self->enemy && self->enemy->client) { self->monsterinfo.aiflags |= AI_BRUTAL; } else { self->monsterinfo.aiflags &= ~AI_BRUTAL; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &tank_move_stand; return; } if ((self->monsterinfo.currentmove == &tank_move_walk) || (self->monsterinfo.currentmove == &tank_move_start_run)) { self->monsterinfo.currentmove = &tank_move_run; } else { self->monsterinfo.currentmove = &tank_move_start_run; } } static mframe_t tank_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t tank_move_pain1 = { FRAME_pain101, FRAME_pain104, tank_frames_pain1, tank_run }; static mframe_t tank_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t tank_move_pain2 = { FRAME_pain201, FRAME_pain205, tank_frames_pain2, tank_run }; static mframe_t tank_frames_pain3[] = { {ai_move, -7, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 2, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 3, NULL}, {ai_move, 0, NULL}, {ai_move, 2, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, tank_footstep} }; mmove_t tank_move_pain3 = { FRAME_pain301, FRAME_pain316, tank_frames_pain3, tank_run }; void tank_pain(edict_t *self, edict_t *other /* other */, float kick /* other */, int damage) { if (!self) { return; } if (self->health < (self->max_health / 2)) { self->s.skinnum |= 1; } if (damage <= 10) { return; } if (level.time < self->pain_debounce_time) { return; } if (damage <= 30) { if (random() > 0.2) { return; } } /* If hard or nightmare, don't go into pain while attacking */ if (skill->value >= SKILL_HARD) { if ((self->s.frame >= FRAME_attak301) && (self->s.frame <= FRAME_attak330)) { return; } if ((self->s.frame >= FRAME_attak101) && (self->s.frame <= FRAME_attak116)) { return; } } self->pain_debounce_time = level.time + 3; gi.sound(self, CHAN_VOICE, sound_pain, 1, ATTN_NORM, 0); if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } if (damage <= 30) { self->monsterinfo.currentmove = &tank_move_pain1; } else if (damage <= 60) { self->monsterinfo.currentmove = &tank_move_pain2; } else { self->monsterinfo.currentmove = &tank_move_pain3; } } void TankBlaster(edict_t *self) { vec3_t forward, right; vec3_t start; vec3_t end; vec3_t dir; int flash_number; if (!self) { return; } if (self->s.frame == FRAME_attak110) { flash_number = MZ2_TANK_BLASTER_1; } else if (self->s.frame == FRAME_attak113) { flash_number = MZ2_TANK_BLASTER_2; } else { flash_number = MZ2_TANK_BLASTER_3; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], forward, right, start); VectorCopy(self->enemy->s.origin, end); end[2] += self->enemy->viewheight; VectorSubtract(end, start, dir); monster_fire_blaster(self, start, dir, 30, 800, flash_number, EF_BLASTER); } void TankStrike(edict_t *self) { if (!self) { return; } gi.sound(self, CHAN_WEAPON, sound_strike, 1, ATTN_NORM, 0); } void TankRocket(edict_t *self) { vec3_t forward, right; vec3_t start; vec3_t dir; vec3_t vec; int flash_number; if (!self) { return; } if (self->s.frame == FRAME_attak324) { flash_number = MZ2_TANK_ROCKET_1; } else if (self->s.frame == FRAME_attak327) { flash_number = MZ2_TANK_ROCKET_2; } else { flash_number = MZ2_TANK_ROCKET_3; } AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], forward, right, start); VectorCopy(self->enemy->s.origin, vec); vec[2] += self->enemy->viewheight; VectorSubtract(vec, start, dir); VectorNormalize(dir); monster_fire_rocket(self, start, dir, 50, 550, flash_number); } void TankMachineGun(edict_t *self) { vec3_t dir; vec3_t vec; vec3_t start; vec3_t forward, right; int flash_number; if (!self) { return; } flash_number = MZ2_TANK_MACHINEGUN_1 + (self->s.frame - FRAME_attak406); AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], forward, right, start); if (self->enemy) { VectorCopy(self->enemy->s.origin, vec); vec[2] += self->enemy->viewheight; VectorSubtract(vec, start, vec); vectoangles(vec, vec); dir[0] = vec[0]; } else { dir[0] = 0; } if (self->s.frame <= FRAME_attak415) { dir[1] = self->s.angles[1] - 8 * (self->s.frame - FRAME_attak411); } else { dir[1] = self->s.angles[1] + 8 * (self->s.frame - FRAME_attak419); } dir[2] = 0; AngleVectors(dir, forward, NULL, NULL); monster_fire_bullet(self, start, forward, 20, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_number); } static mframe_t tank_frames_attack_blast[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, -1, NULL}, {ai_charge, -2, NULL}, {ai_charge, -1, NULL}, {ai_charge, -1, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, TankBlaster}, /* 10 */ {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, TankBlaster}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, TankBlaster} /* 16 */ }; mmove_t tank_move_attack_blast = { FRAME_attak101, FRAME_attak116, tank_frames_attack_blast, tank_reattack_blaster }; static mframe_t tank_frames_reattack_blast[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, TankBlaster}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, TankBlaster} /* 16 */ }; mmove_t tank_move_reattack_blast = { FRAME_attak111, FRAME_attak116, tank_frames_reattack_blast, tank_reattack_blaster }; static mframe_t tank_frames_attack_post_blast[] = { {ai_move, 0, NULL}, /* 17 */ {ai_move, 0, NULL}, {ai_move, 2, NULL}, {ai_move, 3, NULL}, {ai_move, 2, NULL}, {ai_move, -2, tank_footstep} /* 22 */ }; mmove_t tank_move_attack_post_blast = { FRAME_attak117, FRAME_attak122, tank_frames_attack_post_blast, tank_run }; void tank_reattack_blaster(edict_t *self) { if (!self) { return; } if (skill->value >= SKILL_HARD) { if (visible(self, self->enemy)) { if (self->enemy->health > 0) { if (random() <= 0.6) { self->monsterinfo.currentmove = &tank_move_reattack_blast; return; } } } } self->monsterinfo.currentmove = &tank_move_attack_post_blast; } void tank_poststrike(edict_t *self) { self->enemy = NULL; tank_run(self); } static mframe_t tank_frames_attack_strike[] = { {ai_move, 3, NULL}, {ai_move, 2, NULL}, {ai_move, 2, NULL}, {ai_move, 1, NULL}, {ai_move, 6, NULL}, {ai_move, 7, NULL}, {ai_move, 9, tank_footstep}, {ai_move, 2, NULL}, {ai_move, 1, NULL}, {ai_move, 2, NULL}, {ai_move, 2, tank_footstep}, {ai_move, 2, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -2, NULL}, {ai_move, -2, NULL}, {ai_move, 0, tank_windup}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, TankStrike}, {ai_move, 0, NULL}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, -3, NULL}, {ai_move, -10, NULL}, {ai_move, -10, NULL}, {ai_move, -2, NULL}, {ai_move, -3, NULL}, {ai_move, -2, tank_footstep} }; mmove_t tank_move_attack_strike = { FRAME_attak201, FRAME_attak238, tank_frames_attack_strike, tank_poststrike }; static mframe_t tank_frames_attack_pre_rocket[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, /* 10 */ {ai_charge, 0, NULL}, {ai_charge, 1, NULL}, {ai_charge, 2, NULL}, {ai_charge, 7, NULL}, {ai_charge, 7, NULL}, {ai_charge, 7, tank_footstep}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, /* 20 */ {ai_charge, -3, NULL} }; mmove_t tank_move_attack_pre_rocket = { FRAME_attak301, FRAME_attak321, tank_frames_attack_pre_rocket, tank_doattack_rocket }; static mframe_t tank_frames_attack_fire_rocket[] = { {ai_charge, -3, NULL}, /* Loop Start 22 */ {ai_charge, 0, NULL}, {ai_charge, 0, TankRocket}, /* 24 */ {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, TankRocket}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, -1, TankRocket} /* 30 Loop End */ }; mmove_t tank_move_attack_fire_rocket = { FRAME_attak322, FRAME_attak330, tank_frames_attack_fire_rocket, tank_refire_rocket }; static mframe_t tank_frames_attack_post_rocket[] = { {ai_charge, 0, NULL}, /* 31 */ {ai_charge, -1, NULL}, {ai_charge, -1, NULL}, {ai_charge, 0, NULL}, {ai_charge, 2, NULL}, {ai_charge, 3, NULL}, {ai_charge, 4, NULL}, {ai_charge, 2, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, /* 40 */ {ai_charge, 0, NULL}, {ai_charge, -9, NULL}, {ai_charge, -8, NULL}, {ai_charge, -7, NULL}, {ai_charge, -1, NULL}, {ai_charge, -1, tank_footstep}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, /* 50 */ {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t tank_move_attack_post_rocket = { FRAME_attak331, FRAME_attak353, tank_frames_attack_post_rocket, tank_run }; static mframe_t tank_frames_attack_chain[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {NULL, 0, TankMachineGun}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} }; mmove_t tank_move_attack_chain = { FRAME_attak401, FRAME_attak429, tank_frames_attack_chain, tank_run }; void tank_refire_rocket(edict_t *self) { if (!self) { return; } /* Only on hard or nightmare */ if (skill->value >= SKILL_HARD) { if (self->enemy->health > 0) { if (visible(self, self->enemy)) { if (random() <= 0.4) { self->monsterinfo.currentmove = &tank_move_attack_fire_rocket; return; } } } } self->monsterinfo.currentmove = &tank_move_attack_post_rocket; } void tank_doattack_rocket(edict_t *self) { if (!self) { return; } self->monsterinfo.currentmove = &tank_move_attack_fire_rocket; } void tank_attack(edict_t *self) { vec3_t vec; float range; float r; if (!self) { return; } if (self->enemy->health < 0) { self->monsterinfo.currentmove = &tank_move_attack_strike; self->monsterinfo.aiflags &= ~AI_BRUTAL; return; } VectorSubtract(self->enemy->s.origin, self->s.origin, vec); range = VectorLength(vec); r = random(); if (range <= 125) { if (r < 0.4) { self->monsterinfo.currentmove = &tank_move_attack_chain; } else { self->monsterinfo.currentmove = &tank_move_attack_blast; } } else if (range <= 250) { if (r < 0.5) { self->monsterinfo.currentmove = &tank_move_attack_chain; } else { self->monsterinfo.currentmove = &tank_move_attack_blast; } } else { if (r < 0.33) { self->monsterinfo.currentmove = &tank_move_attack_chain; } else if (r < 0.66) { self->monsterinfo.currentmove = &tank_move_attack_pre_rocket; self->pain_debounce_time = level.time + 5.0; /* no pain for a while */ } else { self->monsterinfo.currentmove = &tank_move_attack_blast; } } } void tank_dead(edict_t *self) { if (!self) { return; } VectorSet(self->mins, -16, -16, -16); VectorSet(self->maxs, 16, 16, -0); self->movetype = MOVETYPE_TOSS; self->svflags |= SVF_DEADMONSTER; self->nextthink = 0; gi.linkentity(self); } static mframe_t tank_frames_death1[] = { {ai_move, -7, NULL}, {ai_move, -2, NULL}, {ai_move, -2, NULL}, {ai_move, 1, NULL}, {ai_move, 3, NULL}, {ai_move, 6, NULL}, {ai_move, 1, NULL}, {ai_move, 1, NULL}, {ai_move, 2, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -2, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -3, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -4, NULL}, {ai_move, -6, NULL}, {ai_move, -4, NULL}, {ai_move, -5, NULL}, {ai_move, -7, NULL}, {ai_move, -15, tank_thud}, {ai_move, -5, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; mmove_t tank_move_death = { FRAME_death101, FRAME_death132, tank_frames_death1, tank_dead }; void tank_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point /* unused */) { int n; if (!self) { return; } /* check for gib */ if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 1 /*4*/; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_metal/tris.md2", damage, GIB_METALLIC); } ThrowGib(self, "models/objects/gibs/chest/tris.md2", damage, GIB_ORGANIC); ThrowHead(self, "models/objects/gibs/gear/tris.md2", damage, GIB_METALLIC); self->deadflag = DEAD_DEAD; return; } if (self->deadflag == DEAD_DEAD) { return; } /* regular death */ gi.sound(self, CHAN_VOICE, sound_die, 1, ATTN_NORM, 0); self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; self->monsterinfo.currentmove = &tank_move_death; } /* * QUAKED monster_tank (1 .5 0) (-32 -32 -16) (32 32 72) Ambush Trigger_Spawn Sight * QUAKED monster_tank_commander (1 .5 0) (-32 -32 -16) (32 32 72) Ambush Trigger_Spawn Sight */ void SP_monster_tank(edict_t *self) { if (!self) { return; } if (deathmatch->value) { G_FreeEdict(self); return; } self->s.modelindex = gi.modelindex("models/monsters/tank/tris.md2"); VectorSet(self->mins, -32, -32, -16); VectorSet(self->maxs, 32, 32, 72); self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; sound_pain = gi.soundindex("tank/tnkpain2.wav"); sound_thud = gi.soundindex("tank/tnkdeth2.wav"); sound_idle = gi.soundindex("tank/tnkidle1.wav"); sound_die = gi.soundindex("tank/death.wav"); sound_step = gi.soundindex("tank/step.wav"); sound_windup = gi.soundindex("tank/tnkatck4.wav"); sound_strike = gi.soundindex("tank/tnkatck5.wav"); sound_sight = gi.soundindex("tank/sight1.wav"); gi.soundindex("tank/tnkatck1.wav"); gi.soundindex("tank/tnkatk2a.wav"); gi.soundindex("tank/tnkatk2b.wav"); gi.soundindex("tank/tnkatk2c.wav"); gi.soundindex("tank/tnkatk2d.wav"); gi.soundindex("tank/tnkatk2e.wav"); gi.soundindex("tank/tnkatck3.wav"); if (strcmp(self->classname, "monster_tank_commander") == 0) { self->health = 1000; self->gib_health = -225; } else { self->health = 750; self->gib_health = -200; } self->mass = 500; self->pain = tank_pain; self->die = tank_die; self->monsterinfo.stand = tank_stand; self->monsterinfo.walk = tank_walk; self->monsterinfo.run = tank_run; self->monsterinfo.dodge = NULL; self->monsterinfo.attack = tank_attack; self->monsterinfo.melee = NULL; self->monsterinfo.sight = tank_sight; self->monsterinfo.idle = tank_idle; gi.linkentity(self); self->monsterinfo.currentmove = &tank_move_stand; self->monsterinfo.scale = MODEL_SCALE; walkmonster_start(self); if (strcmp(self->classname, "monster_tank_commander") == 0) { self->s.skinnum = 2; } } xatrix-XATRIX_2_14/src/monster/tank/tank.h000066400000000000000000000174211477320050300204660ustar00rootroot00000000000000/* ======================================================================= * * Tank and Tank Commander animations. * * ======================================================================= */ #define FRAME_stand01 0 #define FRAME_stand02 1 #define FRAME_stand03 2 #define FRAME_stand04 3 #define FRAME_stand05 4 #define FRAME_stand06 5 #define FRAME_stand07 6 #define FRAME_stand08 7 #define FRAME_stand09 8 #define FRAME_stand10 9 #define FRAME_stand11 10 #define FRAME_stand12 11 #define FRAME_stand13 12 #define FRAME_stand14 13 #define FRAME_stand15 14 #define FRAME_stand16 15 #define FRAME_stand17 16 #define FRAME_stand18 17 #define FRAME_stand19 18 #define FRAME_stand20 19 #define FRAME_stand21 20 #define FRAME_stand22 21 #define FRAME_stand23 22 #define FRAME_stand24 23 #define FRAME_stand25 24 #define FRAME_stand26 25 #define FRAME_stand27 26 #define FRAME_stand28 27 #define FRAME_stand29 28 #define FRAME_stand30 29 #define FRAME_walk01 30 #define FRAME_walk02 31 #define FRAME_walk03 32 #define FRAME_walk04 33 #define FRAME_walk05 34 #define FRAME_walk06 35 #define FRAME_walk07 36 #define FRAME_walk08 37 #define FRAME_walk09 38 #define FRAME_walk10 39 #define FRAME_walk11 40 #define FRAME_walk12 41 #define FRAME_walk13 42 #define FRAME_walk14 43 #define FRAME_walk15 44 #define FRAME_walk16 45 #define FRAME_walk17 46 #define FRAME_walk18 47 #define FRAME_walk19 48 #define FRAME_walk20 49 #define FRAME_walk21 50 #define FRAME_walk22 51 #define FRAME_walk23 52 #define FRAME_walk24 53 #define FRAME_walk25 54 #define FRAME_attak101 55 #define FRAME_attak102 56 #define FRAME_attak103 57 #define FRAME_attak104 58 #define FRAME_attak105 59 #define FRAME_attak106 60 #define FRAME_attak107 61 #define FRAME_attak108 62 #define FRAME_attak109 63 #define FRAME_attak110 64 #define FRAME_attak111 65 #define FRAME_attak112 66 #define FRAME_attak113 67 #define FRAME_attak114 68 #define FRAME_attak115 69 #define FRAME_attak116 70 #define FRAME_attak117 71 #define FRAME_attak118 72 #define FRAME_attak119 73 #define FRAME_attak120 74 #define FRAME_attak121 75 #define FRAME_attak122 76 #define FRAME_attak201 77 #define FRAME_attak202 78 #define FRAME_attak203 79 #define FRAME_attak204 80 #define FRAME_attak205 81 #define FRAME_attak206 82 #define FRAME_attak207 83 #define FRAME_attak208 84 #define FRAME_attak209 85 #define FRAME_attak210 86 #define FRAME_attak211 87 #define FRAME_attak212 88 #define FRAME_attak213 89 #define FRAME_attak214 90 #define FRAME_attak215 91 #define FRAME_attak216 92 #define FRAME_attak217 93 #define FRAME_attak218 94 #define FRAME_attak219 95 #define FRAME_attak220 96 #define FRAME_attak221 97 #define FRAME_attak222 98 #define FRAME_attak223 99 #define FRAME_attak224 100 #define FRAME_attak225 101 #define FRAME_attak226 102 #define FRAME_attak227 103 #define FRAME_attak228 104 #define FRAME_attak229 105 #define FRAME_attak230 106 #define FRAME_attak231 107 #define FRAME_attak232 108 #define FRAME_attak233 109 #define FRAME_attak234 110 #define FRAME_attak235 111 #define FRAME_attak236 112 #define FRAME_attak237 113 #define FRAME_attak238 114 #define FRAME_attak301 115 #define FRAME_attak302 116 #define FRAME_attak303 117 #define FRAME_attak304 118 #define FRAME_attak305 119 #define FRAME_attak306 120 #define FRAME_attak307 121 #define FRAME_attak308 122 #define FRAME_attak309 123 #define FRAME_attak310 124 #define FRAME_attak311 125 #define FRAME_attak312 126 #define FRAME_attak313 127 #define FRAME_attak314 128 #define FRAME_attak315 129 #define FRAME_attak316 130 #define FRAME_attak317 131 #define FRAME_attak318 132 #define FRAME_attak319 133 #define FRAME_attak320 134 #define FRAME_attak321 135 #define FRAME_attak322 136 #define FRAME_attak323 137 #define FRAME_attak324 138 #define FRAME_attak325 139 #define FRAME_attak326 140 #define FRAME_attak327 141 #define FRAME_attak328 142 #define FRAME_attak329 143 #define FRAME_attak330 144 #define FRAME_attak331 145 #define FRAME_attak332 146 #define FRAME_attak333 147 #define FRAME_attak334 148 #define FRAME_attak335 149 #define FRAME_attak336 150 #define FRAME_attak337 151 #define FRAME_attak338 152 #define FRAME_attak339 153 #define FRAME_attak340 154 #define FRAME_attak341 155 #define FRAME_attak342 156 #define FRAME_attak343 157 #define FRAME_attak344 158 #define FRAME_attak345 159 #define FRAME_attak346 160 #define FRAME_attak347 161 #define FRAME_attak348 162 #define FRAME_attak349 163 #define FRAME_attak350 164 #define FRAME_attak351 165 #define FRAME_attak352 166 #define FRAME_attak353 167 #define FRAME_attak401 168 #define FRAME_attak402 169 #define FRAME_attak403 170 #define FRAME_attak404 171 #define FRAME_attak405 172 #define FRAME_attak406 173 #define FRAME_attak407 174 #define FRAME_attak408 175 #define FRAME_attak409 176 #define FRAME_attak410 177 #define FRAME_attak411 178 #define FRAME_attak412 179 #define FRAME_attak413 180 #define FRAME_attak414 181 #define FRAME_attak415 182 #define FRAME_attak416 183 #define FRAME_attak417 184 #define FRAME_attak418 185 #define FRAME_attak419 186 #define FRAME_attak420 187 #define FRAME_attak421 188 #define FRAME_attak422 189 #define FRAME_attak423 190 #define FRAME_attak424 191 #define FRAME_attak425 192 #define FRAME_attak426 193 #define FRAME_attak427 194 #define FRAME_attak428 195 #define FRAME_attak429 196 #define FRAME_pain101 197 #define FRAME_pain102 198 #define FRAME_pain103 199 #define FRAME_pain104 200 #define FRAME_pain201 201 #define FRAME_pain202 202 #define FRAME_pain203 203 #define FRAME_pain204 204 #define FRAME_pain205 205 #define FRAME_pain301 206 #define FRAME_pain302 207 #define FRAME_pain303 208 #define FRAME_pain304 209 #define FRAME_pain305 210 #define FRAME_pain306 211 #define FRAME_pain307 212 #define FRAME_pain308 213 #define FRAME_pain309 214 #define FRAME_pain310 215 #define FRAME_pain311 216 #define FRAME_pain312 217 #define FRAME_pain313 218 #define FRAME_pain314 219 #define FRAME_pain315 220 #define FRAME_pain316 221 #define FRAME_death101 222 #define FRAME_death102 223 #define FRAME_death103 224 #define FRAME_death104 225 #define FRAME_death105 226 #define FRAME_death106 227 #define FRAME_death107 228 #define FRAME_death108 229 #define FRAME_death109 230 #define FRAME_death110 231 #define FRAME_death111 232 #define FRAME_death112 233 #define FRAME_death113 234 #define FRAME_death114 235 #define FRAME_death115 236 #define FRAME_death116 237 #define FRAME_death117 238 #define FRAME_death118 239 #define FRAME_death119 240 #define FRAME_death120 241 #define FRAME_death121 242 #define FRAME_death122 243 #define FRAME_death123 244 #define FRAME_death124 245 #define FRAME_death125 246 #define FRAME_death126 247 #define FRAME_death127 248 #define FRAME_death128 249 #define FRAME_death129 250 #define FRAME_death130 251 #define FRAME_death131 252 #define FRAME_death132 253 #define FRAME_recln101 254 #define FRAME_recln102 255 #define FRAME_recln103 256 #define FRAME_recln104 257 #define FRAME_recln105 258 #define FRAME_recln106 259 #define FRAME_recln107 260 #define FRAME_recln108 261 #define FRAME_recln109 262 #define FRAME_recln110 263 #define FRAME_recln111 264 #define FRAME_recln112 265 #define FRAME_recln113 266 #define FRAME_recln114 267 #define FRAME_recln115 268 #define FRAME_recln116 269 #define FRAME_recln117 270 #define FRAME_recln118 271 #define FRAME_recln119 272 #define FRAME_recln120 273 #define FRAME_recln121 274 #define FRAME_recln122 275 #define FRAME_recln123 276 #define FRAME_recln124 277 #define FRAME_recln125 278 #define FRAME_recln126 279 #define FRAME_recln127 280 #define FRAME_recln128 281 #define FRAME_recln129 282 #define FRAME_recln130 283 #define FRAME_recln131 284 #define FRAME_recln132 285 #define FRAME_recln133 286 #define FRAME_recln134 287 #define FRAME_recln135 288 #define FRAME_recln136 289 #define FRAME_recln137 290 #define FRAME_recln138 291 #define FRAME_recln139 292 #define FRAME_recln140 293 #define MODEL_SCALE 1.000000 xatrix-XATRIX_2_14/src/player/000077500000000000000000000000001477320050300162235ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/player/client.c000066400000000000000000001255011477320050300176510ustar00rootroot00000000000000/* ======================================================================= * * Interface between client <-> game and client calculations. * * ======================================================================= */ #include "../header/local.h" #include "../monster/misc/player.h" void ClientUserinfoChanged(edict_t *ent, char *userinfo); void SP_misc_teleporter_dest(edict_t *ent); void Touch_Item(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf); void SP_FixCoopSpots(edict_t *self) { /* Entity number 292 is an unnamed info_player_start next to a named info_player_start. Delete it, if we're in coop since it screws up the spawnpoint selection heuristic in SelectCoopSpawnPoint(). This unnamed info_player_start is selected as spawnpoint for player 0, therefor none of the named info_coop_start() matches... */ if(Q_stricmp(level.mapname, "xware") == 0) { if (self->s.number == 292) { G_FreeEdict(self); self = NULL; } } } void SP_CreateCoopSpots(edict_t *self) { /* Necessary for savegame compatiblity */ } void SP_CreateUnnamedSpawn(edict_t *self) { /* Necessary for savegame compatiblity */ } /* * QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 32) * The normal starting point for a level. */ void SP_info_player_start(edict_t *self) { if (!self) { return; } if (!coop->value) { return; } /* Fix coop spawn points */ SP_FixCoopSpots(self); } /* * QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 32) * potential spawning position for deathmatch games */ void SP_info_player_deathmatch(edict_t *self) { if (!self) { return; } if (!deathmatch->value) { G_FreeEdict(self); return; } SP_misc_teleporter_dest(self); } /* * QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 32) * potential spawning position for coop games */ void SP_info_player_coop(edict_t *self) { if (!self) { return; } if (!coop->value) { G_FreeEdict(self); return; } } /* * QUAKED info_player_intermission (1 0 1) (-16 -16 -24) (16 16 32) * The deathmatch intermission point will be at one of these * Use 'angles' instead of 'angle', so you can set pitch or * roll as well as yaw. 'pitch yaw roll' */ void SP_info_player_intermission(edict_t *ent) { /* This function cannot be removed * since the info_player_intermission * needs a callback function. Like * every entity. */ } /* ======================================================================= */ void player_pain(edict_t *self /* unsued */, edict_t *other /* unused */, float kick /* unused */, int damage /* unused */) { /* Player pain is handled at the end * of the frame in P_DamageFeedback. * This function is still here since * the player is an entity and needs * a pain callback */ } qboolean IsFemale(edict_t *ent) { char *info; if (!ent) { return false; } if (!ent->client) { return false; } info = Info_ValueForKey(ent->client->pers.userinfo, "gender"); if ((info[0] == 'f') || (info[0] == 'F')) { return true; } return false; } qboolean IsNeutral(edict_t *ent) { char *info; if (!ent) { return false; } if (!ent->client) { return false; } info = Info_ValueForKey(ent->client->pers.userinfo, "gender"); if ((info[0] != 'f') && (info[0] != 'F') && (info[0] != 'm') && (info[0] != 'M')) { return true; } return false; } void ClientObituary(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker) { int mod; char *message; char *message2; qboolean ff; if (!self || !inflictor) { return; } if (coop->value && attacker->client) { meansOfDeath |= MOD_FRIENDLY_FIRE; } if (deathmatch->value || coop->value) { ff = meansOfDeath & MOD_FRIENDLY_FIRE; mod = meansOfDeath & ~MOD_FRIENDLY_FIRE; message = NULL; message2 = ""; switch (mod) { case MOD_SUICIDE: message = "suicides"; break; case MOD_FALLING: message = "cratered"; break; case MOD_CRUSH: message = "was squished"; break; case MOD_WATER: message = "sank like a rock"; break; case MOD_SLIME: message = "melted"; break; case MOD_LAVA: message = "does a back flip into the lava"; break; case MOD_EXPLOSIVE: case MOD_BARREL: message = "blew up"; break; case MOD_EXIT: message = "found a way out"; break; case MOD_TARGET_LASER: message = "saw the light"; break; case MOD_TARGET_BLASTER: message = "got blasted"; break; case MOD_BOMB: case MOD_SPLASH: case MOD_TRIGGER_HURT: message = "was in the wrong place"; break; case MOD_GEKK: case MOD_BRAINTENTACLE: message = "that's gotta hurt"; break; } if (attacker == self) { switch (mod) { case MOD_HELD_GRENADE: message = "tried to put the pin back in"; break; case MOD_HG_SPLASH: case MOD_G_SPLASH: if (IsNeutral(self)) { message = "tripped on its own grenade"; } else if (IsFemale(self)) { message = "tripped on her own grenade"; } else { message = "tripped on his own grenade"; } break; case MOD_R_SPLASH: if (IsNeutral(self)) { message = "blew itself up"; } else if (IsFemale(self)) { message = "blew herself up"; } else { message = "blew himself up"; } break; case MOD_BFG_BLAST: message = "should have used a smaller gun"; break; case MOD_TRAP: message = "sucked into his own trap"; break; default: if (IsNeutral(self)) { message = "killed itself"; } else if (IsFemale(self)) { message = "killed herself"; } else { message = "killed himself"; } break; } } if (message) { gi.bprintf(PRINT_MEDIUM, "%s %s.\n", self->client->pers.netname, message); if (deathmatch->value) { self->client->resp.score--; } self->enemy = NULL; return; } self->enemy = attacker; if (attacker && attacker->client) { switch (mod) { case MOD_BLASTER: message = "was blasted by"; break; case MOD_SHOTGUN: message = "was gunned down by"; break; case MOD_SSHOTGUN: message = "was blown away by"; message2 = "'s super shotgun"; break; case MOD_MACHINEGUN: message = "was machinegunned by"; break; case MOD_CHAINGUN: message = "was cut in half by"; message2 = "'s chaingun"; break; case MOD_GRENADE: message = "was popped by"; message2 = "'s grenade"; break; case MOD_G_SPLASH: message = "was shredded by"; message2 = "'s shrapnel"; break; case MOD_ROCKET: message = "ate"; message2 = "'s rocket"; break; case MOD_R_SPLASH: message = "almost dodged"; message2 = "'s rocket"; break; case MOD_HYPERBLASTER: message = "was melted by"; message2 = "'s hyperblaster"; break; case MOD_RAILGUN: message = "was railed by"; break; case MOD_BFG_LASER: message = "saw the pretty lights from"; message2 = "'s BFG"; break; case MOD_BFG_BLAST: message = "was disintegrated by"; message2 = "'s BFG blast"; break; case MOD_BFG_EFFECT: message = "couldn't hide from"; message2 = "'s BFG"; break; case MOD_HANDGRENADE: message = "caught"; message2 = "'s handgrenade"; break; case MOD_HG_SPLASH: message = "didn't see"; message2 = "'s handgrenade"; break; case MOD_HELD_GRENADE: message = "feels"; message2 = "'s pain"; break; case MOD_TELEFRAG: message = "tried to invade"; message2 = "'s personal space"; break; case MOD_RIPPER: message = "ripped to shreds by"; message2 = "'s ripper gun"; break; case MOD_PHALANX: message = "was evaporated by"; break; case MOD_TRAP: message = "caught in trap by"; break; } if (message) { gi.bprintf(PRINT_MEDIUM, "%s %s %s%s\n", self->client->pers.netname, message, attacker->client->pers.netname, message2); if (deathmatch->value) { if (ff) { attacker->client->resp.score--; } else { attacker->client->resp.score++; } } return; } } } gi.bprintf(PRINT_MEDIUM, "%s died.\n", self->client->pers.netname); if (deathmatch->value) { self->client->resp.score--; } } void TossClientWeapon(edict_t *self) { gitem_t *item; edict_t *drop; qboolean quad; qboolean quadfire; float spread; if (!self) { return; } if (!deathmatch->value) { return; } item = self->client->pers.weapon; if (!self->client->pers.inventory[self->client->ammo_index]) { item = NULL; } if (item && (strcmp(item->pickup_name, "Blaster") == 0)) { item = NULL; } if (!((int)(dmflags->value) & DF_QUAD_DROP)) { quad = false; } else { quad = (self->client->quad_framenum > (level.framenum + 10)); } if (!((int)(dmflags->value) & DF_QUADFIRE_DROP)) { quadfire = false; } else { quadfire = (self->client->quadfire_framenum > (level.framenum + 10)); } if (item && quad) { spread = 22.5; } else if (item && quadfire) { spread = 12.5; } else { spread = 0.0; } if (item) { self->client->v_angle[YAW] -= spread; drop = Drop_Item(self, item); self->client->v_angle[YAW] += spread; drop->spawnflags = DROPPED_PLAYER_ITEM; } if (quad) { self->client->v_angle[YAW] += spread; drop = Drop_Item(self, FindItemByClassname("item_quad")); self->client->v_angle[YAW] -= spread; drop->spawnflags |= DROPPED_PLAYER_ITEM; drop->touch = Touch_Item; drop->nextthink = level.time + (self->client->quad_framenum - level.framenum) * FRAMETIME; drop->think = G_FreeEdict; } if (quadfire) { self->client->v_angle[YAW] += spread; drop = Drop_Item(self, FindItemByClassname("item_quadfire")); self->client->v_angle[YAW] -= spread; drop->spawnflags |= DROPPED_PLAYER_ITEM; drop->touch = Touch_Item; drop->nextthink = level.time + (self->client->quadfire_framenum - level.framenum) * FRAMETIME; drop->think = G_FreeEdict; } } void LookAtKiller(edict_t *self, edict_t *inflictor, edict_t *attacker) { vec3_t dir; if (!self) { return; } if (attacker && (attacker != world) && (attacker != self)) { VectorSubtract(attacker->s.origin, self->s.origin, dir); } else if (inflictor && (inflictor != world) && (inflictor != self)) { VectorSubtract(inflictor->s.origin, self->s.origin, dir); } else { self->client->killer_yaw = self->s.angles[YAW]; return; } if (dir[0]) { self->client->killer_yaw = 180 / M_PI *atan2(dir[1], dir[0]); } else { self->client->killer_yaw = 0; if (dir[1] > 0) { self->client->killer_yaw = 90; } else if (dir[1] < 0) { self->client->killer_yaw = -90; } } if (self->client->killer_yaw < 0) { self->client->killer_yaw += 360; } } void player_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point /* unused */) { int n; if (!self || !inflictor || !attacker) { return; } VectorClear(self->avelocity); self->takedamage = DAMAGE_YES; self->movetype = MOVETYPE_TOSS; self->s.modelindex2 = 0; /* remove linked weapon model */ self->s.angles[0] = 0; self->s.angles[2] = 0; self->s.sound = 0; self->client->weapon_sound = 0; self->maxs[2] = -8; self->svflags |= SVF_DEADMONSTER; if (!self->deadflag) { self->client->respawn_time = level.time + 1.0; LookAtKiller(self, inflictor, attacker); self->client->ps.pmove.pm_type = PM_DEAD; ClientObituary(self, inflictor, attacker); TossClientWeapon(self); if (deathmatch->value) { Cmd_Help_f(self); /* show scores */ } /* clear inventory: this is kind of ugly, but it's how we want to handle keys in coop */ for (n = 0; n < game.num_items; n++) { if (coop->value && itemlist[n].flags & IT_KEY) { self->client->resp.coop_respawn.inventory[n] = self->client->pers.inventory[n]; } self->client->pers.inventory[n] = 0; } } /* remove powerups */ self->client->quad_framenum = 0; self->client->invincible_framenum = 0; self->client->breather_framenum = 0; self->client->enviro_framenum = 0; self->flags &= ~FL_POWER_ARMOR; self->client->quadfire_framenum = 0; if (self->health < -40) { /* gib (sound played at end of server frame) */ self->sounds = gi.soundindex("misc/udeath.wav"); for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } ThrowClientHead(self, damage); self->takedamage = DAMAGE_NO; } else { /* normal death */ if (!self->deadflag) { static int i; i = (i + 1) % 3; /* start a death animation */ self->client->anim_priority = ANIM_DEATH; if (self->client->ps.pmove.pm_flags & PMF_DUCKED) { self->s.frame = FRAME_crdeath1 - 1; self->client->anim_end = FRAME_crdeath5; } else { switch (i) { case 0: self->s.frame = FRAME_death101 - 1; self->client->anim_end = FRAME_death106; break; case 1: self->s.frame = FRAME_death201 - 1; self->client->anim_end = FRAME_death206; break; case 2: self->s.frame = FRAME_death301 - 1; self->client->anim_end = FRAME_death308; break; } } /* sound played at end of server frame */ if (!self->sounds) { self->sounds = gi.soundindex(va("*death%i.wav", (rand() % 4) + 1)); } } } self->deadflag = DEAD_DEAD; gi.linkentity(self); } /* ======================================================================= */ /* * This is only called when the game first * initializes in single player, but is called * after each death and level change in deathmatch */ void InitClientPersistant(gclient_t *client) { gitem_t *item; if (!client) { return; } memset(&client->pers, 0, sizeof(client->pers)); item = FindItem("Blaster"); client->pers.selected_item = ITEM_INDEX(item); client->pers.inventory[client->pers.selected_item] = 1; client->pers.weapon = item; client->pers.health = 100; client->pers.max_health = 100; client->pers.max_bullets = 200; client->pers.max_shells = 100; client->pers.max_rockets = 50; client->pers.max_grenades = 50; client->pers.max_cells = 200; client->pers.max_slugs = 50; client->pers.max_magslug = 50; client->pers.max_trap = 5; client->pers.connected = true; } void InitClientResp(gclient_t *client) { if (!client) { return; } memset(&client->resp, 0, sizeof(client->resp)); client->resp.enterframe = level.framenum; client->resp.coop_respawn = client->pers; } /* * Some information that should be persistant, like health, * is still stored in the edict structure, so it needs to * be mirrored out to the client structure before all the * edicts are wiped. */ void SaveClientData(void) { int i; edict_t *ent; for (i = 0; i < game.maxclients; i++) { ent = &g_edicts[1 + i]; if (!ent->inuse) { continue; } game.clients[i].pers.health = ent->health; game.clients[i].pers.max_health = ent->max_health; game.clients[i].pers.savedFlags = (ent->flags & (FL_GODMODE | FL_NOTARGET | FL_POWER_ARMOR)); if (coop->value) { game.clients[i].pers.score = ent->client->resp.score; } } } void FetchClientEntData(edict_t *ent) { if (!ent) { return; } ent->health = ent->client->pers.health; ent->max_health = ent->client->pers.max_health; ent->flags |= ent->client->pers.savedFlags; if (coop->value) { ent->client->resp.score = ent->client->pers.score; } } /* ======================================================================= */ /* * Returns the distance to the nearest * player from the given spot */ float PlayersRangeFromSpot(edict_t *spot) { edict_t *player; float bestplayerdistance; vec3_t v; int n; float playerdistance; if (!spot) { return 0; } bestplayerdistance = 9999999; for (n = 1; n <= maxclients->value; n++) { player = &g_edicts[n]; if (!player->inuse) { continue; } if (player->health <= 0) { continue; } VectorSubtract(spot->s.origin, player->s.origin, v); playerdistance = VectorLength(v); if (playerdistance < bestplayerdistance) { bestplayerdistance = playerdistance; } } return bestplayerdistance; } /* * go to a random point, but NOT the two * points closest to other players */ edict_t * SelectRandomDeathmatchSpawnPoint(void) { edict_t *spot, *spot1, *spot2; int count = 0; int selection; float range, range1, range2; spot = NULL; range1 = range2 = 99999; spot1 = spot2 = NULL; while ((spot = G_Find(spot, FOFS(classname), "info_player_deathmatch")) != NULL) { count++; range = PlayersRangeFromSpot(spot); if (range < range1) { range1 = range; spot1 = spot; } else if (range < range2) { range2 = range; spot2 = spot; } } if (!count) { return NULL; } if (count <= 2) { spot1 = spot2 = NULL; } else { count -= 2; } selection = rand() % count; spot = NULL; do { spot = G_Find(spot, FOFS(classname), "info_player_deathmatch"); if ((spot == spot1) || (spot == spot2)) { selection++; } } while (selection--); return spot; } edict_t * SelectFarthestDeathmatchSpawnPoint(void) { edict_t *bestspot; float bestdistance, bestplayerdistance; edict_t *spot; spot = NULL; bestspot = NULL; bestdistance = 0; while ((spot = G_Find(spot, FOFS(classname), "info_player_deathmatch")) != NULL) { bestplayerdistance = PlayersRangeFromSpot(spot); if (bestplayerdistance > bestdistance) { bestspot = spot; bestdistance = bestplayerdistance; } } if (bestspot) { return bestspot; } /* if there is a player just spawned on each and every start spot we have no choice to turn one into a telefrag meltdown */ spot = G_Find(NULL, FOFS(classname), "info_player_deathmatch"); return spot; } edict_t * SelectDeathmatchSpawnPoint(void) { if ((int)(dmflags->value) & DF_SPAWN_FARTHEST) { return SelectFarthestDeathmatchSpawnPoint(); } else { return SelectRandomDeathmatchSpawnPoint(); } } edict_t * SelectCoopSpawnPoint(edict_t *ent) { int index; edict_t *spot = NULL; char *target; if (!ent) { return NULL; } index = ent->client - game.clients; /* player 0 starts in normal player spawn point */ if (!index) { return NULL; } spot = NULL; /* assume there are four coop spots at each spawnpoint */ while (1) { spot = G_Find(spot, FOFS(classname), "info_player_coop"); if (!spot) { return NULL; /* we didn't have enough... */ } target = spot->targetname; if (!target) { target = ""; } if (Q_stricmp(game.spawnpoint, target) == 0) { /* this is a coop spawn point for one of the clients here */ index--; if (!index) { return spot; /* this is it */ } } } return spot; } /* * Chooses a player start, deathmatch start, coop start, etc */ void SelectSpawnPoint(edict_t *ent, vec3_t origin, vec3_t angles) { edict_t *spot = NULL; edict_t *coopspot = NULL; int dist; int index; int counter = 0; vec3_t d; if (!ent) { return; } if (deathmatch->value) { spot = SelectDeathmatchSpawnPoint(); } else if (coop->value) { spot = SelectCoopSpawnPoint(ent); } /* find a single player start spot */ if (!spot) { while ((spot = G_Find(spot, FOFS(classname), "info_player_start")) != NULL) { if (!game.spawnpoint[0] && !spot->targetname) { break; } if (!game.spawnpoint[0] || !spot->targetname) { continue; } if (Q_stricmp(game.spawnpoint, spot->targetname) == 0) { break; } } if (!spot) { if (!game.spawnpoint[0]) { /* there wasn't a spawnpoint without a target, so use any */ spot = G_Find(spot, FOFS(classname), "info_player_start"); } if (!spot) { gi.error("Couldn't find spawn point %s\n", game.spawnpoint); } } } /* If we are in coop and we didn't find a coop spawnpoint due to map bugs (not correctly connected or the map was loaded via console and thus no previously map is known to the client) use one in 550 units radius. */ if (coop->value) { index = ent->client - game.clients; if (Q_stricmp(spot->classname, "info_player_start") == 0 && index != 0) { while(counter < 3) { coopspot = G_Find(coopspot, FOFS(classname), "info_player_coop"); if (!coopspot) { break; } VectorSubtract(coopspot->s.origin, spot->s.origin, d); /* In xship the coop spawnpoints are farther away than in other maps. Quirk around this. Oh well... */ if (Q_stricmp(level.mapname, "xship") == 0) { dist = 2500; } else { dist = 550; } if ((VectorLength(d) < dist)) { if (index == counter) { spot = coopspot; break; } else { counter++; } } } } } VectorCopy(spot->s.origin, origin); origin[2] += 9; VectorCopy(spot->s.angles, angles); } /* ====================================================================== */ void InitBodyQue(void) { int i; edict_t *ent; level.body_que = 0; for (i = 0; i < BODY_QUEUE_SIZE; i++) { ent = G_Spawn(); ent->classname = "bodyque"; } } void body_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point /* unused */) { int n; if (!self) { return; } if (self->health < -40) { gi.sound(self, CHAN_BODY, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); for (n = 0; n < 4; n++) { ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); } self->s.origin[2] -= 48; ThrowClientHead(self, damage); self->takedamage = DAMAGE_NO; } } void CopyToBodyQue(edict_t *ent) { edict_t *body; if (!ent) { return; } /* grab a body que and cycle to the next one */ body = &g_edicts[(int)maxclients->value + level.body_que + 1]; level.body_que = (level.body_que + 1) % BODY_QUEUE_SIZE; gi.unlinkentity(ent); gi.unlinkentity(body); body->s = ent->s; body->s.number = body - g_edicts; body->svflags = ent->svflags; VectorCopy(ent->mins, body->mins); VectorCopy(ent->maxs, body->maxs); VectorCopy(ent->absmin, body->absmin); VectorCopy(ent->absmax, body->absmax); VectorCopy(ent->size, body->size); body->solid = ent->solid; body->clipmask = ent->clipmask; body->owner = ent->owner; body->movetype = ent->movetype; body->die = body_die; body->takedamage = DAMAGE_YES; gi.linkentity(body); } void respawn(edict_t *self) { if (!self) { return; } if (deathmatch->value || coop->value) { /* spectator's don't leave bodies */ if (self->movetype != MOVETYPE_NOCLIP) { CopyToBodyQue(self); } self->svflags &= ~SVF_NOCLIENT; PutClientInServer(self); /* add a teleportation effect */ self->s.event = EV_PLAYER_TELEPORT; /* hold in place briefly */ self->client->ps.pmove.pm_flags = PMF_TIME_TELEPORT; self->client->ps.pmove.pm_time = 14; self->client->respawn_time = level.time; return; } /* restart the entire server */ gi.AddCommandString("menu_loadgame\n"); } /* * only called when pers.spectator changes * note that resp.spectator should be the * opposite of pers.spectator here */ void spectator_respawn(edict_t *ent) { int i, numspec; if (!ent) { return; } /* if the user wants to become a spectator, make sure he doesn't exceed max_spectators */ if (ent->client->pers.spectator) { char *value = Info_ValueForKey(ent->client->pers.userinfo, "spectator"); if (*spectator_password->string && strcmp(spectator_password->string, "none") && strcmp(spectator_password->string, value)) { gi.cprintf(ent, PRINT_HIGH, "Spectator password incorrect.\n"); ent->client->pers.spectator = false; gi.WriteByte(svc_stufftext); gi.WriteString("spectator 0\n"); gi.unicast(ent, true); return; } /* count spectators */ for (i = 1, numspec = 0; i <= maxclients->value; i++) { if (g_edicts[i].inuse && g_edicts[i].client->pers.spectator) { numspec++; } } if (numspec >= maxspectators->value) { gi.cprintf(ent, PRINT_HIGH, "Server spectator limit is full."); ent->client->pers.spectator = false; /* reset his spectator var */ gi.WriteByte(svc_stufftext); gi.WriteString("spectator 0\n"); gi.unicast(ent, true); return; } } else { /* he was a spectator and wants to join the game he must have the right password */ char *value = Info_ValueForKey(ent->client->pers.userinfo, "password"); if (*password->string && strcmp(password->string, "none") && strcmp(password->string, value)) { gi.cprintf(ent, PRINT_HIGH, "Password incorrect.\n"); ent->client->pers.spectator = true; gi.WriteByte(svc_stufftext); gi.WriteString("spectator 1\n"); gi.unicast(ent, true); return; } } /* clear score on respawn */ ent->client->pers.score = ent->client->resp.score = 0; ent->svflags &= ~SVF_NOCLIENT; PutClientInServer(ent); /* add a teleportation effect */ if (!ent->client->pers.spectator) { /* send effect */ gi.WriteByte(svc_muzzleflash); gi.WriteShort(ent - g_edicts); gi.WriteByte(MZ_LOGIN); gi.multicast(ent->s.origin, MULTICAST_PVS); /* hold in place briefly */ ent->client->ps.pmove.pm_flags = PMF_TIME_TELEPORT; ent->client->ps.pmove.pm_time = 14; } ent->client->respawn_time = level.time; if (ent->client->pers.spectator) { gi.bprintf(PRINT_HIGH, "%s has moved to the sidelines\n", ent->client->pers.netname); } else { gi.bprintf(PRINT_HIGH, "%s joined the game\n", ent->client->pers.netname); } } /* ============================================================== */ /* * Called when a player connects to * a server or respawns in a deathmatch. */ void PutClientInServer(edict_t *ent) { vec3_t mins = {-16, -16, -24}; vec3_t maxs = {16, 16, 32}; int index; vec3_t spawn_origin, spawn_angles; gclient_t *client; int i; client_persistant_t saved; client_respawn_t resp; if (!ent) { return; } /* find a spawn point do it before setting health back up, so farthest ranging doesn't count this client */ SelectSpawnPoint(ent, spawn_origin, spawn_angles); index = ent - g_edicts - 1; client = ent->client; /* deathmatch wipes most client data every spawn */ if (deathmatch->value) { char userinfo[MAX_INFO_STRING]; resp = client->resp; memcpy(userinfo, client->pers.userinfo, sizeof(userinfo)); InitClientPersistant(client); ClientUserinfoChanged(ent, userinfo); } else if (coop->value) { char userinfo[MAX_INFO_STRING]; resp = client->resp; memcpy(userinfo, client->pers.userinfo, sizeof(userinfo)); resp.coop_respawn.game_helpchanged = client->pers.game_helpchanged; resp.coop_respawn.helpchanged = client->pers.helpchanged; client->pers = resp.coop_respawn; ClientUserinfoChanged(ent, userinfo); if (resp.score > client->pers.score) { client->pers.score = resp.score; } } else { memset(&resp, 0, sizeof(resp)); } /* clear everything but the persistant data */ saved = client->pers; memset(client, 0, sizeof(*client)); client->pers = saved; if (client->pers.health <= 0) { InitClientPersistant(client); } client->resp = resp; /* copy some data from the client to the entity */ FetchClientEntData(ent); /* clear entity values */ ent->groundentity = NULL; ent->client = &game.clients[index]; ent->takedamage = DAMAGE_AIM; ent->movetype = MOVETYPE_WALK; ent->viewheight = 22; ent->inuse = true; ent->classname = "player"; ent->mass = 200; ent->solid = SOLID_BBOX; ent->deadflag = DEAD_NO; ent->air_finished = level.time + 12; ent->clipmask = MASK_PLAYERSOLID; ent->model = "players/male/tris.md2"; ent->pain = player_pain; ent->die = player_die; ent->waterlevel = 0; ent->watertype = 0; ent->flags &= ~FL_NO_KNOCKBACK; ent->svflags = 0; VectorCopy(mins, ent->mins); VectorCopy(maxs, ent->maxs); VectorClear(ent->velocity); /* clear playerstate values */ memset(&ent->client->ps, 0, sizeof(client->ps)); client->ps.pmove.origin[0] = spawn_origin[0] * 8; client->ps.pmove.origin[1] = spawn_origin[1] * 8; client->ps.pmove.origin[2] = spawn_origin[2] * 8; if (deathmatch->value && ((int)dmflags->value & DF_FIXED_FOV)) { client->ps.fov = 90; } else { client->ps.fov = atoi(Info_ValueForKey(client->pers.userinfo, "fov")); if (client->ps.fov < 1) { client->ps.fov = 90; } else if (client->ps.fov > 160) { client->ps.fov = 160; } } client->ps.gunindex = gi.modelindex(client->pers.weapon->view_model); /* clear entity state values */ ent->s.effects = 0; ent->s.modelindex = 255; /* will use the skin specified model */ ent->s.modelindex2 = 255; /* custom gun model */ /* sknum is player num and weapon number weapon number will be added in changeweapon */ ent->s.skinnum = ent - g_edicts - 1; ent->s.frame = 0; VectorCopy(spawn_origin, ent->s.origin); ent->s.origin[2] += 1; /* make sure off ground */ VectorCopy(ent->s.origin, ent->s.old_origin); /* set the delta angle */ for (i = 0; i < 3; i++) { client->ps.pmove.delta_angles[i] = ANGLE2SHORT( spawn_angles[i] - client->resp.cmd_angles[i]); } ent->s.angles[PITCH] = 0; ent->s.angles[YAW] = spawn_angles[YAW]; ent->s.angles[ROLL] = 0; VectorCopy(ent->s.angles, client->ps.viewangles); VectorCopy(ent->s.angles, client->v_angle); /* spawn a spectator */ if (client->pers.spectator) { client->chase_target = NULL; client->resp.spectator = true; ent->movetype = MOVETYPE_NOCLIP; ent->solid = SOLID_NOT; ent->svflags |= SVF_NOCLIENT; ent->client->ps.gunindex = 0; gi.linkentity(ent); return; } else { client->resp.spectator = false; } if (!KillBox(ent)) { /* could't spawn in? */ } gi.linkentity(ent); /* force the current weapon up */ client->newweapon = client->pers.weapon; ChangeWeapon(ent); } /* * A client has just connected to the server in * deathmatch mode, so clear everything out before * starting them. */ void ClientBeginDeathmatch(edict_t *ent) { if (!ent) { return; } G_InitEdict(ent); InitClientResp(ent->client); /* locate ent at a spawn point */ PutClientInServer(ent); if (level.intermissiontime) { MoveClientToIntermission(ent); } else { /* send effect */ gi.WriteByte(svc_muzzleflash); gi.WriteShort(ent - g_edicts); gi.WriteByte(MZ_LOGIN); gi.multicast(ent->s.origin, MULTICAST_PVS); } gi.bprintf(PRINT_HIGH, "%s entered the game\n", ent->client->pers.netname); /* make sure all view stuff is valid */ ClientEndServerFrame(ent); } /* * called when a client has finished connecting, and is ready * to be placed into the game. This will happen every level load. */ void ClientBegin(edict_t *ent) { int i; if (!ent) { return; } ent->client = game.clients + (ent - g_edicts - 1); if (deathmatch->value) { ClientBeginDeathmatch(ent); return; } /* if there is already a body waiting for us (a loadgame), just take it, otherwise spawn one from scratch */ if (ent->inuse == true) { /* the client has cleared the client side viewangles upon connecting to the server, which is different than the state when the game is saved, so we need to compensate with deltaangles */ for (i = 0; i < 3; i++) { ent->client->ps.pmove.delta_angles[i] = ANGLE2SHORT( ent->client->ps.viewangles[i]); } } else { /* a spawn point will completely reinitialize the entity except for the persistant data that was initialized at ClientConnect() time */ G_InitEdict(ent); ent->classname = "player"; InitClientResp(ent->client); PutClientInServer(ent); } if (level.intermissiontime) { MoveClientToIntermission(ent); } else { /* send effect if in a multiplayer game */ if (game.maxclients > 1) { gi.WriteByte(svc_muzzleflash); gi.WriteShort(ent - g_edicts); gi.WriteByte(MZ_LOGIN); gi.multicast(ent->s.origin, MULTICAST_PVS); gi.bprintf(PRINT_HIGH, "%s entered the game\n", ent->client->pers.netname); } } /* make sure all view stuff is valid */ ClientEndServerFrame(ent); } /* * Called whenever the player updates a userinfo variable. * The game can override any of the settings in place * (forcing skins or names, etc) before copying it off. */ void ClientUserinfoChanged(edict_t *ent, char *userinfo) { char *s; int playernum; if (!ent || !userinfo) { return; } /* check for malformed or illegal info strings */ if (!Info_Validate(userinfo)) { strcpy(userinfo, "\\name\\badinfo\\skin\\male/grunt"); } /* set name */ s = Info_ValueForKey(userinfo, "name"); strncpy(ent->client->pers.netname, s, sizeof(ent->client->pers.netname) - 1); /* set spectator */ s = Info_ValueForKey(userinfo, "spectator"); /* spectators are only supported in deathmatch */ if (deathmatch->value && *s && strcmp(s, "0")) { ent->client->pers.spectator = true; } else { ent->client->pers.spectator = false; } /* set skin */ s = Info_ValueForKey(userinfo, "skin"); playernum = ent - g_edicts - 1; /* combine name and skin into a configstring */ gi.configstring(CS_PLAYERSKINS + playernum, va("%s\\%s", ent->client->pers.netname, s)); /* fov */ if (deathmatch->value && ((int)dmflags->value & DF_FIXED_FOV)) { ent->client->ps.fov = 90; } else { ent->client->ps.fov = atoi(Info_ValueForKey(userinfo, "fov")); if (ent->client->ps.fov < 1) { ent->client->ps.fov = 90; } else if (ent->client->ps.fov > 160) { ent->client->ps.fov = 160; } } /* handedness */ s = Info_ValueForKey(userinfo, "hand"); if (strlen(s)) { ent->client->pers.hand = atoi(s); } /* save off the userinfo in case we want to check something later */ strncpy(ent->client->pers.userinfo, userinfo, sizeof(ent->client->pers.userinfo) - 1); } /* * Called when a player begins connecting to the server. * The game can refuse entrance to a client by returning false. * If the client is allowed, the connection process will continue * and eventually get to ClientBegin(). Changing levels will NOT * cause this to be called again, but loadgames will. */ qboolean ClientConnect(edict_t *ent, char *userinfo) { char *value; if (!ent || !userinfo) { return false; } /* check to see if they are on the banned IP list */ value = Info_ValueForKey(userinfo, "ip"); if (SV_FilterPacket(value)) { Info_SetValueForKey(userinfo, "rejmsg", "Banned."); return false; } /* check for a spectator */ value = Info_ValueForKey(userinfo, "spectator"); if (deathmatch->value && *value && strcmp(value, "0")) { int i, numspec; if (*spectator_password->string && strcmp(spectator_password->string, "none") && strcmp(spectator_password->string, value)) { Info_SetValueForKey(userinfo, "rejmsg", "Spectator password required or incorrect."); return false; } /* count spectators */ for (i = numspec = 0; i < maxclients->value; i++) { if (g_edicts[i + 1].inuse && g_edicts[i + 1].client->pers.spectator) { numspec++; } } if (numspec >= maxspectators->value) { Info_SetValueForKey(userinfo, "rejmsg", "Server spectator limit is full."); return false; } } else { /* check for a password */ value = Info_ValueForKey(userinfo, "password"); if (*password->string && strcmp(password->string, "none") && strcmp(password->string, value)) { Info_SetValueForKey(userinfo, "rejmsg", "Password required or incorrect."); return false; } } /* they can connect */ ent->client = game.clients + (ent - g_edicts - 1); /* if there is already a body waiting for us (a loadgame), just take it, otherwise spawn one from scratch */ if (ent->inuse == false) { /* clear the respawning variables */ InitClientResp(ent->client); if (!game.autosaved || !ent->client->pers.weapon) { InitClientPersistant(ent->client); } } ClientUserinfoChanged(ent, userinfo); if (game.maxclients > 1) { gi.dprintf("%s connected\n", ent->client->pers.netname); } ent->svflags = 0; /* make sure we start with known default */ ent->client->pers.connected = true; return true; } /* * Called when a player drops from the server. * Will not be called between levels. */ void ClientDisconnect(edict_t *ent) { int playernum; if (!ent) { return; } if (!ent->client) { return; } gi.bprintf(PRINT_HIGH, "%s disconnected\n", ent->client->pers.netname); /* send effect */ gi.WriteByte(svc_muzzleflash); gi.WriteShort(ent - g_edicts); gi.WriteByte(MZ_LOGOUT); gi.multicast(ent->s.origin, MULTICAST_PVS); gi.unlinkentity(ent); ent->s.modelindex = 0; ent->solid = SOLID_NOT; ent->inuse = false; ent->classname = "disconnected"; ent->client->pers.connected = false; playernum = ent - g_edicts - 1; gi.configstring(CS_PLAYERSKINS + playernum, ""); } /* ============================================================== */ edict_t *pm_passent; /* pmove doesn't need to know about passent and contentmask */ trace_t PM_trace(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end) { if (pm_passent->health > 0) { return gi.trace(start, mins, maxs, end, pm_passent, MASK_PLAYERSOLID); } else { return gi.trace(start, mins, maxs, end, pm_passent, MASK_DEADSOLID); } } unsigned CheckBlock(void *b, int c) { int v, i; if (!b) { return 0; } v = 0; for (i = 0; i < c; i++) { v += ((byte *)b)[i]; } return v; } void PrintPmove(pmove_t *pm) { unsigned c1, c2; if (!pm) { return; } c1 = CheckBlock(&pm->s, sizeof(pm->s)); c2 = CheckBlock(&pm->cmd, sizeof(pm->cmd)); Com_Printf("sv %3i:%i %i\n", pm->cmd.impulse, c1, c2); } /* * This will be called once for each client frame, which will * usually be a couple times for each server frame. */ void ClientThink(edict_t *ent, usercmd_t *ucmd) { gclient_t *client; edict_t *other; int i, j; pmove_t pm; if (!ent || !ucmd) { return; } level.current_entity = ent; client = ent->client; if (level.intermissiontime) { client->ps.pmove.pm_type = PM_FREEZE; /* can exit intermission after five seconds */ if ((level.time > level.intermissiontime + 5.0) && (ucmd->buttons & BUTTON_ANY)) { level.exitintermission = true; } return; } pm_passent = ent; if (ent->client->chase_target) { client->resp.cmd_angles[0] = SHORT2ANGLE(ucmd->angles[0]); client->resp.cmd_angles[1] = SHORT2ANGLE(ucmd->angles[1]); client->resp.cmd_angles[2] = SHORT2ANGLE(ucmd->angles[2]); } else { /* set up for pmove */ memset(&pm, 0, sizeof(pm)); if (ent->movetype == MOVETYPE_NOCLIP) { client->ps.pmove.pm_type = PM_SPECTATOR; } else if (ent->s.modelindex != 255) { client->ps.pmove.pm_type = PM_GIB; } else if (ent->deadflag) { client->ps.pmove.pm_type = PM_DEAD; } else { client->ps.pmove.pm_type = PM_NORMAL; } client->ps.pmove.gravity = sv_gravity->value; pm.s = client->ps.pmove; for (i = 0; i < 3; i++) { pm.s.origin[i] = ent->s.origin[i] * 8; /* save to an int first, in case the short overflows * so we get defined behavior (at least with -fwrapv) */ int tmpVel = ent->velocity[i] * 8; pm.s.velocity[i] = tmpVel; } if (memcmp(&client->old_pmove, &pm.s, sizeof(pm.s))) { pm.snapinitial = true; } pm.cmd = *ucmd; pm.trace = PM_trace; /* adds default parms */ pm.pointcontents = gi.pointcontents; /* perform a pmove */ gi.Pmove(&pm); /* save results of pmove */ client->ps.pmove = pm.s; client->old_pmove = pm.s; for (i = 0; i < 3; i++) { ent->s.origin[i] = pm.s.origin[i] * 0.125; ent->velocity[i] = pm.s.velocity[i] * 0.125; } VectorCopy(pm.mins, ent->mins); VectorCopy(pm.maxs, ent->maxs); client->resp.cmd_angles[0] = SHORT2ANGLE(ucmd->angles[0]); client->resp.cmd_angles[1] = SHORT2ANGLE(ucmd->angles[1]); client->resp.cmd_angles[2] = SHORT2ANGLE(ucmd->angles[2]); if (ent->groundentity && !pm.groundentity && (pm.cmd.upmove >= 10) && (pm.waterlevel == 0)) { gi.sound(ent, CHAN_VOICE, gi.soundindex("*jump1.wav"), 1, ATTN_NORM, 0); PlayerNoise(ent, ent->s.origin, PNOISE_SELF); } ent->viewheight = pm.viewheight; ent->waterlevel = pm.waterlevel; ent->watertype = pm.watertype; ent->groundentity = pm.groundentity; if (pm.groundentity) { ent->groundentity_linkcount = pm.groundentity->linkcount; } if (ent->deadflag) { client->ps.viewangles[ROLL] = 40; client->ps.viewangles[PITCH] = -15; client->ps.viewangles[YAW] = client->killer_yaw; } else { VectorCopy(pm.viewangles, client->v_angle); VectorCopy(pm.viewangles, client->ps.viewangles); } gi.linkentity(ent); if (ent->movetype != MOVETYPE_NOCLIP) { G_TouchTriggers(ent); } /* touch other objects */ for (i = 0; i < pm.numtouch; i++) { other = pm.touchents[i]; for (j = 0; j < i; j++) { if (pm.touchents[j] == other) { break; } } if (j != i) { continue; /* duplicated */ } if (!other->touch) { continue; } other->touch(other, ent, NULL, NULL); } } client->oldbuttons = client->buttons; client->buttons = ucmd->buttons; client->latched_buttons |= client->buttons & ~client->oldbuttons; /* save light level the player is standing on for monster sighting AI */ ent->light_level = ucmd->lightlevel; /* fire weapon from final position if needed */ if (client->latched_buttons & BUTTON_ATTACK) { if (client->resp.spectator) { client->latched_buttons = 0; if (client->chase_target) { client->chase_target = NULL; client->ps.pmove.pm_flags &= ~PMF_NO_PREDICTION; } else { GetChaseTarget(ent); } } else if (!client->weapon_thunk) { client->weapon_thunk = true; Think_Weapon(ent); } } if (client->resp.spectator) { if (ucmd->upmove >= 10) { if (!(client->ps.pmove.pm_flags & PMF_JUMP_HELD)) { client->ps.pmove.pm_flags |= PMF_JUMP_HELD; if (client->chase_target) { ChaseNext(ent); } else { GetChaseTarget(ent); } } } else { client->ps.pmove.pm_flags &= ~PMF_JUMP_HELD; } } /* update chase cam if being followed */ for (i = 1; i <= maxclients->value; i++) { other = g_edicts + i; if (other->inuse && (other->client->chase_target == ent)) { UpdateChaseCam(other); } } } /* * This will be called once for each server frame, * before running any other entities in the world. */ void ClientBeginServerFrame(edict_t *ent) { gclient_t *client; int buttonMask; if (!ent) { return; } if (level.intermissiontime) { return; } client = ent->client; if (deathmatch->value && (client->pers.spectator != client->resp.spectator) && ((level.time - client->respawn_time) >= 5)) { spectator_respawn(ent); return; } /* run weapon animations if it hasn't been done by a ucmd_t */ if (!client->weapon_thunk && !client->resp.spectator) { Think_Weapon(ent); } else { client->weapon_thunk = false; } if (ent->deadflag) { /* wait for any button just going down */ if (level.time > client->respawn_time) { /* in deathmatch, only wait for attack button */ if (deathmatch->value) { buttonMask = BUTTON_ATTACK; } else { buttonMask = -1; } if ((client->latched_buttons & buttonMask) || (deathmatch->value && ((int)dmflags->value & DF_FORCE_RESPAWN))) { respawn(ent); client->latched_buttons = 0; } } return; } /* add player trail so monsters can follow */ if (!deathmatch->value) { if (!visible(ent, PlayerTrail_LastSpot())) { PlayerTrail_Add(ent->s.old_origin); } } client->latched_buttons = 0; } xatrix-XATRIX_2_14/src/player/hud.c000066400000000000000000000303071477320050300171520ustar00rootroot00000000000000/* ======================================================================= * * HUD, deathmatch scoreboard, help computer and intermission stuff. * * ======================================================================= */ #include "../header/local.h" void MoveClientToIntermission(edict_t *ent) { if (!ent) { return; } if (deathmatch->value || coop->value) { ent->client->showscores = true; } VectorCopy(level.intermission_origin, ent->s.origin); ent->client->ps.pmove.origin[0] = level.intermission_origin[0] * 8; ent->client->ps.pmove.origin[1] = level.intermission_origin[1] * 8; ent->client->ps.pmove.origin[2] = level.intermission_origin[2] * 8; VectorCopy(level.intermission_angle, ent->client->ps.viewangles); ent->client->ps.pmove.pm_type = PM_FREEZE; ent->client->ps.gunindex = 0; ent->client->ps.blend[3] = 0; ent->client->ps.rdflags &= ~RDF_UNDERWATER; /* clean up powerup info */ ent->client->quad_framenum = 0; ent->client->invincible_framenum = 0; ent->client->breather_framenum = 0; ent->client->enviro_framenum = 0; ent->client->grenade_blew_up = false; ent->client->grenade_time = 0; ent->client->quadfire_framenum = 0; ent->client->trap_blew_up = false; ent->client->trap_time = 0; ent->viewheight = 0; ent->s.modelindex = 0; ent->s.modelindex2 = 0; ent->s.modelindex3 = 0; ent->s.modelindex = 0; ent->s.effects = 0; ent->s.sound = 0; ent->solid = SOLID_NOT; gi.linkentity(ent); /* add the layout */ if (deathmatch->value || coop->value) { DeathmatchScoreboardMessage(ent, NULL); gi.unicast(ent, true); } } void BeginIntermission(edict_t *targ) { int i, n; edict_t *ent, *client; if (!targ) { return; } if (level.intermissiontime) { return; /* already activated */ } game.autosaved = false; /* respawn any dead clients */ for (i = 0; i < maxclients->value; i++) { client = g_edicts + 1 + i; if (!client->inuse) { continue; } if (client->health <= 0) { respawn(client); } } level.intermissiontime = level.time; level.changemap = targ->map; if (strstr(level.changemap, "*")) { if (coop->value) { for (i = 0; i < maxclients->value; i++) { client = g_edicts + 1 + i; if (!client->inuse) { continue; } /* strip players of all keys between units */ for (n = 0; n < game.num_items; n++) { if (itemlist[n].flags & IT_KEY) { client->client->pers.inventory[n] = 0; } } client->client->pers.power_cubes = 0; } } } else { if (!deathmatch->value) { level.exitintermission = 1; /* go immediately to the next level */ return; } } level.exitintermission = 0; /* find an intermission spot */ ent = G_Find(NULL, FOFS(classname), "info_player_intermission"); if (!ent) { /* the map creator forgot to put in an intermission point... */ ent = G_Find(NULL, FOFS(classname), "info_player_start"); if (!ent) { ent = G_Find(NULL, FOFS(classname), "info_player_deathmatch"); } } else { /* chose one of four spots */ i = rand() & 3; while (i--) { ent = G_Find(ent, FOFS(classname), "info_player_intermission"); if (!ent) /* wrap around the list */ { ent = G_Find(ent, FOFS(classname), "info_player_intermission"); } } } VectorCopy(ent->s.origin, level.intermission_origin); VectorCopy(ent->s.angles, level.intermission_angle); /* move all clients to the intermission point */ for (i = 0; i < maxclients->value; i++) { client = g_edicts + 1 + i; if (!client->inuse) { continue; } MoveClientToIntermission(client); } } void DeathmatchScoreboardMessage(edict_t *ent, edict_t *killer /* can be NULL */) { char entry[1024]; char string[1400]; int stringlength; int i, j, k; int sorted[MAX_CLIENTS]; int sortedscores[MAX_CLIENTS]; int score, total; int x, y; gclient_t *cl; edict_t *cl_ent; char *tag; if (!ent) { return; } /* sort the clients by score */ total = 0; for (i = 0; i < game.maxclients; i++) { cl_ent = g_edicts + 1 + i; if (!cl_ent->inuse || game.clients[i].resp.spectator) { continue; } score = game.clients[i].resp.score; for (j = 0; j < total; j++) { if (score > sortedscores[j]) { break; } } for (k = total; k > j; k--) { sorted[k] = sorted[k - 1]; sortedscores[k] = sortedscores[k - 1]; } sorted[j] = i; sortedscores[j] = score; total++; } /* print level name and exit rules */ string[0] = 0; stringlength = strlen(string); /* add the clients in sorted order */ if (total > 12) { total = 12; } for (i = 0; i < total; i++) { cl = &game.clients[sorted[i]]; cl_ent = g_edicts + 1 + sorted[i]; x = (i >= 6) ? 160 : 0; y = 32 + 32 * (i % 6); /* add a dogtag */ if (cl_ent == ent) { tag = "tag1"; } else if (cl_ent == killer) { tag = "tag2"; } else { tag = NULL; } if (tag) { Com_sprintf(entry, sizeof(entry), "xv %i yv %i picn %s ", x + 32, y, tag); j = strlen(entry); if (stringlength + j > 1024) { break; } strcpy(string + stringlength, entry); stringlength += j; } /* send the layout */ Com_sprintf(entry, sizeof(entry), "client %i %i %i %i %i %i ", x, y, sorted[i], cl->resp.score, cl->ping, (level.framenum - cl->resp.enterframe) / 600); j = strlen(entry); if (stringlength + j > 1024) { break; } strcpy(string + stringlength, entry); stringlength += j; } gi.WriteByte(svc_layout); gi.WriteString(string); } void HelpComputerMessage(edict_t *ent) { char string[1024]; char *sk; if (!ent) { return; } if (skill->value == SKILL_EASY) { sk = "easy"; } else if (skill->value == SKILL_MEDIUM) { sk = "medium"; } else if (skill->value == SKILL_HARD) { sk = "hard"; } else { sk = "hard+"; } /* send the layout */ Com_sprintf(string, sizeof(string), "xv 32 yv 8 picn help " /* background */ "xv 202 yv 12 string2 \"%s\" " /* skill */ "xv 0 yv 24 cstring2 \"%s\" " /* level name */ "xv 0 yv 54 cstring2 \"%s\" " /* help 1 */ "xv 0 yv 110 cstring2 \"%s\" " /* help 2 */ "xv 50 yv 164 string2 \" kills goals secrets\" " "xv 50 yv 172 string2 \"%3i/%3i %i/%i %i/%i\" ", sk, level.level_name, game.helpmessage1, game.helpmessage2, level.killed_monsters, level.total_monsters, level.found_goals, level.total_goals, level.found_secrets, level.total_secrets); gi.WriteByte(svc_layout); gi.WriteString(string); } void InventoryMessage(edict_t *ent) { int i; if (!ent) { return; } gi.WriteByte(svc_inventory); for (i = 0; i < MAX_ITEMS; i++) { gi.WriteShort(ent->client->pers.inventory[i]); } } /* ======================================================================= */ void G_SetStats(edict_t *ent) { gitem_t *item; int index, cells = 0; int power_armor_type; if (!ent) { return; } /* health */ ent->client->ps.stats[STAT_HEALTH_ICON] = level.pic_health; ent->client->ps.stats[STAT_HEALTH] = (ent->health < -99) ? -99 : ent->health; /* ammo */ if (!ent->client->ammo_index) { ent->client->ps.stats[STAT_AMMO_ICON] = 0; ent->client->ps.stats[STAT_AMMO] = 0; } else { item = &itemlist[ent->client->ammo_index]; ent->client->ps.stats[STAT_AMMO_ICON] = gi.imageindex(item->icon); ent->client->ps.stats[STAT_AMMO] = ent->client->pers.inventory[ent->client->ammo_index]; } cells = 0; /* armor */ power_armor_type = PowerArmorType(ent); if (power_armor_type) { cells = ent->client->pers.inventory[ITEM_INDEX(FindItem("cells"))]; if (cells == 0) { /* ran out of cells for power armor */ ent->flags &= ~FL_POWER_ARMOR; gi.sound(ent, CHAN_ITEM, gi.soundindex( "misc/power2.wav"), 1, ATTN_NORM, 0); power_armor_type = 0; } } index = ArmorIndex(ent); if (power_armor_type && (!index || (level.framenum & 8))) { /* flash between power armor and other armor icon */ ent->client->ps.stats[STAT_ARMOR_ICON] = gi.imageindex("i_powershield"); ent->client->ps.stats[STAT_ARMOR] = cells; } else if (index) { item = GetItemByIndex(index); ent->client->ps.stats[STAT_ARMOR_ICON] = gi.imageindex(item->icon); ent->client->ps.stats[STAT_ARMOR] = ent->client->pers.inventory[index]; } else { ent->client->ps.stats[STAT_ARMOR_ICON] = 0; ent->client->ps.stats[STAT_ARMOR] = 0; } /* pickup message */ if (level.time > ent->client->pickup_msg_time) { ent->client->ps.stats[STAT_PICKUP_ICON] = 0; ent->client->ps.stats[STAT_PICKUP_STRING] = 0; } /* timers */ if (ent->client->quad_framenum > level.framenum) { ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex("p_quad"); ent->client->ps.stats[STAT_TIMER] = (ent->client->quad_framenum - level.framenum) / 10; } else if (ent->client->quadfire_framenum > level.framenum) { ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex("p_quadfire"); ent->client->ps.stats[STAT_TIMER] = (ent->client->quadfire_framenum - level.framenum) / 10; } else if (ent->client->invincible_framenum > level.framenum) { ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex( "p_invulnerability"); ent->client->ps.stats[STAT_TIMER] = (ent->client->invincible_framenum - level.framenum) / 10; } else if (ent->client->enviro_framenum > level.framenum) { ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex("p_envirosuit"); ent->client->ps.stats[STAT_TIMER] = (ent->client->enviro_framenum - level.framenum) / 10; } else if (ent->client->breather_framenum > level.framenum) { ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex("p_rebreather"); ent->client->ps.stats[STAT_TIMER] = (ent->client->breather_framenum - level.framenum) / 10; } else { ent->client->ps.stats[STAT_TIMER_ICON] = 0; ent->client->ps.stats[STAT_TIMER] = 0; } /* selected item */ if (ent->client->pers.selected_item == -1) { ent->client->ps.stats[STAT_SELECTED_ICON] = 0; } else { ent->client->ps.stats[STAT_SELECTED_ICON] = gi.imageindex(itemlist[ent->client->pers.selected_item].icon); } ent->client->ps.stats[STAT_SELECTED_ITEM] = ent->client->pers.selected_item; /* layouts */ ent->client->ps.stats[STAT_LAYOUTS] = 0; if (deathmatch->value) { if ((ent->client->pers.health <= 0) || level.intermissiontime || ent->client->showscores) { ent->client->ps.stats[STAT_LAYOUTS] |= 1; } if (ent->client->showinventory && (ent->client->pers.health > 0)) { ent->client->ps.stats[STAT_LAYOUTS] |= 2; } } else { if (ent->client->showscores || ent->client->showhelp) { ent->client->ps.stats[STAT_LAYOUTS] |= 1; } if (ent->client->showinventory && (ent->client->pers.health > 0)) { ent->client->ps.stats[STAT_LAYOUTS] |= 2; } } /* frags */ ent->client->ps.stats[STAT_FRAGS] = ent->client->resp.score; /* help icon / current weapon if not shown */ if (ent->client->pers.helpchanged && (level.framenum & 8)) { ent->client->ps.stats[STAT_HELPICON] = gi.imageindex("i_help"); } else if (((ent->client->pers.hand == CENTER_HANDED) || (ent->client->ps.fov > 91)) && ent->client->pers.weapon) { cvar_t *gun; gun = gi.cvar("cl_gun", "2", 0); if (gun->value != 2) { ent->client->ps.stats[STAT_HELPICON] = gi.imageindex( ent->client->pers.weapon->icon); } else { ent->client->ps.stats[STAT_HELPICON] = 0; } } else { ent->client->ps.stats[STAT_HELPICON] = 0; } ent->client->ps.stats[STAT_SPECTATOR] = 0; } void G_CheckChaseStats(edict_t *ent) { int i; gclient_t *cl; if (!ent) { return; } for (i = 1; i <= maxclients->value; i++) { cl = g_edicts[i].client; if (!g_edicts[i].inuse || (cl->chase_target != ent)) { continue; } memcpy(cl->ps.stats, ent->client->ps.stats, sizeof(cl->ps.stats)); G_SetSpectatorStats(g_edicts + i); } } void G_SetSpectatorStats(edict_t *ent) { if (!ent) { return; } gclient_t *cl = ent->client; if (!cl->chase_target) { G_SetStats(ent); } cl->ps.stats[STAT_SPECTATOR] = 1; /* layouts are independant in spectator */ cl->ps.stats[STAT_LAYOUTS] = 0; if ((cl->pers.health <= 0) || level.intermissiontime || cl->showscores) { cl->ps.stats[STAT_LAYOUTS] |= 1; } if (cl->showinventory && (cl->pers.health > 0)) { cl->ps.stats[STAT_LAYOUTS] |= 2; } if (cl->chase_target && cl->chase_target->inuse) { cl->ps.stats[STAT_CHASE] = CS_PLAYERSKINS + (cl->chase_target - g_edicts) - 1; } else { cl->ps.stats[STAT_CHASE] = 0; } } xatrix-XATRIX_2_14/src/player/trail.c000066400000000000000000000043571477320050300175130ustar00rootroot00000000000000/* ======================================================================= * * The player trail, used by monsters to locate the player. * * ======================================================================= */ #include "../header/local.h" /* * This is a circular list containing the a list of points of where * the player has been recently. It is used by monsters for pursuit. * * .origin the spot * .owner forward link * .aiment backward link */ #define TRAIL_LENGTH 8 #define NEXT(n) (((n) + 1) & (TRAIL_LENGTH - 1)) #define PREV(n) (((n) - 1) & (TRAIL_LENGTH - 1)) edict_t *trail[TRAIL_LENGTH]; int trail_head; qboolean trail_active = false; void PlayerTrail_Init(void) { int n; if (deathmatch->value) { return; } for (n = 0; n < TRAIL_LENGTH; n++) { trail[n] = G_Spawn(); trail[n]->classname = "player_trail"; } trail_head = 0; trail_active = true; } void PlayerTrail_Add(vec3_t spot) { vec3_t temp; if (!trail_active) { return; } VectorCopy(spot, trail[trail_head]->s.origin); trail[trail_head]->timestamp = level.time; VectorSubtract(spot, trail[PREV(trail_head)]->s.origin, temp); trail[trail_head]->s.angles[1] = vectoyaw(temp); trail_head = NEXT(trail_head); } void PlayerTrail_New(vec3_t spot) { if (!trail_active) { return; } PlayerTrail_Init(); PlayerTrail_Add(spot); } edict_t * PlayerTrail_PickFirst(edict_t *self) { int marker; int n; if (!self) { return NULL; } if (!trail_active) { return NULL; } for (marker = trail_head, n = TRAIL_LENGTH; n; n--) { if (trail[marker]->timestamp <= self->monsterinfo.trail_time) { marker = NEXT(marker); } else { break; } } if (visible(self, trail[marker])) { return trail[marker]; } if (visible(self, trail[PREV(marker)])) { return trail[PREV(marker)]; } return trail[marker]; } edict_t * PlayerTrail_PickNext(edict_t *self) { int marker; int n; if (!self) { return NULL; } if (!trail_active) { return NULL; } for (marker = trail_head, n = TRAIL_LENGTH; n; n--) { if (trail[marker]->timestamp <= self->monsterinfo.trail_time) { marker = NEXT(marker); } else { break; } } return trail[marker]; } edict_t * PlayerTrail_LastSpot(void) { return trail[PREV(trail_head)]; } xatrix-XATRIX_2_14/src/player/view.c000066400000000000000000000675421477320050300173570ustar00rootroot00000000000000/* ======================================================================= * * The "camera" through which the player looks into the game. * * ======================================================================= */ #include "../header/local.h" #include "../monster/misc/player.h" static edict_t *current_player; static gclient_t *current_client; static vec3_t forward, right, up; float xyspeed; float bobmove; int bobcycle; /* odd cycles are right foot going forward */ float bobfracsin; /* sin(bobfrac*M_PI) */ float SV_CalcRoll(vec3_t angles, vec3_t velocity) { float sign; float side; float value; side = DotProduct(velocity, right); sign = side < 0 ? -1 : 1; side = fabs(side); value = sv_rollangle->value; if (side < sv_rollspeed->value) { side = side * value / sv_rollspeed->value; } else { side = value; } return side * sign; } /* * Handles color blends and view kicks */ void P_DamageFeedback(edict_t *player) { gclient_t *client; float side; float realcount, count, kick; vec3_t v; int r, l; static vec3_t power_color = {0.0, 1.0, 0.0}; static vec3_t acolor = {1.0, 1.0, 1.0}; static vec3_t bcolor = {1.0, 0.0, 0.0}; if (!player) { return; } /* death/gib sound is aggregated and played here */ if (player->sounds) { gi.sound (player, CHAN_VOICE, player->sounds, 1, ATTN_NORM, 0); player->sounds = 0; } client = player->client; /* flash the backgrounds behind the status numbers */ client->ps.stats[STAT_FLASHES] = 0; if (client->damage_blood) { client->ps.stats[STAT_FLASHES] |= 1; } if (client->damage_armor && !(player->flags & FL_GODMODE) && (client->invincible_framenum <= level.framenum)) { client->ps.stats[STAT_FLASHES] |= 2; } /* total points of damage shot at the player this frame */ count = (client->damage_blood + client->damage_armor + client->damage_parmor); if (count == 0) { return; /* didn't take any damage */ } /* start a pain animation if still in the player model */ if ((client->anim_priority < ANIM_PAIN) && (player->s.modelindex == 255)) { static int i; client->anim_priority = ANIM_PAIN; if (client->ps.pmove.pm_flags & PMF_DUCKED) { player->s.frame = FRAME_crpain1 - 1; client->anim_end = FRAME_crpain4; } else { i = (i + 1) % 3; switch (i) { case 0: player->s.frame = FRAME_pain101 - 1; client->anim_end = FRAME_pain104; break; case 1: player->s.frame = FRAME_pain201 - 1; client->anim_end = FRAME_pain204; break; case 2: player->s.frame = FRAME_pain301 - 1; client->anim_end = FRAME_pain304; break; } } } realcount = count; if (count < 10) { count = 10; /* always make a visible effect */ } /* play an apropriate pain sound */ if ((level.time > player->pain_debounce_time) && !(player->flags & FL_GODMODE) && (client->invincible_framenum <= level.framenum) && player->health > 0) { r = 1 + (rand() & 1); player->pain_debounce_time = level.time + 0.7; if (player->health < 25) { l = 25; } else if (player->health < 50) { l = 50; } else if (player->health < 75) { l = 75; } else { l = 100; } gi.sound(player, CHAN_VOICE, gi.soundindex(va("*pain%i_%i.wav", l, r)), 1, ATTN_NORM, 0); } /* the total alpha of the blend is always proportional to count */ if (client->damage_alpha < 0) { client->damage_alpha = 0; } client->damage_alpha += count * 0.01; if (client->damage_alpha < 0.2) { client->damage_alpha = 0.2; } if (client->damage_alpha > 0.6) { client->damage_alpha = 0.6; /* don't go too saturated */ } /* the color of the blend will vary based on how much was absorbed by different armors */ VectorClear(v); if (client->damage_parmor) { VectorMA(v, (float)client->damage_parmor / realcount, power_color, v); } if (client->damage_armor) { VectorMA(v, (float)client->damage_armor / realcount, acolor, v); } if (client->damage_blood) { VectorMA(v, (float)client->damage_blood / realcount, bcolor, v); } VectorCopy(v, client->damage_blend); /* calculate view angle kicks */ kick = abs(client->damage_knockback); if (kick && (player->health > 0)) /* kick of 0 means no view adjust at all */ { kick = kick * 100 / player->health; if (kick < count * 0.5) { kick = count * 0.5; } if (kick > 50) { kick = 50; } VectorSubtract(client->damage_from, player->s.origin, v); VectorNormalize(v); side = DotProduct(v, right); client->v_dmg_roll = kick * side * 0.3; side = -DotProduct(v, forward); client->v_dmg_pitch = kick * side * 0.3; client->v_dmg_time = level.time + DAMAGE_TIME; } /* clear totals */ client->damage_blood = 0; client->damage_armor = 0; client->damage_parmor = 0; client->damage_knockback = 0; } /* * Auto pitching on slopes? * * fall from 128: 400 = 160000 * fall from 256: 580 = 336400 * fall from 384: 720 = 518400 * fall from 512: 800 = 640000 * fall from 640: 960 = * * damage = deltavelocity*deltavelocity * 0.0001 */ void SV_CalcViewOffset(edict_t *ent) { float *angles; float bob; float ratio; float delta; vec3_t v; /* base angles */ angles = ent->client->ps.kick_angles; /* if dead, fix the angle and don't add any kick */ if (ent->deadflag) { VectorClear(angles); ent->client->ps.viewangles[ROLL] = 40; ent->client->ps.viewangles[PITCH] = -15; ent->client->ps.viewangles[YAW] = ent->client->killer_yaw; } else { /* add angles based on weapon kick */ VectorCopy(ent->client->kick_angles, angles); /* add angles based on damage kick */ ratio = (ent->client->v_dmg_time - level.time) / DAMAGE_TIME; if (ratio < 0) { ratio = 0; ent->client->v_dmg_pitch = 0; ent->client->v_dmg_roll = 0; } angles[PITCH] += ratio * ent->client->v_dmg_pitch; angles[ROLL] += ratio * ent->client->v_dmg_roll; /* add pitch based on fall kick */ ratio = (ent->client->fall_time - level.time) / FALL_TIME; if (ratio < 0) { ratio = 0; } angles[PITCH] += ratio * ent->client->fall_value; /* add angles based on velocity */ delta = DotProduct(ent->velocity, forward); angles[PITCH] += delta * run_pitch->value; delta = DotProduct(ent->velocity, right); angles[ROLL] += delta * run_roll->value; /* add angles based on bob */ delta = bobfracsin * bob_pitch->value * xyspeed; if (ent->client->ps.pmove.pm_flags & PMF_DUCKED) { delta *= 6; /* crouching */ } angles[PITCH] += delta; delta = bobfracsin * bob_roll->value * xyspeed; if (ent->client->ps.pmove.pm_flags & PMF_DUCKED) { delta *= 6; /* crouching */ } if (bobcycle & 1) { delta = -delta; } angles[ROLL] += delta; } /* base origin */ VectorClear(v); /* add view height */ v[2] += ent->viewheight; /* add fall height */ ratio = (ent->client->fall_time - level.time) / FALL_TIME; if (ratio < 0) { ratio = 0; } v[2] -= ratio * ent->client->fall_value * 0.4; /* add bob height */ bob = bobfracsin * xyspeed * bob_up->value; if (bob > 6) { bob = 6; } v[2] += bob; /* add kick offset */ VectorAdd(v, ent->client->kick_origin, v); /* absolutely bound offsets so the view can never be outside the player box */ if (v[0] < -14) { v[0] = -14; } else if (v[0] > 14) { v[0] = 14; } if (v[1] < -14) { v[1] = -14; } else if (v[1] > 14) { v[1] = 14; } if (v[2] < -22) { v[2] = -22; } else if (v[2] > 30) { v[2] = 30; } VectorCopy(v, ent->client->ps.viewoffset); } void SV_CalcGunOffset(edict_t *ent) { int i; float delta; if (!ent) { return; } /* gun angles from bobbing */ ent->client->ps.gunangles[ROLL] = xyspeed * bobfracsin * 0.005; ent->client->ps.gunangles[YAW] = xyspeed * bobfracsin * 0.01; if (bobcycle & 1) { ent->client->ps.gunangles[ROLL] = -ent->client->ps.gunangles[ROLL]; ent->client->ps.gunangles[YAW] = -ent->client->ps.gunangles[YAW]; } ent->client->ps.gunangles[PITCH] = xyspeed * bobfracsin * 0.005; /* gun angles from delta movement */ for (i = 0; i < 3; i++) { delta = ent->client->oldviewangles[i] - ent->client->ps.viewangles[i]; if (delta > 180) { delta -= 360; } if (delta < -180) { delta += 360; } if (delta > 45) { delta = 45; } if (delta < -45) { delta = -45; } if (i == YAW) { ent->client->ps.gunangles[ROLL] += 0.1 * delta; } ent->client->ps.gunangles[i] += 0.2 * delta; } /* gun height */ VectorClear(ent->client->ps.gunoffset); /* gun_x / gun_y / gun_z are development tools */ for (i = 0; i < 3; i++) { ent->client->ps.gunoffset[i] += forward[i] * (gun_y->value); ent->client->ps.gunoffset[i] += right[i] * gun_x->value; ent->client->ps.gunoffset[i] += up[i] * (-gun_z->value); } } void SV_AddBlend(float r, float g, float b, float a, float *v_blend) { float a2, a3; if (!v_blend) { return; } if (a <= 0) { return; } a2 = v_blend[3] + (1 - v_blend[3]) * a; /* new total alpha */ a3 = v_blend[3] / a2; /* fraction of color from old */ v_blend[0] = v_blend[0] * a3 + r * (1 - a3); v_blend[1] = v_blend[1] * a3 + g * (1 - a3); v_blend[2] = v_blend[2] * a3 + b * (1 - a3); v_blend[3] = a2; } void SV_CalcBlend(edict_t *ent) { int contents; vec3_t vieworg; int remaining; if (!ent) { return; } ent->client->ps.blend[0] = ent->client->ps.blend[1] = ent->client->ps.blend[2] = ent->client->ps.blend[3] = 0; /* add for contents */ VectorAdd(ent->s.origin, ent->client->ps.viewoffset, vieworg); contents = gi.pointcontents(vieworg); if (contents & (CONTENTS_LAVA | CONTENTS_SLIME | CONTENTS_WATER)) { ent->client->ps.rdflags |= RDF_UNDERWATER; } else { ent->client->ps.rdflags &= ~RDF_UNDERWATER; } if (contents & (CONTENTS_SOLID | CONTENTS_LAVA)) { SV_AddBlend(1.0, 0.3, 0.0, 0.6, ent->client->ps.blend); } else if (contents & CONTENTS_SLIME) { SV_AddBlend(0.0, 0.1, 0.05, 0.6, ent->client->ps.blend); } else if (contents & CONTENTS_WATER) { SV_AddBlend(0.5, 0.3, 0.2, 0.4, ent->client->ps.blend); } /* add for powerups */ if (ent->client->quad_framenum > level.framenum) { remaining = ent->client->quad_framenum - level.framenum; if (remaining == 30) /* beginning to fade */ { gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage2.wav"), 1, ATTN_NORM, 0); } if ((remaining > 30) || (remaining & 4)) { SV_AddBlend(0, 0, 1, 0.08, ent->client->ps.blend); } } else if (ent->client->quadfire_framenum > level.framenum) { remaining = ent->client->quadfire_framenum - level.framenum; if (remaining == 30) /* beginning to fade */ { gi.sound(ent, CHAN_ITEM, gi.soundindex("items/quadfire2.wav"), 1, ATTN_NORM, 0); } if ((remaining > 30) || (remaining & 4)) { SV_AddBlend(1, 0.2, 0.5, 0.08, ent->client->ps.blend); } } else if (ent->client->invincible_framenum > level.framenum) { remaining = ent->client->invincible_framenum - level.framenum; if (remaining == 30) /* beginning to fade */ { gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect2.wav"), 1, ATTN_NORM, 0); } if ((remaining > 30) || (remaining & 4)) { SV_AddBlend(1, 1, 0, 0.08, ent->client->ps.blend); } } else if (ent->client->enviro_framenum > level.framenum) { remaining = ent->client->enviro_framenum - level.framenum; if (remaining == 30) /* beginning to fade */ { gi.sound(ent, CHAN_ITEM, gi.soundindex("items/airout.wav"), 1, ATTN_NORM, 0); } if ((remaining > 30) || (remaining & 4)) { SV_AddBlend(0, 1, 0, 0.08, ent->client->ps.blend); } } else if (ent->client->breather_framenum > level.framenum) { remaining = ent->client->breather_framenum - level.framenum; if (remaining == 30) /* beginning to fade */ { gi.sound(ent, CHAN_ITEM, gi.soundindex("items/airout.wav"), 1, ATTN_NORM, 0); } if ((remaining > 30) || (remaining & 4)) { SV_AddBlend(0.4, 1, 0.4, 0.04, ent->client->ps.blend); } } /* add for damage */ if (ent->client->damage_alpha > 0) { SV_AddBlend(ent->client->damage_blend[0], ent->client->damage_blend[1], ent->client->damage_blend[2], ent->client->damage_alpha, ent->client->ps.blend); } if (ent->client->bonus_alpha > 0) { SV_AddBlend(0.85, 0.7, 0.3, ent->client->bonus_alpha, ent->client->ps.blend); } /* drop the damage value */ ent->client->damage_alpha -= 0.06; if (ent->client->damage_alpha < 0) { ent->client->damage_alpha = 0; } /* drop the bonus value */ ent->client->bonus_alpha -= 0.1; if (ent->client->bonus_alpha < 0) { ent->client->bonus_alpha = 0; } } void P_FallingDamage(edict_t *ent) { float delta; int damage; vec3_t dir; if (!ent) { return; } if (ent->s.modelindex != 255) { return; /* not in the player model */ } if (ent->movetype == MOVETYPE_NOCLIP) { return; } if ((ent->client->oldvelocity[2] < 0) && (ent->velocity[2] > ent->client->oldvelocity[2]) && (!ent->groundentity)) { delta = ent->client->oldvelocity[2]; } else { if (!ent->groundentity) { return; } delta = ent->velocity[2] - ent->client->oldvelocity[2]; } delta = delta * delta * 0.0001; /* never take falling damage if completely underwater */ if (ent->waterlevel == 3) { return; } if (ent->waterlevel == 2) { delta *= 0.25; } if (ent->waterlevel == 1) { delta *= 0.5; } if (delta < 1) { return; } if (delta < 15) { ent->s.event = EV_FOOTSTEP; return; } ent->client->fall_value = delta * 0.5; if (ent->client->fall_value > 40) { ent->client->fall_value = 40; } ent->client->fall_time = level.time + FALL_TIME; if (delta > 30) { if (ent->health > 0) { if (delta >= 55) { ent->s.event = EV_FALLFAR; } else { ent->s.event = EV_FALL; } } ent->pain_debounce_time = level.time; /* no normal pain sound */ damage = (delta - 30) / 2; if (damage < 1) { damage = 1; } VectorSet(dir, 0, 0, 1); if (!deathmatch->value || !((int)dmflags->value & DF_NO_FALLING)) { T_Damage(ent, world, world, dir, ent->s.origin, vec3_origin, damage, 0, 0, MOD_FALLING); } } else { ent->s.event = EV_FALLSHORT; return; } } void P_WorldEffects(void) { qboolean breather; qboolean envirosuit; int waterlevel, old_waterlevel; if (current_player->movetype == MOVETYPE_NOCLIP) { current_player->air_finished = level.time + 12; /* don't need air */ return; } waterlevel = current_player->waterlevel; old_waterlevel = current_client->old_waterlevel; current_client->old_waterlevel = waterlevel; breather = current_client->breather_framenum > level.framenum; envirosuit = current_client->enviro_framenum > level.framenum; /* if just entered a water volume, play a sound */ if (!old_waterlevel && waterlevel) { PlayerNoise(current_player, current_player->s.origin, PNOISE_SELF); if (current_player->watertype & CONTENTS_LAVA) { gi.sound(current_player, CHAN_BODY, gi.soundindex("player/lava_in.wav"), 1, ATTN_NORM, 0); } else if (current_player->watertype & CONTENTS_SLIME) { gi.sound(current_player, CHAN_BODY, gi.soundindex("player/watr_in.wav"), 1, ATTN_NORM, 0); } else if (current_player->watertype & CONTENTS_WATER) { gi.sound(current_player, CHAN_BODY, gi.soundindex("player/watr_in.wav"), 1, ATTN_NORM, 0); } current_player->flags |= FL_INWATER; /* clear damage_debounce, so the pain sound will play immediately */ current_player->damage_debounce_time = level.time - 1; } /* if just completely exited a water volume, play a sound */ if (old_waterlevel && !waterlevel) { PlayerNoise(current_player, current_player->s.origin, PNOISE_SELF); gi.sound(current_player, CHAN_BODY, gi.soundindex("player/watr_out.wav"), 1, ATTN_NORM, 0); current_player->flags &= ~FL_INWATER; } /* check for head just going under water */ if ((old_waterlevel != 3) && (waterlevel == 3)) { gi.sound(current_player, CHAN_BODY, gi.soundindex("player/watr_un.wav"), 1, ATTN_NORM, 0); } /* check for head just coming out of water */ if ((old_waterlevel == 3) && (waterlevel != 3)) { if (current_player->air_finished < level.time) { /* gasp for air */ gi.sound(current_player, CHAN_VOICE, gi.soundindex("player/gasp1.wav"), 1, ATTN_NORM, 0); PlayerNoise(current_player, current_player->s.origin, PNOISE_SELF); } else if (current_player->air_finished < level.time + 11) { /* just break surface */ gi.sound(current_player, CHAN_VOICE, gi.soundindex("player/gasp2.wav"), 1, ATTN_NORM, 0); } } /* check for drowning */ if (waterlevel == 3) { /* breather or envirosuit give air */ if (breather || envirosuit) { current_player->air_finished = level.time + 10; if (((int)(current_client->breather_framenum - level.framenum) % 25) == 0) { if (!current_client->breather_sound) { gi.sound(current_player, CHAN_AUTO, gi.soundindex("player/u_breath1.wav"), 1, ATTN_NORM, 0); } else { gi.sound(current_player, CHAN_AUTO, gi.soundindex("player/u_breath2.wav"), 1, ATTN_NORM, 0); } current_client->breather_sound ^= 1; PlayerNoise(current_player, current_player->s.origin, PNOISE_SELF); } } /* if out of air, start drowning */ if (current_player->air_finished < level.time) { /* drown! */ if ((current_player->client->next_drown_time < level.time) && (current_player->health > 0)) { current_player->client->next_drown_time = level.time + 1; /* take more damage the longer underwater */ current_player->dmg += 2; if (current_player->dmg > 15) { current_player->dmg = 15; } /* play a gurp sound instead of a normal pain sound */ if (current_player->health <= current_player->dmg) { gi.sound(current_player, CHAN_VOICE, gi.soundindex("player/drown1.wav"), 1, ATTN_NORM, 0); } else if (rand() & 1) { gi.sound(current_player, CHAN_VOICE, gi.soundindex("*gurp1.wav"), 1, ATTN_NORM, 0); } else { gi.sound(current_player, CHAN_VOICE, gi.soundindex("*gurp2.wav"), 1, ATTN_NORM, 0); } current_player->pain_debounce_time = level.time; T_Damage(current_player, world, world, vec3_origin, current_player->s.origin, vec3_origin, current_player->dmg, 0, DAMAGE_NO_ARMOR, MOD_WATER); } } } else { current_player->air_finished = level.time + 12; current_player->dmg = 2; } /* check for sizzle damage */ if (waterlevel && (current_player->watertype & (CONTENTS_LAVA | CONTENTS_SLIME))) { if (current_player->watertype & CONTENTS_LAVA) { if ((current_player->health > 0) && (current_player->pain_debounce_time <= level.time) && (current_client->invincible_framenum < level.framenum) && !(current_player->flags & FL_GODMODE)) { if (rand() & 1) { gi.sound(current_player, CHAN_VOICE, gi.soundindex("player/burn1.wav"), 1, ATTN_NORM, 0); } else { gi.sound(current_player, CHAN_VOICE, gi.soundindex("player/burn2.wav"), 1, ATTN_NORM, 0); } current_player->pain_debounce_time = level.time + 1; } if (envirosuit) /* take 1/3 damage with envirosuit */ { T_Damage(current_player, world, world, vec3_origin, current_player->s.origin, vec3_origin, 1 * waterlevel, 0, 0, MOD_LAVA); } else { T_Damage(current_player, world, world, vec3_origin, current_player->s.origin, vec3_origin, 3 * waterlevel, 0, 0, MOD_LAVA); } } if (current_player->watertype & CONTENTS_SLIME) { if (!envirosuit) { /* no damage from slime with envirosuit */ T_Damage(current_player, world, world, vec3_origin, current_player->s.origin, vec3_origin, 1 * waterlevel, 0, 0, MOD_SLIME); } } } } void G_SetClientEffects(edict_t *ent) { int pa_type; int remaining; if (!ent) { return; } ent->s.effects = 0; ent->s.renderfx = 0; if ((ent->health <= 0) || level.intermissiontime) { return; } if (ent->powerarmor_time > level.time) { pa_type = PowerArmorType(ent); if (pa_type == POWER_ARMOR_SCREEN) { ent->s.effects |= EF_POWERSCREEN; } else if (pa_type == POWER_ARMOR_SHIELD) { ent->s.effects |= EF_COLOR_SHELL; ent->s.renderfx |= RF_SHELL_GREEN; } } if (ent->client->quad_framenum > level.framenum) { remaining = ent->client->quad_framenum - level.framenum; if ((remaining > 30) || (remaining & 4)) { ent->s.effects |= EF_QUAD; } } if (ent->client->quadfire_framenum > level.framenum) { remaining = ent->client->quadfire_framenum - level.framenum; if ((remaining > 30) || (remaining & 4)) { ent->s.effects |= EF_QUAD; } } if (ent->client->invincible_framenum > level.framenum) { remaining = ent->client->invincible_framenum - level.framenum; if ((remaining > 30) || (remaining & 4)) { ent->s.effects |= EF_PENT; } } /* show cheaters!!! */ if (ent->flags & FL_GODMODE) { ent->s.effects |= EF_COLOR_SHELL; ent->s.renderfx |= (RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE); } } void G_SetClientEvent(edict_t *ent) { if (!ent) { return; } if (ent->s.event) { return; } if (ent->health <= 0) { return; } if (g_footsteps->value == 1) { if (ent->groundentity && (xyspeed > 225)) { if ((int)(current_client->bobtime + bobmove) != bobcycle) { ent->s.event = EV_FOOTSTEP; } } } else if (g_footsteps->value == 2) { if (ent->groundentity) { if ((int)(current_client->bobtime + bobmove) != bobcycle) { ent->s.event = EV_FOOTSTEP; } } } else if (g_footsteps->value >= 3) { if ((int)(current_client->bobtime + bobmove) != bobcycle) { ent->s.event = EV_FOOTSTEP; } } } void G_SetClientSound(edict_t *ent) { char *weap; if (!ent) { return; } if (ent->client->pers.game_helpchanged != game.helpchanged) { ent->client->pers.game_helpchanged = game.helpchanged; ent->client->pers.helpchanged = 1; } /* help beep (no more than three times) */ if (ent->client->pers.helpchanged && (ent->client->pers.helpchanged <= 3) && !(level.framenum & 63)) { ent->client->pers.helpchanged++; gi.sound(ent, CHAN_VOICE, gi.soundindex("misc/pc_up.wav"), 1, ATTN_STATIC, 0); } if (ent->client->pers.weapon) { weap = ent->client->pers.weapon->classname; } else { weap = ""; } if (ent->waterlevel && (ent->watertype & (CONTENTS_LAVA | CONTENTS_SLIME))) { ent->s.sound = snd_fry; } else if (strcmp(weap, "weapon_railgun") == 0) { ent->s.sound = gi.soundindex("weapons/rg_hum.wav"); } else if (strcmp(weap, "weapon_bfg") == 0) { ent->s.sound = gi.soundindex("weapons/bfg_hum.wav"); } else if (strcmp(weap, "weapon_phalanx") == 0) { ent->s.sound = gi.soundindex("weapons/phaloop.wav"); } else if (ent->client->weapon_sound) { ent->s.sound = ent->client->weapon_sound; } else { ent->s.sound = 0; } } void G_SetClientFrame(edict_t *ent) { gclient_t *client; qboolean duck, run; if (!ent) { return; } if (ent->s.modelindex != 255) { return; /* not in the player model */ } client = ent->client; if (client->ps.pmove.pm_flags & PMF_DUCKED) { duck = true; } else { duck = false; } if (xyspeed) { run = true; } else { run = false; } /* check for stand/duck and stop/go transitions */ if ((duck != client->anim_duck) && (client->anim_priority < ANIM_DEATH)) { goto newanim; } if ((run != client->anim_run) && (client->anim_priority == ANIM_BASIC)) { goto newanim; } if (!ent->groundentity && (client->anim_priority <= ANIM_WAVE)) { goto newanim; } if (client->anim_priority == ANIM_REVERSE) { if (ent->s.frame > client->anim_end) { ent->s.frame--; return; } } else if (ent->s.frame < client->anim_end) { /* continue an animation */ ent->s.frame++; return; } if (client->anim_priority == ANIM_DEATH) { return; /* stay there */ } if (client->anim_priority == ANIM_JUMP) { if (!ent->groundentity) { return; /* stay there */ } ent->client->anim_priority = ANIM_WAVE; ent->s.frame = FRAME_jump3; ent->client->anim_end = FRAME_jump6; return; } newanim: /* return to either a running or standing frame */ client->anim_priority = ANIM_BASIC; client->anim_duck = duck; client->anim_run = run; if (!ent->groundentity) { client->anim_priority = ANIM_JUMP; if (ent->s.frame != FRAME_jump2) { ent->s.frame = FRAME_jump1; } client->anim_end = FRAME_jump2; } else if (run) { /* running */ if (duck) { ent->s.frame = FRAME_crwalk1; client->anim_end = FRAME_crwalk6; } else { ent->s.frame = FRAME_run1; client->anim_end = FRAME_run6; } } else { /* standing */ if (duck) { ent->s.frame = FRAME_crstnd01; client->anim_end = FRAME_crstnd19; } else { ent->s.frame = FRAME_stand01; client->anim_end = FRAME_stand40; } } } /* * Called for each player at the end of * the server frame and right after spawning */ void ClientEndServerFrame(edict_t *ent) { float bobtime; int i; if (!ent) { return; } current_player = ent; current_client = ent->client; /* If the origin or velocity have changed since ClientThink(), update the pmove values. This will happen when the client is pushed by a bmodel or kicked by an explosion. If it wasn't updated here, the view position would lag a frame behind the body position when pushed -- "sinking into plats" */ for (i = 0; i < 3; i++) { current_client->ps.pmove.origin[i] = ent->s.origin[i] * 8.0; current_client->ps.pmove.velocity[i] = ent->velocity[i] * 8.0; } /* If the end of unit layout is displayed, don't give the player any normal movement attributes */ if (level.intermissiontime) { current_client->ps.blend[3] = 0; current_client->ps.fov = 90; G_SetStats(ent); return; } AngleVectors(ent->client->v_angle, forward, right, up); /* burn from lava, etc */ P_WorldEffects(); /* set model angles from view angles so other things in the world can tell which direction you are looking */ if (ent->client->v_angle[PITCH] > 180) { ent->s.angles[PITCH] = (-360 + ent->client->v_angle[PITCH]) / 3; } else { ent->s.angles[PITCH] = ent->client->v_angle[PITCH] / 3; } ent->s.angles[YAW] = ent->client->v_angle[YAW]; ent->s.angles[ROLL] = 0; ent->s.angles[ROLL] = SV_CalcRoll(ent->s.angles, ent->velocity) * 4; /* calculate speed and cycle to be used for all cyclic walking effects */ xyspeed = sqrt(ent->velocity[0] * ent->velocity[0] + ent->velocity[1] * ent->velocity[1]); if (xyspeed < 5) { bobmove = 0; current_client->bobtime = 0; /* start at beginning of cycle again */ } else if (ent->groundentity) { /* so bobbing only cycles when on ground */ if (xyspeed > 210) { bobmove = 0.25; } else if (xyspeed > 100) { bobmove = 0.125; } else { bobmove = 0.0625; } } bobtime = (current_client->bobtime += bobmove); if (current_client->ps.pmove.pm_flags & PMF_DUCKED) { bobtime *= 4; } bobcycle = (int)bobtime; bobfracsin = fabs(sin(bobtime * M_PI)); /* detect hitting the floor */ P_FallingDamage(ent); /* apply all the damage taken this frame */ P_DamageFeedback(ent); /* determine the view offsets */ SV_CalcViewOffset(ent); /* determine the gun offsets */ SV_CalcGunOffset(ent); /* determine the full screen color blend must be after viewoffset, so eye contents can be accurately determined */ SV_CalcBlend(ent); /* chase cam stuff */ if (ent->client->resp.spectator) { G_SetSpectatorStats(ent); } else { G_SetStats(ent); } G_CheckChaseStats(ent); G_SetClientEvent(ent); G_SetClientEffects(ent); G_SetClientSound(ent); G_SetClientFrame(ent); VectorCopy(ent->velocity, ent->client->oldvelocity); VectorCopy(ent->client->ps.viewangles, ent->client->oldviewangles); /* clear weapon kicks */ VectorClear(ent->client->kick_origin); VectorClear(ent->client->kick_angles); if (!(level.framenum & 31)) { /* if the scoreboard is up, update it */ if (ent->client->showscores) { DeathmatchScoreboardMessage(ent, ent->enemy); gi.unicast(ent, false); } /* if the help computer is up, update it */ if (ent->client->showhelp) { ent->client->pers.helpchanged = 0; HelpComputerMessage(ent); gi.unicast(ent, false); } } /* if the inventory is up, update it */ if (ent->client->showinventory) { InventoryMessage(ent); gi.unicast(ent, false); } } xatrix-XATRIX_2_14/src/player/weapon.c000066400000000000000000001342421477320050300176660ustar00rootroot00000000000000/* ======================================================================= * * Player weapons. * * ======================================================================= */ #include "../header/local.h" #include "../monster/misc/player.h" #include #define PLAYER_NOISE_SELF 0 #define PLAYER_NOISE_IMPACT 1 #define FRAME_FIRE_FIRST (FRAME_ACTIVATE_LAST + 1) #define FRAME_IDLE_FIRST (FRAME_FIRE_LAST + 1) #define FRAME_DEACTIVATE_FIRST (FRAME_IDLE_LAST + 1) #define GRENADE_TIMER 3.0 #define GRENADE_MINSPEED 400 #define GRENADE_MAXSPEED 800 #define TRAP_TIMER 5.0 #define TRAP_MINSPEED 300 #define TRAP_MAXSPEED 700 static qboolean is_quad; static qboolean is_quadfire; static byte is_silenced; void weapon_grenade_fire(edict_t *ent, qboolean held); void weapon_trap_fire(edict_t *ent, qboolean held); void P_ProjectSource(edict_t *ent, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result) { gclient_t *client = ent->client; float *point = ent->s.origin; vec3_t _distance; if (!client) { return; } VectorCopy(distance, _distance); if (client->pers.hand == LEFT_HANDED) { _distance[1] *= -1; } else if (client->pers.hand == CENTER_HANDED) { _distance[1] = 0; } G_ProjectSource(point, _distance, forward, right, result); // Berserker: fix - now the projectile hits exactly where the scope is pointing. if (aimfix->value) { vec3_t start, end; VectorSet(start, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] + ent->viewheight); VectorMA(start, 8192, forward, end); trace_t tr = gi.trace(start, NULL, NULL, end, ent, MASK_SHOT); if (tr.fraction < 1) { VectorSubtract(tr.endpos, result, forward); VectorNormalize(forward); } } } /* * Each player can have two noise objects associated with it: * a personal noise (jumping, pain, weapon firing), and a weapon * target noise (bullet wall impacts) * * Monsters that don't directly see the player can move * to a noise in hopes of seeing the player from there. */ static edict_t * PlayerNoise_Spawn(edict_t *who, int type) { edict_t *noise; if (!who) { return NULL; } noise = G_SpawnOptional(); if (!noise) { return NULL; } noise->classname = "player_noise"; noise->spawnflags = type; VectorSet (noise->mins, -8, -8, -8); VectorSet (noise->maxs, 8, 8, 8); noise->owner = who; noise->svflags = SVF_NOCLIENT; return noise; } static void PlayerNoise_Verify(edict_t *who) { edict_t *e; edict_t *n1; edict_t *n2; if (!who) { return; } n1 = who->mynoise; n2 = who->mynoise2; if (n1 && !n1->inuse) { n1 = NULL; } if (n2 && !n2->inuse) { n2 = NULL; } if (n1 && n2) { return; } for (e = g_edicts + 1 + game.maxclients; e < &g_edicts[globals.num_edicts]; e++) { if (!e->inuse || strcmp(e->classname, "player_noise") != 0) { continue; } if (e->owner && e->owner != who) { continue; } e->owner = who; if (!n2 && (e->spawnflags == PLAYER_NOISE_IMPACT || n1)) { n2 = e; } else { n1 = e; } if (n1 && n2) { break; } } if (!n1) { n1 = PlayerNoise_Spawn(who, PLAYER_NOISE_SELF); } if (!n2) { n2 = PlayerNoise_Spawn(who, PLAYER_NOISE_IMPACT); } who->mynoise = n1; who->mynoise2 = n2; } void PlayerNoise(edict_t *who, vec3_t where, int type) { edict_t *noise; if (!who || !who->client) { return; } if (type == PNOISE_WEAPON) { if (who->client->silencer_shots) { who->client->silencer_shots--; return; } } if (deathmatch->value) { return; } if (who->flags & FL_NOTARGET) { return; } PlayerNoise_Verify(who); if ((type == PNOISE_SELF) || (type == PNOISE_WEAPON)) { if (level.framenum <= (level.sound_entity_framenum + 3)) { return; } if (!who->mynoise) { return; } noise = who->mynoise; level.sound_entity = noise; level.sound_entity_framenum = level.framenum; } else { if (level.framenum <= (level.sound2_entity_framenum + 3)) { return; } if (!who->mynoise2) { return; } noise = who->mynoise2; level.sound2_entity = noise; level.sound2_entity_framenum = level.framenum; } VectorCopy(where, noise->s.origin); VectorSubtract(where, noise->maxs, noise->absmin); VectorAdd(where, noise->maxs, noise->absmax); noise->last_sound_time = level.time; gi.linkentity(noise); } qboolean Pickup_Weapon(edict_t *ent, edict_t *other) { int index; gitem_t *ammo; if (!ent || !other) { return false; } index = ITEM_INDEX(ent->item); if ((((int)(dmflags->value) & DF_WEAPONS_STAY) || coop->value) && other->client->pers.inventory[index]) { if (!(ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)) && (!coop_pickup_weapons->value || (ent->flags & FL_COOP_TAKEN))) { return false; /* leave the weapon for others to pickup */ } } other->client->pers.inventory[index]++; if (!(ent->spawnflags & DROPPED_ITEM)) { /* give them some ammo with it */ ammo = FindItem(ent->item->ammo); /* Don't get infinite ammo with trap */ if (((int)dmflags->value & DF_INFINITE_AMMO) && Q_stricmp(ent->item->pickup_name, "ammo_trap")) { Add_Ammo(other, ammo, 1000); } else { Add_Ammo(other, ammo, ammo->quantity); } if (!(ent->spawnflags & DROPPED_PLAYER_ITEM)) { if (deathmatch->value) { if ((int)(dmflags->value) & DF_WEAPONS_STAY) { ent->flags |= FL_RESPAWN; } else { SetRespawn(ent, 30); } } if (coop->value) { ent->flags |= FL_RESPAWN; ent->flags |= FL_COOP_TAKEN; } } } if ((other->client->pers.weapon != ent->item) && (other->client->pers.inventory[index] == 1) && (!deathmatch->value || (other->client->pers.weapon == FindItem("blaster")))) { other->client->newweapon = ent->item; } return true; } /* * The old weapon has been dropped all the * way, so make the new one current */ void ChangeWeapon(edict_t *ent) { int i; if (!ent) { return; } if (ent->client->grenade_time) { ent->client->grenade_time = level.time; ent->client->weapon_sound = 0; weapon_grenade_fire(ent, false); ent->client->grenade_time = 0; } ent->client->pers.lastweapon = ent->client->pers.weapon; ent->client->pers.weapon = ent->client->newweapon; ent->client->newweapon = NULL; ent->client->machinegun_shots = 0; /* set visible model */ if (ent->s.modelindex == 255) { if (ent->client->pers.weapon) { i = ((ent->client->pers.weapon->weapmodel & 0xff) << 8); } else { i = 0; } ent->s.skinnum = (ent - g_edicts - 1) | i; } if (ent->client->pers.weapon && ent->client->pers.weapon->ammo) { ent->client->ammo_index = ITEM_INDEX(FindItem(ent->client->pers.weapon->ammo)); } else { ent->client->ammo_index = 0; } if (!ent->client->pers.weapon) { /* dead */ ent->client->ps.gunindex = 0; return; } ent->client->weaponstate = WEAPON_ACTIVATING; ent->client->ps.gunframe = 0; ent->client->ps.gunindex = gi.modelindex( ent->client->pers.weapon->view_model); ent->client->anim_priority = ANIM_PAIN; if (ent->client->ps.pmove.pm_flags & PMF_DUCKED) { ent->s.frame = FRAME_crpain1; ent->client->anim_end = FRAME_crpain4; } else { ent->s.frame = FRAME_pain301; ent->client->anim_end = FRAME_pain304; } } void NoAmmoWeaponChange(edict_t *ent) { if (ent->client->pers.inventory[ITEM_INDEX(FindItem("slugs"))] && ent->client->pers.inventory[ITEM_INDEX(FindItem("railgun"))]) { ent->client->newweapon = FindItem("railgun"); return; } if (ent->client->pers.inventory[ITEM_INDEX(FindItem("cells"))] > 1 && ent->client->pers.inventory[ITEM_INDEX(FindItem("ionripper"))]) { ent->client->newweapon = FindItem("ionripper"); return; } if (ent->client->pers.inventory[ITEM_INDEX(FindItem("cells"))] && ent->client->pers.inventory[ITEM_INDEX(FindItem("hyperblaster"))]) { ent->client->newweapon = FindItem("hyperblaster"); return; } if (ent->client->pers.inventory[ITEM_INDEX(FindItem("bullets"))] && ent->client->pers.inventory[ITEM_INDEX(FindItem("chaingun"))]) { ent->client->newweapon = FindItem("chaingun"); return; } if (ent->client->pers.inventory[ITEM_INDEX(FindItem("bullets"))] && ent->client->pers.inventory[ITEM_INDEX(FindItem("machinegun"))]) { ent->client->newweapon = FindItem("machinegun"); return; } if ((ent->client->pers.inventory[ITEM_INDEX(FindItem("shells"))] > 1) && ent->client->pers.inventory[ITEM_INDEX(FindItem("super shotgun"))]) { ent->client->newweapon = FindItem("super shotgun"); return; } if (ent->client->pers.inventory[ITEM_INDEX(FindItem("shells"))] && ent->client->pers.inventory[ITEM_INDEX(FindItem("shotgun"))]) { ent->client->newweapon = FindItem("shotgun"); return; } ent->client->newweapon = FindItem("blaster"); } /* * Called by ClientBeginServerFrame and ClientThink */ void Think_Weapon(edict_t *ent) { if (!ent) { return; } /* if just died, put the weapon away */ if (ent->health < 1) { ent->client->newweapon = NULL; ChangeWeapon(ent); } /* call active weapon think routine */ if (ent->client->pers.weapon && ent->client->pers.weapon->weaponthink) { is_quad = (ent->client->quad_framenum > level.framenum); is_quadfire = (ent->client->quadfire_framenum > level.framenum); if (ent->client->silencer_shots) { is_silenced = MZ_SILENCED; } else { is_silenced = 0; } ent->client->pers.weapon->weaponthink(ent); } } /* * Client (player) animation for changing weapon */ static void Change_Weap_Animation(edict_t *ent) { if (!ent) { return; } ent->client->anim_priority = ANIM_REVERSE; if (ent->client->ps.pmove.pm_flags & PMF_DUCKED) { ent->s.frame = FRAME_crpain4 + 1; ent->client->anim_end = FRAME_crpain1; } else { ent->s.frame = FRAME_pain304 + 1; ent->client->anim_end = FRAME_pain301; } } /* * Make the weapon ready if there is ammo */ void Use_Weapon(edict_t *ent, gitem_t *item) { int ammo_index; gitem_t *ammo_item; if (!ent || !item) { return; } /* see if we're already using it */ if (item == ent->client->pers.weapon) { return; } if (item->ammo && !g_select_empty->value && !(item->flags & IT_AMMO)) { ammo_item = FindItem(item->ammo); ammo_index = ITEM_INDEX(ammo_item); if (!ent->client->pers.inventory[ammo_index]) { gi.cprintf(ent, PRINT_HIGH, "No %s for %s.\n", ammo_item->pickup_name, item->pickup_name); return; } if (ent->client->pers.inventory[ammo_index] < item->quantity) { gi.cprintf(ent, PRINT_HIGH, "Not enough %s for %s.\n", ammo_item->pickup_name, item->pickup_name); return; } } /* change to this weapon when down */ ent->client->newweapon = item; } void Use_Weapon2(edict_t *ent, gitem_t *item) { int ammo_index; gitem_t *ammo_item; gitem_t *nextitem; int index; if (!ent || !item) { return; } if (strcmp(item->pickup_name, "HyperBlaster") == 0) { if (item == ent->client->pers.weapon) { item = FindItem("Ionripper"); index = ITEM_INDEX(item); if (!ent->client->pers.inventory[index]) { item = FindItem("HyperBlaster"); } } } else if (strcmp(item->pickup_name, "Railgun") == 0) { ammo_item = FindItem(item->ammo); ammo_index = ITEM_INDEX(ammo_item); if (!ent->client->pers.inventory[ammo_index]) { nextitem = FindItem("Phalanx"); ammo_item = FindItem(nextitem->ammo); ammo_index = ITEM_INDEX(ammo_item); if (ent->client->pers.inventory[ammo_index]) { item = FindItem("Phalanx"); index = ITEM_INDEX(item); if (!ent->client->pers.inventory[index]) { item = FindItem("Railgun"); } } } else if (item == ent->client->pers.weapon) { item = FindItem("Phalanx"); index = ITEM_INDEX(item); if (!ent->client->pers.inventory[index]) { item = FindItem("Railgun"); } } } /* see if we're already using it */ if (item == ent->client->pers.weapon) { return; } if (item->ammo) { ammo_item = FindItem(item->ammo); ammo_index = ITEM_INDEX(ammo_item); if (!ent->client->pers.inventory[ammo_index] && !g_select_empty->value) { gi.cprintf(ent, PRINT_HIGH, "No %s for %s.\n", ammo_item->pickup_name, item->pickup_name); return; } } /* change to this weapon when down */ ent->client->newweapon = item; } void Drop_Weapon(edict_t *ent, gitem_t *item) { int index; if (!ent || !item) { return; } if ((int)(dmflags->value) & DF_WEAPONS_STAY) { return; } index = ITEM_INDEX(item); /* see if we're already using it */ if (((item == ent->client->pers.weapon) || (item == ent->client->newweapon)) && (ent->client->pers.inventory[index] == 1)) { gi.cprintf(ent, PRINT_HIGH, "Can't drop current weapon\n"); return; } Drop_Item(ent, item); ent->client->pers.inventory[index]--; } /* * A generic function to handle the basics of weapon thinking */ void Weapon_Generic(edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int FRAME_IDLE_LAST, int FRAME_DEACTIVATE_LAST, int *pause_frames, int *fire_frames, void (*fire)(edict_t *ent)) { int n; const unsigned short int change_speed = (g_swap_speed->value > 1)? (g_swap_speed->value < USHRT_MAX)? (unsigned short int)g_swap_speed->value : 1 : 1; if (!ent || !fire_frames || !fire) { return; } if (ent->deadflag || (ent->s.modelindex != 255)) /* VWep animations screw up corpses */ { return; } if (ent->client->weaponstate == WEAPON_DROPPING) { if (ent->client->ps.gunframe >= FRAME_DEACTIVATE_LAST - change_speed + 1) { ChangeWeapon(ent); return; } else if ( (FRAME_DEACTIVATE_LAST - FRAME_DEACTIVATE_FIRST) >= (4 * change_speed) ) { unsigned short int remainder = FRAME_DEACTIVATE_LAST - ent->client->ps.gunframe; // "if (remainder == 4)" at change_speed == 1 if ( ( remainder <= (4 * change_speed) ) && ( remainder > (3 * change_speed) ) ) { Change_Weap_Animation(ent); } } ent->client->ps.gunframe += change_speed; return; } if (ent->client->weaponstate == WEAPON_ACTIVATING) { if (ent->client->ps.gunframe >= FRAME_ACTIVATE_LAST - change_speed + 1) { ent->client->weaponstate = WEAPON_READY; ent->client->ps.gunframe = FRAME_IDLE_FIRST; return; } ent->client->ps.gunframe += change_speed; return; } if ((ent->client->newweapon) && (ent->client->weaponstate != WEAPON_FIRING)) { ent->client->weaponstate = WEAPON_DROPPING; ent->client->ps.gunframe = FRAME_DEACTIVATE_FIRST; if ( (FRAME_DEACTIVATE_LAST - FRAME_DEACTIVATE_FIRST) < (4 * change_speed) ) { Change_Weap_Animation(ent); } return; } if (ent->client->weaponstate == WEAPON_READY) { if (((ent->client->latched_buttons | ent->client->buttons) & BUTTON_ATTACK)) { ent->client->latched_buttons &= ~BUTTON_ATTACK; if ((!ent->client->ammo_index) || (ent->client->pers.inventory[ent->client->ammo_index] >= ent->client->pers.weapon->quantity)) { ent->client->ps.gunframe = FRAME_FIRE_FIRST; ent->client->weaponstate = WEAPON_FIRING; /* start the animation */ ent->client->anim_priority = ANIM_ATTACK; if (ent->client->ps.pmove.pm_flags & PMF_DUCKED) { ent->s.frame = FRAME_crattak1 - 1; ent->client->anim_end = FRAME_crattak9; } else { ent->s.frame = FRAME_attack1 - 1; ent->client->anim_end = FRAME_attack8; } } else { if (level.time >= ent->pain_debounce_time) { gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0); ent->pain_debounce_time = level.time + 1; } NoAmmoWeaponChange(ent); } } else { if (ent->client->ps.gunframe == FRAME_IDLE_LAST) { ent->client->ps.gunframe = FRAME_IDLE_FIRST; return; } if (pause_frames) { for (n = 0; pause_frames[n]; n++) { if (ent->client->ps.gunframe == pause_frames[n]) { if (rand() & 15) { return; } } } } ent->client->ps.gunframe++; return; } } if (ent->client->weaponstate == WEAPON_FIRING) { for (n = 0; fire_frames[n]; n++) { if (ent->client->ps.gunframe == fire_frames[n]) { if (ent->client->quad_framenum > level.framenum) { gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage3.wav"), 1, ATTN_NORM, 0); } fire(ent); break; } } if (!fire_frames[n]) { ent->client->ps.gunframe++; } if (ent->client->ps.gunframe == FRAME_IDLE_FIRST + 1) { ent->client->weaponstate = WEAPON_READY; } } } void weapon_grenade_fire(edict_t *ent, qboolean held) { vec3_t offset; vec3_t forward, right; vec3_t start; int damage = 125; float timer; int speed; float radius; if (!ent) { return; } radius = damage + 40; if (is_quad) { damage *= 4; gi.sound(ent, CHAN_ITEM, gi.soundindex( "items/damage3.wav"), 1, ATTN_NORM, 0); } VectorSet(offset, 8, 8, ent->viewheight - 8); AngleVectors(ent->client->v_angle, forward, right, NULL); P_ProjectSource(ent, offset, forward, right, start); timer = ent->client->grenade_time - level.time; speed = GRENADE_MINSPEED + (GRENADE_TIMER - timer) * ((GRENADE_MAXSPEED - GRENADE_MINSPEED) / GRENADE_TIMER); fire_grenade2(ent, start, forward, damage, speed, timer, radius, held); if (!((int)dmflags->value & DF_INFINITE_AMMO)) { ent->client->pers.inventory[ent->client->ammo_index]--; } ent->client->grenade_time = level.time + 1.0; if (ent->deadflag || (ent->s.modelindex != 255)) /* VWep animations screw up corpses */ { return; } if (ent->health <= 0) { return; } if (ent->client->ps.pmove.pm_flags & PMF_DUCKED) { ent->client->anim_priority = ANIM_ATTACK; ent->s.frame = FRAME_crattak1 - 1; ent->client->anim_end = FRAME_crattak3; } else { ent->client->anim_priority = ANIM_REVERSE; ent->s.frame = FRAME_wave08; ent->client->anim_end = FRAME_wave01; } } void Weapon_Grenade(edict_t *ent) { if (!ent) { return; } if ((ent->client->newweapon) && (ent->client->weaponstate == WEAPON_READY)) { ChangeWeapon(ent); return; } if (ent->client->weaponstate == WEAPON_ACTIVATING) { ent->client->weaponstate = WEAPON_READY; ent->client->ps.gunframe = 16; return; } if (ent->client->weaponstate == WEAPON_READY) { if (((ent->client->latched_buttons | ent->client->buttons) & BUTTON_ATTACK)) { ent->client->latched_buttons &= ~BUTTON_ATTACK; if (ent->client->pers.inventory[ent->client->ammo_index]) { ent->client->ps.gunframe = 1; ent->client->weaponstate = WEAPON_FIRING; ent->client->grenade_time = 0; } else { if (level.time >= ent->pain_debounce_time) { gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0); ent->pain_debounce_time = level.time + 1; } NoAmmoWeaponChange(ent); } return; } if ((ent->client->ps.gunframe == 29) || (ent->client->ps.gunframe == 34) || (ent->client->ps.gunframe == 39) || (ent->client->ps.gunframe == 48)) { if (rand() & 15) { return; } } if (++ent->client->ps.gunframe > 48) { ent->client->ps.gunframe = 16; } return; } if (ent->client->weaponstate == WEAPON_FIRING) { if (ent->client->ps.gunframe == 5) { gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/hgrena1b.wav"), 1, ATTN_NORM, 0); } if (ent->client->ps.gunframe == 11) { if (!ent->client->grenade_time) { ent->client->grenade_time = level.time + GRENADE_TIMER + 0.2; ent->client->weapon_sound = gi.soundindex("weapons/hgrenc1b.wav"); } /* they waited too long, detonate it in their hand */ if (!ent->client->grenade_blew_up && (level.time >= ent->client->grenade_time)) { ent->client->weapon_sound = 0; weapon_grenade_fire(ent, true); ent->client->grenade_blew_up = true; } if (ent->client->buttons & BUTTON_ATTACK) { return; } if (ent->client->grenade_blew_up) { if (level.time >= ent->client->grenade_time) { ent->client->ps.gunframe = 15; ent->client->grenade_blew_up = false; } else { return; } } } if (ent->client->ps.gunframe == 12) { ent->client->weapon_sound = 0; weapon_grenade_fire(ent, false); } if ((ent->client->ps.gunframe == 15) && (level.time < ent->client->grenade_time)) { return; } ent->client->ps.gunframe++; if (ent->client->ps.gunframe == 16) { ent->client->grenade_time = 0; ent->client->weaponstate = WEAPON_READY; } } } /* GRENADE LAUNCHER */ void weapon_grenadelauncher_fire(edict_t *ent) { vec3_t offset; vec3_t forward, right; vec3_t start; int damage = 120; float radius; if (!ent) { return; } radius = damage + 40; if (is_quad) { damage *= 4; } VectorSet(offset, 8, 8, ent->viewheight - 8); AngleVectors(ent->client->v_angle, forward, right, NULL); P_ProjectSource(ent, offset, forward, right, start); VectorScale(forward, -2, ent->client->kick_origin); ent->client->kick_angles[0] = -1; fire_grenade(ent, start, forward, damage, 600, 2.5, radius); gi.WriteByte(svc_muzzleflash); gi.WriteShort(ent - g_edicts); gi.WriteByte(MZ_GRENADE | is_silenced); gi.multicast(ent->s.origin, MULTICAST_PVS); ent->client->ps.gunframe++; PlayerNoise(ent, start, PNOISE_WEAPON); if (!((int)dmflags->value & DF_INFINITE_AMMO)) { ent->client->pers.inventory[ent->client->ammo_index]--; } } void Weapon_GrenadeLauncher(edict_t *ent) { static int pause_frames[] = {34, 51, 59, 0}; static int fire_frames[] = {6, 0}; Weapon_Generic(ent, 5, 16, 59, 64, pause_frames, fire_frames, weapon_grenadelauncher_fire); if (is_quadfire) { Weapon_Generic(ent, 5, 16, 59, 64, pause_frames, fire_frames, weapon_grenadelauncher_fire); } } /* ROCKET */ void Weapon_RocketLauncher_Fire(edict_t *ent) { vec3_t offset, start; vec3_t forward, right; int damage; float damage_radius; int radius_damage; if (!ent) { return; } damage = 100 + (int)(random() * 20.0); radius_damage = 120; damage_radius = 120; if (is_quad) { damage *= 4; radius_damage *= 4; } AngleVectors(ent->client->v_angle, forward, right, NULL); VectorScale(forward, -2, ent->client->kick_origin); ent->client->kick_angles[0] = -1; VectorSet(offset, 8, 8, ent->viewheight - 8); P_ProjectSource(ent, offset, forward, right, start); fire_rocket(ent, start, forward, damage, 650, damage_radius, radius_damage); /* send muzzle flash */ gi.WriteByte(svc_muzzleflash); gi.WriteShort(ent - g_edicts); gi.WriteByte(MZ_ROCKET | is_silenced); gi.multicast(ent->s.origin, MULTICAST_PVS); ent->client->ps.gunframe++; PlayerNoise(ent, start, PNOISE_WEAPON); if (!((int)dmflags->value & DF_INFINITE_AMMO)) { ent->client->pers.inventory[ent->client->ammo_index]--; } } void Weapon_RocketLauncher(edict_t *ent) { static int pause_frames[] = {25, 33, 42, 50, 0}; static int fire_frames[] = {5, 0}; if (!ent) { return; } Weapon_Generic(ent, 4, 12, 50, 54, pause_frames, fire_frames, Weapon_RocketLauncher_Fire); if (is_quadfire) { Weapon_Generic(ent, 4, 12, 50, 54, pause_frames, fire_frames, Weapon_RocketLauncher_Fire); } } /* BLASTER / HYPERBLASTER */ void Blaster_Fire(edict_t *ent, vec3_t g_offset, int damage, qboolean hyper, int effect) { vec3_t forward, right; vec3_t start; vec3_t offset; if (!ent) { return; } if (is_quad) { damage *= 4; } AngleVectors(ent->client->v_angle, forward, right, NULL); VectorSet(offset, 24, 8, ent->viewheight - 8); VectorAdd(offset, g_offset, offset); P_ProjectSource(ent, offset, forward, right, start); VectorScale(forward, -2, ent->client->kick_origin); ent->client->kick_angles[0] = -1; fire_blaster(ent, start, forward, damage, 1000, effect, hyper); /* send muzzle flash */ gi.WriteByte(svc_muzzleflash); gi.WriteShort(ent - g_edicts); if (hyper) { gi.WriteByte(MZ_HYPERBLASTER | is_silenced); } else { gi.WriteByte(MZ_BLASTER | is_silenced); } gi.multicast(ent->s.origin, MULTICAST_PVS); PlayerNoise(ent, start, PNOISE_WEAPON); } void Weapon_Blaster_Fire(edict_t *ent) { int damage; if (!ent) { return; } if (deathmatch->value) { damage = 15; } else { damage = 10; } Blaster_Fire(ent, vec3_origin, damage, false, EF_BLASTER); ent->client->ps.gunframe++; } void Weapon_Blaster(edict_t *ent) { static int pause_frames[] = {19, 32, 0}; static int fire_frames[] = {5, 0}; if (!ent) { return; } Weapon_Generic(ent, 4, 8, 52, 55, pause_frames, fire_frames, Weapon_Blaster_Fire); if (is_quadfire) { Weapon_Generic(ent, 4, 8, 52, 55, pause_frames, fire_frames, Weapon_Blaster_Fire); } } void Weapon_HyperBlaster_Fire(edict_t *ent) { float rotation; vec3_t offset; int effect; int damage; if (!ent) { return; } ent->client->weapon_sound = gi.soundindex("weapons/hyprbl1a.wav"); if (!(ent->client->buttons & BUTTON_ATTACK)) { ent->client->ps.gunframe++; } else { if (!ent->client->pers.inventory[ent->client->ammo_index]) { if (level.time >= ent->pain_debounce_time) { gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0); ent->pain_debounce_time = level.time + 1; } NoAmmoWeaponChange(ent); } else { rotation = (ent->client->ps.gunframe - 5) * 2 * M_PI / 6; offset[0] = -4 * sin(rotation); offset[1] = 0; offset[2] = 4 * cos(rotation); if ((ent->client->ps.gunframe == 6) || (ent->client->ps.gunframe == 9)) { effect = EF_HYPERBLASTER; } else { effect = 0; } if (deathmatch->value) { damage = 15; } else { damage = 20; } Blaster_Fire(ent, offset, damage, true, effect); if (!((int)dmflags->value & DF_INFINITE_AMMO)) { ent->client->pers.inventory[ent->client->ammo_index]--; } ent->client->anim_priority = ANIM_ATTACK; if (ent->client->ps.pmove.pm_flags & PMF_DUCKED) { ent->s.frame = FRAME_crattak1 - 1; ent->client->anim_end = FRAME_crattak9; } else { ent->s.frame = FRAME_attack1 - 1; ent->client->anim_end = FRAME_attack8; } } ent->client->ps.gunframe++; if ((ent->client->ps.gunframe == 12) && ent->client->pers.inventory[ent->client->ammo_index]) { ent->client->ps.gunframe = 6; } } if (ent->client->ps.gunframe == 12) { gi.sound(ent, CHAN_AUTO, gi.soundindex("weapons/hyprbd1a.wav"), 1, ATTN_NORM, 0); ent->client->weapon_sound = 0; } } void Weapon_HyperBlaster(edict_t *ent) { static int pause_frames[] = {0}; static int fire_frames[] = {6, 7, 8, 9, 10, 11, 0}; if (!ent) { return; } Weapon_Generic(ent, 5, 20, 49, 53, pause_frames, fire_frames, Weapon_HyperBlaster_Fire); if (is_quadfire) { Weapon_Generic(ent, 5, 20, 49, 53, pause_frames, fire_frames, Weapon_HyperBlaster_Fire); } } /* MACHINEGUN / CHAINGUN */ void Machinegun_Fire(edict_t *ent) { int i; vec3_t start; vec3_t forward, right; vec3_t angles; int damage = 8; int kick = 2; vec3_t offset; if (!ent) { return; } if (!(ent->client->buttons & BUTTON_ATTACK)) { ent->client->machinegun_shots = 0; ent->client->ps.gunframe++; return; } if (ent->client->ps.gunframe == 5) { ent->client->ps.gunframe = 4; } else { ent->client->ps.gunframe = 5; } if (ent->client->pers.inventory[ent->client->ammo_index] < 1) { ent->client->ps.gunframe = 6; if (level.time >= ent->pain_debounce_time) { gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0); ent->pain_debounce_time = level.time + 1; } NoAmmoWeaponChange(ent); return; } if (is_quad) { damage *= 4; kick *= 4; } for (i = 1; i < 3; i++) { ent->client->kick_origin[i] = crandom() * 0.35; ent->client->kick_angles[i] = crandom() * 0.7; } ent->client->kick_origin[0] = crandom() * 0.35; ent->client->kick_angles[0] = ent->client->machinegun_shots * -1.5; /* raise the gun as it is firing */ if (!(deathmatch->value || g_machinegun_norecoil->value)) { ent->client->machinegun_shots++; if (ent->client->machinegun_shots > 9) { ent->client->machinegun_shots = 9; } } /* get start / end positions */ VectorAdd(ent->client->v_angle, ent->client->kick_angles, angles); AngleVectors(angles, forward, right, NULL); VectorSet(offset, 0, 8, ent->viewheight - 8); P_ProjectSource(ent, offset, forward, right, start); fire_bullet(ent, start, forward, damage, kick, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, MOD_MACHINEGUN); gi.WriteByte(svc_muzzleflash); gi.WriteShort(ent - g_edicts); gi.WriteByte(MZ_MACHINEGUN | is_silenced); gi.multicast(ent->s.origin, MULTICAST_PVS); PlayerNoise(ent, start, PNOISE_WEAPON); if (!((int)dmflags->value & DF_INFINITE_AMMO)) { ent->client->pers.inventory[ent->client->ammo_index]--; } ent->client->anim_priority = ANIM_ATTACK; if (ent->client->ps.pmove.pm_flags & PMF_DUCKED) { ent->s.frame = FRAME_crattak1 - (int)(random() + 0.25); ent->client->anim_end = FRAME_crattak9; } else { ent->s.frame = FRAME_attack1 - (int)(random() + 0.25); ent->client->anim_end = FRAME_attack8; } } void Weapon_Machinegun(edict_t *ent) { static int pause_frames[] = {23, 45, 0}; static int fire_frames[] = {4, 5, 0}; if (!ent) { return; } Weapon_Generic(ent, 3, 5, 45, 49, pause_frames, fire_frames, Machinegun_Fire); if (is_quadfire) { Weapon_Generic(ent, 3, 5, 45, 49, pause_frames, fire_frames, Machinegun_Fire); } } void Chaingun_Fire(edict_t *ent) { int i; int shots; vec3_t start; vec3_t forward, right, up; float r, u; vec3_t offset; int damage; int kick = 2; if (!ent) { return; } if (deathmatch->value) { damage = 6; } else { damage = 8; } if (ent->client->ps.gunframe == 5) { gi.sound(ent, CHAN_AUTO, gi.soundindex("weapons/chngnu1a.wav"), 1, ATTN_IDLE, 0); } if ((ent->client->ps.gunframe == 14) && !(ent->client->buttons & BUTTON_ATTACK)) { ent->client->ps.gunframe = 32; ent->client->weapon_sound = 0; return; } else if ((ent->client->ps.gunframe == 21) && (ent->client->buttons & BUTTON_ATTACK) && ent->client->pers.inventory[ent->client->ammo_index]) { ent->client->ps.gunframe = 15; } else { ent->client->ps.gunframe++; } if (ent->client->ps.gunframe == 22) { ent->client->weapon_sound = 0; gi.sound(ent, CHAN_AUTO, gi.soundindex("weapons/chngnd1a.wav"), 1, ATTN_IDLE, 0); } else { ent->client->weapon_sound = gi.soundindex("weapons/chngnl1a.wav"); } ent->client->anim_priority = ANIM_ATTACK; if (ent->client->ps.pmove.pm_flags & PMF_DUCKED) { ent->s.frame = FRAME_crattak1 - (ent->client->ps.gunframe & 1); ent->client->anim_end = FRAME_crattak9; } else { ent->s.frame = FRAME_attack1 - (ent->client->ps.gunframe & 1); ent->client->anim_end = FRAME_attack8; } if (ent->client->ps.gunframe <= 9) { shots = 1; } else if (ent->client->ps.gunframe <= 14) { if (ent->client->buttons & BUTTON_ATTACK) { shots = 2; } else { shots = 1; } } else { shots = 3; } if (ent->client->pers.inventory[ent->client->ammo_index] < shots) { shots = ent->client->pers.inventory[ent->client->ammo_index]; } if (!shots) { if (level.time >= ent->pain_debounce_time) { gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0); ent->pain_debounce_time = level.time + 1; } NoAmmoWeaponChange(ent); return; } if (is_quad) { damage *= 4; kick *= 4; } for (i = 0; i < 3; i++) { ent->client->kick_origin[i] = crandom() * 0.35; ent->client->kick_angles[i] = crandom() * 0.7; } for (i = 0; i < shots; i++) { /* get start / end positions */ AngleVectors(ent->client->v_angle, forward, right, up); r = 7 + crandom() * 4; u = crandom() * 4; VectorSet(offset, 0, r, u + ent->viewheight - 8); P_ProjectSource(ent, offset, forward, right, start); fire_bullet(ent, start, forward, damage, kick, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, MOD_CHAINGUN); } /* send muzzle flash */ gi.WriteByte(svc_muzzleflash); gi.WriteShort(ent - g_edicts); gi.WriteByte((MZ_CHAINGUN1 + shots - 1) | is_silenced); gi.multicast(ent->s.origin, MULTICAST_PVS); PlayerNoise(ent, start, PNOISE_WEAPON); if (!((int)dmflags->value & DF_INFINITE_AMMO)) { ent->client->pers.inventory[ent->client->ammo_index] -= shots; } } void Weapon_Chaingun(edict_t *ent) { static int pause_frames[] = {38, 43, 51, 61, 0}; static int fire_frames[] = {5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 0}; if (!ent) { return; } Weapon_Generic(ent, 4, 31, 61, 64, pause_frames, fire_frames, Chaingun_Fire); if (is_quadfire) { Weapon_Generic(ent, 4, 31, 61, 64, pause_frames, fire_frames, Chaingun_Fire); } } /* SHOTGUN / SUPERSHOTGUN */ void weapon_shotgun_fire(edict_t *ent) { vec3_t start; vec3_t forward, right; vec3_t offset; int damage = 4; int kick = 8; if (!ent) { return; } if (ent->client->ps.gunframe == 9) { ent->client->ps.gunframe++; return; } AngleVectors(ent->client->v_angle, forward, right, NULL); VectorScale(forward, -2, ent->client->kick_origin); ent->client->kick_angles[0] = -2; VectorSet(offset, 0, 8, ent->viewheight - 8); P_ProjectSource(ent, offset, forward, right, start); if (is_quad) { damage *= 4; kick *= 4; } fire_shotgun(ent, start, forward, damage, kick, 500, 500, DEFAULT_SHOTGUN_COUNT, MOD_SHOTGUN); /* send muzzle flash */ gi.WriteByte(svc_muzzleflash); gi.WriteShort(ent - g_edicts); gi.WriteByte(MZ_SHOTGUN | is_silenced); gi.multicast(ent->s.origin, MULTICAST_PVS); ent->client->ps.gunframe++; PlayerNoise(ent, start, PNOISE_WEAPON); if (!((int)dmflags->value & DF_INFINITE_AMMO)) { ent->client->pers.inventory[ent->client->ammo_index]--; } } void Weapon_Shotgun(edict_t *ent) { static int pause_frames[] = {22, 28, 34, 0}; static int fire_frames[] = {8, 9, 0}; if (!ent) { return; } Weapon_Generic(ent, 7, 18, 36, 39, pause_frames, fire_frames, weapon_shotgun_fire); if (is_quadfire) { Weapon_Generic(ent, 7, 18, 36, 39, pause_frames, fire_frames, weapon_shotgun_fire); } } void weapon_supershotgun_fire(edict_t *ent) { vec3_t start; vec3_t forward, right; vec3_t offset; vec3_t v; int damage = 6; int kick = 12; if (!ent) { return; } AngleVectors(ent->client->v_angle, forward, right, NULL); VectorScale(forward, -2, ent->client->kick_origin); ent->client->kick_angles[0] = -2; VectorSet(offset, 0, 8, ent->viewheight - 8); P_ProjectSource(ent, offset, forward, right, start); if (is_quad) { damage *= 4; kick *= 4; } v[PITCH] = ent->client->v_angle[PITCH]; v[YAW] = ent->client->v_angle[YAW] - 5; v[ROLL] = ent->client->v_angle[ROLL]; AngleVectors(v, forward, NULL, NULL); if (aimfix->value) { AngleVectors(v, forward, right, NULL); VectorScale(forward, -2, ent->client->kick_origin); ent->client->kick_angles[0] = -2; VectorSet(offset, 0, 8, ent->viewheight - 8); P_ProjectSource(ent, offset, forward, right, start); } fire_shotgun(ent, start, forward, damage, kick, DEFAULT_SHOTGUN_HSPREAD, DEFAULT_SHOTGUN_VSPREAD, DEFAULT_SSHOTGUN_COUNT / 2, MOD_SSHOTGUN); v[YAW] = ent->client->v_angle[YAW] + 5; AngleVectors(v, forward, NULL, NULL); if (aimfix->value) { AngleVectors(v, forward, right, NULL); VectorScale(forward, -2, ent->client->kick_origin); ent->client->kick_angles[0] = -2; VectorSet(offset, 0, 8, ent->viewheight - 8); P_ProjectSource(ent, offset, forward, right, start); } fire_shotgun(ent, start, forward, damage, kick, DEFAULT_SHOTGUN_HSPREAD, DEFAULT_SHOTGUN_VSPREAD, DEFAULT_SSHOTGUN_COUNT / 2, MOD_SSHOTGUN); /* send muzzle flash */ gi.WriteByte(svc_muzzleflash); gi.WriteShort(ent - g_edicts); gi.WriteByte(MZ_SSHOTGUN | is_silenced); gi.multicast(ent->s.origin, MULTICAST_PVS); ent->client->ps.gunframe++; PlayerNoise(ent, start, PNOISE_WEAPON); if (!((int)dmflags->value & DF_INFINITE_AMMO)) { ent->client->pers.inventory[ent->client->ammo_index] -= 2; } } void Weapon_SuperShotgun(edict_t *ent) { static int pause_frames[] = {29, 42, 57, 0}; static int fire_frames[] = {7, 0}; Weapon_Generic(ent, 6, 17, 57, 61, pause_frames, fire_frames, weapon_supershotgun_fire); if (!ent) { return; } if (is_quadfire) { Weapon_Generic(ent, 6, 17, 57, 61, pause_frames, fire_frames, weapon_supershotgun_fire); } } /* RAILGUN */ void weapon_railgun_fire(edict_t *ent) { vec3_t start; vec3_t forward, right; vec3_t offset; int damage; int kick; if (!ent) { return; } if (deathmatch->value) { /* normal damage is too extreme in dm */ damage = 100; kick = 200; } else { damage = 150; kick = 250; } if (is_quad) { damage *= 4; kick *= 4; } AngleVectors(ent->client->v_angle, forward, right, NULL); VectorScale(forward, -3, ent->client->kick_origin); ent->client->kick_angles[0] = -3; VectorSet(offset, 0, 7, ent->viewheight - 8); P_ProjectSource(ent, offset, forward, right, start); fire_rail(ent, start, forward, damage, kick); /* send muzzle flash */ gi.WriteByte(svc_muzzleflash); gi.WriteShort(ent - g_edicts); gi.WriteByte(MZ_RAILGUN | is_silenced); gi.multicast(ent->s.origin, MULTICAST_PVS); ent->client->ps.gunframe++; PlayerNoise(ent, start, PNOISE_WEAPON); if (!((int)dmflags->value & DF_INFINITE_AMMO)) { ent->client->pers.inventory[ent->client->ammo_index]--; } } void Weapon_Railgun(edict_t *ent) { static int pause_frames[] = {56, 0}; static int fire_frames[] = {4, 0}; Weapon_Generic(ent, 3, 18, 56, 61, pause_frames, fire_frames, weapon_railgun_fire); if (!ent) { return; } if (is_quadfire) { Weapon_Generic(ent, 3, 18, 56, 61, pause_frames, fire_frames, weapon_railgun_fire); } } /* BFG10K */ void weapon_bfg_fire(edict_t *ent) { vec3_t offset, start; vec3_t forward, right; int damage; float damage_radius = 1000; if (!ent) { return; } if (deathmatch->value) { damage = 200; } else { damage = 500; } if (ent->client->ps.gunframe == 9) { /* send muzzle flash */ gi.WriteByte(svc_muzzleflash); gi.WriteShort(ent - g_edicts); gi.WriteByte(MZ_BFG | is_silenced); gi.multicast(ent->s.origin, MULTICAST_PVS); ent->client->ps.gunframe++; PlayerNoise(ent, start, PNOISE_WEAPON); return; } /* cells can go down during windup (from power armor hits), so check again and abort firing if we don't have enough now */ if (ent->client->pers.inventory[ent->client->ammo_index] < 50) { ent->client->ps.gunframe++; return; } if (is_quad) { damage *= 4; } AngleVectors(ent->client->v_angle, forward, right, NULL); VectorScale(forward, -2, ent->client->kick_origin); /* make a big pitch kick with an inverse fall */ ent->client->v_dmg_pitch = -40; ent->client->v_dmg_roll = crandom() * 8; ent->client->v_dmg_time = level.time + DAMAGE_TIME; VectorSet(offset, 8, 8, ent->viewheight - 8); P_ProjectSource(ent, offset, forward, right, start); fire_bfg(ent, start, forward, damage, 400, damage_radius); ent->client->ps.gunframe++; PlayerNoise(ent, start, PNOISE_WEAPON); if (!((int)dmflags->value & DF_INFINITE_AMMO)) { ent->client->pers.inventory[ent->client->ammo_index] -= 50; } } void Weapon_BFG(edict_t *ent) { static int pause_frames[] = {39, 45, 50, 55, 0}; static int fire_frames[] = {9, 17, 0}; if (!ent) { return; } Weapon_Generic(ent, 8, 32, 55, 58, pause_frames, fire_frames, weapon_bfg_fire); if (is_quadfire) { Weapon_Generic(ent, 8, 32, 55, 58, pause_frames, fire_frames, weapon_bfg_fire); } } /* ====================================================================== */ /* RipperGun */ void weapon_ionripper_fire(edict_t *ent) { vec3_t start; vec3_t forward, right; vec3_t offset; vec3_t tempang; int damage; if (!ent) { return; } if (deathmatch->value) { /* tone down for deathmatch */ damage = 30; } else { damage = 50; } if (is_quad) { damage *= 4; } VectorCopy(ent->client->v_angle, tempang); tempang[YAW] += crandom(); AngleVectors(tempang, forward, right, NULL); VectorScale(forward, -3, ent->client->kick_origin); ent->client->kick_angles[0] = -3; VectorSet(offset, 16, 7, ent->viewheight - 8); P_ProjectSource(ent, offset, forward, right, start); fire_ionripper(ent, start, forward, damage, 500, EF_IONRIPPER); /* send muzzle flash */ gi.WriteByte(svc_muzzleflash); gi.WriteShort(ent - g_edicts); gi.WriteByte(MZ_IONRIPPER | is_silenced); gi.multicast(ent->s.origin, MULTICAST_PVS); ent->client->ps.gunframe++; PlayerNoise(ent, start, PNOISE_WEAPON); if (!((int)dmflags->value & DF_INFINITE_AMMO)) { ent->client->pers.inventory[ent->client->ammo_index] -= ent->client->pers.weapon->quantity; } if (ent->client->pers.inventory[ent->client->ammo_index] < 0) { ent->client->pers.inventory[ent->client->ammo_index] = 0; } } void Weapon_Ionripper(edict_t *ent) { static int pause_frames[] = {36, 0}; static int fire_frames[] = {5, 0}; if (!ent) { return; } Weapon_Generic(ent, 4, 6, 36, 39, pause_frames, fire_frames, weapon_ionripper_fire); if (is_quadfire) { Weapon_Generic(ent, 4, 6, 36, 39, pause_frames, fire_frames, weapon_ionripper_fire); } } /* Phalanx */ void weapon_phalanx_fire(edict_t *ent) { vec3_t start; vec3_t forward, right, up; vec3_t offset; vec3_t v; int damage; float damage_radius; int radius_damage; if (!ent) { return; } damage = 70 + (int)(random() * 10.0); radius_damage = 120; damage_radius = 120; if (is_quad) { damage *= 4; radius_damage *= 4; } AngleVectors(ent->client->v_angle, forward, right, NULL); VectorScale(forward, -2, ent->client->kick_origin); ent->client->kick_angles[0] = -2; VectorSet(offset, 0, 8, ent->viewheight - 8); P_ProjectSource(ent, offset, forward, right, start); if (ent->client->ps.gunframe == 8) { v[PITCH] = ent->client->v_angle[PITCH]; v[YAW] = ent->client->v_angle[YAW] - 1.5; v[ROLL] = ent->client->v_angle[ROLL]; AngleVectors(v, forward, right, up); if (aimfix->value) { AngleVectors(v, forward, right, NULL); VectorScale(forward, -2, ent->client->kick_origin); ent->client->kick_angles[0] = -2; VectorSet(offset, 0, 8, ent->viewheight - 8); P_ProjectSource(ent, offset, forward, right, start); } radius_damage = 30; damage_radius = 120; fire_plasma(ent, start, forward, damage, 725, damage_radius, radius_damage); if (!((int)dmflags->value & DF_INFINITE_AMMO)) { ent->client->pers.inventory[ent->client->ammo_index]--; } } else { v[PITCH] = ent->client->v_angle[PITCH]; v[YAW] = ent->client->v_angle[YAW] + 1.5; v[ROLL] = ent->client->v_angle[ROLL]; AngleVectors(v, forward, right, up); if (aimfix->value) { AngleVectors(v, forward, right, NULL); VectorScale(forward, -2, ent->client->kick_origin); ent->client->kick_angles[0] = -2; VectorSet(offset, 0, 8, ent->viewheight - 8); P_ProjectSource(ent, offset, forward, right, start); } fire_plasma(ent, start, forward, damage, 725, damage_radius, radius_damage); /* send muzzle flash */ gi.WriteByte(svc_muzzleflash); gi.WriteShort(ent - g_edicts); gi.WriteByte(MZ_PHALANX | is_silenced); gi.multicast(ent->s.origin, MULTICAST_PVS); PlayerNoise(ent, start, PNOISE_WEAPON); } ent->client->ps.gunframe++; } void Weapon_Phalanx(edict_t *ent) { static int pause_frames[] = {29, 42, 55, 0}; static int fire_frames[] = {7, 8, 0}; if (!ent) { return; } Weapon_Generic(ent, 5, 20, 58, 63, pause_frames, fire_frames, weapon_phalanx_fire); if (is_quadfire) { Weapon_Generic(ent, 5, 20, 58, 63, pause_frames, fire_frames, weapon_phalanx_fire); } } /* TRAP */ void weapon_trap_fire(edict_t *ent, qboolean held) { vec3_t offset; vec3_t forward, right; vec3_t start; int damage = 125; float timer; int speed; float radius; if (!ent) { return; } radius = damage + 40; if (is_quad) { damage *= 4; } VectorSet(offset, 8, 8, ent->viewheight - 8); AngleVectors(ent->client->v_angle, forward, right, NULL); P_ProjectSource(ent, offset, forward, right, start); timer = ent->client->grenade_time - level.time; speed = GRENADE_MINSPEED + (GRENADE_TIMER - timer) * ((GRENADE_MAXSPEED - GRENADE_MINSPEED) / GRENADE_TIMER); fire_trap(ent, start, forward, damage, speed, timer, radius, held); ent->client->pers.inventory[ent->client->ammo_index]--; ent->client->grenade_time = level.time + 1.0; } void Weapon_Trap(edict_t *ent) { if (!ent) { return; } if ((ent->client->newweapon) && (ent->client->weaponstate == WEAPON_READY)) { ChangeWeapon(ent); return; } if (ent->client->weaponstate == WEAPON_ACTIVATING) { ent->client->weaponstate = WEAPON_READY; ent->client->ps.gunframe = 16; return; } if (ent->client->weaponstate == WEAPON_READY) { if (((ent->client->latched_buttons | ent->client->buttons) & BUTTON_ATTACK)) { ent->client->latched_buttons &= ~BUTTON_ATTACK; if (ent->client->pers.inventory[ent->client->ammo_index]) { ent->client->ps.gunframe = 1; ent->client->weaponstate = WEAPON_FIRING; ent->client->grenade_time = 0; } else { if (level.time >= ent->pain_debounce_time) { gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0); ent->pain_debounce_time = level.time + 1; } NoAmmoWeaponChange(ent); } return; } if ((ent->client->ps.gunframe == 29) || (ent->client->ps.gunframe == 34) || (ent->client->ps.gunframe == 39) || (ent->client->ps.gunframe == 48)) { if (rand() & 15) { return; } } if (++ent->client->ps.gunframe > 48) { ent->client->ps.gunframe = 16; } return; } if (ent->client->weaponstate == WEAPON_FIRING) { if (ent->client->ps.gunframe == 5) { gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/trapcock.wav"), 1, ATTN_NORM, 0); } if (ent->client->ps.gunframe == 11) { if (!ent->client->grenade_time) { ent->client->grenade_time = level.time + GRENADE_TIMER + 0.2; ent->client->weapon_sound = gi.soundindex("weapons/traploop.wav"); } /* they waited too long, detonate it in their hand */ if (!ent->client->grenade_blew_up && (level.time >= ent->client->grenade_time)) { ent->client->weapon_sound = 0; weapon_trap_fire(ent, true); ent->client->grenade_blew_up = true; } if (ent->client->buttons & BUTTON_ATTACK) { return; } if (ent->client->grenade_blew_up) { if (level.time >= ent->client->grenade_time) { ent->client->ps.gunframe = 15; ent->client->grenade_blew_up = false; } else { return; } } } if (ent->client->ps.gunframe == 12) { ent->client->weapon_sound = 0; weapon_trap_fire(ent, false); if (ent->client->pers.inventory[ent->client->ammo_index] == 0) { NoAmmoWeaponChange(ent); } } if ((ent->client->ps.gunframe == 15) && (level.time < ent->client->grenade_time)) { return; } ent->client->ps.gunframe++; if (ent->client->ps.gunframe == 16) { ent->client->grenade_time = 0; ent->client->weaponstate = WEAPON_READY; } } } xatrix-XATRIX_2_14/src/savegame/000077500000000000000000000000001477320050300165175ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/savegame/savegame.c000066400000000000000000000552251477320050300204640ustar00rootroot00000000000000/* * ======================================================================= * * The savegame system. * * ======================================================================= */ /* * This is the Quake 2 savegame system, fixed by Yamagi * based on an idea by Knightmare of kmquake2. This major * rewrite of the original g_save.c is much more robust * and portable since it doesn't use any function pointers. * * Inner workings: * When the game is saved all function pointers are * translated into human readable function definition strings. * The same way all mmove_t pointers are translated. This * human readable strings are then written into the file. * At game load the human readable strings are retranslated * into the actual function pointers and struct pointers. The * pointers are generated at each compilation / start of the * client, thus the pointers are always correct. * * Limitations: * While savegames survive recompilations of the game source * and bigger changes in the source, there are some limitation * which a nearly impossible to fix without a object orientated * rewrite of the game. * - If functions or mmove_t structs that a referencenced * inside savegames are added or removed (e.g. the files * in tables/ are altered) the load functions cannot * reconnect all pointers and thus not restore the game. * - If the operating system is changed internal structures * may change in an unrepairable way. * - If the architecture is changed pointer length and * other internal datastructures change in an * incompatible way. * - If the edict_t struct is changed, savegames * will break. * This is not so bad as it looks since functions and * struct won't be added and edict_t won't be changed * if no big, sweeping changes are done. The operating * system and architecture are in the hands of the user. */ #include "../header/local.h" /* * When ever the savegame version is changed, q2 will refuse to * load older savegames. This should be bumped if the files * in tables/ are changed, otherwise strange things may happen. */ #define SAVEGAMEVER "YQ2-5" #ifndef BUILD_DATE #define BUILD_DATE __DATE__ #endif /* * This macros are used to prohibit loading of savegames * created on other systems or architectures. This will * crash q2 in spectacular ways */ #ifndef YQ2OSTYPE #error YQ2OSTYPE should be defined by the build system #endif #ifndef YQ2ARCH #error YQ2ARCH should be defined by the build system #endif /* * Older operating system and architecture detection * macros, implemented by savegame version YQ2-1. */ #if defined(__APPLE__) #define YQ2OSTYPE_1 "MacOS X" #elif defined(__FreeBSD__) #define YQ2OSTYPE_1 "FreeBSD" #elif defined(__OpenBSD__) #define YQ2OSTYPE_1 "OpenBSD" #elif defined(__linux__) #define YQ2OSTYPE_1 "Linux" #elif defined(_WIN32) #define YQ2OSTYPE_1 "Windows" #else #define YQ2OSTYPE_1 "Unknown" #endif #if defined(__i386__) #define YQ2ARCH_1 "i386" #elif defined(__x86_64__) #define YQ2ARCH_1 "amd64" #elif defined(__sparc__) #define YQ2ARCH_1 "sparc64" #elif defined(__ia64__) #define YQ2ARCH_1 "ia64" #else #define YQ2ARCH_1 "unknown" #endif /* * Connects a human readable * function signature with * the corresponding pointer */ typedef struct { char *funcStr; byte *funcPtr; } functionList_t; /* * Connects a human readable * mmove_t string with the * correspondig pointer * */ typedef struct { char *mmoveStr; mmove_t *mmovePtr; } mmoveList_t; typedef struct { char ver[32]; char game[32]; char os[32]; char arch[32]; } savegameHeader_t; /* ========================================================= */ /* * Prototypes for forward * declaration for all game * functions. */ #include "tables/gamefunc_decs.h" /* * List with function pointer * to each of the functions * prototyped above. */ static functionList_t functionList[] = { #include "tables/gamefunc_list.h" }; /* * Prototypes for forward * declaration for all game * mmove_t functions. */ #include "tables/gamemmove_decs.h" /* * List with pointers to * each of the mmove_t * functions prototyped * above. */ static mmoveList_t mmoveList[] = { #include "tables/gamemmove_list.h" }; /* * Fields to be saved (used in g_spawn.c) */ field_t fields[] = { #include "tables/fields.h" }; /* * Level fields to * be saved */ static field_t levelfields[] = { #include "tables/levelfields.h" }; /* * Client fields to * be saved */ static field_t clientfields[] = { #include "tables/clientfields.h" }; /* ========================================================= */ /* * This will be called when the dll is first loaded, * which only happens when a new game is started or * a save game is loaded. */ void InitGame(void) { gi.dprintf("Game is starting up.\n"); gi.dprintf("Game is %s built on %s.\n", GAMEVERSION, BUILD_DATE); gun_x = gi.cvar ("gun_x", "0", 0); gun_y = gi.cvar ("gun_y", "0", 0); gun_z = gi.cvar ("gun_z", "0", 0); sv_rollspeed = gi.cvar ("sv_rollspeed", "200", 0); sv_rollangle = gi.cvar ("sv_rollangle", "2", 0); sv_maxvelocity = gi.cvar ("sv_maxvelocity", "2000", 0); sv_gravity = gi.cvar ("sv_gravity", "800", 0); /* noset vars */ dedicated = gi.cvar ("dedicated", "0", CVAR_NOSET); /* latched vars */ sv_cheats = gi.cvar ("cheats", "0", CVAR_SERVERINFO|CVAR_LATCH); gi.cvar ("gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_LATCH); gi.cvar ("gamedate", BUILD_DATE, CVAR_SERVERINFO | CVAR_LATCH); maxclients = gi.cvar ("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH); maxspectators = gi.cvar ("maxspectators", "4", CVAR_SERVERINFO); deathmatch = gi.cvar ("deathmatch", "0", CVAR_LATCH); coop = gi.cvar ("coop", "0", CVAR_LATCH); coop_elevator_delay = gi.cvar("coop_elevator_delay", "1.0", CVAR_ARCHIVE); coop_pickup_weapons = gi.cvar("coop_pickup_weapons", "0", CVAR_ARCHIVE); skill = gi.cvar ("skill", "1", CVAR_LATCH); maxentities = gi.cvar ("maxentities", "1024", CVAR_LATCH); g_footsteps = gi.cvar ("g_footsteps", "1", CVAR_ARCHIVE); g_monsterfootsteps = gi.cvar("g_monsterfootsteps", "0", CVAR_ARCHIVE); g_fix_triggered = gi.cvar ("g_fix_triggered", "0", 0); /* change anytime vars */ dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO); fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO); timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO); password = gi.cvar ("password", "", CVAR_USERINFO); spectator_password = gi.cvar ("spectator_password", "", CVAR_USERINFO); needpass = gi.cvar ("needpass", "0", CVAR_SERVERINFO); filterban = gi.cvar ("filterban", "1", 0); g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE); run_pitch = gi.cvar ("run_pitch", "0.002", 0); run_roll = gi.cvar ("run_roll", "0.005", 0); bob_up = gi.cvar ("bob_up", "0.005", 0); bob_pitch = gi.cvar ("bob_pitch", "0.002", 0); bob_roll = gi.cvar ("bob_roll", "0.002", 0); /* flood control */ flood_msgs = gi.cvar ("flood_msgs", "4", 0); flood_persecond = gi.cvar ("flood_persecond", "4", 0); flood_waitdelay = gi.cvar ("flood_waitdelay", "10", 0); /* dm map list */ sv_maplist = gi.cvar ("sv_maplist", "", 0); /* others */ aimfix = gi.cvar("aimfix", "0", CVAR_ARCHIVE); g_machinegun_norecoil = gi.cvar("g_machinegun_norecoil", "0", CVAR_ARCHIVE); g_quick_weap = gi.cvar("g_quick_weap", "1", CVAR_ARCHIVE); g_swap_speed = gi.cvar("g_swap_speed", "1", CVAR_ARCHIVE); /* items */ InitItems (); game.helpmessage1[0] = 0; game.helpmessage2[0] = 0; /* initialize all entities for this game */ game.maxentities = maxentities->value; g_edicts = gi.TagMalloc (game.maxentities * sizeof(g_edicts[0]), TAG_GAME); globals.edicts = g_edicts; globals.max_edicts = game.maxentities; /* initialize all clients for this game */ game.maxclients = maxclients->value; game.clients = gi.TagMalloc (game.maxclients * sizeof(game.clients[0]), TAG_GAME); globals.num_edicts = game.maxclients+1; } /* ========================================================= */ /* * Helper function to get * the human readable function * definition by an address. * Called by WriteField1 and * WriteField2. */ functionList_t * GetFunctionByAddress(byte *adr) { int i; for (i = 0; functionList[i].funcStr; i++) { if (functionList[i].funcPtr == adr) { return &functionList[i]; } } return NULL; } /* * Helper function to get the * pointer to a function by * it's human readable name. * Called by WriteField1 and * WriteField2. */ byte * FindFunctionByName(char *name) { int i; for (i = 0; functionList[i].funcStr; i++) { if (!strcmp(name, functionList[i].funcStr)) { return functionList[i].funcPtr; } } return NULL; } /* * Helper function to get the * human readable definition of * a mmove_t struct by a pointer. */ mmoveList_t * GetMmoveByAddress(mmove_t *adr) { int i; for (i = 0; mmoveList[i].mmoveStr; i++) { if (mmoveList[i].mmovePtr == adr) { return &mmoveList[i]; } } return NULL; } /* * Helper function to get the * pointer to a mmove_t struct * by a human readable definition. */ mmove_t * FindMmoveByName(char *name) { int i; for (i = 0; mmoveList[i].mmoveStr; i++) { if (!strcmp(name, mmoveList[i].mmoveStr)) { return mmoveList[i].mmovePtr; } } return NULL; } /* ========================================================= */ /* * The following two functions are * doing the dirty work to write the * data generated by the functions * below this block into files. */ void WriteField1(FILE *f, field_t *field, byte *base) { void *p; int len; int index; functionList_t *func; mmoveList_t *mmove; if (field->flags & FFL_SPAWNTEMP) { return; } p = (void *)(base + field->ofs); switch (field->type) { case F_INT: case F_FLOAT: case F_ANGLEHACK: case F_VECTOR: case F_IGNORE: break; case F_LSTRING: case F_GSTRING: if (*(char **)p) { len = strlen(*(char **)p) + 1; } else { len = 0; } *(int *)p = len; break; case F_EDICT: if (*(edict_t **)p == NULL) { index = -1; } else { index = *(edict_t **)p - g_edicts; } *(int *)p = index; break; case F_CLIENT: if (*(gclient_t **)p == NULL) { index = -1; } else { index = *(gclient_t **)p - game.clients; } *(int *)p = index; break; case F_ITEM: if (*(edict_t **)p == NULL) { index = -1; } else { index = *(gitem_t **)p - itemlist; } *(int *)p = index; break; case F_FUNCTION: if (*(byte **)p == NULL) { len = 0; } else { func = GetFunctionByAddress (*(byte **)p); if (!func) { gi.error ("WriteField1: function not in list, can't save game"); } len = strlen(func->funcStr)+1; } *(int *)p = len; break; case F_MMOVE: if (*(byte **)p == NULL) { len = 0; } else { mmove = GetMmoveByAddress (*(mmove_t **)p); if (!mmove) { gi.error ("WriteField1: mmove not in list, can't save game"); } len = strlen(mmove->mmoveStr)+1; } *(int *)p = len; break; default: gi.error("WriteEdict: unknown field type"); } } void WriteField2(FILE *f, field_t *field, byte *base) { int len; void *p; functionList_t *func; mmoveList_t *mmove; if (field->flags & FFL_SPAWNTEMP) { return; } p = (void *)(base + field->ofs); switch (field->type) { case F_LSTRING: if (*(char **)p) { len = strlen(*(char **)p) + 1; fwrite(*(char **)p, len, 1, f); } break; case F_FUNCTION: if (*(byte **)p) { func = GetFunctionByAddress (*(byte **)p); if (!func) { gi.error ("WriteField2: function not in list, can't save game"); } len = strlen(func->funcStr)+1; fwrite (func->funcStr, len, 1, f); } break; case F_MMOVE: if (*(byte **)p) { mmove = GetMmoveByAddress (*(mmove_t **)p); if (!mmove) { gi.error ("WriteField2: mmove not in list, can't save game"); } len = strlen(mmove->mmoveStr)+1; fwrite (mmove->mmoveStr, len, 1, f); } break; default: break; } } /* ========================================================= */ /* * This function does the dirty * work to read the data from a * file. The processing of the * data is done in the functions * below */ void ReadField(FILE *f, field_t *field, byte *base) { void *p; int len; int index; char funcStr[2048]; if (field->flags & FFL_SPAWNTEMP) { return; } p = (void *)(base + field->ofs); switch (field->type) { case F_INT: case F_FLOAT: case F_ANGLEHACK: case F_VECTOR: case F_IGNORE: break; case F_LSTRING: len = *(int *)p; if (!len) { *(char **)p = NULL; } else { *(char **)p = gi.TagMalloc(32 + len, TAG_LEVEL); fread(*(char **)p, len, 1, f); } break; case F_EDICT: index = *(int *)p; if (index == -1) { *(edict_t **)p = NULL; } else { *(edict_t **)p = &g_edicts[index]; } break; case F_CLIENT: index = *(int *)p; if (index == -1) { *(gclient_t **)p = NULL; } else { *(gclient_t **)p = &game.clients[index]; } break; case F_ITEM: index = *(int *)p; if (index == -1) { *(gitem_t **)p = NULL; } else { *(gitem_t **)p = &itemlist[index]; } break; case F_FUNCTION: len = *(int *)p; if (!len) { *(byte **)p = NULL; } else { if (len > sizeof(funcStr)) { gi.error ("ReadField: function name is longer than buffer (%i chars)", (int)sizeof(funcStr)); } fread (funcStr, len, 1, f); if ( !(*(byte **)p = FindFunctionByName (funcStr)) ) { gi.error ("ReadField: function %s not found in table, can't load game", funcStr); } } break; case F_MMOVE: len = *(int *)p; if (!len) { *(byte **)p = NULL; } else { if (len > sizeof(funcStr)) { gi.error ("ReadField: mmove name is longer than buffer (%i chars)", (int)sizeof(funcStr)); } fread (funcStr, len, 1, f); if ( !(*(mmove_t **)p = FindMmoveByName (funcStr)) ) { gi.error ("ReadField: mmove %s not found in table, can't load game", funcStr); } } break; default: gi.error("ReadEdict: unknown field type"); } } /* ========================================================= */ /* * Write the client struct into a file. */ void WriteClient(FILE *f, gclient_t *client) { field_t *field; gclient_t temp; /* all of the ints, floats, and vectors stay as they are */ temp = *client; /* change the pointers to indexes */ for (field = clientfields; field->name; field++) { WriteField1(f, field, (byte *)&temp); } /* write the block */ fwrite(&temp, sizeof(temp), 1, f); /* now write any allocated data following the edict */ for (field = clientfields; field->name; field++) { WriteField2(f, field, (byte *)client); } } /* * Read the client struct from a file */ void ReadClient(FILE *f, gclient_t *client, short save_ver) { field_t *field; fread(client, sizeof(*client), 1, f); for (field = clientfields; field->name; field++) { if (field->save_ver <= save_ver) { ReadField(f, field, (byte *)client); } } if (save_ver < 3) { InitClientResp(client); } } /* ========================================================= */ /* * Writes the game struct into * a file. This is called when * ever the games goes to e new * level or the user saves the * game. Saved informations are: * - cross level data * - client states * - help computer info */ void WriteGame(const char *filename, qboolean autosave) { savegameHeader_t sv; FILE *f; int i; if (!autosave) { SaveClientData(); } f = fopen(filename, "wb"); if (!f) { gi.error("Couldn't open %s", filename); } /* Savegame identification */ memset(&sv, 0, sizeof(sv)); Q_strlcpy(sv.ver, SAVEGAMEVER, sizeof(sv.ver) - 1); Q_strlcpy(sv.game, GAMEVERSION, sizeof(sv.game) - 1); Q_strlcpy(sv.os, YQ2OSTYPE, sizeof(sv.os) - 1); Q_strlcpy(sv.arch, YQ2ARCH, sizeof(sv.arch) - 1); fwrite(&sv, sizeof(sv), 1, f); game.autosaved = autosave; fwrite(&game, sizeof(game), 1, f); game.autosaved = false; for (i = 0; i < game.maxclients; i++) { WriteClient(f, &game.clients[i]); } fclose(f); } /* * Read the game structs from * a file. Called when ever a * savegames is loaded. */ void ReadGame(const char *filename) { savegameHeader_t sv; FILE *f; int i; short save_ver = 0; gi.FreeTags(TAG_GAME); f = fopen(filename, "rb"); if (!f) { gi.error("Couldn't open %s", filename); } /* Sanity checks */ fread(&sv, sizeof(sv), 1, f); static const struct { const char* verstr; int vernum; } version_mappings[] = { {"YQ2-1", 1}, {"YQ2-2", 2}, {"YQ2-3", 3}, {"YQ2-4", 4}, {"YQ2-5", 5}, }; for (i=0; i < sizeof(version_mappings)/sizeof(version_mappings[0]); ++i) { if (strcmp(version_mappings[i].verstr, sv.ver) == 0) { save_ver = version_mappings[i].vernum; break; } } if (save_ver == 0) // not found in mappings table { fclose(f); gi.error("Savegame from an incompatible version.\n"); } else if (save_ver == 1) { if (strcmp(sv.game, GAMEVERSION) != 0) { fclose(f); gi.error("Savegame from an other game.so.\n"); } else if (strcmp(sv.os, YQ2OSTYPE_1) != 0) { fclose(f); gi.error("Savegame from an other os.\n"); } #ifdef _WIN32 /* Windows was forced to i386 */ if (strcmp(sv.arch, "i386") != 0) { fclose(f); gi.error("Savegame from another architecture.\n"); } #else if (strcmp(sv.arch, YQ2ARCH_1) != 0) { fclose(f); gi.error("Savegame from another architecture.\n"); } #endif } else // all newer savegame versions { if (strcmp(sv.game, GAMEVERSION) != 0) { fclose(f); gi.error("Savegame from another game.so.\n"); } else if (strcmp(sv.os, YQ2OSTYPE) != 0) { fclose(f); gi.error("Savegame from another os.\n"); } else if (strcmp(sv.arch, YQ2ARCH) != 0) { #if defined(_WIN32) && (defined(__i386__) || defined(_M_IX86)) // before savegame version "YQ2-4" (and after version 1), // the official Win32 binaries accidentally had the YQ2ARCH "AMD64" // instead of "i386" set due to a bug in the Makefile. // This quirk allows loading those savegames anyway if (save_ver >= 4 || strcmp(sv.arch, "AMD64") != 0) #endif { fclose(f); gi.error("Savegame from another architecture.\n"); } } } g_edicts = gi.TagMalloc(game.maxentities * sizeof(g_edicts[0]), TAG_GAME); globals.edicts = g_edicts; fread(&game, sizeof(game), 1, f); game.clients = gi.TagMalloc(game.maxclients * sizeof(game.clients[0]), TAG_GAME); for (i = 0; i < game.maxclients; i++) { ReadClient(f, &game.clients[i], save_ver); } fclose(f); } /* ========================================================== */ /* * Helper function to write the * edict into a file. Called by * WriteLevel. */ void WriteEdict(FILE *f, edict_t *ent) { field_t *field; edict_t temp; /* all of the ints, floats, and vectors stay as they are */ temp = *ent; /* change the pointers to lengths or indexes */ for (field = fields; field->name; field++) { WriteField1(f, field, (byte *)&temp); } /* write the block */ fwrite(&temp, sizeof(temp), 1, f); /* now write any allocated data following the edict */ for (field = fields; field->name; field++) { WriteField2(f, field, (byte *)ent); } } /* * Helper function to write the * level local data into a file. * Called by WriteLevel. */ void WriteLevelLocals(FILE *f) { field_t *field; level_locals_t temp; /* all of the ints, floats, and vectors stay as they are */ temp = level; /* change the pointers to lengths or indexes */ for (field = levelfields; field->name; field++) { WriteField1(f, field, (byte *)&temp); } /* write the block */ fwrite(&temp, sizeof(temp), 1, f); /* now write any allocated data following the edict */ for (field = levelfields; field->name; field++) { WriteField2(f, field, (byte *)&level); } } /* * Writes the current level * into a file. */ void WriteLevel(const char *filename) { int i; edict_t *ent; FILE *f; f = fopen(filename, "wb"); if (!f) { gi.error("Couldn't open %s", filename); } /* write out edict size for checking */ i = sizeof(edict_t); fwrite(&i, sizeof(i), 1, f); /* write out level_locals_t */ WriteLevelLocals(f); /* write out all the entities */ for (i = 0; i < globals.num_edicts; i++) { ent = &g_edicts[i]; if (!ent->inuse) { continue; } fwrite(&i, sizeof(i), 1, f); WriteEdict(f, ent); } i = -1; fwrite(&i, sizeof(i), 1, f); fclose(f); } /* ========================================================== */ /* * A helper function to * read the edict back * into the memory. Called * by ReadLevel. */ void ReadEdict(FILE *f, edict_t *ent) { field_t *field; fread(ent, sizeof(*ent), 1, f); for (field = fields; field->name; field++) { ReadField(f, field, (byte *)ent); } } /* * A helper function to * read the level local * data from a file. * Called by ReadLevel. */ void ReadLevelLocals(FILE *f) { field_t *field; fread(&level, sizeof(level), 1, f); for (field = levelfields; field->name; field++) { ReadField(f, field, (byte *)&level); } } /* * Reads a level back into the memory. * SpawnEntities were already called * in the same way when the level was * saved. All world links were cleared * before this function was called. When * this function is called, no clients * are connected to the server. */ void ReadLevel(const char *filename) { int entnum; FILE *f; int i; edict_t *ent; f = fopen(filename, "rb"); if (!f) { gi.error("Couldn't open %s", filename); } /* free any dynamic memory allocated by loading the level base state */ gi.FreeTags(TAG_LEVEL); /* wipe all the entities */ memset(g_edicts, 0, game.maxentities * sizeof(g_edicts[0])); globals.num_edicts = maxclients->value + 1; /* check edict size */ fread(&i, sizeof(i), 1, f); if (i != sizeof(edict_t)) { fclose(f); gi.error("ReadLevel: mismatched edict size"); } /* load the level locals */ ReadLevelLocals(f); /* load all the entities */ while (1) { if (fread(&entnum, sizeof(entnum), 1, f) != 1) { fclose(f); gi.error("ReadLevel: failed to read entnum"); } if (entnum == -1) { break; } if (entnum >= globals.num_edicts) { globals.num_edicts = entnum + 1; } ent = &g_edicts[entnum]; ReadEdict(f, ent); /* let the server rebuild world links for this ent */ memset(&ent->area, 0, sizeof(ent->area)); gi.linkentity(ent); } fclose(f); /* mark all clients as unconnected */ for (i = 0; i < maxclients->value; i++) { ent = &g_edicts[i + 1]; ent->client = game.clients + i; ent->client->pers.connected = false; } /* do any load time things at this point */ for (i = 0; i < globals.num_edicts; i++) { ent = &g_edicts[i]; if (!ent->inuse) { continue; } /* fire any cross-level triggers */ if (ent->classname) { if (strcmp(ent->classname, "target_crosslevel_target") == 0) { ent->nextthink = level.time + ent->delay; } } } } xatrix-XATRIX_2_14/src/savegame/tables/000077500000000000000000000000001477320050300177715ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/savegame/tables/clientfields.h000066400000000000000000000010071477320050300226050ustar00rootroot00000000000000/* * ======================================================================= * * Fields of the client to be saved. * * ======================================================================= */ {"pers.weapon", CLOFS(pers.weapon), F_ITEM}, {"pers.lastweapon", CLOFS(pers.lastweapon), F_ITEM}, {"newweapon", CLOFS(newweapon), F_ITEM}, {"resp.coop_respawn.weapon", CLOFS(resp.coop_respawn.weapon), F_ITEM, 0, 3}, {"resp.coop_respawn.lastweapon", CLOFS(resp.coop_respawn.lastweapon), F_ITEM, 0, 3}, {NULL, 0, F_INT} xatrix-XATRIX_2_14/src/savegame/tables/fields.h000066400000000000000000000076131477320050300214170ustar00rootroot00000000000000/* * ======================================================================= * * Game fields to be saved. * * ======================================================================= */ {"classname", FOFS(classname), F_LSTRING}, {"model", FOFS(model), F_LSTRING}, {"spawnflags", FOFS(spawnflags), F_INT}, {"speed", FOFS(speed), F_FLOAT}, {"accel", FOFS(accel), F_FLOAT}, {"decel", FOFS(decel), F_FLOAT}, {"target", FOFS(target), F_LSTRING}, {"targetname", FOFS(targetname), F_LSTRING}, {"pathtarget", FOFS(pathtarget), F_LSTRING}, {"deathtarget", FOFS(deathtarget), F_LSTRING}, {"killtarget", FOFS(killtarget), F_LSTRING}, {"combattarget", FOFS(combattarget), F_LSTRING}, {"message", FOFS(message), F_LSTRING}, {"team", FOFS(team), F_LSTRING}, {"wait", FOFS(wait), F_FLOAT}, {"delay", FOFS(delay), F_FLOAT}, {"random", FOFS(random), F_FLOAT}, {"move_origin", FOFS(move_origin), F_VECTOR}, {"move_angles", FOFS(move_angles), F_VECTOR}, {"style", FOFS(style), F_INT}, {"count", FOFS(count), F_INT}, {"health", FOFS(health), F_INT}, {"sounds", FOFS(sounds), F_INT}, {"light", 0, F_IGNORE}, {"dmg", FOFS(dmg), F_INT}, {"mass", FOFS(mass), F_INT}, {"volume", FOFS(volume), F_FLOAT}, {"attenuation", FOFS(attenuation), F_FLOAT}, {"map", FOFS(map), F_LSTRING}, {"origin", FOFS(s.origin), F_VECTOR}, {"angles", FOFS(s.angles), F_VECTOR}, {"angle", FOFS(s.angles), F_ANGLEHACK}, {"goalentity", FOFS(goalentity), F_EDICT, FFL_NOSPAWN}, {"movetarget", FOFS(movetarget), F_EDICT, FFL_NOSPAWN}, {"enemy", FOFS(enemy), F_EDICT, FFL_NOSPAWN}, {"oldenemy", FOFS(oldenemy), F_EDICT, FFL_NOSPAWN}, {"activator", FOFS(activator), F_EDICT, FFL_NOSPAWN}, {"groundentity", FOFS(groundentity), F_EDICT, FFL_NOSPAWN}, {"teamchain", FOFS(teamchain), F_EDICT, FFL_NOSPAWN}, {"teammaster", FOFS(teammaster), F_EDICT, FFL_NOSPAWN}, {"owner", FOFS(owner), F_EDICT, FFL_NOSPAWN}, {"mynoise", FOFS(mynoise), F_EDICT, FFL_NOSPAWN}, {"mynoise2", FOFS(mynoise2), F_EDICT, FFL_NOSPAWN}, {"target_ent", FOFS(target_ent), F_EDICT, FFL_NOSPAWN}, {"chain", FOFS(chain), F_EDICT, FFL_NOSPAWN}, {"prethink", FOFS(prethink), F_FUNCTION, FFL_NOSPAWN}, {"think", FOFS(think), F_FUNCTION, FFL_NOSPAWN}, {"blocked", FOFS(blocked), F_FUNCTION, FFL_NOSPAWN}, {"touch", FOFS(touch), F_FUNCTION, FFL_NOSPAWN}, {"use", FOFS(use), F_FUNCTION, FFL_NOSPAWN}, {"pain", FOFS(pain), F_FUNCTION, FFL_NOSPAWN}, {"die", FOFS(die), F_FUNCTION, FFL_NOSPAWN}, {"stand", FOFS(monsterinfo.stand), F_FUNCTION, FFL_NOSPAWN}, {"idle", FOFS(monsterinfo.idle), F_FUNCTION, FFL_NOSPAWN}, {"search", FOFS(monsterinfo.search), F_FUNCTION, FFL_NOSPAWN}, {"walk", FOFS(monsterinfo.walk), F_FUNCTION, FFL_NOSPAWN}, {"run", FOFS(monsterinfo.run), F_FUNCTION, FFL_NOSPAWN}, {"dodge", FOFS(monsterinfo.dodge), F_FUNCTION, FFL_NOSPAWN}, {"attack", FOFS(monsterinfo.attack), F_FUNCTION, FFL_NOSPAWN}, {"melee", FOFS(monsterinfo.melee), F_FUNCTION, FFL_NOSPAWN}, {"sight", FOFS(monsterinfo.sight), F_FUNCTION, FFL_NOSPAWN}, {"checkattack", FOFS(monsterinfo.checkattack), F_FUNCTION, FFL_NOSPAWN}, {"currentmove", FOFS(monsterinfo.currentmove), F_MMOVE, FFL_NOSPAWN}, {"endfunc", FOFS(moveinfo.endfunc), F_FUNCTION, FFL_NOSPAWN}, {"lip", STOFS(lip), F_INT, FFL_SPAWNTEMP}, {"distance", STOFS(distance), F_INT, FFL_SPAWNTEMP}, {"height", STOFS(height), F_INT, FFL_SPAWNTEMP}, {"noise", STOFS(noise), F_LSTRING, FFL_SPAWNTEMP}, {"pausetime", STOFS(pausetime), F_FLOAT, FFL_SPAWNTEMP}, {"item", STOFS(item), F_LSTRING, FFL_SPAWNTEMP}, {"item", FOFS(item), F_ITEM}, {"gravity", STOFS(gravity), F_LSTRING, FFL_SPAWNTEMP}, {"sky", STOFS(sky), F_LSTRING, FFL_SPAWNTEMP}, {"skyrotate", STOFS(skyrotate), F_FLOAT, FFL_SPAWNTEMP}, {"skyaxis", STOFS(skyaxis), F_VECTOR, FFL_SPAWNTEMP}, {"minyaw", STOFS(minyaw), F_FLOAT, FFL_SPAWNTEMP}, {"maxyaw", STOFS(maxyaw), F_FLOAT, FFL_SPAWNTEMP}, {"minpitch", STOFS(minpitch), F_FLOAT, FFL_SPAWNTEMP}, {"maxpitch", STOFS(maxpitch), F_FLOAT, FFL_SPAWNTEMP}, {"nextmap", STOFS(nextmap), F_LSTRING, FFL_SPAWNTEMP}, {0, 0, 0, 0} xatrix-XATRIX_2_14/src/savegame/tables/gamefunc_decs.h000066400000000000000000002214331477320050300227320ustar00rootroot00000000000000/* * Copyright (C) 1997-2001 Id Software, Inc. * Copyright (C) 2011 Yamagi Burmeister * * 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. * * ======================================================================= * * Prototypes for every function in the game.so. * * ======================================================================= */ extern void ReadLevel ( const char * filename ) ; extern void ReadLevelLocals ( FILE * f ) ; extern void ReadEdict ( FILE * f , edict_t * ent ) ; extern void WriteLevel ( const char * filename ) ; extern void WriteLevelLocals ( FILE * f ) ; extern void WriteEdict ( FILE * f , edict_t * ent ) ; extern void ReadGame ( const char * filename ) ; extern void WriteGame ( const char * filename , qboolean autosave ) ; extern void ReadClient ( FILE * f , gclient_t * client , short save_ver ) ; extern void WriteClient ( FILE * f , gclient_t * client ) ; extern void ReadField ( FILE * f , field_t * field , byte * base ) ; extern void WriteField2 ( FILE * f , field_t * field , byte * base ) ; extern void WriteField1 ( FILE * f , field_t * field , byte * base ) ; extern mmove_t * FindMmoveByName ( char * name ) ; extern mmoveList_t * GetMmoveByAddress ( mmove_t * adr ) ; extern byte * FindFunctionByName ( char * name ) ; extern functionList_t * GetFunctionByAddress ( byte * adr ) ; extern void InitGame ( void ) ; extern void Info_SetValueForKey ( char * s , char * key , char * value ) ; extern qboolean Info_Validate ( char * s ) ; extern void Info_RemoveKey ( char * s , char * key ) ; extern char * Info_ValueForKey ( char * s , char * key ) ; extern void Com_sprintf ( char * dest , int size , char * fmt , ... ) ; extern int Q_strcasecmp ( char * s1 , char * s2 ) ; extern int Q_strncasecmp ( char * s1 , char * s2 , int n ) ; extern int Q_stricmp ( const char * s1 , const char * s2 ) ; extern void Com_PageInMemory ( byte * buffer , int size ) ; extern char * COM_Parse ( char * * data_p ) ; extern char * va ( const char * format , ... ) ; extern void Swap_Init ( void ) ; extern float FloatNoSwap ( float f ) ; extern float FloatSwap ( float f ) ; extern int LongNoSwap ( int l ) ; extern int LongSwap ( int l ) ; extern short ShortNoSwap ( short l ) ; extern short ShortSwap ( short l ) ; extern float LittleFloat ( float l ) ; extern float BigFloat ( float l ) ; extern int LittleLong ( int l ) ; extern int BigLong ( int l ) ; extern short LittleShort ( short l ) ; extern short BigShort ( short l ) ; extern void COM_DefaultExtension ( char * path , const char * extension ) ; extern void COM_FilePath ( const char * in , char * out ) ; extern void COM_FileBase ( char * in , char * out ) ; extern const char * COM_FileExtension ( const char * in ) ; extern void COM_StripExtension ( char * in , char * out ) ; extern char * COM_SkipPath ( char * pathname ) ; extern int Q_log2 ( int val ) ; extern void VectorScale ( vec3_t in , vec_t scale , vec3_t out ) ; extern void VectorInverse ( vec3_t v ) ; extern vec_t VectorLength ( vec3_t v ) ; extern void CrossProduct ( vec3_t v1 , vec3_t v2 , vec3_t cross ) ; extern void _VectorCopy ( vec3_t in , vec3_t out ) ; extern void _VectorAdd ( vec3_t veca , vec3_t vecb , vec3_t out ) ; extern void _VectorSubtract ( vec3_t veca , vec3_t vecb , vec3_t out ) ; extern vec_t _DotProduct ( vec3_t v1 , vec3_t v2 ) ; extern void VectorMA ( vec3_t veca , float scale , vec3_t vecb , vec3_t vecc ) ; extern vec_t VectorNormalize2 ( vec3_t v , vec3_t out ) ; extern vec_t VectorNormalize ( vec3_t v ) ; extern int VectorCompare ( vec3_t v1 , vec3_t v2 ) ; extern void AddPointToBounds ( vec3_t v , vec3_t mins , vec3_t maxs ) ; extern void ClearBounds ( vec3_t mins , vec3_t maxs ) ; extern int BoxOnPlaneSide2 ( vec3_t emins , vec3_t emaxs , struct cplane_s * p ) ; extern float anglemod ( float a ) ; extern float LerpAngle ( float a2 , float a1 , float frac ) ; extern float Q_fabs ( float f ) ; extern void R_ConcatTransforms ( float in1 [ 3 ] [ 4 ] , float in2 [ 3 ] [ 4 ] , float out [ 3 ] [ 4 ] ) ; extern void R_ConcatRotations ( float in1 [ 3 ] [ 3 ] , float in2 [ 3 ] [ 3 ] , float out [ 3 ] [ 3 ] ) ; extern void PerpendicularVector ( vec3_t dst , const vec3_t src ) ; extern void ProjectPointOnPlane ( vec3_t dst , const vec3_t p , const vec3_t normal ) ; extern void AngleVectors ( vec3_t angles , vec3_t forward , vec3_t right , vec3_t up ) ; extern void RotatePointAroundVector ( vec3_t dst , const vec3_t dir , const vec3_t point , float degrees ) ; extern void Weapon_Trap ( edict_t * ent ) ; extern void weapon_trap_fire ( edict_t * ent , qboolean held ) ; extern void Weapon_Phalanx ( edict_t * ent ) ; extern void weapon_phalanx_fire ( edict_t * ent ) ; extern void Weapon_Ionripper ( edict_t * ent ) ; extern void weapon_ionripper_fire ( edict_t * ent ) ; extern void Weapon_BFG ( edict_t * ent ) ; extern void weapon_bfg_fire ( edict_t * ent ) ; extern void Weapon_Railgun ( edict_t * ent ) ; extern void weapon_railgun_fire ( edict_t * ent ) ; extern void Weapon_SuperShotgun ( edict_t * ent ) ; extern void weapon_supershotgun_fire ( edict_t * ent ) ; extern void Weapon_Shotgun ( edict_t * ent ) ; extern void weapon_shotgun_fire ( edict_t * ent ) ; extern void Weapon_Chaingun ( edict_t * ent ) ; extern void Chaingun_Fire ( edict_t * ent ) ; extern void Weapon_Machinegun ( edict_t * ent ) ; extern void Machinegun_Fire ( edict_t * ent ) ; extern void Weapon_HyperBlaster ( edict_t * ent ) ; extern void Weapon_HyperBlaster_Fire ( edict_t * ent ) ; extern void Weapon_Blaster ( edict_t * ent ) ; extern void Weapon_Blaster_Fire ( edict_t * ent ) ; extern void Blaster_Fire ( edict_t * ent , vec3_t g_offset , int damage , qboolean hyper , int effect ) ; extern void Weapon_RocketLauncher ( edict_t * ent ) ; extern void Weapon_RocketLauncher_Fire ( edict_t * ent ) ; extern void Weapon_GrenadeLauncher ( edict_t * ent ) ; extern void weapon_grenadelauncher_fire ( edict_t * ent ) ; extern void Weapon_Grenade ( edict_t * ent ) ; extern void weapon_grenade_fire ( edict_t * ent , qboolean held ) ; extern void Weapon_Generic ( edict_t * ent , int FRAME_ACTIVATE_LAST , int FRAME_FIRE_LAST , int FRAME_IDLE_LAST , int FRAME_DEACTIVATE_LAST , int * pause_frames , int * fire_frames , void ( * fire ) ( edict_t * ent ) ) ; extern void Drop_Weapon ( edict_t * ent , gitem_t * item ) ; extern void Use_Weapon2 ( edict_t * ent , gitem_t * item ) ; extern void Use_Weapon ( edict_t * ent , gitem_t * item ) ; extern void Think_Weapon ( edict_t * ent ) ; extern void NoAmmoWeaponChange ( edict_t * ent ) ; extern void ChangeWeapon ( edict_t * ent ) ; extern qboolean Pickup_Weapon ( edict_t * ent , edict_t * other ) ; extern void PlayerNoise ( edict_t * who , vec3_t where , int type ) ; extern void ClientEndServerFrame ( edict_t * ent ) ; extern void P_ProjectSource(edict_t *ent, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result); extern void G_SetClientFrame ( edict_t * ent ) ; extern void G_SetClientSound ( edict_t * ent ) ; extern void G_SetClientEvent ( edict_t * ent ) ; extern void G_SetClientEffects ( edict_t * ent ) ; extern void P_WorldEffects ( void ) ; extern void P_FallingDamage ( edict_t * ent ) ; extern void SV_CalcBlend ( edict_t * ent ) ; extern void SV_AddBlend ( float r , float g , float b , float a , float * v_blend ) ; extern void SV_CalcGunOffset ( edict_t * ent ) ; extern void SV_CalcViewOffset ( edict_t * ent ) ; extern void P_DamageFeedback ( edict_t * player ) ; extern float SV_CalcRoll ( vec3_t angles , vec3_t velocity ) ; extern edict_t * PlayerTrail_LastSpot ( void ) ; extern edict_t * PlayerTrail_PickNext ( edict_t * self ) ; extern edict_t * PlayerTrail_PickFirst ( edict_t * self ) ; extern void PlayerTrail_New ( vec3_t spot ) ; extern void PlayerTrail_Add ( vec3_t spot ) ; extern void PlayerTrail_Init ( void ) ; extern void G_SetSpectatorStats ( edict_t * ent ) ; extern void G_CheckChaseStats ( edict_t * ent ) ; extern void G_SetStats ( edict_t * ent ) ; extern void InventoryMessage ( edict_t * ent ) ; extern void HelpComputerMessage ( edict_t * ent ) ; extern void DeathmatchScoreboardMessage ( edict_t * ent , edict_t * killer ) ; extern void BeginIntermission ( edict_t * targ ) ; extern void MoveClientToIntermission ( edict_t * ent ) ; extern void ClientBeginServerFrame ( edict_t * ent ) ; extern void ClientThink ( edict_t * ent , usercmd_t * ucmd ) ; extern void PrintPmove ( pmove_t * pm ) ; extern unsigned CheckBlock ( void * b , int c ) ; extern trace_t PM_trace ( vec3_t start , vec3_t mins , vec3_t maxs , vec3_t end ) ; extern void ClientDisconnect ( edict_t * ent ) ; extern qboolean ClientConnect ( edict_t * ent , char * userinfo ) ; extern void ClientUserinfoChanged ( edict_t * ent , char * userinfo ) ; extern void ClientBegin ( edict_t * ent ) ; extern void ClientBeginDeathmatch ( edict_t * ent ) ; extern void PutClientInServer ( edict_t * ent ) ; extern void spectator_respawn ( edict_t * ent ) ; extern void respawn ( edict_t * self ) ; extern void CopyToBodyQue ( edict_t * ent ) ; extern void body_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void InitBodyQue ( void ) ; extern void SelectSpawnPoint ( edict_t * ent , vec3_t origin , vec3_t angles ) ; extern edict_t * SelectCoopSpawnPoint ( edict_t * ent ) ; extern edict_t * SelectDeathmatchSpawnPoint ( void ) ; extern edict_t * SelectFarthestDeathmatchSpawnPoint ( void ) ; extern edict_t * SelectRandomDeathmatchSpawnPoint ( void ) ; extern float PlayersRangeFromSpot ( edict_t * spot ) ; extern void FetchClientEntData ( edict_t * ent ) ; extern void SaveClientData ( void ) ; extern void InitClientResp ( gclient_t * client ) ; extern void InitClientPersistant ( gclient_t * client ) ; extern void player_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void LookAtKiller ( edict_t * self , edict_t * inflictor , edict_t * attacker ) ; extern void TossClientWeapon ( edict_t * self ) ; extern void ClientObituary ( edict_t * self , edict_t * inflictor , edict_t * attacker ) ; extern qboolean IsNeutral ( edict_t * ent ) ; extern qboolean IsFemale ( edict_t * ent ) ; extern void player_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void SP_info_player_intermission ( edict_t *ent ); extern void SP_info_player_coop ( edict_t * self ) ; extern void SP_info_player_deathmatch ( edict_t * self ) ; extern void SP_info_player_start ( edict_t * self ) ; extern void SP_CreateCoopSpots ( edict_t * self ) ; extern void SP_FixCoopSpots ( edict_t * self ) ; extern void SP_monster_tank ( edict_t * self ) ; extern void tank_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void tank_dead ( edict_t * self ) ; extern void tank_attack ( edict_t * self ) ; extern void tank_doattack_rocket ( edict_t * self ) ; extern void tank_refire_rocket ( edict_t * self ) ; extern void tank_poststrike ( edict_t * self ) ; extern void tank_reattack_blaster ( edict_t * self ) ; extern void TankMachineGun ( edict_t * self ) ; extern void TankRocket ( edict_t * self ) ; extern void TankStrike ( edict_t * self ) ; extern void TankBlaster ( edict_t * self ) ; extern void tank_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void tank_run ( edict_t * self ) ; extern void tank_walk ( edict_t * self ) ; extern void tank_stand ( edict_t * self ) ; extern void tank_idle ( edict_t * self ) ; extern void tank_windup ( edict_t * self ) ; extern void tank_thud ( edict_t * self ) ; extern void tank_footstep ( edict_t * self ) ; extern void tank_sight ( edict_t * self , edict_t * other ) ; extern void SP_monster_supertank ( edict_t * self ) ; extern void supertank_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void BossExplode ( edict_t * self ) ; extern void supertank_dead ( edict_t * self ) ; extern void supertank_attack ( edict_t * self ) ; extern void supertankMachineGun ( edict_t * self ) ; extern void supertankRocket ( edict_t * self ) ; extern void supertank_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void supertank_reattack1 ( edict_t * self ) ; extern void supertank_run ( edict_t * self ) ; extern void supertank_walk ( edict_t * self ) ; extern void supertank_forward ( edict_t * self ) ; extern void supertank_stand ( edict_t * self ) ; extern void supertank_search ( edict_t * self ) ; extern void TreadSound ( edict_t * self ) ; extern void SP_monster_soldier_lasergun ( edict_t * self ) ; extern void SP_monster_soldier_hypergun ( edict_t * self ) ; extern void SP_monster_soldier_ripper ( edict_t * self ) ; extern void SP_monster_soldier_h ( edict_t * self ) ; extern void soldierh_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void soldierh_dead ( edict_t * self ) ; extern void soldierh_fire7 ( edict_t * self ) ; extern void soldierh_fire6 ( edict_t * self ) ; extern void soldierh_dodge ( edict_t * self , edict_t * attacker , float eta ) ; extern void soldierh_duck_hold ( edict_t * self ) ; extern void soldierh_sight ( edict_t * self , edict_t * other ) ; extern void soldierh_attack ( edict_t * self ) ; extern void soldierh_attack6_refire ( edict_t * self ) ; extern void soldierh_fire8 ( edict_t * self ) ; extern void soldierh_fire4 ( edict_t * self ) ; extern void soldierh_attack3_refire ( edict_t * self ) ; extern void soldierh_fire3 ( edict_t * self ) ; extern void soldierh_duck_up ( edict_t * self ) ; extern void soldierh_duck_down ( edict_t * self ) ; extern void soldierh_attack2_refire2 ( edict_t * self ) ; extern void soldierh_attack2_refire1 ( edict_t * self ) ; extern void soldierh_fire2 ( edict_t * self ) ; extern void soldierh_ripper2 ( edict_t * self ) ; extern void soldierh_hyper_refire2 ( edict_t * self ) ; extern void soldierh_hyper_sound ( edict_t * self ) ; extern void soldierh_attack1_refire2 ( edict_t * self ) ; extern void soldierh_attack1_refire1 ( edict_t * self ) ; extern void soldierh_fire1 ( edict_t * self ) ; extern void soldierh_ripper1 ( edict_t * self ) ; extern void soldierh_hyper_refire1 ( edict_t * self ) ; extern void soldierh_fire ( edict_t * self , int flash_number ) ; extern void soldierh_laserbeam ( edict_t * self , int flash_index ) ; extern void soldierh_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void soldierh_run ( edict_t * self ) ; extern void soldierh_walk ( edict_t * self ) ; extern void soldierh_walk1_random ( edict_t * self ) ; extern void soldierh_stand ( edict_t * self ) ; extern void soldierh_cock ( edict_t * self ) ; extern void soldierh_idle ( edict_t * self ) ; extern void SP_monster_soldier_ss ( edict_t * self ) ; extern void SP_monster_soldier ( edict_t * self ) ; extern void SP_monster_soldier_light ( edict_t * self ) ; extern void SP_monster_soldier_x ( edict_t * self ) ; extern void soldier_footstep( edict_t *self ) ; extern void soldier_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void soldier_dead ( edict_t * self ) ; extern void soldier_fire7 ( edict_t * self ) ; extern void soldier_fire6 ( edict_t * self ) ; extern void soldier_dodge ( edict_t * self , edict_t * attacker , float eta ) ; extern void soldier_duck_hold ( edict_t * self ) ; extern void soldier_sight ( edict_t * self , edict_t * other ) ; extern void soldier_attack ( edict_t * self ) ; extern void soldier_attack6_refire ( edict_t * self ) ; extern void soldier_fire8 ( edict_t * self ) ; extern void soldier_fire4 ( edict_t * self ) ; extern void soldier_attack3_refire ( edict_t * self ) ; extern void soldier_fire3 ( edict_t * self ) ; extern void soldier_duck_up ( edict_t * self ) ; extern void soldier_duck_down ( edict_t * self ) ; extern void soldier_attack2_refire2 ( edict_t * self ) ; extern void soldier_attack2_refire1 ( edict_t * self ) ; extern void soldier_fire2 ( edict_t * self ) ; extern void soldier_attack1_refire2 ( edict_t * self ) ; extern void soldier_attack1_refire1 ( edict_t * self ) ; extern void soldier_fire1 ( edict_t * self ) ; extern void soldier_fire ( edict_t * self , int flash_number ) ; extern void soldier_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void soldier_run ( edict_t * self ) ; extern void soldier_walk ( edict_t * self ) ; extern void soldier_walk1_random ( edict_t * self ) ; extern void soldier_stand ( edict_t * self ) ; extern void soldier_cock ( edict_t * self ) ; extern void soldier_idle ( edict_t * self ) ; extern void SP_monster_parasite ( edict_t * self ) ; extern void parasite_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void parasite_dead ( edict_t * self ) ; extern void parasite_attack ( edict_t * self ) ; extern void parasite_drain_attack ( edict_t * self ) ; extern qboolean parasite_drain_attack_ok ( vec3_t start , vec3_t end ) ; extern void parasite_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void parasite_walk ( edict_t * self ) ; extern void parasite_start_walk ( edict_t * self ) ; extern void parasite_run ( edict_t * self ) ; extern void parasite_start_run ( edict_t * self ) ; extern void parasite_stand ( edict_t * self ) ; extern void parasite_idle ( edict_t * self ) ; extern void parasite_refidget ( edict_t * self ) ; extern void parasite_do_fidget ( edict_t * self ) ; extern void parasite_end_fidget ( edict_t * self ) ; extern void parasite_search ( edict_t * self ) ; extern void parasite_scratch ( edict_t * self ) ; extern void parasite_tap ( edict_t * self ) ; extern void parasite_sight ( edict_t * self , edict_t * other ) ; extern void parasite_reel_in ( edict_t * self ) ; extern void parasite_launch ( edict_t * self ) ; extern void SP_monster_mutant ( edict_t * self ) ; extern void mutant_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void mutant_dead ( edict_t * self ) ; extern void mutant_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern qboolean mutant_checkattack ( edict_t * self ) ; extern qboolean mutant_check_jump ( edict_t * self ) ; extern qboolean mutant_check_melee ( edict_t * self ) ; extern void mutant_jump ( edict_t * self ) ; extern void mutant_check_landing ( edict_t * self ) ; extern void mutant_jump_takeoff ( edict_t * self ) ; extern void mutant_jump_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void mutant_melee ( edict_t * self ) ; extern void mutant_check_refire ( edict_t * self ) ; extern void mutant_hit_right ( edict_t * self ) ; extern void mutant_hit_left ( edict_t * self ) ; extern void mutant_run ( edict_t * self ) ; extern void mutant_walk ( edict_t * self ) ; extern void mutant_walk_loop ( edict_t * self ) ; extern void mutant_idle ( edict_t * self ) ; extern void mutant_idle_loop ( edict_t * self ) ; extern void mutant_stand ( edict_t * self ) ; extern void mutant_swing ( edict_t * self ) ; extern void mutant_search ( edict_t * self ) ; extern void mutant_sight ( edict_t * self , edict_t * other ) ; extern void mutant_step ( edict_t * self ) ; extern qboolean M_walkmove ( edict_t * ent , float yaw , float dist ) ; extern void M_MoveToGoal ( edict_t * ent , float dist ) ; extern qboolean SV_CloseEnough ( edict_t * ent , edict_t * goal , float dist ) ; extern void SV_NewChaseDir ( edict_t * actor , edict_t * enemy , float dist ) ; extern void SV_FixCheckBottom ( edict_t * ent ) ; extern qboolean SV_StepDirection ( edict_t * ent , float yaw , float dist ) ; extern void M_ChangeYaw ( edict_t * ent ) ; extern qboolean SV_movestep ( edict_t * ent , vec3_t move , qboolean relink ) ; extern qboolean M_CheckBottom ( edict_t * ent ) ; extern void SP_monster_medic ( edict_t * self ) ; extern void medic_footstep( edict_t *self ) ; extern qboolean medic_checkattack ( edict_t * self ) ; extern void medic_attack ( edict_t * self ) ; extern void medic_hook_retract ( edict_t * self ) ; extern void medic_cable_attack ( edict_t * self ) ; extern void medic_hook_launch ( edict_t * self ) ; extern void medic_continue ( edict_t * self ) ; extern void medic_dodge ( edict_t * self , edict_t * attacker , float eta ) ; extern void medic_duck_up ( edict_t * self ) ; extern void medic_duck_hold ( edict_t * self ) ; extern void medic_duck_down ( edict_t * self ) ; extern void medic_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void medic_dead ( edict_t * self ) ; extern void medic_fire_blaster ( edict_t * self ) ; extern void medic_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void medic_run ( edict_t * self ) ; extern void medic_walk ( edict_t * self ) ; extern void medic_stand ( edict_t * self ) ; extern void medic_sight ( edict_t * self , edict_t * other ) ; extern void medic_search ( edict_t * self ) ; extern void medic_idle ( edict_t * self ) ; extern edict_t * medic_FindDeadMonster ( edict_t * self ) ; extern void SP_misc_insane ( edict_t * self ) ; extern void insane_footstep( edict_t *self ) ; extern void insane_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void insane_dead ( edict_t * self ) ; extern void insane_stand ( edict_t * self ) ; extern void insane_checkup ( edict_t * self ) ; extern void insane_checkdown ( edict_t * self ) ; extern void insane_onground ( edict_t * self ) ; extern void insane_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void insane_run ( edict_t * self ) ; extern void insane_walk ( edict_t * self ) ; extern void insane_cross ( edict_t * self ) ; extern void insane_scream ( edict_t * self ) ; extern void insane_moan ( edict_t * self ) ; extern void insane_shake ( edict_t * self ) ; extern void insane_fist ( edict_t * self ) ; extern void SP_monster_infantry ( edict_t * self ) ; extern void infantry_footstep( edict_t *self ) ; extern void infantry_attack ( edict_t * self ) ; extern void infantry_smack ( edict_t * self ) ; extern void infantry_swing ( edict_t * self ) ; extern void infantry_fire ( edict_t * self ) ; extern void infantry_cock_gun ( edict_t * self ) ; extern void infantry_set_firetime ( edict_t * self ) ; extern void infantry_dodge ( edict_t * self , edict_t * attacker , float eta ) ; extern void infantry_duck_up ( edict_t * self ) ; extern void infantry_duck_hold ( edict_t * self ) ; extern void infantry_duck_down ( edict_t * self ) ; extern void infantry_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void infantry_dead ( edict_t * self ) ; extern void infantry_sight ( edict_t * self , edict_t * other ) ; extern void InfantryMachineGun ( edict_t * self ) ; extern void infantry_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void infantry_run ( edict_t * self ) ; extern void infantry_walk ( edict_t * self ) ; extern void infantry_fidget ( edict_t * self ) ; extern void infantry_stand ( edict_t * self ) ; extern void SP_monster_hover ( edict_t * self ) ; extern void hover_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void hover_dead ( edict_t * self ) ; extern void hover_deadthink ( edict_t * self ) ; extern void hover_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void hover_attack ( edict_t * self ) ; extern void hover_start_attack ( edict_t * self ) ; extern void hover_walk ( edict_t * self ) ; extern void hover_run ( edict_t * self ) ; extern void hover_stand ( edict_t * self ) ; extern void hover_fire_blaster ( edict_t * self ) ; extern void hover_reattack ( edict_t * self ) ; extern void hover_search ( edict_t * self ) ; extern void hover_sight ( edict_t * self , edict_t * other ) ; extern void SP_monster_gunner ( edict_t * self ) ; extern void gunner_footstep( edict_t *self ) ; extern void gunner_refire_chain ( edict_t * self ) ; extern void gunner_fire_chain ( edict_t * self ) ; extern void gunner_attack ( edict_t * self ) ; extern void GunnerGrenade ( edict_t * self ) ; extern void GunnerFire ( edict_t * self ) ; extern void gunner_opengun ( edict_t * self ) ; extern void gunner_dodge ( edict_t * self , edict_t * attacker , float eta ) ; extern void gunner_duck_up ( edict_t * self ) ; extern void gunner_duck_hold ( edict_t * self ) ; extern void gunner_duck_down ( edict_t * self ) ; extern void gunner_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void gunner_dead ( edict_t * self ) ; extern void gunner_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void gunner_runandshoot ( edict_t * self ) ; extern void gunner_run ( edict_t * self ) ; extern void gunner_walk ( edict_t * self ) ; extern void gunner_stand ( edict_t * self ) ; extern void gunner_fidget ( edict_t * self ) ; extern void gunner_search ( edict_t * self ) ; extern void gunner_sight ( edict_t * self , edict_t * other ) ; extern void gunner_idlesound ( edict_t * self ) ; extern void SP_monster_gladiator ( edict_t * self ) ; extern void gladiator_footstep( edict_t *self ) ; extern void gladiator_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void gladiator_dead ( edict_t * self ) ; extern void gladiator_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void gladiator_attack ( edict_t * self ) ; extern void GladiatorGun ( edict_t * self ) ; extern void gladiator_melee ( edict_t * self ) ; extern void GaldiatorMelee ( edict_t * self ) ; extern void gladiator_run ( edict_t * self ) ; extern void gladiator_walk ( edict_t * self ) ; extern void gladiator_stand ( edict_t * self ) ; extern void gladiator_cleaver_swing ( edict_t * self ) ; extern void gladiator_search ( edict_t * self ) ; extern void gladiator_sight ( edict_t * self , edict_t * other ) ; extern void gladiator_idle ( edict_t * self ) ; extern void SP_monster_gladb ( edict_t * self ) ; extern void gladb_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void gladb_dead ( edict_t * self ) ; extern void gladb_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void gladb_attack ( edict_t * self ) ; extern void gladbGun_check ( edict_t * self ) ; extern void gladbGun ( edict_t * self ) ; extern void gladb_melee ( edict_t * self ) ; extern void GladbMelee ( edict_t * self ) ; extern void gladb_run ( edict_t * self ) ; extern void gladb_walk ( edict_t * self ) ; extern void gladb_stand ( edict_t * self ) ; extern void gladb_cleaver_swing ( edict_t * self ) ; extern void gladb_search ( edict_t * self ) ; extern void gladb_sight ( edict_t * self , edict_t * other ) ; extern void gladb_idle ( edict_t * self ) ; extern void land_to_water ( edict_t * self ) ; extern void water_to_land ( edict_t * self ) ; extern void SP_monster_gekk ( edict_t * self ) ; extern void gekk_dodge ( edict_t * self , edict_t * attacker , float eta ) ; extern void gekk_duck_hold ( edict_t * self ) ; extern void gekk_duck_up ( edict_t * self ) ; extern void gekk_duck_down ( edict_t * self ) ; extern void gekk_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void isgibfest ( edict_t * self ) ; extern void gekk_gibfest ( edict_t * self ) ; extern void gekk_dead ( edict_t * self ) ; extern void gekk_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void gekk_jump ( edict_t * self ) ; extern void gekk_check_landing ( edict_t * self ) ; extern void gekk_stop_skid ( edict_t * self ) ; extern void gekk_jump_takeoff2 ( edict_t * self ) ; extern void gekk_jump_takeoff ( edict_t * self ) ; extern void gekk_jump_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void gekk_melee ( edict_t * self ) ; extern void gekk_preattack ( edict_t * self ) ; extern void gekk_bite ( edict_t * self ) ; extern void gekk_check_underwater ( edict_t * self ) ; extern void reloogie ( edict_t * self ) ; extern void loogie ( edict_t * self ) ; extern void fire_loogie ( edict_t * self , vec3_t start , vec3_t dir , int damage , int speed ) ; extern void loogie_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void gekk_check_refire ( edict_t * self ) ; extern void gekk_hit_right ( edict_t * self ) ; extern void gekk_hit_left ( edict_t * self ) ; extern void gekk_run ( edict_t * self ) ; extern void gekk_run_start ( edict_t * self ) ; extern void gekk_walk ( edict_t * self ) ; extern void gekk_idle ( edict_t * self ) ; extern void gekk_idle_loop ( edict_t * self ) ; extern void gekk_stand ( edict_t * self ) ; extern void gekk_swim ( edict_t * self ) ; extern void gekk_swim_loop ( edict_t * self ) ; extern void ai_stand2 ( edict_t * self , float dist ) ; extern void gekk_face ( edict_t * self ) ; extern void gekk_swing ( edict_t * self ) ; extern void gekk_search ( edict_t * self ) ; extern void gekk_sight ( edict_t * self , edict_t * other ) ; extern void gekk_step ( edict_t * self ) ; extern qboolean gekk_checkattack ( edict_t * self ) ; extern qboolean gekk_check_jump_close ( edict_t * self ) ; extern qboolean gekk_check_jump ( edict_t * self ) ; extern qboolean gekk_check_melee ( edict_t * self ) ; extern void SP_monster_flyer ( edict_t * self ) ; extern void flyer_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void flyer_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void flyer_check_melee ( edict_t * self ) ; extern void flyer_melee ( edict_t * self ) ; extern void flyer_nextmove ( edict_t * self ) ; extern void flyer_setstart ( edict_t * self ) ; extern void flyer_attack ( edict_t * self ) ; extern void flyer_loop_melee ( edict_t * self ) ; extern void flyer_slash_right ( edict_t * self ) ; extern void flyer_slash_left ( edict_t * self ) ; extern void flyer_fireright ( edict_t * self ) ; extern void flyer_fireleft ( edict_t * self ) ; extern void flyer_fire ( edict_t * self , int flash_number ) ; extern void flyer_start ( edict_t * self ) ; extern void flyer_stop ( edict_t * self ) ; extern void flyer_stand ( edict_t * self ) ; extern void flyer_walk ( edict_t * self ) ; extern void flyer_run ( edict_t * self ) ; extern void flyer_pop_blades ( edict_t * self ) ; extern void flyer_idle ( edict_t * self ) ; extern void flyer_sight ( edict_t * self , edict_t * other ) ; extern void SP_monster_floater ( edict_t * self ) ; extern void floater_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void floater_dead ( edict_t * self ) ; extern void floater_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void floater_melee ( edict_t * self ) ; extern void floater_attack ( edict_t * self ) ; extern void floater_zap ( edict_t * self ) ; extern void floater_wham ( edict_t * self ) ; extern void floater_walk ( edict_t * self ) ; extern void floater_run ( edict_t * self ) ; extern void floater_stand ( edict_t * self ) ; extern void floater_fire_blaster ( edict_t * self ) ; extern void floater_idle ( edict_t * self ) ; extern void floater_sight ( edict_t * self , edict_t * other ) ; extern void SP_monster_flipper ( edict_t * self ) ; extern void flipper_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void flipper_sight ( edict_t * self , edict_t * other ) ; extern void flipper_dead ( edict_t * self ) ; extern void flipper_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void flipper_melee ( edict_t * self ) ; extern void flipper_preattack ( edict_t * self ) ; extern void flipper_bite ( edict_t * self ) ; extern void flipper_start_run ( edict_t * self ) ; extern void flipper_walk ( edict_t * self ) ; extern void flipper_run ( edict_t * self ) ; extern void flipper_run_loop ( edict_t * self ) ; extern void flipper_stand ( edict_t * self ) ; extern void SP_monster_fixbot ( edict_t * self ) ; extern void bot_goal_think ( edict_t *self ) ; extern void fixbot_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void fixbot_dead ( edict_t * self ) ; extern void fixbot_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void fixbot_attack ( edict_t * self ) ; extern void fixbot_start_attack ( edict_t * self ) ; extern void fixbot_walk ( edict_t * self ) ; extern void fixbot_run ( edict_t * self ) ; extern void fixbot_stand ( edict_t * self ) ; extern void fixbot_fire_blaster ( edict_t * self ) ; extern void fixbot_fire_welder ( edict_t * self ) ; extern void ai_move2 ( edict_t * self , float dist ) ; extern void weldstate ( edict_t * self ) ; extern void fixbot_fire_laser ( edict_t * self ) ; extern int check_telefrag ( edict_t * self ) ; extern void ai_movetogoal ( edict_t * self , float dist ) ; extern void go_roam ( edict_t * self ) ; extern void ai_facing ( edict_t * self , float dist ) ; extern void fly_vertical2 ( edict_t * self ) ; extern void fly_vertical ( edict_t * self ) ; extern void blastoff ( edict_t * self , vec3_t start , vec3_t aimdir , int damage , int kick , int te_impact , int hspread , int vspread ) ; extern void use_scanner ( edict_t * self ) ; extern void roam_goal ( edict_t * self ) ; extern void change_to_roam ( edict_t * self ) ; extern void takeoff_goal ( edict_t * self ) ; extern void landing_goal ( edict_t * self ) ; extern int fixbot_search ( edict_t * self ) ; extern edict_t * fixbot_FindDeadMonster ( edict_t * self ) ; extern float crand ( void ) ; extern void SP_monster_chick_heat ( edict_t * self ) ; extern void SP_monster_chick ( edict_t * self ) ; extern void chick_footstep( edict_t *self ) ; extern void chick_sight ( edict_t * self , edict_t * other ) ; extern void chick_attack ( edict_t * self ) ; extern void chick_melee ( edict_t * self ) ; extern void chick_slash ( edict_t * self ) ; extern void chick_reslash ( edict_t * self ) ; extern void chick_attack1 ( edict_t * self ) ; extern void chick_rerocket ( edict_t * self ) ; extern void ChickReload ( edict_t * self ) ; extern void Chick_PreAttack1 ( edict_t * self ) ; extern void ChickRocket ( edict_t * self ) ; extern void ChickSlash ( edict_t * self ) ; extern void chick_dodge ( edict_t * self , edict_t * attacker , float eta ) ; extern void chick_duck_up ( edict_t * self ) ; extern void chick_duck_hold ( edict_t * self ) ; extern void chick_duck_down ( edict_t * self ) ; extern void chick_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void chick_dead ( edict_t * self ) ; extern void chick_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void chick_run ( edict_t * self ) ; extern void chick_walk ( edict_t * self ) ; extern void chick_stand ( edict_t * self ) ; extern void chick_fidget ( edict_t * self ) ; extern void ChickMoan ( edict_t * self ) ; extern void SP_monster_brain ( edict_t * self ) ; extern void brain_footstep( edict_t *self ) ; extern void brain_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void brain_dead ( edict_t * self ) ; extern void brain_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void brain_run ( edict_t * self ) ; extern void brain_attack ( edict_t * self ) ; extern void brain_laserbeam_reattack ( edict_t * self ) ; extern void brain_laserbeam ( edict_t * self ) ; extern void brain_tounge_attack ( edict_t * self ) ; extern qboolean brain_tounge_attack_ok ( vec3_t start , vec3_t end ) ; extern void brain_melee ( edict_t * self ) ; extern void brain_chest_closed ( edict_t * self ) ; extern void brain_tentacle_attack ( edict_t * self ) ; extern void brain_chest_open ( edict_t * self ) ; extern void brain_hit_left ( edict_t * self ) ; extern void brain_swing_left ( edict_t * self ) ; extern void brain_hit_right ( edict_t * self ) ; extern void brain_swing_right ( edict_t * self ) ; extern void brain_dodge ( edict_t * self , edict_t * attacker , float eta ) ; extern void brain_duck_up ( edict_t * self ) ; extern void brain_duck_hold ( edict_t * self ) ; extern void brain_duck_down ( edict_t * self ) ; extern void brain_walk ( edict_t * self ) ; extern void brain_idle ( edict_t * self ) ; extern void brain_stand ( edict_t * self ) ; extern void brain_search ( edict_t * self ) ; extern void brain_sight ( edict_t * self , edict_t * other ) ; extern void SP_monster_boss5 ( edict_t * self ) ; extern void boss5_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void BossExplode2 ( edict_t * self ) ; extern void boss5_dead ( edict_t * self ) ; extern void boss5_attack ( edict_t * self ) ; extern void boss5MachineGun ( edict_t * self ) ; extern void boss5Rocket ( edict_t * self ) ; extern void boss5_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void boss5_reattack1 ( edict_t * self ) ; extern void boss5_run ( edict_t * self ) ; extern void boss5_walk ( edict_t * self ) ; extern void boss5_forward ( edict_t * self ) ; extern void boss5_stand ( edict_t * self ) ; extern void boss5_search ( edict_t * self ) ; extern void TreadSound2 ( edict_t * self ) ; extern void MakronToss ( edict_t * self ) ; extern void MakronSpawn ( edict_t * self ) ; extern void SP_monster_makron ( edict_t * self ) ; extern void MakronPrecache ( void ) ; extern qboolean Makron_CheckAttack ( edict_t * self ) ; extern void makron_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void makron_torso_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void makron_dead ( edict_t * self ) ; extern void makron_torso ( edict_t * ent ) ; extern void makron_torso_think ( edict_t * self ) ; extern void makron_attack ( edict_t * self ) ; extern void makron_sight ( edict_t * self , edict_t * other ) ; extern void makron_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void MakronHyperblaster ( edict_t * self ) ; extern void MakronRailgun ( edict_t * self ) ; extern void MakronSaveloc ( edict_t * self ) ; extern void makronBFG ( edict_t * self ) ; extern void makron_run ( edict_t * self ) ; extern void makron_walk ( edict_t * self ) ; extern void makron_prerailgun ( edict_t * self ) ; extern void makron_brainsplorch ( edict_t * self ) ; extern void makron_step_right ( edict_t * self ) ; extern void makron_step_left ( edict_t * self ) ; extern void makron_popup ( edict_t * self ) ; extern void makron_hit ( edict_t * self ) ; extern void makron_stand ( edict_t * self ) ; extern void makron_taunt ( edict_t * self ) ; extern void SP_monster_jorg ( edict_t * self ) ; extern qboolean Jorg_CheckAttack ( edict_t * self ) ; extern void jorg_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void jorg_dead ( edict_t * self ) ; extern void jorg_attack ( edict_t * self ) ; extern void jorg_firebullet ( edict_t * self ) ; extern void jorg_firebullet_left ( edict_t * self ) ; extern void jorg_firebullet_right ( edict_t * self ) ; extern void jorgBFG ( edict_t * self ) ; extern void jorg_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void jorg_attack1 ( edict_t * self ) ; extern void jorg_reattack1 ( edict_t * self ) ; extern void jorg_run ( edict_t * self ) ; extern void jorg_walk ( edict_t * self ) ; extern void jorg_stand ( edict_t * self ) ; extern void jorg_step_right ( edict_t * self ) ; extern void jorg_step_left ( edict_t * self ) ; extern void jorg_death_hit ( edict_t * self ) ; extern void jorg_idle ( edict_t * self ) ; extern void jorg_search ( edict_t * self ) ; extern void SP_monster_boss3_stand ( edict_t * self ) ; extern void Think_Boss3Stand ( edict_t * ent ) ; extern void Use_Boss3 ( edict_t * ent , edict_t * other , edict_t * activator ) ; extern void SP_monster_boss2 ( edict_t * self ) ; extern qboolean Boss2_CheckAttack ( edict_t * self ) ; extern void boss2_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void boss2_dead ( edict_t * self ) ; extern void boss2_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void boss2_reattack_mg ( edict_t * self ) ; extern void boss2_attack_mg ( edict_t * self ) ; extern void boss2_attack ( edict_t * self ) ; extern void boss2_walk ( edict_t * self ) ; extern void boss2_run ( edict_t * self ) ; extern void boss2_stand ( edict_t * self ) ; extern void Boss2MachineGun ( edict_t * self ) ; extern void boss2_firebullet_left ( edict_t * self ) ; extern void boss2_firebullet_right ( edict_t * self ) ; extern void Boss2Rocket ( edict_t * self ) ; extern void boss2_search ( edict_t * self ) ; extern void SP_monster_berserk ( edict_t * self ) ; extern void berserk_footstep( edict_t *self ) ; extern void berserk_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void berserk_dead ( edict_t * self ) ; extern void berserk_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; extern void berserk_melee ( edict_t * self ) ; extern void berserk_strike ( edict_t * self ) ; extern void berserk_attack_club ( edict_t * self ) ; extern void berserk_swing ( edict_t * self ) ; extern void berserk_attack_spike ( edict_t * self ) ; extern void berserk_run ( edict_t * self ) ; extern void berserk_walk ( edict_t * self ) ; extern void berserk_fidget ( edict_t * self ) ; extern void berserk_stand ( edict_t * self ) ; extern void berserk_search ( edict_t * self ) ; extern void berserk_sight ( edict_t * self , edict_t * other ) ; extern void fire_trap ( edict_t * self , vec3_t start , vec3_t aimdir , int damage , int speed , float timer , float damage_radius , qboolean held ) ; extern void Trap_Think ( edict_t * ent ) ; extern void fire_plasma ( edict_t * self , vec3_t start , vec3_t dir , int damage , int speed , float damage_radius , int radius_damage ) ; extern void plasma_touch ( edict_t * ent , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void fire_heat ( edict_t * self , vec3_t start , vec3_t dir , int damage , int speed , float damage_radius , int radius_damage ) ; extern void heat_think ( edict_t * self ) ; extern void fire_ionripper ( edict_t * self , vec3_t start , vec3_t dir , int damage , int speed , int effect ) ; extern void ionripper_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void ionripper_sparks ( edict_t * self ) ; extern void fire_bfg ( edict_t * self , vec3_t start , vec3_t dir , int damage , int speed , float damage_radius ) ; extern void bfg_think ( edict_t * self ) ; extern void bfg_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void bfg_explode ( edict_t * self ) ; extern void fire_rail ( edict_t * self , vec3_t start , vec3_t aimdir , int damage , int kick ) ; extern void fire_rocket ( edict_t * self , vec3_t start , vec3_t dir , int damage , int speed , float damage_radius , int radius_damage ) ; extern void rocket_touch ( edict_t * ent , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void fire_grenade2 ( edict_t * self , vec3_t start , vec3_t aimdir , int damage , int speed , float timer , float damage_radius , qboolean held ) ; extern void fire_grenade ( edict_t * self , vec3_t start , vec3_t aimdir , int damage , int speed , float timer , float damage_radius ) ; extern void Grenade_Touch ( edict_t * ent , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void Grenade_Explode ( edict_t * ent ) ; extern void fire_blueblaster ( edict_t * self , vec3_t start , vec3_t dir , int damage , int speed , int effect ) ; extern void fire_blaster ( edict_t * self , vec3_t start , vec3_t dir , int damage , int speed , int effect , qboolean hyper ) ; extern void blaster_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void fire_shotgun ( edict_t * self , vec3_t start , vec3_t aimdir , int damage , int kick , int hspread , int vspread , int count , int mod ) ; extern void fire_bullet ( edict_t * self , vec3_t start , vec3_t aimdir , int damage , int kick , int hspread , int vspread , int mod ) ; extern void fire_lead ( edict_t * self , vec3_t start , vec3_t aimdir , int damage , int kick , int te_impact , int hspread , int vspread , int mod ) ; extern qboolean fire_hit ( edict_t * self , vec3_t aim , int damage , int kick ) ; extern void check_dodge ( edict_t * self , vec3_t start , vec3_t dir , int speed ) ; extern qboolean KillBox ( edict_t * ent ) ; extern void G_TouchSolids ( edict_t * ent ) ; extern void G_TouchTriggers ( edict_t * ent ) ; extern void G_FreeEdict ( edict_t * ed ) ; extern edict_t * G_Spawn ( void ) ; extern void G_InitEdict ( edict_t * e ) ; extern char * G_CopyString ( char * in ) ; extern void vectoangles ( vec3_t value1 , vec3_t angles ) ; extern float vectoyaw ( vec3_t vec ) ; extern void G_SetMovedir ( vec3_t angles , vec3_t movedir ) ; extern char * vtos ( vec3_t v ) ; extern float * tv ( float x , float y , float z ) ; extern void G_UseTargets ( edict_t * ent , edict_t * activator ) ; extern void Think_Delay ( edict_t * ent ) ; extern edict_t * G_PickTarget ( char * targetname ) ; extern edict_t * findradius ( edict_t * from , vec3_t org , float rad ) ; extern edict_t * G_Find ( edict_t * from , int fieldofs , char * match ) ; extern void G_ProjectSource ( vec3_t point , vec3_t distance , vec3_t forward , vec3_t right , vec3_t result ) ; extern void SP_turret_driver ( edict_t * self ) ; extern void turret_driver_link ( edict_t * self ) ; extern void turret_driver_think ( edict_t * self ) ; extern void turret_driver_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void SP_turret_base ( edict_t * self ) ; extern void SP_turret_breach ( edict_t * self ) ; extern void turret_breach_finish_init ( edict_t * self ) ; extern void turret_breach_think ( edict_t * self ) ; extern void turret_breach_fire ( edict_t * self ) ; extern void turret_blocked ( edict_t * self , edict_t * other ) ; extern float SnapToEights ( float x ) ; extern void AnglesNormalize ( vec3_t vec ) ; extern void SP_trigger_monsterjump ( edict_t * self ) ; extern void trigger_monsterjump_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void SP_trigger_gravity ( edict_t * self ) ; extern void trigger_gravity_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void SP_trigger_hurt ( edict_t * self ) ; extern void hurt_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void hurt_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_trigger_push ( edict_t * self ) ; extern void trigger_push_active ( edict_t * self ) ; extern void trigger_push_inactive ( edict_t * self ) ; extern void trigger_effect ( edict_t * self ) ; extern void trigger_push_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void SP_trigger_always ( edict_t * ent ) ; extern void SP_trigger_counter ( edict_t * self ) ; extern void trigger_counter_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_trigger_key ( edict_t * self ) ; extern void trigger_key_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_trigger_relay ( edict_t * self ) ; extern void trigger_relay_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_trigger_once ( edict_t * ent ) ; extern void SP_trigger_multiple ( edict_t * ent ) ; extern void trigger_enable ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void Touch_Multi ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void Use_Multi ( edict_t * ent , edict_t * other , edict_t * activator ) ; extern void multi_trigger ( edict_t * ent ) ; extern void multi_wait ( edict_t * ent ) ; extern void InitTrigger ( edict_t * self ) ; extern void SP_target_earthquake ( edict_t * self ) ; extern void target_earthquake_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void target_earthquake_think ( edict_t * self ) ; extern void SP_target_lightramp ( edict_t * self ) ; extern void target_lightramp_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void target_lightramp_think ( edict_t * self ) ; extern void SP_target_mal_laser ( edict_t * self ) ; extern void mal_laser_think ( edict_t * self ) ; extern void target_mal_laser_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void target_mal_laser_off ( edict_t * self ) ; extern void target_mal_laser_on ( edict_t * self ) ; extern void SP_target_laser ( edict_t * self ) ; extern void target_laser_start ( edict_t * self ) ; extern void target_laser_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void target_laser_off ( edict_t * self ) ; extern void target_laser_on ( edict_t * self ) ; extern void target_laser_think ( edict_t * self ) ; extern void SP_target_crosslevel_target ( edict_t * self ) ; extern void target_crosslevel_target_think ( edict_t * self ) ; extern void SP_target_crosslevel_trigger ( edict_t * self ) ; extern void trigger_crosslevel_trigger_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_target_blaster ( edict_t * self ) ; extern void use_target_blaster ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_target_spawner ( edict_t * self ) ; extern void use_target_spawner ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_target_splash ( edict_t * self ) ; extern void use_target_splash ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_target_changelevel ( edict_t * ent ) ; extern void use_target_changelevel ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_target_explosion ( edict_t * ent ) ; extern void use_target_explosion ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void target_explosion_explode ( edict_t * self ) ; extern void SP_target_goal ( edict_t * ent ) ; extern void use_target_goal ( edict_t * ent , edict_t * other , edict_t * activator ) ; extern void SP_target_secret ( edict_t * ent ) ; extern void use_target_secret ( edict_t * ent , edict_t * other , edict_t * activator ) ; extern void SP_target_help ( edict_t * ent ) ; extern void Use_Target_Help ( edict_t * ent , edict_t * other , edict_t * activator ) ; extern void Target_Help_Think ( edict_t * ent ) ; extern void SP_target_speaker ( edict_t * ent ) ; extern void Use_Target_Speaker ( edict_t * ent , edict_t * other , edict_t * activator ) ; extern void SP_target_temp_entity ( edict_t * ent ) ; extern void Use_Target_Tent ( edict_t * ent , edict_t * other , edict_t * activator ) ; extern void ServerCommand ( void ) ; extern void SVCmd_WriteIP_f ( void ) ; extern void SVCmd_ListIP_f ( void ) ; extern void SVCmd_RemoveIP_f ( void ) ; extern void SVCmd_AddIP_f ( void ) ; extern qboolean SV_FilterPacket ( char * from ) ; extern void Svcmd_Test_f ( void ) ; extern void SP_worldspawn ( edict_t * ent ) ; extern void SpawnEntities ( const char * mapname , char * entities , const char * spawnpoint ) ; extern void G_FindTeams ( void ) ; extern char * ED_ParseEdict ( char * data , edict_t * ent ) ; extern void ED_ParseField ( const char * key , const char * value , edict_t * ent ) ; extern char * ED_NewString ( const char * string ) ; extern void ED_CallSpawn ( edict_t * ent ) ; extern void G_RunEntity ( edict_t * ent ) ; extern void SV_Physics_Step ( edict_t * ent ) ; extern void SV_AddRotationalFriction ( edict_t * ent ) ; extern void SV_Physics_Toss ( edict_t * ent ) ; extern void SV_Physics_Noclip ( edict_t * ent ) ; extern void SV_Physics_None ( edict_t * ent ) ; extern void SV_Physics_Pusher ( edict_t * ent ) ; extern qboolean SV_Push ( edict_t * pusher , vec3_t move , vec3_t amove ) ; extern trace_t SV_PushEntity ( edict_t * ent , vec3_t push ) ; extern void RealBoundingBox ( edict_t * ent , vec3_t mins , vec3_t maxs ) ; extern void SV_AddGravity ( edict_t * ent ) ; extern int SV_FlyMove ( edict_t * ent , float time , int mask ) ; extern int ClipVelocity ( vec3_t in , vec3_t normal , vec3_t out , float overbounce ) ; extern void SV_Impact ( edict_t * e1 , trace_t * trace ) ; extern qboolean SV_RunThink ( edict_t * ent ) ; extern void SV_CheckVelocity ( edict_t * ent ) ; extern edict_t * SV_TestEntityPosition ( edict_t * ent ) ; extern void swimmonster_start ( edict_t * self ) ; extern void swimmonster_start_go ( edict_t * self ) ; extern void flymonster_start ( edict_t * self ) ; extern void flymonster_start_go ( edict_t * self ) ; extern void walkmonster_start ( edict_t * self ) ; extern void walkmonster_start_go ( edict_t * self ) ; extern void monster_start_go ( edict_t * self ) ; extern qboolean monster_start ( edict_t * self ) ; extern void monster_death_use ( edict_t * self ) ; extern void monster_triggered_start ( edict_t * self ) ; extern void monster_triggered_spawn_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void monster_triggered_spawn ( edict_t * self ) ; extern void monster_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void monster_think ( edict_t * self ) ; extern void M_MoveFrame ( edict_t * self ) ; extern void M_SetEffects ( edict_t * ent ) ; extern void M_droptofloor ( edict_t * ent ) ; extern void M_WorldEffects ( edict_t * ent ) ; extern void M_CatagorizePosition ( edict_t * ent ) ; extern void M_CheckGround ( edict_t * ent ) ; extern void AttackFinished ( edict_t * self , float time ) ; extern void M_FlyCheck ( edict_t * self ) ; extern void M_FliesOn ( edict_t * self ) ; extern void M_FliesOff ( edict_t * self ) ; extern void monster_fire_bfg ( edict_t * self , vec3_t start , vec3_t aimdir , int damage , int speed , int kick , float damage_radius , int flashtype ) ; extern void monster_fire_railgun ( edict_t * self , vec3_t start , vec3_t aimdir , int damage , int kick , int flashtype ) ; extern void monster_fire_rocket ( edict_t * self , vec3_t start , vec3_t dir , int damage , int speed , int flashtype ) ; extern void monster_fire_grenade ( edict_t * self , vec3_t start , vec3_t aimdir , int damage , int speed , int flashtype ) ; extern void monster_dabeam ( edict_t * self ) ; extern void dabeam_hit ( edict_t * self ) ; extern void monster_fire_heat ( edict_t * self , vec3_t start , vec3_t dir , int damage , int speed , int flashtype ) ; extern void monster_fire_ionripper ( edict_t * self , vec3_t start , vec3_t dir , int damage , int speed , int flashtype , int effect ) ; extern void monster_fire_blueblaster ( edict_t * self , vec3_t start , vec3_t dir , int damage , int speed , int flashtype , int effect ) ; extern void monster_fire_blaster ( edict_t * self , vec3_t start , vec3_t dir , int damage , int speed , int flashtype , int effect ) ; extern void monster_fire_shotgun ( edict_t * self , vec3_t start , vec3_t aimdir , int damage , int kick , int hspread , int vspread , int count , int flashtype ) ; extern void monster_fire_bullet ( edict_t * self , vec3_t start , vec3_t dir , int damage , int kick , int hspread , int vspread , int flashtype ) ; extern void SP_misc_nuke ( edict_t * ent ) ; extern void use_nuke ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_misc_amb4 ( edict_t * ent ) ; extern void amb4_think ( edict_t * ent ) ; extern void SP_misc_teleporter_dest ( edict_t * ent ) ; extern void SP_misc_teleporter ( edict_t * ent ) ; extern void teleporter_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void SP_func_clock ( edict_t * self ) ; extern void func_clock_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void func_clock_think ( edict_t * self ) ; extern void func_clock_format_countdown ( edict_t * self ) ; extern void func_clock_reset ( edict_t * self ) ; extern void SP_target_string ( edict_t * self ) ; extern void target_string_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_target_character ( edict_t * self ) ; extern void SP_misc_gib_head ( edict_t * ent ) ; extern void SP_misc_gib_leg ( edict_t * ent ) ; extern void SP_misc_gib_arm ( edict_t * ent ) ; extern void SP_light_mine2 ( edict_t * ent ) ; extern void SP_light_mine1 ( edict_t * ent ) ; extern void SP_misc_satellite_dish ( edict_t * ent ) ; extern void misc_satellite_dish_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void misc_satellite_dish_think ( edict_t * self ) ; extern void SP_misc_transport ( edict_t * ent ) ; extern void SP_misc_strogg_ship ( edict_t * ent ) ; extern void misc_strogg_ship_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_misc_viper_missile ( edict_t * self ) ; extern void misc_viper_missile_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_misc_viper_bomb ( edict_t * self ) ; extern void misc_viper_bomb_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void misc_viper_bomb_prethink ( edict_t * self ) ; extern void misc_viper_bomb_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void SP_misc_bigviper ( edict_t * ent ) ; extern void SP_misc_crashviper ( edict_t * ent ) ; extern void SP_misc_viper ( edict_t * ent ) ; extern void misc_viper_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_misc_deadsoldier ( edict_t * ent ) ; extern void misc_deadsoldier_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void SP_misc_banner ( edict_t * ent ) ; extern void misc_banner_think ( edict_t * ent ) ; extern void SP_monster_commander_body ( edict_t * self ) ; extern void commander_body_drop ( edict_t * self ) ; extern void commander_body_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void commander_body_think ( edict_t * self ) ; extern void SP_misc_easterchick2 ( edict_t * ent ) ; extern void misc_easterchick2_think ( edict_t * self ) ; extern void SP_misc_easterchick ( edict_t * ent ) ; extern void misc_easterchick_think ( edict_t * self ) ; extern void SP_misc_eastertank ( edict_t * ent ) ; extern void misc_eastertank_think ( edict_t * self ) ; extern void SP_misc_blackhole ( edict_t * ent ) ; extern void misc_blackhole_think ( edict_t * self ) ; extern void misc_blackhole_use ( edict_t * ent , edict_t * other , edict_t * activator ) ; extern void SP_misc_explobox ( edict_t * self ) ; extern void barrel_delay ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void barrel_explode ( edict_t * self ) ; extern void barrel_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void SP_func_explosive ( edict_t * self ) ; extern void func_explosive_spawn ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void func_explosive_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void func_explosive_explode ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void SP_func_object ( edict_t * self ) ; extern void func_object_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void func_object_release ( edict_t * self ) ; extern void func_object_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void SP_func_wall ( edict_t * self ) ; extern void func_wall_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_light ( edict_t * self ) ; extern void light_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_info_notnull ( edict_t * self ) ; extern void SP_info_null ( edict_t * self ) ; extern void SP_viewthing ( edict_t * ent ) ; extern void TH_viewthing ( edict_t * ent ) ; extern void SP_point_combat ( edict_t * self ) ; extern void point_combat_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void SP_path_corner ( edict_t * self ) ; extern void path_corner_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void BecomeExplosion2 ( edict_t * self ) ; extern void BecomeExplosion1 ( edict_t * self ) ; extern void ThrowDebris ( edict_t * self , char * modelname , float speed , vec3_t origin ) ; extern void debris_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void ThrowClientHead ( edict_t * self , int damage ) ; extern void ThrowHeadACID ( edict_t * self , char * gibname , int damage , int type ) ; extern void ThrowGibACID ( edict_t * self , char * gibname , int damage , int type ) ; extern void ThrowHead ( edict_t * self , char * gibname , int damage , int type ) ; extern void ThrowGib ( edict_t * self , char * gibname , int damage , int type ) ; extern void gib_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void gib_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void gib_think ( edict_t * self ) ; extern void ClipGibVelocity ( edict_t * ent ) ; extern void VelocityForDamage ( int damage , vec3_t v ) ; extern void SP_func_areaportal ( edict_t * ent ) ; extern void Use_Areaportal ( edict_t * ent , edict_t * other , edict_t * activator ) ; extern void G_RunFrame ( void ) ; extern void ExitLevel ( void ) ; extern void CheckDMRules ( void ) ; extern void CheckNeedPass ( void ) ; extern void EndDMLevel ( void ) ; extern edict_t * CreateTargetChangeLevel ( char * map ) ; extern void ClientEndServerFrames ( void ) ; extern void Com_Printf ( char * msg , ... ) ; extern void Sys_Error ( char * error , ... ) ; extern game_export_t * GetGameAPI ( game_import_t * import ) ; extern void ShutdownGame ( void ) ; extern void SetItemNames ( void ) ; extern void InitItems ( void ) ; extern void SP_item_foodcube ( edict_t * self ) ; extern void SP_item_health_mega ( edict_t * self ) ; extern void SP_item_health_large ( edict_t * self ) ; extern void SP_item_health_small ( edict_t * self ) ; extern void SP_item_health ( edict_t * self ) ; extern void SpawnItem ( edict_t * ent , gitem_t * item ) ; extern void PrecacheItem ( gitem_t * it ) ; extern void droptofloor ( edict_t * ent ) ; extern void Use_Item ( edict_t * ent , edict_t * other , edict_t * activator ) ; extern edict_t * Drop_Item ( edict_t * ent , gitem_t * item ) ; extern void drop_make_touchable ( edict_t * ent ) ; extern void drop_temp_touch ( edict_t * ent , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void Touch_Item ( edict_t * ent , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void Drop_PowerArmor ( edict_t * ent , gitem_t * item ) ; extern qboolean Pickup_PowerArmor ( edict_t * ent , edict_t * other ) ; extern void Use_PowerArmor ( edict_t * ent , gitem_t * item ) ; extern int PowerArmorType ( edict_t * ent ) ; extern qboolean Pickup_Armor ( edict_t * ent , edict_t * other ) ; extern int ArmorIndex ( edict_t * ent ) ; extern qboolean Pickup_Health ( edict_t * ent , edict_t * other ) ; extern void MegaHealth_think ( edict_t * self ) ; extern void Drop_Ammo ( edict_t * ent , gitem_t * item ) ; extern qboolean Pickup_Ammo ( edict_t * ent , edict_t * other ) ; extern qboolean Add_Ammo ( edict_t * ent , gitem_t * item , int count ) ; extern qboolean Pickup_Key ( edict_t * ent , edict_t * other ) ; extern void Use_Silencer ( edict_t * ent , gitem_t * item ) ; extern void Use_Invulnerability ( edict_t * ent , gitem_t * item ) ; extern void Use_Envirosuit ( edict_t * ent , gitem_t * item ) ; extern void Use_Breather ( edict_t * ent , gitem_t * item ) ; extern void Use_QuadFire ( edict_t * ent , gitem_t * item ) ; extern void Use_Quad ( edict_t * ent , gitem_t * item ) ; extern qboolean Pickup_Pack ( edict_t * ent , edict_t * other ) ; extern qboolean Pickup_Bandolier ( edict_t * ent , edict_t * other ) ; extern qboolean Pickup_AncientHead ( edict_t * ent , edict_t * other ) ; extern qboolean Pickup_Adrenaline ( edict_t * ent , edict_t * other ) ; extern void Drop_General ( edict_t * ent , gitem_t * item ) ; extern qboolean Pickup_Powerup ( edict_t * ent , edict_t * other ) ; extern void SetRespawn ( edict_t * ent , float delay ) ; extern void DoRespawn ( edict_t * ent ) ; extern gitem_t * FindItem ( char * pickup_name ) ; extern gitem_t * FindItemByClassname ( char * classname ) ; extern gitem_t * GetItemByIndex ( int index ) ; extern void SP_object_repair ( edict_t * ent ) ; extern void object_repair_sparks ( edict_t * ent ) ; extern void object_repair_dead ( edict_t * ent ) ; extern void object_repair_fx ( edict_t * ent ) ; extern void SP_rotating_light ( edict_t * self ) ; extern void rotating_light_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void rotating_light_killed ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void rotating_light_alarm ( edict_t * self ) ; extern void SP_func_killbox ( edict_t * ent ) ; extern void use_killbox ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_func_door_secret ( edict_t * ent ) ; extern void door_secret_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void door_secret_blocked ( edict_t * self , edict_t * other ) ; extern void door_secret_done ( edict_t * self ) ; extern void door_secret_move6 ( edict_t * self ) ; extern void door_secret_move5 ( edict_t * self ) ; extern void door_secret_move4 ( edict_t * self ) ; extern void door_secret_move3 ( edict_t * self ) ; extern void door_secret_move2 ( edict_t * self ) ; extern void door_secret_move1 ( edict_t * self ) ; extern void door_secret_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_func_conveyor ( edict_t * self ) ; extern void func_conveyor_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_func_timer ( edict_t * self ) ; extern void func_timer_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void func_timer_think ( edict_t * self ) ; extern void SP_trigger_elevator ( edict_t * self ) ; extern void trigger_elevator_init ( edict_t * self ) ; extern void trigger_elevator_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void SP_func_train ( edict_t * self ) ; extern void train_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void func_train_find ( edict_t * self ) ; extern void train_resume ( edict_t * self ) ; extern void train_next ( edict_t * self ) ; extern void train_wait ( edict_t * self ) ; extern void train_blocked ( edict_t * self , edict_t * other ) ; extern void SP_func_water ( edict_t * self ) ; extern void SP_func_door_rotating ( edict_t * ent ) ; extern void SP_func_door ( edict_t * ent ) ; extern void door_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void door_killed ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void door_blocked ( edict_t * self , edict_t * other ) ; extern void Think_SpawnDoorTrigger ( edict_t * ent ) ; extern void Think_CalcMoveSpeed ( edict_t * self ) ; extern void Touch_DoorTrigger ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void door_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void door_go_up ( edict_t * self , edict_t * activator ) ; extern void door_go_down ( edict_t * self ) ; extern void door_hit_bottom ( edict_t * self ) ; extern void door_hit_top ( edict_t * self ) ; extern void door_use_areaportals ( edict_t * self , qboolean open ) ; extern void SP_func_button ( edict_t * ent ) ; extern void button_killed ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void button_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void button_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void button_fire ( edict_t * self ) ; extern void button_wait ( edict_t * self ) ; extern void button_return ( edict_t * self ) ; extern void button_done ( edict_t * self ) ; extern void SP_func_rotating ( edict_t * ent ) ; extern void rotating_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void rotating_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void rotating_blocked ( edict_t * self , edict_t * other ) ; extern void SP_func_plat ( edict_t * ent ) ; extern void plat_spawn_inside_trigger ( edict_t * ent ) ; extern void Touch_Plat_Center ( edict_t * ent , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void Use_Plat ( edict_t * ent , edict_t * other , edict_t * activator ) ; extern void plat_blocked ( edict_t * self , edict_t * other ) ; extern void plat_go_up ( edict_t * ent ) ; extern void plat_go_down ( edict_t * ent ) ; extern void plat_hit_bottom ( edict_t * ent ) ; extern void plat_hit_top ( edict_t * ent ) ; extern void Think_AccelMove ( edict_t * ent ) ; extern void plat_Accelerate ( moveinfo_t * moveinfo ) ; extern void plat_CalcAcceleratedMove ( moveinfo_t * moveinfo ) ; extern void AngleMove_Calc ( edict_t * ent , void ( * func ) ( edict_t * ) ) ; extern void AngleMove_Begin ( edict_t * ent ) ; extern void AngleMove_Final ( edict_t * ent ) ; extern void AngleMove_Done ( edict_t * ent ) ; extern void Move_Calc ( edict_t * ent , vec3_t dest , void ( * func ) ( edict_t * ) ) ; extern void Move_Begin ( edict_t * ent ) ; extern void Move_Final ( edict_t * ent ) ; extern void Move_Done ( edict_t * ent ) ; extern void T_RadiusDamage ( edict_t * inflictor , edict_t * attacker , float damage , edict_t * ignore , float radius , int mod ) ; extern void T_Damage ( edict_t * targ , edict_t * inflictor , edict_t * attacker , vec3_t dir , vec3_t point , vec3_t normal , int damage , int knockback , int dflags , int mod ) ; extern void M_ReactToDamage ( edict_t * targ , edict_t * attacker ) ; extern int CheckArmor ( edict_t * ent , vec3_t point , vec3_t normal , int damage , int te_sparks , int dflags ) ; extern int CheckPowerArmor ( edict_t * ent , vec3_t point , vec3_t normal , int damage , int dflags ) ; extern void SpawnDamage ( int type , vec3_t origin , vec3_t normal , int damage ) ; extern void Killed ( edict_t * targ , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern qboolean CanDamage ( edict_t * targ , edict_t * inflictor ) ; extern void ClientCommand ( edict_t * ent ) ; extern void Cmd_PlayerList_f ( edict_t * ent ) ; extern void Cmd_Say_f ( edict_t * ent , qboolean team , qboolean arg0 ) ; extern void Cmd_Wave_f ( edict_t * ent ) ; extern void Cmd_Players_f ( edict_t * ent ) ; extern int PlayerSort ( void const * a , void const * b ) ; extern void Cmd_PutAway_f ( edict_t * ent ) ; extern void Cmd_Kill_f ( edict_t * ent ) ; extern void Cmd_InvDrop_f ( edict_t * ent ) ; extern void Cmd_WeapLast_f ( edict_t * ent ) ; extern void Cmd_WeapNext_f ( edict_t * ent ) ; extern void Cmd_WeapPrev_f ( edict_t * ent ) ; extern void Cmd_InvUse_f ( edict_t * ent ) ; extern void Cmd_Inven_f ( edict_t * ent ) ; extern void Cmd_Help_f ( edict_t * ent ) ; extern void Cmd_Score_f ( edict_t * ent ) ; extern void Cmd_Drop_f ( edict_t * ent ) ; extern void Cmd_Use_f ( edict_t * ent ) ; extern void Cmd_Noclip_f ( edict_t * ent ) ; extern void Cmd_Notarget_f ( edict_t * ent ) ; extern void Cmd_God_f ( edict_t * ent ) ; extern void Cmd_Give_f ( edict_t * ent ) ; extern void ValidateSelectedItem ( edict_t * ent ) ; extern void SelectPrevItem ( edict_t * ent , int itflags ) ; extern void SelectNextItem ( edict_t * ent , int itflags ) ; extern qboolean OnSameTeam ( edict_t * ent1 , edict_t * ent2 ) ; extern void GetChaseTarget ( edict_t * ent ) ; extern void ChasePrev ( edict_t * ent ) ; extern void ChaseNext ( edict_t * ent ) ; extern void UpdateChaseCam ( edict_t * ent ) ; extern void ai_run ( edict_t * self , float dist ) ; extern qboolean ai_checkattack ( edict_t * self , float dist ) ; extern void ai_run_slide ( edict_t * self , float distance ) ; extern void ai_run_missile ( edict_t * self ) ; extern void ai_run_melee ( edict_t * self ) ; extern qboolean M_CheckAttack ( edict_t * self ) ; extern qboolean FacingIdeal ( edict_t * self ) ; extern qboolean FindTarget ( edict_t * self ) ; extern void FoundTarget ( edict_t * self ) ; extern void HuntTarget ( edict_t * self ) ; extern qboolean infront ( edict_t * self , edict_t * other ) ; extern qboolean visible ( edict_t * self , edict_t * other ) ; extern int range ( edict_t * self , edict_t * other ) ; extern void ai_turn ( edict_t * self , float dist ) ; extern void ai_charge ( edict_t * self , float dist ) ; extern void ai_walk ( edict_t * self , float dist ) ; extern void ai_stand ( edict_t * self , float dist ) ; extern void ai_move ( edict_t * self , float dist ) ; extern void AI_SetSightClient ( void ) ; extern void wait_and_change_think(edict_t* ent); xatrix-XATRIX_2_14/src/savegame/tables/gamefunc_list.h000066400000000000000000001550011477320050300227640ustar00rootroot00000000000000/* * Copyright (C) 1997-2001 Id Software, Inc. * Copyright (C) 2011 Yamagi Burmeister * * 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. * * ======================================================================= * * Functionpointers to every function in the game.so. * * ======================================================================= */ {"ReadLevel", (byte *)ReadLevel}, {"ReadLevelLocals", (byte *)ReadLevelLocals}, {"ReadEdict", (byte *)ReadEdict}, {"WriteLevel", (byte *)WriteLevel}, {"WriteLevelLocals", (byte *)WriteLevelLocals}, {"WriteEdict", (byte *)WriteEdict}, {"ReadGame", (byte *)ReadGame}, {"WriteGame", (byte *)WriteGame}, {"ReadClient", (byte *)ReadClient}, {"WriteClient", (byte *)WriteClient}, {"ReadField", (byte *)ReadField}, {"WriteField2", (byte *)WriteField2}, {"WriteField1", (byte *)WriteField1}, {"FindMmoveByName", (byte *)FindMmoveByName}, {"GetMmoveByAddress", (byte *)GetMmoveByAddress}, {"FindFunctionByName", (byte *)FindFunctionByName}, {"GetFunctionByAddress", (byte *)GetFunctionByAddress}, {"InitGame", (byte *)InitGame}, {"Info_SetValueForKey", (byte *)Info_SetValueForKey}, {"Info_Validate", (byte *)Info_Validate}, {"Info_RemoveKey", (byte *)Info_RemoveKey}, {"Info_ValueForKey", (byte *)Info_ValueForKey}, {"Com_sprintf", (byte *)Com_sprintf}, {"Q_strcasecmp", (byte *)Q_strcasecmp}, {"Q_strncasecmp", (byte *)Q_strncasecmp}, {"Q_stricmp", (byte *)Q_stricmp}, {"Com_PageInMemory", (byte *)Com_PageInMemory}, {"COM_Parse", (byte *)COM_Parse}, {"va", (byte *)va}, {"Swap_Init", (byte *)Swap_Init}, {"FloatNoSwap", (byte *)FloatNoSwap}, {"FloatSwap", (byte *)FloatSwap}, {"LongNoSwap", (byte *)LongNoSwap}, {"LongSwap", (byte *)LongSwap}, {"ShortNoSwap", (byte *)ShortNoSwap}, {"ShortSwap", (byte *)ShortSwap}, {"LittleFloat", (byte *)LittleFloat}, {"BigFloat", (byte *)BigFloat}, {"LittleLong", (byte *)LittleLong}, {"BigLong", (byte *)BigLong}, {"LittleShort", (byte *)LittleShort}, {"BigShort", (byte *)BigShort}, {"COM_DefaultExtension", (byte *)COM_DefaultExtension}, {"COM_FilePath", (byte *)COM_FilePath}, {"COM_FileBase", (byte *)COM_FileBase}, {"COM_FileExtension", (byte *)COM_FileExtension}, {"COM_StripExtension", (byte *)COM_StripExtension}, {"COM_SkipPath", (byte *)COM_SkipPath}, {"Q_log2", (byte *)Q_log2}, {"VectorScale", (byte *)VectorScale}, {"VectorInverse", (byte *)VectorInverse}, {"VectorLength", (byte *)VectorLength}, {"CrossProduct", (byte *)CrossProduct}, {"_VectorCopy", (byte *)_VectorCopy}, {"_VectorAdd", (byte *)_VectorAdd}, {"_VectorSubtract", (byte *)_VectorSubtract}, {"_DotProduct", (byte *)_DotProduct}, {"VectorMA", (byte *)VectorMA}, {"VectorNormalize2", (byte *)VectorNormalize2}, {"VectorNormalize", (byte *)VectorNormalize}, {"VectorCompare", (byte *)VectorCompare}, {"AddPointToBounds", (byte *)AddPointToBounds}, {"ClearBounds", (byte *)ClearBounds}, {"BoxOnPlaneSide2", (byte *)BoxOnPlaneSide2}, {"anglemod", (byte *)anglemod}, {"LerpAngle", (byte *)LerpAngle}, {"Q_fabs", (byte *)Q_fabs}, {"R_ConcatTransforms", (byte *)R_ConcatTransforms}, {"R_ConcatRotations", (byte *)R_ConcatRotations}, {"PerpendicularVector", (byte *)PerpendicularVector}, {"ProjectPointOnPlane", (byte *)ProjectPointOnPlane}, {"AngleVectors", (byte *)AngleVectors}, {"RotatePointAroundVector", (byte *)RotatePointAroundVector}, {"Weapon_Trap", (byte *)Weapon_Trap}, {"weapon_trap_fire", (byte *)weapon_trap_fire}, {"Weapon_Phalanx", (byte *)Weapon_Phalanx}, {"weapon_phalanx_fire", (byte *)weapon_phalanx_fire}, {"Weapon_Ionripper", (byte *)Weapon_Ionripper}, {"weapon_ionripper_fire", (byte *)weapon_ionripper_fire}, {"Weapon_BFG", (byte *)Weapon_BFG}, {"weapon_bfg_fire", (byte *)weapon_bfg_fire}, {"Weapon_Railgun", (byte *)Weapon_Railgun}, {"weapon_railgun_fire", (byte *)weapon_railgun_fire}, {"Weapon_SuperShotgun", (byte *)Weapon_SuperShotgun}, {"weapon_supershotgun_fire", (byte *)weapon_supershotgun_fire}, {"Weapon_Shotgun", (byte *)Weapon_Shotgun}, {"weapon_shotgun_fire", (byte *)weapon_shotgun_fire}, {"Weapon_Chaingun", (byte *)Weapon_Chaingun}, {"Chaingun_Fire", (byte *)Chaingun_Fire}, {"Weapon_Machinegun", (byte *)Weapon_Machinegun}, {"Machinegun_Fire", (byte *)Machinegun_Fire}, {"Weapon_HyperBlaster", (byte *)Weapon_HyperBlaster}, {"Weapon_HyperBlaster_Fire", (byte *)Weapon_HyperBlaster_Fire}, {"Weapon_Blaster", (byte *)Weapon_Blaster}, {"Weapon_Blaster_Fire", (byte *)Weapon_Blaster_Fire}, {"Blaster_Fire", (byte *)Blaster_Fire}, {"Weapon_RocketLauncher", (byte *)Weapon_RocketLauncher}, {"Weapon_RocketLauncher_Fire", (byte *)Weapon_RocketLauncher_Fire}, {"Weapon_GrenadeLauncher", (byte *)Weapon_GrenadeLauncher}, {"weapon_grenadelauncher_fire", (byte *)weapon_grenadelauncher_fire}, {"Weapon_Grenade", (byte *)Weapon_Grenade}, {"weapon_grenade_fire", (byte *)weapon_grenade_fire}, {"Weapon_Generic", (byte *)Weapon_Generic}, {"Drop_Weapon", (byte *)Drop_Weapon}, {"Use_Weapon2", (byte *)Use_Weapon2}, {"Use_Weapon", (byte *)Use_Weapon}, {"Think_Weapon", (byte *)Think_Weapon}, {"NoAmmoWeaponChange", (byte *)NoAmmoWeaponChange}, {"ChangeWeapon", (byte *)ChangeWeapon}, {"Pickup_Weapon", (byte *)Pickup_Weapon}, {"PlayerNoise", (byte *)PlayerNoise}, {"P_ProjectSource", (byte *)P_ProjectSource}, {"ClientEndServerFrame", (byte *)ClientEndServerFrame}, {"G_SetClientFrame", (byte *)G_SetClientFrame}, {"G_SetClientSound", (byte *)G_SetClientSound}, {"G_SetClientEvent", (byte *)G_SetClientEvent}, {"G_SetClientEffects", (byte *)G_SetClientEffects}, {"P_WorldEffects", (byte *)P_WorldEffects}, {"P_FallingDamage", (byte *)P_FallingDamage}, {"SV_CalcBlend", (byte *)SV_CalcBlend}, {"SV_AddBlend", (byte *)SV_AddBlend}, {"SV_CalcGunOffset", (byte *)SV_CalcGunOffset}, {"SV_CalcViewOffset", (byte *)SV_CalcViewOffset}, {"P_DamageFeedback", (byte *)P_DamageFeedback}, {"SV_CalcRoll", (byte *)SV_CalcRoll}, {"PlayerTrail_LastSpot", (byte *)PlayerTrail_LastSpot}, {"PlayerTrail_PickNext", (byte *)PlayerTrail_PickNext}, {"PlayerTrail_PickFirst", (byte *)PlayerTrail_PickFirst}, {"PlayerTrail_New", (byte *)PlayerTrail_New}, {"PlayerTrail_Add", (byte *)PlayerTrail_Add}, {"PlayerTrail_Init", (byte *)PlayerTrail_Init}, {"G_SetSpectatorStats", (byte *)G_SetSpectatorStats}, {"G_CheckChaseStats", (byte *)G_CheckChaseStats}, {"G_SetStats", (byte *)G_SetStats}, {"InventoryMessage", (byte *)InventoryMessage}, {"HelpComputerMessage", (byte *)HelpComputerMessage}, {"DeathmatchScoreboardMessage", (byte *)DeathmatchScoreboardMessage}, {"BeginIntermission", (byte *)BeginIntermission}, {"MoveClientToIntermission", (byte *)MoveClientToIntermission}, {"ClientBeginServerFrame", (byte *)ClientBeginServerFrame}, {"ClientThink", (byte *)ClientThink}, {"PrintPmove", (byte *)PrintPmove}, {"CheckBlock", (byte *)CheckBlock}, {"PM_trace", (byte *)PM_trace}, {"ClientDisconnect", (byte *)ClientDisconnect}, {"ClientConnect", (byte *)ClientConnect}, {"ClientUserinfoChanged", (byte *)ClientUserinfoChanged}, {"ClientBegin", (byte *)ClientBegin}, {"ClientBeginDeathmatch", (byte *)ClientBeginDeathmatch}, {"PutClientInServer", (byte *)PutClientInServer}, {"spectator_respawn", (byte *)spectator_respawn}, {"respawn", (byte *)respawn}, {"CopyToBodyQue", (byte *)CopyToBodyQue}, {"body_die", (byte *)body_die}, {"InitBodyQue", (byte *)InitBodyQue}, {"SelectSpawnPoint", (byte *)SelectSpawnPoint}, {"SelectCoopSpawnPoint", (byte *)SelectCoopSpawnPoint}, {"SelectDeathmatchSpawnPoint", (byte *)SelectDeathmatchSpawnPoint}, {"SelectFarthestDeathmatchSpawnPoint", (byte *)SelectFarthestDeathmatchSpawnPoint}, {"SelectRandomDeathmatchSpawnPoint", (byte *)SelectRandomDeathmatchSpawnPoint}, {"PlayersRangeFromSpot", (byte *)PlayersRangeFromSpot}, {"FetchClientEntData", (byte *)FetchClientEntData}, {"SaveClientData", (byte *)SaveClientData}, {"InitClientResp", (byte *)InitClientResp}, {"InitClientPersistant", (byte *)InitClientPersistant}, {"player_die", (byte *)player_die}, {"LookAtKiller", (byte *)LookAtKiller}, {"TossClientWeapon", (byte *)TossClientWeapon}, {"ClientObituary", (byte *)ClientObituary}, {"IsNeutral", (byte *)IsNeutral}, {"IsFemale", (byte *)IsFemale}, {"player_pain", (byte *)player_pain}, {"SP_info_player_intermission", (byte *)SP_info_player_intermission}, {"SP_info_player_coop", (byte *)SP_info_player_coop}, {"SP_info_player_deathmatch", (byte *)SP_info_player_deathmatch}, {"SP_info_player_start", (byte *)SP_info_player_start}, {"SP_CreateCoopSpots", (byte *)SP_CreateCoopSpots}, {"SP_FixCoopSpots", (byte *)SP_FixCoopSpots}, {"SP_monster_tank", (byte *)SP_monster_tank}, {"tank_die", (byte *)tank_die}, {"tank_dead", (byte *)tank_dead}, {"tank_attack", (byte *)tank_attack}, {"tank_doattack_rocket", (byte *)tank_doattack_rocket}, {"tank_refire_rocket", (byte *)tank_refire_rocket}, {"tank_poststrike", (byte *)tank_poststrike}, {"tank_reattack_blaster", (byte *)tank_reattack_blaster}, {"TankMachineGun", (byte *)TankMachineGun}, {"TankRocket", (byte *)TankRocket}, {"TankStrike", (byte *)TankStrike}, {"TankBlaster", (byte *)TankBlaster}, {"tank_pain", (byte *)tank_pain}, {"tank_run", (byte *)tank_run}, {"tank_walk", (byte *)tank_walk}, {"tank_stand", (byte *)tank_stand}, {"tank_idle", (byte *)tank_idle}, {"tank_windup", (byte *)tank_windup}, {"tank_thud", (byte *)tank_thud}, {"tank_footstep", (byte *)tank_footstep}, {"tank_sight", (byte *)tank_sight}, {"SP_monster_supertank", (byte *)SP_monster_supertank}, {"supertank_die", (byte *)supertank_die}, {"BossExplode", (byte *)BossExplode}, {"supertank_dead", (byte *)supertank_dead}, {"supertank_attack", (byte *)supertank_attack}, {"supertankMachineGun", (byte *)supertankMachineGun}, {"supertankRocket", (byte *)supertankRocket}, {"supertank_pain", (byte *)supertank_pain}, {"supertank_reattack1", (byte *)supertank_reattack1}, {"supertank_run", (byte *)supertank_run}, {"supertank_walk", (byte *)supertank_walk}, {"supertank_forward", (byte *)supertank_forward}, {"supertank_stand", (byte *)supertank_stand}, {"supertank_search", (byte *)supertank_search}, {"TreadSound", (byte *)TreadSound}, {"SP_monster_soldier_lasergun", (byte *)SP_monster_soldier_lasergun}, {"SP_monster_soldier_hypergun", (byte *)SP_monster_soldier_hypergun}, {"SP_monster_soldier_ripper", (byte *)SP_monster_soldier_ripper}, {"SP_monster_soldier_h", (byte *)SP_monster_soldier_h}, {"soldierh_die", (byte *)soldierh_die}, {"soldierh_dead", (byte *)soldierh_dead}, {"soldierh_fire7", (byte *)soldierh_fire7}, {"soldierh_fire6", (byte *)soldierh_fire6}, {"soldierh_dodge", (byte *)soldierh_dodge}, {"soldierh_duck_hold", (byte *)soldierh_duck_hold}, {"soldierh_sight", (byte *)soldierh_sight}, {"soldierh_attack", (byte *)soldierh_attack}, {"soldierh_attack6_refire", (byte *)soldierh_attack6_refire}, {"soldierh_fire8", (byte *)soldierh_fire8}, {"soldierh_fire4", (byte *)soldierh_fire4}, {"soldierh_attack3_refire", (byte *)soldierh_attack3_refire}, {"soldierh_fire3", (byte *)soldierh_fire3}, {"soldierh_duck_up", (byte *)soldierh_duck_up}, {"soldierh_duck_down", (byte *)soldierh_duck_down}, {"soldierh_attack2_refire2", (byte *)soldierh_attack2_refire2}, {"soldierh_attack2_refire1", (byte *)soldierh_attack2_refire1}, {"soldierh_fire2", (byte *)soldierh_fire2}, {"soldierh_ripper2", (byte *)soldierh_ripper2}, {"soldierh_hyper_refire2", (byte *)soldierh_hyper_refire2}, {"soldierh_hyper_sound", (byte *)soldierh_hyper_sound}, {"soldierh_attack1_refire2", (byte *)soldierh_attack1_refire2}, {"soldierh_attack1_refire1", (byte *)soldierh_attack1_refire1}, {"soldierh_fire1", (byte *)soldierh_fire1}, {"soldierh_ripper1", (byte *)soldierh_ripper1}, {"soldierh_hyper_refire1", (byte *)soldierh_hyper_refire1}, {"soldierh_fire", (byte *)soldierh_fire}, {"soldierh_laserbeam", (byte *)soldierh_laserbeam}, {"soldierh_pain", (byte *)soldierh_pain}, {"soldierh_run", (byte *)soldierh_run}, {"soldierh_walk", (byte *)soldierh_walk}, {"soldierh_walk1_random", (byte *)soldierh_walk1_random}, {"soldierh_stand", (byte *)soldierh_stand}, {"soldierh_cock", (byte *)soldierh_cock}, {"soldierh_idle", (byte *)soldierh_idle}, {"SP_monster_soldier_ss", (byte *)SP_monster_soldier_ss}, {"SP_monster_soldier", (byte *)SP_monster_soldier}, {"SP_monster_soldier_light", (byte *)SP_monster_soldier_light}, {"SP_monster_soldier_x", (byte *)SP_monster_soldier_x}, {"soldier_footstep", (byte *)soldier_footstep}, {"soldier_die", (byte *)soldier_die}, {"soldier_dead", (byte *)soldier_dead}, {"soldier_fire7", (byte *)soldier_fire7}, {"soldier_fire6", (byte *)soldier_fire6}, {"soldier_dodge", (byte *)soldier_dodge}, {"soldier_duck_hold", (byte *)soldier_duck_hold}, {"soldier_sight", (byte *)soldier_sight}, {"soldier_attack", (byte *)soldier_attack}, {"soldier_attack6_refire", (byte *)soldier_attack6_refire}, {"soldier_fire8", (byte *)soldier_fire8}, {"soldier_fire4", (byte *)soldier_fire4}, {"soldier_attack3_refire", (byte *)soldier_attack3_refire}, {"soldier_fire3", (byte *)soldier_fire3}, {"soldier_duck_up", (byte *)soldier_duck_up}, {"soldier_duck_down", (byte *)soldier_duck_down}, {"soldier_attack2_refire2", (byte *)soldier_attack2_refire2}, {"soldier_attack2_refire1", (byte *)soldier_attack2_refire1}, {"soldier_fire2", (byte *)soldier_fire2}, {"soldier_attack1_refire2", (byte *)soldier_attack1_refire2}, {"soldier_attack1_refire1", (byte *)soldier_attack1_refire1}, {"soldier_fire1", (byte *)soldier_fire1}, {"soldier_fire", (byte *)soldier_fire}, {"soldier_pain", (byte *)soldier_pain}, {"soldier_run", (byte *)soldier_run}, {"soldier_walk", (byte *)soldier_walk}, {"soldier_walk1_random", (byte *)soldier_walk1_random}, {"soldier_stand", (byte *)soldier_stand}, {"soldier_cock", (byte *)soldier_cock}, {"soldier_idle", (byte *)soldier_idle}, {"SP_monster_parasite", (byte *)SP_monster_parasite}, {"parasite_die", (byte *)parasite_die}, {"parasite_dead", (byte *)parasite_dead}, {"parasite_attack", (byte *)parasite_attack}, {"parasite_drain_attack", (byte *)parasite_drain_attack}, {"parasite_drain_attack_ok", (byte *)parasite_drain_attack_ok}, {"parasite_pain", (byte *)parasite_pain}, {"parasite_walk", (byte *)parasite_walk}, {"parasite_start_walk", (byte *)parasite_start_walk}, {"parasite_run", (byte *)parasite_run}, {"parasite_start_run", (byte *)parasite_start_run}, {"parasite_stand", (byte *)parasite_stand}, {"parasite_idle", (byte *)parasite_idle}, {"parasite_refidget", (byte *)parasite_refidget}, {"parasite_do_fidget", (byte *)parasite_do_fidget}, {"parasite_end_fidget", (byte *)parasite_end_fidget}, {"parasite_search", (byte *)parasite_search}, {"parasite_scratch", (byte *)parasite_scratch}, {"parasite_tap", (byte *)parasite_tap}, {"parasite_sight", (byte *)parasite_sight}, {"parasite_reel_in", (byte *)parasite_reel_in}, {"parasite_launch", (byte *)parasite_launch}, {"SP_monster_mutant", (byte *)SP_monster_mutant}, {"mutant_die", (byte *)mutant_die}, {"mutant_dead", (byte *)mutant_dead}, {"mutant_pain", (byte *)mutant_pain}, {"mutant_checkattack", (byte *)mutant_checkattack}, {"mutant_check_jump", (byte *)mutant_check_jump}, {"mutant_check_melee", (byte *)mutant_check_melee}, {"mutant_jump", (byte *)mutant_jump}, {"mutant_check_landing", (byte *)mutant_check_landing}, {"mutant_jump_takeoff", (byte *)mutant_jump_takeoff}, {"mutant_jump_touch", (byte *)mutant_jump_touch}, {"mutant_melee", (byte *)mutant_melee}, {"mutant_check_refire", (byte *)mutant_check_refire}, {"mutant_hit_right", (byte *)mutant_hit_right}, {"mutant_hit_left", (byte *)mutant_hit_left}, {"mutant_run", (byte *)mutant_run}, {"mutant_walk", (byte *)mutant_walk}, {"mutant_walk_loop", (byte *)mutant_walk_loop}, {"mutant_idle", (byte *)mutant_idle}, {"mutant_idle_loop", (byte *)mutant_idle_loop}, {"mutant_stand", (byte *)mutant_stand}, {"mutant_swing", (byte *)mutant_swing}, {"mutant_search", (byte *)mutant_search}, {"mutant_sight", (byte *)mutant_sight}, {"mutant_step", (byte *)mutant_step}, {"M_walkmove", (byte *)M_walkmove}, {"M_MoveToGoal", (byte *)M_MoveToGoal}, {"SV_CloseEnough", (byte *)SV_CloseEnough}, {"SV_NewChaseDir", (byte *)SV_NewChaseDir}, {"SV_FixCheckBottom", (byte *)SV_FixCheckBottom}, {"SV_StepDirection", (byte *)SV_StepDirection}, {"M_ChangeYaw", (byte *)M_ChangeYaw}, {"SV_movestep", (byte *)SV_movestep}, {"M_CheckBottom", (byte *)M_CheckBottom}, {"SP_monster_medic", (byte *)SP_monster_medic}, {"medic_footstep", (byte *)medic_footstep}, {"medic_checkattack", (byte *)medic_checkattack}, {"medic_attack", (byte *)medic_attack}, {"medic_hook_retract", (byte *)medic_hook_retract}, {"medic_cable_attack", (byte *)medic_cable_attack}, {"medic_hook_launch", (byte *)medic_hook_launch}, {"medic_continue", (byte *)medic_continue}, {"medic_dodge", (byte *)medic_dodge}, {"medic_duck_up", (byte *)medic_duck_up}, {"medic_duck_hold", (byte *)medic_duck_hold}, {"medic_duck_down", (byte *)medic_duck_down}, {"medic_die", (byte *)medic_die}, {"medic_dead", (byte *)medic_dead}, {"medic_fire_blaster", (byte *)medic_fire_blaster}, {"medic_pain", (byte *)medic_pain}, {"medic_run", (byte *)medic_run}, {"medic_walk", (byte *)medic_walk}, {"medic_stand", (byte *)medic_stand}, {"medic_sight", (byte *)medic_sight}, {"medic_search", (byte *)medic_search}, {"medic_idle", (byte *)medic_idle}, {"medic_FindDeadMonster", (byte *)medic_FindDeadMonster}, {"SP_misc_insane", (byte *)SP_misc_insane}, {"insane_footstep", (byte *)insane_footstep}, {"insane_die", (byte *)insane_die}, {"insane_dead", (byte *)insane_dead}, {"insane_stand", (byte *)insane_stand}, {"insane_checkup", (byte *)insane_checkup}, {"insane_checkdown", (byte *)insane_checkdown}, {"insane_onground", (byte *)insane_onground}, {"insane_pain", (byte *)insane_pain}, {"insane_run", (byte *)insane_run}, {"insane_walk", (byte *)insane_walk}, {"insane_cross", (byte *)insane_cross}, {"insane_scream", (byte *)insane_scream}, {"insane_moan", (byte *)insane_moan}, {"insane_shake", (byte *)insane_shake}, {"insane_fist", (byte *)insane_fist}, {"SP_monster_infantry", (byte *)SP_monster_infantry}, {"infantry_footstep", (byte *)infantry_footstep}, {"infantry_attack", (byte *)infantry_attack}, {"infantry_smack", (byte *)infantry_smack}, {"infantry_swing", (byte *)infantry_swing}, {"infantry_fire", (byte *)infantry_fire}, {"infantry_cock_gun", (byte *)infantry_cock_gun}, {"infantry_set_firetime", (byte *)infantry_set_firetime}, {"infantry_dodge", (byte *)infantry_dodge}, {"infantry_duck_up", (byte *)infantry_duck_up}, {"infantry_duck_hold", (byte *)infantry_duck_hold}, {"infantry_duck_down", (byte *)infantry_duck_down}, {"infantry_die", (byte *)infantry_die}, {"infantry_dead", (byte *)infantry_dead}, {"infantry_sight", (byte *)infantry_sight}, {"InfantryMachineGun", (byte *)InfantryMachineGun}, {"infantry_pain", (byte *)infantry_pain}, {"infantry_run", (byte *)infantry_run}, {"infantry_walk", (byte *)infantry_walk}, {"infantry_fidget", (byte *)infantry_fidget}, {"infantry_stand", (byte *)infantry_stand}, {"SP_monster_hover", (byte *)SP_monster_hover}, {"hover_die", (byte *)hover_die}, {"hover_dead", (byte *)hover_dead}, {"hover_deadthink", (byte *)hover_deadthink}, {"hover_pain", (byte *)hover_pain}, {"hover_attack", (byte *)hover_attack}, {"hover_start_attack", (byte *)hover_start_attack}, {"hover_walk", (byte *)hover_walk}, {"hover_run", (byte *)hover_run}, {"hover_stand", (byte *)hover_stand}, {"hover_fire_blaster", (byte *)hover_fire_blaster}, {"hover_reattack", (byte *)hover_reattack}, {"hover_search", (byte *)hover_search}, {"hover_sight", (byte *)hover_sight}, {"SP_monster_gunner", (byte *)SP_monster_gunner}, {"gunner_footstep", (byte *)gunner_footstep}, {"gunner_refire_chain", (byte *)gunner_refire_chain}, {"gunner_fire_chain", (byte *)gunner_fire_chain}, {"gunner_attack", (byte *)gunner_attack}, {"GunnerGrenade", (byte *)GunnerGrenade}, {"GunnerFire", (byte *)GunnerFire}, {"gunner_opengun", (byte *)gunner_opengun}, {"gunner_dodge", (byte *)gunner_dodge}, {"gunner_duck_up", (byte *)gunner_duck_up}, {"gunner_duck_hold", (byte *)gunner_duck_hold}, {"gunner_duck_down", (byte *)gunner_duck_down}, {"gunner_die", (byte *)gunner_die}, {"gunner_dead", (byte *)gunner_dead}, {"gunner_pain", (byte *)gunner_pain}, {"gunner_runandshoot", (byte *)gunner_runandshoot}, {"gunner_run", (byte *)gunner_run}, {"gunner_walk", (byte *)gunner_walk}, {"gunner_stand", (byte *)gunner_stand}, {"gunner_fidget", (byte *)gunner_fidget}, {"gunner_search", (byte *)gunner_search}, {"gunner_sight", (byte *)gunner_sight}, {"gunner_idlesound", (byte *)gunner_idlesound}, {"SP_monster_gladiator", (byte *)SP_monster_gladiator}, {"gladiator_footstep", (byte *)gladiator_footstep}, {"gladiator_die", (byte *)gladiator_die}, {"gladiator_dead", (byte *)gladiator_dead}, {"gladiator_pain", (byte *)gladiator_pain}, {"gladiator_attack", (byte *)gladiator_attack}, {"GladiatorGun", (byte *)GladiatorGun}, {"gladiator_melee", (byte *)gladiator_melee}, {"GaldiatorMelee", (byte *)GaldiatorMelee}, {"gladiator_run", (byte *)gladiator_run}, {"gladiator_walk", (byte *)gladiator_walk}, {"gladiator_stand", (byte *)gladiator_stand}, {"gladiator_cleaver_swing", (byte *)gladiator_cleaver_swing}, {"gladiator_search", (byte *)gladiator_search}, {"gladiator_sight", (byte *)gladiator_sight}, {"gladiator_idle", (byte *)gladiator_idle}, {"SP_monster_gladb", (byte *)SP_monster_gladb}, {"gladb_die", (byte *)gladb_die}, {"gladb_dead", (byte *)gladb_dead}, {"gladb_pain", (byte *)gladb_pain}, {"gladb_attack", (byte *)gladb_attack}, {"gladbGun_check", (byte *)gladbGun_check}, {"gladbGun", (byte *)gladbGun}, {"gladb_melee", (byte *)gladb_melee}, {"GladbMelee", (byte *)GladbMelee}, {"gladb_run", (byte *)gladb_run}, {"gladb_walk", (byte *)gladb_walk}, {"gladb_stand", (byte *)gladb_stand}, {"gladb_cleaver_swing", (byte *)gladb_cleaver_swing}, {"gladb_search", (byte *)gladb_search}, {"gladb_sight", (byte *)gladb_sight}, {"gladb_idle", (byte *)gladb_idle}, {"land_to_water", (byte *)land_to_water}, {"water_to_land", (byte *)water_to_land}, {"SP_monster_gekk", (byte *)SP_monster_gekk}, {"gekk_dodge", (byte *)gekk_dodge}, {"gekk_duck_hold", (byte *)gekk_duck_hold}, {"gekk_duck_up", (byte *)gekk_duck_up}, {"gekk_duck_down", (byte *)gekk_duck_down}, {"gekk_die", (byte *)gekk_die}, {"isgibfest", (byte *)isgibfest}, {"gekk_gibfest", (byte *)gekk_gibfest}, {"gekk_dead", (byte *)gekk_dead}, {"gekk_pain", (byte *)gekk_pain}, {"gekk_jump", (byte *)gekk_jump}, {"gekk_check_landing", (byte *)gekk_check_landing}, {"gekk_stop_skid", (byte *)gekk_stop_skid}, {"gekk_jump_takeoff2", (byte *)gekk_jump_takeoff2}, {"gekk_jump_takeoff", (byte *)gekk_jump_takeoff}, {"gekk_jump_touch", (byte *)gekk_jump_touch}, {"gekk_melee", (byte *)gekk_melee}, {"gekk_preattack", (byte *)gekk_preattack}, {"gekk_bite", (byte *)gekk_bite}, {"gekk_check_underwater", (byte *)gekk_check_underwater}, {"reloogie", (byte *)reloogie}, {"loogie", (byte *)loogie}, {"fire_loogie", (byte *)fire_loogie}, {"loogie_touch", (byte *)loogie_touch}, {"gekk_check_refire", (byte *)gekk_check_refire}, {"gekk_hit_right", (byte *)gekk_hit_right}, {"gekk_hit_left", (byte *)gekk_hit_left}, {"gekk_run", (byte *)gekk_run}, {"gekk_run_start", (byte *)gekk_run_start}, {"gekk_walk", (byte *)gekk_walk}, {"gekk_idle", (byte *)gekk_idle}, {"gekk_idle_loop", (byte *)gekk_idle_loop}, {"gekk_stand", (byte *)gekk_stand}, {"gekk_swim", (byte *)gekk_swim}, {"gekk_swim_loop", (byte *)gekk_swim_loop}, {"ai_stand2", (byte *)ai_stand2}, {"gekk_face", (byte *)gekk_face}, {"gekk_swing", (byte *)gekk_swing}, {"gekk_search", (byte *)gekk_search}, {"gekk_sight", (byte *)gekk_sight}, {"gekk_step", (byte *)gekk_step}, {"gekk_checkattack", (byte *)gekk_checkattack}, {"gekk_check_jump_close", (byte *)gekk_check_jump_close}, {"gekk_check_jump", (byte *)gekk_check_jump}, {"gekk_check_melee", (byte *)gekk_check_melee}, {"SP_monster_flyer", (byte *)SP_monster_flyer}, {"flyer_die", (byte *)flyer_die}, {"flyer_pain", (byte *)flyer_pain}, {"flyer_check_melee", (byte *)flyer_check_melee}, {"flyer_melee", (byte *)flyer_melee}, {"flyer_nextmove", (byte *)flyer_nextmove}, {"flyer_setstart", (byte *)flyer_setstart}, {"flyer_attack", (byte *)flyer_attack}, {"flyer_loop_melee", (byte *)flyer_loop_melee}, {"flyer_slash_right", (byte *)flyer_slash_right}, {"flyer_slash_left", (byte *)flyer_slash_left}, {"flyer_fireright", (byte *)flyer_fireright}, {"flyer_fireleft", (byte *)flyer_fireleft}, {"flyer_fire", (byte *)flyer_fire}, {"flyer_start", (byte *)flyer_start}, {"flyer_stop", (byte *)flyer_stop}, {"flyer_stand", (byte *)flyer_stand}, {"flyer_walk", (byte *)flyer_walk}, {"flyer_run", (byte *)flyer_run}, {"flyer_pop_blades", (byte *)flyer_pop_blades}, {"flyer_idle", (byte *)flyer_idle}, {"flyer_sight", (byte *)flyer_sight}, {"SP_monster_floater", (byte *)SP_monster_floater}, {"floater_die", (byte *)floater_die}, {"floater_dead", (byte *)floater_dead}, {"floater_pain", (byte *)floater_pain}, {"floater_melee", (byte *)floater_melee}, {"floater_attack", (byte *)floater_attack}, {"floater_zap", (byte *)floater_zap}, {"floater_wham", (byte *)floater_wham}, {"floater_walk", (byte *)floater_walk}, {"floater_run", (byte *)floater_run}, {"floater_stand", (byte *)floater_stand}, {"floater_fire_blaster", (byte *)floater_fire_blaster}, {"floater_idle", (byte *)floater_idle}, {"floater_sight", (byte *)floater_sight}, {"SP_monster_flipper", (byte *)SP_monster_flipper}, {"flipper_die", (byte *)flipper_die}, {"flipper_sight", (byte *)flipper_sight}, {"flipper_dead", (byte *)flipper_dead}, {"flipper_pain", (byte *)flipper_pain}, {"flipper_melee", (byte *)flipper_melee}, {"flipper_preattack", (byte *)flipper_preattack}, {"flipper_bite", (byte *)flipper_bite}, {"flipper_start_run", (byte *)flipper_start_run}, {"flipper_walk", (byte *)flipper_walk}, {"flipper_run", (byte *)flipper_run}, {"flipper_run_loop", (byte *)flipper_run_loop}, {"flipper_stand", (byte *)flipper_stand}, {"SP_monster_fixbot", (byte *)SP_monster_fixbot}, {"bot_goal_think", (byte *)bot_goal_think}, {"fixbot_die", (byte *)fixbot_die}, {"fixbot_dead", (byte *)fixbot_dead}, {"fixbot_pain", (byte *)fixbot_pain}, {"fixbot_attack", (byte *)fixbot_attack}, {"fixbot_start_attack", (byte *)fixbot_start_attack}, {"fixbot_walk", (byte *)fixbot_walk}, {"fixbot_run", (byte *)fixbot_run}, {"fixbot_stand", (byte *)fixbot_stand}, {"fixbot_fire_blaster", (byte *)fixbot_fire_blaster}, {"fixbot_fire_welder", (byte *)fixbot_fire_welder}, {"ai_move2", (byte *)ai_move2}, {"weldstate", (byte *)weldstate}, {"fixbot_fire_laser", (byte *)fixbot_fire_laser}, {"check_telefrag", (byte *)check_telefrag}, {"ai_movetogoal", (byte *)ai_movetogoal}, {"go_roam", (byte *)go_roam}, {"ai_facing", (byte *)ai_facing}, {"fly_vertical2", (byte *)fly_vertical2}, {"fly_vertical", (byte *)fly_vertical}, {"blastoff", (byte *)blastoff}, {"use_scanner", (byte *)use_scanner}, {"roam_goal", (byte *)roam_goal}, {"change_to_roam", (byte *)change_to_roam}, {"takeoff_goal", (byte *)takeoff_goal}, {"landing_goal", (byte *)landing_goal}, {"fixbot_search", (byte *)fixbot_search}, {"fixbot_FindDeadMonster", (byte *)fixbot_FindDeadMonster}, {"crand", (byte *)crand}, {"SP_monster_chick_heat", (byte *)SP_monster_chick_heat}, {"SP_monster_chick", (byte *)SP_monster_chick}, {"chick_footstep", (byte *)chick_footstep}, {"chick_sight", (byte *)chick_sight}, {"chick_attack", (byte *)chick_attack}, {"chick_melee", (byte *)chick_melee}, {"chick_slash", (byte *)chick_slash}, {"chick_reslash", (byte *)chick_reslash}, {"chick_attack1", (byte *)chick_attack1}, {"chick_rerocket", (byte *)chick_rerocket}, {"ChickReload", (byte *)ChickReload}, {"Chick_PreAttack1", (byte *)Chick_PreAttack1}, {"ChickRocket", (byte *)ChickRocket}, {"ChickSlash", (byte *)ChickSlash}, {"chick_dodge", (byte *)chick_dodge}, {"chick_duck_up", (byte *)chick_duck_up}, {"chick_duck_hold", (byte *)chick_duck_hold}, {"chick_duck_down", (byte *)chick_duck_down}, {"chick_die", (byte *)chick_die}, {"chick_dead", (byte *)chick_dead}, {"chick_pain", (byte *)chick_pain}, {"chick_run", (byte *)chick_run}, {"chick_walk", (byte *)chick_walk}, {"chick_stand", (byte *)chick_stand}, {"chick_fidget", (byte *)chick_fidget}, {"ChickMoan", (byte *)ChickMoan}, {"SP_monster_brain", (byte *)SP_monster_brain}, {"brain_footstep", (byte *)brain_footstep}, {"brain_die", (byte *)brain_die}, {"brain_dead", (byte *)brain_dead}, {"brain_pain", (byte *)brain_pain}, {"brain_run", (byte *)brain_run}, {"brain_attack", (byte *)brain_attack}, {"brain_laserbeam_reattack", (byte *)brain_laserbeam_reattack}, {"brain_laserbeam", (byte *)brain_laserbeam}, {"brain_tounge_attack", (byte *)brain_tounge_attack}, {"brain_tounge_attack_ok", (byte *)brain_tounge_attack_ok}, {"brain_melee", (byte *)brain_melee}, {"brain_chest_closed", (byte *)brain_chest_closed}, {"brain_tentacle_attack", (byte *)brain_tentacle_attack}, {"brain_chest_open", (byte *)brain_chest_open}, {"brain_hit_left", (byte *)brain_hit_left}, {"brain_swing_left", (byte *)brain_swing_left}, {"brain_hit_right", (byte *)brain_hit_right}, {"brain_swing_right", (byte *)brain_swing_right}, {"brain_dodge", (byte *)brain_dodge}, {"brain_duck_up", (byte *)brain_duck_up}, {"brain_duck_hold", (byte *)brain_duck_hold}, {"brain_duck_down", (byte *)brain_duck_down}, {"brain_walk", (byte *)brain_walk}, {"brain_idle", (byte *)brain_idle}, {"brain_stand", (byte *)brain_stand}, {"brain_search", (byte *)brain_search}, {"brain_sight", (byte *)brain_sight}, {"SP_monster_boss5", (byte *)SP_monster_boss5}, {"boss5_die", (byte *)boss5_die}, {"BossExplode2", (byte *)BossExplode2}, {"boss5_dead", (byte *)boss5_dead}, {"boss5_attack", (byte *)boss5_attack}, {"boss5MachineGun", (byte *)boss5MachineGun}, {"boss5Rocket", (byte *)boss5Rocket}, {"boss5_pain", (byte *)boss5_pain}, {"boss5_reattack1", (byte *)boss5_reattack1}, {"boss5_run", (byte *)boss5_run}, {"boss5_walk", (byte *)boss5_walk}, {"boss5_forward", (byte *)boss5_forward}, {"boss5_stand", (byte *)boss5_stand}, {"boss5_search", (byte *)boss5_search}, {"TreadSound2", (byte *)TreadSound2}, {"MakronToss", (byte *)MakronToss}, {"MakronSpawn", (byte *)MakronSpawn}, {"SP_monster_makron", (byte *)SP_monster_makron}, {"MakronPrecache", (byte *)MakronPrecache}, {"Makron_CheckAttack", (byte *)Makron_CheckAttack}, {"makron_die", (byte *)makron_die}, {"makron_torso_die", (byte *)makron_torso_die}, {"makron_dead", (byte *)makron_dead}, {"makron_torso", (byte *)makron_torso}, {"makron_torso_think", (byte *)makron_torso_think}, {"makron_attack", (byte *)makron_attack}, {"makron_sight", (byte *)makron_sight}, {"makron_pain", (byte *)makron_pain}, {"MakronHyperblaster", (byte *)MakronHyperblaster}, {"MakronRailgun", (byte *)MakronRailgun}, {"MakronSaveloc", (byte *)MakronSaveloc}, {"makronBFG", (byte *)makronBFG}, {"makron_run", (byte *)makron_run}, {"makron_walk", (byte *)makron_walk}, {"makron_prerailgun", (byte *)makron_prerailgun}, {"makron_brainsplorch", (byte *)makron_brainsplorch}, {"makron_step_right", (byte *)makron_step_right}, {"makron_step_left", (byte *)makron_step_left}, {"makron_popup", (byte *)makron_popup}, {"makron_hit", (byte *)makron_hit}, {"makron_stand", (byte *)makron_stand}, {"makron_taunt", (byte *)makron_taunt}, {"SP_monster_jorg", (byte *)SP_monster_jorg}, {"Jorg_CheckAttack", (byte *)Jorg_CheckAttack}, {"jorg_die", (byte *)jorg_die}, {"jorg_dead", (byte *)jorg_dead}, {"jorg_attack", (byte *)jorg_attack}, {"jorg_firebullet", (byte *)jorg_firebullet}, {"jorg_firebullet_left", (byte *)jorg_firebullet_left}, {"jorg_firebullet_right", (byte *)jorg_firebullet_right}, {"jorgBFG", (byte *)jorgBFG}, {"jorg_pain", (byte *)jorg_pain}, {"jorg_attack1", (byte *)jorg_attack1}, {"jorg_reattack1", (byte *)jorg_reattack1}, {"jorg_run", (byte *)jorg_run}, {"jorg_walk", (byte *)jorg_walk}, {"jorg_stand", (byte *)jorg_stand}, {"jorg_step_right", (byte *)jorg_step_right}, {"jorg_step_left", (byte *)jorg_step_left}, {"jorg_death_hit", (byte *)jorg_death_hit}, {"jorg_idle", (byte *)jorg_idle}, {"jorg_search", (byte *)jorg_search}, {"SP_monster_boss3_stand", (byte *)SP_monster_boss3_stand}, {"Think_Boss3Stand", (byte *)Think_Boss3Stand}, {"Use_Boss3", (byte *)Use_Boss3}, {"SP_monster_boss2", (byte *)SP_monster_boss2}, {"Boss2_CheckAttack", (byte *)Boss2_CheckAttack}, {"boss2_die", (byte *)boss2_die}, {"boss2_dead", (byte *)boss2_dead}, {"boss2_pain", (byte *)boss2_pain}, {"boss2_reattack_mg", (byte *)boss2_reattack_mg}, {"boss2_attack_mg", (byte *)boss2_attack_mg}, {"boss2_attack", (byte *)boss2_attack}, {"boss2_walk", (byte *)boss2_walk}, {"boss2_run", (byte *)boss2_run}, {"boss2_stand", (byte *)boss2_stand}, {"Boss2MachineGun", (byte *)Boss2MachineGun}, {"boss2_firebullet_left", (byte *)boss2_firebullet_left}, {"boss2_firebullet_right", (byte *)boss2_firebullet_right}, {"Boss2Rocket", (byte *)Boss2Rocket}, {"boss2_search", (byte *)boss2_search}, {"SP_monster_berserk", (byte *)SP_monster_berserk}, {"berserk_footstep", (byte *)berserk_footstep}, {"berserk_die", (byte *)berserk_die}, {"berserk_dead", (byte *)berserk_dead}, {"berserk_pain", (byte *)berserk_pain}, {"berserk_melee", (byte *)berserk_melee}, {"berserk_strike", (byte *)berserk_strike}, {"berserk_attack_club", (byte *)berserk_attack_club}, {"berserk_swing", (byte *)berserk_swing}, {"berserk_attack_spike", (byte *)berserk_attack_spike}, {"berserk_run", (byte *)berserk_run}, {"berserk_walk", (byte *)berserk_walk}, {"berserk_fidget", (byte *)berserk_fidget}, {"berserk_stand", (byte *)berserk_stand}, {"berserk_search", (byte *)berserk_search}, {"berserk_sight", (byte *)berserk_sight}, {"fire_trap", (byte *)fire_trap}, {"Trap_Think", (byte *)Trap_Think}, {"fire_plasma", (byte *)fire_plasma}, {"plasma_touch", (byte *)plasma_touch}, {"fire_heat", (byte *)fire_heat}, {"heat_think", (byte *)heat_think}, {"fire_ionripper", (byte *)fire_ionripper}, {"ionripper_touch", (byte *)ionripper_touch}, {"ionripper_sparks", (byte *)ionripper_sparks}, {"fire_bfg", (byte *)fire_bfg}, {"bfg_think", (byte *)bfg_think}, {"bfg_touch", (byte *)bfg_touch}, {"bfg_explode", (byte *)bfg_explode}, {"fire_rail", (byte *)fire_rail}, {"fire_rocket", (byte *)fire_rocket}, {"rocket_touch", (byte *)rocket_touch}, {"fire_grenade2", (byte *)fire_grenade2}, {"fire_grenade", (byte *)fire_grenade}, {"Grenade_Touch", (byte *)Grenade_Touch}, {"Grenade_Explode", (byte *)Grenade_Explode}, {"fire_blueblaster", (byte *)fire_blueblaster}, {"fire_blaster", (byte *)fire_blaster}, {"blaster_touch", (byte *)blaster_touch}, {"fire_shotgun", (byte *)fire_shotgun}, {"fire_bullet", (byte *)fire_bullet}, {"fire_lead", (byte *)fire_lead}, {"fire_hit", (byte *)fire_hit}, {"check_dodge", (byte *)check_dodge}, {"KillBox", (byte *)KillBox}, {"G_TouchSolids", (byte *)G_TouchSolids}, {"G_TouchTriggers", (byte *)G_TouchTriggers}, {"G_FreeEdict", (byte *)G_FreeEdict}, {"G_Spawn", (byte *)G_Spawn}, {"G_InitEdict", (byte *)G_InitEdict}, {"G_CopyString", (byte *)G_CopyString}, {"vectoangles", (byte *)vectoangles}, {"vectoyaw", (byte *)vectoyaw}, {"G_SetMovedir", (byte *)G_SetMovedir}, {"vtos", (byte *)vtos}, {"tv", (byte *)tv}, {"G_UseTargets", (byte *)G_UseTargets}, {"Think_Delay", (byte *)Think_Delay}, {"G_PickTarget", (byte *)G_PickTarget}, {"findradius", (byte *)findradius}, {"G_Find", (byte *)G_Find}, {"G_ProjectSource", (byte *)G_ProjectSource}, {"SP_turret_driver", (byte *)SP_turret_driver}, {"turret_driver_link", (byte *)turret_driver_link}, {"turret_driver_think", (byte *)turret_driver_think}, {"turret_driver_die", (byte *)turret_driver_die}, {"SP_turret_base", (byte *)SP_turret_base}, {"SP_turret_breach", (byte *)SP_turret_breach}, {"turret_breach_finish_init", (byte *)turret_breach_finish_init}, {"turret_breach_think", (byte *)turret_breach_think}, {"turret_breach_fire", (byte *)turret_breach_fire}, {"turret_blocked", (byte *)turret_blocked}, {"SnapToEights", (byte *)SnapToEights}, {"AnglesNormalize", (byte *)AnglesNormalize}, {"SP_trigger_monsterjump", (byte *)SP_trigger_monsterjump}, {"trigger_monsterjump_touch", (byte *)trigger_monsterjump_touch}, {"SP_trigger_gravity", (byte *)SP_trigger_gravity}, {"trigger_gravity_touch", (byte *)trigger_gravity_touch}, {"SP_trigger_hurt", (byte *)SP_trigger_hurt}, {"hurt_touch", (byte *)hurt_touch}, {"hurt_use", (byte *)hurt_use}, {"SP_trigger_push", (byte *)SP_trigger_push}, {"trigger_push_active", (byte *)trigger_push_active}, {"trigger_push_inactive", (byte *)trigger_push_inactive}, {"trigger_effect", (byte *)trigger_effect}, {"trigger_push_touch", (byte *)trigger_push_touch}, {"SP_trigger_always", (byte *)SP_trigger_always}, {"SP_trigger_counter", (byte *)SP_trigger_counter}, {"trigger_counter_use", (byte *)trigger_counter_use}, {"SP_trigger_key", (byte *)SP_trigger_key}, {"trigger_key_use", (byte *)trigger_key_use}, {"SP_trigger_relay", (byte *)SP_trigger_relay}, {"trigger_relay_use", (byte *)trigger_relay_use}, {"SP_trigger_once", (byte *)SP_trigger_once}, {"SP_trigger_multiple", (byte *)SP_trigger_multiple}, {"trigger_enable", (byte *)trigger_enable}, {"Touch_Multi", (byte *)Touch_Multi}, {"Use_Multi", (byte *)Use_Multi}, {"multi_trigger", (byte *)multi_trigger}, {"multi_wait", (byte *)multi_wait}, {"InitTrigger", (byte *)InitTrigger}, {"SP_target_earthquake", (byte *)SP_target_earthquake}, {"target_earthquake_use", (byte *)target_earthquake_use}, {"target_earthquake_think", (byte *)target_earthquake_think}, {"SP_target_lightramp", (byte *)SP_target_lightramp}, {"target_lightramp_use", (byte *)target_lightramp_use}, {"target_lightramp_think", (byte *)target_lightramp_think}, {"SP_target_mal_laser", (byte *)SP_target_mal_laser}, {"mal_laser_think", (byte *)mal_laser_think}, {"target_mal_laser_use", (byte *)target_mal_laser_use}, {"target_mal_laser_off", (byte *)target_mal_laser_off}, {"target_mal_laser_on", (byte *)target_mal_laser_on}, {"SP_target_laser", (byte *)SP_target_laser}, {"target_laser_start", (byte *)target_laser_start}, {"target_laser_use", (byte *)target_laser_use}, {"target_laser_off", (byte *)target_laser_off}, {"target_laser_on", (byte *)target_laser_on}, {"target_laser_think", (byte *)target_laser_think}, {"SP_target_crosslevel_target", (byte *)SP_target_crosslevel_target}, {"target_crosslevel_target_think", (byte *)target_crosslevel_target_think}, {"SP_target_crosslevel_trigger", (byte *)SP_target_crosslevel_trigger}, {"trigger_crosslevel_trigger_use", (byte *)trigger_crosslevel_trigger_use}, {"SP_target_blaster", (byte *)SP_target_blaster}, {"use_target_blaster", (byte *)use_target_blaster}, {"SP_target_spawner", (byte *)SP_target_spawner}, {"use_target_spawner", (byte *)use_target_spawner}, {"SP_target_splash", (byte *)SP_target_splash}, {"use_target_splash", (byte *)use_target_splash}, {"SP_target_changelevel", (byte *)SP_target_changelevel}, {"use_target_changelevel", (byte *)use_target_changelevel}, {"SP_target_explosion", (byte *)SP_target_explosion}, {"use_target_explosion", (byte *)use_target_explosion}, {"target_explosion_explode", (byte *)target_explosion_explode}, {"SP_target_goal", (byte *)SP_target_goal}, {"use_target_goal", (byte *)use_target_goal}, {"SP_target_secret", (byte *)SP_target_secret}, {"use_target_secret", (byte *)use_target_secret}, {"SP_target_help", (byte *)SP_target_help}, {"Use_Target_Help", (byte *)Use_Target_Help}, {"Target_Help_Think", (byte *)Target_Help_Think}, {"SP_target_speaker", (byte *)SP_target_speaker}, {"Use_Target_Speaker", (byte *)Use_Target_Speaker}, {"SP_target_temp_entity", (byte *)SP_target_temp_entity}, {"Use_Target_Tent", (byte *)Use_Target_Tent}, {"ServerCommand", (byte *)ServerCommand}, {"SVCmd_WriteIP_f", (byte *)SVCmd_WriteIP_f}, {"SVCmd_ListIP_f", (byte *)SVCmd_ListIP_f}, {"SVCmd_RemoveIP_f", (byte *)SVCmd_RemoveIP_f}, {"SVCmd_AddIP_f", (byte *)SVCmd_AddIP_f}, {"SV_FilterPacket", (byte *)SV_FilterPacket}, {"Svcmd_Test_f", (byte *)Svcmd_Test_f}, {"SP_worldspawn", (byte *)SP_worldspawn}, {"SpawnEntities", (byte *)SpawnEntities}, {"G_FindTeams", (byte *)G_FindTeams}, {"ED_ParseEdict", (byte *)ED_ParseEdict}, {"ED_ParseField", (byte *)ED_ParseField}, {"ED_NewString", (byte *)ED_NewString}, {"ED_CallSpawn", (byte *)ED_CallSpawn}, {"G_RunEntity", (byte *)G_RunEntity}, {"SV_Physics_Step", (byte *)SV_Physics_Step}, {"SV_AddRotationalFriction", (byte *)SV_AddRotationalFriction}, {"SV_Physics_Toss", (byte *)SV_Physics_Toss}, {"SV_Physics_Noclip", (byte *)SV_Physics_Noclip}, {"SV_Physics_None", (byte *)SV_Physics_None}, {"SV_Physics_Pusher", (byte *)SV_Physics_Pusher}, {"SV_Push", (byte *)SV_Push}, {"SV_PushEntity", (byte *)SV_PushEntity}, {"RealBoundingBox", (byte *)RealBoundingBox}, {"SV_AddGravity", (byte *)SV_AddGravity}, {"SV_FlyMove", (byte *)SV_FlyMove}, {"ClipVelocity", (byte *)ClipVelocity}, {"SV_Impact", (byte *)SV_Impact}, {"SV_RunThink", (byte *)SV_RunThink}, {"SV_CheckVelocity", (byte *)SV_CheckVelocity}, {"SV_TestEntityPosition", (byte *)SV_TestEntityPosition}, {"swimmonster_start", (byte *)swimmonster_start}, {"swimmonster_start_go", (byte *)swimmonster_start_go}, {"flymonster_start", (byte *)flymonster_start}, {"flymonster_start_go", (byte *)flymonster_start_go}, {"walkmonster_start", (byte *)walkmonster_start}, {"walkmonster_start_go", (byte *)walkmonster_start_go}, {"monster_start_go", (byte *)monster_start_go}, {"monster_start", (byte *)monster_start}, {"monster_death_use", (byte *)monster_death_use}, {"monster_triggered_start", (byte *)monster_triggered_start}, {"monster_triggered_spawn_use", (byte *)monster_triggered_spawn_use}, {"monster_triggered_spawn", (byte *)monster_triggered_spawn}, {"monster_use", (byte *)monster_use}, {"monster_think", (byte *)monster_think}, {"M_MoveFrame", (byte *)M_MoveFrame}, {"M_SetEffects", (byte *)M_SetEffects}, {"M_droptofloor", (byte *)M_droptofloor}, {"M_WorldEffects", (byte *)M_WorldEffects}, {"M_CatagorizePosition", (byte *)M_CatagorizePosition}, {"M_CheckGround", (byte *)M_CheckGround}, {"AttackFinished", (byte *)AttackFinished}, {"M_FlyCheck", (byte *)M_FlyCheck}, {"M_FliesOn", (byte *)M_FliesOn}, {"M_FliesOff", (byte *)M_FliesOff}, {"monster_fire_bfg", (byte *)monster_fire_bfg}, {"monster_fire_railgun", (byte *)monster_fire_railgun}, {"monster_fire_rocket", (byte *)monster_fire_rocket}, {"monster_fire_grenade", (byte *)monster_fire_grenade}, {"monster_dabeam", (byte *)monster_dabeam}, {"dabeam_hit", (byte *)dabeam_hit}, {"monster_fire_heat", (byte *)monster_fire_heat}, {"monster_fire_ionripper", (byte *)monster_fire_ionripper}, {"monster_fire_blueblaster", (byte *)monster_fire_blueblaster}, {"monster_fire_blaster", (byte *)monster_fire_blaster}, {"monster_fire_shotgun", (byte *)monster_fire_shotgun}, {"monster_fire_bullet", (byte *)monster_fire_bullet}, {"SP_misc_nuke", (byte *)SP_misc_nuke}, {"use_nuke", (byte *)use_nuke}, {"SP_misc_amb4", (byte *)SP_misc_amb4}, {"amb4_think", (byte *)amb4_think}, {"SP_misc_teleporter_dest", (byte *)SP_misc_teleporter_dest}, {"SP_misc_teleporter", (byte *)SP_misc_teleporter}, {"teleporter_touch", (byte *)teleporter_touch}, {"SP_func_clock", (byte *)SP_func_clock}, {"func_clock_use", (byte *)func_clock_use}, {"func_clock_think", (byte *)func_clock_think}, {"func_clock_format_countdown", (byte *)func_clock_format_countdown}, {"func_clock_reset", (byte *)func_clock_reset}, {"SP_target_string", (byte *)SP_target_string}, {"target_string_use", (byte *)target_string_use}, {"SP_target_character", (byte *)SP_target_character}, {"SP_misc_gib_head", (byte *)SP_misc_gib_head}, {"SP_misc_gib_leg", (byte *)SP_misc_gib_leg}, {"SP_misc_gib_arm", (byte *)SP_misc_gib_arm}, {"SP_light_mine2", (byte *)SP_light_mine2}, {"SP_light_mine1", (byte *)SP_light_mine1}, {"SP_misc_satellite_dish", (byte *)SP_misc_satellite_dish}, {"misc_satellite_dish_use", (byte *)misc_satellite_dish_use}, {"misc_satellite_dish_think", (byte *)misc_satellite_dish_think}, {"SP_misc_transport", (byte *)SP_misc_transport}, {"SP_misc_strogg_ship", (byte *)SP_misc_strogg_ship}, {"misc_strogg_ship_use", (byte *)misc_strogg_ship_use}, {"SP_misc_viper_missile", (byte *)SP_misc_viper_missile}, {"misc_viper_missile_use", (byte *)misc_viper_missile_use}, {"SP_misc_viper_bomb", (byte *)SP_misc_viper_bomb}, {"misc_viper_bomb_use", (byte *)misc_viper_bomb_use}, {"misc_viper_bomb_prethink", (byte *)misc_viper_bomb_prethink}, {"misc_viper_bomb_touch", (byte *)misc_viper_bomb_touch}, {"SP_misc_bigviper", (byte *)SP_misc_bigviper}, {"SP_misc_crashviper", (byte *)SP_misc_crashviper}, {"SP_misc_viper", (byte *)SP_misc_viper}, {"misc_viper_use", (byte *)misc_viper_use}, {"SP_misc_deadsoldier", (byte *)SP_misc_deadsoldier}, {"misc_deadsoldier_die", (byte *)misc_deadsoldier_die}, {"SP_misc_banner", (byte *)SP_misc_banner}, {"misc_banner_think", (byte *)misc_banner_think}, {"SP_monster_commander_body", (byte *)SP_monster_commander_body}, {"commander_body_drop", (byte *)commander_body_drop}, {"commander_body_use", (byte *)commander_body_use}, {"commander_body_think", (byte *)commander_body_think}, {"SP_misc_easterchick2", (byte *)SP_misc_easterchick2}, {"misc_easterchick2_think", (byte *)misc_easterchick2_think}, {"SP_misc_easterchick", (byte *)SP_misc_easterchick}, {"misc_easterchick_think", (byte *)misc_easterchick_think}, {"SP_misc_eastertank", (byte *)SP_misc_eastertank}, {"misc_eastertank_think", (byte *)misc_eastertank_think}, {"SP_misc_blackhole", (byte *)SP_misc_blackhole}, {"misc_blackhole_think", (byte *)misc_blackhole_think}, {"misc_blackhole_use", (byte *)misc_blackhole_use}, {"SP_misc_explobox", (byte *)SP_misc_explobox}, {"barrel_delay", (byte *)barrel_delay}, {"barrel_explode", (byte *)barrel_explode}, {"barrel_touch", (byte *)barrel_touch}, {"SP_func_explosive", (byte *)SP_func_explosive}, {"func_explosive_spawn", (byte *)func_explosive_spawn}, {"func_explosive_use", (byte *)func_explosive_use}, {"func_explosive_explode", (byte *)func_explosive_explode}, {"SP_func_object", (byte *)SP_func_object}, {"func_object_use", (byte *)func_object_use}, {"func_object_release", (byte *)func_object_release}, {"func_object_touch", (byte *)func_object_touch}, {"SP_func_wall", (byte *)SP_func_wall}, {"func_wall_use", (byte *)func_wall_use}, {"SP_light", (byte *)SP_light}, {"light_use", (byte *)light_use}, {"SP_info_notnull", (byte *)SP_info_notnull}, {"SP_info_null", (byte *)SP_info_null}, {"SP_viewthing", (byte *)SP_viewthing}, {"TH_viewthing", (byte *)TH_viewthing}, {"SP_point_combat", (byte *)SP_point_combat}, {"point_combat_touch", (byte *)point_combat_touch}, {"SP_path_corner", (byte *)SP_path_corner}, {"path_corner_touch", (byte *)path_corner_touch}, {"BecomeExplosion2", (byte *)BecomeExplosion2}, {"BecomeExplosion1", (byte *)BecomeExplosion1}, {"ThrowDebris", (byte *)ThrowDebris}, {"debris_die", (byte *)debris_die}, {"ThrowClientHead", (byte *)ThrowClientHead}, {"ThrowHeadACID", (byte *)ThrowHeadACID}, {"ThrowGibACID", (byte *)ThrowGibACID}, {"ThrowHead", (byte *)ThrowHead}, {"ThrowGib", (byte *)ThrowGib}, {"gib_die", (byte *)gib_die}, {"gib_touch", (byte *)gib_touch}, {"gib_think", (byte *)gib_think}, {"ClipGibVelocity", (byte *)ClipGibVelocity}, {"VelocityForDamage", (byte *)VelocityForDamage}, {"SP_func_areaportal", (byte *)SP_func_areaportal}, {"Use_Areaportal", (byte *)Use_Areaportal}, {"G_RunFrame", (byte *)G_RunFrame}, {"ExitLevel", (byte *)ExitLevel}, {"CheckDMRules", (byte *)CheckDMRules}, {"CheckNeedPass", (byte *)CheckNeedPass}, {"EndDMLevel", (byte *)EndDMLevel}, {"CreateTargetChangeLevel", (byte *)CreateTargetChangeLevel}, {"ClientEndServerFrames", (byte *)ClientEndServerFrames}, {"Com_Printf", (byte *)Com_Printf}, {"Sys_Error", (byte *)Sys_Error}, {"GetGameAPI", (byte *)GetGameAPI}, {"ShutdownGame", (byte *)ShutdownGame}, {"SetItemNames", (byte *)SetItemNames}, {"InitItems", (byte *)InitItems}, {"SP_item_foodcube", (byte *)SP_item_foodcube}, {"SP_item_health_mega", (byte *)SP_item_health_mega}, {"SP_item_health_large", (byte *)SP_item_health_large}, {"SP_item_health_small", (byte *)SP_item_health_small}, {"SP_item_health", (byte *)SP_item_health}, {"SpawnItem", (byte *)SpawnItem}, {"PrecacheItem", (byte *)PrecacheItem}, {"droptofloor", (byte *)droptofloor}, {"Use_Item", (byte *)Use_Item}, {"Drop_Item", (byte *)Drop_Item}, {"drop_make_touchable", (byte *)drop_make_touchable}, {"drop_temp_touch", (byte *)drop_temp_touch}, {"Touch_Item", (byte *)Touch_Item}, {"Drop_PowerArmor", (byte *)Drop_PowerArmor}, {"Pickup_PowerArmor", (byte *)Pickup_PowerArmor}, {"Use_PowerArmor", (byte *)Use_PowerArmor}, {"PowerArmorType", (byte *)PowerArmorType}, {"Pickup_Armor", (byte *)Pickup_Armor}, {"ArmorIndex", (byte *)ArmorIndex}, {"Pickup_Health", (byte *)Pickup_Health}, {"MegaHealth_think", (byte *)MegaHealth_think}, {"Drop_Ammo", (byte *)Drop_Ammo}, {"Pickup_Ammo", (byte *)Pickup_Ammo}, {"Add_Ammo", (byte *)Add_Ammo}, {"Pickup_Key", (byte *)Pickup_Key}, {"Use_Silencer", (byte *)Use_Silencer}, {"Use_Invulnerability", (byte *)Use_Invulnerability}, {"Use_Envirosuit", (byte *)Use_Envirosuit}, {"Use_Breather", (byte *)Use_Breather}, {"Use_QuadFire", (byte *)Use_QuadFire}, {"Use_Quad", (byte *)Use_Quad}, {"Pickup_Pack", (byte *)Pickup_Pack}, {"Pickup_Bandolier", (byte *)Pickup_Bandolier}, {"Pickup_AncientHead", (byte *)Pickup_AncientHead}, {"Pickup_Adrenaline", (byte *)Pickup_Adrenaline}, {"Drop_General", (byte *)Drop_General}, {"Pickup_Powerup", (byte *)Pickup_Powerup}, {"SetRespawn", (byte *)SetRespawn}, {"DoRespawn", (byte *)DoRespawn}, {"FindItem", (byte *)FindItem}, {"FindItemByClassname", (byte *)FindItemByClassname}, {"GetItemByIndex", (byte *)GetItemByIndex}, {"SP_object_repair", (byte *)SP_object_repair}, {"object_repair_sparks", (byte *)object_repair_sparks}, {"object_repair_dead", (byte *)object_repair_dead}, {"object_repair_fx", (byte *)object_repair_fx}, {"SP_rotating_light", (byte *)SP_rotating_light}, {"rotating_light_use", (byte *)rotating_light_use}, {"rotating_light_killed", (byte *)rotating_light_killed}, {"rotating_light_alarm", (byte *)rotating_light_alarm}, {"SP_func_killbox", (byte *)SP_func_killbox}, {"use_killbox", (byte *)use_killbox}, {"SP_func_door_secret", (byte *)SP_func_door_secret}, {"door_secret_die", (byte *)door_secret_die}, {"door_secret_blocked", (byte *)door_secret_blocked}, {"door_secret_done", (byte *)door_secret_done}, {"door_secret_move6", (byte *)door_secret_move6}, {"door_secret_move5", (byte *)door_secret_move5}, {"door_secret_move4", (byte *)door_secret_move4}, {"door_secret_move3", (byte *)door_secret_move3}, {"door_secret_move2", (byte *)door_secret_move2}, {"door_secret_move1", (byte *)door_secret_move1}, {"door_secret_use", (byte *)door_secret_use}, {"SP_func_conveyor", (byte *)SP_func_conveyor}, {"func_conveyor_use", (byte *)func_conveyor_use}, {"SP_func_timer", (byte *)SP_func_timer}, {"func_timer_use", (byte *)func_timer_use}, {"func_timer_think", (byte *)func_timer_think}, {"SP_trigger_elevator", (byte *)SP_trigger_elevator}, {"trigger_elevator_init", (byte *)trigger_elevator_init}, {"trigger_elevator_use", (byte *)trigger_elevator_use}, {"SP_func_train", (byte *)SP_func_train}, {"train_use", (byte *)train_use}, {"func_train_find", (byte *)func_train_find}, {"train_resume", (byte *)train_resume}, {"train_next", (byte *)train_next}, {"train_wait", (byte *)train_wait}, {"train_blocked", (byte *)train_blocked}, {"SP_func_water", (byte *)SP_func_water}, {"SP_func_door_rotating", (byte *)SP_func_door_rotating}, {"SP_func_door", (byte *)SP_func_door}, {"door_touch", (byte *)door_touch}, {"door_killed", (byte *)door_killed}, {"door_blocked", (byte *)door_blocked}, {"Think_SpawnDoorTrigger", (byte *)Think_SpawnDoorTrigger}, {"Think_CalcMoveSpeed", (byte *)Think_CalcMoveSpeed}, {"Touch_DoorTrigger", (byte *)Touch_DoorTrigger}, {"door_use", (byte *)door_use}, {"door_go_up", (byte *)door_go_up}, {"door_go_down", (byte *)door_go_down}, {"door_hit_bottom", (byte *)door_hit_bottom}, {"door_hit_top", (byte *)door_hit_top}, {"door_use_areaportals", (byte *)door_use_areaportals}, {"SP_func_button", (byte *)SP_func_button}, {"button_killed", (byte *)button_killed}, {"button_touch", (byte *)button_touch}, {"button_use", (byte *)button_use}, {"button_fire", (byte *)button_fire}, {"button_wait", (byte *)button_wait}, {"button_return", (byte *)button_return}, {"button_done", (byte *)button_done}, {"SP_func_rotating", (byte *)SP_func_rotating}, {"rotating_use", (byte *)rotating_use}, {"rotating_touch", (byte *)rotating_touch}, {"rotating_blocked", (byte *)rotating_blocked}, {"SP_func_plat", (byte *)SP_func_plat}, {"plat_spawn_inside_trigger", (byte *)plat_spawn_inside_trigger}, {"Touch_Plat_Center", (byte *)Touch_Plat_Center}, {"Use_Plat", (byte *)Use_Plat}, {"plat_blocked", (byte *)plat_blocked}, {"plat_go_up", (byte *)plat_go_up}, {"plat_go_down", (byte *)plat_go_down}, {"plat_hit_bottom", (byte *)plat_hit_bottom}, {"plat_hit_top", (byte *)plat_hit_top}, {"Think_AccelMove", (byte *)Think_AccelMove}, {"plat_Accelerate", (byte *)plat_Accelerate}, {"plat_CalcAcceleratedMove", (byte *)plat_CalcAcceleratedMove}, {"AngleMove_Calc", (byte *)AngleMove_Calc}, {"AngleMove_Begin", (byte *)AngleMove_Begin}, {"AngleMove_Final", (byte *)AngleMove_Final}, {"AngleMove_Done", (byte *)AngleMove_Done}, {"Move_Calc", (byte *)Move_Calc}, {"Move_Begin", (byte *)Move_Begin}, {"Move_Final", (byte *)Move_Final}, {"Move_Done", (byte *)Move_Done}, {"T_RadiusDamage", (byte *)T_RadiusDamage}, {"T_Damage", (byte *)T_Damage}, {"M_ReactToDamage", (byte *)M_ReactToDamage}, {"CheckArmor", (byte *)CheckArmor}, {"CheckPowerArmor", (byte *)CheckPowerArmor}, {"SpawnDamage", (byte *)SpawnDamage}, {"Killed", (byte *)Killed}, {"CanDamage", (byte *)CanDamage}, {"ClientCommand", (byte *)ClientCommand}, {"Cmd_PlayerList_f", (byte *)Cmd_PlayerList_f}, {"Cmd_Say_f", (byte *)Cmd_Say_f}, {"Cmd_Wave_f", (byte *)Cmd_Wave_f}, {"Cmd_Players_f", (byte *)Cmd_Players_f}, {"PlayerSort", (byte *)PlayerSort}, {"Cmd_PutAway_f", (byte *)Cmd_PutAway_f}, {"Cmd_Kill_f", (byte *)Cmd_Kill_f}, {"Cmd_InvDrop_f", (byte *)Cmd_InvDrop_f}, {"Cmd_WeapLast_f", (byte *)Cmd_WeapLast_f}, {"Cmd_WeapNext_f", (byte *)Cmd_WeapNext_f}, {"Cmd_WeapPrev_f", (byte *)Cmd_WeapPrev_f}, {"Cmd_InvUse_f", (byte *)Cmd_InvUse_f}, {"Cmd_Inven_f", (byte *)Cmd_Inven_f}, {"Cmd_Help_f", (byte *)Cmd_Help_f}, {"Cmd_Score_f", (byte *)Cmd_Score_f}, {"Cmd_Drop_f", (byte *)Cmd_Drop_f}, {"Cmd_Use_f", (byte *)Cmd_Use_f}, {"Cmd_Noclip_f", (byte *)Cmd_Noclip_f}, {"Cmd_Notarget_f", (byte *)Cmd_Notarget_f}, {"Cmd_God_f", (byte *)Cmd_God_f}, {"Cmd_Give_f", (byte *)Cmd_Give_f}, {"ValidateSelectedItem", (byte *)ValidateSelectedItem}, {"SelectPrevItem", (byte *)SelectPrevItem}, {"SelectNextItem", (byte *)SelectNextItem}, {"OnSameTeam", (byte *)OnSameTeam}, {"GetChaseTarget", (byte *)GetChaseTarget}, {"ChasePrev", (byte *)ChasePrev}, {"ChaseNext", (byte *)ChaseNext}, {"UpdateChaseCam", (byte *)UpdateChaseCam}, {"ai_run", (byte *)ai_run}, {"ai_checkattack", (byte *)ai_checkattack}, {"ai_run_slide", (byte *)ai_run_slide}, {"ai_run_missile", (byte *)ai_run_missile}, {"ai_run_melee", (byte *)ai_run_melee}, {"M_CheckAttack", (byte *)M_CheckAttack}, {"FacingIdeal", (byte *)FacingIdeal}, {"FindTarget", (byte *)FindTarget}, {"FoundTarget", (byte *)FoundTarget}, {"HuntTarget", (byte *)HuntTarget}, {"infront", (byte *)infront}, {"visible", (byte *)visible}, {"range", (byte *)range}, {"ai_turn", (byte *)ai_turn}, {"ai_charge", (byte *)ai_charge}, {"ai_walk", (byte *)ai_walk}, {"ai_stand", (byte *)ai_stand}, {"ai_move", (byte *)ai_move}, {"AI_SetSightClient", (byte *)AI_SetSightClient}, {"wait_and_change_think", (byte *)wait_and_change_think}, {0, 0} xatrix-XATRIX_2_14/src/savegame/tables/gamemmove_decs.h000066400000000000000000000326731477320050300231300ustar00rootroot00000000000000/* * ======================================================================= * * Pointers to every mmove_t in the game.so. * * ======================================================================= */ extern mmove_t tank_move_death ; extern mmove_t tank_move_attack_chain ; extern mmove_t tank_move_attack_post_rocket ; extern mmove_t tank_move_attack_fire_rocket ; extern mmove_t tank_move_attack_pre_rocket ; extern mmove_t tank_move_attack_strike ; extern mmove_t tank_move_attack_post_blast ; extern mmove_t tank_move_reattack_blast ; extern mmove_t tank_move_attack_blast ; extern mmove_t tank_move_pain3 ; extern mmove_t tank_move_pain2 ; extern mmove_t tank_move_pain1 ; extern mmove_t tank_move_stop_run ; extern mmove_t tank_move_run ; extern mmove_t tank_move_start_run ; extern mmove_t tank_move_stop_walk ; extern mmove_t tank_move_walk ; extern mmove_t tank_move_start_walk ; extern mmove_t tank_move_stand ; extern mmove_t supertank_move_end_attack1 ; extern mmove_t supertank_move_attack1 ; extern mmove_t supertank_move_attack2 ; extern mmove_t supertank_move_attack3 ; extern mmove_t supertank_move_attack4 ; extern mmove_t supertank_move_backward ; extern mmove_t supertank_move_death ; extern mmove_t supertank_move_pain1 ; extern mmove_t supertank_move_pain2 ; extern mmove_t supertank_move_pain3 ; extern mmove_t supertank_move_turn_left ; extern mmove_t supertank_move_turn_right ; extern mmove_t supertank_move_forward ; extern mmove_t supertank_move_run ; extern mmove_t supertank_move_stand ; extern mmove_t soldierh_move_death6 ; extern mmove_t soldierh_move_death5 ; extern mmove_t soldierh_move_death4 ; extern mmove_t soldierh_move_death3 ; extern mmove_t soldierh_move_death2 ; extern mmove_t soldierh_move_death1 ; extern mmove_t soldierh_move_duck ; extern mmove_t soldierh_move_attack6 ; extern mmove_t soldierh_move_attack4 ; extern mmove_t soldierh_move_attack3 ; extern mmove_t soldierh_move_attack2 ; extern mmove_t soldierh_move_attack1 ; extern mmove_t soldierh_move_pain4 ; extern mmove_t soldierh_move_pain3 ; extern mmove_t soldierh_move_pain2 ; extern mmove_t soldierh_move_pain1 ; extern mmove_t soldierh_move_run ; extern mmove_t soldierh_move_start_run ; extern mmove_t soldierh_move_walk2 ; extern mmove_t soldierh_move_walk1 ; extern mmove_t soldierh_move_stand3 ; extern mmove_t soldierh_move_stand1 ; extern mmove_t soldier_move_death6 ; extern mmove_t soldier_move_death5 ; extern mmove_t soldier_move_death4 ; extern mmove_t soldier_move_death3 ; extern mmove_t soldier_move_death2 ; extern mmove_t soldier_move_death1 ; extern mmove_t soldier_move_duck ; extern mmove_t soldier_move_attack6 ; extern mmove_t soldier_move_attack4 ; extern mmove_t soldier_move_attack3 ; extern mmove_t soldier_move_attack2 ; extern mmove_t soldier_move_attack1 ; extern mmove_t soldier_move_pain4 ; extern mmove_t soldier_move_pain3 ; extern mmove_t soldier_move_pain2 ; extern mmove_t soldier_move_pain1 ; extern mmove_t soldier_move_run ; extern mmove_t soldier_move_start_run ; extern mmove_t soldier_move_walk2 ; extern mmove_t soldier_move_walk1 ; extern mmove_t soldier_move_stand3 ; extern mmove_t soldier_move_stand1 ; extern mmove_t parasite_move_death ; extern mmove_t parasite_move_break ; extern mmove_t parasite_move_drain ; extern mmove_t parasite_move_pain1 ; extern mmove_t parasite_move_stop_walk ; extern mmove_t parasite_move_start_walk ; extern mmove_t parasite_move_walk ; extern mmove_t parasite_move_stop_run ; extern mmove_t parasite_move_start_run ; extern mmove_t parasite_move_run ; extern mmove_t parasite_move_stand ; extern mmove_t parasite_move_end_fidget ; extern mmove_t parasite_move_fidget ; extern mmove_t parasite_move_start_fidget ; extern mmove_t mutant_move_death2 ; extern mmove_t mutant_move_death1 ; extern mmove_t mutant_move_pain3 ; extern mmove_t mutant_move_pain2 ; extern mmove_t mutant_move_pain1 ; extern mmove_t mutant_move_jump ; extern mmove_t mutant_move_attack ; extern mmove_t mutant_move_run ; extern mmove_t mutant_move_start_walk ; extern mmove_t mutant_move_walk ; extern mmove_t mutant_move_idle ; extern mmove_t mutant_move_stand ; extern mmove_t medic_move_attackCable ; extern mmove_t medic_move_attackBlaster ; extern mmove_t medic_move_attackHyperBlaster ; extern mmove_t medic_move_duck ; extern mmove_t medic_move_death ; extern mmove_t medic_move_pain2 ; extern mmove_t medic_move_pain1 ; extern mmove_t medic_move_run ; extern mmove_t medic_move_walk ; extern mmove_t medic_move_stand ; extern mmove_t insane_move_struggle_cross ; extern mmove_t insane_move_cross ; extern mmove_t insane_move_crawl_death ; extern mmove_t insane_move_crawl_pain ; extern mmove_t insane_move_runcrawl ; extern mmove_t insane_move_crawl ; extern mmove_t insane_move_stand_death ; extern mmove_t insane_move_stand_pain ; extern mmove_t insane_move_run_insane ; extern mmove_t insane_move_walk_insane ; extern mmove_t insane_move_run_normal ; extern mmove_t insane_move_walk_normal ; extern mmove_t insane_move_down ; extern mmove_t insane_move_jumpdown ; extern mmove_t insane_move_downtoup ; extern mmove_t insane_move_uptodown ; extern mmove_t insane_move_stand_insane ; extern mmove_t insane_move_stand_normal ; extern mmove_t infantry_move_attack2 ; extern mmove_t infantry_move_attack1 ; extern mmove_t infantry_move_duck ; extern mmove_t infantry_move_death3 ; extern mmove_t infantry_move_death2 ; extern mmove_t infantry_move_death1 ; extern mmove_t infantry_move_pain2 ; extern mmove_t infantry_move_pain1 ; extern mmove_t infantry_move_run ; extern mmove_t infantry_move_walk ; extern mmove_t infantry_move_fidget ; extern mmove_t infantry_move_stand ; extern mmove_t hover_move_end_attack ; extern mmove_t hover_move_attack1 ; extern mmove_t hover_move_start_attack ; extern mmove_t hover_move_backward ; extern mmove_t hover_move_death1 ; extern mmove_t hover_move_run ; extern mmove_t hover_move_walk ; extern mmove_t hover_move_forward ; extern mmove_t hover_move_land ; extern mmove_t hover_move_pain1 ; extern mmove_t hover_move_pain2 ; extern mmove_t hover_move_pain3 ; extern mmove_t hover_move_takeoff ; extern mmove_t hover_move_stop2 ; extern mmove_t hover_move_stop1 ; extern mmove_t hover_move_stand ; extern mmove_t gunner_move_attack_grenade ; extern mmove_t gunner_move_endfire_chain ; extern mmove_t gunner_move_fire_chain ; extern mmove_t gunner_move_attack_chain ; extern mmove_t gunner_move_duck ; extern mmove_t gunner_move_death ; extern mmove_t gunner_move_pain1 ; extern mmove_t gunner_move_pain2 ; extern mmove_t gunner_move_pain3 ; extern mmove_t gunner_move_runandshoot ; extern mmove_t gunner_move_run ; extern mmove_t gunner_move_walk ; extern mmove_t gunner_move_stand ; extern mmove_t gunner_move_fidget ; extern mmove_t gladiator_move_death ; extern mmove_t gladiator_move_pain_air ; extern mmove_t gladiator_move_pain ; extern mmove_t gladiator_move_attack_gun ; extern mmove_t gladiator_move_attack_melee ; extern mmove_t gladiator_move_run ; extern mmove_t gladiator_move_walk ; extern mmove_t gladiator_move_stand ; extern mmove_t gladb_move_death ; extern mmove_t gladb_move_pain_air ; extern mmove_t gladb_move_pain ; extern mmove_t gladb_move_attack_gun ; extern mmove_t gladb_move_attack_melee ; extern mmove_t gladb_move_run ; extern mmove_t gladb_move_walk ; extern mmove_t gladb_move_stand ; extern mmove_t gekk_move_rduck ; extern mmove_t gekk_move_lduck ; extern mmove_t gekk_move_wdeath ; extern mmove_t gekk_move_death4 ; extern mmove_t gekk_move_death3 ; extern mmove_t gekk_move_death1 ; extern mmove_t gekk_move_pain2 ; extern mmove_t gekk_move_pain1 ; extern mmove_t gekk_move_pain ; extern mmove_t gekk_move_attack ; extern mmove_t gekk_move_leapatk2 ; extern mmove_t gekk_move_leapatk ; extern mmove_t gekk_move_attack2 ; extern mmove_t gekk_move_attack1 ; extern mmove_t gekk_move_spit ; extern mmove_t gekk_move_run_start ; extern mmove_t gekk_move_run ; extern mmove_t gekk_move_walk ; extern mmove_t gekk_move_idle2 ; extern mmove_t gekk_move_idle ; extern mmove_t gekk_move_swim_start ; extern mmove_t gekk_move_swim_loop ; extern mmove_t gekk_move_standunderwater ; extern mmove_t gekk_move_stand ; extern mmove_t flyer_move_loop_melee ; extern mmove_t flyer_move_end_melee ; extern mmove_t flyer_move_start_melee ; extern mmove_t flyer_move_attack2 ; extern mmove_t flyer_move_bankleft ; extern mmove_t flyer_move_bankright ; extern mmove_t flyer_move_defense ; extern mmove_t flyer_move_pain1 ; extern mmove_t flyer_move_pain2 ; extern mmove_t flyer_move_pain3 ; extern mmove_t flyer_move_rollleft ; extern mmove_t flyer_move_rollright ; extern mmove_t flyer_move_stop ; extern mmove_t flyer_move_start ; extern mmove_t flyer_move_run ; extern mmove_t flyer_move_walk ; extern mmove_t flyer_move_stand ; extern mmove_t floater_move_run ; extern mmove_t floater_move_walk ; extern mmove_t floater_move_pain3 ; extern mmove_t floater_move_pain2 ; extern mmove_t floater_move_pain1 ; extern mmove_t floater_move_death ; extern mmove_t floater_move_attack3 ; extern mmove_t floater_move_attack2 ; extern mmove_t floater_move_attack1 ; extern mmove_t floater_move_activate ; extern mmove_t floater_move_stand2 ; extern mmove_t floater_move_stand1 ; extern mmove_t flipper_move_death ; extern mmove_t flipper_move_attack ; extern mmove_t flipper_move_pain1 ; extern mmove_t flipper_move_pain2 ; extern mmove_t flipper_move_start_run ; extern mmove_t flipper_move_walk ; extern mmove_t flipper_move_run_start ; extern mmove_t flipper_move_run_loop ; extern mmove_t flipper_move_stand ; extern mmove_t fixbot_move_weld_end ; extern mmove_t fixbot_move_weld ; extern mmove_t fixbot_move_weld_start ; extern mmove_t fixbot_move_attack2 ; extern mmove_t fixbot_move_laserattack ; extern mmove_t fixbot_move_attack1 ; extern mmove_t fixbot_move_start_attack ; extern mmove_t fixbot_move_backward ; extern mmove_t fixbot_move_death1 ; extern mmove_t fixbot_move_run ; extern mmove_t fixbot_move_walk ; extern mmove_t fixbot_move_forward ; extern mmove_t fixbot_move_land ; extern mmove_t fixbot_move_pain3 ; extern mmove_t fixbot_move_painb ; extern mmove_t fixbot_move_paina ; extern mmove_t fixbot_move_takeoff ; extern mmove_t fixbot_move_turn ; extern mmove_t fixbot_move_roamgoal ; extern mmove_t fixbot_move_pickup ; extern mmove_t fixbot_move_stand2 ; extern mmove_t fixbot_move_stand ; extern mmove_t fixbot_move_landing ; extern mmove_t chick_move_start_slash ; extern mmove_t chick_move_end_slash ; extern mmove_t chick_move_slash ; extern mmove_t chick_move_end_attack1 ; extern mmove_t chick_move_attack1 ; extern mmove_t chick_move_start_attack1 ; extern mmove_t chick_move_duck ; extern mmove_t chick_move_death1 ; extern mmove_t chick_move_death2 ; extern mmove_t chick_move_pain3 ; extern mmove_t chick_move_pain2 ; extern mmove_t chick_move_pain1 ; extern mmove_t chick_move_walk ; extern mmove_t chick_move_run ; extern mmove_t chick_move_start_run ; extern mmove_t chick_move_stand ; extern mmove_t chick_move_fidget ; extern mmove_t brain_move_run ; extern mmove_t brain_move_attack4 ; extern mmove_t brain_move_attack3 ; extern mmove_t brain_move_attack2 ; extern mmove_t brain_move_attack1 ; extern mmove_t brain_move_death1 ; extern mmove_t brain_move_death2 ; extern mmove_t brain_move_duck ; extern mmove_t brain_move_pain1 ; extern mmove_t brain_move_pain2 ; extern mmove_t brain_move_pain3 ; extern mmove_t brain_move_defense ; extern mmove_t brain_move_walk1 ; extern mmove_t brain_move_idle ; extern mmove_t brain_move_stand ; extern mmove_t boss5_move_end_attack1 ; extern mmove_t boss5_move_attack1 ; extern mmove_t boss5_move_attack2 ; extern mmove_t boss5_move_attack3 ; extern mmove_t boss5_move_attack4 ; extern mmove_t boss5_move_backward ; extern mmove_t boss5_move_death ; extern mmove_t boss5_move_pain1 ; extern mmove_t boss5_move_pain2 ; extern mmove_t boss5_move_pain3 ; extern mmove_t boss5_move_turn_left ; extern mmove_t boss5_move_turn_right ; extern mmove_t boss5_move_forward ; extern mmove_t boss5_move_run ; extern mmove_t boss5_move_stand ; extern mmove_t makron_move_attack5 ; extern mmove_t makron_move_attack4 ; extern mmove_t makron_move_attack3 ; extern mmove_t makron_move_sight ; extern mmove_t makron_move_death3 ; extern mmove_t makron_move_death2 ; extern mmove_t makron_move_pain4 ; extern mmove_t makron_move_pain5 ; extern mmove_t makron_move_pain6 ; extern mmove_t makron_move_walk ; extern mmove_t makron_move_run ; extern mmove_t makron_move_stand ; extern mmove_t jorg_move_end_attack1 ; extern mmove_t jorg_move_attack1 ; extern mmove_t jorg_move_start_attack1 ; extern mmove_t jorg_move_attack2 ; extern mmove_t jorg_move_death ; extern mmove_t jorg_move_pain1 ; extern mmove_t jorg_move_pain2 ; extern mmove_t jorg_move_pain3 ; extern mmove_t jorg_move_end_walk ; extern mmove_t jorg_move_walk ; extern mmove_t jorg_move_start_walk ; extern mmove_t jorg_move_run ; extern mmove_t jorg_move_stand ; extern mmove_t boss2_move_death ; extern mmove_t boss2_move_pain_light ; extern mmove_t boss2_move_pain_heavy ; extern mmove_t boss2_move_attack_rocket ; extern mmove_t boss2_move_attack_post_mg ; extern mmove_t boss2_move_attack_mg ; extern mmove_t boss2_move_attack_pre_mg ; extern mmove_t boss2_move_run ; extern mmove_t boss2_move_walk ; extern mmove_t boss2_move_fidget ; extern mmove_t boss2_move_stand ; extern mmove_t berserk_move_death2 ; extern mmove_t berserk_move_death1 ; extern mmove_t berserk_move_pain2 ; extern mmove_t berserk_move_pain1 ; extern mmove_t berserk_move_attack_strike ; extern mmove_t berserk_move_attack_club ; extern mmove_t berserk_move_attack_spike ; extern mmove_t berserk_move_run1 ; extern mmove_t berserk_move_walk ; extern mmove_t berserk_move_stand_fidget ; extern mmove_t berserk_move_stand ; xatrix-XATRIX_2_14/src/savegame/tables/gamemmove_list.h000066400000000000000000000417041477320050300231600ustar00rootroot00000000000000/* * ======================================================================= * * Prototypes for every mmove_t in the game.so. * * ======================================================================= */ {"tank_move_death", &tank_move_death}, {"tank_move_attack_chain", &tank_move_attack_chain}, {"tank_move_attack_post_rocket", &tank_move_attack_post_rocket}, {"tank_move_attack_fire_rocket", &tank_move_attack_fire_rocket}, {"tank_move_attack_pre_rocket", &tank_move_attack_pre_rocket}, {"tank_move_attack_strike", &tank_move_attack_strike}, {"tank_move_attack_post_blast", &tank_move_attack_post_blast}, {"tank_move_reattack_blast", &tank_move_reattack_blast}, {"tank_move_attack_blast", &tank_move_attack_blast}, {"tank_move_pain3", &tank_move_pain3}, {"tank_move_pain2", &tank_move_pain2}, {"tank_move_pain1", &tank_move_pain1}, {"tank_move_stop_run", &tank_move_stop_run}, {"tank_move_run", &tank_move_run}, {"tank_move_start_run", &tank_move_start_run}, {"tank_move_stop_walk", &tank_move_stop_walk}, {"tank_move_walk", &tank_move_walk}, {"tank_move_start_walk", &tank_move_start_walk}, {"tank_move_stand", &tank_move_stand}, {"supertank_move_end_attack1", &supertank_move_end_attack1}, {"supertank_move_attack1", &supertank_move_attack1}, {"supertank_move_attack2", &supertank_move_attack2}, {"supertank_move_attack3", &supertank_move_attack3}, {"supertank_move_attack4", &supertank_move_attack4}, {"supertank_move_backward", &supertank_move_backward}, {"supertank_move_death", &supertank_move_death}, {"supertank_move_pain1", &supertank_move_pain1}, {"supertank_move_pain2", &supertank_move_pain2}, {"supertank_move_pain3", &supertank_move_pain3}, {"supertank_move_turn_left", &supertank_move_turn_left}, {"supertank_move_turn_right", &supertank_move_turn_right}, {"supertank_move_forward", &supertank_move_forward}, {"supertank_move_run", &supertank_move_run}, {"supertank_move_stand", &supertank_move_stand}, {"soldierh_move_death6", &soldierh_move_death6}, {"soldierh_move_death5", &soldierh_move_death5}, {"soldierh_move_death4", &soldierh_move_death4}, {"soldierh_move_death3", &soldierh_move_death3}, {"soldierh_move_death2", &soldierh_move_death2}, {"soldierh_move_death1", &soldierh_move_death1}, {"soldierh_move_duck", &soldierh_move_duck}, {"soldierh_move_attack6", &soldierh_move_attack6}, {"soldierh_move_attack4", &soldierh_move_attack4}, {"soldierh_move_attack3", &soldierh_move_attack3}, {"soldierh_move_attack2", &soldierh_move_attack2}, {"soldierh_move_attack1", &soldierh_move_attack1}, {"soldierh_move_pain4", &soldierh_move_pain4}, {"soldierh_move_pain3", &soldierh_move_pain3}, {"soldierh_move_pain2", &soldierh_move_pain2}, {"soldierh_move_pain1", &soldierh_move_pain1}, {"soldierh_move_run", &soldierh_move_run}, {"soldierh_move_start_run", &soldierh_move_start_run}, {"soldierh_move_walk2", &soldierh_move_walk2}, {"soldierh_move_walk1", &soldierh_move_walk1}, {"soldierh_move_stand3", &soldierh_move_stand3}, {"soldierh_move_stand1", &soldierh_move_stand1}, {"soldier_move_death6", &soldier_move_death6}, {"soldier_move_death5", &soldier_move_death5}, {"soldier_move_death4", &soldier_move_death4}, {"soldier_move_death3", &soldier_move_death3}, {"soldier_move_death2", &soldier_move_death2}, {"soldier_move_death1", &soldier_move_death1}, {"soldier_move_duck", &soldier_move_duck}, {"soldier_move_attack6", &soldier_move_attack6}, {"soldier_move_attack4", &soldier_move_attack4}, {"soldier_move_attack3", &soldier_move_attack3}, {"soldier_move_attack2", &soldier_move_attack2}, {"soldier_move_attack1", &soldier_move_attack1}, {"soldier_move_pain4", &soldier_move_pain4}, {"soldier_move_pain3", &soldier_move_pain3}, {"soldier_move_pain2", &soldier_move_pain2}, {"soldier_move_pain1", &soldier_move_pain1}, {"soldier_move_run", &soldier_move_run}, {"soldier_move_start_run", &soldier_move_start_run}, {"soldier_move_walk2", &soldier_move_walk2}, {"soldier_move_walk1", &soldier_move_walk1}, {"soldier_move_stand3", &soldier_move_stand3}, {"soldier_move_stand1", &soldier_move_stand1}, {"parasite_move_death", ¶site_move_death}, {"parasite_move_break", ¶site_move_break}, {"parasite_move_drain", ¶site_move_drain}, {"parasite_move_pain1", ¶site_move_pain1}, {"parasite_move_stop_walk", ¶site_move_stop_walk}, {"parasite_move_start_walk", ¶site_move_start_walk}, {"parasite_move_walk", ¶site_move_walk}, {"parasite_move_stop_run", ¶site_move_stop_run}, {"parasite_move_start_run", ¶site_move_start_run}, {"parasite_move_run", ¶site_move_run}, {"parasite_move_stand", ¶site_move_stand}, {"parasite_move_end_fidget", ¶site_move_end_fidget}, {"parasite_move_fidget", ¶site_move_fidget}, {"parasite_move_start_fidget", ¶site_move_start_fidget}, {"mutant_move_death2", &mutant_move_death2}, {"mutant_move_death1", &mutant_move_death1}, {"mutant_move_pain3", &mutant_move_pain3}, {"mutant_move_pain2", &mutant_move_pain2}, {"mutant_move_pain1", &mutant_move_pain1}, {"mutant_move_jump", &mutant_move_jump}, {"mutant_move_attack", &mutant_move_attack}, {"mutant_move_run", &mutant_move_run}, {"mutant_move_start_walk", &mutant_move_start_walk}, {"mutant_move_walk", &mutant_move_walk}, {"mutant_move_idle", &mutant_move_idle}, {"mutant_move_stand", &mutant_move_stand}, {"medic_move_attackCable", &medic_move_attackCable}, {"medic_move_attackBlaster", &medic_move_attackBlaster}, {"medic_move_attackHyperBlaster", &medic_move_attackHyperBlaster}, {"medic_move_duck", &medic_move_duck}, {"medic_move_death", &medic_move_death}, {"medic_move_pain2", &medic_move_pain2}, {"medic_move_pain1", &medic_move_pain1}, {"medic_move_run", &medic_move_run}, {"medic_move_walk", &medic_move_walk}, {"medic_move_stand", &medic_move_stand}, {"insane_move_struggle_cross", &insane_move_struggle_cross}, {"insane_move_cross", &insane_move_cross}, {"insane_move_crawl_death", &insane_move_crawl_death}, {"insane_move_crawl_pain", &insane_move_crawl_pain}, {"insane_move_runcrawl", &insane_move_runcrawl}, {"insane_move_crawl", &insane_move_crawl}, {"insane_move_stand_death", &insane_move_stand_death}, {"insane_move_stand_pain", &insane_move_stand_pain}, {"insane_move_run_insane", &insane_move_run_insane}, {"insane_move_walk_insane", &insane_move_walk_insane}, {"insane_move_run_normal", &insane_move_run_normal}, {"insane_move_walk_normal", &insane_move_walk_normal}, {"insane_move_down", &insane_move_down}, {"insane_move_jumpdown", &insane_move_jumpdown}, {"insane_move_downtoup", &insane_move_downtoup}, {"insane_move_uptodown", &insane_move_uptodown}, {"insane_move_stand_insane", &insane_move_stand_insane}, {"insane_move_stand_normal", &insane_move_stand_normal}, {"infantry_move_attack2", &infantry_move_attack2}, {"infantry_move_attack1", &infantry_move_attack1}, {"infantry_move_duck", &infantry_move_duck}, {"infantry_move_death3", &infantry_move_death3}, {"infantry_move_death2", &infantry_move_death2}, {"infantry_move_death1", &infantry_move_death1}, {"infantry_move_pain2", &infantry_move_pain2}, {"infantry_move_pain1", &infantry_move_pain1}, {"infantry_move_run", &infantry_move_run}, {"infantry_move_walk", &infantry_move_walk}, {"infantry_move_fidget", &infantry_move_fidget}, {"infantry_move_stand", &infantry_move_stand}, {"hover_move_end_attack", &hover_move_end_attack}, {"hover_move_attack1", &hover_move_attack1}, {"hover_move_start_attack", &hover_move_start_attack}, {"hover_move_backward", &hover_move_backward}, {"hover_move_death1", &hover_move_death1}, {"hover_move_run", &hover_move_run}, {"hover_move_walk", &hover_move_walk}, {"hover_move_forward", &hover_move_forward}, {"hover_move_land", &hover_move_land}, {"hover_move_pain1", &hover_move_pain1}, {"hover_move_pain2", &hover_move_pain2}, {"hover_move_pain3", &hover_move_pain3}, {"hover_move_takeoff", &hover_move_takeoff}, {"hover_move_stop2", &hover_move_stop2}, {"hover_move_stop1", &hover_move_stop1}, {"hover_move_stand", &hover_move_stand}, {"gunner_move_attack_grenade", &gunner_move_attack_grenade}, {"gunner_move_endfire_chain", &gunner_move_endfire_chain}, {"gunner_move_fire_chain", &gunner_move_fire_chain}, {"gunner_move_attack_chain", &gunner_move_attack_chain}, {"gunner_move_duck", &gunner_move_duck}, {"gunner_move_death", &gunner_move_death}, {"gunner_move_pain1", &gunner_move_pain1}, {"gunner_move_pain2", &gunner_move_pain2}, {"gunner_move_pain3", &gunner_move_pain3}, {"gunner_move_runandshoot", &gunner_move_runandshoot}, {"gunner_move_run", &gunner_move_run}, {"gunner_move_walk", &gunner_move_walk}, {"gunner_move_stand", &gunner_move_stand}, {"gunner_move_fidget", &gunner_move_fidget}, {"gladiator_move_death", &gladiator_move_death}, {"gladiator_move_pain_air", &gladiator_move_pain_air}, {"gladiator_move_pain", &gladiator_move_pain}, {"gladiator_move_attack_gun", &gladiator_move_attack_gun}, {"gladiator_move_attack_melee", &gladiator_move_attack_melee}, {"gladiator_move_run", &gladiator_move_run}, {"gladiator_move_walk", &gladiator_move_walk}, {"gladiator_move_stand", &gladiator_move_stand}, {"gladb_move_death", &gladb_move_death}, {"gladb_move_pain_air", &gladb_move_pain_air}, {"gladb_move_pain", &gladb_move_pain}, {"gladb_move_attack_gun", &gladb_move_attack_gun}, {"gladb_move_attack_melee", &gladb_move_attack_melee}, {"gladb_move_run", &gladb_move_run}, {"gladb_move_walk", &gladb_move_walk}, {"gladb_move_stand", &gladb_move_stand}, {"gekk_move_rduck", &gekk_move_rduck}, {"gekk_move_lduck", &gekk_move_lduck}, {"gekk_move_wdeath", &gekk_move_wdeath}, {"gekk_move_death4", &gekk_move_death4}, {"gekk_move_death3", &gekk_move_death3}, {"gekk_move_death1", &gekk_move_death1}, {"gekk_move_pain2", &gekk_move_pain2}, {"gekk_move_pain1", &gekk_move_pain1}, {"gekk_move_pain", &gekk_move_pain}, {"gekk_move_attack", &gekk_move_attack}, {"gekk_move_leapatk2", &gekk_move_leapatk2}, {"gekk_move_leapatk", &gekk_move_leapatk}, {"gekk_move_attack2", &gekk_move_attack2}, {"gekk_move_attack1", &gekk_move_attack1}, {"gekk_move_spit", &gekk_move_spit}, {"gekk_move_run_start", &gekk_move_run_start}, {"gekk_move_run", &gekk_move_run}, {"gekk_move_walk", &gekk_move_walk}, {"gekk_move_idle2", &gekk_move_idle2}, {"gekk_move_idle", &gekk_move_idle}, {"gekk_move_swim_start", &gekk_move_swim_start}, {"gekk_move_swim_loop", &gekk_move_swim_loop}, {"gekk_move_standunderwater", &gekk_move_standunderwater}, {"gekk_move_stand", &gekk_move_stand}, {"flyer_move_loop_melee", &flyer_move_loop_melee}, {"flyer_move_end_melee", &flyer_move_end_melee}, {"flyer_move_start_melee", &flyer_move_start_melee}, {"flyer_move_attack2", &flyer_move_attack2}, {"flyer_move_bankleft", &flyer_move_bankleft}, {"flyer_move_bankright", &flyer_move_bankright}, {"flyer_move_defense", &flyer_move_defense}, {"flyer_move_pain1", &flyer_move_pain1}, {"flyer_move_pain2", &flyer_move_pain2}, {"flyer_move_pain3", &flyer_move_pain3}, {"flyer_move_rollleft", &flyer_move_rollleft}, {"flyer_move_rollright", &flyer_move_rollright}, {"flyer_move_stop", &flyer_move_stop}, {"flyer_move_start", &flyer_move_start}, {"flyer_move_run", &flyer_move_run}, {"flyer_move_walk", &flyer_move_walk}, {"flyer_move_stand", &flyer_move_stand}, {"floater_move_run", &floater_move_run}, {"floater_move_walk", &floater_move_walk}, {"floater_move_pain3", &floater_move_pain3}, {"floater_move_pain2", &floater_move_pain2}, {"floater_move_pain1", &floater_move_pain1}, {"floater_move_death", &floater_move_death}, {"floater_move_attack3", &floater_move_attack3}, {"floater_move_attack2", &floater_move_attack2}, {"floater_move_attack1", &floater_move_attack1}, {"floater_move_activate", &floater_move_activate}, {"floater_move_stand2", &floater_move_stand2}, {"floater_move_stand1", &floater_move_stand1}, {"flipper_move_death", &flipper_move_death}, {"flipper_move_attack", &flipper_move_attack}, {"flipper_move_pain1", &flipper_move_pain1}, {"flipper_move_pain2", &flipper_move_pain2}, {"flipper_move_start_run", &flipper_move_start_run}, {"flipper_move_walk", &flipper_move_walk}, {"flipper_move_run_start", &flipper_move_run_start}, {"flipper_move_run_loop", &flipper_move_run_loop}, {"flipper_move_stand", &flipper_move_stand}, {"fixbot_move_weld_end", &fixbot_move_weld_end}, {"fixbot_move_weld", &fixbot_move_weld}, {"fixbot_move_weld_start", &fixbot_move_weld_start}, {"fixbot_move_attack2", &fixbot_move_attack2}, {"fixbot_move_laserattack", &fixbot_move_laserattack}, {"fixbot_move_attack1", &fixbot_move_attack1}, {"fixbot_move_start_attack", &fixbot_move_start_attack}, {"fixbot_move_backward", &fixbot_move_backward}, {"fixbot_move_death1", &fixbot_move_death1}, {"fixbot_move_run", &fixbot_move_run}, {"fixbot_move_walk", &fixbot_move_walk}, {"fixbot_move_forward", &fixbot_move_forward}, {"fixbot_move_land", &fixbot_move_land}, {"fixbot_move_pain3", &fixbot_move_pain3}, {"fixbot_move_painb", &fixbot_move_painb}, {"fixbot_move_paina", &fixbot_move_paina}, {"fixbot_move_takeoff", &fixbot_move_takeoff}, {"fixbot_move_turn", &fixbot_move_turn}, {"fixbot_move_roamgoal", &fixbot_move_roamgoal}, {"fixbot_move_pickup", &fixbot_move_pickup}, {"fixbot_move_stand2", &fixbot_move_stand2}, {"fixbot_move_stand", &fixbot_move_stand}, {"fixbot_move_landing", &fixbot_move_landing}, {"chick_move_start_slash", &chick_move_start_slash}, {"chick_move_end_slash", &chick_move_end_slash}, {"chick_move_slash", &chick_move_slash}, {"chick_move_end_attack1", &chick_move_end_attack1}, {"chick_move_attack1", &chick_move_attack1}, {"chick_move_start_attack1", &chick_move_start_attack1}, {"chick_move_duck", &chick_move_duck}, {"chick_move_death1", &chick_move_death1}, {"chick_move_death2", &chick_move_death2}, {"chick_move_pain3", &chick_move_pain3}, {"chick_move_pain2", &chick_move_pain2}, {"chick_move_pain1", &chick_move_pain1}, {"chick_move_walk", &chick_move_walk}, {"chick_move_run", &chick_move_run}, {"chick_move_start_run", &chick_move_start_run}, {"chick_move_stand", &chick_move_stand}, {"chick_move_fidget", &chick_move_fidget}, {"brain_move_run", &brain_move_run}, {"brain_move_attack4", &brain_move_attack4}, {"brain_move_attack3", &brain_move_attack3}, {"brain_move_attack2", &brain_move_attack2}, {"brain_move_attack1", &brain_move_attack1}, {"brain_move_death1", &brain_move_death1}, {"brain_move_death2", &brain_move_death2}, {"brain_move_duck", &brain_move_duck}, {"brain_move_pain1", &brain_move_pain1}, {"brain_move_pain2", &brain_move_pain2}, {"brain_move_pain3", &brain_move_pain3}, {"brain_move_defense", &brain_move_defense}, {"brain_move_walk1", &brain_move_walk1}, {"brain_move_idle", &brain_move_idle}, {"brain_move_stand", &brain_move_stand}, {"boss5_move_end_attack1", &boss5_move_end_attack1}, {"boss5_move_attack1", &boss5_move_attack1}, {"boss5_move_attack2", &boss5_move_attack2}, {"boss5_move_attack3", &boss5_move_attack3}, {"boss5_move_attack4", &boss5_move_attack4}, {"boss5_move_backward", &boss5_move_backward}, {"boss5_move_death", &boss5_move_death}, {"boss5_move_pain1", &boss5_move_pain1}, {"boss5_move_pain2", &boss5_move_pain2}, {"boss5_move_pain3", &boss5_move_pain3}, {"boss5_move_turn_left", &boss5_move_turn_left}, {"boss5_move_turn_right", &boss5_move_turn_right}, {"boss5_move_forward", &boss5_move_forward}, {"boss5_move_run", &boss5_move_run}, {"boss5_move_stand", &boss5_move_stand}, {"makron_move_attack5", &makron_move_attack5}, {"makron_move_attack4", &makron_move_attack4}, {"makron_move_attack3", &makron_move_attack3}, {"makron_move_sight", &makron_move_sight}, {"makron_move_death3", &makron_move_death3}, {"makron_move_death2", &makron_move_death2}, {"makron_move_pain4", &makron_move_pain4}, {"makron_move_pain5", &makron_move_pain5}, {"makron_move_pain6", &makron_move_pain6}, {"makron_move_walk", &makron_move_walk}, {"makron_move_run", &makron_move_run}, {"makron_move_stand", &makron_move_stand}, {"jorg_move_end_attack1", &jorg_move_end_attack1}, {"jorg_move_attack1", &jorg_move_attack1}, {"jorg_move_start_attack1", &jorg_move_start_attack1}, {"jorg_move_attack2", &jorg_move_attack2}, {"jorg_move_death", &jorg_move_death}, {"jorg_move_pain1", &jorg_move_pain1}, {"jorg_move_pain2", &jorg_move_pain2}, {"jorg_move_pain3", &jorg_move_pain3}, {"jorg_move_end_walk", &jorg_move_end_walk}, {"jorg_move_walk", &jorg_move_walk}, {"jorg_move_start_walk", &jorg_move_start_walk}, {"jorg_move_run", &jorg_move_run}, {"jorg_move_stand", &jorg_move_stand}, {"boss2_move_death", &boss2_move_death}, {"boss2_move_pain_light", &boss2_move_pain_light}, {"boss2_move_pain_heavy", &boss2_move_pain_heavy}, {"boss2_move_attack_rocket", &boss2_move_attack_rocket}, {"boss2_move_attack_post_mg", &boss2_move_attack_post_mg}, {"boss2_move_attack_mg", &boss2_move_attack_mg}, {"boss2_move_attack_pre_mg", &boss2_move_attack_pre_mg}, {"boss2_move_run", &boss2_move_run}, {"boss2_move_walk", &boss2_move_walk}, {"boss2_move_fidget", &boss2_move_fidget}, {"boss2_move_stand", &boss2_move_stand}, {"berserk_move_death2", &berserk_move_death2}, {"berserk_move_death1", &berserk_move_death1}, {"berserk_move_pain2", &berserk_move_pain2}, {"berserk_move_pain1", &berserk_move_pain1}, {"berserk_move_attack_strike", &berserk_move_attack_strike}, {"berserk_move_attack_club", &berserk_move_attack_club}, {"berserk_move_attack_spike", &berserk_move_attack_spike}, {"berserk_move_run1", &berserk_move_run1}, {"berserk_move_walk", &berserk_move_walk}, {"berserk_move_stand_fidget", &berserk_move_stand_fidget}, {"berserk_move_stand", &berserk_move_stand}, {0, 0} xatrix-XATRIX_2_14/src/savegame/tables/levelfields.h000066400000000000000000000007121477320050300224400ustar00rootroot00000000000000/* * ======================================================================= * * Fields inside a level to be saved. * * ======================================================================= */ {"changemap", LLOFS(changemap), F_LSTRING}, {"sight_client", LLOFS(sight_client), F_EDICT}, {"sight_entity", LLOFS(sight_entity), F_EDICT}, {"sound_entity", LLOFS(sound_entity), F_EDICT}, {"sound2_entity", LLOFS(sound2_entity), F_EDICT}, {NULL, 0, F_INT} xatrix-XATRIX_2_14/src/shared/000077500000000000000000000000001477320050300161755ustar00rootroot00000000000000xatrix-XATRIX_2_14/src/shared/flash.c000066400000000000000000000305661477320050300174500ustar00rootroot00000000000000/* * ======================================================================= * * Muzzle flash posititions. * * ======================================================================= */ #include "../header/shared.h" vec3_t monster_flash_offset[] = { /* flash 0 is not used */ {0.0, 0.0, 0.0}, /* MZ2_TANK_BLASTER_1 1 */ {20.7, -18.5, 28.7}, /* MZ2_TANK_BLASTER_2 2 */ {16.6, -21.5, 30.1}, /* MZ2_TANK_BLASTER_3 3 */ {11.8, -23.9, 32.1}, /* MZ2_TANK_MACHINEGUN_1 4 */ {22.9, -0.7, 25.3}, /* MZ2_TANK_MACHINEGUN_2 5 */ {22.2, 6.2, 22.3}, /* MZ2_TANK_MACHINEGUN_3 6 */ {19.4, 13.1, 18.6}, /* MZ2_TANK_MACHINEGUN_4 7 */ {19.4, 18.8, 18.6}, /* MZ2_TANK_MACHINEGUN_5 8 */ {17.9, 25.0, 18.6}, /* MZ2_TANK_MACHINEGUN_6 9 */ {14.1, 30.5, 20.6}, /* MZ2_TANK_MACHINEGUN_7 10 */ {9.3, 35.3, 22.1}, /* MZ2_TANK_MACHINEGUN_8 11 */ {4.7, 38.4, 22.1}, /* MZ2_TANK_MACHINEGUN_9 12 */ {-1.1, 40.4, 24.1}, /* MZ2_TANK_MACHINEGUN_10 13 */ {-6.5, 41.2, 24.1}, /* MZ2_TANK_MACHINEGUN_11 14 */ {3.2, 40.1, 24.7}, /* MZ2_TANK_MACHINEGUN_12 15 */ {11.7, 36.7, 26.0}, /* MZ2_TANK_MACHINEGUN_13 16 */ {18.9, 31.3, 26.0}, /* MZ2_TANK_MACHINEGUN_14 17 */ {24.4, 24.4, 26.4}, /* MZ2_TANK_MACHINEGUN_15 18 */ {27.1, 17.1, 27.2}, /* MZ2_TANK_MACHINEGUN_16 19 */ {28.5, 9.1, 28.0}, /* MZ2_TANK_MACHINEGUN_17 20 */ {27.1, 2.2, 28.0}, /* MZ2_TANK_MACHINEGUN_18 21 */ {24.9, -2.8, 28.0}, /* MZ2_TANK_MACHINEGUN_19 22 */ {21.6, -7.0, 26.4}, /* MZ2_TANK_ROCKET_1 23 */ {6.2, 29.1, 49.1}, /* MZ2_TANK_ROCKET_2 24 */ {6.9, 23.8, 49.1}, /* MZ2_TANK_ROCKET_3 25 */ {8.3, 17.8, 49.5}, /* MZ2_INFANTRY_MACHINEGUN_1 26 */ {26.6, 7.1, 13.1}, /* MZ2_INFANTRY_MACHINEGUN_2 27 */ {18.2, 7.5, 15.4}, /* MZ2_INFANTRY_MACHINEGUN_3 28 */ {17.2, 10.3, 17.9}, /* MZ2_INFANTRY_MACHINEGUN_4 29 */ {17.0, 12.8, 20.1}, /* MZ2_INFANTRY_MACHINEGUN_5 30 */ {15.1, 14.1, 21.8}, /* MZ2_INFANTRY_MACHINEGUN_6 31 */ {11.8, 17.2, 23.1}, /* MZ2_INFANTRY_MACHINEGUN_7 32 */ {11.4, 20.2, 21.0}, /* MZ2_INFANTRY_MACHINEGUN_8 33 */ {9.0, 23.0, 18.9}, /* MZ2_INFANTRY_MACHINEGUN_9 34 */ {13.9, 18.6, 17.7}, /* MZ2_INFANTRY_MACHINEGUN_10 35 */ {15.4, 15.6, 15.8}, /* MZ2_INFANTRY_MACHINEGUN_11 36 */ {10.2, 15.2, 25.1}, /* MZ2_INFANTRY_MACHINEGUN_12 37 */ {-1.9, 15.1, 28.2}, /* MZ2_INFANTRY_MACHINEGUN_13 38 */ {-12.4, 13.0, 20.2}, /* MZ2_SOLDIER_BLASTER_1 39 */ {10.6 * 1.2, 7.7 * 1.2, 7.8 * 1.2}, /* MZ2_SOLDIER_BLASTER_2 40 */ {21.1 * 1.2, 3.6 * 1.2, 19.0 * 1.2}, /* MZ2_SOLDIER_SHOTGUN_1 41 */ {10.6 * 1.2, 7.7 * 1.2, 7.8 * 1.2}, /* MZ2_SOLDIER_SHOTGUN_2 42 */ {21.1 * 1.2, 3.6 * 1.2, 19.0 * 1.2}, /* MZ2_SOLDIER_MACHINEGUN_1 43 */ {10.6 * 1.2, 7.7 * 1.2, 7.8 * 1.2}, /* MZ2_SOLDIER_MACHINEGUN_2 44 */ {21.1 * 1.2, 3.6 * 1.2, 19.0 * 1.2}, /* MZ2_GUNNER_MACHINEGUN_1 45 */ {30.1 * 1.15, 3.9 * 1.15, 19.6 * 1.15}, /* MZ2_GUNNER_MACHINEGUN_2 46 */ {29.1 * 1.15, 2.5 * 1.15, 20.7 * 1.15}, /* MZ2_GUNNER_MACHINEGUN_3 47 */ {28.2 * 1.15, 2.5 * 1.15, 22.2 * 1.15}, /* MZ2_GUNNER_MACHINEGUN_4 48 */ {28.2 * 1.15, 3.6 * 1.15, 22.0 * 1.15}, /* MZ2_GUNNER_MACHINEGUN_5 49 */ {26.9 * 1.15, 2.0 * 1.15, 23.4 * 1.15}, /* MZ2_GUNNER_MACHINEGUN_6 50 */ {26.5 * 1.15, 0.6 * 1.15, 20.8 * 1.15}, /* MZ2_GUNNER_MACHINEGUN_7 51 */ {26.9 * 1.15, 0.5 * 1.15, 21.5 * 1.15}, /* MZ2_GUNNER_MACHINEGUN_8 52 */ {29.0 * 1.15, 2.4 * 1.15, 19.5 * 1.15}, /* MZ2_GUNNER_GRENADE_1 53 */ {4.6 * 1.15, -16.8 * 1.15, 7.3 * 1.15}, /* MZ2_GUNNER_GRENADE_2 54 */ {4.6 * 1.15, -16.8 * 1.15, 7.3 * 1.15}, /* MZ2_GUNNER_GRENADE_3 55 */ {4.6 * 1.15, -16.8 * 1.15, 7.3 * 1.15}, /* MZ2_GUNNER_GRENADE_4 56 */ {4.6 * 1.15, -16.8 * 1.15, 7.3 * 1.15}, /* MZ2_CHICK_ROCKET_1 57 */ {24.8, -9.0, 39.0}, /* MZ2_FLYER_BLASTER_1 58 */ {12.1, 13.4, -14.5}, /* MZ2_FLYER_BLASTER_2 59 */ {12.1, -7.4, -14.5}, /* MZ2_MEDIC_BLASTER_1 60 */ {12.1, 5.4, 16.5}, /* MZ2_GLADIATOR_RAILGUN_1 61 */ {30.0, 18.0, 28.0}, /* MZ2_HOVER_BLASTER_1 62 */ {32.5, -0.8, 10.0}, /* MZ2_ACTOR_MACHINEGUN_1 63 */ {18.4, 7.4, 9.6}, /* MZ2_SUPERTANK_MACHINEGUN_1 64 */ {30.0, 30.0, 88.5}, /* MZ2_SUPERTANK_MACHINEGUN_2 65 */ {30.0, 30.0, 88.5}, /* MZ2_SUPERTANK_MACHINEGUN_3 66 */ {30.0, 30.0, 88.5}, /* MZ2_SUPERTANK_MACHINEGUN_4 67 */ {30.0, 30.0, 88.5}, /* MZ2_SUPERTANK_MACHINEGUN_5 68 */ {30.0, 30.0, 88.5}, /* MZ2_SUPERTANK_MACHINEGUN_6 69 */ {30.0, 30.0, 88.5}, /* MZ2_SUPERTANK_ROCKET_1 70 */ {16.0, -22.5, 91.2}, /* MZ2_SUPERTANK_ROCKET_2 71 */ {16.0, -33.4, 86.7}, /* MZ2_SUPERTANK_ROCKET_3 72 */ {16.0, -42.8, 83.3}, /* MZ2_BOSS2_MACHINEGUN_L1 73 */ {32, -40, 70}, /* MZ2_BOSS2_MACHINEGUN_L2 74 */ {32, -40, 70}, /* MZ2_BOSS2_MACHINEGUN_L3 75 */ {32, -40, 70}, /* MZ2_BOSS2_MACHINEGUN_L4 76 */ {32, -40, 70}, /* MZ2_BOSS2_MACHINEGUN_L5 77 */ {32, -40, 70}, /* MZ2_BOSS2_ROCKET_1 78 */ {22.0, 16.0, 10.0}, /* MZ2_BOSS2_ROCKET_2 79 */ {22.0, 8.0, 10.0}, /* MZ2_BOSS2_ROCKET_3 80 */ {22.0, -8.0, 10.0}, /* MZ2_BOSS2_ROCKET_4 81 */ {22.0, -16.0, 10.0}, /* MZ2_FLOAT_BLASTER_1 82 */ {32.5, -0.8, 10}, /* MZ2_SOLDIER_BLASTER_3 83 */ {20.8 * 1.2, 10.1 * 1.2, -2.7 * 1.2}, /* MZ2_SOLDIER_SHOTGUN_3 84 */ {20.8 * 1.2, 10.1 * 1.2, -2.7 * 1.2}, /* MZ2_SOLDIER_MACHINEGUN_3 85 */ {20.8 * 1.2, 10.1 * 1.2, -2.7 * 1.2}, /* MZ2_SOLDIER_BLASTER_4 86 */ {7.6 * 1.2, 9.3 * 1.2, 0.8 * 1.2}, /* MZ2_SOLDIER_SHOTGUN_4 87 */ {7.6 * 1.2, 9.3 * 1.2, 0.8 * 1.2}, /* MZ2_SOLDIER_MACHINEGUN_4 88 */ {7.6 * 1.2, 9.3 * 1.2, 0.8 * 1.2}, /* MZ2_SOLDIER_BLASTER_5 89 */ {30.5 * 1.2, 9.9 * 1.2, -18.7 * 1.2}, /* MZ2_SOLDIER_SHOTGUN_5 90 */ {30.5 * 1.2, 9.9 * 1.2, -18.7 * 1.2}, /* MZ2_SOLDIER_MACHINEGUN_5 91 */ {30.5 * 1.2, 9.9 * 1.2, -18.7 * 1.2}, /* MZ2_SOLDIER_BLASTER_6 92 */ {27.6 * 1.2, 3.4 * 1.2, -10.4 * 1.2}, /* MZ2_SOLDIER_SHOTGUN_6 93 */ {27.6 * 1.2, 3.4 * 1.2, -10.4 * 1.2}, /* MZ2_SOLDIER_MACHINEGUN_6 94 */ {27.6 * 1.2, 3.4 * 1.2, -10.4 * 1.2}, /* MZ2_SOLDIER_BLASTER_7 95 */ {28.9 * 1.2, 4.6 * 1.2, -8.1 * 1.2}, /* MZ2_SOLDIER_SHOTGUN_7 96 */ {28.9 * 1.2, 4.6 * 1.2, -8.1 * 1.2}, /* MZ2_SOLDIER_MACHINEGUN_7 97 */ {28.9 * 1.2, 4.6 * 1.2, -8.1 * 1.2}, /* MZ2_SOLDIER_BLASTER_8 98 */ {31.5 * 1.2, 9.6 * 1.2, 10.1 * 1.2}, /* MZ2_SOLDIER_SHOTGUN_8 99 */ {34.5 * 1.2, 9.6 * 1.2, 6.1 * 1.2}, /* MZ2_SOLDIER_MACHINEGUN_8 100 */ {34.5 * 1.2, 9.6 * 1.2, 6.1 * 1.2}, /* MZ2_MAKRON_BFG 101 */ {17, -19.5, 62.9}, /* MZ2_MAKRON_BLASTER_1 102 */ {-3.6, -24.1, 59.5}, /* MZ2_MAKRON_BLASTER_2 103 */ {-1.6, -19.3, 59.5}, /* MZ2_MAKRON_BLASTER_3 104 */ {-0.1, -14.4, 59.5}, /* MZ2_MAKRON_BLASTER_4 105 */ {2.0, -7.6, 59.5}, /* MZ2_MAKRON_BLASTER_5 106 */ {3.4, 1.3, 59.5}, /* MZ2_MAKRON_BLASTER_6 107 */ {3.7, 11.1, 59.5}, /* MZ2_MAKRON_BLASTER_7 108 */ {-0.3, 22.3, 59.5}, /* MZ2_MAKRON_BLASTER_8 109 */ {-6, 33, 59.5}, /* MZ2_MAKRON_BLASTER_9 110 */ {-9.3, 36.4, 59.5}, /* MZ2_MAKRON_BLASTER_10 111 */ {-7, 35, 59.5}, /* MZ2_MAKRON_BLASTER_11 112 */ {-2.1, 29, 59.5}, /* MZ2_MAKRON_BLASTER_12 113 */ {3.9, 17.3, 59.5}, /* MZ2_MAKRON_BLASTER_13 114 */ {6.1, 5.8, 59.5}, /* MZ2_MAKRON_BLASTER_14 115 */ {5.9, -4.4, 59.5}, /* MZ2_MAKRON_BLASTER_15 116 */ {4.2, -14.1, 59.5}, /* MZ2_MAKRON_BLASTER_16 117 */ {2.4, -18.8, 59.5}, /* MZ2_MAKRON_BLASTER_17 118 */ {-1.8, -25.5, 59.5}, /* MZ2_MAKRON_RAILGUN_1 119 */ {-17.3, 7.8, 72.4}, /* MZ2_JORG_MACHINEGUN_L1 120 */ {78.5, -47.1, 96}, /* MZ2_JORG_MACHINEGUN_L2 121 */ {78.5, -47.1, 96}, /* MZ2_JORG_MACHINEGUN_L3 122 */ {78.5, -47.1, 96}, /* MZ2_JORG_MACHINEGUN_L4 123 */ {78.5, -47.1, 96}, /* MZ2_JORG_MACHINEGUN_L5 124 */ {78.5, -47.1, 96}, /* MZ2_JORG_MACHINEGUN_L6 125 */ {78.5, -47.1, 96}, /* MZ2_JORG_MACHINEGUN_R1 126 */ {78.5, 46.7, 96}, /* MZ2_JORG_MACHINEGUN_R2 127 */ {78.5, 46.7, 96}, /* MZ2_JORG_MACHINEGUN_R3 128 */ {78.5, 46.7, 96}, /* MZ2_JORG_MACHINEGUN_R4 129 */ {78.5, 46.7, 96}, /* MZ2_JORG_MACHINEGUN_R5 130 */ {78.5, 46.7, 96}, /* MZ2_JORG_MACHINEGUN_R6 131 */ {78.5, 46.7, 96}, /* MZ2_JORG_BFG_1 132 */ {6.3, -9, 111.2}, /* MZ2_BOSS2_MACHINEGUN_R1 73 */ {32, 40, 70}, /* MZ2_BOSS2_MACHINEGUN_R2 74 */ {32, 40, 70}, /* MZ2_BOSS2_MACHINEGUN_R3 75 */ {32, 40, 70}, /* MZ2_BOSS2_MACHINEGUN_R4 76 */ {32, 40, 70}, /* MZ2_BOSS2_MACHINEGUN_R5 77 */ {32, 40, 70}, /* MZ2_CARRIER_MACHINEGUN_L1 */ {56, -32, 32}, /* MZ2_CARRIER_MACHINEGUN_R1 */ {56, 32, 32}, /* MZ2_CARRIER_GRENADE */ {42, 24, 50}, /* MZ2_TURRET_MACHINEGUN 141 */ {16, 0, 0}, /* MZ2_TURRET_ROCKET 142 */ {16, 0, 0}, /* MZ2_TURRET_BLASTER 143 */ {16, 0, 0}, /* MZ2_STALKER_BLASTER 144 */ {24, 0, 6}, /* MZ2_DAEDALUS_BLASTER 145 */ {32.5, -0.8, 10.0}, /* MZ2_MEDIC_BLASTER_2 146 */ {12.1, 5.4, 16.5}, /* MZ2_CARRIER_RAILGUN 147 */ {32, 0, 6}, /* MZ2_WIDOW_DISRUPTOR 148 */ {57.72, 14.50, 88.81}, /* MZ2_WIDOW_BLASTER 149 */ {56, 32, 32}, /* MZ2_WIDOW_RAIL 150 */ {62, -20, 84}, /* MZ2_WIDOW_PLASMABEAM 151 */ {32, 0, 6}, /* MZ2_CARRIER_MACHINEGUN_L2 152 */ {61, -32, 12}, /* MZ2_CARRIER_MACHINEGUN_R2 153 */ {61, 32, 12}, /* MZ2_WIDOW_RAIL_LEFT 154 */ {17, -62, 91}, /* MZ2_WIDOW_RAIL_RIGHT 155 */ {68, 12, 86}, /* MZ2_WIDOW_BLASTER_SWEEP1 156 */ {47.5, 56, 89}, /* MZ2_WIDOW_BLASTER_SWEEP2 157 */ {54, 52, 91}, /* MZ2_WIDOW_BLASTER_SWEEP3 158 */ {58, 40, 91}, /* MZ2_WIDOW_BLASTER_SWEEP4 159 */ {68, 30, 88}, /* MZ2_WIDOW_BLASTER_SWEEP5 160 */ {74, 20, 88}, /* MZ2_WIDOW_BLASTER_SWEEP6 161 */ {73, 11, 87}, /* MZ2_WIDOW_BLASTER_SWEEP7 162 */ {73, 3, 87}, /* MZ2_WIDOW_BLASTER_SWEEP8 163 */ {70, -12, 87}, /* MZ2_WIDOW_BLASTER_SWEEP9 164 */ {67, -20, 90}, /* MZ2_WIDOW_BLASTER_100 165 */ {-20, 76, 90}, /* MZ2_WIDOW_BLASTER_90 166 */ {-8, 74, 90}, /* MZ2_WIDOW_BLASTER_80 167 */ {0, 72, 90}, /* MZ2_WIDOW_BLASTER_70 168 d06 */ {10, 71, 89}, /* MZ2_WIDOW_BLASTER_60 169 d07 */ {23, 70, 87}, /* MZ2_WIDOW_BLASTER_50 170 d08 */ {32, 64, 85}, /* MZ2_WIDOW_BLASTER_40 171 */ {40, 58, 84}, /* MZ2_WIDOW_BLASTER_30 172 d10 */ {48, 50, 83}, /* MZ2_WIDOW_BLASTER_20 173 */ {54, 42, 82}, /* MZ2_WIDOW_BLASTER_10 174 d12 */ {56, 34, 82}, /* MZ2_WIDOW_BLASTER_0 175 */ {58, 26, 82}, /* MZ2_WIDOW_BLASTER_10L 176 d14 */ {60, 16, 82}, /* MZ2_WIDOW_BLASTER_20L 177 */ {59, 6, 81}, /* MZ2_WIDOW_BLASTER_30L 178 d16 */ {58, -2, 80}, /* MZ2_WIDOW_BLASTER_40L 179 */ {57, -10, 79}, /* MZ2_WIDOW_BLASTER_50L 180 d18 */ {54, -18, 78}, /* MZ2_WIDOW_BLASTER_60L 181 */ {42, -32, 80}, /* MZ2_WIDOW_BLASTER_70L 182 d20 */ {36, -40, 78}, /* MZ2_WIDOW_RUN_1 183 */ {68.4, 10.88, 82.08}, /* MZ2_WIDOW_RUN_2 184 */ {68.51, 8.64, 85.14}, /* MZ2_WIDOW_RUN_3 185 */ {68.66, 6.38, 88.78}, /* MZ2_WIDOW_RUN_4 186 */ {68.73, 5.1, 84.47}, /* MZ2_WIDOW_RUN_5 187 */ {68.82, 4.79, 80.52}, /* MZ2_WIDOW_RUN_6 188 */ {68.77, 6.11, 85.37}, /* MZ2_WIDOW_RUN_7 189 */ {68.67, 7.99, 90.24}, /* MZ2_WIDOW_RUN_8 190 */ {68.55, 9.54, 87.36}, /* MZ2_CARRIER_ROCKET_1 191 */ {0, 0, -5}, /* MZ2_CARRIER_ROCKET_2 192 */ {0, 0, -5}, /* MZ2_CARRIER_ROCKET_3 193 */ {0, 0, -5}, /* MZ2_CARRIER_ROCKET_4 194 */ {0, 0, -5}, /* MZ2_WIDOW2_BEAMER_1 195 */ /* { 72.13, -17.63, 93.77 }, */ {69.00, -17.63, 93.77}, /* MZ2_WIDOW2_BEAMER_2 196 */ /* { 71.46, -17.08, 89.82 }, */ {69.00, -17.08, 89.82}, /* MZ2_WIDOW2_BEAMER_3 197 */ /* { 71.47, -18.40, 90.70 }, */ {69.00, -18.40, 90.70}, /* MZ2_WIDOW2_BEAMER_4 198 */ /* { 71.96, -18.34, 94.32 }, */ {69.00, -18.34, 94.32}, /* MZ2_WIDOW2_BEAMER_5 199 */ /* { 72.25, -18.30, 97.98 }, */ {69.00, -18.30, 97.98}, /* MZ2_WIDOW2_BEAM_SWEEP_1 200 */ {45.04, -59.02, 92.24}, /* MZ2_WIDOW2_BEAM_SWEEP_2 201 */ {50.68, -54.70, 91.96}, /* MZ2_WIDOW2_BEAM_SWEEP_3 202 */ {56.57, -47.72, 91.65}, /* MZ2_WIDOW2_BEAM_SWEEP_4 203 */ {61.75, -38.75, 91.38}, /* MZ2_WIDOW2_BEAM_SWEEP_5 204 */ {65.55, -28.76, 91.24}, /* MZ2_WIDOW2_BEAM_SWEEP_6 205 */ {67.79, -18.90, 91.22}, /* MZ2_WIDOW2_BEAM_SWEEP_7 206 */ {68.60, -9.52, 91.23}, /* MZ2_WIDOW2_BEAM_SWEEP_8 207 */ {68.08, 0.18, 91.32}, /* MZ2_WIDOW2_BEAM_SWEEP_9 208 */ {66.14, 9.79, 91.44}, /* MZ2_WIDOW2_BEAM_SWEEP_10 209 */ {62.77, 18.91, 91.65}, /* MZ2_WIDOW2_BEAM_SWEEP_11 210 */ {58.29, 27.11, 92.00}, /* end of table */ {0.0, 0.0, 0.0} }; xatrix-XATRIX_2_14/src/shared/rand.c000066400000000000000000000027411477320050300172710ustar00rootroot00000000000000/* * KISS PRNG (c) 2011 Shinobu * * This file was optained from zuttobenkyou.wordpress.com * and modified by the Yamagi Quake II developers. * * LICENSE: Public domain * * ======================================================================= * * KISS PRNG, as devised by Dr. George Marsaglia * * ======================================================================= */ #include #define QSIZE 0x200000 #define CNG (cng = 6906969069ULL * cng + 13579) #define XS (xs ^= (xs << 13), xs ^= (xs >> 17), xs ^= (xs << 43)) #define KISS (B64MWC() + CNG + XS) static uint64_t QARY[QSIZE]; static int j; static uint64_t carry; static uint64_t xs; static uint64_t cng; uint64_t B64MWC(void) { uint64_t t, x; j = (j + 1) & (QSIZE - 1); x = QARY[j]; t = (x << 28) + carry; carry = (x >> 36) - (t < x); return QARY[j] = t - x; } /* * Generate a pseudorandom * integer >0. */ int randk(void) { int r; r = (int)KISS; r = (r < 0) ? (r * -1) : r; return r; } /* * Generate a pseudorandom * signed float between * 0 and 1. */ float frandk(void) { return (randk()&32767)* (1.0/32767); } /* Generate a pseudorandom * float between -1 and 1. */ float crandk(void) { return (randk()&32767)* (2.0/32767) - 1; } /* * Seeds the PRNG */ void randk_seed(void) { uint64_t i; /* Seed QARY[] with CNG+XS: */ for (i = 0; i < QSIZE; i++) { QARY[i] = CNG + XS; } /* Run through several rounds to warm up the state */ for (i = 0; i < 256; i++) { randk(); } } xatrix-XATRIX_2_14/src/shared/shared.c000066400000000000000000000507751477320050300176250ustar00rootroot00000000000000/* * ======================================================================= * * Support functions, linked into client, server, renderer and game. * * ======================================================================= */ #include #include "../header/shared.h" #define DEG2RAD(a) (a * M_PI) / 180.0F vec3_t vec3_origin = {0, 0, 0}; /* ============================================================================ */ void RotatePointAroundVector(vec3_t dst, const vec3_t dir, const vec3_t point, float degrees) { float m[3][3]; float im[3][3]; float zrot[3][3]; float tmpmat[3][3]; float rot[3][3]; int i; vec3_t vr, vup, vf; vf[0] = dir[0]; vf[1] = dir[1]; vf[2] = dir[2]; PerpendicularVector(vr, dir); CrossProduct(vr, vf, vup); m[0][0] = vr[0]; m[1][0] = vr[1]; m[2][0] = vr[2]; m[0][1] = vup[0]; m[1][1] = vup[1]; m[2][1] = vup[2]; m[0][2] = vf[0]; m[1][2] = vf[1]; m[2][2] = vf[2]; memcpy(im, m, sizeof(im)); im[0][1] = m[1][0]; im[0][2] = m[2][0]; im[1][0] = m[0][1]; im[1][2] = m[2][1]; im[2][0] = m[0][2]; im[2][1] = m[1][2]; memset(zrot, 0, sizeof(zrot)); zrot[1][1] = zrot[2][2] = 1.0F; zrot[0][0] = (float)cos(DEG2RAD(degrees)); zrot[0][1] = (float)sin(DEG2RAD(degrees)); zrot[1][0] = (float)-sin(DEG2RAD(degrees)); zrot[1][1] = (float)cos(DEG2RAD(degrees)); R_ConcatRotations(m, zrot, tmpmat); R_ConcatRotations(tmpmat, im, rot); for (i = 0; i < 3; i++) { dst[i] = rot[i][0] * point[0] + rot[i][1] * point[1] + rot[i][2] * point[2]; } } void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up) { float angle; static float sr, sp, sy, cr, cp, cy; angle = angles[YAW] * (M_PI * 2 / 360); sy = (float)sin(angle); cy = (float)cos(angle); angle = angles[PITCH] * (M_PI * 2 / 360); sp = (float)sin(angle); cp = (float)cos(angle); angle = angles[ROLL] * (M_PI * 2 / 360); sr = (float)sin(angle); cr = (float)cos(angle); if (forward) { forward[0] = cp * cy; forward[1] = cp * sy; forward[2] = -sp; } if (right) { right[0] = (-1 * sr * sp * cy + - 1 * cr * -sy); right[1] = (-1 * sr * sp * sy + - 1 * cr * cy); right[2] = -1 * sr * cp; } if (up) { up[0] = (cr * sp * cy + - sr * -sy); up[1] = (cr * sp * sy + - sr * cy); up[2] = cr * cp; } } void AngleVectors2(vec3_t value1, vec3_t angles) { float forward; float yaw, pitch; if ((value1[1] == 0) && (value1[0] == 0)) { yaw = 0; if (value1[2] > 0) { pitch = 90; } else { pitch = 270; } } else { if (value1[0]) { yaw = ((float)atan2(value1[1], value1[0]) * 180 / M_PI); } else if (value1[1] > 0) { yaw = 90; } else { yaw = 270; } if (yaw < 0) { yaw += 360; } forward = (float)sqrt(value1[0] * value1[0] + value1[1] * value1[1]); pitch = ((float)atan2(value1[2], forward) * 180 / M_PI); if (pitch < 0) { pitch += 360; } } angles[PITCH] = -pitch; angles[YAW] = yaw; angles[ROLL] = 0; } void ProjectPointOnPlane(vec3_t dst, const vec3_t p, const vec3_t normal) { float d; vec3_t n; float inv_denom; inv_denom = 1.0F / DotProduct(normal, normal); d = DotProduct(normal, p) * inv_denom; n[0] = normal[0] * inv_denom; n[1] = normal[1] * inv_denom; n[2] = normal[2] * inv_denom; dst[0] = p[0] - d * n[0]; dst[1] = p[1] - d * n[1]; dst[2] = p[2] - d * n[2]; } /* assumes "src" is normalized */ void PerpendicularVector(vec3_t dst, const vec3_t src) { int pos; int i; float minelem = 1.0F; vec3_t tempvec; /* find the smallest magnitude axially aligned vector */ for (pos = 0, i = 0; i < 3; i++) { if (fabs(src[i]) < minelem) { pos = i; minelem = (float)fabs(src[i]); } } tempvec[0] = tempvec[1] = tempvec[2] = 0.0F; tempvec[pos] = 1.0F; /* project the point onto the plane defined by src */ ProjectPointOnPlane(dst, tempvec, src); /* normalize the result */ VectorNormalize(dst); } void R_ConcatRotations(float in1[3][3], float in2[3][3], float out[3][3]) { out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + in1[0][2] * in2[2][0]; out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] + in1[0][2] * in2[2][1]; out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] + in1[0][2] * in2[2][2]; out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] + in1[1][2] * in2[2][0]; out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] + in1[1][2] * in2[2][1]; out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] + in1[1][2] * in2[2][2]; out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] + in1[2][2] * in2[2][0]; out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] + in1[2][2] * in2[2][1]; out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] + in1[2][2] * in2[2][2]; } void R_ConcatTransforms(float in1[3][4], float in2[3][4], float out[3][4]) { out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + in1[0][2] * in2[2][0]; out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] + in1[0][2] * in2[2][1]; out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] + in1[0][2] * in2[2][2]; out[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] + in1[0][2] * in2[2][3] + in1[0][3]; out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] + in1[1][2] * in2[2][0]; out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] + in1[1][2] * in2[2][1]; out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] + in1[1][2] * in2[2][2]; out[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] + in1[1][2] * in2[2][3] + in1[1][3]; out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] + in1[2][2] * in2[2][0]; out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] + in1[2][2] * in2[2][1]; out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] + in1[2][2] * in2[2][2]; out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] + in1[2][2] * in2[2][3] + in1[2][3]; } /* ============================================================================ */ float Q_fabs(float f) { int tmp = *(int *)&f; tmp &= 0x7FFFFFFF; return *(float *)&tmp; } float LerpAngle(float a2, float a1, float frac) { if (a1 - a2 > 180) { a1 -= 360; } if (a1 - a2 < -180) { a1 += 360; } return a2 + frac * (a1 - a2); } float anglemod(float a) { a = (360.0 / 65536) * ((int)(a * (65536 / 360.0)) & 65535); return a; } /* * This is the slow, general version */ int BoxOnPlaneSide2(vec3_t emins, vec3_t emaxs, struct cplane_s *p) { int i; float dist1, dist2; int sides; vec3_t corners[2]; for (i = 0; i < 3; i++) { if (p->normal[i] < 0) { corners[0][i] = emins[i]; corners[1][i] = emaxs[i]; } else { corners[1][i] = emins[i]; corners[0][i] = emaxs[i]; } } dist1 = DotProduct(p->normal, corners[0]) - p->dist; dist2 = DotProduct(p->normal, corners[1]) - p->dist; sides = 0; if (dist1 >= 0) { sides = 1; } if (dist2 < 0) { sides |= 2; } return sides; } /* * Returns 1, 2, or 1 + 2 */ int BoxOnPlaneSide(vec3_t emins, vec3_t emaxs, struct cplane_s *p) { float dist1, dist2; int sides; /* fast axial cases */ if (p->type < 3) { if (p->dist <= emins[p->type]) { return 1; } if (p->dist >= emaxs[p->type]) { return 2; } return 3; } /* general case */ switch (p->signbits) { case 0: dist1 = p->normal[0] * emaxs[0] + p->normal[1] * emaxs[1] + p->normal[2] * emaxs[2]; dist2 = p->normal[0] * emins[0] + p->normal[1] * emins[1] + p->normal[2] * emins[2]; break; case 1: dist1 = p->normal[0] * emins[0] + p->normal[1] * emaxs[1] + p->normal[2] * emaxs[2]; dist2 = p->normal[0] * emaxs[0] + p->normal[1] * emins[1] + p->normal[2] * emins[2]; break; case 2: dist1 = p->normal[0] * emaxs[0] + p->normal[1] * emins[1] + p->normal[2] * emaxs[2]; dist2 = p->normal[0] * emins[0] + p->normal[1] * emaxs[1] + p->normal[2] * emins[2]; break; case 3: dist1 = p->normal[0] * emins[0] + p->normal[1] * emins[1] + p->normal[2] * emaxs[2]; dist2 = p->normal[0] * emaxs[0] + p->normal[1] * emaxs[1] + p->normal[2] * emins[2]; break; case 4: dist1 = p->normal[0] * emaxs[0] + p->normal[1] * emaxs[1] + p->normal[2] * emins[2]; dist2 = p->normal[0] * emins[0] + p->normal[1] * emins[1] + p->normal[2] * emaxs[2]; break; case 5: dist1 = p->normal[0] * emins[0] + p->normal[1] * emaxs[1] + p->normal[2] * emins[2]; dist2 = p->normal[0] * emaxs[0] + p->normal[1] * emins[1] + p->normal[2] * emaxs[2]; break; case 6: dist1 = p->normal[0] * emaxs[0] + p->normal[1] * emins[1] + p->normal[2] * emins[2]; dist2 = p->normal[0] * emins[0] + p->normal[1] * emaxs[1] + p->normal[2] * emaxs[2]; break; case 7: dist1 = p->normal[0] * emins[0] + p->normal[1] * emins[1] + p->normal[2] * emins[2]; dist2 = p->normal[0] * emaxs[0] + p->normal[1] * emaxs[1] + p->normal[2] * emaxs[2]; break; default: dist1 = dist2 = 0; break; } sides = 0; if (dist1 >= p->dist) { sides = 1; } if (dist2 < p->dist) { sides |= 2; } return sides; } void ClearBounds(vec3_t mins, vec3_t maxs) { mins[0] = mins[1] = mins[2] = 99999; maxs[0] = maxs[1] = maxs[2] = -99999; } void AddPointToBounds(vec3_t v, vec3_t mins, vec3_t maxs) { int i; vec_t val; for (i = 0; i < 3; i++) { val = v[i]; if (val < mins[i]) { mins[i] = val; } if (val > maxs[i]) { maxs[i] = val; } } } int VectorCompare(vec3_t v1, vec3_t v2) { if ((v1[0] != v2[0]) || (v1[1] != v2[1]) || (v1[2] != v2[2])) { return 0; } return 1; } vec_t VectorNormalize(vec3_t v) { float length, ilength; length = v[0] * v[0] + v[1] * v[1] + v[2] * v[2]; length = (float)sqrt(length); if (length) { ilength = 1 / length; v[0] *= ilength; v[1] *= ilength; v[2] *= ilength; } return length; } vec_t VectorNormalize2(vec3_t v, vec3_t out) { VectorCopy(v, out); return VectorNormalize(out); } void VectorMA(vec3_t veca, float scale, vec3_t vecb, vec3_t vecc) { vecc[0] = veca[0] + scale * vecb[0]; vecc[1] = veca[1] + scale * vecb[1]; vecc[2] = veca[2] + scale * vecb[2]; } vec_t _DotProduct(vec3_t v1, vec3_t v2) { return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2]; } void _VectorSubtract(vec3_t veca, vec3_t vecb, vec3_t out) { out[0] = veca[0] - vecb[0]; out[1] = veca[1] - vecb[1]; out[2] = veca[2] - vecb[2]; } void _VectorAdd(vec3_t veca, vec3_t vecb, vec3_t out) { out[0] = veca[0] + vecb[0]; out[1] = veca[1] + vecb[1]; out[2] = veca[2] + vecb[2]; } void _VectorCopy(vec3_t in, vec3_t out) { out[0] = in[0]; out[1] = in[1]; out[2] = in[2]; } void CrossProduct(vec3_t v1, vec3_t v2, vec3_t cross) { cross[0] = v1[1] * v2[2] - v1[2] * v2[1]; cross[1] = v1[2] * v2[0] - v1[0] * v2[2]; cross[2] = v1[0] * v2[1] - v1[1] * v2[0]; } double sqrt(double x); vec_t VectorLength(vec3_t v) { int i; float length; length = 0; for (i = 0; i < 3; i++) { length += v[i] * v[i]; } length = (float)sqrt(length); return length; } void VectorInverse(vec3_t v) { v[0] = -v[0]; v[1] = -v[1]; v[2] = -v[2]; } void VectorScale(vec3_t in, vec_t scale, vec3_t out) { out[0] = in[0] * scale; out[1] = in[1] * scale; out[2] = in[2] * scale; } int Q_log2(int val) { int answer = 0; while (val >>= 1) { answer++; } return answer; } /* ==================================================================================== */ char * COM_SkipPath(char *pathname) { char *last; last = pathname; while (*pathname) { if (*pathname == '/') { last = pathname + 1; } pathname++; } return last; } void COM_StripExtension(char *in, char *out) { while (*in && *in != '.') { *out++ = *in++; } *out = 0; } const char * COM_FileExtension(const char *in) { const char *ext = strrchr(in, '.'); if (!ext || ext == in) { return ""; } return ext + 1; } void COM_FileBase(char *in, char *out) { char *s, *s2; s = in + strlen(in) - 1; while (s != in && *s != '.') { s--; } for (s2 = s; s2 != in && *s2 != '/'; s2--) { } if (s - s2 < 2) { out[0] = 0; } else { s--; strncpy(out, s2 + 1, s - s2); out[s - s2] = 0; } } /* * Returns the path up to, but not including the last / */ void COM_FilePath(const char *in, char *out) { const char *s; s = in + strlen(in) - 1; while (s != in && *s != '/') { s--; } strncpy(out, in, s - in); out[s - in] = 0; } void COM_DefaultExtension(char *path, const char *extension) { char *src; /* */ /* if path doesn't have a .EXT, append extension */ /* (extension should include the .) */ /* */ src = path + strlen(path) - 1; while (*src != '/' && src != path) { if (*src == '.') { return; /* it has an extension */ } src--; } strcat(path, extension); } /* * ============================================================================ * * BYTE ORDER FUNCTIONS * * ============================================================================ */ qboolean bigendien; /* can't just use function pointers, or dll linkage can mess up when qcommon is included in multiple places */ short (*_BigShort)(short l); short (*_LittleShort)(short l); int (*_BigLong)(int l); int (*_LittleLong)(int l); float (*_BigFloat)(float l); float (*_LittleFloat)(float l); short BigShort(short l) { return _BigShort(l); } short LittleShort(short l) { return _LittleShort(l); } int BigLong(int l) { return _BigLong(l); } int LittleLong(int l) { return _LittleLong(l); } float BigFloat(float l) { return _BigFloat(l); } float LittleFloat(float l) { return _LittleFloat(l); } short ShortSwap(short l) { byte b1, b2; b1 = l & 255; b2 = (l >> 8) & 255; return (b1 << 8) + b2; } short ShortNoSwap(short l) { return l; } int LongSwap(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 LongNoSwap(int l) { return l; } float FloatSwap(float f) { union { float f; byte b[4]; } dat1, dat2; dat1.f = f; dat2.b[0] = dat1.b[3]; dat2.b[1] = dat1.b[2]; dat2.b[2] = dat1.b[1]; dat2.b[3] = dat1.b[0]; return dat2.f; } float FloatNoSwap(float f) { return f; } void Swap_Init(void) { byte swaptest[2] = {1, 0}; /* set the byte swapping variables in a portable manner */ /* PVS NOTE: maybe use memcpy here? */ if (*(short *)swaptest == 1) { bigendien = false; _BigShort = ShortSwap; _LittleShort = ShortNoSwap; _BigLong = LongSwap; _LittleLong = LongNoSwap; _BigFloat = FloatSwap; _LittleFloat = FloatNoSwap; Com_Printf("Byte ordering: little endian\n\n"); } else { bigendien = true; _BigShort = ShortNoSwap; _LittleShort = ShortSwap; _BigLong = LongNoSwap; _LittleLong = LongSwap; _BigFloat = FloatNoSwap; _LittleFloat = FloatSwap; Com_Printf("Byte ordering: big endian\n\n"); } if (LittleShort(*(short *)swaptest) != 1) assert("Error in the endian conversion!"); } /* * does a varargs printf into a temp buffer, so I don't * need to have varargs versions of all text functions. */ char * va(const char *format, ...) { va_list argptr; static char string[1024]; va_start(argptr, format); vsnprintf(string, 1024, format, argptr); va_end(argptr); return string; } char com_token[MAX_TOKEN_CHARS]; /* * Parse a token out of a string */ char * COM_Parse(char **data_p) { int c; int len; char *data; data = *data_p; len = 0; com_token[0] = 0; if (!data) { *data_p = NULL; return ""; } skipwhite: while ((c = *data) <= ' ') { if (c == 0) { *data_p = NULL; return ""; } data++; } /* skip // comments */ if ((c == '/') && (data[1] == '/')) { while (*data && *data != '\n') { data++; } goto skipwhite; } /* handle quoted strings specially */ if (c == '\"') { data++; while (1) { c = *data++; if ((c == '\"') || !c) { com_token[len] = 0; *data_p = data; return com_token; } if (len < MAX_TOKEN_CHARS) { com_token[len] = c; len++; } } } /* parse a regular word */ do { if (len < MAX_TOKEN_CHARS) { com_token[len] = c; len++; } data++; c = *data; } while (c > 32); if (len == MAX_TOKEN_CHARS) { len = 0; } com_token[len] = 0; *data_p = data; return com_token; } int paged_total; void Com_PageInMemory(byte *buffer, int size) { int i; for (i = size - 1; i > 0; i -= 4096) { paged_total += buffer[i]; } } /* * ============================================================================ * * LIBRARY REPLACEMENT FUNCTIONS * * ============================================================================ */ int Q_stricmp(const char *s1, const char *s2) { return strcasecmp(s1, s2); } int Q_strncasecmp(char *s1, char *s2, int n) { int c1, c2; do { c1 = *s1++; c2 = *s2++; if (!n--) { return 0; /* strings are equal until end point */ } if (c1 != c2) { if ((c1 >= 'a') && (c1 <= 'z')) { c1 -= ('a' - 'A'); } if ((c2 >= 'a') && (c2 <= 'z')) { c2 -= ('a' - 'A'); } if (c1 != c2) { return -1; /* strings not equal */ } } } while (c1); return 0; /* strings are equal */ } int Q_strcasecmp(char *s1, char *s2) { return Q_strncasecmp(s1, s2, 99999); } void Com_sprintf(char *dest, int size, char *fmt, ...) { int len; va_list argptr; static char bigbuffer[0x10000]; va_start(argptr, fmt); len = vsnprintf(bigbuffer, 0x10000, fmt, argptr); va_end(argptr); if (len >= size) { Com_Printf("Com_sprintf: overflow\n"); dest = NULL; return; } bigbuffer[size - 1] = '\0'; strcpy(dest, bigbuffer); } char * strlwr ( char *s ) { char *p = s; while ( *s ) { *s = tolower( *s ); s++; } return ( p ); } int Q_strlcpy(char *dst, const char *src, int size) { const char *s = src; while (*s) { if (size > 1) { *dst++ = *s; size--; } s++; } if (size > 0) { *dst = '\0'; } return s - src; } int Q_strlcat(char *dst, const char *src, int size) { char *d = dst; while (size > 0 && *d) { size--; d++; } return (d - dst) + Q_strlcpy(d, src, size); } /* * ===================================================================== * * INFO STRINGS * * ===================================================================== */ /* * Searches the string for the given * key and returns the associated value, * or an empty string. */ char * Info_ValueForKey(char *s, char *key) { char pkey[512]; static char value[2][512]; /* use two buffers so compares work without stomping on each other */ static int valueindex; char *o; valueindex ^= 1; if (*s == '\\') { s++; } while (1) { o = pkey; while (*s != '\\') { if (!*s) { return ""; } *o++ = *s++; } *o = 0; s++; o = value[valueindex]; while (*s != '\\' && *s) { if (!*s) { return ""; } *o++ = *s++; } *o = 0; if (!strcmp(key, pkey)) { return value[valueindex]; } if (!*s) { return ""; } s++; } } void Info_RemoveKey(char *s, char *key) { char *start; char pkey[512]; char value[512]; char *o; if (strstr(key, "\\")) { return; } while (1) { start = s; if (*s == '\\') { s++; } o = pkey; while (*s != '\\') { if (!*s) { return; } *o++ = *s++; } *o = 0; s++; o = value; while (*s != '\\' && *s) { if (!*s) { return; } *o++ = *s++; } *o = 0; if (!strcmp(key, pkey)) { memmove(start, s, strlen(s) + 1); /* remove this part */ return; } if (!*s) { return; } } } /* * Some characters are illegal in info strings * because they can mess up the server's parsing */ qboolean Info_Validate(char *s) { if (strstr(s, "\"")) { return false; } if (strstr(s, ";")) { return false; } return true; } void Info_SetValueForKey(char *s, char *key, char *value) { char newi[MAX_INFO_STRING], *v; int c; int maxsize = MAX_INFO_STRING; if (strstr(key, "\\") || strstr(value, "\\")) { Com_Printf("Can't use keys or values with a \\\n"); return; } if (strstr(key, ";")) { Com_Printf("Can't use keys or values with a semicolon\n"); return; } if (strstr(key, "\"") || strstr(value, "\"")) { Com_Printf("Can't use keys or values with a \"\n"); return; } if ((strlen(key) > MAX_INFO_KEY - 1) || (strlen(value) > MAX_INFO_KEY - 1)) { Com_Printf("Keys and values must be < 64 characters.\n"); return; } Info_RemoveKey(s, key); if (*value == '\0') { return; } Com_sprintf(newi, sizeof(newi), "\\%s\\%s", key, value); if (strlen(newi) + strlen(s) >= maxsize) { Com_Printf("Info string length exceeded\n"); return; } /* only copy ascii values */ s += strlen(s); v = newi; while (*v) { c = *v++; c &= 127; /* strip high bits */ if ((c >= 32) && (c < 127)) { *s++ = c; } } *s = 0; } xatrix-XATRIX_2_14/stuff/000077500000000000000000000000001477320050300152675ustar00rootroot00000000000000xatrix-XATRIX_2_14/stuff/mapfixes/000077500000000000000000000000001477320050300171035ustar00rootroot00000000000000xatrix-XATRIX_2_14/stuff/mapfixes/industry.ent000066400000000000000000002707621477320050300215120ustar00rootroot00000000000000// FIXED ENTITY STRING (by BjossiAlfreds) // // 1. Fixed an unreachable monster_gunner (1238) // // This gunner stands in front of the elevator when you return // after picking up the green key. His targetname, t238, is never // targeted. I set it to t301 instead, which is targeted by the // green key. { "sounds" "8" "nextmap" "outbase" "message" "Industrial Facility" "spawnflags" "1796" "sky" "x1u3" "classname" "worldspawn" "angle" "180" } { "origin" "320 -1216 248" "angle" "90" "targetname" "w_treat" "classname" "info_player_coop" } { "classname" "misc_teleporter" "spawnflags" "1792" "target" "t315" "origin" "-96 -1768 152" } { "origin" "-1360 -2040 144" "classname" "ammo_trap" } { "origin" "-1088 -936 352" "angles" "5 145 0" "classname" "info_player_intermission" } { "classname" "target_goal" "targetname" "t327" "origin" "344 -1232 232" } { "model" "*1" "classname" "trigger_once" "target" "t327" } { "classname" "target_goal" "targetname" "t326" "origin" "1512 632 176" } { "model" "*2" "classname" "trigger_once" "target" "t326" } { "origin" "-1048 -896 16" "spawnflags" "2048" "classname" "ammo_trap" } { "model" "*3" "spawnflags" "1798" "classname" "func_wall" } { "spawnflags" "2048" "classname" "ammo_bullets" "origin" "-808 1960 416" } { "classname" "ammo_bullets" "spawnflags" "2048" "origin" "-760 1960 416" } { "origin" "-608 -1920 144" "classname" "ammo_bullets" } { "spawnflags" "2048" "classname" "ammo_shells" "origin" "-808 1768 144" } { "classname" "ammo_shells" "spawnflags" "2048" "origin" "-808 1728 144" } { "classname" "ammo_rockets" "spawnflags" "2048" "origin" "-2265 544 296" } { "classname" "ammo_rockets" "spawnflags" "2048" "origin" "-1248 -256 32" } { "origin" "-1360 -2088 144" "classname" "item_armor_shard" } { "origin" "-1400 -2088 144" "classname" "item_armor_shard" } { "origin" "-1320 -2088 144" "classname" "item_armor_shard" } { "origin" "-1360 -1960 152" "targetname" "t324" "spawnflags" "2" "angle" "90" "classname" "monster_parasite" } { "spawnflags" "2048" "origin" "-1392 -1672 160" "target" "t322" "targetname" "t270" "classname" "trigger_relay" } { "model" "*4" "target" "t323" "count" "7" "spawnflags" "1" "targetname" "t322" "classname" "trigger_counter" } { "origin" "-1360 -2048 176" "classname" "light" "light" "70" "_color" "1.000000 0.000000 0.000000" } { "origin" "-1360 -1944 176" "_color" "1.000000 0.000000 0.000000" "light" "70" "classname" "light" } { "model" "*5" "spawnflags" "2048" "target" "t324" "targetname" "t323" "wait" "-1" "angle" "-2" "classname" "func_door" } { "_color" "0.678431 0.882353 1.000000" "light" "65" "classname" "light" "origin" "-224 -512 304" } { "_color" "0.678431 0.882353 1.000000" "light" "65" "classname" "light" "origin" "-480 -512 304" } { "_color" "0.678431 0.882353 1.000000" "light" "65" "classname" "light" "origin" "-480 -288 304" } { "_color" "0.678431 0.882353 1.000000" "light" "65" "classname" "light" "origin" "-480 -160 304" } { "_color" "0.678431 0.882353 1.000000" "light" "65" "classname" "light" "origin" "-480 -32 304" } { "_color" "0.678431 0.882353 1.000000" "light" "65" "classname" "light" "origin" "-480 192 176" } { "_color" "0.678431 0.882353 1.000000" "light" "65" "classname" "light" "origin" "-256 192 176" } { "_color" "0.678431 0.882353 1.000000" "light" "65" "classname" "light" "origin" "-24 192 176" } { "classname" "light" "light" "65" "_color" "0.678431 0.882353 1.000000" "origin" "352 192 304" } { "classname" "ammo_rockets" "spawnflags" "1792" "origin" "1974 856 144" } { "spawnflags" "1792" "classname" "ammo_rockets" "origin" "1974 896 144" } { "spawnflags" "1792" "classname" "ammo_rockets" "origin" "1974 936 144" } { "origin" "-184 -1776 152" "angle" "180" "classname" "info_player_start" } { "origin" "528 1632 264" "noise" "world/chatter3" "volume" "1" "attenuation" "-1" "spawnflags" "4" "targetname" "t321" "classname" "target_speaker" } { "origin" "520 1696 264" "delay" "3" "target" "t320" "targetname" "t275" "classname" "trigger_relay" } { "origin" "520 1656 264" "target" "t321" "targetname" "t275" "classname" "trigger_relay" } { "origin" "1512 312 200" "noise" "world/chatter2" "volume" "1" "attenuation" "-1" "spawnflags" "4" "targetname" "t319" "classname" "target_speaker" } { "origin" "1496 344 200" "target" "t318" "targetname" "t274" "classname" "trigger_relay" } { "origin" "1496 328 200" "delay" ".5" "target" "t319" "targetname" "t274" "classname" "trigger_relay" } { "origin" "1136 920 -176" "spawnflags" "1792" "classname" "item_armor_combat" } { "target" "t315" "spawnflags" "1792" "origin" "1544 440 -160" "classname" "misc_teleporter" } { "origin" "-1472 2024 424" "angle" "270" "classname" "info_player_deathmatch" } { "model" "*6" "spawnflags" "1798" "classname" "func_wall" } { "classname" "trigger_relay" "targetname" "t296" "target" "t317" "origin" "1456 784 -184" } { "classname" "trigger_relay" "targetname" "t314" "target" "t316" "message" "Blue forcefield deactivated." "origin" "-408 536 240" } { "origin" "-2512 -1168 24" "targetname" "t315" "angle" "45" "classname" "misc_teleporter_dest" "spawnflags" "1792" } { "origin" "-472 -568 -104" "target" "t315" "spawnflags" "1792" "classname" "misc_teleporter" } { "model" "*7" "spawnflags" "1798" "classname" "func_wall" } { "origin" "328 -160 16" "spawnflags" "1792" "classname" "item_silencer" } { "origin" "224 224 208" "spawnflags" "1792" "classname" "ammo_slugs" } { "origin" "224 288 240" "spawnflags" "1792" "classname" "weapon_railgun" } { "origin" "-520 -536 144" "classname" "ammo_grenades" "spawnflags" "1792" } { "origin" "-520 -568 144" "classname" "weapon_grenadelauncher" "spawnflags" "1792" } { "origin" "-520 -608 144" "spawnflags" "1792" "classname" "ammo_grenades" } { "origin" "-536 1008 144" "classname" "weapon_shotgun" "spawnflags" "1792" } { "origin" "-496 1008 144" "spawnflags" "1792" "classname" "ammo_shells" } { "classname" "ammo_bullets" "origin" "-448 -1800 144" "spawnflags" "1792" } { "spawnflags" "1792" "origin" "-448 -1768 144" "classname" "weapon_chaingun" } { "classname" "ammo_bullets" "origin" "-608 -1968 144" } { "origin" "-544 -1576 152" "angle" "270" "classname" "info_player_deathmatch" } { "origin" "-2672 48 208" "classname" "ammo_cells" "spawnflags" "1792" } { "origin" "-2656 0 208" "classname" "weapon_bfg" "spawnflags" "1792" } { "origin" "-2672 -40 208" "spawnflags" "1792" "classname" "ammo_cells" } { "origin" "-1920 -152 208" "target" "t143" "spawnflags" "1792" "classname" "trigger_always" } { "origin" "1536 1816 144" "classname" "ammo_grenades" "spawnflags" "1792" } { "origin" "1576 1816 144" "spawnflags" "1792" "classname" "ammo_grenades" } { "origin" "1120 1656 200" "target" "t214" "spawnflags" "1792" "classname" "trigger_always" } { "model" "*8" "spawnflags" "2054" "classname" "func_wall" } { "model" "*9" "spawnflags" "2054" "classname" "func_wall" } { "origin" "-824 1504 336" "spawnflags" "1792" "classname" "item_bandolier" } { "classname" "ammo_slugs" "spawnflags" "1792" "origin" "-216 1960 416" } { "classname" "weapon_railgun" "spawnflags" "1792" "origin" "-184 1960 416" } { "origin" "-256 480 144" "spawnflags" "1792" "classname" "item_quadfire" } { "model" "*10" "target" "t270" "classname" "func_button" "angle" "0" "lip" "4" } { "classname" "monster_gladiator" "angle" "180" "spawnflags" "3" "targetname" "t273" "target" "t314" "origin" "-392 480 152" } { "classname" "light" "light" "125" "_color" "1.000000 1.000000 0.835294" "origin" "-396 480 208" } { "model" "*11" "classname" "func_wall" "spawnflags" "2054" "targetname" "t316" } { "targetname" "xintell" "angle" "180" "classname" "info_player_coop" "origin" "-128 -1856 152" } { "targetname" "xintell" "angle" "180" "classname" "info_player_coop" "origin" "-128 -1680 152" } { "targetname" "xintell" "classname" "info_player_coop" "angle" "180" "origin" "-96 -1768 152" } { "targetname" "outbase" "angle" "270" "classname" "info_player_coop" "origin" "-1472 2288 424" } { "targetname" "outbase" "angle" "270" "classname" "info_player_coop" "origin" "-1472 2208 424" } { "classname" "info_player_coop" "angle" "270" "targetname" "outbase" "origin" "-1472 2368 424" } { "angle" "90" "classname" "info_player_coop" "origin" "1544 320 152" "targetname" "refinery" } { "angle" "90" "classname" "info_player_coop" "origin" "1544 384 152" "targetname" "refinery" } { "classname" "info_player_coop" "angle" "90" "targetname" "refinery" "origin" "1544 256 152" } { "spawnflags" "2048" "classname" "ammo_magslug" "origin" "1240 1272 -176" } { "classname" "ammo_magslug" "spawnflags" "2048" "origin" "1176 1272 -176" } { "classname" "weapon_phalanx" "spawnflags" "2048" "origin" "1208 1272 -176" } { "spawnflags" "2048" "classname" "item_health_large" "origin" "-496 1008 144" } { "classname" "item_health_large" "spawnflags" "2048" "origin" "-536 1008 144" } { "origin" "1536 1816 144" "spawnflags" "2048" "classname" "ammo_cells" } { "origin" "864 1320 144" "classname" "ammo_cells" "spawnflags" "2048" } { "origin" "864 1240 144" "spawnflags" "2048" "classname" "ammo_cells" } { "origin" "1224 408 144" "classname" "item_health_large" "spawnflags" "0" } { "origin" "1264 408 144" "classname" "item_health_large" "spawnflags" "0" } { "origin" "1184 408 144" "spawnflags" "2048" "classname" "item_health_large" } { "origin" "-176 1632 424" "targetname" "t296" "spawnflags" "3" "angle" "180" "classname" "monster_infantry" } { "origin" "-232 1176 424" "targetname" "t296" "spawnflags" "3" "angle" "90" "classname" "monster_gunner" } { "origin" "472 1312 160" "target" "t221" "spawnflags" "1" "angle" "90" "classname" "monster_gunner" } { "origin" "1112 640 -176" "spawnflags" "2048" "classname" "ammo_rockets" } { "origin" "920 1600 -176" "target" "t309" "targetname" "t308" "classname" "path_corner" } { "origin" "912 1744 -176" "target" "t308" "targetname" "t307" "classname" "path_corner" } { "origin" "1480 1616 -176" "targetname" "t310" "target" "t307" "classname" "path_corner" } { "origin" "1128 1528 -176" "target" "t310" "targetname" "t309" "classname" "path_corner" } { "origin" "1536 1616 -160" "target" "t310" "angle" "180" "spawnflags" "1" "classname" "monster_gladiator" } { "origin" "-2088 -536 648" "targetname" "t306" "classname" "point_combat" } { "origin" "-2088 -216 728" "targetname" "t287" "target" "t306" "spawnflags" "770" "angle" "270" "classname" "monster_hover" } { "target" "t305" "targetname" "t304" "origin" "-1456 -1776 136" "classname" "point_combat" } { "targetname" "t277" "target" "t304" "spawnflags" "1" "angle" "270" "origin" "-1456 -1576 152" "classname" "monster_gladiator" } { "origin" "1960 1296 136" "targetname" "t303" "classname" "point_combat" } { "classname" "target_help" "targetname" "t301" "message" "Proceed to Outer Base." "origin" "1552 368 -120" } { "origin" "464 48 232" "message" "You found a secret." "targetname" "t300" "classname" "target_secret" } { "origin" "-544 -880 -88" "light" "60" "classname" "light" } { "origin" "-760 1912 496" "target" "t299" "targetname" "t298" "classname" "trigger_relay" } { "origin" "-792 1912 496" "target" "t298" "targetname" "t297" "item" "key_green_key" "classname" "trigger_key" } { "model" "*12" "target" "t297" "spawnflags" "2048" "classname" "trigger_multiple" } { "spawnflags" "2048" "origin" "1544 440 -168" "classname" "key_green_key" "target" "t301" } { "model" "*13" "spawnflags" "2054" "classname" "func_wall" "targetname" "t317" } { "classname" "item_health_large" "origin" "-328 -1576 144" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-1223 -1767 208" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-863 -1775 208" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-583 -1759 208" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-359 -1759 208" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-1383 185 264" } { "targetname" "t305" "classname" "point_combat" "origin" "-1280 -1776 136" } { "target" "t303" "angle" "135" "origin" "1920 1096 248" "targetname" "t290" "classname" "monster_hover" "item" "ammo_cells" } { "origin" "1576 432 200" "target" "t288" "targetname" "t272" "classname" "trigger_relay" } { "origin" "1840 904 456" "targetname" "t288" "classname" "monster_hover" "angle" "180" "spawnflags" "3" } { "origin" "1736 504 456" "targetname" "t288" "classname" "monster_hover" "angle" "90" "spawnflags" "3" } { "origin" "1544 504 456" "targetname" "t288" "classname" "monster_hover" "angle" "90" "spawnflags" "771" } { "origin" "1336 504 456" "targetname" "t288" "classname" "monster_hover" "angle" "90" "spawnflags" "771" } { "targetname" "t288" "origin" "1816 1064 456" "spawnflags" "3" "angle" "135" "classname" "monster_hover" } { "targetname" "t50" "target" "t296" "origin" "1448 912 -192" "spawnflags" "1" "angle" "45" "classname" "monster_boss5" } { "origin" "-1512 2176 432" "target" "t269" "spawnflags" "1" "classname" "target_crosslevel_target" } { "origin" "-1856 -456 648" "targetname" "t285" "classname" "point_combat" } { "origin" "-1600 -784 648" "targetname" "t286" "classname" "point_combat" } { "origin" "-2112 -792 648" "targetname" "t284" "classname" "point_combat" } { "origin" "-1864 -280 664" "targetname" "t287" "target" "t285" "classname" "monster_hover" "angle" "270" "spawnflags" "2" } { "origin" "-1608 -1056 744" "targetname" "t287" "target" "t286" "classname" "monster_hover" "angle" "90" "spawnflags" "2" } { "origin" "-2112 -1064 744" "targetname" "t287" "target" "t284" "spawnflags" "258" "angle" "90" "classname" "monster_hover" } { "origin" "-1624 -192 136" "target" "t279" "targetname" "t278" "classname" "point_combat" } { "origin" "-1632 -256 136" "target" "t280" "targetname" "t279" "classname" "point_combat" } { "target" "t278" "origin" "-1313 -207 152" "spawnflags" "769" "angle" "180" "classname" "monster_soldier_lasergun" "targetname" "t1" } { "origin" "-2080 -256 136" "target" "t283" "targetname" "t282" "classname" "point_combat" } { "origin" "-1760 -192 136" "target" "t282" "targetname" "t281" "classname" "point_combat" } { "origin" "-1632 -560 136" "targetname" "t280" "classname" "point_combat" "spawnflags" "1" } { "origin" "-2080 -560 136" "targetname" "t283" "spawnflags" "1" "classname" "point_combat" } { "spawnflags" "1792" "origin" "-448 -1736 144" "classname" "ammo_bullets" } { "origin" "-448 -1568 144" "classname" "ammo_rockets" } { "model" "*14" "spawnflags" "2048" "target" "t276" "classname" "trigger_once" } { "spawnflags" "2048" "origin" "-280 -1632 144" "classname" "item_health_large" } { "origin" "-560 -1960 152" "item" "ammo_cells" "targetname" "t276" "spawnflags" "1" "angle" "0" "classname" "monster_soldier_ripper" } { "origin" "-544 -1568 152" "item" "item_armor_shard" "target" "t277" "targetname" "t276" "spawnflags" "1" "angle" "270" "classname" "monster_gunner" } { "targetname" "t320" "origin" "552 1672 280" "message" "Pursue airstrike marker to\n Water Treatment Plant." "classname" "target_help" } { "model" "*15" "target" "t275" "targetname" "t273" "spawnflags" "4" "classname" "trigger_once" } { "targetname" "t318" "origin" "1496 448 216" "message" "Locate stolen\n airstrike marker." "classname" "target_help" } { "origin" "1592 416 200" "target" "t273" "targetname" "t272" "classname" "trigger_relay" } { "origin" "1592 448 200" "target" "t272" "spawnflags" "2" "classname" "target_crosslevel_target" } { "model" "*16" "target" "t274" "targetname" "t273" "spawnflags" "4" "classname" "trigger_once" } { "origin" "1544 456 152" "targetname" "refinery" "angle" "90" "classname" "info_player_start" } { "origin" "1504 256 200" "map" "refinery$industry" "targetname" "t271" "classname" "target_changelevel" } { "origin" "-1024 -544 8" "targetname" "t1" "spawnflags" "2" "angle" "180" "classname" "monster_boss5" } { "model" "*17" "spawnflags" "2048" "target" "t1" "classname" "trigger_once" } { "origin" "-1376 -1632 160" "light" "50" "classname" "light" } { "model" "*18" "target" "t270" "lip" "4" "angle" "270" "classname" "func_button" } { "origin" "-1456 -1768 272" "light" "65" "classname" "light" } { "origin" "-1200 -1768 272" "light" "65" "classname" "light" } { "origin" "-976 -1768 272" "light" "65" "classname" "light" } { "origin" "-720 -1768 272" "light" "65" "classname" "light" } { "origin" "-512 -1696 312" "light" "65" "classname" "light" } { "origin" "-112 -1704 224" "classname" "light" "light" "65" } { "origin" "-512 -1840 312" "classname" "light" "light" "65" } { "origin" "-352 -1840 312" "classname" "light" "light" "65" } { "origin" "-352 -1696 312" "classname" "light" "light" "65" } { "origin" "-1456 -1576 272" "classname" "light" "light" "65" } { "origin" "-112 -1832 224" "light" "65" "classname" "light" } { "model" "*19" "lip" "38" "team" "ed1" "angle" "270" "classname" "func_door" "wait" "-1" "spawnflags" "2048" } { "model" "*20" "lip" "38" "team" "ed1" "angle" "90" "classname" "func_door" "wait" "-1" "spawnflags" "2048" } { "origin" "120 -1000 360" "classname" "light" "light" "50" "_color" "1.000000 0.868526 0.721116" } { "_color" "1.000000 0.868526 0.721116" "light" "50" "classname" "light" "origin" "96 -1024 360" } { "_color" "1.000000 0.868526 0.721116" "light" "50" "classname" "light" "origin" "72 -1000 360" } { "_color" "1.000000 0.868526 0.721116" "light" "50" "classname" "light" "origin" "96 -976 360" } { "light" "50" "_color" "1.000000 0.000000 0.000000" "classname" "light" "origin" "1140 1560 180" } { "classname" "light" "_color" "1.000000 0.000000 0.000000" "light" "50" "origin" "1140 1736 180" } { "origin" "-200 -1776 152" "target" "t113" "angle" "180" "classname" "info_player_start" "targetname" "xintell" } { "origin" "-1424 2120 424" "message" "Proceed to Refinery." "targetname" "t268" "classname" "target_help" } { "model" "*21" "targetname" "t269" "target" "t268" "spawnflags" "4" "classname" "trigger_once" } { "origin" "1119 680 -176" "spawnflags" "2048" "classname" "item_health_large" } { "target" "t290" "origin" "1736 1624 -128" "targetname" "t50" "classname" "trigger_relay" } { "origin" "144 96 -16" "classname" "item_health_large" } { "origin" "-426 105 -24" "spawnflags" "2048" "delay" "2" "target" "t248" "targetname" "t247" "classname" "trigger_relay" } { "model" "*22" "spawnflags" "2048" "target" "t247" "classname" "trigger_once" } { "origin" "144 96 -8" "targetname" "t246" "spawnflags" "2050" "angle" "180" "classname" "monster_soldier_lasergun" } { "model" "*23" "spawnflags" "0" "targetname" "t248" "target" "t246" "wait" "-1" "angle" "-2" "classname" "func_door" } { "model" "*24" "target" "t271" "angle" "270" "classname" "trigger_multiple" } { "model" "*25" "message" "This door is opened nearby." "targetname" "t328" "spawnflags" "2048" "wait" "-1" "_minlight" ".1" "angle" "-1" "classname" "func_door" } { "classname" "item_armor_combat" "spawnflags" "2048" "origin" "-1472 192 280" } { "classname" "monster_gunner" "angle" "0" "spawnflags" "257" "origin" "-1328 1857 424" "item" "ammo_bullets" } { "spawnflags" "2049" "angle" "270" "classname" "monster_soldier_lasergun" "origin" "-1506 2023 424" } { "classname" "monster_soldier_lasergun" "angle" "270" "spawnflags" "2049" "origin" "-1442 2023 424" } { "classname" "monster_gunner" "origin" "464 2009 160" "angle" "90" "spawnflags" "259" "targetname" "t301" } { "classname" "trigger_relay" "targetname" "t242" "killtarget" "rocketboy" "origin" "1976 512 440" } { "model" "*26" "spawnflags" "2048" "classname" "trigger_once" "message" "No prize for you Rocketman" "target" "t242" } { "classname" "item_invulnerability" "spawnflags" "2048" "targetname" "rocketboy" "origin" "2063 433 400" } { "classname" "ammo_rockets" "spawnflags" "2048" "origin" "1231 1464 -168" } { "model" "*27" "classname" "trigger_once" "target" "t228" } { "classname" "target_secret" "targetname" "t226" "message" "You've found a secret." "origin" "-2582 41 296" } { "model" "*28" "spawnflags" "2048" "classname" "trigger_once" "target" "t226" } { "classname" "weapon_phalanx" "spawnflags" "2048" "origin" "-2652 1 208" } { "classname" "ammo_magslug" "spawnflags" "2048" "origin" "-2671 48 208" } { "classname" "ammo_magslug" "spawnflags" "2048" "origin" "-2671 -44 208" } { "spawnflags" "0" "classname" "item_health" "origin" "-2392 473 16" } { "spawnflags" "0" "classname" "item_health" "origin" "-2392 545 16" } { "classname" "item_health" "spawnflags" "0" "origin" "-2392 409 16" } { "classname" "trigger_relay" "targetname" "t225" "target" "t214" "origin" "1114 1681 200" } { "classname" "monster_soldier_hypergun" "angle" "45" "spawnflags" "2049" "origin" "-545 -488 -104" } { "classname" "monster_soldier_lasergun" "angle" "45" "spawnflags" "2305" "origin" "-457 -96 -104" } { "classname" "path_corner" "targetname" "t221" "origin" "471 1343 144" "target" "t222" } { "classname" "path_corner" "targetname" "t220" "target" "t221" "origin" "463 1855 144" } { "classname" "path_corner" "targetname" "t219" "target" "t220" "origin" "-97 1855 144" } { "classname" "path_corner" "targetname" "t218" "target" "t219" "origin" "463 1855 144" } { "classname" "path_corner" "targetname" "t217" "target" "t218" "origin" "463 1647 144" } { "classname" "path_corner" "target" "t217" "origin" "943 1647 144" "targetname" "t223" } { "classname" "path_corner" "origin" "463 1647 144" "targetname" "t222" "target" "t223" } { "classname" "monster_gunner" "angle" "180" "item" "ammo_bullets" "spawnflags" "2049" "origin" "1040 1647 160" "target" "t223" } { "classname" "monster_gunner" "angle" "90" "targetname" "t216" "origin" "320 -1064 248" "spawnflags" "1" } { "classname" "monster_soldier_hypergun" "angle" "180" "spawnflags" "1" "target" "t216" "origin" "-265 -1001 248" } { "classname" "monster_soldier_ripper" "angle" "315" "item" "ammo_cells" "origin" "-544 40 -104" } { "classname" "ammo_bullets" "spawnflags" "2048" "origin" "-1248 -144 144" } { "origin" "-1249 -192 144" "classname" "item_health" "spawnflags" "2048" } { "classname" "item_health_large" "origin" "1406 1480 -168" } { "classname" "trigger_key" "targetname" "t213" "item" "key_red_key" "origin" "1081 1668 200" "target" "t225" } { "model" "*29" "target" "t244" "spawnflags" "4" "classname" "trigger_multiple" "targetname" "t214" } { "model" "*30" "spawnflags" "2048" "classname" "trigger_multiple" "target" "t213" } { "model" "*31" "target" "t244" "classname" "trigger_multiple" "spawnflags" "4" "targetname" "t214" } { "classname" "monster_soldier_ripper" "spawnflags" "769" "origin" "-1093 1345 408" "item" "ammo_cells" } { "classname" "item_health_large" "spawnflags" "2048" "origin" "-2416 33 16" } { "classname" "item_health" "spawnflags" "2048" "origin" "-1249 -96 144" } { "target" "t281" "classname" "monster_soldier_lasergun" "angle" "180" "spawnflags" "257" "origin" "-1313 -135 152" "targetname" "t1" } { "origin" "447 -308 136" "targetname" "t207" "classname" "point_combat" } { "origin" "281 -11 136" "targetname" "t206" "classname" "point_combat" } { "origin" "416 -61 136" "targetname" "t205" "spawnflags" "1" "classname" "point_combat" } { "origin" "239 -51 136" "target" "t204" "targetname" "t203" "classname" "point_combat" } { "origin" "127 -51 136" "targetname" "t204" "spawnflags" "1" "classname" "point_combat" } { "origin" "301 99 152" "target" "t206" "spawnflags" "1" "angle" "225" "classname" "monster_soldier_lasergun" } { "origin" "-819 1641 392" "targetname" "t202" "spawnflags" "1" "classname" "point_combat" } { "targetname" "t148" "spawnflags" "769" "target" "t202" "angle" "270" "origin" "-830 1708 408" "classname" "monster_soldier_lasergun" } { "origin" "-682 1814 152" "angle" "45" "spawnflags" "2049" "classname" "monster_infantry" } { "origin" "-429 1452 136" "target" "t201" "targetname" "t200" "classname" "point_combat" } { "origin" "-557 1428 136" "spawnflags" "1" "targetname" "t201" "classname" "point_combat" } { "origin" "-439 1566 152" "targetname" "t148" "target" "t200" "spawnflags" "2049" "angle" "270" "classname" "monster_infantry" "item" "ammo_bullets" } { "origin" "-608 1666 136" "targetname" "t199" "spawnflags" "1" "classname" "point_combat" } { "origin" "-608 1760 152" "targetname" "t148" "spawnflags" "2305" "target" "t199" "angle" "270" "classname" "monster_soldier_hypergun" } { "origin" "-385 1240 136" "targetname" "t198" "spawnflags" "1" "classname" "point_combat" } { "origin" "-246 1240 152" "targetname" "t148" "spawnflags" "2817" "target" "t198" "angle" "180" "classname" "monster_soldier_lasergun" } { "origin" "-1550 -1444 144" "spawnflags" "2048" "classname" "item_health_large" } { "classname" "point_combat" "targetname" "t177" "origin" "263 -610 136" } { "model" "*32" "spawnflags" "2048" "classname" "trigger_once" "target" "t176" } { "target" "t203" "angle" "225" "classname" "monster_infantry" "origin" "238 22 152" "spawnflags" "1" "item" "ammo_bullets" } { "target" "t205" "classname" "monster_infantry" "angle" "225" "origin" "350 14 152" "spawnflags" "769" } { "target" "t207" "classname" "point_combat" "targetname" "t175" "spawnflags" "2049" "origin" "442 -169 136" } { "classname" "monster_infantry" "spawnflags" "2049" "angle" "0" "target" "t175" "targetname" "t176" "origin" "119 -167 24" } { "classname" "ammo_grenades" "spawnflags" "2048" "origin" "289 -455 -112" } { "classname" "ammo_grenades" "spawnflags" "2048" "origin" "241 -455 -112" } { "spawnflags" "2048" "classname" "ammo_shells" "origin" "311 -160 16" } { "classname" "ammo_shells" "spawnflags" "2048" "origin" "351 -160 16" } { "classname" "monster_parasite" "targetname" "t172" "spawnflags" "1" "origin" "30 97 -8" } { "classname" "ammo_rockets" "spawnflags" "0" "origin" "143 -744 152" } { "origin" "420 -391 -112" "spawnflags" "2048" "classname" "item_armor_shard" } { "origin" "420 -359 -112" "spawnflags" "2048" "classname" "item_armor_shard" } { "origin" "420 -423 -112" "spawnflags" "2048" "classname" "item_armor_shard" } { "model" "*33" "target" "t174" "classname" "trigger_once" "spawnflags" "2048" } { "model" "*34" "speed" "150" "wait" "-1" "angle" "-2" "classname" "func_door" "lip" "4" "targetname" "t174" "spawnflags" "2048" } { "origin" "-984 692 400" "spawnflags" "2048" "classname" "weapon_rocketlauncher" } { "targetname" "t174" "origin" "-2277 402 56" "target" "t173" "classname" "trigger_relay" } { "targetname" "t173" "classname" "monster_parasite" "angle" "0" "spawnflags" "2306" "origin" "-2391 545 24" } { "targetname" "t173" "classname" "monster_parasite" "angle" "0" "spawnflags" "2050" "origin" "-2391 473 24" } { "spawnflags" "257" "origin" "-811 1807 152" "angle" "270" "classname" "monster_parasite" } { "origin" "440 288 152" "spawnflags" "1" "angle" "180" "classname" "monster_infantry" } { "origin" "-560 304 -16" "spawnflags" "2048" "classname" "item_health" } { "origin" "-272 167 -16" "spawnflags" "0" "classname" "item_armor_shard" } { "origin" "-312 167 -16" "spawnflags" "0" "classname" "item_armor_shard" } { "origin" "-352 167 -16" "spawnflags" "0" "classname" "item_armor_shard" } { "origin" "-232 167 -16" "spawnflags" "0" "classname" "item_armor_shard" } { "model" "*35" "spawnflags" "2048" "target" "t172" "classname" "trigger_once" } { "origin" "-462 268 -8" "classname" "monster_infantry" "angle" "270" "spawnflags" "2305" } { "targetname" "t172" "origin" "-414 248 -8" "spawnflags" "2049" "angle" "270" "classname" "monster_infantry" } { "origin" "-896 1504 328" "light" "75" "classname" "light" } { "spawnflags" "2048" "delay" "1.3" "target" "t169" "targetname" "t168" "origin" "-816 1536 408" "classname" "trigger_relay" } { "spawnflags" "2048" "message" "You've found a secret." "targetname" "t168" "origin" "-839 1555 408" "classname" "target_secret" } { "origin" "-953 1504 288" "spawnflags" "2048" "classname" "item_health_mega" } { "model" "*36" "lip" "10" "targetname" "t169" "wait" "-1" "spawnflags" "0" "angle" "-1" "classname" "func_door" } { "model" "*37" "spawnflags" "2048" "lip" "10" "target" "t168" "health" "1" "wait" "-1" "angle" "180" "classname" "func_door" } { "targetname" "t173" "origin" "-2391 409 24" "spawnflags" "2818" "angle" "0" "classname" "monster_parasite" } { "origin" "-1832 345 152" "spawnflags" "2305" "angle" "90" "classname" "monster_infantry" "item" "ammo_bullets" } { "origin" "-1385 152 152" "spawnflags" "2049" "angle" "315" "classname" "monster_infantry" "item" "ammo_bullets" } { "origin" "255 -820 152" "spawnflags" "2305" "angle" "90" "classname" "monster_gunner" "target" "t177" "targetname" "t176" } { "target" "t300" "origin" "476 96 240" "spawnflags" "2048" "classname" "item_armor_body" } { "origin" "222 240 208" "classname" "ammo_bullets" "spawnflags" "2048" } { "origin" "222 208 208" "spawnflags" "2048" "classname" "ammo_bullets" } { "origin" "222 293 240" "spawnflags" "2048" "classname" "weapon_chaingun" } { "origin" "93 -874 144" "classname" "item_health_large" "spawnflags" "2048" } { "origin" "93 -834 144" "spawnflags" "2048" "classname" "item_health_large" } { "origin" "-373 -487 -104" "spawnflags" "2305" "angle" "135" "classname" "monster_parasite" } { "origin" "-472 -383 136" "targetname" "t161" "spawnflags" "1" "classname" "point_combat" } { "origin" "-470 -568 152" "spawnflags" "2048" "target" "t161" "angle" "90" "classname" "monster_gunner" "item" "ammo_grenades" } { "origin" "-2240 688 16" "spawnflags" "2048" "classname" "item_silencer" } { "origin" "-2256 408 160" "classname" "item_health" "spawnflags" "3584" } { "origin" "-2288 408 160" "spawnflags" "2048" "classname" "item_health" } { "origin" "-481 1664 336" "spawnflags" "0" "classname" "item_armor_body" } { "origin" "-353 1272 432" "spawnflags" "257" "target" "t160" "angle" "180" "classname" "monster_gunner" } { "target" "t160" "targetname" "t159" "classname" "path_corner" "origin" "-667 1274 416" } { "target" "t159" "targetname" "t158" "classname" "path_corner" "origin" "-571 1370 416" } { "target" "t158" "targetname" "t157" "origin" "-459 1466 416" "classname" "path_corner" } { "targetname" "t160" "target" "t157" "origin" "-459 1274 416" "classname" "path_corner" } { "origin" "508 1343 432" "spawnflags" "1" "target" "t156" "angle" "180" "classname" "monster_gunner" } { "origin" "-305 1344 416" "target" "t155" "targetname" "t154" "classname" "path_corner" } { "origin" "-305 1752 416" "target" "t154" "targetname" "t153" "classname" "path_corner" } { "origin" "-625 1752 416" "target" "t153" "targetname" "t152" "classname" "path_corner" } { "origin" "-321 1752 416" "target" "t152" "targetname" "t151" "classname" "path_corner" } { "origin" "-321 1344 416" "target" "t151" "targetname" "t150" "classname" "path_corner" } { "origin" "-113 1344 416" "target" "t150" "targetname" "t149" "classname" "path_corner" } { "origin" "463 1344 416" "targetname" "t156" "target" "t149" "classname" "path_corner" } { "origin" "-97 1344 416" "target" "t156" "targetname" "t155" "classname" "path_corner" } { "model" "*38" "spawnflags" "2048" "target" "t148" "classname" "trigger_once" } { "origin" "-985 727 408" "targetname" "t148" "target" "t147" "angle" "90" "spawnflags" "2049" "classname" "monster_gunner" "item" "ammo_grenades" } { "origin" "-985 815 392" "targetname" "t147" "spawnflags" "1" "classname" "point_combat" } { "origin" "-2217 544 296" "spawnflags" "2048" "classname" "ammo_rockets" } { "origin" "-2255 464 160" "classname" "item_armor_shard" "spawnflags" "2048" } { "origin" "-2287 464 160" "classname" "item_armor_shard" "spawnflags" "2048" } { "origin" "-2223 464 160" "spawnflags" "2048" "classname" "item_armor_shard" } { "origin" "-1772 527 152" "targetname" "t146" "angle" "0" "classname" "monster_parasite" "spawnflags" "2050" } { "origin" "-1836 519 152" "spawnflags" "2818" "targetname" "t146" "classname" "monster_parasite" "angle" "0" } { "origin" "-1804 471 152" "spawnflags" "2306" "targetname" "t146" "angle" "0" "classname" "monster_parasite" } { "origin" "-2031 239 144" "spawnflags" "2048" "classname" "ammo_grenades" } { "spawnflags" "2048" "classname" "item_health" "origin" "-942 -526 24" } { "spawnflags" "2048" "classname" "item_health" "origin" "-942 -486 24" } { "classname" "item_health" "spawnflags" "2048" "origin" "-942 -566 24" } { "model" "*39" "spawnflags" "5" "classname" "trigger_multiple" "targetname" "t143" "target" "t144" } { "model" "*40" "classname" "trigger_multiple" "spawnflags" "5" "targetname" "t143" "target" "t144" } { "classname" "trigger_relay" "targetname" "t139" "target" "t143" "origin" "-1934 -109 208" } { "model" "*41" "classname" "trigger_multiple" "spawnflags" "2048" "target" "t141" } { "target" "t287" "classname" "key_pass" "spawnflags" "2048" "origin" "-1053 -544 24" } { "classname" "trigger_key" "target" "t139" "item" "key_pass" "origin" "-1931 -134 208" "targetname" "t141" "spawnflags" "2048" } { "model" "*42" "spawnflags" "2048" "targetname" "t299" "classname" "func_door" "angle" "-1" "wait" "-1" } { "classname" "target_help" "targetname" "t113" "origin" "-148 -1790 216" "message" "Gain entrance\nto Refinery." "spawnflags" "2048" } { "classname" "target_help" "targetname" "t113" "spawnflags" "2049" "message" "Destroy Strogg fuel\n production facility." "origin" "-177 -1745 216" } { "model" "*43" "classname" "trigger_once" "target" "t113" "spawnflags" "2048" } { "classname" "target_changelevel" "targetname" "t112" "map" "outbase$industry" "origin" "-1424 2400 464" } { "model" "*44" "target" "t112" "angle" "90" "classname" "trigger_multiple" } { "origin" "-1473 2119 424" "targetname" "outbase" "angle" "270" "classname" "info_player_start" } { "origin" "-1271 1865 472" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "-967 1865 472" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "-967 1865 512" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-1271 1865 512" } { "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" "origin" "-1272 1832 576" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-1240 1864 576" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-1272 1896 576" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-1304 1864 576" } { "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" "origin" "-1471 1993 472" } { "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" "origin" "-968 1832 576" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-936 1864 576" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-968 1896 576" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-1000 1864 576" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-672 1792 624" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-640 1760 624" } { "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" "origin" "-672 1728 624" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-704 1760 624" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-679 1761 560" } { "model" "*45" "angle" "-1" "classname" "func_door" "spawnflags" "2056" } { "origin" "1134 1719 144" "spawnflags" "1792" "classname" "ammo_magslug" } { "origin" "-1730 -1248 16" "spawnflags" "1792" "classname" "ammo_magslug" } { "origin" "-1648 -1247 16" "classname" "ammo_grenades" "spawnflags" "1792" } { "origin" "-1688 -1247 16" "spawnflags" "1792" "classname" "ammo_grenades" } { "origin" "-8 -617 144" "classname" "ammo_grenades" "spawnflags" "1792" } { "origin" "-8 -585 144" "spawnflags" "1792" "classname" "ammo_grenades" } { "origin" "-809 1768 144" "classname" "ammo_grenades" "spawnflags" "1792" } { "origin" "-809 1688 144" "spawnflags" "1792" "classname" "ammo_grenades" } { "origin" "-809 1727 144" "spawnflags" "1792" "classname" "weapon_grenadelauncher" } { "origin" "-248 1960 416" "spawnflags" "1792" "classname" "ammo_slugs" } { "origin" "2057 512 400" "classname" "ammo_cells" "spawnflags" "1792" } { "origin" "2017 550 400" "spawnflags" "1792" "classname" "ammo_cells" } { "origin" "2056 551 400" "spawnflags" "1792" "classname" "item_power_shield" } { "origin" "1111 640 -176" "classname" "ammo_cells" "spawnflags" "1792" } { "origin" "1127 584 -176" "spawnflags" "1792" "classname" "ammo_cells" } { "origin" "1111 680 -176" "spawnflags" "1792" "classname" "weapon_hyperblaster" } { "origin" "1888 402 144" "classname" "ammo_rockets" "spawnflags" "2048" } { "origin" "1928 402 144" "classname" "ammo_rockets" "spawnflags" "2048" } { "origin" "1848 402 144" "spawnflags" "2048" "classname" "ammo_rockets" } { "origin" "1951 1071 144" "spawnflags" "1792" "classname" "weapon_rocketlauncher" } { "origin" "1447 1704 -168" "spawnflags" "1792" "classname" "item_health_large" } { "origin" "1175 1465 -168" "classname" "item_health_small" "spawnflags" "1792" } { "origin" "1143 1465 -168" "classname" "item_health_small" "spawnflags" "1792" } { "origin" "1207 1465 -168" "spawnflags" "1792" "classname" "item_health_small" } { "origin" "616 1752 -168" "spawnflags" "1792" "classname" "ammo_bullets" } { "origin" "616 1720 -168" "classname" "ammo_bullets" "spawnflags" "1792" } { "origin" "616 1784 -168" "spawnflags" "1792" "classname" "ammo_bullets" } { "origin" "664 1752 -168" "spawnflags" "1792" "classname" "weapon_chaingun" } { "origin" "351 -864 208" "spawnflags" "1792" "classname" "item_adrenaline" } { "origin" "-193 1711 144" "spawnflags" "1792" "classname" "ammo_rockets" } { "origin" "104 1856 144" "classname" "item_armor_shard" "spawnflags" "1792" } { "origin" "64 1856 144" "classname" "item_armor_shard" "spawnflags" "1792" } { "origin" "24 1856 144" "classname" "item_armor_shard" "spawnflags" "1792" } { "origin" "144 1856 144" "spawnflags" "1792" "classname" "item_armor_shard" } { "origin" "-817 1504 144" "spawnflags" "1792" "classname" "ammo_magslug" } { "origin" "-944 696 400" "classname" "ammo_magslug" "spawnflags" "1792" } { "origin" "-1024 696 400" "spawnflags" "1792" "classname" "ammo_magslug" } { "origin" "-984 696 400" "spawnflags" "1792" "classname" "weapon_phalanx" } { "origin" "-686 1845 144" "classname" "ammo_shells" "spawnflags" "1792" } { "origin" "-652 1845 144" "spawnflags" "1792" "classname" "ammo_shells" } { "origin" "-685 1810 144" "spawnflags" "1792" "classname" "weapon_supershotgun" } { "origin" "-298 40 -112" "spawnflags" "1792" "classname" "ammo_cells" } { "origin" "-256 41 -112" "spawnflags" "1792" "classname" "weapon_hyperblaster" } { "origin" "366 -415 -112" "classname" "ammo_cells" "spawnflags" "1792" } { "origin" "366 -367 -112" "spawnflags" "1792" "classname" "ammo_cells" } { "origin" "417 -389 -112" "spawnflags" "1792" "classname" "item_power_shield" } { "origin" "278 303 144" "spawnflags" "1792" "classname" "ammo_slugs" } { "origin" "472 93 240" "spawnflags" "1792" "classname" "item_health_mega" } { "origin" "94 -873 144" "classname" "ammo_slugs" "spawnflags" "1792" } { "origin" "175 -720 152" "spawnflags" "0" "classname" "ammo_rockets" } { "origin" "-523 -570 144" "classname" "item_health_large" "spawnflags" "2048" } { "origin" "-523 -610 144" "spawnflags" "2048" "classname" "item_health_large" } { "origin" "-945 479 144" "classname" "item_armor_shard" "spawnflags" "1792" } { "origin" "-985 479 144" "spawnflags" "1792" "classname" "item_armor_shard" } { "origin" "-1025 479 144" "spawnflags" "1792" "classname" "item_armor_shard" } { "origin" "-601 479 144" "classname" "item_armor_shard" "spawnflags" "1792" } { "origin" "-641 479 144" "classname" "item_armor_shard" "spawnflags" "1792" } { "origin" "-561 479 144" "spawnflags" "1792" "classname" "item_armor_shard" } { "origin" "-2240 256 16" "spawnflags" "2048" "classname" "item_bandolier" } { "origin" "-2218 255 16" "classname" "ammo_magslug" "spawnflags" "1792" } { "origin" "-2266 255 16" "spawnflags" "1792" "classname" "ammo_magslug" } { "origin" "-2240 704 16" "spawnflags" "1792" "classname" "weapon_phalanx" } { "origin" "-1841 584 144" "classname" "item_health_small" "spawnflags" "2048" } { "origin" "-1809 584 144" "classname" "item_health_small" "spawnflags" "2048" } { "origin" "-1873 584 144" "spawnflags" "2048" "classname" "item_health_small" } { "origin" "-2288 409 160" "classname" "ammo_shells" "spawnflags" "1792" } { "origin" "-2256 409 160" "spawnflags" "1792" "classname" "ammo_shells" } { "origin" "-2240 544 296" "spawnflags" "1792" "classname" "item_armor_combat" } { "origin" "-1472 232 280" "classname" "ammo_cells" "spawnflags" "1792" } { "origin" "-1472 152 280" "spawnflags" "1792" "classname" "ammo_cells" } { "origin" "-1473 192 280" "spawnflags" "1792" "classname" "weapon_boomer" } { "origin" "-2029 -88 144" "spawnflags" "1792" "classname" "ammo_bullets" } { "origin" "-1745 -87 144" "classname" "ammo_grenades" "spawnflags" "1792" } { "origin" "-1697 -87 144" "spawnflags" "1792" "classname" "ammo_grenades" } { "origin" "-1281 -88 144" "spawnflags" "1792" "classname" "item_health" } { "origin" "-1241 -88 144" "spawnflags" "1792" "classname" "item_health" } { "origin" "-1321 -88 144" "spawnflags" "1792" "classname" "item_health" } { "origin" "-2369 -1312 208" "spawnflags" "1792" "classname" "item_health_mega" } { "classname" "ammo_shells" "spawnflags" "0" "origin" "-2252 -248 16" } { "origin" "-2216 -248 16" "classname" "ammo_shells" "spawnflags" "0" } { "origin" "-2288 -248 16" "spawnflags" "1792" "classname" "ammo_shells" } { "origin" "-2251 -284 16" "spawnflags" "0" "classname" "weapon_supershotgun" } { "origin" "-954 -487 24" "classname" "ammo_rockets" "spawnflags" "1792" } { "origin" "-954 -599 24" "spawnflags" "1792" "classname" "ammo_rockets" } { "origin" "-955 -542 24" "spawnflags" "1792" "classname" "weapon_rocketlauncher" } { "classname" "info_player_start" "angle" "90" "targetname" "w_treat" "origin" "316 -1143 248" } { "classname" "target_changelevel" "targetname" "t109" "map" "w_treat$industry" "origin" "293 -1383 272" } { "model" "*46" "classname" "trigger_multiple" "angle" "270" "target" "t109" } { "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" "origin" "1313 529 368" } { "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" "origin" "2089 513 496" } { "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" "origin" "1881 513 368" } { "origin" "2025 1305 368" "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" } { "origin" "1897 1249 368" "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" } { "origin" "1857 1097 368" "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" } { "origin" "1841 897 368" "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" } { "origin" "1833 713 368" "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" } { "origin" "2209 425 496" "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" } { "origin" "1697 513 368" "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" } { "origin" "1505 529 368" "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" } { "origin" "1073 569 368" "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" } { "origin" "1033 729 368" "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" } { "origin" "1217 1289 368" "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" } { "origin" "1041 1217 368" "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" } { "origin" "1001 1065 368" "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" } { "origin" "1073 905 368" "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" } { "origin" "1169 945 384" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "961 889 232" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "969 1121 232" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "985 1337 232" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1185 1225 232" } { "origin" "1601 1529 232" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "1441 1569 304" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1337 1585 232" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1489 1265 232" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1521 857 232" } { "origin" "1537 649 232" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1849 657 232" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1817 873 232" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1217 649 232" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1169 945 232" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1409 1089 232" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "961 681 232" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1593 1777 232" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1713 1105 232" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1857 1153 232" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1825 1345 232" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "2025 1409 232" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "2017 1665 232" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1793 1609 232" } { "origin" "2113 1161 232" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1521 857 72" } { "origin" "1849 657 72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1817 873 72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1217 649 72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1169 945 72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1409 1089 72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1185 1225 72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1489 1265 72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1713 1105 72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1857 1153 72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1825 1345 72" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "2025 1409 72" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "2017 1665 72" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1793 1609 72" } { "origin" "2113 1161 72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1521 857 -80" } { "origin" "1537 649 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1849 657 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1817 873 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1217 649 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1409 1089 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1185 1225 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1489 1265 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1713 1105 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1857 1153 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1825 1345 -80" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "2025 1409 -80" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "2017 1665 -80" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1793 1609 -80" } { "origin" "2113 1161 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1409 1089 384" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1713 1105 384" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1817 873 384" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1849 657 384" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1537 649 384" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1217 649 384" } { "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" "origin" "2105 1169 424" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "1857 1153 384" } { "origin" "1521 857 384" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1825 1345 384" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "2025 1409 384" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "2017 1665 384" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1793 1609 384" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "1529 1609 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "1169 1617 -48" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "817 1665 -48" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "465 1977 -48" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "465 1969 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "1297 1577 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "1057 1609 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "841 1681 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "705 1825 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "1425 1617 -48" } { "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" "origin" "465 2185 -80" } { "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" "origin" "465 2177 200" } { "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" "origin" "457 1929 200" } { "origin" "881 1649 200" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "673 1649 200" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "-55 1857 200" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "209 1857 200" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "673 2033 -80" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "465 1649 200" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "465 1377 200" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "465 1121 200" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "465 1121 328" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "465 1121 480" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "465 1345 480" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-47 1345 528" } { "origin" "241 1345 528" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "465 1345 528" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" "origin" "241 1345 480" } { "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" "origin" "1057 1649 200" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "465 1345 264" } { "origin" "1049 1649 264" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "673 1649 264" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "-47 1345 480" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "465 1649 264" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "465 1857 264" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "209 1857 264" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "-55 1857 264" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "-367 1849 264" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-631 1289 496" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-807 1689 496" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-295 1369 496" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-263 1641 496" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-663 1849 496" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-367 1849 496" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "865 1649 264" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-663 1841 264" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-623 1537 264" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-335 1505 264" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-391 1273 264" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-671 1281 264" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-991 1281 264" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-991 1025 264" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-991 777 264" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-983 481 264" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "97 -999 296" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-95 -999 296" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-287 -999 296" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-447 -999 296" } { "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" "origin" "-447 -1007 280" } { "origin" "-47 -999 280" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "-247 -999 280" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "321 -999 296" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "-447 -1007 8" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "-447 -863 -72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "-447 -703 -72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" } { "origin" "-455 -551 -72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-479 -215 200" } { "origin" "65 -191 288" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "65 -319 288" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "65 -447 288" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "65 -559 288" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "321 -543 288" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "321 -415 288" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "321 -287 288" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "321 -159 288" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "313 -31 288" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "273 -31 224" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-479 -287 -72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" "origin" "209 -999 280" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-247 -263 -72" } { "origin" "-487 -31 -72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-47 -239 -72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-55 -407 -72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "89 -359 -72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "289 -351 -72" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "257 -311 88" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "257 -311 224" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "329 113 224" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "65 -79 288" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "265 -127 224" } { "origin" "441 -127 224" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "41 -127 224" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-247 -55 -72" } { "origin" "433 -311 224" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "33 -311 224" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "257 -511 224" } { "origin" "433 -511 224" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "33 -511 224" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "449 -31 224" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "225 -631 224" } { "origin" "369 281 224" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-239 -511 224" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-487 -479 224" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-239 -175 200" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "-479 -31 152" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-479 193 104" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-255 193 104" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "1 185 104" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-23 513 120" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-135 737 168" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-335 849 200" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-599 937 264" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-599 481 320" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "-599 713 264" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-599 481 264" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "217 -855 224" } { "origin" "-2223 465 40" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-2199 465 264" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "style" "1" "targetname" "t105" "classname" "func_areaportal" } { "origin" "-423 1761 560" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "-671 1281 368" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-311 1601 304" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-391 1345 560" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-671 1281 560" } { "origin" "-983 1281 368" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-983 1281 560" } { "origin" "-991 961 368" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-991 961 560" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-983 481 320" } { "origin" "-831 1273 496" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-655 1585 368" } { "origin" "-1471 1993 512" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-1471 465 264" } { "origin" "-1471 465 320" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "-1831 465 264" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-255 481 264" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-1463 -1655 208" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-1687 177 264" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-1951 177 264" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb23" } { "origin" "-1439 177 320" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "classname" "info_player_deathmatch" "origin" "1830 411 152" } { "classname" "info_player_deathmatch" "angle" "270" "origin" "1216 1273 -168" } { "classname" "info_player_deathmatch" "angle" "270" "origin" "687 2089 -160" } { "classname" "info_player_deathmatch" "angle" "135" "origin" "-191 1244 152" } { "classname" "info_player_deathmatch" "angle" "270" "origin" "-481 25 -104" } { "classname" "info_player_deathmatch" "origin" "480 297 152" } { "classname" "info_player_deathmatch" "angle" "135" "origin" "37 86 -8" } { "classname" "info_player_deathmatch" "origin" "-601 1008 152" } { "angle" "135" "classname" "info_player_deathmatch" "origin" "-1282 1 152" } { "classname" "info_player_deathmatch" "angle" "270" "origin" "-2415 33 24" } { "classname" "info_player_deathmatch" "origin" "-1249 -152 152" } { "classname" "info_player_deathmatch" "origin" "-1050 -961 24" } { "origin" "-1800 464 368" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-1831 465 320" } { "origin" "-1832 432 368" "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" } { "origin" "-1864 464 368" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "origin" "-1832 496 368" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "origin" "-1440 464 368" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "origin" "-1472 432 368" "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" } { "origin" "-1504 464 368" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "origin" "-1472 496 368" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-599 849 320" } { "origin" "-1615 -239 256" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "-1359 -479 256" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "-1623 -511 256" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "-2111 -455 256" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "-2175 -759 256" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "-1927 -807 256" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "-1663 -807 256" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "-1383 -807 256" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "-1879 -647 256" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "-1735 -1023 256" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "-1983 -1023 256" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "-2367 -639 256" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "-2367 -127 256" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "origin" "-2367 -383 256" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "classname" "target_secret" "message" "You found another secret." "spawnflags" "2048" "targetname" "t104" "origin" "-2020 573 72" } { "target" "t104" "spawnflags" "0" "classname" "item_quad" "origin" "-1954 464 16" } { "classname" "target_secret" "message" "You've found a secret." "targetname" "t103" "spawnflags" "2048" "origin" "-1834 388 296" } { "classname" "path_corner" "wait" "-1" "origin" "-1984 328 96" "target" "t101" "targetname" "t102" } { "classname" "path_corner" "wait" "-1" "origin" "-1984 328 80" "targetname" "t101" "target" "t102" } { "classname" "target_speaker" "noise" "world/dr_short" "attenuation" "3" "volume" "1" "origin" "-1992 456 256" "targetname" "t99" } { "model" "*47" "classname" "func_explosive" "health" "25" "dmg" "50" "target" "t103" "spawnflags" "2048" } { "classname" "trigger_relay" "targetname" "t83" "target" "t99" "origin" "-1968 448 256" } { "classname" "trigger_relay" "targetname" "t83" "target" "t100" "origin" "-1960 424 256" } { "model" "*48" "classname" "func_train" "spawnflags" "2" "target" "t86" "targetname" "t100" "team" "secretx" } { "model" "*49" "classname" "func_train" "spawnflags" "2" "target" "t88" "targetname" "t100" "team" "secretx" } { "model" "*50" "classname" "func_train" "spawnflags" "2" "target" "t90" "targetname" "t100" "team" "secretx" } { "model" "*51" "classname" "func_train" "spawnflags" "2" "target" "t92" "targetname" "t100" "team" "secretx" } { "model" "*52" "classname" "func_train" "spawnflags" "2" "target" "t94" "targetname" "t100" "team" "secretx" } { "model" "*53" "classname" "func_train" "spawnflags" "2" "targetname" "t100" "team" "secretx" "target" "t102" } { "classname" "path_corner" "targetname" "t93" "target" "t94" "origin" "-2016 328 64" "wait" "-1" } { "classname" "path_corner" "targetname" "t91" "target" "t92" "origin" "-2048 328 48" "wait" "-1" } { "classname" "path_corner" "targetname" "t89" "target" "t90" "origin" "-2080 328 32" "wait" "-1" } { "classname" "path_corner" "targetname" "t87" "target" "t88" "origin" "-2112 328 16" "wait" "-1" } { "classname" "path_corner" "targetname" "t85" "target" "t86" "origin" "-2144 328 0" "wait" "-1" } { "classname" "path_corner" "target" "t85" "targetname" "t86" "origin" "-2144 328 96" "wait" "-1" } { "classname" "path_corner" "target" "t87" "targetname" "t88" "origin" "-2112 328 96" "wait" "-1" } { "classname" "path_corner" "target" "t89" "targetname" "t90" "origin" "-2080 328 96" "wait" "-1" } { "classname" "path_corner" "target" "t91" "targetname" "t92" "origin" "-2048 328 96" "wait" "-1" } { "classname" "path_corner" "target" "t93" "targetname" "t94" "origin" "-2016 328 96" "wait" "-1" } { "model" "*54" "classname" "func_door" "angle" "180" "lip" "148" "targetname" "t99" "speed" "100" "spawnflags" "32" "wait" "-1" "_minlight" ".1" } { "model" "*55" "classname" "trigger_once" "target" "t84" "spawnflags" "2048" } { "model" "*56" "target" "t146" "classname" "func_door" "angle" "-1" "wait" "-1" "targetname" "t84" "speed" "200" "spawnflags" "2048" } { "model" "*57" "target" "t83" "health" "1" "lip" "8" "angle" "0" "classname" "func_button" } { "model" "*58" "target" "t83" "health" "1" "lip" "8" "angle" "0" "classname" "func_button" } { "noise" "world/amb23" "spawnflags" "1" "classname" "target_speaker" "origin" "-1935 465 40" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-1695 177 320" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-1951 177 320" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-1887 -159 320" } { "origin" "-2199 465 320" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "origin" "-1463 -1439 256" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "-2367 -895 256" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "-2239 -639 256" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "-2239 -1023 256" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "-1471 -1023 256" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "-2031 -239 256" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "-1895 -383 256" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "-1415 -383 256" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "-1343 -639 256" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "-1215 -1023 256" } { "noise" "world/amb10" "spawnflags" "1" "classname" "target_speaker" "origin" "-1471 -1215 256" } { "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" "origin" "-1311 -159 320" } { "origin" "-1455 -1575 256" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1455 -1767 256" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1199 -1767 256" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-975 -1767 256" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-719 -1767 256" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2383 1 256" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb10" } { "classname" "func_group" } { "classname" "func_group" } { "origin" "-600 480 264" "classname" "light" "light" "150" "_color" "1.000000 0.772549 0.650980" } { "classname" "func_group" } { "model" "*59" "spawnflags" "8" "classname" "func_door" "angle" "-1" "target" "t50" "_minlight" ".1" } { "classname" "func_group" } { "model" "*60" "classname" "func_door" "angle" "-2" "spawnflags" "1" "targetname" "t58" "lip" "32" } { "model" "*61" "classname" "func_button" "angle" "270" "target" "t58" "delay" "1.5" "lip" "4" } { "model" "*62" "classname" "func_door" "angle" "-1" "_minlight" ".1" "spawnflags" "2056" } { "classname" "func_group" } { "classname" "func_group" } { "model" "*63" "target" "t105" "classname" "func_door" "angle" "-1" "_minlight" ".1" "targetname" "t144" } { "targetname" "t178" "origin" "408 -360 -104" "spawnflags" "2050" "classname" "monster_parasite" "angle" "180" } { "targetname" "t178" "origin" "408 -432 -104" "spawnflags" "2306" "angle" "90" "classname" "monster_parasite" } { "style" "2" "classname" "func_areaportal" "targetname" "t50" } { "origin" "432 1976 -24" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" "origin" "464 1944 -24" } { "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" "origin" "496 1976 -24" } { "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" "origin" "464 2008 -24" } { "origin" "840 1752 -104" "classname" "light" "light" "125" "_color" "1.000000 0.866667 0.717647" } { "origin" "912 1664 -104" "classname" "light" "light" "125" "_color" "1.000000 0.866667 0.717647" } { "_color" "1.000000 0.866667 0.717647" "light" "125" "classname" "light" "origin" "1248 1616 -104" } { "_color" "1.000000 0.866667 0.717647" "light" "150" "classname" "light" "origin" "624 1996 -104" } { "_color" "1.000000 0.866667 0.717647" "light" "150" "classname" "light" "origin" "464 2144 -104" } { "_color" "1.000000 0.866667 0.717647" "light" "125" "classname" "light" "origin" "464 2016 200" } { "model" "*64" "targetname" "t244" "_minlight" ".1" "spawnflags" "8" "target" "t49" "angle" "-1" "classname" "func_door" } { "style" "3" "targetname" "t49" "classname" "func_areaportal" } { "origin" "464 1120 200" "classname" "light" "light" "150" "_color" "1.000000 0.866667 0.717647" } { "origin" "464 1280 200" "classname" "light" "light" "150" "_color" "1.000000 0.866667 0.717647" } { "origin" "464 1152 560" "classname" "light" "light" "75" "_color" "1.000000 0.866667 0.717647" } { "origin" "520 1248 176" "delay" "2" "target" "t46" "targetname" "t45" "classname" "trigger_relay" } { "model" "*65" "target" "t45" "classname" "func_button" "angle" "270" "lip" "4" } { "model" "*66" "lip" "24" "spawnflags" "0" "targetname" "t46" "angle" "-1" "classname" "func_door" "_minlight" ".05" } { "origin" "1428 1616 -160" "classname" "light" "light" "150" "_color" "1.000000 0.866667 0.717647" } { "origin" "-48 1312 576" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "-80 1344 576" "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" } { "origin" "-16 1344 576" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "-48 1376 576" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "-48 1344 416" "classname" "light" "light" "125" "_color" "1.000000 0.866667 0.717647" } { "origin" "464 1312 576" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "432 1344 576" "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" } { "origin" "496 1344 576" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "464 1376 576" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "464 1344 416" "classname" "light" "light" "125" "_color" "1.000000 0.866667 0.717647" } { "origin" "464 1648 144" "classname" "light" "light" "125" "_color" "1.000000 0.866667 0.717647" } { "origin" "432 1648 304" "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" } { "origin" "464 1680 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "496 1648 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "464 1616 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "464 2212 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "496 2180 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "464 2148 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "432 2180 304" "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" } { "origin" "464 1888 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "delay" "2" "origin" "520 2064 -168" "target" "t42" "targetname" "t44" "classname" "trigger_relay" } { "model" "*67" "target" "t44" "angle" "90" "lip" "4" "classname" "func_button" } { "model" "*68" "lip" "8" "spawnflags" "1" "targetname" "t42" "angle" "-2" "classname" "func_door" } { "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" "origin" "208 1888 304" } { "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" "origin" "240 1856 304" } { "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" "origin" "176 1856 304" } { "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" "origin" "208 1824 304" } { "origin" "208 1856 144" "classname" "light" "light" "125" "_color" "1.000000 0.866667 0.717647" } { "_color" "1.000000 0.866667 0.717647" "light" "125" "classname" "light" "origin" "464 1120 304" } { "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" "origin" "496 1856 304" } { "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" "origin" "432 1856 304" } { "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" "origin" "464 1824 304" } { "origin" "464 1856 144" "classname" "light" "light" "125" "_color" "1.000000 0.866667 0.717647" } { "origin" "-48 1824 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "-80 1856 304" "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" } { "origin" "-48 1888 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "-16 1856 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" "origin" "240 1312 576" } { "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" "origin" "272 1344 576" } { "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" "origin" "240 1376 576" } { "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" "origin" "208 1344 576" } { "_color" "1.000000 0.866667 0.717647" "light" "125" "classname" "light" "origin" "240 1344 416" } { "origin" "464 1456 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "496 1424 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "464 1392 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "432 1424 304" "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" } { "origin" "464 1424 144" "classname" "light" "light" "125" "_color" "1.000000 0.866667 0.717647" } { "origin" "672 1680 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "704 1648 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "640 1648 304" "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" } { "origin" "672 1616 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "origin" "672 1648 144" "classname" "light" "light" "125" "_color" "1.000000 0.866667 0.717647" } { "origin" "864 1648 144" "classname" "light" "light" "125" "_color" "1.000000 0.866667 0.717647" } { "origin" "1056 1648 144" "classname" "light" "light" "125" "_color" "1.000000 0.866667 0.717647" } { "origin" "1024 1648 304" "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" } { "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" "origin" "832 1648 304" } { "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" "origin" "864 1616 304" } { "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" "origin" "896 1648 304" } { "_color" "1.000000 0.866667 0.717647" "light" "85" "classname" "light" "origin" "864 1680 304" } { "_color" "1.000000 0.866667 0.717647" "light" "125" "classname" "light" "origin" "-48 1856 144" } { "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" "origin" "1056 1616 304" } { "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" "origin" "1088 1648 304" } { "classname" "light" "light" "85" "_color" "1.000000 0.866667 0.717647" "origin" "1056 1680 304" } { "_color" "1.000000 0.866667 0.717647" "light" "75" "classname" "light" "origin" "496 1120 560" } { "_color" "1.000000 0.866667 0.717647" "light" "75" "classname" "light" "origin" "464 1088 560" } { "_color" "1.000000 0.866667 0.717647" "light" "125" "classname" "light" "origin" "464 1120 384" } { "classname" "light" "light" "75" "_color" "1.000000 0.866667 0.717647" "origin" "432 1120 560" } { "origin" "1544 336 184" "light" "125" "classname" "light" } { "classname" "light" "light" "100" "origin" "1544 264 184" } { "style" "4" "classname" "func_areaportal" "targetname" "t41" } { "model" "*69" "_minlight" ".1" "classname" "func_door" "angle" "180" "team" "exit1" } { "model" "*70" "_minlight" ".1" "classname" "func_door" "angle" "0" "team" "exit1" "target" "t41" } { "origin" "-312 -1000 360" "classname" "light" "light" "50" "_color" "1.000000 0.868526 0.721116" } { "_color" "1.000000 0.868526 0.721116" "light" "50" "classname" "light" "origin" "344 -1000 360" } { "_color" "1.000000 0.868526 0.721116" "light" "50" "classname" "light" "origin" "-96 -976 360" } { "_color" "1.000000 0.868526 0.721116" "light" "50" "classname" "light" "origin" "-120 -1000 360" } { "_color" "1.000000 0.868526 0.721116" "light" "50" "classname" "light" "origin" "-72 -1000 360" } { "_color" "1.000000 0.868526 0.721116" "light" "50" "classname" "light" "origin" "-96 -1024 360" } { "_color" "1.000000 0.868526 0.721116" "light" "50" "classname" "light" "origin" "-288 -976 360" } { "_color" "1.000000 0.868526 0.721116" "light" "50" "classname" "light" "origin" "-448 -1000 312" } { "_color" "1.000000 0.868526 0.721116" "light" "50" "classname" "light" "origin" "-264 -1000 360" } { "_color" "1.000000 0.868526 0.721116" "light" "50" "classname" "light" "origin" "-288 -1024 360" } { "origin" "296 -1000 360" "classname" "light" "light" "50" "_color" "1.000000 0.868526 0.721116" } { "origin" "320 -976 360" "classname" "light" "light" "50" "_color" "1.000000 0.868526 0.721116" } { "origin" "320 -1024 360" "classname" "light" "light" "50" "_color" "1.000000 0.868526 0.721116" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-2200 496 368" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-2168 464 368" } { "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" "origin" "-2200 432 368" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-2232 464 368" } { "origin" "-1696 208 424" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "origin" "-1664 176 424" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "origin" "-1696 144 424" "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" } { "origin" "-1728 176 424" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "origin" "-1440 208 424" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "origin" "-1408 176 424" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "origin" "-1440 144 424" "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" } { "origin" "-1472 176 424" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "origin" "-1472 2024 576" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "origin" "-1440 1992 576" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "origin" "-1472 1960 576" "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" } { "origin" "-1504 1992 576" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" "origin" "-984 1248 624" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-952 1280 624" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-984 1312 624" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-1016 1280 624" } { "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" "origin" "-672 1248 624" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-640 1280 624" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-672 1312 624" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-704 1280 624" } { "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" "origin" "-384 1312 624" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-352 1344 624" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-384 1376 624" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-416 1344 624" } { "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" "origin" "-416 1728 624" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-384 1760 624" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-416 1792 624" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-448 1760 624" } { "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" "origin" "-1952 144 424" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-1920 176 424" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-1952 208 424" } { "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" "origin" "-1984 176 424" } { "light" "125" "classname" "light" "origin" "-416 1304 236" } { "origin" "-312 1440 164" "classname" "light" "light" "150" } { "origin" "-1016 960 624" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "origin" "-984 992 624" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "origin" "-952 960 624" "classname" "light" "light" "100" "_color" "1.000000 0.877953 0.799213" } { "origin" "-984 928 624" "_color" "1.000000 0.877953 0.799213" "light" "100" "classname" "light" } { "light" "125" "classname" "light" "origin" "-312 1384 236" } { "origin" "-984 1088 264" "classname" "light" "light" "150" } { "origin" "-984 904 264" "classname" "light" "light" "170" } { "origin" "-984 1280 264" "light" "150" "classname" "light" } { "light" "150" "classname" "light" "origin" "-256 1440 228" } { "_color" "0.515748 0.818898 1.000000" "origin" "-224 1304 236" "classname" "light" "light" "125" } { "classname" "light" "light" "125" "origin" "-312 1440 292" } { "origin" "-312 1880 228" "classname" "light" "light" "150" } { "light" "150" "classname" "light" "origin" "-224 1856 196" } { "origin" "-608 1632 416" "classname" "light" "light" "265" "_color" "1.000000 0.772549 0.650980" } { "light" "150" "classname" "light" "origin" "-552 1880 228" } { "light" "150" "classname" "light" "origin" "-312 1632 164" } { "light" "150" "classname" "light" "origin" "-312 1824 164" } { "light" "150" "classname" "light" "origin" "-552 1824 164" } { "origin" "-576 1248 292" "classname" "light" "light" "125" } { "origin" "-312 1632 292" "light" "125" "classname" "light" } { "origin" "-312 1824 292" "light" "125" "classname" "light" } { "origin" "-552 1824 292" "light" "125" "classname" "light" } { "origin" "-728 1824 292" "light" "125" "classname" "light" } { "origin" "-256 1632 228" "classname" "light" "light" "150" } { "origin" "-728 1880 228" "classname" "light" "light" "150" } { "origin" "-728 1824 164" "classname" "light" "light" "125" } { "origin" "-576 1248 164" "light" "150" "classname" "light" } { "origin" "-984 568 216" "classname" "light" "light" "100" "_color" "1.000000 0.772549 0.650980" } { "origin" "-472 -440 -80" "classname" "light" "_color" "1.000000 0.654902 0.309804" "light" "150" } { "_color" "1.000000 0.772549 0.650980" "light" "115" "classname" "light" "origin" "-448 -972 -72" } { "_color" "1.000000 0.772549 0.650980" "light" "125" "classname" "light" "origin" "64 -192 296" } { "light" "125" "_color" "1.000000 0.654902 0.309804" "classname" "light" "origin" "-424 -480 -80" } { "light" "150" "_color" "1.000000 0.654902 0.309804" "classname" "light" "origin" "-472 -248 -80" } { "classname" "light" "_color" "0.541176 0.772549 1.000000" "light" "100" "origin" "248 -800 168" } { "origin" "64 -448 296" "classname" "light" "light" "125" "_color" "1.000000 0.772549 0.650980" } { "origin" "64 -320 296" "classname" "light" "light" "125" "_color" "1.000000 0.772549 0.650980" } { "origin" "-448 -1000 96" "classname" "light" "light" "100" "_color" "1.000000 0.772549 0.650980" } { "origin" "64 -80 296" "classname" "light" "light" "125" "_color" "1.000000 0.772549 0.650980" } { "origin" "-600 568 240" "classname" "light" "light" "100" "_color" "1.000000 0.772549 0.650980" } { "model" "*71" "classname" "trigger_once" "target" "t37" "spawnflags" "2048" } { "model" "*72" "target" "t178" "classname" "func_door" "angle" "-2" "lip" "2" "targetname" "t37" "wait" "-1" "spawnflags" "2048" } { "_color" "1.000000 1.000000 0.866667" "light" "100" "classname" "light" "origin" "-356 224 56" } { "classname" "light" "light" "100" "_color" "1.000000 1.000000 0.866667" "origin" "-156 224 56" } { "origin" "-472 -104 -80" "classname" "light" "_color" "1.000000 0.654902 0.309804" "light" "150" } { "origin" "-456 24 -80" "light" "125" "_color" "1.000000 0.654902 0.309804" "classname" "light" } { "light" "150" "_color" "1.000000 0.858824 0.717647" "classname" "light" "origin" "-240 -104 -80" } { "classname" "light" "_color" "1.000000 0.858824 0.717647" "light" "125" "origin" "-240 -248 -80" } { "origin" "-16 528 248" "classname" "light" "light" "100" "_color" "1.000000 0.772549 0.650980" } { "origin" "-88 664 248" "classname" "light" "light" "100" "_color" "1.000000 0.772549 0.650980" } { "origin" "-192 792 248" "classname" "light" "light" "100" "_color" "1.000000 0.772549 0.650980" } { "origin" "-336 856 248" "classname" "light" "light" "100" "_color" "1.000000 0.772549 0.650980" } { "origin" "-344 856 120" "classname" "light" "light" "100" "_color" "1.000000 0.772549 0.650980" } { "_color" "1.000000 0.772549 0.650980" "light" "100" "classname" "light" "origin" "-16 528 32" } { "_color" "1.000000 0.772549 0.650980" "light" "100" "classname" "light" "origin" "-88 664 64" } { "_color" "1.000000 0.772549 0.650980" "light" "100" "classname" "light" "origin" "-184 792 96" } { "_color" "1.000000 0.772549 0.650980" "light" "100" "classname" "light" "origin" "0 352 248" } { "_color" "1.000000 0.772549 0.650980" "light" "125" "classname" "light" "origin" "64 -560 296" } { "origin" "0 352 0" "classname" "light" "light" "100" "_color" "1.000000 0.772549 0.650980" } { "_color" "1.000000 0.772549 0.650980" "light" "115" "classname" "light" "origin" "-600 852 264" } { "origin" "-984 480 264" "classname" "light" "light" "150" "_color" "1.000000 0.772549 0.650980" } { "_color" "1.000000 1.000000 0.835294" "light" "100" "classname" "light" "origin" "-1176 480 208" } { "origin" "-792 480 208" "classname" "light" "light" "100" "_color" "1.000000 1.000000 0.835294" } { "origin" "-256 480 208" "_color" "0.149020 0.596078 1.000000" "light" "100" "classname" "light" } { "model" "*73" "wait" "2" "targetname" "t270" "classname" "func_door" "angle" "-1" "target" "t34" "_minlight" ".1" "spawnflags" "0" } { "style" "5" "classname" "func_areaportal" "targetname" "t34" } { "origin" "160 -736 160" "light" "75" "classname" "light" } { "origin" "-920 -896 24" "_color" "1.000000 0.793522 0.655870" "light" "150" "classname" "light" } { "model" "*74" "spawnflags" "2048" "target" "t249" "speed" "50" "targetname" "t1" "lip" "-112" "angle" "-1" "classname" "func_door" "wait" "-1" "team" "bigdoor1" } { "model" "*75" "spawnflags" "2048" "wait" "-1" "speed" "50" "targetname" "t1" "lip" "-52" "angle" "-1" "classname" "func_door" "team" "bigdoor1" } { "model" "*76" "spawnflags" "2048" "wait" "-1" "speed" "50" "targetname" "t1" "angle" "-1" "classname" "func_door" "team" "bigdoor1" } { "model" "*77" "angle" "180" "classname" "func_door" "team" "baddoor" "spawnflags" "8" } { "model" "*78" "angle" "0" "classname" "func_door" "team" "baddoor" "spawnflags" "8" } { "classname" "light" "light" "125" "_color" "1.000000 0.586614 0.338583" "origin" "320 -1376 256" } { "classname" "light" "light" "125" "_color" "1.000000 0.586614 0.338583" "origin" "320 -1216 256" } { "classname" "info_player_coop" "targetname" "w_treat" "angle" "90" "origin" "320 -1280 248" } { "origin" "320 -1352 248" "angle" "90" "targetname" "w_treat" "classname" "info_player_coop" } { "model" "*79" "message" "A door has opened." "wait" "-1" "target" "t328" "spawnflags" "2048" "lip" "12" "angle" "0" "classname" "func_button" } { "classname" "light" "light" "100" "_color" "0.149020 0.596078 1.000000" "origin" "-224 480 168" }xatrix-XATRIX_2_14/stuff/mapfixes/w_treat.ent000066400000000000000000002005741477320050300212700ustar00rootroot00000000000000// FIXED ENTITY STRING (by BjossiAlfreds) // // 1. Fixed an inaccessible monster_soldier_hypergun (861) // // He is part of a 3-man hypergun soldier group. The other two guys // both have a targetname t70 while the 3rd guy has none. It was most // likely intended for him to have t70 as well so I did just that. { "sounds" "2" "nextmap" "badlands" "sky" "x1u4" "Message" "Water Treatment Plant" "classname" "worldspawn" } { "killtarget" "rocketwall" "classname" "trigger_relay" "targetname" "t70" "origin" "-1328 -1304 312" } { "classname" "trigger_relay" "targetname" "t57" "killtarget" "rocketwall" "origin" "-768 -2416 -88" } { "model" "*1" "classname" "func_wall" "spawnflags" "2054" "targetname" "t5" } { "origin" "24 -1448 -16" "spawnflags" "2048" "classname" "misc_explobox" } { "origin" "-520 -1792 -16" "spawnflags" "2048" "classname" "misc_explobox" } { "origin" "-3200 -360 304" "noise" "world/chatter4" "volume" "1" "attenuation" "-1" "spawnflags" "2052" "targetname" "t95" "classname" "target_speaker" } { "origin" "-3200 -312 304" "target" "t94" "targetname" "t16" "classname" "trigger_relay" } { "origin" "-3200 -336 304" "delay" ".5" "target" "t95" "targetname" "t16" "classname" "trigger_relay" } { "origin" "-1324 -2092 -12" "targetname" "t59" "classname" "info_notnull" } { "origin" "-3208 -320 248" "angle" "0" "classname" "info_player_start" } { "angle" "0" "classname" "info_player_coop" "origin" "-3344 -320 248" "targetname" "industry" } { "angle" "0" "classname" "info_player_coop" "origin" "-3280 -320 248" "targetname" "industry" } { "classname" "info_player_coop" "targetname" "industry" "angle" "0" "origin" "-3416 -320 248" } { "angle" "270" "classname" "info_player_coop" "origin" "1792 24 -120" "targetname" "badlands" } { "angle" "270" "classname" "info_player_coop" "origin" "1792 112 -120" "targetname" "badlands" } { "classname" "info_player_coop" "angle" "270" "targetname" "badlands" "origin" "1792 192 -120" } { "origin" "1456 -920 16" "classname" "light" "_color" "1.000000 0.482353 0.019608" "light" "60" } { "origin" "1312 -968 16" "classname" "light" "_color" "1.000000 0.482353 0.019608" "light" "70" } { "origin" "1120 -968 16" "classname" "light" "_color" "1.000000 0.482353 0.019608" "light" "70" } { "origin" "976 -888 16" "classname" "light" "_color" "1.000000 0.482353 0.019608" "light" "70" } { "origin" "976 -200 16" "classname" "light" "_color" "1.000000 0.482353 0.019608" "light" "70" } { "origin" "1120 -136 16" "classname" "light" "_color" "1.000000 0.482353 0.019608" "light" "70" } { "origin" "1312 -136 16" "classname" "light" "_color" "1.000000 0.482353 0.019608" "light" "70" } { "origin" "1456 -184 16" "classname" "light" "_color" "1.000000 0.482353 0.019608" "light" "70" } { "origin" "1568 -296 16" "classname" "light" "_color" "1.000000 0.482353 0.019608" "light" "70" } { "origin" "1680 -184 16" "classname" "light" "_color" "1.000000 0.482353 0.019608" "light" "70" } { "origin" "1792 -136 16" "classname" "light" "_color" "1.000000 0.482353 0.019608" "light" "70" } { "origin" "1904 -248 16" "classname" "light" "_color" "1.000000 0.482353 0.019608" "light" "70" } { "origin" "1904 -856 16" "classname" "light" "_color" "1.000000 0.482353 0.019608" "light" "70" } { "origin" "1680 -920 16" "classname" "light" "_color" "1.000000 0.482353 0.019608" "light" "70" } { "origin" "1792 -968 16" "classname" "light" "_color" "1.000000 0.482353 0.019608" "light" "70" } { "origin" "1568 -808 16" "light" "70" "_color" "1.000000 0.482353 0.019608" "classname" "light" } { "model" "*2" "classname" "func_wall" "spawnflags" "1792" } { "model" "*3" "spawnflags" "1792" "classname" "func_wall" } { "model" "*4" "spawnflags" "1792" "classname" "func_wall" } { "model" "*5" "spawnflags" "2048" "classname" "func_wall" } { "origin" "-472 -1324 16" "_color" "1.000000 0.482353 0.019608" "light" "85" "classname" "light" } { "origin" "-720 -592 24" "message" "Maintenance hatch\n override enabled." "target" "t3" "targetname" "t93" "classname" "trigger_relay" } { "model" "*6" "health" "1" "lip" "4" "wait" "-1" "angle" "-1" "spawnflags" "2056" "classname" "func_door" } { "model" "*7" "spawnflags" "2048" "target" "t93" "health" "1" "classname" "func_explosive" } { "classname" "misc_explobox" "spawnflags" "2048" "origin" "24 -1408 -16" } { "model" "*8" "spawnflags" "1792" "classname" "func_wall" } { "model" "*9" "targetname" "t92" "spawnflags" "6" "classname" "func_wall" } { "model" "*10" "targetname" "t92" "spawnflags" "6" "classname" "func_wall" } { "model" "*11" "targetname" "t92" "spawnflags" "2049" "classname" "func_object" } { "model" "*12" "targetname" "t92" "spawnflags" "2049" "classname" "func_object" } { "model" "*13" "targetname" "t92" "classname" "func_explosive" } { "model" "*14" "targetname" "t92" "spawnflags" "2049" "classname" "func_object" } { "model" "*15" "targetname" "t92" "spawnflags" "2054" "classname" "func_wall" } { "origin" "-864 -1088 232" "spawnflags" "2048" "classname" "weapon_railgun" } { "model" "*16" "health" "20" "target" "t92" "mass" "250" "dmg" "100" "classname" "func_explosive" } { "origin" "1792 -56 -120" "targetname" "badlands" "angle" "270" "classname" "info_player_start" } { "origin" "1808 176 -80" "map" "badlands$w_treat" "targetname" "t91" "classname" "target_changelevel" } { "classname" "monster_soldier_lasergun" "spawnflags" "769" "target" "t73" "origin" "1136 -880 -120" } { "classname" "monster_soldier_lasergun" "target" "t75" "spawnflags" "257" "origin" "1112 -240 -120" } { "classname" "monster_soldier_lasergun" "angle" "0" "spawnflags" "1024" "origin" "-2328 -3200 88" } { "classname" "ammo_shells" "origin" "-2920 -1072 -128" } { "classname" "monster_soldier_hypergun" "angle" "0" "spawnflags" "2" "targetname" "t88" "origin" "-2888 -1112 -120" } { "classname" "monster_gunner" "angle" "90" "spawnflags" "1" "origin" "1792 -888 -120" } { "classname" "target_goal" "targetname" "t89" "origin" "1832 -24 -72" } { "model" "*17" "target" "t91" "angle" "90" "classname" "trigger_multiple" } { "classname" "item_armor_shard" "origin" "560 -1816 -200" } { "classname" "item_armor_shard" "origin" "528 -1864 -200" } { "classname" "item_armor_shard" "origin" "608 -1808 -200" } { "classname" "item_health_small" "origin" "568 -2224 -200" } { "classname" "item_health_small" "origin" "584 -2280 -200" } { "classname" "item_health_small" "origin" "520 -2184 -200" } { "classname" "item_health_small" "origin" "568 -2328 -200" } { "classname" "monster_soldier_lasergun" "angle" "270" "spawnflags" "257" "origin" "-1984 -1296 280" } { "classname" "monster_soldier_lasergun" "angle" "315" "spawnflags" "257" "origin" "-2792 -1344 280" } { "classname" "monster_soldier_lasergun" "angle" "180" "spawnflags" "1" "origin" "-2280 -1368 8" "target" "t87" } { "origin" "-2720 -1088 -48" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "model" "*18" "classname" "func_door" "angle" "-2" "lip" "-16" "speed" "200" "wait" "-1" "targetname" "t87" "sounds" "1" "target" "t88" "spawnflags" "2048" } { "classname" "monster_berserk" "angle" "0" "spawnflags" "769" "origin" "-864 -1456 8" } { "classname" "monster_soldier_lasergun" "angle" "0" "spawnflags" "1" "origin" "-992 -1376 8" } { "classname" "monster_soldier_ripper" "angle" "315" "spawnflags" "769" "origin" "-968 -792 8" } { "spawnflags" "0" "classname" "item_health_small" "origin" "-320 -88 64" } { "spawnflags" "0" "classname" "item_health_small" "origin" "-360 -88 64" } { "classname" "item_health_small" "spawnflags" "0" "origin" "-280 -88 64" } { "spawnflags" "2" "angle" "270" "classname" "monster_berserk" "targetname" "t86" "origin" "-352 -104 72" } { "classname" "monster_berserk" "angle" "270" "spawnflags" "770" "targetname" "t86" "origin" "-288 -104 72" } { "model" "*19" "classname" "func_door" "angle" "-2" "wait" "-1" "speed" "200" "sounds" "1" "lip" "-16" "targetname" "t47" "target" "t86" "spawnflags" "2048" } { "origin" "-416 -1304 64" "spawnflags" "2048" "classname" "item_health" } { "origin" "-800 -3096 -176" "message" "You've found a secret." "targetname" "t85" "classname" "target_secret" } { "origin" "-808 -3104 -256" "target" "t85" "spawnflags" "2048" "classname" "item_adrenaline" } { "origin" "-2840 -2248 -384" "classname" "item_health_large" } { "origin" "-2176 -1296 0" "spawnflags" "2048" "classname" "ammo_shells" } { "origin" "-2016 -1304 0" "classname" "ammo_magslug" "spawnflags" "2048" } { "origin" "-1952 -1304 0" "spawnflags" "2048" "classname" "ammo_magslug" } { "origin" "-1480 -1760 264" "targetname" "t84" "classname" "point_combat" } { "origin" "-1136 -1800 280" "target" "t84" "spawnflags" "2" "targetname" "t83" "angle" "180" "classname" "monster_soldier_lasergun" } { "origin" "-1184 -1720 288" "target" "t83" "targetname" "t63" "classname" "trigger_relay" } { "model" "*20" "angle" "180" "classname" "trigger_monsterjump" } { "origin" "-1480 -1760 264" "targetname" "t82" "classname" "point_combat" } { "origin" "-1136 -1760 280" "targetname" "t63" "spawnflags" "2" "target" "t82" "angle" "180" "classname" "monster_soldier_hypergun" } { "origin" "-1352 -1632 8" "spawnflags" "1" "angle" "0" "classname" "monster_berserk" } { "spawnflags" "1" "origin" "-472 -1248 200" "angle" "180" "classname" "monster_soldier_lasergun" } { "origin" "-992 -1024 0" "spawnflags" "2048" "classname" "item_health" } { "origin" "-1136 -552 64" "classname" "item_health_large" "spawnflags" "2048" } { "origin" "-1136 -600 64" "spawnflags" "2048" "classname" "item_health_large" } { "origin" "-256 -848 72" "spawnflags" "1" "target" "t42" "angle" "90" "classname" "monster_soldier_ripper" } { "origin" "-1344 -816 72" "spawnflags" "769" "target" "t39" "angle" "90" "classname" "monster_soldier_hypergun" } { "origin" "-1440 -816 56" "targetname" "t80" "classname" "point_combat" "spawnflags" "1" } { "origin" "-1248 -816 56" "targetname" "t79" "spawnflags" "1" "classname" "point_combat" } { "origin" "-1248 -864 72" "target" "t79" "classname" "monster_soldier_lasergun" "angle" "90" "spawnflags" "257" } { "origin" "-1440 -864 72" "target" "t80" "spawnflags" "1" "angle" "90" "classname" "monster_soldier_lasergun" } { "origin" "-1344 -880 56" "spawnflags" "1" "targetname" "t78" "classname" "point_combat" } { "model" "*21" "classname" "func_wall" "spawnflags" "2054" "targetname" "rocketwall" } { "classname" "item_armor_body" "spawnflags" "2048" "origin" "2432 -744 -144" } { "classname" "item_health_large" "spawnflags" "2048" "origin" "1728 -936 -128" } { "spawnflags" "0" "classname" "ammo_rockets" "origin" "1856 -935 -128" } { "classname" "monster_gunner" "angle" "270" "spawnflags" "769" "origin" "1792 -192 -120" } { "classname" "monster_soldier_ripper" "angle" "0" "spawnflags" "513" "target" "t76" "origin" "1224 -240 -120" } { "classname" "path_corner" "target" "t75" "targetname" "t76" "origin" "1368 -240 -136" } { "classname" "path_corner" "targetname" "t75" "target" "t76" "origin" "1024 -240 -136" } { "classname" "path_corner" "target" "t73" "targetname" "t74" "origin" "1376 -872 -136" } { "classname" "path_corner" "targetname" "t73" "target" "t74" "origin" "1048 -872 -136" } { "classname" "monster_soldier_ripper" "target" "t74" "spawnflags" "1" "origin" "1424 -872 -120" } { "origin" "704 -2432 264" "spawnflags" "3" "angle" "180" "classname" "monster_gekk" "targetname" "t72" } { "spawnflags" "3" "angle" "135" "classname" "monster_gekk" "origin" "120 -2744 392" "targetname" "t72" } { "spawnflags" "3" "angle" "135" "classname" "monster_gekk" "origin" "24 -2800 392" "targetname" "t72" } { "spawnflags" "3" "angle" "90" "classname" "monster_gekk" "origin" "-472 -2984 392" "targetname" "t72" } { "classname" "monster_gekk" "angle" "180" "spawnflags" "3" "origin" "712 -2360 264" "targetname" "t72" } { "classname" "trigger_relay" "targetname" "t10" "origin" "-2336 -3160 112" "target" "t72" } { "classname" "monster_gunner" "angle" "315" "origin" "-2328 -3200 88" "spawnflags" "768" "targetname" "t90" } { "classname" "monster_soldier_lasergun" "angle" "0" "spawnflags" "1" "origin" "-2336 -3064 -120" } { "classname" "target_secret" "targetname" "t71" "message" "You've found a secret." "origin" "-2080 -1760 -264" } { "classname" "item_invulnerability" "spawnflags" "2048" "target" "t71" "origin" "-2144 -1728 -256" } { "classname" "monster_gunner" "angle" "180" "spawnflags" "1" "origin" "-2464 -1336 -120" } { "classname" "monster_soldier_hypergun" "angle" "180" "spawnflags" "1" "origin" "-2336 -1368 -120" } { "spawnflags" "2" "angle" "180" "classname" "monster_soldier_hypergun" "targetname" "t70" "origin" "-1192 -1448 280" } { "classname" "monster_soldier_hypergun" "angle" "180" "spawnflags" "770" "targetname" "t70" "origin" "-1200 -1512 280" } { "classname" "monster_soldier_hypergun" "spawnflags" "2" "angle" "180" "targetname" "t70" "origin" "-1216 -1232 280" } { "model" "*22" "classname" "trigger_once" "spawnflags" "2048" "target" "t70" } { "model" "*23" "classname" "trigger_once" "spawnflags" "2048" "target" "t69" } { "classname" "monster_soldier_lasergun" "angle" "180" "spawnflags" "2" "target" "t67" "targetname" "t69" "origin" "-1168 -1624 280" } { "classname" "monster_soldier_lasergun" "angle" "135" "spawnflags" "770" "target" "t68" "targetname" "t69" "origin" "-1136 -2008 280" } { "classname" "point_combat" "spawnflags" "1" "targetname" "t68" "origin" "-1488 -1952 264" } { "classname" "item_adrenaline" "spawnflags" "2048" "origin" "-2848 -1328 272" } { "classname" "point_combat" "spawnflags" "1" "origin" "-1616 -1608 264" "targetname" "t67" } { "classname" "point_combat" "targetname" "t66" "origin" "-1608 -1472 264" } { "classname" "monster_soldier_hypergun" "angle" "180" "spawnflags" "2" "target" "t66" "targetname" "t70" "origin" "-1224 -1472 280" } { "classname" "trigger_relay" "targetname" "t63" "delay" "2" "origin" "-1752 -1776 160" } { "classname" "point_combat" "targetname" "t65" "origin" "-1608 -2072 264" } { "classname" "monster_soldier_ripper" "angle" "180" "target" "t65" "spawnflags" "2" "targetname" "t63" "origin" "-1488 -2072 280" } { "model" "*24" "classname" "trigger_monsterjump" "angle" "180" } { "classname" "trigger_relay" "targetname" "t63" "target" "t64" "origin" "-1752 -1744 160" } { "model" "*25" "classname" "trigger_once" "target" "t63" } { "classname" "point_combat" "targetname" "t62" "origin" "-1608 -1472 264" } { "model" "*26" "classname" "trigger_monsterjump" "angle" "180" } { "classname" "monster_soldier_hypergun" "angle" "180" "spawnflags" "2" "origin" "-1272 -1472 280" "target" "t62" "targetname" "t64" } { "classname" "path_corner" "target" "t60" "targetname" "t61" "origin" "-1696 -1616 -8" } { "classname" "path_corner" "targetname" "t60" "target" "t61" "origin" "-1696 -1976 -8" } { "classname" "monster_gladiator" "angle" "180" "spawnflags" "1" "target" "t61" "origin" "-1696 -1792 8" } { "classname" "item_health_large" "spawnflags" "2048" "origin" "-1408 -1648 96" } { "classname" "point_combat" "spawnflags" "1" "targetname" "t58" "origin" "-1344 -2128 -8" } { "classname" "monster_gunner" "angle" "270" "spawnflags" "257" "target" "t58" "targetname" "t59" "origin" "-1328 -1912 8" } { "origin" "-1368 -2096 8" "targetname" "t57" "spawnflags" "1" "classname" "monster_berserk" "angle" "315" "target" "t59" } { "origin" "-1328 -2048 8" "targetname" "t57" "spawnflags" "1" "angle" "315" "classname" "monster_berserk" "target" "t59" } { "model" "*27" "target" "t57" "classname" "trigger_once" } { "spawnflags" "0" "classname" "ammo_bullets" "origin" "-537 -2464 160" } { "spawnflags" "0" "classname" "ammo_bullets" "origin" "-537 -2504 160" } { "origin" "-792 -2480 168" "spawnflags" "1" "angle" "90" "classname" "monster_gunner" } { "origin" "-528 -2320 152" "targetname" "t55" "classname" "point_combat" } { "targetname" "t56" "target" "t55" "origin" "-648 -2320 168" "spawnflags" "1" "angle" "0" "classname" "monster_gunner" } { "target" "t56" "origin" "-200 -2232 88" "item" "ammo_cells" "spawnflags" "257" "angle" "45" "classname" "monster_soldier_ripper" } { "origin" "80 -1176 8" "spawnflags" "2817" "angle" "270" "classname" "monster_soldier_ripper" } { "origin" "-400 -1952 64" "classname" "item_armor_shard" "spawnflags" "2048" } { "origin" "-368 -1952 64" "classname" "item_armor_shard" "spawnflags" "2048" } { "origin" "-336 -1952 64" "classname" "item_armor_shard" "spawnflags" "2048" } { "origin" "-432 -1952 64" "spawnflags" "2048" "classname" "item_armor_shard" } { "origin" "-32 -1200 64" "classname" "item_health_small" "spawnflags" "2048" } { "origin" "-32 -1232 64" "classname" "item_health_small" "spawnflags" "2048" } { "origin" "-32 -1264 64" "classname" "item_health_small" "spawnflags" "2048" } { "origin" "-32 -1168 64" "spawnflags" "2048" "classname" "item_health_small" } { "origin" "-520 -1832 -16" "classname" "misc_explobox" "spawnflags" "2048" } { "origin" "-216 -1936 -16" "spawnflags" "2048" "classname" "misc_explobox" } { "origin" "-488 -1904 0" "spawnflags" "2048" "classname" "item_health" } { "origin" "24 -1744 8" "spawnflags" "1" "target" "t54" "angle" "180" "classname" "monster_gladiator" } { "origin" "-16 -1744 -8" "targetname" "t54" "target" "t53" "classname" "path_corner" } { "origin" "-472 -1744 -8" "target" "t54" "targetname" "t53" "classname" "path_corner" } { "origin" "-704 -1504 -8" "target" "t52" "targetname" "t51" "classname" "point_combat" } { "origin" "-704 -1232 -8" "targetname" "t52" "spawnflags" "1" "classname" "point_combat" } { "origin" "-544 -1504 8" "targetname" "t50" "target" "t51" "spawnflags" "257" "angle" "180" "classname" "monster_gunner" } { "origin" "-912 -1184 8" "spawnflags" "257" "angle" "0" "classname" "monster_soldier_ripper" } { "origin" "-992 -1448 0" "spawnflags" "2048" "classname" "ammo_rockets" } { "origin" "-992 -1216 0" "classname" "item_health_small" "spawnflags" "2048" } { "origin" "-992 -1176 0" "classname" "item_health_small" "spawnflags" "2048" } { "origin" "-992 -1256 0" "spawnflags" "2048" "classname" "item_health_small" } { "origin" "-544 -1384 0" "spawnflags" "2048" "classname" "item_health_large" } { "origin" "-560 -1192 -8" "targetname" "t49" "spawnflags" "1" "classname" "point_combat" } { "origin" "-528 -1192 8" "targetname" "t50" "target" "t49" "spawnflags" "1" "angle" "180" "classname" "monster_soldier_lasergun" } { "origin" "-992 -680 8" "target" "t50" "targetname" "t47" "spawnflags" "1" "angle" "0" "classname" "monster_soldier_hypergun" } { "origin" "-480 -1368 248" "message" "You located a secret." "targetname" "t48" "classname" "target_secret" } { "origin" "-480 -1408 256" "target" "t48" "spawnflags" "2048" "classname" "item_quad" } { "origin" "-424 -1344 72" "targetname" "t47" "spawnflags" "1" "angle" "0" "classname" "monster_gunner" } { "origin" "-96 -1000 72" "target" "t47" "spawnflags" "1" "angle" "180" "classname" "monster_soldier_ripper" } { "origin" "-904 -96 328" "classname" "monster_soldier_lasergun" "angle" "270" "spawnflags" "1" } { "origin" "-904 -416 328" "spawnflags" "1" "angle" "90" "classname" "monster_soldier_lasergun" } { "origin" "-2008 -384 72" "item" "ammo_cells" "spawnflags" "1" "angle" "0" "classname" "monster_soldier_ripper" } { "target" "t78" "origin" "-1344 -1000 72" "classname" "monster_gunner" "angle" "90" "spawnflags" "257" } { "origin" "-1792 -1120 72" "item" "item_armor_shard" "target" "t46" "spawnflags" "1" "angle" "90" "classname" "monster_soldier_hypergun" } { "target" "t41" "targetname" "t40" "origin" "-1344 -224 56" "classname" "path_corner" } { "target" "t44" "targetname" "t43" "origin" "-256 -248 56" "classname" "path_corner" } { "target" "t43" "targetname" "t42" "origin" "-256 -800 56" "classname" "path_corner" } { "target" "t42" "targetname" "t41" "origin" "-256 -248 56" "classname" "path_corner" } { "target" "t45" "targetname" "t44" "origin" "-1344 -224 56" "classname" "path_corner" } { "wait" "5" "target" "t40" "targetname" "t39" "origin" "-1344 -768 56" "classname" "path_corner" } { "target" "t39" "targetname" "t38" "origin" "-1344 -224 56" "classname" "path_corner" } { "target" "t38" "targetname" "t37" "origin" "-1792 -224 56" "classname" "path_corner" } { "targetname" "t46" "target" "t37" "origin" "-1792 -1088 56" "classname" "path_corner" } { "target" "t46" "targetname" "t45" "origin" "-1792 -224 56" "classname" "path_corner" } { "origin" "-2136 -880 64" "classname" "item_health" "spawnflags" "2048" } { "origin" "-2176 -880 64" "spawnflags" "2048" "classname" "item_health" } { "origin" "-2240 -448 56" "target" "t35" "targetname" "t34" "classname" "path_corner" } { "origin" "-2368 -448 56" "target" "t34" "targetname" "t33" "classname" "path_corner" } { "origin" "-2240 -448 56" "target" "t33" "targetname" "t32" "classname" "path_corner" } { "origin" "-2240 -168 56" "targetname" "t36" "target" "t32" "classname" "path_corner" } { "origin" "-2240 -768 56" "target" "t36" "targetname" "t35" "classname" "path_corner" } { "item" "ammo_slugs" "origin" "-2192 -160 72" "target" "t36" "spawnflags" "1" "angle" "225" "classname" "monster_gladiator" } { "origin" "-2280 -792 312" "spawnflags" "1" "targetname" "t31" "classname" "point_combat" } { "origin" "-2224 -792 328" "target" "t31" "angle" "180" "classname" "monster_soldier_lasergun" } { "item" "ammo_cells" "origin" "-2424 184 184" "target" "t29" "spawnflags" "769" "angle" "180" "classname" "monster_soldier_ripper" } { "item" "ammo_cells" "origin" "-2240 208 184" "target" "t30" "spawnflags" "1" "classname" "monster_soldier_hypergun" } { "origin" "-2880 208 168" "target" "t27" "targetname" "t26" "classname" "path_corner" } { "origin" "-2896 16 168" "target" "t28" "targetname" "t27" "classname" "path_corner" } { "origin" "-2880 208 168" "target" "t29" "targetname" "t28" "classname" "path_corner" } { "origin" "-2520 208 168" "target" "t26" "targetname" "t25" "classname" "path_corner" } { "origin" "-2280 208 168" "targetname" "t30" "target" "t25" "classname" "path_corner" } { "origin" "-2520 208 168" "target" "t30" "targetname" "t29" "classname" "path_corner" } { "classname" "monster_gunner" "angle" "180" "spawnflags" "257" "target" "t24" "origin" "-2368 -896 72" } { "classname" "path_corner" "targetname" "t17" "target" "t18" "origin" "-2776 -872 72" } { "classname" "path_corner" "targetname" "t18" "target" "t19" "origin" "-2936 -752 136" } { "classname" "path_corner" "targetname" "t19" "target" "t20" "origin" "-2976 -600 184" } { "classname" "path_corner" "targetname" "t21" "target" "t22" "origin" "-2976 -600 184" } { "classname" "path_corner" "targetname" "t22" "target" "t23" "origin" "-2936 -752 136" } { "classname" "path_corner" "targetname" "t23" "target" "t24" "origin" "-2776 -872 72" } { "classname" "path_corner" "target" "t17" "targetname" "t24" "origin" "-2432 -896 56" } { "classname" "path_corner" "targetname" "t20" "target" "t21" "origin" "-2968 -488 216" } { "targetname" "t94" "classname" "target_help" "message" "Locate entrance to\n the Badlands." "origin" "-3232 -280 320" } { "model" "*28" "spawnflags" "2048" "classname" "trigger_once" "target" "t16" } { "classname" "func_group" } { "classname" "func_group" } { "classname" "func_group" } { "origin" "-3434 -288 280" "map" "industry$w_treat" "targetname" "t15" "classname" "target_changelevel" } { "model" "*29" "target" "t15" "angle" "180" "classname" "trigger_multiple" } { "spawnflags" "1792" "classname" "item_bandolier" "origin" "-786 -3106 -256" } { "classname" "weapon_machinegun" "spawnflags" "1792" "origin" "-1545 -97 64" } { "classname" "item_pack" "spawnflags" "0" "origin" "-1513 -1472 -312" } { "classname" "weapon_shotgun" "spawnflags" "1792" "origin" "-1122 -1120 0" } { "classname" "info_player_deathmatch" "angle" "315" "origin" "-1561 -1112 72" } { "classname" "item_quad" "spawnflags" "1792" "origin" "-2144 -1728 -256" } { "classname" "ammo_cells" "spawnflags" "0" "origin" "-1173 -2043 272" } { "classname" "ammo_bullets" "origin" "-1235 -1903 0" } { "classname" "ammo_bullets" "origin" "-1235 -1951 0" } { "classname" "weapon_chaingun" "origin" "-1401 -1920 160" } { "classname" "item_invulnerability" "spawnflags" "1792" "origin" "-480 -1408 256" } { "model" "*30" "classname" "func_wall" "spawnflags" "1792" } { "classname" "weapon_grenadelauncher" "spawnflags" "1792" "origin" "-705 -544 0" } { "classname" "item_silencer" "spawnflags" "0" "origin" "-433 -1512 64" } { "classname" "info_player_intermission" "spawnflags" "1792" "angles" "0 145 0" "origin" "592 -2200 96" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" "origin" "1792 -240 -80" } { "origin" "1064 -536 -80" "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" } { "origin" "1072 -200 -80" "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" } { "origin" "1088 -896 -80" "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" } { "origin" "1400 -896 -80" "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" } { "origin" "1400 -208 -80" "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" } { "origin" "1560 -544 -80" "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" } { "origin" "1792 -848 -80" "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" } { "origin" "1792 -552 -80" "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" } { "origin" "1792 64 -80" "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" } { "origin" "1976 -544 -152" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-2712 -2048 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-2432 -2048 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-2112 -2048 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-2432 -2264 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-2432 -2560 -152" } { "origin" "-2048 -3072 32" "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2304 -3072 32" "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2136 -2832 -152" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2776 -1872 -152" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2432 -2832 -152" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1728 -2832 -152" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1344 -2832 -152" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-936 -2832 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1344 -2832 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1728 -2832 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2136 -2832 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2432 -2832 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2432 -2560 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "1976 -544 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "1640 -544 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "1336 -392 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "1336 -648 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "448 -576 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "768 -560 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "1056 -552 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "448 -960 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "456 -1248 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "632 -1392 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "528 -1600 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "520 -1888 -200" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "448 -2312 -200" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "304 -1432 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "200 -1824 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "216 -2096 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "40 -2360 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "112 -2624 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-240 -2544 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-272 -2784 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-648 -3016 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-520 -2664 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-704 -2832 -216" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "2432 -592 -184" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "2240 -552 -184" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" "origin" "1416 -544 -80" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "1640 -544 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "1336 -648 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "1336 -392 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "1056 -552 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "768 -560 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "448 -576 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "448 -960 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "456 -1248 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "632 -1392 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "304 -1432 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "528 -1600 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "200 -1824 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "520 -1888 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "216 -2096 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "448 -2312 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "40 -2360 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "112 -2624 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-272 -2784 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-240 -2544 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-520 -2664 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-648 -3016 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-704 -2832 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-936 -2832 -152" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" "origin" "-1760 -3072 32" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-2432 -2264 -280" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-2176 -2120 -280" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" "origin" "464 -2184 296" } { "origin" "240 -2328 296" "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-72 -2696 296" "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-616 -2848 296" "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-232 -2400 296" "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" "origin" "840 -2464 488" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" "origin" "-40 -2072 296" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" "origin" "192 -1760 296" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" "origin" "128 -1456 296" } { "origin" "448 -1448 296" "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-664 -2472 376" "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" "origin" "128 -1208 296" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" "origin" "-184 -1760 296" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" "origin" "-456 -1760 296" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-736 -1760 208" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-576 -2432 -56" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-912 -2432 -56" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-1168 -2360 64" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-1328 -2144 104" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-1280 -1792 160" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-1720 -1792 72" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-1856 -2000 -56" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-1904 -1672 -56" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-1160 -768 176" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-1800 -1432 -8" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-1992 -1432 -8" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-2200 -1432 -8" } { "origin" "-1608 -1512 -8" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1824 -1512 -8" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2048 -1512 -8" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-2224 -1600 -96" } { "origin" "-2144 -1600 -96" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-2224 -1728 -168" } { "origin" "-2144 -1728 -168" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1496 -1432 -8" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2224 -1728 -184" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1736 -1512 -8" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1952 -1512 -8" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2144 -1520 -8" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-1832 -1432 -8" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-2048 -1432 -8" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-2224 -1432 -8" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-2224 -1600 -128" } { "origin" "-2144 -1600 -128" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-1440 -1512 -8" } { "origin" "-2144 -1728 -184" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-1536 -1512 -8" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-2168 -1800 -280" } { "origin" "-2528 -1864 -280" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2752 -1880 -280" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2752 -2120 -280" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2432 -2120 -280" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "2432 -864 -184" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1536 -1432 -8" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2184 -1800 -320" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-2016 -1808 -280" } { "origin" "-2464 -1808 -352" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2192 -1696 -56" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb12" "origin" "-1904 -1472 48" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb12" "origin" "-2184 -1472 48" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb12" "origin" "-2184 -1672 48" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb12" "origin" "-1296 -1512 112" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-1968 -1840 -344" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-2432 -1664 -56" } { "origin" "-1912 -1496 56" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2184 -1504 56" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2432 -1456 -56" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-1688 -1496 56" } { "origin" "-2712 -1456 -56" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-2712 -1664 -56" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-2720 -1224 -56" } { "origin" "-1160 -1624 360" "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" "origin" "-1416 -1624 360" } { "origin" "-1408 -1944 360" "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1528 -1376 360" "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1816 -1456 360" "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" "origin" "-1808 -1800 360" } { "origin" "-2128 -1800 352" "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2432 -1800 360" "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" "origin" "-2712 -1800 352" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" "origin" "-2128 -2048 360" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" "origin" "-2432 -2048 360" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" "origin" "-2432 -1456 360" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" "origin" "-2712 -1456 360" } { "origin" "-2128 -1456 360" "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1744 -2040 360" "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2712 -2048 360" "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2" "origin" "-1152 -1944 360" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-2720 -1248 -48" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb12" "origin" "-1200 -1320 112" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb12" "origin" "-1456 -1240 112" } { "origin" "-1392 -1472 -296" "noise" "world/water1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1384 -1472 -184" "noise" "world/amb12" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1656 -1480 48" "noise" "world/amb12" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1344 -1368 176" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1344 -1152 176" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "576 -1768 296" "noise" "world/wind2" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1" "origin" "-1392 -1472 -160" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-2600 -1088 -56" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-2336 -1088 8" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-2088 -1088 96" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-1856 -1088 144" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-1792 -936 144" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-1792 -768 176" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-2872 -1112 -48" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-2560 -1088 -48" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-2368 -1088 16" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-2176 -1088 72" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-1968 -1088 144" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-1792 -1088 144" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-1792 -960 144" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-1976 -768 176" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" "origin" "-376 -424 432" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" "origin" "-512 -576 432" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb14" "origin" "-736 -664 432" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-640 -704 256" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-992 -1216 112" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-904 -112 176" } { "origin" "-832 -1024 256" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-832 -704 256" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-552 -256 432" "noise" "world/amb14" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-536 -656 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-704 -544 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-896 -544 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-992 -640 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-992 -832 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-992 -1024 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-992 -1408 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-384 -1504 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-192 -1504 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-96 -1408 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-96 -1216 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-96 -1024 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-96 -832 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-256 -680 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-256 -488 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-256 -256 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-680 -256 112" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-904 -400 176" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-904 -256 360" "noise" "world/fan1" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1160 -112 176" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1344 -768 176" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1352 -512 176" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1344 -256 176" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1792 -256 176" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-1792 -512 176" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2.wav" "origin" "-2480 -784 336" } { "origin" "-1528 -1792 72" "noise" "world/amb8" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-1160 -576 176" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-640 -1024 256" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-1352 -112 176" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-1544 -112 176" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-1736 -112 176" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-1928 -112 176" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-1976 -384 176" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-1976 -576 176" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb8" "origin" "-1568 -256 176" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-2176 -672 128" } { "origin" "-1344 -960 152" "noise" "world/amb7" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2200 80 -56" "noise" "world/water1.wav" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2512 152 -56" "noise" "world/water1.wav" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2776 96 -56" "noise" "world/water1.wav" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2736 -312 -56" "noise" "world/water1.wav" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2464 -616 -56" "noise" "world/water1.wav" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2792 -664 -56" "noise" "world/water1.wav" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2816 -768 408" "noise" "world/wind2.wav" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2.wav" "origin" "-2296 -440 536" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2.wav" "origin" "-2200 -760 536" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb7" "origin" "-2176 -288 128" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/water1.wav" "origin" "-2408 -192 -56" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2.wav" "origin" "-2920 -544 536" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2.wav" "origin" "-2880 -328 536" } { "origin" "-2880 208 536" "noise" "world/wind2.wav" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2920 -40 536" "noise" "world/wind2.wav" "spawnflags" "1" "classname" "target_speaker" } { "origin" "-2184 -72 536" "noise" "world/wind2.wav" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "noise" "world/wind2.wav" "origin" "-2288 184 496" } { "origin" "2160 -544 -120" "targetname" "t14" "message" "You've found a secret." "spawnflags" "2048" "classname" "target_secret" } { "model" "*31" "spawnflags" "1792" "classname" "func_wall" } { "model" "*32" "target" "t14" "spawnflags" "2048" "health" "25" "classname" "func_explosive" } { "origin" "1792 -935 -128" "classname" "ammo_rockets" "spawnflags" "2048" } { "origin" "1728 -935 -128" "spawnflags" "1792" "classname" "ammo_rockets" } { "origin" "1792 -935 -128" "spawnflags" "1792" "classname" "weapon_rocketlauncher" } { "origin" "1247 -903 -128" "classname" "item_health_small" "spawnflags" "0" } { "origin" "1183 -903 -128" "classname" "item_health_small" "spawnflags" "0" } { "origin" "1119 -903 -128" "classname" "item_health_small" "spawnflags" "0" } { "origin" "1311 -903 -128" "spawnflags" "0" "classname" "item_health_small" } { "origin" "-991 -639 0" "spawnflags" "0" "classname" "ammo_rockets" } { "origin" "-1125 -419 64" "spawnflags" "1792" "classname" "ammo_rockets" } { "origin" "-2176 -1297 0" "spawnflags" "1792" "classname" "ammo_rockets" } { "spawnflags" "0" "classname" "ammo_cells" "origin" "-2466 -1813 -384" } { "origin" "-1120 -1505 0" "classname" "item_health_large" } { "classname" "item_health_large" "origin" "-1120 -1457 0" } { "model" "*33" "spawnflags" "2048" "classname" "func_wall" } { "model" "*34" "spawnflags" "1792" "classname" "func_wall" } { "model" "*35" "spawnflags" "1792" "classname" "func_wall" } { "model" "*36" "spawnflags" "2048" "classname" "func_wall" } { "origin" "171 -1234 0" "classname" "item_health_large" "spawnflags" "1792" } { "origin" "171 -1186 0" "classname" "item_health_large" "spawnflags" "0" } { "origin" "171 -1282 0" "classname" "item_health_large" "spawnflags" "1792" } { "origin" "-537 -2424 160" "classname" "ammo_bullets" "spawnflags" "0" } { "origin" "-538 -2462 160" "classname" "weapon_machinegun" "spawnflags" "1792" } { "model" "*37" "spawnflags" "2048" "classname" "func_wall" } { "spawnflags" "0" "classname" "item_health_large" "origin" "-1760 -3240 80" } { "model" "*38" "spawnflags" "2048" "classname" "func_wall" } { "origin" "-2718 -313 -80" "spawnflags" "0" "classname" "item_armor_jacket" } { "origin" "-2217 -15 16" "spawnflags" "0" "classname" "item_health_small" } { "origin" "-2185 -15 16" "spawnflags" "0" "classname" "item_health_small" } { "origin" "-2153 -15 16" "spawnflags" "0" "classname" "item_health_small" } { "origin" "-2249 -15 16" "spawnflags" "0" "classname" "item_health_small" } { "origin" "-1120 -1553 0" "classname" "item_health_large" } { "angle" "90" "origin" "-992 -1445 8" "classname" "info_player_deathmatch" } { "targetname" "t13" "origin" "830 -2642 264" "spawnflags" "1792" "angle" "90" "classname" "misc_teleporter_dest" } { "target" "t13" "origin" "-2321 -3200 88" "spawnflags" "1792" "classname" "misc_teleporter" } { "origin" "-872 -1946 0" "classname" "ammo_grenades" } { "origin" "-992 -832 0" "classname" "ammo_grenades" } { "origin" "-1154 -1904 136" "classname" "item_armor_combat" } { "model" "*39" "_minlight" ".1" "team" "xitdoor" "angle" "0" "classname" "func_door" "spawnflags" "8" } { "model" "*40" "_minlight" ".1" "team" "xitdoor" "angle" "180" "classname" "func_door" "spawnflags" "8" "target" "t89" } { "origin" "-1655 -863 64" "spawnflags" "0" "classname" "ammo_bullets" } { "origin" "-1695 -863 64" "spawnflags" "1792" "classname" "ammo_bullets" } { "origin" "-2100 -575 64" "spawnflags" "1792" "classname" "weapon_supershotgun" } { "origin" "-2086 -428 64" "spawnflags" "1792" "classname" "ammo_shells" } { "origin" "-2086 -340 64" "spawnflags" "1792" "classname" "ammo_shells" } { "origin" "-2086 -384 64" "spawnflags" "1792" "classname" "ammo_shells" } { "origin" "-2746 -1059 -128" "classname" "ammo_slugs" "spawnflags" "1792" } { "origin" "-2021 -1624 -128" "classname" "item_health_large" "spawnflags" "0" } { "origin" "-2069 -1624 -128" "classname" "item_health_large" "spawnflags" "0" } { "origin" "-1672 -2082 136" "classname" "item_health_mega" "spawnflags" "0" } { "origin" "-1945 -1882 -384" "classname" "weapon_hyperblaster" "spawnflags" "0" } { "origin" "-2586 -1813 -384" "classname" "ammo_cells" "spawnflags" "0" } { "origin" "-2338 -1813 -384" "classname" "ammo_cells" "spawnflags" "0" } { "origin" "-1144 -2084 272" "spawnflags" "0" "classname" "item_power_shield" } { "origin" "-1631 -1312 0" "classname" "item_breather" "spawnflags" "0" } { "spawnflags" "0" "origin" "-644 -2463 288" "classname" "item_armor_jacket" } { "origin" "86 -1761 -256" "spawnflags" "1792" "classname" "item_adrenaline" } { "spawnflags" "1792" "origin" "-1473 -638 64" "classname" "item_health_small" } { "spawnflags" "1792" "origin" "-1473 -682 64" "classname" "item_health_small" } { "spawnflags" "1792" "origin" "-1473 -594 64" "classname" "item_health_small" } { "origin" "-1498 -1303 0" "spawnflags" "2048" "classname" "item_armor_shard" } { "origin" "-1546 -1303 0" "spawnflags" "2048" "classname" "item_armor_shard" } { "origin" "-1450 -1303 0" "spawnflags" "2048" "classname" "item_armor_shard" } { "origin" "-1800 -3240 80" "classname" "item_health_large" "spawnflags" "0" } { "origin" "-1808 -3032 -128" "classname" "ammo_bullets" "spawnflags" "1792" } { "spawnflags" "1792" "origin" "-1752 -3032 -128" "classname" "ammo_bullets" } { "origin" "-1864 -3032 -128" "classname" "ammo_bullets" "spawnflags" "1792" } { "origin" "-1808 -3080 -128" "spawnflags" "1792" "classname" "weapon_chaingun" } { "spawnflags" "0" "origin" "-1808 -2112 -128" "classname" "ammo_shells" } { "spawnflags" "0" "origin" "-1808 -2064 -128" "classname" "ammo_shells" } { "origin" "-1832 -2176 -128" "spawnflags" "1792" "classname" "weapon_supershotgun" } { "origin" "-2712 -1312 272" "classname" "ammo_rockets" "spawnflags" "1792" } { "origin" "-2656 -1312 272" "spawnflags" "1792" "classname" "ammo_rockets" } { "origin" "-2832 -1328 272" "spawnflags" "1792" "classname" "weapon_rocketlauncher" } { "spawnflags" "1792" "origin" "-1648 -416 64" "classname" "ammo_grenades" } { "spawnflags" "1792" "origin" "-1648 -360 64" "classname" "ammo_grenades" } { "origin" "-864 -96 64" "classname" "item_armor_shard" "spawnflags" "0" } { "origin" "-904 -96 64" "classname" "item_armor_shard" "spawnflags" "0" } { "origin" "-944 -96 64" "classname" "item_armor_shard" "spawnflags" "0" } { "origin" "-904 -416 64" "spawnflags" "0" "classname" "item_armor_shard" } { "origin" "-944 -416 64" "spawnflags" "0" "classname" "item_armor_shard" } { "origin" "-864 -416 64" "spawnflags" "0" "classname" "item_armor_shard" } { "spawnflags" "1792" "origin" "-104 -1380 64" "classname" "item_health_large" } { "spawnflags" "1792" "origin" "-104 -1436 64" "classname" "item_health_large" } { "origin" "-672 -1944 0" "classname" "ammo_shells" "spawnflags" "0" } { "origin" "-712 -1944 0" "spawnflags" "0" "classname" "ammo_shells" } { "origin" "96 -1200 0" "spawnflags" "1792" "classname" "weapon_shotgun" } { "origin" "-848 -2536 160" "spawnflags" "1792" "classname" "item_health_large" } { "origin" "-800 -2536 160" "spawnflags" "0" "classname" "item_health_large" } { "spawnflags" "0" "origin" "1312 -200 -128" "classname" "item_armor_shard" } { "spawnflags" "0" "origin" "1248 -200 -128" "classname" "item_armor_shard" } { "spawnflags" "0" "origin" "1184 -200 -128" "classname" "item_armor_shard" } { "spawnflags" "0" "origin" "1120 -200 -128" "classname" "item_armor_shard" } { "spawnflags" "1792" "origin" "960 -2408 256" "classname" "ammo_slugs" } { "spawnflags" "1792" "origin" "760 -2400 256" "classname" "weapon_railgun" } { "origin" "-2144 -880 72" "angle" "90" "classname" "info_player_deathmatch" } { "model" "*41" "spawnflags" "2048" "classname" "func_wall" } { "origin" "1000 -888 -120" "angle" "0" "classname" "info_player_deathmatch" } { "origin" "-2288 -3072 -120" "angle" "0" "classname" "info_player_deathmatch" } { "origin" "-192 -1504 72" "angle" "90" "classname" "info_player_deathmatch" } { "origin" "40 -1144 8" "angle" "270" "classname" "info_player_deathmatch" } { "origin" "-832 -2280 168" "angle" "0" "classname" "info_player_deathmatch" } { "model" "*42" "spawnflags" "2048" "classname" "func_wall" } { "origin" "-2336 -1304 -120" "angle" "225" "classname" "info_player_deathmatch" } { "origin" "-1952 -864 72" "angle" "90" "classname" "info_player_deathmatch" } { "origin" "-2152 -840 320" "classname" "ammo_cells" } { "origin" "-2152 -880 320" "classname" "ammo_cells" } { "origin" "-2936 352 184" "angle" "270" "classname" "info_player_deathmatch" } { "model" "*43" "target" "t3" "spawnflags" "1792" "angle" "90" "classname" "func_button" } { "model" "*44" "spawnflags" "2048" "classname" "func_wall" } { "model" "*45" "spawnflags" "2048" "classname" "func_button" "angle" "180" "target" "t10" "message" "Secondary flood gate opened." } { "model" "*46" "spawnflags" "2048" "classname" "func_door" "angle" "-1" "wait" "-1" "targetname" "t7" } { "origin" "-2304 -3056 152" "_color" "1.000000 0.673228 0.188976" "light" "75" "classname" "light" } { "_color" "1.000000 0.603922 0.368627" "light" "75" "classname" "light" "origin" "-1792 -3072 -80" } { "_color" "1.000000 0.673228 0.188976" "light" "75" "classname" "light" "origin" "-1792 -3056 152" } { "classname" "light" "light" "75" "_color" "1.000000 0.673228 0.188976" "origin" "-1984 -3056 152" } { "classname" "light" "light" "75" "_color" "1.000000 0.673228 0.188976" "origin" "-2112 -3056 152" } { "classname" "light" "light" "75" "_color" "1.000000 0.673228 0.188976" "origin" "-2240 -3056 152" } { "classname" "light" "light" "50" "_color" "1.000000 0.673228 0.188976" "origin" "-2352 -3200 112" } { "origin" "-2176 -3056 152" "classname" "light" "light" "75" "_color" "1.000000 0.673228 0.188976" } { "origin" "-2048 -3056 152" "classname" "light" "light" "75" "_color" "1.000000 0.673228 0.188976" } { "origin" "-1920 -3056 152" "classname" "light" "light" "75" "_color" "1.000000 0.673228 0.188976" } { "origin" "-1792 -3072 -24" "classname" "light" "light" "75" "_color" "1.000000 0.603922 0.368627" } { "origin" "-1856 -3056 152" "_color" "1.000000 0.673228 0.188976" "light" "75" "classname" "light" } { "model" "*47" "spawnflags" "2048" "targetname" "t7" "classname" "func_door" "angle" "-1" "wait" "-1" } { "model" "*48" "spawnflags" "2048" "target" "t9" "classname" "trigger_once" } { "spawnflags" "2048" "origin" "-1352 -1560 -200" "message" "You've found a secret area." "targetname" "t9" "classname" "target_secret" } { "model" "*49" "spawnflags" "2048" "classname" "func_button" "target" "t8" "angle" "90" } { "model" "*50" "message" "Access Denied." "wait" "-1" "spawnflags" "2048" "angle" "-1" "classname" "func_door" "targetname" "t8" } { "classname" "light" "light" "100" "_color" "1.000000 0.870079 0.783465" "origin" "-1216 -1344 248" } { "_color" "0.768627 1.000000 1.000000" "classname" "light" "light" "50" "origin" "-1552 -1512 -16" } { "_color" "0.768627 1.000000 1.000000" "classname" "light" "light" "50" "origin" "-1552 -1432 -16" } { "_color" "0.768627 1.000000 1.000000" "classname" "light" "light" "50" "origin" "-1648 -1512 -16" } { "_color" "0.768627 1.000000 1.000000" "classname" "light" "light" "50" "origin" "-1648 -1432 -16" } { "classname" "func_group" } { "model" "*51" "spawnflags" "2048" "health" "25" "classname" "func_explosive" } { "classname" "func_group" } { "_color" "0.482353 0.741176 1.000000" "classname" "light" "light" "70" "origin" "-1760 -1432 -16" } { "_color" "0.482353 0.741176 1.000000" "classname" "light" "light" "70" "origin" "-1888 -1432 -16" } { "_color" "0.482353 0.741176 1.000000" "classname" "light" "light" "70" "origin" "-2016 -1432 -16" } { "_color" "0.482353 0.741176 1.000000" "classname" "light" "light" "70" "origin" "-2144 -1432 -16" } { "_color" "0.482353 0.741176 1.000000" "classname" "light" "light" "70" "origin" "-2224 -1432 -16" } { "_color" "0.482353 0.741176 1.000000" "classname" "light" "light" "70" "origin" "-2224 -1512 -16" } { "origin" "-2144 -1728 -232" "light" "70" "classname" "light" "_color" "0.482353 0.741176 1.000000" } { "_color" "0.482353 0.741176 1.000000" "classname" "light" "light" "70" "origin" "-2144 -1728 -128" } { "_color" "0.482353 0.741176 1.000000" "classname" "light" "light" "70" "origin" "-2144 -1600 -128" } { "_color" "0.482353 0.741176 1.000000" "classname" "light" "light" "70" "origin" "-2144 -1600 -16" } { "_color" "0.482353 0.741176 1.000000" "classname" "light" "light" "70" "origin" "-2144 -1512 -16" } { "origin" "-2224 -1728 -128" "light" "70" "classname" "light" "_color" "0.482353 0.741176 1.000000" } { "origin" "-2224 -1600 -128" "light" "70" "classname" "light" "_color" "0.482353 0.741176 1.000000" } { "origin" "-2224 -1600 -16" "light" "70" "classname" "light" "_color" "0.482353 0.741176 1.000000" } { "origin" "-1440 -1432 -88" "light" "50" "classname" "light" "_color" "0.768627 1.000000 1.000000" } { "origin" "-2016 -1512 -16" "light" "70" "classname" "light" "_color" "0.482353 0.741176 1.000000" } { "_color" "0.482353 0.741176 1.000000" "classname" "light" "light" "70" "origin" "-1760 -1512 -16" } { "origin" "-1888 -1512 -16" "light" "70" "classname" "light" "_color" "0.482353 0.741176 1.000000" } { "origin" "-1440 -1512 -88" "light" "50" "classname" "light" "_color" "0.768627 1.000000 1.000000" } { "model" "*52" "spawnflags" "2048" "target" "t7" "wait" "-1" "angle" "0" "classname" "func_button" "message" "Primary flood gates opened." } { "model" "*53" "spawnflags" "2048" "wait" "-1" "angle" "-1" "classname" "func_door" "targetname" "t10" } { "classname" "func_group" } { "_color" "0.482353 0.741176 1.000000" "classname" "light" "light" "70" "origin" "-2224 -1728 -232" } { "classname" "func_group" } { "classname" "func_group" } { "classname" "func_group" } { "classname" "func_group" } { "classname" "func_group" } { "classname" "func_group" } { "classname" "func_group" } { "classname" "func_group" } { "model" "*54" "spawnflags" "8" "team" "sliders1" "angle" "270" "classname" "func_door" } { "spawnflags" "2048" "origin" "-736 -720 336" "message" "You've found a secret area." "targetname" "t5" "classname" "target_secret" } { "model" "*55" "spawnflags" "2048" "target" "t5" "classname" "trigger_once" } { "model" "*56" "spawnflags" "8" "team" "sliders1" "lip" "64" "angle" "90" "classname" "func_door" } { "model" "*57" "targetname" "t4" "speed" "50" "lip" "4" "wait" "-1" "angle" "-2" "classname" "func_door" } { "model" "*58" "targetname" "t4" "wait" "-1" "lip" "-2" "angle" "180" "classname" "func_door" } { "origin" "-672 -600 24" "target" "t4" "targetname" "t3" "classname" "trigger_relay" } { "model" "*59" "target" "t11" "spawnflags" "2048" "classname" "trigger_once" "message" "This button is not functioning." } { "spawnflags" "2048" "classname" "light" "light" "60" "style" "4" "origin" "-616 -576 56" } { "model" "*60" "spawnflags" "8" "angle" "-1" "team" "bigdoor1" "speed" "25" "lip" "-112" "classname" "func_door" } { "model" "*61" "spawnflags" "8" "team" "bigdoor1" "lip" "-52" "speed" "25" "angle" "-1" "classname" "func_door" } { "model" "*62" "spawnflags" "8" "team" "bigdoor1" "speed" "25" "angle" "-1" "classname" "func_door" } { "classname" "item_armor_body" "origin" "-1064 -256 320" } { "classname" "light" "light" "200" "_color" "1.000000 0.796078 0.325490" "origin" "-904 -252 392" } { "model" "*63" "origin" "-904 -252 560" "speed" "200" "_minlight" ".25" "spawnflags" "1" "classname" "func_rotating" } { "classname" "func_group" } { "model" "*64" "classname" "func_door" "angle" "-1" "_minlight" ".1" } { "classname" "weapon_boomer" "origin" "-2200 -832 320" } { "spawnflags" "2048" "classname" "target_secret" "targetname" "t1" "message" "You've discovered a secret area." "origin" "-2264 -680 448" } { "model" "*65" "spawnflags" "2048" "classname" "trigger_once" "target" "t1" } { "targetname" "industry" "origin" "-3216 -320 248" "angle" "0" "classname" "info_player_start" } { "model" "*66" "team" "baddoor2" "classname" "func_door" "angle" "270" "target" "t277" } { "model" "*67" "team" "baddoor2" "classname" "func_door" "angle" "90" } { "origin" "-3416 -320 256" "_color" "1.000000 0.586614 0.338583" "light" "125" "classname" "light" } { "origin" "-3256 -320 256" "_color" "1.000000 0.586614 0.338583" "light" "125" "classname" "light" }xatrix-XATRIX_2_14/stuff/mapfixes/xintell.ent000066400000000000000000001145601477320050300213010ustar00rootroot00000000000000// FIXED ENTITY STRING (by BjossiAlfreds) // // 1. Made the item_invulnerability (18) by the exit into a counted secret // // Given that its presence can be discovered visually and is easy to get // with a simple rocket jump, it can be made into a proper secret. So I // added a target_secret (2476) that the item links to. { "nextmap" "industry" "message" "Intelligence Center" "sky" "x1u2" "classname" "worldspawn" "sounds" "9" } { "model" "*1" "classname" "func_wall" } { "origin" "304 1096 304" "classname" "item_invulnerability" "target" "invulsec" } { "origin" "768 -480 488" "angle" "180" "classname" "info_player_deathmatch" } { "attenuation" "-1" "classname" "target_speaker" "noise" "world/datafiles.wav" "spawnflags" "2052" "targetname" "t56" "origin" "1576 -512 256" } { "classname" "trigger_relay" "targetname" "t3" "target" "t56" "spawnflags" "2048" "wait" "0.5" "origin" "1560 -512 256" } { "classname" "ammo_trap" "spawnflags" "1792" "origin" "880 -480 216" } { "classname" "ammo_rockets" "origin" "1392 -464 480" "angle" "180" "spawnflags" "3584" } { "angle" "270" "spawnflags" "1792" "classname" "ammo_cells" "origin" "1632 -1304 272" } { "spawnflags" "1792" "classname" "weapon_hyperblaster" "origin" "1632 -1344 272" } { "classname" "ammo_cells" "spawnflags" "1792" "angle" "180" "origin" "1672 -1344 272" } { "classname" "ammo_grenades" "spawnflags" "1792" "origin" "1840 -976 272" } { "classname" "ammo_grenades" "spawnflags" "1792" "origin" "1840 -944 272" } { "classname" "weapon_grenadelauncher" "spawnflags" "1792" "origin" "1872 -960 272" } { "origin" "248 672 304" "classname" "weapon_grenadelauncher" } { "origin" "264 632 304" "classname" "ammo_grenades" } { "origin" "296 632 304" "classname" "ammo_grenades" } { "origin" "1320 -480 288" "classname" "light" "light" "150" "_color" "1.000000 0.921569 0.654902" } { "classname" "target_goal" "targetname" "t42" "origin" "1592 -1384 584" } { "origin" "704 992 512" "map" "xu2.cin+*industry$xintell" "targetname" "t55" "classname" "target_changelevel" } { "model" "*2" "spawnflags" "0" "target" "t55" "classname" "trigger_multiple" } { "classname" "info_player_intermission" "angles" "-20 315 0" "origin" "2192 -816 280" } { "classname" "item_armor_shard" "spawnflags" "1792" "origin" "2352 -1584 272" } { "classname" "item_armor_shard" "spawnflags" "1792" "origin" "2352 -1552 272" } { "classname" "item_health_small" "spawnflags" "1792" "origin" "2352 -1520 272" } { "classname" "item_health_small" "spawnflags" "1792" "origin" "2352 -1488 272" } { "classname" "item_health_small" "spawnflags" "1792" "origin" "2064 -1840 272" } { "classname" "item_health_small" "spawnflags" "1792" "origin" "2096 -1840 272" } { "classname" "item_armor_shard" "spawnflags" "1792" "origin" "2032 -1840 272" } { "classname" "item_armor_shard" "spawnflags" "1792" "origin" "2000 -1840 272" } { "classname" "item_armor_shard" "origin" "608 -656 64" } { "classname" "item_armor_shard" "origin" "608 -624 64" } { "classname" "item_armor_shard" "origin" "608 -592 64" } { "classname" "item_armor_shard" "origin" "608 -560 64" } { "classname" "info_player_deathmatch" "angle" "45" "origin" "416 -1216 72" } { "classname" "target_help" "targetname" "t54" "spawnflags" "2049" "message" "Use Data CD to discover\nthe location of the Strogg\ncounter strike fleet." "origin" "432 -2256 88" } { "classname" "target_help" "targetname" "t54" "message" "Locate the Main\nIntelligence computer\nprocessing core." "spawnflags" "2048" "origin" "464 -2256 88" } { "model" "*3" "classname" "trigger_once" "target" "t54" "spawnflags" "2048" } { "classname" "weapon_supershotgun" "spawnflags" "1792" "origin" "896 -1064 64" } { "origin" "352 -32 400" "target" "t53" "spawnflags" "1" "classname" "monster_tank" "item" "ammo_rockets" } { "origin" "416 -480 424" "target" "t51" "targetname" "t50" "classname" "path_corner" } { "origin" "416 -480 440" "target" "t53" "targetname" "t52" "classname" "path_corner" } { "targetname" "t53" "target" "t50" "origin" "416 -32 408" "classname" "path_corner" } { "target" "t52" "targetname" "t51" "origin" "416 -1168 392" "classname" "path_corner" } { "origin" "864 336 440" "item" "ammo_cells" "spawnflags" "2" "targetname" "t49" "classname" "monster_soldier_ripper" "angle" "270" } { "origin" "192 368 408" "item" "item_armor_shard" "spawnflags" "1" "target" "t49" "classname" "monster_soldier_ripper" "angle" "270" } { "origin" "928 336 440" "spawnflags" "258" "targetname" "t49" "angle" "270" "classname" "monster_soldier_ripper" } { "item" "ammo_cells" "origin" "128 368 408" "spawnflags" "1" "angle" "270" "classname" "monster_soldier_ripper" } { "model" "*4" "target" "t48" "classname" "trigger_once" } { "origin" "728 -272 488" "targetname" "t48" "classname" "monster_soldier_ripper" "angle" "270" "spawnflags" "257" } { "origin" "728 -688 488" "targetname" "t48" "spawnflags" "1" "angle" "90" "classname" "monster_soldier_ripper" } { "origin" "1560 -528 256" "target" "t47" "targetname" "t3" "classname" "trigger_relay" "spawnflags" "2048" } { "model" "*5" "targetname" "t47" "spawnflags" "2055" "classname" "func_wall" } { "origin" "1064 -480 560" "classname" "item_enviro" } { "origin" "1096 -480 584" "targetname" "t47" "spawnflags" "2" "angle" "0" "classname" "monster_floater" } { "origin" "1528 -520 248" "classname" "monster_soldier_ripper" "spawnflags" "769" "angle" "180" } { "origin" "1528 -448 248" "item" "ammo_cells" "angle" "180" "classname" "monster_soldier_ripper" "spawnflags" "1" } { "origin" "1592 -480 248" "item" "item_armor_shard" "angle" "0" "spawnflags" "1" "classname" "monster_soldier_ripper" } { "origin" "1280 -856 480" "target" "t46" "item" "ammo_rockets" "spawnflags" "1" "classname" "monster_tank" } { "origin" "1280 -768 504" "targetname" "t46" "target" "t45" "classname" "path_corner" } { "origin" "1280 -192 504" "target" "t46" "targetname" "t45" "classname" "path_corner" } { "origin" "1536 -480 240" "classname" "weapon_railgun" "spawnflags" "1792" } { "origin" "1488 -408 240" "spawnflags" "1792" "classname" "ammo_slugs" } { "origin" "1392 -480 488" "angle" "180" "classname" "info_player_deathmatch" } { "classname" "ammo_cells" "origin" "1816 -1160 272" "angle" "0" } { "model" "*6" "target" "t44" "spawnflags" "2816" "classname" "trigger_once" } { "origin" "2432 -1344 672" "targetname" "t44" "angle" "180" "spawnflags" "769" "classname" "monster_floater" } { "origin" "2496 -1344 672" "targetname" "t44" "angle" "0" "spawnflags" "769" "classname" "monster_floater" } { "origin" "2296 -640 392" "target" "t43" "spawnflags" "1792" "classname" "trigger_always" } { "origin" "1592 -1336 584" "spawnflags" "2048" "target" "t43" "targetname" "t42" "classname" "trigger_relay" } { "origin" "1592 -1360 584" "spawnflags" "2048" "target" "t40" "targetname" "t42" "classname" "trigger_relay" } { "model" "*7" "target" "t42" "count" "2" "targetname" "t41" "spawnflags" "2049" "classname" "trigger_counter" } { "origin" "1168 -1800 376" "spawnflags" "1792" "target" "t40" "classname" "trigger_always" } { "model" "*8" "target" "reddr2" "classname" "trigger_multiple" } { "model" "*9" "targetname" "t40" "target" "reddr2" "spawnflags" "4" "classname" "trigger_multiple" } { "model" "*10" "target" "reddr1" "classname" "trigger_multiple" } { "model" "*11" "targetname" "t43" "target" "reddr1" "spawnflags" "4" "classname" "trigger_multiple" } { "origin" "2328 -1792 256" "angle" "90" "spawnflags" "2056" "classname" "misc_deadsoldier" } { "origin" "2408 -1896 272" "classname" "ammo_grenades" "spawnflags" "2304" } { "origin" "2408 -1840 272" "spawnflags" "2048" "classname" "ammo_shells" } { "origin" "2408 -1896 304" "spawnflags" "3584" "classname" "item_armor_jacket" } { "origin" "2352 -1896 272" "spawnflags" "2048" "classname" "ammo_shells" } { "origin" "2768 -1424 280" "angle" "135" "classname" "info_player_deathmatch" } { "origin" "1936 -2256 280" "angle" "135" "classname" "info_player_deathmatch" } { "origin" "1304 -2248 272" "classname" "item_health" } { "origin" "1336 -2280 272" "classname" "item_health" } { "origin" "1680 -2320 272" "classname" "ammo_bullets" } { "origin" "1584 -2320 272" "classname" "ammo_bullets" } { "origin" "1632 -2304 272" "classname" "weapon_chaingun" } { "origin" "1304 -1304 272" "classname" "ammo_rockets" "angle" "270" } { "origin" "1344 -1304 272" "classname" "ammo_rockets" "angle" "270" } { "target" "t41" "classname" "monster_boss5" "angle" "0" "origin" "1984 -1792 256" "spawnflags" "1" "targetname" "t44" } { "origin" "2792 -832 272" "spawnflags" "1792" "classname" "item_armor_shard" } { "origin" "2792 -792 272" "spawnflags" "1792" "classname" "item_armor_shard" } { "origin" "2752 -792 272" "spawnflags" "1792" "classname" "item_armor_shard" } { "origin" "2832 -1152 272" "spawnflags" "1792" "classname" "ammo_magslug" } { "origin" "2832 -1088 272" "spawnflags" "1792" "classname" "ammo_magslug" } { "origin" "2856 -1160 272" "spawnflags" "2048" "classname" "item_armor_shard" } { "origin" "2856 -1192 272" "spawnflags" "2048" "classname" "item_armor_shard" } { "origin" "2856 -1128 272" "classname" "item_armor_shard" "spawnflags" "2048" } { "origin" "2856 -1088 272" "classname" "item_health_large" "spawnflags" "3584" } { "origin" "2856 -1048 272" "spawnflags" "2048" "classname" "item_health_large" } { "spawnflags" "1792" "origin" "2800 -1120 272" "classname" "weapon_phalanx" } { "spawnflags" "1536" "origin" "1816 -1120 272" "classname" "ammo_cells" "angle" "0" } { "origin" "1856 -792 272" "classname" "item_health_small" } { "origin" "1816 -832 272" "classname" "item_health_small" } { "origin" "1816 -792 272" "classname" "item_health_small" } { "target" "t41" "origin" "1552 -1384 256" "angle" "270" "classname" "monster_boss5" } { "origin" "2272 224 416" "spawnflags" "1" "target" "t39" "classname" "monster_tank" "item" "ammo_rockets" } { "origin" "1824 -160 352" "target" "t38" "targetname" "t37" "classname" "path_corner" } { "origin" "1824 160 424" "target" "t39" "targetname" "t38" "classname" "path_corner" } { "origin" "1824 160 408" "target" "t35" "targetname" "t34" "classname" "path_corner" } { "origin" "1824 -160 336" "target" "t36" "targetname" "t35" "classname" "path_corner" } { "origin" "2272 160 408" "targetname" "t39" "target" "t34" "classname" "path_corner" } { "origin" "2272 -160 304" "target" "t37" "targetname" "t36" "classname" "path_corner" } { "origin" "896 480 456" "target" "t33" "targetname" "t32" "classname" "path_corner" } { "origin" "896 480 440" "target" "t31" "targetname" "t30" "classname" "path_corner" } { "origin" "2272 480 456" "target" "t32" "targetname" "t31" "classname" "path_corner" } { "origin" "888 232 440" "targetname" "t33" "target" "t30" "classname" "path_corner" } { "origin" "2080 480 432" "target" "t30" "spawnflags" "1" "classname" "monster_tank" "item" "ammo_rockets" } { "origin" "920 -928 472" "targetname" "t29" "spawnflags" "1" "classname" "point_combat" } { "angle" "90" "origin" "920 -960 488" "spawnflags" "1" "target" "t29" "classname" "monster_soldier_ripper" } { "angle" "90" "origin" "1160 -960 488" "spawnflags" "1" "classname" "monster_soldier_ripper" "item" "ammo_cells" } { "model" "*12" "target" "t28" "spawnflags" "2048" "classname" "trigger_once" } { "origin" "1096 -8 472" "targetname" "t27" "spawnflags" "257" "classname" "point_combat" } { "origin" "1152 0 488" "angle" "225" "spawnflags" "257" "target" "t27" "classname" "monster_soldier_ripper" } { "angle" "0" "origin" "848 24 488" "item" "ammo_cells" "targetname" "t28" "spawnflags" "1" "classname" "monster_soldier_ripper" } { "origin" "1560 136 504" "spawnflags" "1536" "classname" "item_armor_body" } { "angle" "0" "spawnflags" "2" "targetname" "t21" "classname" "monster_floater" "origin" "1384 348 520" } { "classname" "item_health_large" "origin" "1336 348 480" } { "origin" "920 -128 224" "spawnflags" "2048" "classname" "ammo_grenades" } { "origin" "880 -128 208" "angle" "270" "spawnflags" "1" "classname" "misc_deadsoldier" } { "origin" "920 -168 208" "spawnflags" "4" "angle" "90" "classname" "misc_deadsoldier" } { "origin" "960 -64 232" "angle" "270" "classname" "info_player_deathmatch" } { "origin" "1240 -56 224" "classname" "item_health" } { "origin" "1280 -56 224" "classname" "item_health" } { "origin" "904 -704 216" "spawnflags" "1" "targetname" "t25" "classname" "point_combat" } { "origin" "904 -776 216" "spawnflags" "1" "targetname" "t26" "classname" "point_combat" } { "item" "item_armor_shard" "origin" "920 -704 232" "target" "t25" "classname" "monster_soldier_ripper" "angle" "180" "spawnflags" "256" } { "item" "item_armor_shard" "origin" "920 -776 232" "spawnflags" "768" "target" "t26" "classname" "monster_soldier_ripper" "angle" "180" } { "origin" "432 -1208 56" "spawnflags" "1" "targetname" "t24" "classname" "point_combat" } { "origin" "424 -856 72" "classname" "monster_soldier_ripper" "angle" "270" "spawnflags" "1" } { "origin" "608 -904 72" "classname" "monster_soldier_ripper" "angle" "270" "spawnflags" "257" } { "target" "t24" "origin" "408 -1208 72" "spawnflags" "1" "angle" "0" "classname" "monster_soldier_ripper" } { "origin" "448 -2128 48" "angle" "90" "classname" "info_player_deathmatch" } { "origin" "608 -744 56" "targetname" "t23" "spawnflags" "1" "classname" "point_combat" } { "origin" "608 -720 72" "target" "t23" "spawnflags" "1" "classname" "monster_soldier_ripper" "angle" "270" } { "origin" "416 -608 72" "spawnflags" "1" "classname" "monster_soldier_ripper" "angle" "270" } { "origin" "584 -1984 64" "classname" "weapon_machinegun" } { "origin" "632 -1984 48" "angle" "135" "spawnflags" "8" "classname" "misc_deadsoldier" } { "origin" "552 -2024 64" "classname" "ammo_bullets" } { "origin" "296 -2024 64" "classname" "ammo_bullets" } { "origin" "344 -2024 64" "classname" "ammo_bullets" } { "origin" "528 -1456 64" "classname" "ammo_rockets" } { "origin" "528 -1416 64" "classname" "ammo_rockets" } { "origin" "904 -1952 64" "classname" "item_health" } { "origin" "904 -2000 64" "classname" "item_health" } { "origin" "448 -1440 64" "spawnflags" "1792" "classname" "weapon_rocketlauncher" } { "model" "*13" "classname" "func_wall" "spawnflags" "1792" } { "origin" "424 -1360 64" "classname" "ammo_shells" "spawnflags" "2048" } { "origin" "472 -1360 64" "classname" "ammo_shells" "spawnflags" "2048" } { "origin" "360 -1528 72" "classname" "monster_soldier_ripper" "angle" "180" "spawnflags" "1" } { "origin" "288 -1364 72" "classname" "monster_soldier_ripper" "angle" "270" "spawnflags" "1" } { "origin" "400 -1440 72" "spawnflags" "257" "angle" "180" "classname" "monster_soldier_ripper" } { "spawnflags" "1792" "origin" "2368 -1856 280" "targetname" "tport2" "angle" "135" "classname" "misc_teleporter_dest" } { "spawnflags" "1792" "origin" "672 896 312" "target" "tport2" "angle" "180" "classname" "misc_teleporter" } { "origin" "416 -656 456" "classname" "target_speaker" "noise" "world/amb4.wav" "spawnflags" "1" } { "origin" "416 -312 456" "classname" "target_speaker" "noise" "world/amb4.wav" "spawnflags" "1" } { "origin" "416 -32 456" "classname" "target_speaker" "noise" "world/amb4.wav" "spawnflags" "1" } { "origin" "1824 -104 456" "classname" "target_speaker" "noise" "world/amb4.wav" "spawnflags" "1" } { "targetname" "t20" "origin" "416 256 512" "spawnflags" "2049" "classname" "target_speaker" "noise" "world/force1.wav" } { "targetname" "t20" "noise" "world/force1.wav" "classname" "target_speaker" "spawnflags" "2049" "origin" "416 192 512" } { "targetname" "t20" "noise" "world/force1.wav" "classname" "target_speaker" "spawnflags" "2049" "origin" "488 256 512" } { "targetname" "t20" "origin" "488 192 512" "spawnflags" "2049" "classname" "target_speaker" "noise" "world/force1.wav" } { "targetname" "t20" "origin" "192 384 440" "spawnflags" "2049" "classname" "target_speaker" "noise" "world/force1.wav" } { "targetname" "t20" "noise" "world/force1.wav" "classname" "target_speaker" "spawnflags" "2049" "origin" "128 384 440" } { "targetname" "t20" "noise" "world/force1.wav" "classname" "target_speaker" "spawnflags" "2049" "origin" "192 456 440" } { "noise" "world/amb18.wav" "classname" "target_speaker" "spawnflags" "1" "origin" "680 224 512" } { "noise" "world/amb18.wav" "classname" "target_speaker" "spawnflags" "1" "origin" "888 232 512" } { "noise" "world/amb18.wav" "classname" "target_speaker" "spawnflags" "1" "origin" "960 -176 312" } { "classname" "target_speaker" "spawnflags" "1" "origin" "2272 256 480" "noise" "world/amb16.wav" } { "classname" "target_speaker" "spawnflags" "1" "origin" "1536 32 264" "noise" "world/amb16.wav" } { "spawnflags" "1" "noise" "world/amb4.wav" "classname" "target_speaker" "origin" "416 -1168 456" } { "spawnflags" "1" "noise" "world/amb4.wav" "classname" "target_speaker" "origin" "1280 -296 544" } { "origin" "1888 160 456" "classname" "target_speaker" "noise" "world/amb4.wav" "spawnflags" "1" } { "origin" "1528 -440 288" "classname" "target_speaker" "noise" "world/amb4.wav" "spawnflags" "1" } { "spawnflags" "1" "noise" "world/amb9.wav" "classname" "target_speaker" "origin" "736 -304 568" } { "spawnflags" "1" "noise" "world/amb9.wav" "classname" "target_speaker" "origin" "760 -952 568" } { "spawnflags" "1" "noise" "world/amb9.wav" "classname" "target_speaker" "origin" "728 -680 568" } { "spawnflags" "1" "noise" "world/amb9.wav" "classname" "target_speaker" "origin" "512 -840 104" } { "spawnflags" "1" "noise" "world/amb16.wav" "classname" "target_speaker" "origin" "144 256 456" } { "spawnflags" "1" "noise" "world/amb16.wav" "classname" "target_speaker" "origin" "440 520 392" } { "spawnflags" "1" "noise" "world/amb16.wav" "classname" "target_speaker" "origin" "304 -1440 104" } { "spawnflags" "1" "noise" "world/amb4.wav" "classname" "target_speaker" "origin" "160 952 376" } { "spawnflags" "1" "noise" "world/amb4.wav" "classname" "target_speaker" "origin" "288 952 376" } { "spawnflags" "1" "noise" "world/amb4.wav" "classname" "target_speaker" "origin" "800 -1448 104" } { "origin" "448 -1856 72" "target" "tport1" "spawnflags" "1792" "angle" "90" "classname" "misc_teleporter" } { "model" "*14" "spawnflags" "1792" "classname" "func_wall" } { "origin" "104 672 312" "spawnflags" "1792" "targetname" "tport1" "angle" "0" "classname" "misc_teleporter_dest" } { "origin" "448 1088 312" "classname" "info_player_deathmatch" } { "origin" "120 976 304" "classname" "item_health" } { "origin" "160 976 304" "classname" "item_health" } { "origin" "144 880 432" "classname" "item_armor_combat" } { "_color" "1.000000 0.921569 0.654902" "light" "150" "classname" "light" "origin" "1488 -480 288" } { "targetname" "t4" "origin" "168 224 504" "target" "t20" "classname" "trigger_relay" } { "classname" "light" "light" "160" "origin" "160 256 464" "_color" "1.000000 0.701961 0.529412" } { "classname" "light" "light" "160" "origin" "1248 480 520" "_color" "1.000000 0.701961 0.529412" } { "origin" "392 224 456" "_color" "1.000000 0.866667 0.701961" "light" "150" "classname" "light" } { "origin" "504 224 456" "_color" "1.000000 0.866667 0.701961" "light" "150" "classname" "light" } { "model" "*15" "targetname" "t20" "spawnflags" "2055" "classname" "func_wall" } { "model" "*16" "targetname" "t20" "spawnflags" "2055" "classname" "func_wall" } { "model" "*17" "spawnflags" "1792" "classname" "func_wall" } { "model" "*18" "spawnflags" "1792" "classname" "func_wall" } { "_color" "1.000000 0.924901 0.656126" "light" "115" "classname" "light" "origin" "248 760 396" } { "_color" "1.000000 0.924901 0.656126" "light" "115" "classname" "light" "origin" "328 760 396" } { "light" "115" "classname" "light" "origin" "448 832 396" } { "origin" "448 960 396" "classname" "light" "light" "115" } { "_color" "1.000000 0.924901 0.656126" "origin" "248 968 396" "classname" "light" "light" "115" } { "origin" "624 832 396" "classname" "light" "light" "115" } { "model" "*19" "spawnflags" "2048" "classname" "func_button" "target" "t19" } { "classname" "light" "light" "150" "_color" "1.000000 0.866667 0.701961" "origin" "160 472 456" } { "classname" "light" "light" "150" "_color" "1.000000 0.866667 0.701961" "origin" "160 360 456" } { "origin" "656 896 360" "classname" "target_speaker" "spawnflags" "1" "noise" "world/amb9.wav" } { "model" "*20" "classname" "func_door" "angle" "-2" "spawnflags" "2049" "lip" "154" "targetname" "t19" } { "_color" "1.000000 0.924901 0.656126" "light" "115" "classname" "light" "origin" "328 968 396" } { "classname" "light" "light" "115" "origin" "688 832 396" } { "light" "115" "classname" "light" "origin" "688 960 396" } { "classname" "light" "light" "115" "origin" "624 960 396" } { "light" "115" "classname" "light" "origin" "688 832 524" } { "classname" "light" "light" "115" "origin" "688 960 524" } { "light" "150" "classname" "light" "origin" "656 832 396" } { "classname" "light" "light" "150" "origin" "656 960 396" } { "light" "150" "classname" "light" "origin" "656 832 716" } { "classname" "light" "light" "150" "origin" "656 960 716" } { "light" "115" "classname" "light" "origin" "624 960 524" } { "classname" "light" "light" "115" "origin" "624 832 524" } { "model" "*21" "spawnflags" "2048" "classname" "func_door" "angle" "90" "team" "ed1" "lip" "38" } { "model" "*22" "spawnflags" "2048" "classname" "func_door" "angle" "270" "team" "ed1" "lip" "38" } { "classname" "light" "light" "120" "_color" "1.000000 0.924901 0.656126" "origin" "1032 -1760 328" } { "origin" "2272 -520 328" "_color" "1.000000 0.924901 0.656126" "light" "120" "classname" "light" } { "style" "1" "classname" "func_areaportal" "targetname" "t18" } { "style" "2" "classname" "func_areaportal" "targetname" "t17" } { "model" "*23" "targetname" "reddr2" "classname" "func_door" "angle" "90" "target" "t17" "wait" "2" "spawnflags" "4" } { "model" "*24" "targetname" "reddr2" "classname" "func_door" "angle" "270" "wait" "2" "spawnflags" "4" } { "classname" "func_group" } { "classname" "light" "light" "120" "_color" "1.000000 0.924901 0.656126" "origin" "2272 -608 328" } { "origin" "2240 -1728 568" "classname" "target_speaker" "noise" "world/wind2.wav" "spawnflags" "1" } { "origin" "2304 -1408 568" "classname" "target_speaker" "noise" "world/wind2.wav" "spawnflags" "1" } { "origin" "2688 -1336 568" "classname" "target_speaker" "noise" "world/wind2.wav" "spawnflags" "1" } { "spawnflags" "1" "noise" "world/wind2.wav" "classname" "target_speaker" "origin" "1848 -2168 568" } { "origin" "1416 -2168 568" "classname" "target_speaker" "noise" "world/wind2.wav" "spawnflags" "1" } { "origin" "1580 -1408 568" "classname" "target_speaker" "noise" "world/wind2.wav" "spawnflags" "1" } { "spawnflags" "1" "noise" "world/wind2.wav" "classname" "target_speaker" "origin" "1408 -1408 568" } { "origin" "1920 -1056 568" "classname" "target_speaker" "noise" "world/wind2.wav" "spawnflags" "1" } { "spawnflags" "1" "noise" "world/wind2.wav" "classname" "target_speaker" "origin" "1920 -896 568" } { "spawnflags" "1" "noise" "world/wind2.wav" "classname" "target_speaker" "origin" "1920 -1792 568" } { "spawnflags" "1" "noise" "world/wind2.wav" "classname" "target_speaker" "origin" "1128 -880 648" } { "spawnflags" "1" "classname" "target_speaker" "noise" "world/amb18.wav" "origin" "2304 -1272 416" } { "origin" "2584 -1272 416" "noise" "world/amb18.wav" "classname" "target_speaker" "spawnflags" "1" } { "spawnflags" "1" "classname" "target_speaker" "noise" "world/amb18.wav" "origin" "2584 -968 416" } { "origin" "2304 -968 416" "noise" "world/amb18.wav" "classname" "target_speaker" "spawnflags" "1" } { "origin" "1768 -1784 416" "noise" "world/amb18.wav" "classname" "target_speaker" "spawnflags" "1" } { "spawnflags" "1" "classname" "target_speaker" "noise" "world/amb18.wav" "origin" "1488 -1784 416" } { "origin" "1488 -2088 416" "noise" "world/amb18.wav" "classname" "target_speaker" "spawnflags" "1" } { "origin" "904 -480 312" "noise" "world/amb18.wav" "classname" "target_speaker" "spawnflags" "1" } { "spawnflags" "1" "noise" "world/amb4.wav" "classname" "target_speaker" "origin" "1280 -664 544" } { "spawnflags" "1" "noise" "world/amb4.wav" "classname" "target_speaker" "origin" "840 -1664 104" } { "spawnflags" "1" "classname" "target_speaker" "noise" "world/amb18.wav" "origin" "1768 -2088 416" } { "spawnflags" "1" "classname" "target_speaker" "origin" "1880 480 520" "noise" "world/amb16.wav" } { "spawnflags" "1" "classname" "target_speaker" "origin" "1520 424 520" "noise" "world/amb16.wav" } { "noise" "world/amb16.wav" "origin" "1512 184 520" "spawnflags" "1" "classname" "target_speaker" } { "classname" "target_speaker" "spawnflags" "1" "origin" "1496 184 264" "noise" "world/amb16.wav" } { "origin" "904 -264 320" "spawnflags" "1" "random" "1" "classname" "func_timer" "target" "t16" "wait" "3" } { "origin" "920 -264 320" "noise" "world/drip1.wav" "classname" "target_speaker" "targetname" "t16" } { "spawnflags" "1" "classname" "target_speaker" "origin" "1144 -176 312" "noise" "world/amb18.wav" } { "spawnflags" "1" "classname" "target_speaker" "origin" "1512 -160 264" "noise" "world/amb18.wav" } { "spawnflags" "1" "noise" "world/amb16.wav" "classname" "target_speaker" "origin" "552 -1856 104" } { "origin" "760 -1520 120" "classname" "func_timer" "random" "1" "spawnflags" "1" "target" "t14" "wait" "3" } { "origin" "776 -1520 120" "classname" "target_speaker" "noise" "world/drip1.wav" "targetname" "t14" } { "spawnflags" "1" "random" "1" "classname" "func_timer" "origin" "808 -1384 120" "target" "t13" "wait" "3" } { "noise" "world/drip1.wav" "classname" "target_speaker" "origin" "824 -1384 120" "targetname" "t13" } { "classname" "func_timer" "random" "1" "spawnflags" "1" "origin" "904 -632 320" "target" "t15" "wait" "2" } { "classname" "target_speaker" "noise" "world/drip1.wav" "origin" "920 -632 320" "targetname" "t15" } { "classname" "target_secret" "targetname" "t8" "message" "You have found a secret area." "spawnflags" "2048" "origin" "1528 -480 144" } { "classname" "item_adrenaline" "target" "t8" "origin" "1568 -480 144" } { "classname" "item_health_small" "origin" "1580 -628 320" } { "classname" "item_health_small" "origin" "1548 -628 320" } { "classname" "item_health_small" "origin" "1516 -628 320" } { "classname" "item_health_small" "origin" "1484 -628 320" } { "classname" "item_health_small" "origin" "1548 -332 320" } { "classname" "item_health_small" "origin" "1516 -332 320" } { "classname" "item_health_small" "origin" "1484 -332 320" } { "classname" "item_health_small" "origin" "1580 -332 320" } { "model" "*25" "classname" "func_button" "angle" "0" "wait" "-1" "light" "160" "message" "Downloading location of Strogg\nstrike fleet." "targetname" "t2" "target" "t3" "spawnflags" "2048" } { "model" "*26" "classname" "trigger_multiple" "target" "t1" "spawnflags" "2048" } { "classname" "trigger_key" "item" "key_data_cd" "origin" "1628 -432 260" "targetname" "t1" "target" "t2" "spawnflags" "2048" } { "classname" "trigger_relay" "origin" "1584 -432 260" "targetname" "t3" "target" "t4" "spawnflags" "2048" "delay" "2" } { "model" "*27" "classname" "func_explosive" "health" "25" "mass" "200" "target" "t5" } { "targetname" "xware" "angle" "90" "origin" "448 -2160 72" "classname" "info_player_coop" } { "targetname" "xware" "angle" "90" "origin" "448 -2424 72" "classname" "info_player_coop" } { "targetname" "xware" "angle" "90" "origin" "448 -2368 72" "classname" "info_player_coop" } { "origin" "416 -1856 104" "_color" "1.000000 0.705882 0.529412" "light" "120" "classname" "light" } { "origin" "520 -1096 120" "classname" "target_speaker" "noise" "world/drip1.wav" "targetname" "t11" } { "origin" "504 -1096 120" "classname" "func_timer" "random" "1" "spawnflags" "1" "target" "t11" "wait" "2" } { "origin" "824 -1744 120" "classname" "target_speaker" "noise" "world/drip1.wav" "targetname" "t10" } { "origin" "808 -1744 120" "classname" "func_timer" "random" "1" "spawnflags" "1" "target" "t10" "wait" "3" } { "origin" "344 -1856 120" "classname" "target_speaker" "noise" "world/drip1.wav" "targetname" "t9" } { "origin" "328 -1856 120" "classname" "func_timer" "random" "1" "spawnflags" "1" "target" "t9" "wait" "3" } { "origin" "456 -1512 120" "noise" "world/drip1.wav" "classname" "target_speaker" "targetname" "t12" } { "origin" "440 -1512 120" "spawnflags" "1" "random" "1" "classname" "func_timer" "target" "t12" "wait" "3" } { "noise" "world/amb16.wav" "origin" "1160 480 520" "classname" "target_speaker" "spawnflags" "1" } { "noise" "world/amb16.wav" "origin" "2272 -264 480" "spawnflags" "1" "classname" "target_speaker" } { "noise" "world/amb18.wav" "origin" "1144 -784 312" "classname" "target_speaker" "spawnflags" "1" } { "origin" "144 64 456" "classname" "target_speaker" "noise" "world/amb16.wav" "spawnflags" "1" } { "origin" "200 -1728 104" "classname" "target_speaker" "noise" "world/amb16.wav" "spawnflags" "1" } { "origin" "1528 -520 288" "classname" "target_speaker" "noise" "world/amb4.wav" "spawnflags" "1" } { "origin" "800 -1264 104" "classname" "target_speaker" "noise" "world/amb4.wav" "spawnflags" "1" } { "origin" "192 672 376" "classname" "target_speaker" "noise" "world/amb4.wav" "spawnflags" "1" } { "origin" "704 -1120 104" "classname" "target_speaker" "noise" "world/amb4.wav" "spawnflags" "1" } { "origin" "760 -8 568" "classname" "target_speaker" "noise" "world/amb9.wav" "spawnflags" "1" } { "origin" "512 -664 104" "classname" "target_speaker" "noise" "world/amb9.wav" "spawnflags" "1" } { "origin" "1120 -80 648" "classname" "target_speaker" "noise" "world/wind2.wav" "spawnflags" "1" } { "origin" "928 -80 648" "classname" "target_speaker" "noise" "world/wind2.wav" "spawnflags" "1" } { "origin" "2688 -904 568" "classname" "target_speaker" "noise" "world/wind2.wav" "spawnflags" "1" } { "origin" "1216 -480 312" "noise" "world/amb18.wav" "classname" "target_speaker" "spawnflags" "1" } { "origin" "960 -784 312" "noise" "world/amb18.wav" "classname" "target_speaker" "spawnflags" "1" } { "targetname" "t20" "origin" "128 456 440" "spawnflags" "2049" "classname" "target_speaker" "noise" "world/force1.wav" } { "origin" "936 -880 648" "spawnflags" "1" "noise" "world/wind2.wav" "classname" "target_speaker" } { "model" "*28" "spawnflags" "2048" "target" "t21" "classname" "trigger_once" } { "origin" "856 -1024 64" "classname" "ammo_shells" } { "origin" "896 -1024 64" "classname" "ammo_shells" } { "origin" "608 -880 64" "classname" "item_armor_shard" "spawnflags" "1792" } { "origin" "608 -848 64" "classname" "item_armor_shard" "spawnflags" "1792" } { "origin" "608 -816 64" "classname" "item_armor_shard" "spawnflags" "1792" } { "origin" "608 -912 64" "classname" "item_armor_shard" "spawnflags" "1792" } { "origin" "416 -528 64" "classname" "item_health" } { "origin" "416 -568 64" "classname" "item_health" } { "origin" "1312 -752 240" "classname" "ammo_cells" } { "origin" "1312 -848 240" "classname" "ammo_cells" } { "origin" "1288 -800 240" "classname" "weapon_boomer" } { "_color" "1.000000 0.901961 0.588235" "light" "50" "classname" "light" "origin" "1528 -160 280" } { "angle" "180" "spawnflags" "258" "targetname" "t21" "origin" "1656 348 520" "classname" "monster_floater" } { "origin" "1704 348 480" "classname" "item_health_large" } { "spawnflags" "2304" "origin" "1560 136 472" "classname" "item_armor_combat" } { "origin" "1552 -464 276" "message" "Primary mission completed." "spawnflags" "1" "classname" "target_help" "targetname" "t4" } { "origin" "1552 -432 276" "message" "Counter strike fleet is\nlocated on Stroggos Moon.\nProceed to Industry Complex." "classname" "target_help" "targetname" "t4" "spawnflags" "2048" } { "origin" "1560 -408 260" "classname" "target_goal" "targetname" "t4" "spawnflags" "2048" } { "_color" "1.000000 0.901961 0.588235" "light" "80" "classname" "light" "origin" "1408 192 280" } { "_color" "1.000000 0.901961 0.588235" "light" "100" "classname" "light" "origin" "1408 192 376" } { "origin" "1336 264 520" "classname" "light" "light" "120" "_color" "1.000000 1.000000 0.800000" } { "_color" "1.000000 1.000000 0.800000" "light" "120" "classname" "light" "origin" "1336 120 520" } { "targetname" "t22" "origin" "480 -2440 48" "map" "xware$xintell" "classname" "target_changelevel" } { "model" "*29" "target" "t22" "angle" "270" "classname" "trigger_multiple" } { "model" "*30" "spawnflags" "2048" "targetname" "t21" "wait" "-1" "classname" "func_door" "angle" "-1" } { "model" "*31" "spawnflags" "2048" "targetname" "t21" "wait" "-1" "classname" "func_door" "angle" "-1" } { "targetname" "xware" "origin" "448 -2312 72" "angle" "90" "classname" "info_player_start" } { "origin" "1528 184 280" "classname" "light" "light" "80" "_color" "1.000000 0.901961 0.588235" } { "_color" "1.000000 1.000000 0.800000" "light" "120" "classname" "light" "origin" "1576 264 520" } { "_color" "1.000000 0.901961 0.588235" "light" "50" "classname" "light" "origin" "1536 0 280" } { "origin" "1576 120 520" "classname" "light" "light" "120" "_color" "1.000000 1.000000 0.800000" } { "origin" "1248 -128 320" "classname" "light" "light" "160" "_color" "0.501961 0.501961 1.000000" } { "classname" "light" "light" "160" "origin" "1792 480 520" "_color" "1.000000 0.701961 0.529412" } { "_color" "1.000000 0.701961 0.529412" "origin" "160 64 464" "light" "160" "classname" "light" } { "classname" "light" "light" "160" "origin" "1520 480 520" "_color" "1.000000 0.701961 0.529412" } { "_color" "0.792157 0.749020 1.000000" "light" "100" "classname" "light" "origin" "1080 -480 592" } { "_color" "0.501961 0.501961 1.000000" "light" "160" "classname" "light" "origin" "1056 -832 320" } { "_color" "0.501961 0.501961 1.000000" "light" "160" "classname" "light" "origin" "928 -704 320" } { "_color" "0.501961 0.501961 1.000000" "light" "160" "classname" "light" "origin" "928 -480 320" } { "_color" "0.501961 0.501961 1.000000" "light" "160" "classname" "light" "origin" "928 -256 320" } { "_color" "0.501961 0.501961 1.000000" "light" "160" "classname" "light" "origin" "1056 -128 320" } { "classname" "light" "light" "160" "_color" "0.501961 0.501961 1.000000" "origin" "1248 -832 320" } { "classname" "light" "light" "120" "_color" "1.000000 0.588235 0.235294" "origin" "928 -424 120" } { "_color" "1.000000 0.588235 0.235294" "light" "120" "classname" "light" "origin" "928 -536 120" } { "_color" "1.000000 0.588235 0.235294" "light" "120" "classname" "light" "origin" "848 -424 120" } { "classname" "light" "light" "120" "_color" "1.000000 0.588235 0.235294" "origin" "848 -536 120" } { "_color" "1.000000 0.705882 0.529412" "light" "120" "classname" "light" "origin" "512 -736 104" } { "_color" "1.000000 0.924901 0.656126" "origin" "1592 -480 288" "classname" "light" "light" "150" } { "origin" "1080 -976 544" "classname" "light" "light" "120" "_color" "1.000000 0.846154 0.396761" } { "origin" "936 -976 544" "classname" "light" "light" "120" "_color" "1.000000 0.846154 0.396761" } { "origin" "512 -576 104" "classname" "light" "light" "120" "_color" "1.000000 0.705882 0.529412" } { "origin" "712 -736 104" "classname" "light" "light" "120" "_color" "1.000000 0.705882 0.529412" } { "origin" "512 -928 104" "classname" "light" "light" "120" "_color" "1.000000 0.705882 0.529412" } { "origin" "512 -1120 104" "classname" "light" "light" "120" "_color" "1.000000 0.705882 0.529412" } { "origin" "800 -1120 104" "classname" "light" "light" "120" "_color" "1.000000 0.705882 0.529412" } { "origin" "824 -1280 104" "classname" "light" "light" "120" "_color" "1.000000 0.705882 0.529412" } { "origin" "800 -1472 104" "classname" "light" "light" "120" "_color" "1.000000 0.705882 0.529412" } { "origin" "800 -1664 104" "classname" "light" "light" "120" "_color" "1.000000 0.705882 0.529412" } { "classname" "light" "light" "120" "_color" "1.000000 0.705882 0.529412" "origin" "800 -1856 104" } { "classname" "light" "light" "120" "_color" "1.000000 0.705882 0.529412" "origin" "608 -1856 104" } { "classname" "light" "light" "120" "_color" "1.000000 0.705882 0.529412" "origin" "224 -1856 104" } { "_color" "1.000000 0.705882 0.529412" "light" "50" "classname" "light" "origin" "512 -448 104" } { "_color" "1.000000 0.705882 0.529412" "light" "120" "classname" "light" "origin" "448 -1440 104" } { "_color" "1.000000 0.705882 0.529412" "light" "120" "classname" "light" "origin" "224 -1440 104" } { "classname" "light" "light" "120" "_color" "1.000000 0.705882 0.529412" "origin" "224 -1664 104" } { "classname" "func_group" } { "classname" "func_group" } { "origin" "1120 -1760 328" "_color" "1.000000 0.924901 0.656126" "light" "120" "classname" "light" } { "model" "*32" "targetname" "reddr1" "_minlight" "0.1" "angle" "180" "classname" "func_door" "wait" "2" "spawnflags" "4" } { "model" "*33" "targetname" "reddr1" "_minlight" "0.1" "angle" "0" "classname" "func_door" "target" "t18" "wait" "2" "spawnflags" "4" } { "model" "*34" "mass" "200" "health" "25" "classname" "func_explosive" "target" "t6" } { "model" "*35" "mass" "200" "health" "25" "classname" "func_explosive" "target" "t7" } { "origin" "1532 -392 284" "noise" "world/brkglas.wav" "classname" "target_speaker" "targetname" "t5" } { "origin" "1532 -568 284" "classname" "target_speaker" "noise" "world/brkglas.wav" "targetname" "t6" } { "origin" "1608 -480 284" "classname" "target_speaker" "noise" "world/brkglas.wav" "targetname" "t7" } { "origin" "2784 -1120 328" "_color" "1.000000 0.924901 0.656126" "light" "120" "classname" "light" } { "classname" "light" "light" "120" "_color" "1.000000 0.924901 0.656126" "origin" "1632 -2272 328" } { "_color" "1.000000 0.846154 0.396761" "light" "120" "classname" "light" "origin" "1280 -840 544" } { "_color" "1.000000 0.846154 0.396761" "light" "120" "classname" "light" "origin" "1280 -696 544" } { "_color" "1.000000 0.846154 0.396761" "light" "120" "classname" "light" "origin" "1280 -264 544" } { "_color" "1.000000 0.846154 0.396761" "light" "120" "classname" "light" "origin" "1280 -120 544" } { "origin" "936 16 544" "classname" "light" "light" "120" "_color" "1.000000 0.846154 0.396761" } { "origin" "1080 16 544" "classname" "light" "light" "120" "_color" "1.000000 0.846154 0.396761" } { "_color" "1.000000 0.846154 0.396761" "light" "120" "classname" "light" "origin" "728 -120 544" } { "_color" "1.000000 0.846154 0.396761" "light" "120" "classname" "light" "origin" "728 -264 544" } { "origin" "728 -696 544" "classname" "light" "light" "120" "_color" "1.000000 0.846154 0.396761" } { "origin" "728 -840 544" "classname" "light" "light" "120" "_color" "1.000000 0.846154 0.396761" } { "spawnflags" "1" "classname" "target_speaker" "noise" "world/steam3.wav" "origin" "968 -480 264" } { "model" "*36" "origin" "420 -2236 84" "distance" "90" "_minlight" "0.1" "classname" "func_door_rotating" } { "origin" "1392 -496 480" "classname" "ammo_rockets" "angle" "180" "spawnflags" "3584" } { "origin" "1488 -480 168" "classname" "light" "light" "120" "_color" "0.501961 0.501961 1.000000" } { "light" "120" "classname" "light" "origin" "1592 -480 168" "_color" "0.501961 0.501961 1.000000" } { "origin" "1576 -448 256" "targetname" "t56" "spawnflags" "2052" "noise" "world/datafiles.wav" "classname" "target_speaker" "attenuation" "-1" } { "classname" "item_pack" "spawnflags" "1792" "origin" "2168 -1656 272" } { "classname" "target_secret" "spawnflags" "2048" "origin" "304 1096 304" "targetname" "invulsec" "message" "You found a secret item." }