djcev.com

//

Git Repos / fte_dogmode / commit 689b891

Commit: 689b89135916beb05b98056dc5fbbf5ad0b7dbd4
Parent: c95cd513f1bc5fadf1378474b54b714516f96d9b
Author: Cameron Vanderzanden, 2023-12-02 11:16
Committer: Cameron Vanderzanden, 2023-12-02 11:16

Commit Message

More refactoring & moving, begin adding mdls & snd

Moved entities from misc.qc and dtmisc.qc into files in misc/,
refactored items into files in items/. Did a little cleanup and
reformatting to a few other files (subs, utility, etc.). Plus
more refactoring changes I'm forgetting.

I've started importing the Q1 mdls from progs_dump V3 into this
repository; the ammo and health models are present now. Also
brought in one sound file. (More models and sounds are coming).

Also brought in the standard GPL2 COPYING.txt .

Change List

?File Add Del
A COPYING.txt +340
A progs/ammo/m_cells1.mdl
A progs/ammo/m_cells2.mdl
A progs/ammo/m_nails1.mdl
A progs/ammo/m_nails2.mdl
A progs/ammo/m_rock1.mdl
A progs/ammo/m_rock2.mdl
A progs/ammo/m_shell1.mdl
A progs/ammo/m_shell2.mdl
A progs/health/m_h100.mdl
A progs/health/m_h15.mdl
A progs/health/m_h25.mdl
A progs/health/pd_vial.mdl
A progs/teleport.mdl
A qc/client/impulse.qc +90
A qc/client/intermission.qc +335
M qc/compat_quake3.qc +4 -1
M qc/cshift.qc +15 -4
M qc/csqc/csqc_entrypoints.qc +1 -1
M qc/csqc/csqc_progs.src +14 -7
M qc/custom_mdls.qc +86 -37
M qc/custom_snd.qc +233 -60
D qc/doe_ltrail.qc -194
D qc/dtmisc.qc -822
D qc/fog.qc -544
M qc/func/rotate.qc -14
A qc/hazards/ltrail.qc +208
A qc/hazards/shooter.qc +335
D qc/intermission.qc -265
D qc/items.qc -1947
A qc/items/ammo.qc +346
A qc/items/armor.qc +278
A qc/items/backpacks.qc +501
A qc/items/health.qc +271
A qc/items/keys.qc +234
A qc/items/misc.qc +155
A qc/items/powerups.qc +224
A qc/items/runes.qc +106
A qc/items/weapons.qc +380
D qc/items_armor.qc -290
D qc/items_health.qc -271
M qc/keydata.qc +81 -113
M qc/keylock.qc +42 -58
D qc/lights.qc -490
D qc/misc.qc -1341
A qc/misc/air_bubbles.qc +124
A qc/misc/ambient_sound.qc +259
A qc/misc/deadstuff.qc +361
A qc/misc/explobox.qc +93
A qc/misc/fireball.qc +61
A qc/misc/infight.qc +120
A qc/misc/light_candle.qc +147
A qc/misc/lights.qc +492
A qc/misc/model.qc +194
A qc/misc/noisemaker.qc +41
A qc/misc/play.qc +468
A qc/misc/target_autosave.qc +96
A qc/misc/viewthing.qc +21
D qc/misc_model.qc -188
M qc/player.qc +90 -105
M qc/pmove.qc +2 -1
M qc/progs.src +67 -30
M qc/subs.qc +385 -311
A qc/triggers/fog.qc +598
M qc/triggers/void.qc +6 -2
M qc/utility.qc +8 -1
M qc/weapons.qc -97
M qc/world.qc +5 -5
A sound/oldone2/pd_pop2.wav

Diff COPYING.txt

diff --git a/COPYING.txt b/COPYING.txt
new file mode 100644
index 0000000..d60c31a
--- /dev/null
+++ b/COPYING.txt
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.

Return to the top of this page or return to the overview of this repo.

Diff progs/ammo/m_cells1.mdl

diff --git a/progs/ammo/m_cells1.mdl b/progs/ammo/m_cells1.mdl
new file mode 100644
index 0000000..49428a8
Binary files /dev/null and b/progs/ammo/m_cells1.mdl differ

Return to the top of this page or return to the overview of this repo.

Diff progs/ammo/m_cells2.mdl

diff --git a/progs/ammo/m_cells2.mdl b/progs/ammo/m_cells2.mdl
new file mode 100644
index 0000000..a28bbbe
Binary files /dev/null and b/progs/ammo/m_cells2.mdl differ

Return to the top of this page or return to the overview of this repo.

Diff progs/ammo/m_nails1.mdl

diff --git a/progs/ammo/m_nails1.mdl b/progs/ammo/m_nails1.mdl
new file mode 100644
index 0000000..2a7471c
Binary files /dev/null and b/progs/ammo/m_nails1.mdl differ

Return to the top of this page or return to the overview of this repo.

Diff progs/ammo/m_nails2.mdl

diff --git a/progs/ammo/m_nails2.mdl b/progs/ammo/m_nails2.mdl
new file mode 100644
index 0000000..82298f0
Binary files /dev/null and b/progs/ammo/m_nails2.mdl differ

Return to the top of this page or return to the overview of this repo.

Diff progs/ammo/m_rock1.mdl

diff --git a/progs/ammo/m_rock1.mdl b/progs/ammo/m_rock1.mdl
new file mode 100644
index 0000000..53c6cb1
Binary files /dev/null and b/progs/ammo/m_rock1.mdl differ

Return to the top of this page or return to the overview of this repo.

Diff progs/ammo/m_rock2.mdl

diff --git a/progs/ammo/m_rock2.mdl b/progs/ammo/m_rock2.mdl
new file mode 100644
index 0000000..ee07395
Binary files /dev/null and b/progs/ammo/m_rock2.mdl differ

Return to the top of this page or return to the overview of this repo.

Diff progs/ammo/m_shell1.mdl

diff --git a/progs/ammo/m_shell1.mdl b/progs/ammo/m_shell1.mdl
new file mode 100644
index 0000000..855f070
Binary files /dev/null and b/progs/ammo/m_shell1.mdl differ

Return to the top of this page or return to the overview of this repo.

Diff progs/ammo/m_shell2.mdl

diff --git a/progs/ammo/m_shell2.mdl b/progs/ammo/m_shell2.mdl
new file mode 100644
index 0000000..047e6d3
Binary files /dev/null and b/progs/ammo/m_shell2.mdl differ

Return to the top of this page or return to the overview of this repo.

Diff progs/health/m_h100.mdl

diff --git a/progs/health/m_h100.mdl b/progs/health/m_h100.mdl
new file mode 100644
index 0000000..6966039
Binary files /dev/null and b/progs/health/m_h100.mdl differ

Return to the top of this page or return to the overview of this repo.

Diff progs/health/m_h15.mdl

diff --git a/progs/health/m_h15.mdl b/progs/health/m_h15.mdl
new file mode 100644
index 0000000..a2c901c
Binary files /dev/null and b/progs/health/m_h15.mdl differ

Return to the top of this page or return to the overview of this repo.

Diff progs/health/m_h25.mdl

diff --git a/progs/health/m_h25.mdl b/progs/health/m_h25.mdl
new file mode 100644
index 0000000..47f4ff0
Binary files /dev/null and b/progs/health/m_h25.mdl differ

Return to the top of this page or return to the overview of this repo.

Diff progs/health/pd_vial.mdl

diff --git a/progs/health/pd_vial.mdl b/progs/health/pd_vial.mdl
new file mode 100644
index 0000000..6ab464f
Binary files /dev/null and b/progs/health/pd_vial.mdl differ

Return to the top of this page or return to the overview of this repo.

Diff progs/teleport.mdl

diff --git a/progs/teleport.mdl b/progs/teleport.mdl
new file mode 100644
index 0000000..6d574a1
Binary files /dev/null and b/progs/teleport.mdl differ

Return to the top of this page or return to the overview of this repo.

Diff qc/client/impulse.qc

diff --git a/qc/client/impulse.qc b/qc/client/impulse.qc
new file mode 100644
index 0000000..aebefa5
--- /dev/null
+++ b/qc/client/impulse.qc
@@ -0,0 +1,90 @@
+//==============================================================================
+// client/impulse.qc -- impulse commands
+//==============================================================================
+
+//----------------------------------------------------------------------
+// CheatCommand
+//----------------------------------------------------------------------
+void() CheatCommand =
+{
+ // 1998-07-29 Cheats coop fix by Maddes start
+ // if (deathmatch || coop)
+ if (deathmatch)
+ // 1998-07-29 Cheats coop fix by Maddes end
+ return;
+
+ self.ammo_cells = 200;
+ self.ammo_nails = 200;
+ self.ammo_rockets = 100;
+ self.ammo_shells = 100;
+ self.items = self.items | IT_AXE | IT_SHOTGUN | IT_SUPER_SHOTGUN |
+ IT_NAILGUN | IT_SUPER_NAILGUN | IT_GRENADE_LAUNCHER |
+ IT_ROCKET_LAUNCHER | IT_LIGHTNING;
+
+ // support for item_key_custom -- iw
+ GiveAllKeys (self);
+
+ self.weapon = IT_ROCKET_LAUNCHER;
+ self.impulse = 0;
+ W_SetCurrentAmmo ();
+};
+
+//----------------------------------------------------------------------
+void() QuadCheat =
+{
+ // 1998-07-29 Cheats coop fix by Maddes start
+ // if (deathmatch || coop)
+ if (deathmatch)
+ // 1998-07-29 Cheats coop fix by Maddes end
+ return;
+
+ self.super_time = 1;
+ self.super_damage_finished = time + 30;
+ self.items = self.items | IT_QUAD;
+ dprint ("quad cheat\n");
+};
+
+//----------------------------------------------------------------------
+// ServerflagsCommand -- Just for development
+//----------------------------------------------------------------------
+void() ServerflagsCommand =
+{
+ // 1998-07-29 Cheats coop fix by Maddes start
+ if (deathmatch)
+ return;
+ // 1998-07-29 Cheats coop fix by Maddes end
+
+ serverflags = serverflags * 2 + 1;
+};
+
+//----------------------------------------------------------------------
+// ImpulseCommands
+//----------------------------------------------------------------------
+void() ImpulseCommands =
+{
+ if (self.impulse >= 1 && self.impulse <= 8)
+ W_ChangeWeapon ();
+
+ if (self.impulse == 9)
+ CheatCommand ();
+ if (self.impulse == 10)
+ CycleWeaponCommand ();
+ if (self.impulse == 11)
+ ServerflagsCommand ();
+ if (self.impulse == 12)
+ CycleWeaponReverseCommand ();
+
+ if (self.impulse == 255)
+ QuadCheat ();
+
+ // dumptruck_ds version inspired by Copper
+ if (self.impulse == 100)
+ sprint (self, version);
+
+ // if (self.impulse == 101) // debugging armor shards -- dumptruck_ds
+ // dprint ("Armortype is");
+ // dprint (ftos(self.armortype));
+ // dprint ("\n");
+
+ self.impulse = 0;
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/client/intermission.qc

diff --git a/qc/client/intermission.qc b/qc/client/intermission.qc
new file mode 100644
index 0000000..e376539
--- /dev/null
+++ b/qc/client/intermission.qc
@@ -0,0 +1,335 @@
+//==============================================================================
+// intermission.qc -- LEVEL CHANGING / INTERMISSION
+//==============================================================================
+
+// globals
+float intermission_running;
+float intermission_exittime;
+entity used_exit;
+string nextmap;
+
+/*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+
+This is the camera point for the intermission.
+Use mangle instead of angle, so you can set pitch or roll as well as yaw. 'pitch roll yaw'
+*/
+void() info_intermission =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+};
+
+//----------------------------------------------------------------------
+void() info_intermissiontext =
+{
+ if (self.message == "" || self.cnt == 0)
+ {
+ objerror ("endscreen lacks required fields");
+ }
+};
+
+//----------------------------------------------------------------------
+void(string message) ShowIntermissionMessage =
+{
+ WriteByte (MSG_ALL, SVC_FINALE);
+ WriteString (MSG_ALL, message);
+};
+
+//----------------------------------------------------------------------
+void() StartMessageIntermission =
+{
+ WriteByte (MSG_ALL, SVC_CDTRACK);
+ WriteByte (MSG_ALL, 2);
+ WriteByte (MSG_ALL, 3);
+};
+
+//----------------------------------------------------------------------
+void() Episode1End =
+{
+ StartMessageIntermission ();
+
+ if (!cvar("registered"))
+ {
+ ShowIntermissionMessage ("As the corpse of the monstrous "
+ "entity\nChthon sinks back into the lava whence\n"
+ "it rose, you grip the Rune of Earth\n"
+ "Magic tightly. Now that you have\n"
+ "conquered the Dimension of the Doomed,\n"
+ "realm of Earth Magic, you are ready to\n"
+ "complete your task in the other three\n"
+ "haunted lands of Quake. Or are you? If\n"
+ "you don't register Quake, you'll never\n"
+ "know what awaits you in the Realm of\n"
+ "Black Magic, the Netherworld, and the\nElder World!");
+ }
+ else
+ {
+ ShowIntermissionMessage ("As the corpse of the monstrous"
+ "entity\nChthon sinks back into the lava whence\n"
+ "it rose, you grip the Rune of Earth\n"
+ "Magic tightly. Now that you have\n"
+ "conquered the Dimension of the Doomed,\n"
+ "realm of Earth Magic, you are ready to\n"
+ "complete your task. A Rune of magic\n"
+ "power lies at the end of each haunted\n"
+ "land of Quake. Go forth, seek the\n"
+ "totality of the four Runes!");
+ }
+};
+
+//----------------------------------------------------------------------
+void() Episode2End =
+{
+ StartMessageIntermission ();
+
+ ShowIntermissionMessage ("The Rune of Black Magic throbs evilly in\n"
+ "your hand and whispers dark thoughts\n"
+ "into your brain. You learn the inmost\n"
+ "lore of the Hell-Mother; Shub-Niggurath!\n"
+ "You now know that she is behind all the\n"
+ "terrible plotting which has led to so\n"
+ "much death and horror. But she is not\n"
+ "inviolate! Armed with this Rune, you\n"
+ "realize that once all four Runes are\n"
+ "combined, the gate to Shub-Niggurath's\n"
+ "Pit will open, and you can face the\n"
+ "Witch-Goddess herself in her frightful\n"
+ "otherworld cathedral.");
+};
+
+//----------------------------------------------------------------------
+void() Episode3End =
+{
+ StartMessageIntermission ();
+
+ ShowIntermissionMessage ("The charred viscera of diabolic horrors\n"
+ "bubble viscously as you seize the Rune\n"
+ "of Hell Magic. Its heat scorches your\n"
+ "hand, and its terrible secrets blight\n"
+ "your mind. Gathering the shreds of your\n"
+ "courage, you shake the devil's shackles\n"
+ "from your soul, and become ever more\n"
+ "hard and determined to destroy the\n"
+ "hideous creatures whose mere existence\n"
+ "threatens the souls and psyches of all\n"
+ "the population of Earth.");
+
+};
+
+//----------------------------------------------------------------------
+void() Episode4End =
+{
+ StartMessageIntermission ();
+
+ ShowIntermissionMessage ("Despite the awful might of the Elder\n"
+ "World, you have achieved the Rune of\n"
+ "Elder Magic, capstone of all types of\n"
+ "arcane wisdom. Beyond good and evil,\n"
+ "beyond life and death, the Rune\n"
+ "pulsates, heavy with import. Patient and\n"
+ "potent, the Elder Being Shub-Niggurath\n"
+ "weaves her dire plans to clear off all\n"
+ "life from the Earth, and bring her own\n"
+ "foul offspring to our world! For all the\n"
+ "dwellers in these nightmare dimensions\n"
+ "are her descendants! Once all Runes of\n"
+ "magic power are united, the energy\n"
+ "behind them will blast open the Gateway\n"
+ "to Shub-Niggurath, and you can travel\n"
+ "there to foil the Hell-Mother's plots\nin person.");
+};
+
+//----------------------------------------------------------------------
+float() RunId1Intermissions =
+{
+ if (world.skip_id1_overrides == 0)
+ {
+ if (world.model == "maps/e1m7.bsp")
+ {
+ Episode1End ();
+ return 1;
+ }
+ else if (world.model == "maps/e2m6.bsp")
+ {
+ Episode2End ();
+ return 1;
+ }
+ else if (world.model == "maps/e3m6.bsp")
+ {
+ Episode3End ();
+ return 1;
+ }
+ else if (world.model == "maps/e4m7.bsp")
+ {
+ Episode4End ();
+ return 1;
+ }
+ }
+ return 0;
+};
+
+//----------------------------------------------------------------------
+// FindIntermission -- Returns the entity to view from
+//----------------------------------------------------------------------
+entity() FindIntermission =
+{
+ local entity spot;
+ local float cyc;
+
+ // look for info_intermission first
+ spot = find (world, classname, "info_intermission");
+ if (spot)
+ { // pick a random one
+ cyc = random() * 4;
+ while (cyc > 1)
+ {
+ spot = find (spot, classname, "info_intermission");
+ if (!spot)
+ spot = find (spot, classname,
+ "info_intermission");
+ cyc = cyc - 1;
+ }
+ return spot;
+ }
+
+ // then look for the start position
+ spot = find (world, classname, "info_player_start");
+ if (spot)
+ return spot;
+
+ // testinfo_player_start is only found in regioned levels
+ spot = find (world, classname, "testplayerstart");
+ if (spot)
+ return spot;
+
+ objerror ("FindIntermission: no spot");
+
+ // just to suppress the compiler warning
+ return world;
+};
+
+//----------------------------------------------------------------------
+void() GotoNextMap =
+{
+ if (cvar("samelevel"))
+ // if samelevel is set, stay on same level
+ changelevel (mapname);
+ else
+ changelevel (nextmap);
+};
+
+//----------------------------------------------------------------------
+float(float start) ShowIntermissionTextEntity =
+{
+ if (!(used_exit.spawnflags & 2))
+ {
+ local entity end_message;
+ for (end_message = world; (end_message = find
+ (end_message, classname, "info_intermissiontext")); )
+ {
+ if (end_message.cnt == (intermission_running - 1))
+ {
+ if (start == 1)
+ StartMessageIntermission ();
+ ShowIntermissionMessage (end_message.message);
+ return 1;
+ }
+ }
+ }
+ return 0;
+};
+
+//----------------------------------------------------------------------
+void() ExitIntermission =
+{
+ // skip any text in deathmatch
+ if (deathmatch)
+ {
+ GotoNextMap ();
+ return;
+ }
+
+ intermission_exittime = time + 1;
+ intermission_running = intermission_running + 1;
+
+ // run some text if at the end of an episode
+ if (intermission_running == 2)
+ {
+ if (RunId1Intermissions() == 1)
+ {
+ return;
+ }
+ else
+ {
+ if (used_exit.message != "")
+ {
+ // favor message on changelevel
+ StartMessageIntermission ();
+ ShowIntermissionMessage (used_exit.message);
+ return;
+ }
+ if (ShowIntermissionTextEntity(1))
+ {
+ return;
+ }
+ }
+
+ GotoNextMap ();
+ }
+
+ if (intermission_running == 3)
+ {
+ if (!cvar("registered"))
+ {
+ // shareware episode has been completed,
+ // go to sell screen
+ WriteByte (MSG_ALL, SVC_SELLSCREEN);
+ return;
+ }
+ if (ShowIntermissionTextEntity(0))
+ {
+ return;
+ }
+ if ((serverflags&15) == 15)
+ {
+ ShowIntermissionMessage ("Now, you have all four Runes."
+ " You sense\ntremendous invisible forces moving"
+ " to\nunseal ancient barriers."
+ " Shub-Niggurath\nhad hoped to use the Runes"
+ " Herself to\nclear off the Earth, but now"
+ " instead,\nyou will use them to enter her"
+ " home and\nconfront her as an avatar of"
+ " avenging\nEarth-life. If you defeat her,"
+ " you will\nbe remembered forever as the"
+ " savior of\nthe planet. If she conquers,"
+ " it will be\nas if you had never been born.");
+ return;
+ }
+ }
+
+ if (intermission_running > 3)
+ {
+ if (ShowIntermissionTextEntity(0))
+ {
+ return;
+ }
+ }
+
+ GotoNextMap ();
+};
+
+//----------------------------------------------------------------------
+// IntermissionThink -- When the player presses attack or jump, change
+// to the next level
+//----------------------------------------------------------------------
+void() IntermissionThink =
+{
+ if (time < intermission_exittime)
+ return;
+
+ if (!self.button0 && !self.button1 && !self.button2)
+ return;
+
+ ExitIntermission ();
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/compat_quake3.qc

diff --git a/qc/compat_quake3.qc b/qc/compat_quake3.qc
index 05b38d3..d437bf5 100644
--- a/qc/compat_quake3.qc
+++ b/qc/compat_quake3.qc
@@ -16,8 +16,9 @@ void() info_teleport_destination;

//======================================================================
// Quake 3 armor item support -- CEV
-//----------------------------------------------------------------------
+//======================================================================

+//----------------------------------------------------------------------
// Green Armor -- CEV
//----------------------------------------------------------------------
void() spawnfunc_item_armor_jacket =
@@ -26,6 +27,7 @@ void() spawnfunc_item_armor_jacket =
item_armor1 ();
};

+//----------------------------------------------------------------------
// Yellow Armor -- CEV
//----------------------------------------------------------------------
void() spawnfunc_item_armor_combat =
@@ -34,6 +36,7 @@ void() spawnfunc_item_armor_combat =
item_armor2 ();
};

+//----------------------------------------------------------------------
// Red Armor -- CEV
//----------------------------------------------------------------------
void() spawnfunc_item_armor_body =

Return to the top of this page or return to the overview of this repo.

Diff qc/cshift.qc

diff --git a/qc/cshift.qc b/qc/cshift.qc
index 95c4406..86cd34f 100644
--- a/qc/cshift.qc
+++ b/qc/cshift.qc
@@ -1,9 +1,15 @@
+//==============================================================================
+// cshift.qc
+//==============================================================================
+
+//----------------------------------------------------------------------
inline void(entity client, float density, vector color) csf_save =
{
client.csf_color = color;
client.csf_density = density;
};

+//----------------------------------------------------------------------
inline void(entity client) csf_apply =
{
stuffcmd (client, "\nv_cshift ");
@@ -17,12 +23,14 @@ inline void(entity client) csf_apply =
stuffcmd (client, "\n");
};

+//----------------------------------------------------------------------
void(entity client, float density, vector color) csf_set =
{
csf_save (client, density, color);
csf_apply (client);
};

+//----------------------------------------------------------------------
void() csfcontroller_think =
{
entity e = self.owner;
@@ -30,11 +38,11 @@ void() csfcontroller_think =
if (self.pain_finished > time && e.csf_density != self.csf_density)
{

- float density;
- vector color;
+ local float density, fraction;
+ local vector color;

// wat
- float fraction = 1 - (self.pain_finished - time) / self.speed;
+ fraction = 1 - (self.pain_finished - time) / self.speed;

density = lerpHermite (e.csf_density, self.csf_density,
fraction);
@@ -49,14 +57,16 @@ void() csfcontroller_think =
{
csf_set(e, self.csf_density, self.csf_color);
}
-
};

+//----------------------------------------------------------------------
void(entity client) csfcontroller_start =
{
if (client.csfcontroller.classname == "csfcontroller" &&
client.csfcontroller.owner == client)
+ {
return;
+ }

entity e = spawn ();
client.csfcontroller = e;
@@ -65,6 +75,7 @@ void(entity client) csfcontroller_start =
e.think = csfcontroller_think;
};

+//----------------------------------------------------------------------
void(entity client, float density, vector color, float spd) csf_fade =
{
csfcontroller_start (client);

Return to the top of this page or return to the overview of this repo.

Diff qc/csqc/csqc_entrypoints.qc

diff --git a/qc/csqc/csqc_entrypoints.qc b/qc/csqc/csqc_entrypoints.qc
index 02fa6e9..fcf11bc 100644
--- a/qc/csqc/csqc_entrypoints.qc
+++ b/qc/csqc/csqc_entrypoints.qc
@@ -115,7 +115,7 @@ void(float vwidth, float vheight, float notmenu) CSQC_UpdateView =

// TODO CEV
// addentities (MASK_ENGINE|MASK_VIEWMODEL);
- addentities (MASK_NORMAL|MASK_ENGINE);
+ addentities (MASK_NORMAL | MASK_ENGINE | MASK_VIEWMODEL);
setproperty (VF_MIN, '0 0');
setproperty (VF_SIZE, ssize);

Return to the top of this page or return to the overview of this repo.

Diff qc/csqc/csqc_progs.src

diff --git a/qc/csqc/csqc_progs.src b/qc/csqc/csqc_progs.src
index fd7728b..0df5b11 100644
--- a/qc/csqc/csqc_progs.src
+++ b/qc/csqc/csqc_progs.src
@@ -6,13 +6,20 @@
#define CSQC

#includelist
-../defs_globalvars.qc
-../defs_entvars.qc
-csqc_defsbuiltins.qc
+//----------------------------------------------------------------------
+// CSQC defs
+//----------------------------------------------------------------------
+../defs_globalvars.qc // globalvars_t
+../defs_entvars.qc // entvars_t
+csqc_defsbuiltins.qc // curated builtings list
csqc_defsclient.qc
csqc_defs.qc
-../pmove.qc
-csqc_player.qc
-csqc_hudvanilla.qc
-csqc_entrypoints.qc
+
+//----------------------------------------------------------------------
+// movement & client prediction, HUD, entity handling
+//----------------------------------------------------------------------
+../pmove.qc // player movement code
+csqc_player.qc // player handling
+csqc_hudvanilla.qc // HUD
+csqc_entrypoints.qc //
#endlist

Return to the top of this page or return to the overview of this repo.

Diff qc/custom_mdls.qc

diff --git a/qc/custom_mdls.qc b/qc/custom_mdls.qc
index 266aa92..b86d7f0 100644
--- a/qc/custom_mdls.qc
+++ b/qc/custom_mdls.qc
@@ -1,17 +1,10 @@
-/*
-
-========================================================================
-
-MAPPER-SETTABLE CUSTOM MODELS FOR MONSTERS
+//==============================================================================
+// MAPPER-SETTABLE CUSTOM MODELS FOR MONSTERS
+//==============================================================================

-========================================================================
-*/
-
-/*
-================
-precache_model_custom
-================
-*/
+//----------------------------------------------------------------------
+// precache_model_custom
+//----------------------------------------------------------------------
void(.string mdl_field, string default_file) precache_model_custom =
{
if (self.mdl_field != "")
@@ -20,20 +13,45 @@ void(.string mdl_field, string default_file) precache_model_custom =
precache_model (default_file);
};

+//----------------------------------------------------------------------
+void(string default_file) precache_head_model =
+{
+ precache_model_custom (mdl_head, default_file);
+};

-void(string default_file) precache_head_model = { precache_model_custom (mdl_head, default_file); };
-void(string default_file) precache_body_model = { precache_model_custom (mdl_body, default_file); };
-void(string default_file) precache_proj_model = { precache_model_custom (mdl_proj, default_file); };
-void(string default_file) precache_gib1 = { precache_model_custom (mdl_gib1, default_file); };
-void(string default_file) precache_gib2 = { precache_model_custom (mdl_gib2, default_file); };
-void(string default_file) precache_gib3 = { precache_model_custom (mdl_gib3, default_file); };
+//----------------------------------------------------------------------
+void(string default_file) precache_body_model =
+{
+ precache_model_custom (mdl_body, default_file);
+};

+//----------------------------------------------------------------------
+void(string default_file) precache_proj_model =
+{
+ precache_model_custom (mdl_proj, default_file);
+};

-/*
-================
-precache_model2_custom
-================
-*/
+//----------------------------------------------------------------------
+void(string default_file) precache_gib1 =
+{
+ precache_model_custom (mdl_gib1, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_gib2 =
+{
+ precache_model_custom (mdl_gib2, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_gib3 =
+{
+ precache_model_custom (mdl_gib3, default_file);
+};
+
+//----------------------------------------------------------------------
+// precache_model2_custom
+//----------------------------------------------------------------------
void(.string mdl_field, string default_file) precache_model2_custom =
{
if (self.mdl_field != "")
@@ -42,29 +60,60 @@ void(.string mdl_field, string default_file) precache_model2_custom =
precache_model2 (default_file);
};

+//----------------------------------------------------------------------
+void(string default_file) precache_head_model2 =
+{
+ precache_model2_custom (mdl_head, default_file);
+};

-void(string default_file) precache_head_model2 = { precache_model2_custom (mdl_head, default_file); };
-void(string default_file) precache_body_model2 = { precache_model2_custom (mdl_body, default_file); };
-void(string default_file) precache_proj_model2 = { precache_model2_custom (mdl_proj, default_file); };
-void(string default_file) precache_exproj_model2 = { precache_model2_custom (mdl_exproj, default_file); };
+//----------------------------------------------------------------------
+void(string default_file) precache_body_model2 =
+{
+ precache_model2_custom (mdl_body, default_file);
+};

+//----------------------------------------------------------------------
+void(string default_file) precache_proj_model2 =
+{
+ precache_model2_custom (mdl_proj, default_file);
+};

-/*
-================
-model_custom
-================
-*/
+//----------------------------------------------------------------------
+void(string default_file) precache_exproj_model2 =
+{
+ precache_model2_custom (mdl_exproj, default_file);
+};
+
+//----------------------------------------------------------------------
+// model_custom
+//----------------------------------------------------------------------
void(.string mdl_field, string default_file) model_custom =
{
if (self.mdl_field != "")
{
setmodel (self, self.mdl_field);
- // dprint("CUSTOM MODEL LOADED\n");
+ // dprint ("CUSTOM MODEL LOADED\n");
}
else
setmodel (self, default_file);
};

-void(string default_file) body_model = { model_custom (mdl_body, default_file); };
-// void(string default_file) head_model = { model_custom (mdl_head, default_file); };
-void(string default_file) proj_model = { model_custom (mdl_proj, default_file); };
+//----------------------------------------------------------------------
+void(string default_file) body_model =
+{
+ model_custom (mdl_body, default_file);
+};
+
+/*
+//----------------------------------------------------------------------
+void(string default_file) head_model =
+{
+ model_custom (mdl_head, default_file);
+};
+*/
+
+//----------------------------------------------------------------------
+void(string default_file) proj_model =
+{
+ model_custom (mdl_proj, default_file);
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/custom_snd.qc

diff --git a/qc/custom_snd.qc b/qc/custom_snd.qc
index 920d093..b03e69c 100644
--- a/qc/custom_snd.qc
+++ b/qc/custom_snd.qc
@@ -1,25 +1,18 @@
-/*
-========================================================================
-
-MAPPER-SETTABLE CUSTOM SOUND EFFECTS FOR MONSTERS
+//==============================================================================
+// MAPPER-SETTABLE CUSTOM SOUND EFFECTS FOR MONSTERS
+//==============================================================================

+/*
========================================================================
-
-
This file was created for progs_dump by Ian "iw" Walshaw, January 2020.

TODO: iw to add descriptive comments to this file.
-
-
========================================================================
*/

-
-/*
-================
-precache_sound_custom
-================
-*/
+//----------------------------------------------------------------------
+// precache_sound_custom
+//----------------------------------------------------------------------
void(.string snd_field, string default_file) precache_sound_custom =
{
if (self.snd_field != "")
@@ -28,26 +21,81 @@ void(.string snd_field, string default_file) precache_sound_custom =
precache_sound (default_file);
};

+//----------------------------------------------------------------------
+void(string default_file) precache_sound_attack =
+{
+ precache_sound_custom (snd_attack, default_file);
+};

-void(string default_file) precache_sound_attack = { precache_sound_custom (snd_attack, default_file); };
-void(string default_file) precache_sound_death = { precache_sound_custom (snd_death, default_file); };
-void(string default_file) precache_sound_hit = { precache_sound_custom (snd_hit, default_file); };
-void(string default_file) precache_sound_idle = { precache_sound_custom (snd_idle, default_file); };
-void(string default_file) precache_sound_land = { precache_sound_custom (snd_land, default_file); };
-void(string default_file) precache_sound_misc = { precache_sound_custom (snd_misc, default_file); };
-void(string default_file) precache_sound_misc1 = { precache_sound_custom (snd_misc1, default_file); };
-void(string default_file) precache_sound_misc2 = { precache_sound_custom (snd_misc2, default_file); };
-void(string default_file) precache_sound_misc3 = { precache_sound_custom (snd_misc3, default_file); };
-void(string default_file) precache_sound_move = { precache_sound_custom (snd_move, default_file); };
-void(string default_file) precache_sound_pain = { precache_sound_custom (snd_pain, default_file); };
-void(string default_file) precache_sound_sight = { precache_sound_custom (snd_sight, default_file); };
+//----------------------------------------------------------------------
+void(string default_file) precache_sound_death =
+{
+ precache_sound_custom (snd_death, default_file);
+};

+//----------------------------------------------------------------------
+void(string default_file) precache_sound_hit =
+{
+ precache_sound_custom (snd_hit, default_file);
+};

-/*
-================
-precache_sound2_custom
-================
-*/
+//----------------------------------------------------------------------
+void(string default_file) precache_sound_idle =
+{
+ precache_sound_custom (snd_idle, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_sound_land =
+{
+ precache_sound_custom (snd_land, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_sound_misc =
+{
+ precache_sound_custom (snd_misc, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_sound_misc1 =
+{
+ precache_sound_custom (snd_misc1, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_sound_misc2 =
+{
+ precache_sound_custom (snd_misc2, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_sound_misc3 =
+{
+ precache_sound_custom (snd_misc3, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_sound_move =
+{
+ precache_sound_custom (snd_move, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_sound_pain =
+{
+ precache_sound_custom (snd_pain, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_sound_sight =
+{
+ precache_sound_custom (snd_sight, default_file);
+};
+
+//----------------------------------------------------------------------
+// precache_sound2_custom
+//----------------------------------------------------------------------
void(.string snd_field, string default_file) precache_sound2_custom =
{
if (self.snd_field != "")
@@ -56,26 +104,81 @@ void(.string snd_field, string default_file) precache_sound2_custom =
precache_sound2 (default_file);
};

+//----------------------------------------------------------------------
+void(string default_file) precache_sound2_attack =
+{
+ precache_sound2_custom (snd_attack, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_sound2_death =
+{
+ precache_sound2_custom (snd_death, default_file);
+};

-void(string default_file) precache_sound2_attack = { precache_sound2_custom (snd_attack, default_file); };
-void(string default_file) precache_sound2_death = { precache_sound2_custom (snd_death, default_file); };
-void(string default_file) precache_sound2_hit = { precache_sound2_custom (snd_hit, default_file); };
-void(string default_file) precache_sound2_idle = { precache_sound2_custom (snd_idle, default_file); };
-void(string default_file) precache_sound2_land = { precache_sound2_custom (snd_land, default_file); };
-void(string default_file) precache_sound2_misc = { precache_sound2_custom (snd_misc, default_file); };
-void(string default_file) precache_sound2_misc1 = { precache_sound2_custom (snd_misc1, default_file); };
-void(string default_file) precache_sound2_misc2 = { precache_sound2_custom (snd_misc2, default_file); };
-void(string default_file) precache_sound2_misc3 = { precache_sound2_custom (snd_misc3, default_file); };
-void(string default_file) precache_sound2_move = { precache_sound2_custom (snd_move, default_file); };
-void(string default_file) precache_sound2_pain = { precache_sound2_custom (snd_pain, default_file); };
-void(string default_file) precache_sound2_sight = { precache_sound2_custom (snd_sight, default_file); };
+//----------------------------------------------------------------------
+void(string default_file) precache_sound2_hit =
+{
+ precache_sound2_custom (snd_hit, default_file);
+};

+//----------------------------------------------------------------------
+void(string default_file) precache_sound2_idle =
+{
+ precache_sound2_custom (snd_idle, default_file);
+};

-/*
-================
-sound_custom
-================
-*/
+//----------------------------------------------------------------------
+void(string default_file) precache_sound2_land =
+{
+ precache_sound2_custom (snd_land, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_sound2_misc =
+{
+ precache_sound2_custom (snd_misc, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_sound2_misc1 =
+{
+ precache_sound2_custom (snd_misc1, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_sound2_misc2 =
+{
+ precache_sound2_custom (snd_misc2, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_sound2_misc3 =
+{
+ precache_sound2_custom (snd_misc3, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_sound2_move =
+{
+ precache_sound2_custom (snd_move, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_sound2_pain =
+{
+ precache_sound2_custom (snd_pain, default_file);
+};
+
+//----------------------------------------------------------------------
+void(string default_file) precache_sound2_sight =
+{
+ precache_sound2_custom (snd_sight, default_file);
+};
+
+//----------------------------------------------------------------------
+// sound_custom
+//----------------------------------------------------------------------
void(.string snd_field, entity e, float chan, string default_file,
float vol, float atten) sound_custom =
{
@@ -85,16 +188,86 @@ void(.string snd_field, entity e, float chan, string default_file,
sound (e, chan, default_file, vol, atten);
};

+//----------------------------------------------------------------------
+void(entity e, float chan, string default_file, float vol, float atten)
+ sound_attack =
+{
+ sound_custom (snd_attack, e, chan, default_file, vol, atten);
+};

-void(entity e, float chan, string default_file, float vol, float atten) sound_attack = { sound_custom (snd_attack, e, chan, default_file, vol, atten); };
-void(entity e, float chan, string default_file, float vol, float atten) sound_death = { sound_custom (snd_death, e, chan, default_file, vol, atten); };
-void(entity e, float chan, string default_file, float vol, float atten) sound_hit = { sound_custom (snd_hit, e, chan, default_file, vol, atten); };
-void(entity e, float chan, string default_file, float vol, float atten) sound_idle = { sound_custom (snd_idle, e, chan, default_file, vol, atten); };
-void(entity e, float chan, string default_file, float vol, float atten) sound_land = { sound_custom (snd_land, e, chan, default_file, vol, atten); };
-void(entity e, float chan, string default_file, float vol, float atten) sound_misc = { sound_custom (snd_misc, e, chan, default_file, vol, atten); };
-void(entity e, float chan, string default_file, float vol, float atten) sound_misc1 = { sound_custom (snd_misc1, e, chan, default_file, vol, atten); };
-void(entity e, float chan, string default_file, float vol, float atten) sound_misc2 = { sound_custom (snd_misc2, e, chan, default_file, vol, atten); };
-void(entity e, float chan, string default_file, float vol, float atten) sound_misc3 = { sound_custom (snd_misc3, e, chan, default_file, vol, atten); };
-void(entity e, float chan, string default_file, float vol, float atten) sound_move = { sound_custom (snd_move, e, chan, default_file, vol, atten); };
-void(entity e, float chan, string default_file, float vol, float atten) sound_pain = { sound_custom (snd_pain, e, chan, default_file, vol, atten); };
-void(entity e, float chan, string default_file, float vol, float atten) sound_sight = { sound_custom (snd_sight, e, chan, default_file, vol, atten); };
+//----------------------------------------------------------------------
+void(entity e, float chan, string default_file, float vol, float atten)
+ sound_death =
+{
+ sound_custom (snd_death, e, chan, default_file, vol, atten);
+};
+
+//----------------------------------------------------------------------
+void(entity e, float chan, string default_file, float vol, float atten)
+ sound_hit =
+{
+ sound_custom (snd_hit, e, chan, default_file, vol, atten);
+};
+
+//----------------------------------------------------------------------
+void(entity e, float chan, string default_file, float vol, float atten)
+ sound_idle =
+{
+ sound_custom (snd_idle, e, chan, default_file, vol, atten);
+};
+
+//----------------------------------------------------------------------
+void(entity e, float chan, string default_file, float vol, float atten)
+ sound_land =
+{
+ sound_custom (snd_land, e, chan, default_file, vol, atten);
+};
+
+//----------------------------------------------------------------------
+void(entity e, float chan, string default_file, float vol, float atten)
+ sound_misc =
+{
+ sound_custom (snd_misc, e, chan, default_file, vol, atten);
+};
+
+//----------------------------------------------------------------------
+void(entity e, float chan, string default_file, float vol, float atten)
+ sound_misc1 =
+{
+ sound_custom (snd_misc1, e, chan, default_file, vol, atten);
+};
+
+//----------------------------------------------------------------------
+void(entity e, float chan, string default_file, float vol, float atten)
+ sound_misc2 =
+{
+ sound_custom (snd_misc2, e, chan, default_file, vol, atten);
+};
+
+//----------------------------------------------------------------------
+void(entity e, float chan, string default_file, float vol, float atten)
+ sound_misc3 =
+{
+ sound_custom (snd_misc3, e, chan, default_file, vol, atten);
+};
+
+//----------------------------------------------------------------------
+void(entity e, float chan, string default_file, float vol, float atten)
+ sound_move =
+{
+ sound_custom (snd_move, e, chan, default_file, vol, atten);
+};
+
+//----------------------------------------------------------------------
+void(entity e, float chan, string default_file, float vol, float atten)
+ sound_pain =
+{
+ sound_custom (snd_pain, e, chan, default_file, vol, atten);
+};
+
+//----------------------------------------------------------------------
+void(entity e, float chan, string default_file, float vol, float atten)
+ sound_sight =
+{
+ sound_custom (snd_sight, e, chan, default_file, vol, atten);
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/doe_ltrail.qc

diff --git a/qc/doe_ltrail.qc b/qc/doe_ltrail.qc
deleted file mode 100644
index 0a3f0d9..0000000
--- a/qc/doe_ltrail.qc
+++ /dev/null
@@ -1,194 +0,0 @@
-// lightning trail
-// pmack
-// sept 96
-
-// float ltrailLastUsed; -- now an entity field.
-
-float LT_TOGGLE = 1;
-float LT_ACTIVE = 2;
-
-void() ltrail_chain =
-{
- SUB_UseTargets();
-
- self.think = SUB_Null;
-};
-
-void() ltrail_fire =
-{
- local entity myTarget;
-
- if (self.classname != "ltrail_end")
- {
- if (!self.sounds)
- sound (self, CHAN_VOICE, "weapons/lhit.wav", 1, ATTN_NORM);
- myTarget = find(world, targetname, self.target);
- WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
- WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
- WriteEntity (MSG_BROADCAST, self);
- WriteCoord (MSG_BROADCAST, self.origin_x);
- WriteCoord (MSG_BROADCAST, self.origin_y);
- WriteCoord (MSG_BROADCAST, self.origin_z);
- WriteCoord (MSG_BROADCAST, myTarget.origin_x);
- WriteCoord (MSG_BROADCAST, myTarget.origin_y);
- WriteCoord (MSG_BROADCAST, myTarget.origin_z);
- LightningDamage (self.origin, myTarget.origin, self, self.currentammo);
- }
-
- if ( self.items < time)
- {
- self.think = ltrail_chain;
- self.nextthink = time + self.frags;
- }
- else
- {
- self.think = ltrail_fire;
- self.nextthink = time + 0.05;
- }
-};
-
-void() ltrail_start_fire =
-{
- // if it's a toggle ltrail, we ignore triggers from ltrail_end's
- // when toggled off.
- if (self.spawnflags & LT_TOGGLE)
- {
- // user is not a lightning trail - change activity state.
- if ( other.classname != "ltrail_end" )
- {
- if (self.spawnflags & LT_ACTIVE)
- // currently active
- {
- self.spawnflags = self.spawnflags - LT_ACTIVE;
- return;
- }
- else
- // not active
- {
- self.spawnflags = self.spawnflags + LT_ACTIVE;
- }
- }
- // user is lightning trail, but trail has been turned off.
- // ignore the message.
- else if (!(self.spawnflags & LT_ACTIVE))
- return;
- }
-
- if (self.classname == "ltrail_start")
- {
- self.items = time + self.weapon;
- ltrail_fire();
- self.ltrailLastUsed = time;
- }
- else if (self.classname == "ltrail_relay")
- {
- self.items = time + self.weapon;
- ltrail_fire();
- }
- else
- {
- self.think = ltrail_chain;
- self.nextthink = time + self.frags;
- }
-};
-
-/*QUAKED ltrail_start (0 1 0) (-8 -8 -8) (8 8 8) LT_TOGGLE START_ON X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-
-Starting point of a lightning trail.
-Set currentammo to amount of damage you want the lightning to do.
-Default is 25.
-
-Set frags to amount of time before next item is triggered.
-Default is 0.3 seconds.
-
-Set weapon to amount of time to be firing the lightning.
-Default is 0.3 seconds.
-
-Set the LT_TOGGLE checkbox if you want the lightning shooter to continuously fire until triggered again.
-*/
-void() ltrail_start =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- self.ltrailLastUsed = time;
-
- precache_sound ("weapons/lhit.wav");
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_BBOX;
- self.use = ltrail_start_fire;
-
- if (self.currentammo == 0)
- self.currentammo = 25;
-
- if (self.weapon == 0)
- self.weapon = 0.3;
-
- if (self.frags == 0)
- self.frags = 0.3;
-
- if (self.spawnflags & LT_ACTIVE)
- {
- self.items = time + 99999999;
- self.think = ltrail_fire;
- self.nextthink = time + 0.1;
- }
-};
-
-/*QUAKED ltrail_relay (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-Relay point of a lightning trail.
-Set currentammo to amount of damage you want the lightning to do.
-Default is 25.
-
-Set frags to amount of time before next item is triggered.
-Default is 0.3 seconds.
-
-Set weapon to amount of time to be firing the lightning.
-Default is 0.3 seconds.
-*/
-void() ltrail_relay =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_sound ("weapons/lhit.wav");
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_BBOX;
- self.use = ltrail_start_fire;
-
- if (self.currentammo == 0)
- self.currentammo = 25;
-
- if (self.weapon == 0)
- self.weapon = 0.3;
-
- if (self.frags == 0)
- self.frags = 0.3;
-};
-
-/*QUAKED ltrail_end (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-Ending point of a lightning trail.
-Does not fire any lightning.
-
-Set frags to amount of time before next item is triggered.
-Default is 0.3 seconds.
-*/
-void() ltrail_end =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_sound ("weapons/lhit.wav");
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_BBOX;
- self.use = ltrail_start_fire;
-
- if (self.currentammo == 0)
- self.currentammo = 25;
-
- if (self.weapon == 0)
- self.weapon = 0.3;
-
- if (self.frags == 0)
- self.frags = 0.3;
-};

Return to the top of this page or return to the overview of this repo.

Diff qc/dtmisc.qc

diff --git a/qc/dtmisc.qc b/qc/dtmisc.qc
deleted file mode 100644
index c992a44..0000000
--- a/qc/dtmisc.qc
+++ /dev/null
@@ -1,822 +0,0 @@
-//a collection of various pieces of mods and some new code -- dumptruck_ds
-
-/* Miscelanneous QuickC program
- Copyright (c)1996 Hipnotic Interactive, Inc.
- All rights reserved.
- Distributed (unsupported) on 3.12.97
-*/
-
-void() play_sound_use =
- {
- if (self.spawnflags & 1)
- {
- if (self.state == 0)
- {
- self.state = 1;
- sound (self, self.impulse, self.noise, self.volume, self.speed);
- }
- else
- {
- self.state = 0;
- sound (self, self.impulse, "misc/null.wav", self.volume, self.speed);
- }
- }
- else
- {
- sound (self, self.impulse, self.noise, self.volume, self.speed);
- }
- };
-
-void() PlaySoundThink =
- {
- local float t;
- t = self.wait * random();
- if (t < self.delay)
- t = self.delay;
- self.nextthink = time + t;
- play_sound_use();
- };
-
-/*QUAKED play_sound_triggered (0.3 0.1 0.6) (-8 -8 -8) (8 8 8) toggle
-play a sound when it is used
-"toggle" determines whether sound should be stopped when triggered again
-"volume" how loud (1 default full volume)
-"noise" sound to play
-"impulse" channel on which to play sound (0-7) (0 automatic is default)
-"speed" attenuation factor
- -1 - no attenuation
- 1 - normal
- 2 - idle
- 3 - static
-*/
-void() play_sound_triggered =
- {
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- if (!self.noise) //dumptruck_ds
- {
- objerror ("no soundfile set in noise!\n");
- remove(self);
- return;
- }
-
- precache_sound (self.noise);
- precache_sound ("misc/null.wav");
- if (self.volume == 0)
- self.volume = 1;
- if (self.speed == 0)
- self.speed = 1;
- if (self.speed == -1)
- // self.speed = 0;
- self.speed = ATTN_NONE;
- if (self.spawnflags & 1)
- if (self.impulse == 0)
- self.impulse = 7;
- self.use = play_sound_use;
- };
-
-/*QUAKED play_sound (0.3 0.1 0.6) (-8 -8 -8) (8 8 8)
-play a sound on a periodic basis
-"volume" how loud (1 default full volume)
-"noise" sound to play
-"wait" random time between sounds (default 20)
-"delay" minimum delay between sounds (default 2)
-"impulse" channel on which to play sound (0-7) (0 automatic is default)
-"speed" attenuation factor
- -1 - no attenuation
- 1 - normal
- 2 - idle
- 3 - static
-*/
-void() play_sound =
- {
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- local float t;
-
- if (!self.noise) //dumptruck_ds
- {
- objerror ("no soundfile set in noise!\n");
- remove(self);
- return;
- }
-
-
- play_sound_triggered();
- if (self.wait == 0)
- self.wait = 20;
- if (self.delay == 0)
- self.delay = 2;
- self.think = PlaySoundThink;
- t = self.wait * random();
- if (t < self.delay)
- t = self.delay;
- self.nextthink = time + t;
- };
-
-
- //johnfitz -- ambient_general (this is from Rubicon Rumble dev kit)
-
-/*QUAKED ambient_general (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-Plays any looped sound
-
-Keys:
-
-"noise" is the wav file to play
-
-"volume" default 1
-
-"speed" attenuation, default 3
-*/
-void () ambient_general =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- if (!self.noise) //dumptruck_ds
- {
- objerror ("no soundfile set in noise!\n");
- remove(self);
- return;
- }
-
- precache_sound (self.noise);
- if (!self.speed)
- {
- self.speed = ATTN_NORM;
- }
- if (self.speed == 0)
- self.speed = 1;
- if (self.speed == -1)
- // self.speed = 0;
- self.speed = ATTN_NONE;
- if (!self.volume)
- {
- self.volume = 0.5;
- }
- ambientsound (self.origin, self.noise, self.volume, self.speed);
- remove(self);
-};
-//johnfitz
-
-/*QUAKED tele_fog (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
-
-When triggered, tele_fog shows the teleport particle effects and sounds.
-
-Use this when killtageting an entity if the player can see.
-
-*/
-
-void () play_tfog = //thanks Khreathor -- dumptruck_ds
-
-{
- spawn_tfog(self.origin);
-}
-
-void() tele_fog =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- self.use = play_tfog;
-};
-
-/*QUAKED play_tele (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
-
-When triggered, tele_fog shows the teleport particle effects and sounds.
-Same os tele_fog.
-
-Use this when killtageting an entity if the player can see.
-
-*/
-void() play_tele = //same as tele_fog, added for "play_xxxx" consistancy
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- self.use = play_tfog;
-};
-
-/*QUAKED play_explosion (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
-
-When triggered, creates a explosion at it's origin. Causes damage.
-
-*/
-
-void () play_explosion_fx = //thanks Khreathor -- dumptruck_ds
-
-{
- self.owner = self; // GrenadeExplode uses self.owner as the attacker -- iw
- GrenadeExplode();
-}
-
-void() play_explosion =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- self.use = play_explosion_fx;
-};
-
-/*QUAKED play_lavasplash (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
-
-When triggered, plays the lavasplash effect from E1M7.
-
-Use noise key for a custom sound.
-
-*/
-
-void () play_lavasplash_fx = //thanks Khreathor -- dumptruck_ds
-{
- if (self.noise != "")
- {
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
- }
- else
- {
- sound (self, CHAN_AUTO, "boss1/out1.wav", 1, ATTN_NORM);
- }
-WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
-WriteByte (MSG_BROADCAST, TE_LAVASPLASH);
-WriteCoord (MSG_BROADCAST, self.origin_x);
-WriteCoord (MSG_BROADCAST, self.origin_y);
-WriteCoord (MSG_BROADCAST, self.origin_z);
-};
-
-void () play_lavasplash =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- if (self.noise != "") precache_sound (self.noise);
- precache_sound("boss1/out1.wav");
- self.use = play_lavasplash_fx;
-};
-
-/*QUAKED meat_shower (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
-
-When triggered, plays a gib effect.
-
-Use style 0 for normal and 1 for extra large. fly_sound 0 is silent, 1 for regular gib sounds.
-
-*/
-
-void () play_meatspray = //-- dumptruck_ds -- thanks to Spike for helping with errors
-{
- if (self.style == 1)
- {
- ThrowGib ("progs/gib1.mdl", random()*-80);
- ThrowGib ("progs/gib2.mdl", random()*-80);
- ThrowGib ("progs/gib3.mdl", random()*-80);
- ThrowGib ("progs/gib1.mdl", random()*-75);
- ThrowGib ("progs/gib2.mdl", random()*-75);
- ThrowGib ("progs/gib3.mdl", random()*-75);
- }
- else
- {
- ThrowGib ("progs/gib1.mdl", random()*-65);
- ThrowGib ("progs/gib2.mdl", random()*-65);
- ThrowGib ("progs/gib3.mdl", random()*-65);
- }
- {
- if (self.fly_sound != 1)
- return;
- }
- {
- if (random() < 0.5)
- sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NORM);
- else
- sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
-}
-};
-
-void() meat_shower =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- self.use = play_meatspray;
-}
-
-/*QUAKED play_gibs (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
-
-When triggered, plays a gib effect. Same as meat_shower.
-
-Use style 0 for normal and 1 for extra large. fly_sound 0 is silent, 1 for regular gib sounds.
-
-*/
-void() play_gibs = //same as meat_shower, added for "play_xxxx" consistancy
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- self.use = play_meatspray;
-}
-
-void() mflash_use =
-{
- self.effects = self.effects | EF_MUZZLEFLASH;
-
- if (self.noise != "")
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
-};
-
-/*QUAKED play_mflash (0 .5 .8) (-8 -8 -8) (8 8 8)
-triggable muzzle flash effect entity
-*/
-
-void() play_mflash =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model ("progs/s_null.spr");
- if (self.noise != "") precache_sound (self.noise);
-
- setmodel (self, "progs/s_null.spr");
- setorigin (self, self.origin);
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_NOT;
- setsize (self, '0 0 0', '0 0 0');
- self.use = mflash_use;
-};
-
-//
-// play_bfield triggerable effect
-//
-
-void() bfield_toggle =
-{
- if (!self.state)
- {
- self.state = 1;
- self.effects = self.effects | EF_BRIGHTFIELD;
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
- }
- else
- {
- self.state = 0;
- self.effects = self.effects - (self.effects & EF_BRIGHTFIELD);
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
- }
-};
-
-/*QUAKED play_bfield (0 .5 .8) (-8 -8 -8) (8 8 8)
-a triggerable, spherical field of yellow particles
-state 1 = start on
-*/
-
-void() play_bfield =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model ("progs/s_null.spr");
- if (self.noise != "") precache_sound (self.noise);
-
- setmodel (self, "progs/s_null.spr");
- setorigin( self, self.origin);
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_NOT;
- setsize (self, '0 0 0', '0 0 0');
- if (self.state)
- self.effects = self.effects | EF_BRIGHTFIELD;
- self.use = bfield_toggle;
-};
-
-//
-// play_brlight triggerable effect
-//
-
-void() brlight_toggle = //dumptruck_ds -- thanks to c0burn
-{
- if (!self.state)
- {
- self.state = 1;
- self.effects = self.effects | EF_BRIGHTLIGHT;
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
- }
- else
- {
- self.state = 0;
- self.effects = self.effects - (self.effects & EF_BRIGHTLIGHT);
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
- }
-};
-
-/*QUAKED play_brlight (0 .5 .8) (-8 -8 -8) (8 8 8)
-a triggerable bright lighting effect
-state 1 = start on
-*/
-
-void() play_brlight =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model ("progs/s_null.spr");
- if (self.noise != "") precache_sound (self.noise);
-
- setmodel (self, "progs/s_null.spr");
- setorigin (self, self.origin);
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_NOT;
- setsize (self, '0 0 0', '0 0 0');
- if (self.state)
- self.effects = self.effects | EF_BRIGHTLIGHT;
- self.use = brlight_toggle;
-};
-//
-// play_dimlight triggerable effect
-//
-void() dim_toggle =
-{
- if (!self.state)
- {
- self.state = 1;
- self.effects = self.effects | EF_DIMLIGHT;
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
- }
- else
- {
- self.state = 0;
- self.effects = self.effects - (self.effects & EF_DIMLIGHT);
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
- }
-};
-
-/*QUAKED play_dimlight (0 .5 .8) (-8 -8 -8) (8 8 8)
-a triggerable lighting effect
-state 1 = start on
-*/
-
-void() play_dimlight =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model ("progs/s_null.spr");
- if (self.noise != "") precache_sound (self.noise);
-
- setmodel (self, "progs/s_null.spr");
- // setorigin (self, self.origin);
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_NOT;
- setsize (self, '0 0 0', '0 0 0');
- if (self.state)
- self.effects = self.effects | EF_DIMLIGHT;
- setorigin (self, self.origin);
- self.use = dim_toggle;
-};
-
-/* misc gore */
-/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */
-/*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-deadstuff version 1.0 - tony collen - manero@canweb.net - EfNet IRC #QuakeEd or #Trinity
--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-*/
-
-/*QUAKED gib_head_demon (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_demon.mdl");
-}
-*/
-void() gib_head_demon =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model("progs/h_demon.mdl");
- setmodel(self, "progs/h_demon.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize(self,'-13.64 -16.77 -0.11','17.44 16.22 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-
-/*QUAKED gib_head_dog (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_dog.mdl");
-}
-*/
-void() gib_head_dog =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model("progs/h_dog.mdl");
- setmodel(self, "progs/h_dog.mdl");
- self.frame = 0; //was 1 -- dumptruck_ds
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize(self,'-9.66 -11.89 -0.2','6.57 7.96 13.29');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-
-/*QUAKED gib_head_army (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_guard.mdl");
-}
-*/
-void() gib_head_army =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model("progs/h_guard.mdl");
- setmodel(self, "progs/h_guard.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize(self,'-9.67 -8.27 -0.28','4.05 4.8 13.41');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-
-/*QUAKED gib_head_hell_knight (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_hellkn.mdl");
-}*/
-void() gib_head_hell_knight =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model("progs/h_hellkn.mdl");
- setmodel(self, "progs/h_hellkn.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize(self,'-7.9 -12.97 -0.63','10.55 8.87 21.06');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-
-/*QUAKED gib_head_knight (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_knight.mdl");
-}*/
-void() gib_head_knight =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model("progs/h_knight.mdl");
- setmodel(self, "progs/h_knight.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize(self,'-8.17 -7.47 -0.13','8.36 6.5 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-
-/*QUAKED gib_head_enforcer (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_mega.mdl");
-}
-*/
-void() gib_head_enforcer =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model("progs/h_mega.mdl");
- setmodel(self, "progs/h_mega.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize(self,'-10.63 -10.23 -0.05','9.27 8.25 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-
-/*QUAKED gib_head_ogre (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_ogre.mdl");
-}*/
-void() gib_head_ogre =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model("progs/h_ogre.mdl");
- setmodel(self, "progs/h_ogre.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize(self,'-12.35 -15.7 -0.17','10.67 13.88 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-
-/*QUAKED gib_head_player (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_player.mdl");
-}*/
-void() gib_head_player =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model("progs/h_player.mdl");
- setmodel(self, "progs/h_player.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize(self,'-9.67 -12.38 -2.1','11.49 50.7 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-
-/*QUAKED gib_head_shalrath (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_shal.mdl");
-}*/
-void() gib_head_shalrath =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model("progs/h_shal.mdl");
- setmodel(self, "progs/h_shal.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize(self,'-19.85 -19.09 -1.44','13.72 16.8 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-
-/*QUAKED gib_head_shambler (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_shams.mdl");
-}*/
-void() gib_head_shambler =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model("progs/h_shams.mdl");
- setmodel(self, "progs/h_shams.mdl");
- self.frame = 0; //was 1, caused an error -- dumptruck_ds
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize(self,'-15.15 -20.638 -0.45','21.44 21.76 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-
-/*QUAKED gib_head_wizard (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_wizard.mdl");
-}*/
-void() gib_head_wizard =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model("progs/h_wizard.mdl");
- setmodel(self, "progs/h_wizard.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize(self,'-10.41 -8.66 -0.54','6.52 10.82 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-
-/*QUAKED gib_misc_1 (0 0.5 0.8) (-8 -8 -8) (8 8 8) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/gib1.mdl");
-}*/
-void() gib_misc_1 =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model("progs/gib1.mdl");
- setmodel(self, "progs/gib1.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize(self,'-3.57 -8.06 -3.34','3.69 8.31 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-
-/*QUAKED gib_misc_2 (0 0.5 0.8) (-8 -8 -8) (8 8 8) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/gib2.mdl");
-}*/
-void() gib_misc_2 =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model("progs/gib2.mdl");
- setmodel(self, "progs/gib2.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize(self,'-12.68 -14.83 -6.19','13.53 14.57 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-
-/*QUAKED gib_misc_3 (0 0.5 0.8) (-8 -8 -8) (8 8 8) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/gib3.mdl");
-}*/
-void() gib_misc_3 =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model("progs/gib3.mdl");
- setmodel(self, "progs/gib3.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize(self,'-18.95 -15.92 -3.13','13.17 15.66 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-/* END Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */
-

Return to the top of this page or return to the overview of this repo.

Diff qc/fog.qc

diff --git a/qc/fog.qc b/qc/fog.qc
deleted file mode 100644
index ca6bf95..0000000
--- a/qc/fog.qc
+++ /dev/null
@@ -1,544 +0,0 @@
-/*
-====================
-
-Fog controllers
-Based on Copper's fog by Lunaran
-Changed by bmFbr
-
-====================
-*/
-
-float FOG_INTERVAL = 0.04166667; // 1/24;
-/*FGD
-@baseclass = Fog [
- fog_density(string) : "Fog Density"
- fog_color(string) : "Fog Color"
-]
-@baseclass = FogShift [
- fog_density(string) : "Start Fog Density"
- fog_color(string) : "Start Fog Color"
- fog_density2(string) : "End Fog Density"
- fog_color2(string) : "End Fog Color"
-]
-*/
-
-/*
-================
-fog_save
-================
-*/
-void( entity client, float density, vector color ) fog_save =
-{
- if (client.classname != "player") return;
-
- // save whatever we set the client's fog to in case of saves/loads
- client.fog_density = density;
- client.fog_color = color;
-}
-
-void( entity client ) fog_save_to_previous =
-{
- if (client.classname != "player") return;
-
- // copies the current fog to the secondary fields to transition from the current fog
- client.fog_density2 = client.fog_density;
- client.fog_color2 = client.fog_color;
-}
-
-void( entity client, float density) skyfog_save =
-{
- if (client.classname != "player") return;
-
- client.skyfog_density = density;
-}
-
-void( entity client ) skyfog_save_to_previous =
-{
- if (client.classname != "player") return;
-
- client.skyfog_density2 = client.skyfog_density;
-}
-/*
-================
-fog_setFromEnt
-================
-*/
-void( entity client, entity fogger ) fog_setFromEnt =
-{
- float density;
- //
- // Don't set the fog if the entity has no values, because it might be a custom map with
- // _fog on the worldspawn instead.
- // To actually get an entity to clear the fog, density to -1.
- // The same applies to skyfog
-
- //eprint(fogger);
-
- //dprint3("fog_density: ", ftos(fogger.fog_density*100), "\n");
- if (fogger.fog_density) {
- dprint("setting fog\n");
- density = zeroconvert(fogger.fog_density);
- fog_set(client, density, fogger.fog_color);
- }
-
- //dprint3("skyfog_density: ", ftos(fogger.skyfog_density*100), "\n");
- if (fogger.skyfog_density) {
- dprint("setting skyfog\n");
- density = zeroconvert(fogger.skyfog_density);
- skyfog_set(client, density);
- }
-}
-
-/*
-================
-fog_set
-================
-*/
-void( entity client, float density, vector color) fog_set =
-{
- if (client.classname != "player") return;
-
- //dprint9("Setting fog: ", ftos(density), " ", ftos(color_x), " ", ftos(color_y), " ", ftos(color_z), "\n");
-
- stuffcmd(client, "\nfog ");
- stuffcmd_float(client, density);
- stuffcmd(client, " ");
- stuffcmd_float(client, color_x);
- stuffcmd(client, " ");
- stuffcmd_float(client, color_y);
- stuffcmd(client, " ");
- stuffcmd_float(client, color_z);
- stuffcmd(client, "\n");
-
- fog_save(client, density, color);
-}
-
-
-void( entity client, float density) skyfog_set =
-{
- if (client.classname != "player") return;
-
- //dprint3("Setting skyfog: ", ftos(density), "\n");
-
- stuffcmd(client, "\nr_skyfog ");
- stuffcmd_float(client, density);
- stuffcmd(client, "\n");
-
- skyfog_save(client, density);
-}
-
-/*
-================
-fog_blendTouch
-================
-*/
-void() fog_blendTouch =
-{
- if (other.classname != "player")
- return;
-
- if (other.health <= 0)
- return;
-
- if (self.estate != STATE_ACTIVE)
- return;
-
- // fix for only first client getting a fog change when multiple coop clients are touching this at once
- if (time != self.rad_time) // because fog is rad
- if (time < self.attack_finished)
- return;
-
- float f, lerp_density, leaving;
- float lerp_sdensity;
- float ent_density, ent_density2, ent_sdensity, ent_sdensity2;
- vector dorg, mid, ovel;
- vector lerp_color;
-
- ent_density = zeroconvert(self.fog_density);
- ent_density2 = zeroconvert(self.fog_density2);
-
- ent_sdensity = zeroconvert(self.skyfog_density);
- ent_sdensity2 = zeroconvert(self.skyfog_density2);
-
- // if you run/fall through a fogblend fast enough you can come out the other side
- // partially blended, so check if player will exit the trigger bounds before the
- // next touch (same class of bug as leaping through lasers in Q2)
- ovel = other.velocity * FOG_INTERVAL;
- leaving = ( (other.absmax_x + ovel_x < self.absmin_x) ||
- (other.absmax_y + ovel_y < self.absmin_y) ||
- (other.absmax_z + ovel_z < self.absmin_z) ||
- (other.absmin_x + ovel_x > self.absmax_x) ||
- (other.absmin_y + ovel_y > self.absmax_y) ||
- (other.absmin_z + ovel_z > self.absmax_z) );
-
- if (leaving)
- {
- // last chance to set fog correctly, so snap it to the final values
- leaving = other.velocity * self.movedir;
- if (leaving > 0)
- {
- lerp_density = ent_density2;
- lerp_color = self.fog_color2;
- lerp_sdensity = ent_sdensity2;
- }
- else
- {
- lerp_density = ent_density;
- lerp_color = self.fog_color;
- lerp_sdensity = ent_sdensity;
- }
- }
- else
- {
- // in transition, blend proportionally between the two fogs
- mid = (self.mins + self.maxs) * 0.5;
- dorg = other.origin + other.view_ofs - mid;
-
- f = dorg * self.movedir;
- f = (f / self.distance) + 0.5;
-
- lerp_density = lerp(ent_density, ent_density2, f);
- lerp_color = lerpVector(self.fog_color, self.fog_color2, f);
- lerp_sdensity = lerp(ent_sdensity, ent_sdensity2, f);
- }
-
- if (self.fog_density || self.fog_density2) fog_set(other, lerp_density, lerp_color);
- if (self.skyfog_density || self.skyfog_density2) skyfog_set(other, lerp_sdensity);
-
- self.rad_time = time;
- self.attack_finished = time + FOG_INTERVAL;
-
- // reset client's fogblend_entity in case it's currently being transitioned by another entity
- other.fogblend_entity = world;
-}
-
-
-/*QUAKED trigger_fogblend (.5 .5 .2) ?
-Acts as a smoothly blending portal between two zones of different fog. Sets the fog for any client passing through it, blending their global fog settings between "fog_color"/"fog_density" and "fog_color2"/"fog_density2" proportional to their position within the trigger.
-The axis of motion on which the blend happens is defined by "angle", pointing to whatever zone has color2 and density2. Trigger therefore has two 'sides' - the side that "angle" points to, and the opposite side.
-
-"distance" - override the length of the blend period in world units - defaults to bounds size
- on 'angle' otherwise. this is only useful for diagonal triggers.
-
-CAVEATS:
-- will 'stuffcmd' 2 dozen times per frame so try not to make these huge
-- a bug in most quake engine ports will reset the eye position smoothing that happens when climbing stairs or riding a plat on every frame that a 'stuffcmd' is sent, so fog transitions during upwards motion will cause noticeable stuttering.
-*/
-/*FGD
-@SolidClass base(Appearflags, Targetname, Target, FogShift) = trigger_fogblend :
-"Trigger: Fog Blend
-Acts as a smoothly blending portal between two zones of different fog. Sets the fog for any client passing through it, blending their global fog settings between start and end values proportional to their position within the trigger.
-
-- will 'stuffcmd' 2 dozen times per frame so try not to make these huge
-- a bug in most quake engine ports will reset the eye position smoothing that happens when climbing stairs or riding a plat on every frame that a 'stuffcmd' is sent, so fog transitions during upwards motion will cause noticeable stuttering."
-[
- distance(integer) : "Length of blend distance (defaults to size of trigger)"
- angle(integer) : "Axis of motion of blend (points toward end values)"
-]
-*/
-void() trigger_fogblend =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- if (self.angles == '0 0 0') // InitTrigger assumes angle 0 means no angle
- self.angles = '0 360 0';
-
- InitTrigger ();
- self.touch = fog_blendTouch;
- self.distance = zeroconvertdefault(self.distance, BoundsAngleSize(self.movedir, self.size));
-
- SUB_CheckWaiting();
-}
-
-
-/*
-================
-fog_blendTimeThink
-used by both trigger_fog and target_fogblend
-================
-*/
-
-float FOGBLEND_ONEWAY = 1;
-float FOGBLEND_REVERSE = 2;
-float FOGBLEND_ALLCLIENTS = 4;
-float FOGBLEND_BLENDTO = 8;
-
-void(entity cl, float sTo, float f) skyfog_blendSetFraction = {
- float s;
-
- s = lerpHermite(cl.skyfog_density2, sTo, f);
-
- //eprint(cl);
- //dprint3("Fraction skyfog density: ", ftos(s), "\n");
-
- skyfog_set(cl, s);
-};
-
-void(entity cl, vector cTo, float dTo, float f) fog_blendSetFraction = {
- float d;
- vector c;
-
- d = lerpHermite(cl.fog_density2, dTo, f);
- c = lerpVectorHermite(cl.fog_color2, cTo, f);
-
- /*
- eprint(cl);
- dprint3("fog density: ", ftos(d), "\n");
- dprint3("color: ", vtos(c), "\n");
- dprint3("fraction: ", ftos(f), "\n");
- */
-
- fog_set(cl, d, c);
-};
-
-void() fog_blendTimeThink = {
- float f;
- float dTo, sTo;
- vector cTo;
-
- if (time >= self.pain_finished) {
- f = 1;
- }
- else {
- self.nextthink = time + FOG_INTERVAL;
- if (self.state && self.speed)
- f = 1 - (self.pain_finished - time) / self.speed;
- else if (self.speed2)
- f = 1 - (self.pain_finished - time) / self.speed2;
- else
- f = 1;
- }
-
- if (self.state) {
- dTo = self.fog_density2;
- cTo = self.fog_color2;
- sTo = self.skyfog_density2;
- }
- else {
- dTo = self.fog_density;
- cTo = self.fog_color;
- sTo = self.skyfog_density;
- }
-
- if (self.spawnflags & FOGBLEND_ALLCLIENTS) {
- entity pl;
- pl = nextent(world);
- while (pl.flags & FL_CLIENT) {
- if (pl.fogblend_entity == self) {
- if (dTo && !(pl.fog_density2 == dTo && pl.fog_color2 == cTo))
- fog_blendSetFraction(pl, cTo, zeroconvert(dTo), f);
-
- if (sTo)
- skyfog_blendSetFraction(pl, zeroconvert(sTo), f);
-
- if (time >= self.pain_finished)
- pl.fogblend_entity = world;
- }
-
- pl = nextent(pl);
- }
- }
- else {
- if (self.enemy.fogblend_entity == self) {
- if (dTo && !(self.enemy.fog_density2 == dTo && self.enemy.fog_color2 == cTo))
- fog_blendSetFraction(self.enemy, cTo, zeroconvert(dTo), f);
-
- if (sTo)
- skyfog_blendSetFraction(self.enemy, zeroconvert(sTo), f);
-
- if (time >= self.pain_finished) {
- self.enemy.fogblend_entity = world;
-
- }
- }
- }
-
- if (self.classname == "fog_controller"){
- if (self.enemy.fogblend_entity != self || time >= self.pain_finished) {
- remove(self);
- return;
- }
- }
-};
-
-
-
-/**************************************
-
-target_fogblend
-
-**************************************/
-
-void() target_fogblend_use = {
-
- self.enemy = activator;
- if (self.enemy.classname != "player") return;
-
-
- if (!(self.spawnflags & FOGBLEND_ONEWAY))
- self.state = 1 - self.state;
-
- if (self.state)
- self.pain_finished = time + self.delay + self.speed;
- else
- self.pain_finished = time + self.delay + self.speed2;
-
-
- if (self.spawnflags & FOGBLEND_ALLCLIENTS) {
- entity pl;
- pl = nextent(world);
- while (pl.flags & FL_CLIENT) {
- if (self.fog_density) fog_save_to_previous(pl);
- if (self.skyfog_density) skyfog_save_to_previous(pl);
-
- pl.fogblend_entity = self;
-
- pl = nextent(pl);
- }
- }
- else {
- if (self.fog_density) fog_save_to_previous(self.enemy);
- if (self.skyfog_density) skyfog_save_to_previous(self.enemy);
-
- self.enemy.fogblend_entity = self;
- }
-
- self.nextthink = time + self.delay;
-};
-
-
-
-
-/*QUAKED target_fogblend (.5 .5 .2) (-8 -8 -8) (8 8 8) ONE_WAY REVERSE GLOBAL BLENDTO
-Blends the fog for a client. activator's fog will be blended from "fog_color" and "fog_density"
-to "fog_color2" and "fog_density2". Triggering again will blend it back, unless ONE_WAY is set.
-Set REVERSE if you're tired of swapping the values by hand.
-Set GLOBAL to affect all clients in multiplayer, not just the activator.
-
-"delay" - pause before beginning to blend
-"speed" - time to spend blending, -1 for an instant change to fog2.
-"speed2" - time to spend blending back, if different than "speed". -1 for instant.
-
-CAVEATS:
-- will 'stuffcmd' 2 dozen times per frame so try not to make this take too long
-- a bug in most quake engine ports will reset the eye position smoothing that happens when climbing stairs or riding a plat on every frame that a 'stuffcmd' is sent, so fog transitions during upwards motion will cause noticeable stuttering.
-*/
-/*FGD
-@PointClass base(Appearflags, Targetname, Target, FogShift) color(128 128 50) = target_fogblend :
-"Target: Fog Blend
-Activator's fog will be blended over time from start to end values.
-
-- will 'stuffcmd' 2 dozen times per frame so try not to make this take too long
-- a bug in most quake engine ports will reset the eye position smoothing that happens when climbing stairs or riding a plat on every frame that a 'stuffcmd' is sent, so fog transitions during upwards motion will cause noticeable stuttering."
-[
- spawnflags(flags) = [
- 1 : "One-Way Only" : 0
- 2 : "Reverse Start/End" : 0
- 4 : "All clients" : 0
- ]
- delay(string) : "Pause before starting blend"
- speed(string) : "Time to blend (-1 for instant)"
- speed2(string) : "Time to blend back, if different (-1 for instant)"
-]
-*/
-void() target_fogblend =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- if (!self.fog_density && !self.skyfog_density) {
- objerror("Neither fog density nor skyfog density set");
- return;
- }
-
- self.use = target_fogblend_use;
- self.think = fog_blendTimeThink;
-
- if (self.spawnflags & FOGBLEND_REVERSE)
- self.state = 1;
- else
- self.state = 0;
-
- if (self.spawnflags & FOGBLEND_ONEWAY)
- self.state = 1 - self.state;
-
- if (!self.speed) self.speed = 1;
- if (!self.speed2) self.speed2 = self.speed;
-
- if (self.speed == -1) self.speed = 0;
- if (self.speed2 == -1) self.speed2 = 0;
-}
-
-
-
-/**************************************
-
-trigger_fog
-
-**************************************/
-
-void() trigger_fog_touch = {
- if (self.estate != STATE_ACTIVE)
- return;
-
- if (!(other.flags & FL_CLIENT))
- return;
-
- // fog already set to this value
- if (other.fog_color == self.fog_color && other.fog_density == self.fog_density)
- return;
-
- // transition already occurring from this trigger
- if (other.fogblend_entity.owner == self)
- return;
-
- if (self.fog_density) fog_save_to_previous(other);
- if (self.skyfog_density) skyfog_save_to_previous(other);
-
- // spawn a temp entity to control the transition for this client
- entity controller;
-
- controller = spawn();
- controller.classname = "fog_controller";
- controller.owner = self;
- controller.enemy = other;
- controller.speed2 = self.speed; // speed2 is used when state is 0
- controller.fog_color = self.fog_color;
- controller.fog_density = self.fog_density;
- controller.skyfog_density = self.skyfog_density;
-
- controller.pain_finished = time + self.delay + self.speed;
-
- controller.think = fog_blendTimeThink;
- controller.nextthink = time + controller.delay;
-
- other.fogblend_entity = controller;
-};
-
-/*QUAKED trigger_fog (.5 .5 .2) ?
-Smoothly blends touching client's currently applied fog to "fog_color" and "fog_density" over time.
-
-"delay" - pause before beginning to blend.
-"speed" - time to spend blending, -1 for an instant change.
-
-CAVEATS:
-- will 'stuffcmd' 2 dozen times per second so try not to make these huge
-- a bug in most quake engine ports will reset the eye position smoothing that happens when climbing stairs or riding a plat on every frame that a 'stuffcmd' is sent, so fog transitions during upwards motion will cause noticeable stuttering.
-*/
-
-void() trigger_fog = {
-
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- if (!self.fog_density && !self.skyfog_density) {
- objerror("Neither fog density nor skyfog density set");
- return;
- }
- InitTrigger ();
- self.touch = trigger_fog_touch;
- if (!self.speed) self.speed = 1;
-
- SUB_CheckWaiting();
-};

Return to the top of this page or return to the overview of this repo.

Diff qc/func/rotate.qc

diff --git a/qc/func/rotate.qc b/qc/func/rotate.qc
index 47ae6d1..33be98f 100644
--- a/qc/func/rotate.qc
+++ b/qc/func/rotate.qc
@@ -61,31 +61,17 @@ const float ROTATE_DOOR_STAYOPEN = 1; // spawnflags for func_rotate_door
vector(vector ang) SUB_NormalizeAngles =
{
while (ang_x > 360)
- {
ang_x = ang_x - 360;
- }
while (ang_x < 0)
- {
ang_x = ang_x + 360;
- }
-
while (ang_y > 360)
- {
ang_y = ang_y - 360;
- }
while (ang_y < 0)
- {
ang_y = ang_y + 360;
- }
-
while (ang_z > 360)
- {
ang_z = ang_z - 360;
- }
while (ang_z < 0)
- {
ang_z = ang_z + 360;
- }

return ang;
};

Return to the top of this page or return to the overview of this repo.

Diff qc/hazards/ltrail.qc

diff --git a/qc/hazards/ltrail.qc b/qc/hazards/ltrail.qc
new file mode 100644
index 0000000..9e450c3
--- /dev/null
+++ b/qc/hazards/ltrail.qc
@@ -0,0 +1,208 @@
+//==============================================================================
+// ltrail -- Dissolution Of Eternity lighting trail
+//==============================================================================
+
+//======================================================================
+// lightning trail
+// pmack
+// sept 96
+//======================================================================
+
+// float ltrailLastUsed; -- now an entity field.
+
+// constants
+const float LT_TOGGLE = 1;
+const float LT_ACTIVE = 2;
+
+//----------------------------------------------------------------------
+void() ltrail_chain =
+{
+ SUB_UseTargets ();
+ self.think = SUB_Null;
+};
+
+//----------------------------------------------------------------------
+void() ltrail_fire =
+{
+ local entity myTarget;
+
+ if (self.classname != "ltrail_end")
+ {
+ if (!self.sounds)
+ sound (self, CHAN_VOICE, "weapons/lhit.wav",
+ 1, ATTN_NORM);
+ myTarget = find (world, targetname, self.target);
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
+ WriteEntity (MSG_BROADCAST, self);
+ WriteCoord (MSG_BROADCAST, self.origin_x);
+ WriteCoord (MSG_BROADCAST, self.origin_y);
+ WriteCoord (MSG_BROADCAST, self.origin_z);
+ WriteCoord (MSG_BROADCAST, myTarget.origin_x);
+ WriteCoord (MSG_BROADCAST, myTarget.origin_y);
+ WriteCoord (MSG_BROADCAST, myTarget.origin_z);
+ LightningDamage (self.origin, myTarget.origin,
+ self, self.currentammo);
+ }
+
+ if ( self.items < time)
+ {
+ self.think = ltrail_chain;
+ self.nextthink = time + self.frags;
+ }
+ else
+ {
+ self.think = ltrail_fire;
+ self.nextthink = time + 0.05;
+ }
+};
+
+//----------------------------------------------------------------------
+void() ltrail_start_fire =
+{
+ // if it's a toggle ltrail, we ignore triggers from ltrail_end's
+ // when toggled off.
+ if (self.spawnflags & LT_TOGGLE)
+ {
+ // user is not a lightning trail - change activity state.
+ if ( other.classname != "ltrail_end" )
+ {
+ if (self.spawnflags & LT_ACTIVE)
+ {
+ // currently active
+ self.spawnflags = self.spawnflags - LT_ACTIVE;
+ return;
+ }
+ else
+ {
+ // not active
+ self.spawnflags = self.spawnflags + LT_ACTIVE;
+ }
+ }
+ // user is lightning trail, but trail has been turned off.
+ // ignore the message.
+ else if (!(self.spawnflags & LT_ACTIVE))
+ return;
+ }
+
+ if (self.classname == "ltrail_start")
+ {
+ self.items = time + self.weapon;
+ ltrail_fire ();
+ self.ltrailLastUsed = time;
+ }
+ else if (self.classname == "ltrail_relay")
+ {
+ self.items = time + self.weapon;
+ ltrail_fire ();
+ }
+ else
+ {
+ self.think = ltrail_chain;
+ self.nextthink = time + self.frags;
+ }
+};
+
+/*QUAKED ltrail_start (0 1 0) (-8 -8 -8) (8 8 8) LT_TOGGLE START_ON X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+
+Starting point of a lightning trail.
+Set currentammo to amount of damage you want the lightning to do.
+Default is 25.
+
+Set frags to amount of time before next item is triggered.
+Default is 0.3 seconds.
+
+Set weapon to amount of time to be firing the lightning.
+Default is 0.3 seconds.
+
+Set the LT_TOGGLE checkbox if you want the lightning shooter to continuously fire until triggered again.
+*/
+void() ltrail_start =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.ltrailLastUsed = time;
+
+ precache_sound ("weapons/lhit.wav");
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_BBOX;
+ self.use = ltrail_start_fire;
+
+ if (self.currentammo == 0)
+ self.currentammo = 25;
+
+ if (self.weapon == 0)
+ self.weapon = 0.3;
+
+ if (self.frags == 0)
+ self.frags = 0.3;
+
+ if (self.spawnflags & LT_ACTIVE)
+ {
+ self.items = time + 99999999;
+ self.think = ltrail_fire;
+ self.nextthink = time + 0.1;
+ }
+};
+
+/*QUAKED ltrail_relay (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+Relay point of a lightning trail.
+Set currentammo to amount of damage you want the lightning to do.
+Default is 25.
+
+Set frags to amount of time before next item is triggered.
+Default is 0.3 seconds.
+
+Set weapon to amount of time to be firing the lightning.
+Default is 0.3 seconds.
+*/
+void() ltrail_relay =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_sound ("weapons/lhit.wav");
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_BBOX;
+ self.use = ltrail_start_fire;
+
+ if (self.currentammo == 0)
+ self.currentammo = 25;
+
+ if (self.weapon == 0)
+ self.weapon = 0.3;
+
+ if (self.frags == 0)
+ self.frags = 0.3;
+};
+
+/*QUAKED ltrail_end (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+Ending point of a lightning trail.
+Does not fire any lightning.
+
+Set frags to amount of time before next item is triggered.
+Default is 0.3 seconds.
+*/
+void() ltrail_end =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_sound ("weapons/lhit.wav");
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_BBOX;
+ self.use = ltrail_start_fire;
+
+ if (self.currentammo == 0)
+ self.currentammo = 25;
+
+ if (self.weapon == 0)
+ self.weapon = 0.3;
+
+ if (self.frags == 0)
+ self.frags = 0.3;
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/hazards/shooter.qc

diff --git a/qc/hazards/shooter.qc b/qc/hazards/shooter.qc
new file mode 100644
index 0000000..6a72583
--- /dev/null
+++ b/qc/hazards/shooter.qc
@@ -0,0 +1,335 @@
+//==============================================================================
+// trap_spikeshooter from Hipnotic -- with additions by dumptruck_ds
+//==============================================================================
+
+// MED 11/09/96 added new spawnflags -- taken from hipdefs.qc - dumptruck_ds
+
+// constants
+float SPAWNFLAG_SUPERSPIKE = 1;
+float SPAWNFLAG_LASER = 2;
+float SPAWNFLAG_LAVABALL = 4;
+float SPAWNFLAG_ROCKET = 8;
+float SPAWNFLAG_VOREBALL = 16;
+float SPAWNFLAG_GRENADE = 32;
+float SPAWNFLAG_GIBS = 64;
+float SPAWNFLAG_SILENT = 128;
+
+// prototypes
+void(vector org, vector vec) LaunchLaser;
+
+//----------------------------------------------------------------------
+// ShalMissileTouch -- moved from Shalrath to enable shooter version
+//----------------------------------------------------------------------
+void() ShalMissileTouch =
+{
+ if (other == self.owner)
+ // don't explode on owner
+ return;
+
+ if (other.classname == "monster_zombie")
+ T_Damage (other, self, self, 110);
+
+ T_RadiusDamage (self, self.owner, 40, world);
+ sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
+
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_EXPLOSION);
+ WriteCoord (MSG_BROADCAST, self.origin_x);
+ WriteCoord (MSG_BROADCAST, self.origin_y);
+ WriteCoord (MSG_BROADCAST, self.origin_z);
+
+ BecomeExplosion ();
+
+ // self.velocity = '0 0 0';
+ // self.touch = SUB_Null;
+ // setmodel (self, "progs/s_explod.spr");
+ // self.solid = SOLID_NOT;
+ // s_explode1 ();
+};
+
+//----------------------------------------------------------------------
+// ZombieGrenadeTouch -- moved from zombie.qc to enable shooter version
+//----------------------------------------------------------------------
+void() ZombieGrenadeTouch =
+{
+ if (other == self.owner)
+ // don't explode on owner
+ return;
+
+ if (other.takedamage)
+ {
+ T_Damage (other, self, self.owner, 10 );
+ sound (self, CHAN_WEAPON, "zombie/z_hit.wav", 1, ATTN_NORM);
+ remove (self);
+ return;
+ }
+
+ // bounce sound
+ sound (self, CHAN_WEAPON, "zombie/z_miss.wav", 1, ATTN_NORM);
+ self.velocity = '0 0 0';
+ self.avelocity = '0 0 0';
+ self.touch = SUB_Remove;
+};
+
+//----------------------------------------------------------------------
+// spikeshooter_use
+// MED 11/09/96 added lava ball and rocket
+// dumptruck_ds added voreball and grenades
+//----------------------------------------------------------------------
+void() spikeshooter_use =
+{
+ local entity gnade, lavaball, rockettrap, voreball, zgibs;
+
+ if (self.spawnflags & SPAWNFLAG_LASER)
+ {
+ if (!(self.spawnflags & SPAWNFLAG_SILENT))
+ sound (self, CHAN_VOICE, "enforcer/enfire.wav",
+ 1, ATTN_NORM);
+ LaunchLaser (self.origin, self.movedir);
+ newmis.spawnflags = self.spawnflags;
+ }
+ else if (self.spawnflags & SPAWNFLAG_LAVABALL)
+ {
+ if (!(self.spawnflags & SPAWNFLAG_SILENT))
+ // dms
+ sound (self, CHAN_VOICE, "boss1/throw.wav",
+ 1, ATTN_NORM);
+ lavaball = spawn ();
+ lavaball.movetype = MOVETYPE_FLYMISSILE;
+ lavaball.solid = SOLID_BBOX;
+ lavaball.classname = "lavaball";
+ // set lavaball speed
+ lavaball.velocity = self.movedir * 600; // was 300 dms
+ lavaball.angles = vectoangles (lavaball.velocity);
+ lavaball.owner = self;
+ lavaball.touch = ShalMissileTouch;
+ setmodel (lavaball, "progs/lavaball.mdl"); // dms
+ setsize (lavaball, '0 0 0', '0 0 0');
+ setorigin (lavaball, self.origin);
+ lavaball.avelocity = '0 0 400';
+ lavaball.nextthink = time + 5;
+ lavaball.think = SUB_Remove;
+ }
+ else if (self.spawnflags & SPAWNFLAG_ROCKET)
+ {
+ if (!(self.spawnflags & SPAWNFLAG_SILENT))
+ sound (self, CHAN_VOICE, "weapons/sgun1.wav",
+ 1, ATTN_NORM);
+ rockettrap = spawn ();
+ rockettrap.movetype = MOVETYPE_FLYMISSILE;
+ rockettrap.solid = SOLID_BBOX;
+ rockettrap.classname = "rockettrap";
+ // set rocket speed
+ rockettrap.velocity = self.movedir * 1000;
+ rockettrap.angles = vectoangles (rockettrap.velocity);
+ rockettrap.owner = self;
+ rockettrap.touch = T_MissileTouch;
+ setmodel (rockettrap, "progs/missile.mdl"); // dms
+ setsize (rockettrap, '0 0 0', '0 0 0');
+ setorigin (rockettrap, self.origin);
+ // rockettrap.avelocity = '0 0 400';
+ rockettrap.nextthink = time + 5;
+ rockettrap.think = SUB_Remove;
+ }
+ else if (self.spawnflags & SPAWNFLAG_VOREBALL)
+ {
+ if (!(self.spawnflags & SPAWNFLAG_SILENT))
+ sound (self, CHAN_VOICE, "shalrath/attack2.wav",
+ 1, ATTN_NORM);
+ voreball = spawn ();
+ voreball.movetype = MOVETYPE_FLYMISSILE;
+ voreball.solid = SOLID_BBOX;
+ voreball.classname = "voreball";
+ // set voreball speed
+ voreball.velocity = self.movedir * 600; // was 300 dms
+ voreball.angles = vectoangles (voreball.velocity);
+ voreball.owner = self;
+ voreball.touch = ShalMissileTouch;
+ setmodel (voreball, "progs/v_spike.mdl"); // dms
+ setsize (voreball, '0 0 0', '0 0 0');
+ setorigin (voreball, self.origin);
+ voreball.avelocity = '0 0 400';
+ voreball.nextthink = time + 5;
+ voreball.think = SUB_Remove;
+ }
+ else if (self.spawnflags & SPAWNFLAG_GRENADE)
+ {
+ if (!(self.spawnflags & SPAWNFLAG_SILENT))
+ sound (self, CHAN_VOICE, "weapons/grenade.wav",
+ 1, ATTN_NORM);
+ gnade = spawn ();
+ gnade.movetype = MOVETYPE_BOUNCE;
+ // gnade.movetype = MOVETYPE_FLYMISSILE;
+ gnade.solid = SOLID_BBOX;
+ gnade.classname = "gnade";
+ // set grenade speed
+ // gnade.velocity = self.movedir * 600; // was 300 dms
+ gnade.velocity = self.movedir * 600 + v_up * 200 +
+ crandom() * v_right * 10 + crandom() * v_up * 10;
+ gnade.angles = vectoangles (gnade.velocity);
+ gnade.owner = self;
+ gnade.touch = GrenadeTouch;
+ setmodel (gnade, "progs/grenade.mdl"); // dms
+ setsize (gnade, '0 0 0', '0 0 0');
+ setorigin (gnade, self.origin);
+ gnade.avelocity = '300 300 300';
+ gnade.nextthink = time + 2.5;
+ gnade.think = GrenadeExplode;
+ }
+ else if (self.spawnflags & SPAWNFLAG_GIBS)
+ {
+ if (!(self.spawnflags & SPAWNFLAG_SILENT))
+ sound (self, CHAN_VOICE, "zombie/z_shot1.wav",
+ 1, ATTN_NORM);
+ zgibs = spawn ();
+ zgibs.owner = self;
+ zgibs.movetype = MOVETYPE_BOUNCE;
+ zgibs.solid = SOLID_BBOX;
+ zgibs.classname = "zgibs";
+ setmodel (zgibs, "progs/zom_gib.mdl");
+ setsize (zgibs, '0 0 0', '0 0 0');
+ setorigin (zgibs, self.origin);
+ zgibs.velocity = self.movedir * 600 + v_up * 200 +
+ crandom() * v_right * 10 + crandom() * v_up * 10;
+ zgibs.avelocity = '3000 1000 2000';
+ zgibs.touch = ZombieGrenadeTouch;
+ // set missile duration
+ zgibs.nextthink = time + 2.5;
+ zgibs.think = SUB_Remove;
+ }
+ else
+ {
+ if (!(self.spawnflags & SPAWNFLAG_SILENT))
+ sound (self, CHAN_VOICE, "weapons/spike2.wav",
+ 1, ATTN_NORM);
+ launch_spike (self.origin, self.movedir);
+ newmis.velocity = self.movedir * 500;
+ if (self.spawnflags & SPAWNFLAG_SUPERSPIKE)
+ newmis.touch = superspike_touch;
+ }
+};
+
+//----------------------------------------------------------------------
+// shooter_think -- MED 11/01/96 added state capability
+//----------------------------------------------------------------------
+void() shooter_think =
+{
+ if (self.state)
+ {
+ spikeshooter_use ();
+ }
+ self.nextthink = time + self.wait;
+};
+
+/*QUAKED trap_spikeshooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser lavaball rocket silent X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+
+When triggered, fires a spike in the direction set in QuakeEd.
+Laser is only for REGISTERED.
+*/
+void() trap_spikeshooter =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (self.proj_speed_mod <= 0)
+ self.proj_speed_mod = 1;
+
+ // MED 11/01/96 commented out setmovedir
+ SetMovedir ();
+ self.use = spikeshooter_use;
+ if (self.spawnflags & SPAWNFLAG_LASER)
+ {
+ precache_model2 ("progs/laser.mdl");
+ precache_sound2 ("enforcer/enfire.wav");
+ precache_sound2 ("enforcer/enfstop.wav");
+ }
+ else if (self.spawnflags & SPAWNFLAG_LAVABALL)
+ {
+ precache_model ("progs/lavaball.mdl");
+ // precache_sound2 ("knight/sword2.wav"); // dms
+ precache_sound2 ("boss1/throw.wav"); // dms
+ }
+ else if (self.spawnflags & SPAWNFLAG_ROCKET)
+ {
+ precache_model ("progs/missile.mdl");
+ precache_sound ("weapons/sgun1.wav");
+ }
+ else if (self.spawnflags & SPAWNFLAG_VOREBALL)
+ {
+ precache_model ("progs/v_spike.mdl");
+ precache_sound ("shalrath/attack2.wav");
+ }
+ else if (self.spawnflags & SPAWNFLAG_GRENADE)
+ {
+ precache_model ("progs/grenade.mdl");
+ // grenade launcher
+ precache_sound ("weapons/grenade.wav");
+ }
+ else if (self.spawnflags & SPAWNFLAG_GIBS)
+ {
+ precache_model ("progs/zom_gib.mdl");
+ // Zombie gibs
+ precache_sound ("zombie/z_shot1.wav");
+ precache_sound ("zombie/z_miss.wav");
+ precache_sound ("zombie/z_hit.wav");
+ }
+ else
+ {
+ precache_sound ("weapons/spike2.wav");
+ }
+};
+
+/*QUAKED trap_shooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser lavaball rocket silent X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+Continuously fires spikes.
+"wait" time between spike (1.0 default)
+"nextthink" delay before firing first spike, so multiple shooters can be stagered.
+*/
+void() trap_shooter =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ trap_spikeshooter ();
+
+ if (self.wait == 0)
+ self.wait = 1;
+
+ // MED 11/01/96 added state capability
+ self.state = 1;
+ self.nextthink = self.nextthink + self.wait + self.ltime;
+ self.think = shooter_think;
+};
+
+//----------------------------------------------------------------------
+// trap_shooter_use -- MED 11/01/96 added new use function
+//----------------------------------------------------------------------
+void() trap_shooter_use =
+{
+ self.state = 1 - self.state;
+};
+
+//MED 11/01/96 added new function
+/*QUAKED trap_switched_shooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser lavaball rocket silent X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+Continuously fires spikes.
+"wait" time between spike (1.0 default)
+"nextthink" delay before firing first spike, so multiple shooters can be stagered.
+"state" 0 initially off, 1 initially on. (0 default)
+*/
+void() trap_switched_shooter =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ trap_spikeshooter ();
+
+ if (self.wait == 0)
+ self.wait = 1;
+
+ // MED 11/01/96 added state capability
+ self.nextthink = self.nextthink + self.wait + self.ltime;
+ self.think = shooter_think;
+ self.use = trap_shooter_use;
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/intermission.qc

diff --git a/qc/intermission.qc b/qc/intermission.qc
deleted file mode 100644
index 89fb64f..0000000
--- a/qc/intermission.qc
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
-=============================================================================
-
- LEVEL CHANGING / INTERMISSION
-
-=============================================================================
-*/
-
-float intermission_running;
-float intermission_exittime;
-entity used_exit;
-
-
-/*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-
-This is the camera point for the intermission.
-Use mangle instead of angle, so you can set pitch or roll as well as yaw. 'pitch roll yaw'
-*/
-void() info_intermission =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-};
-
-
-void() info_intermissiontext =
-{
- if (self.message == "" || self.cnt == 0)
- {
- objerror("endscreen lacks required fields");
- }
-}
-
-void(string message) ShowIntermissionMessage =
-{
- WriteByte (MSG_ALL, SVC_FINALE);
- WriteString (MSG_ALL, message);
-}
-
-void() StartMessageIntermission =
-{
- WriteByte (MSG_ALL, SVC_CDTRACK);
- WriteByte (MSG_ALL, 2);
- WriteByte (MSG_ALL, 3);
-}
-
-void() Episode1End =
-{
- StartMessageIntermission();
- if (!cvar("registered"))
- {
- ShowIntermissionMessage("As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
- }
- else
- {
- ShowIntermissionMessage("As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
- }
-}
-
-void() Episode2End =
-{
- StartMessageIntermission();
- ShowIntermissionMessage("The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
-}
-
-void() Episode3End =
-{
- StartMessageIntermission();
- ShowIntermissionMessage("The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
-
-}
-
-void() Episode4End =
-{
- StartMessageIntermission();
- ShowIntermissionMessage("Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
-}
-
-float() RunId1Intermissions =
-{
- if (world.skip_id1_overrides == 0)
- {
- if (world.model == "maps/e1m7.bsp")
- {
- Episode1End();
- return 1;
- }
- else if (world.model == "maps/e2m6.bsp")
- {
- Episode2End();
- return 1;
- }
- else if (world.model == "maps/e3m6.bsp")
- {
- Episode3End();
- return 1;
- }
- else if (world.model == "maps/e4m7.bsp")
- {
- Episode4End();
- return 1;
- }
- }
- return 0;
-}
-
-/*
-============
-FindIntermission
-
-Returns the entity to view from
-============
-*/
-entity() FindIntermission =
-{
- local entity spot;
- local float cyc;
-
-// look for info_intermission first
- spot = find (world, classname, "info_intermission");
- if (spot)
- { // pick a random one
- cyc = random() * 4;
- while (cyc > 1)
- {
- spot = find (spot, classname, "info_intermission");
- if (!spot)
- spot = find (spot, classname, "info_intermission");
- cyc = cyc - 1;
- }
- return spot;
- }
-
-// then look for the start position
- spot = find (world, classname, "info_player_start");
- if (spot)
- return spot;
-
-// testinfo_player_start is only found in regioned levels
- spot = find (world, classname, "testplayerstart");
- if (spot)
- return spot;
-
- objerror ("FindIntermission: no spot");
- return world;// just to suppress the compiler warning
-};
-
-
-string nextmap;
-void() GotoNextMap =
-{
- if (cvar("samelevel")) // if samelevel is set, stay on same level
- changelevel (mapname);
- else
- changelevel (nextmap);
-};
-
-float(float start) ShowIntermissionTextEntity =
-{
- if (!(used_exit.spawnflags & 2))
- {
- local entity end_message;
- for (end_message = world; (end_message = find(end_message, classname, "info_intermissiontext"));)
- {
- if (end_message.cnt == (intermission_running - 1))
- {
- if (start == 1)
- {
- StartMessageIntermission();
- }
- ShowIntermissionMessage(end_message.message);
- return 1;
- }
- }
- }
- return 0;
-}
-
-void() ExitIntermission =
-{
-// skip any text in deathmatch
- if (deathmatch)
- {
- GotoNextMap ();
- return;
- }
-
-
-
- intermission_exittime = time + 1;
- intermission_running = intermission_running + 1;
-//
-// run some text if at the end of an episode
-//
- if (intermission_running == 2)
- {
- if (RunId1Intermissions() == 1)
- {
- return;
- }
- else
- {
- if (used_exit.message != "") // favor message on changelevel
- {
- StartMessageIntermission();
- ShowIntermissionMessage(used_exit.message);
- return;
- }
- if (ShowIntermissionTextEntity(1))
- {
- return;
- }
- }
-
- GotoNextMap();
- }
-
- if (intermission_running == 3)
- {
- if (!cvar("registered"))
- { // shareware episode has been completed, go to sell screen
- WriteByte (MSG_ALL, SVC_SELLSCREEN);
- return;
- }
- if (ShowIntermissionTextEntity(0))
- {
- return;
- }
- if ( (serverflags&15) == 15)
- {
- ShowIntermissionMessage("Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
- return;
-
- }
-
- }
-
- if (intermission_running > 3)
- {
- if (ShowIntermissionTextEntity(0))
- {
- return;
- }
- }
-
- GotoNextMap();
-};
-
-/*
-============
-IntermissionThink
-
-When the player presses attack or jump, change to the next level
-============
-*/
-void() IntermissionThink =
-{
- if (time < intermission_exittime)
- return;
-
- if (!self.button0 && !self.button1 && !self.button2)
- return;
-
- ExitIntermission ();
-};

Return to the top of this page or return to the overview of this repo.

Diff qc/items.qc

diff --git a/qc/items.qc b/qc/items.qc
deleted file mode 100644
index 797f8a0..0000000
--- a/qc/items.qc
+++ /dev/null
@@ -1,1947 +0,0 @@
-void (vector org) spawn_tfog;
-void() W_SetCurrentAmmo;
-/* ALL LIGHTS SHOULD BE 0 1 0 IN COLOR ALL OTHER ITEMS SHOULD
-BE .8 .3 .4 IN COLOR */
-
-float ITEM_SPAWNSILENT = 32;
-float ITEM_SPAWNED = 64;
-float ITEM_SUSPENDED = 128;
-float ITEM_RESPAWNDM = 16384;
-float ITEM_DONTDROP = 8388608;
-
-.vector particles_offset;
-
-void() SUB_regen =
-{
- self.model = self.mdl; // restore original model
- self.solid = SOLID_TRIGGER; // allow it to be touched again
- // TODO CEV
- // if (deathmatch || (self.spawnflags & ITEM_RESPAWNDM)) // Respawn with DM effects
- sound (self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM); // play respawn sound
- // else
- // spawn_tfog (self.origin + self.particles_offset); // play teleport sound and display particles
- setorigin (self, self.origin);
-};
-
-// Supa, Quoth respawning items support Respawn item like in DM if 'ritem' TRUE,
-// override respawn time with 'respawndelay' if set, inc 'cnt' with each respawn
-// and if 'respawncount' is set we'll remove the item if cnt > respawncount
-// remember that SUB_Regen is already set on every item that can respawn, all we
-// need to do is give a nextthink time in order to trigger it
-.float ritem,
- respawndelay,
- respawncount;
-
-void(entity whatitem, float defaultdelay) CheckItemRespawn =
-{
- if (!whatitem.ritem) // respawn item if true, otherwise abort
- return;
-
- whatitem.cnt = whatitem.cnt + 1; // inc before check to account for zero indexing
-
- if (whatitem.respawncount) // limited respawns
- if (whatitem.respawncount < whatitem.cnt)
- return;
-
- // okay, we're clear to set up a respawn
-
- if (whatitem.respawndelay) // custom respawn delay?
- whatitem.nextthink = time + whatitem.respawndelay;
- else
- whatitem.nextthink = time + defaultdelay;
-};
-
-
-/*QUAKED noclass (0 0 0) (-8 -8 -8) (8 8 8)
-prints a warning message when spawned
-*/
-void() noclass =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- dprint ("noclass spawned at");
- dprint (vtos(self.origin));
- dprint ("\n");
- remove (self);
-};
-
-/*
-============
-DelaySpawnItem //this is from rmq-items.qc
-
-Makes a SPAWNED item ready for pickup on a trigger event - modified a bit -- dumptruck_ds
-============
-*/
-void() DelaySpawnItem =
-{
- self.solid = SOLID_TRIGGER;
- setmodel (self, self.mdl);
- setsize (self, self.pos1, self.pos2);
-
- if (!(self.spawnflags & ITEM_SPAWNSILENT)) // SILENT, gb
- // sound (self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM);
- spawn_tfog (self.origin + self.particles_offset);
-
- if (self.spawnflags & ITEM_SUSPENDED)
- self.movetype = MOVETYPE_FLY;
- else
- self.movetype = MOVETYPE_TOSS;
-
- self.use = SUB_Null;
-};
-
-
-// Supa, restore old hull and lock movement
-void() RefreshHull =
-{
- // setsize (self, self.dest, self.dest2);
- setsize (self, '0 0 0', '32 32 56'); //dumptruck_ds -- fix for bounding boxes
-
- self.movetype = MOVETYPE_NONE;
- self.velocity = '0 0 0';
-};
-
-
-/*
-============
-PlaceItem
-
-plants the object on the floor
-============
-*/
-void() PlaceItem =
-{
- // local float oldz;
- self.mdl = self.model; // so it can be restored on respawn
- self.flags = FL_ITEM; // make extra wide
- self.solid = SOLID_TRIGGER;
- self.velocity = '0 0 0';
-
- if (self.spawnflags & ITEM_SUSPENDED) //ijed Don't drop spawnflag
- {
- self.movetype = MOVETYPE_FLY;
- }
- else
- {
- // The following hack for item_health was inherited from the RMQ
- // code, and was here when the func_mapjamx maps were created.
- // It would have been nice to remove this code entirely, because
- // progs_dump doesn't need it, and it breaks item_health's
- // collision with entities that have MOVETYPE_PUSH. However,
- // removing this code would cause some of the item_health
- // entities in some of the func_mapjamx maps to "fall out of the
- // level", because they're accidentally touching solid surfaces.
- // So, to maintain backwards-compatibility, this code has been
- // left in, but will only be run if one of the func_mapjamx maps
- // is being played. -- iw
- //
- if (known_release == KNOWN_RELEASE_FUNC_MAPJAMX)
- {
- if (self.classname == "item_health") // Supa, CTF
- {
-
- // hacking around hull issues..
- setsize (self, '0 0 0', '0 0 0'); // void hull for now
-
- self.think = RefreshHull;
- self.nextthink = time + 0.2;
- }
- }
-
- self.movetype = MOVETYPE_TOSS;
-
- if (!(self.spawnflags & ITEM_DONTDROP))
- {
- setorigin (self, self.origin + '0 0 6');
-
- if (!droptofloor())
- {
- print_self ("bonus item", "fell out of level");
- remove(self);
- return;
- }
- }
- }
-
- if ((self.spawnflags & ITEM_SPAWNED)) // SPAWNED, gb
- {
- self.pos1 = self.mins;
- self.pos2 = self.maxs;
-
- self.model = "";
- self.solid = SOLID_NOT;
-
- if (self.spawnflags & ITEM_DONTDROP) self.movetype = MOVETYPE_NONE;
-
- self.use = DelaySpawnItem;
- }
-};
-
-
-/*
-============
-StartItem
-
-Sets the clipping size and plants the object on the floor
-============
-*/
-void() StartItem =
-{
- self.nextthink = time + 0.3; // items start after other solids || was 0.2 -- dumptruck_ds
- self.think = PlaceItem;
-};
-
-/*
-===============================================================================
-
-WEAPONS
-
-===============================================================================
-*/
-
-void() bound_other_ammo =
-{
- if (other.ammo_shells > 100)
- other.ammo_shells = 100;
- if (other.ammo_nails > 200)
- other.ammo_nails = 200;
- if (other.ammo_rockets > 100)
- other.ammo_rockets = 100;
- if (other.ammo_cells > 100)
- other.ammo_cells = 100;
-};
-
-
-float(float w) RankForWeapon =
-{
- if (self.waterlevel <= 1 && w == IT_LIGHTNING) // 1997-12-23 Thunderbolt fix by Maddes recognize waterlevel
- return 1;
- if (w == IT_ROCKET_LAUNCHER)
- return 2;
- if (w == IT_SUPER_NAILGUN)
- return 3;
- if (w == IT_GRENADE_LAUNCHER)
- return 4;
- if (w == IT_SUPER_SHOTGUN)
- return 5;
- if (w == IT_NAILGUN)
- return 6;
- if (w == IT_SHOTGUN)
- return 7;
- return 8;
-};
-
-/*
-=============
-Deathmatch_Weapon
-
-Deathmatch weapon change rules for picking up a weapon
-
-.float ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
-=============
-*/
-void(float old, float new) Deathmatch_Weapon =
-{
- local float or, nr;
-
-// change self.weapon if desired
- or = RankForWeapon (self.weapon);
- nr = RankForWeapon (new);
- if ( nr < or )
- self.weapon = new;
-};
-
-/*
-=============
-weapon_touch
-=============
-*/
-float() W_BestWeapon;
-
-void() weapon_touch =
-{
- local float hadammo, best, new, old;
- local entity stemp;
- local float leave;
-
- // from Copper -- dumptruck_ds
- if (!CheckValidTouch()) return;
-
- if (!(other.flags & FL_CLIENT))
- return;
-
-// if the player was using his best weapon, change up to the new one if better
- stemp = self;
- self = other;
- best = W_BestWeapon();
- self = stemp;
-
- if (deathmatch == 2 || coop)
- {
- leave = 1;
-
- // fix weapon items never firing their targets in coop or
- // "deathmatch 2" -- iw
- activator = other;
- SUB_UseAndForgetTargets ();
- }
- else
- {
- leave = 0;
- }
-
- // johnfitz added for axe, shotgun items --dumptruck_ds from RRP /rubicon2
- if (self.classname == "weapon_axe")
- {
- if (leave && (other.items & IT_AXE) )
- return;
- new = IT_AXE;
- }
- else if (self.classname == "weapon_shotgun")
- {
- if (leave && (other.items & IT_SHOTGUN) )
- return;
- hadammo = other.ammo_shells;
- new = IT_SHOTGUN;
- other.ammo_shells = other.ammo_shells + 5;
- }
- // johnfitz
-
- else if (self.classname == "weapon_nailgun")
- {
- if (leave && (other.items & IT_NAILGUN) )
- return;
- hadammo = other.ammo_nails;
- new = IT_NAILGUN;
- other.ammo_nails = other.ammo_nails + 30;
- }
- else if (self.classname == "weapon_supernailgun")
- {
- if (leave && (other.items & IT_SUPER_NAILGUN) )
- return;
- hadammo = other.ammo_rockets;
- new = IT_SUPER_NAILGUN;
- other.ammo_nails = other.ammo_nails + 30;
- }
- else if (self.classname == "weapon_supershotgun")
- {
- if (leave && (other.items & IT_SUPER_SHOTGUN) )
- return;
- hadammo = other.ammo_rockets;
- new = IT_SUPER_SHOTGUN;
- other.ammo_shells = other.ammo_shells + 5;
- }
- else if (self.classname == "weapon_rocketlauncher")
- {
- if (leave && (other.items & IT_ROCKET_LAUNCHER) )
- return;
- hadammo = other.ammo_rockets;
- new = IT_ROCKET_LAUNCHER;
- other.ammo_rockets = other.ammo_rockets + 5;
- }
- else if (self.classname == "weapon_grenadelauncher")
- {
- if (leave && (other.items & IT_GRENADE_LAUNCHER) )
- return;
- hadammo = other.ammo_rockets;
- new = IT_GRENADE_LAUNCHER;
- other.ammo_rockets = other.ammo_rockets + 5;
- }
- else if (self.classname == "weapon_lightning")
- {
- if (leave && (other.items & IT_LIGHTNING) )
- return;
- hadammo = other.ammo_rockets;
- new = IT_LIGHTNING;
- other.ammo_cells = other.ammo_cells + 15;
- }
- else
- {
- objerror ("weapon_touch: unknown classname");
- return;
- }
-
- sprint (other, "You got the ");
- sprint (other, self.netname);
- sprint (other, "\n");
-// weapon touch sound
- sound (other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
- stuffcmd (other, "bf\n");
-
- bound_other_ammo ();
-
-// change to the weapon
- old = other.items;
- other.items = other.items | new;
-
- stemp = self;
- self = other;
-
-// 1997-12-23 Thunderbolt fix by Maddes start
-/* don't separate between SinglePlayer/Coop and Deathmatch
- if (!deathmatch)
- self.weapon = new;
- else
-*/
-// 1997-12-23 Thunderbolt fix by Maddes end
- Deathmatch_Weapon (old, new);
-
- W_SetCurrentAmmo();
-
- self = stemp;
-
- if (leave)
- return;
-
-// remove it in single player, or setup for respawning in deathmatch
- self.model = string_null;
- self.solid = SOLID_NOT;
- // Supa, SP respawning items support
- if (!deathmatch)
- CheckItemRespawn(self, 30);
- else if (deathmatch == 1) // weapons never disappear in "deathmatch 2"
- self.nextthink = time + 30;
-
- self.think = SUB_regen;
-
- activator = other;
- SUB_UseTargets(); // fire all targets / killtargets
-};
-
-// johnfitz new items -- dumptruck_ds from RRP and rubicon2
-/*QUAKED weapon_axe (0 .5 .8) (-16 -16 0) (16 16 32)
-Axe
-*/
-void() weapon_axe =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model ("progs/g_axe.mdl");
- setmodel (self, "progs/g_axe.mdl");
- self.weapon = IT_AXE;
- self.netname = "Axe";
- self.touch = weapon_touch;
- setsize (self, '-16 -16 0', '16 16 56');
- StartItem ();
-};
-/*QUAKED weapon_shotgun (0 .5 .8) (-16 -16 0) (16 16 32) X STYLE_1 STYLE_2 X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model("progs/g_shotgn.mdl"); }
-This is a pickup model that should be used when you want a player to spawn with only an axe and then later get the shotgun: (trigger_take_weapon or reset_items 2 in worldspawn). There are two models to choose from. Spawnflag 2 (the default) selects an unused “classic look” model from Rubicon 2 by metlslime. Spawnflag 4 is an alternate from Slapmap and has been used in a few mods.
-Single-barrelled Shotgun
-Shotgun
-*/
-
-void() weapon_shotgun =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model ("progs/g_shotgu.mdl");
- setmodel (self, "progs/g_shotgu.mdl"); //new shotgun model by Starshipwaters -dumptruck_ds - removed 2 older shotguns that used spawnflags
- self.weapon = IT_SHOTGUN;
- self.netname = "Shotgun";
- self.touch = weapon_touch;
- setsize (self, '-16 -16 0', '16 16 56');
- StartItem ();
-};
-// johnfitz
-
-/*QUAKED weapon_supershotgun (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model("progs/g_shot.mdl"); }
-Double-barrelled Shotgun
-*/
-
-void() weapon_supershotgun =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model ("progs/g_shot.mdl");
- setmodel (self, "progs/g_shot.mdl");
- self.weapon = IT_SUPER_SHOTGUN;
- self.netname = "Double-barrelled Shotgun";
- self.touch = weapon_touch;
- setsize (self, '-16 -16 0', '16 16 56');
- self.particles_offset = '0 0 33';
- StartItem ();
-};
-
-/*QUAKED weapon_nailgun (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model("progs/g_nail.mdl"); }
-Nailgun
-*/
-
-void() weapon_nailgun =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model ("progs/g_nail.mdl");
- setmodel (self, "progs/g_nail.mdl");
- self.weapon = IT_NAILGUN;
- self.netname = "nailgun";
- self.touch = weapon_touch;
- setsize (self, '-16 -16 0', '16 16 56');
- self.particles_offset = '0 0 31';
- StartItem ();
-};
-
-/*QUAKED weapon_supernailgun (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model("progs/g_nail2.mdl"); }
-Perforator
-*/
-
-void() weapon_supernailgun =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model ("progs/g_nail2.mdl");
- setmodel (self, "progs/g_nail2.mdl");
- self.weapon = IT_SUPER_NAILGUN;
- self.netname = "Super Nailgun";
- self.touch = weapon_touch;
- setsize (self, '-16 -16 0', '16 16 56');
- self.particles_offset = '0 0 34';
- StartItem ();
-};
-
-/*QUAKED weapon_grenadelauncher (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model("progs/g_rock.mdl"); }
-Grenade Launcher
-*/
-
-void() weapon_grenadelauncher =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model ("progs/g_rock.mdl");
- setmodel (self, "progs/g_rock.mdl");
- self.weapon = 3;
- self.netname = "Grenade Launcher";
- self.touch = weapon_touch;
- setsize (self, '-16 -16 0', '16 16 56');
- self.particles_offset = '0 0 28';
- StartItem ();
-};
-
-/*QUAKED weapon_rocketlauncher (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model("progs/g_rock2.mdl"); }
-Rocket Launcher
-*/
-
-void() weapon_rocketlauncher =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model ("progs/g_rock2.mdl");
- setmodel (self, "progs/g_rock2.mdl");
- self.weapon = 3;
- self.netname = "Rocket Launcher";
- self.touch = weapon_touch;
- setsize (self, '-16 -16 0', '16 16 56');
- self.particles_offset = '0 0 32';
- StartItem ();
-};
-
-
-/*QUAKED weapon_lightning (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model("progs/g_light.mdl"); }
-Thunderbolt
-*/
-
-void() weapon_lightning =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model ("progs/g_light.mdl");
- setmodel (self, "progs/g_light.mdl");
- self.weapon = 3;
- self.netname = "Thunderbolt";
- self.touch = weapon_touch;
- setsize (self, '-16 -16 0', '16 16 56');
- self.particles_offset = '0 0 31';
- StartItem ();
-};
-
-
-/*
-===============================================================================
-
-AMMO
-
-===============================================================================
-*/
-
-void() ammo_touch =
-{
-local entity stemp;
-local float best;
-
- // from Copper -- dumptruck_ds
- if (!CheckValidTouch()) return;
-
-// if the player was using his best weapon, change up to the new one if better
- stemp = self;
- self = other;
- best = W_BestWeapon();
- self = stemp;
-
-
-// shotgun
- if (self.weapon == 1)
- {
- if (other.ammo_shells >= 100)
- return;
- other.ammo_shells = other.ammo_shells + self.aflag;
- }
-
-// spikes
- if (self.weapon == 2)
- {
- if (other.ammo_nails >= 200)
- return;
- other.ammo_nails = other.ammo_nails + self.aflag;
- }
-
-// rockets
- if (self.weapon == 3)
- {
- if (other.ammo_rockets >= 100)
- return;
- other.ammo_rockets = other.ammo_rockets + self.aflag;
- }
-
-// cells
- if (self.weapon == 4)
- {
- if (other.ammo_cells >= 100)
- return;
- other.ammo_cells = other.ammo_cells + self.aflag;
- }
-
- bound_other_ammo ();
-
- sprint (other, "You got the ");
- sprint (other, self.netname);
- sprint (other, "\n");
-// ammo touch sound
- sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
- stuffcmd (other, "bf\n");
-
-// change to a better weapon if appropriate
-
- if ( other.weapon == best )
- {
- stemp = self;
- self = other;
- self.weapon = W_BestWeapon();
- W_SetCurrentAmmo ();
- self = stemp;
- }
-
-// if changed current ammo, update it
- stemp = self;
- self = other;
- W_SetCurrentAmmo();
- self = stemp;
-
-// remove it in single player, or setup for respawning in deathmatch
- self.model = string_null;
- self.solid = SOLID_NOT;
- if (!deathmatch)
- CheckItemRespawn(self, 30);
- else if (deathmatch == 1) // doesn't respawn in "deathmatch 2"
- self.nextthink = time + 30;
- self.think = SUB_regen;
-
- activator = other;
- SUB_UseTargets(); // fire all targets / killtargets
-};
-
-
-
-
-float WEAPON_BIG2 = 1;
-
-/*QUAKED item_shells (0 .5 .8) (0 0 0) (32 32 32) LARGE_BOX X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
- model ( {{ spawnflags & 1 -> { "path" : "maps/b_shell1.bsp" }, "maps/b_shell0.bsp" }} );
-}
-Box of 20 shells.
-LARGE_BOX is a box of 40 shells.
-*/
-
-void() item_shells =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- self.touch = ammo_touch;
-
-
-
- if (self.spawnflags & WEAPON_BIG2)
- {
- if (!self.mdl_body && world.s_lg_mdl) self.mdl_body = world.s_lg_mdl;
- if (world.style)
- {
- precache_body_model ("progs/a_mdls/m_shell2.mdl"); // models courtesy Lunaran -- dumptruck_ds
- body_model("progs/a_mdls/m_shell2.mdl");
- }
- // precache_model ("maps/b_shell1.bsp");
- // setmodel (self, "maps/b_shell1.bsp");
- else
- {
- precache_body_model ("maps/b_shell1.bsp");
- body_model ("maps/b_shell1.bsp");
- }
- if !(self.particles_offset)
- self.particles_offset = '16 16 16';
- self.aflag = 40;
- }
- else
- {
- if (!self.mdl_body && world.s_sm_mdl) self.mdl_body = world.s_sm_mdl;
- if (world.style)
- {
- precache_body_model ("progs/a_mdls/m_shell1.mdl"); // models courtesy Lunaran -- dumptruck_ds
- body_model("progs/a_mdls/m_shell1.mdl");
- }
- else
- {
- precache_body_model ("maps/b_shell0.bsp");
- body_model ("maps/b_shell0.bsp");
- }
- // precache_model ("maps/b_shell0.bsp");
- // setmodel (self, "maps/b_shell0.bsp");
- if !(self.particles_offset)
- self.particles_offset = '12 12 12';
- self.aflag = 20;
- }
- self.weapon = 1;
- self.netname = "shells";
- setsize (self, '0 0 0', '32 32 56');
- StartItem ();
-};
-
-/*QUAKED item_spikes (0 .5 .8) (0 0 0) (32 32 32) LARGE_BOX X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
- model ( {{ spawnflags & 1 -> { "path" : "maps/b_nail1.bsp" }, "maps/b_nail0.bsp" }} );
-}
-Box of 25 nails.
-LARGE_BOX is a box of 50 nails.
-*/
-
-void() item_spikes =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- self.touch = ammo_touch;
-
- if (self.spawnflags & WEAPON_BIG2)
- {
- if (!self.mdl_body && world.n_lg_mdl) self.mdl_body = world.n_lg_mdl;
- if (world.style)
- {
- precache_body_model ("progs/a_mdls/m_nails2.mdl"); // models courtesy Lunaran -- dumptruck_ds
- body_model("progs/a_mdls/m_nails2.mdl");
- }
- else
- {
- precache_body_model ("maps/b_nail1.bsp");
- body_model ("maps/b_nail1.bsp");
- }
- // precache_model ("maps/b_nail1.bsp");
- // setmodel (self, "maps/b_nail1.bsp");
- if !(self.particles_offset)
- self.particles_offset = '16 16 16';
- self.aflag = 50;
- }
- else
- {
-
- if (!self.mdl_body && world.n_sm_mdl) self.mdl_body = world.n_sm_mdl;
- if (world.style)
- {
- precache_body_model ("progs/a_mdls/m_nails1.mdl"); // models courtesy Lunaran -- dumptruck_ds
- body_model("progs/a_mdls/m_nails1.mdl");
- }
- else
- {
- precache_body_model ("maps/b_nail0.bsp");
- body_model ("maps/b_nail0.bsp");
- }
- // precache_model ("maps/b_nail0.bsp");
- // setmodel (self, "maps/b_nail0.bsp");
- if !(self.particles_offset)
- self.particles_offset = '12 12 12';
- self.aflag = 25;
- }
- self.weapon = 2;
- self.netname = "nails";
- setsize (self, '0 0 0', '32 32 56');
- StartItem ();
-};
-
-/*QUAKED item_rockets (0 .5 .8) (0 0 0) (32 32 32) LARGE_BOX X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
- model ( {{ spawnflags & 1 -> { "path" : "maps/b_rock1.bsp" }, "maps/b_rock0.bsp" }} );
-}
-*/
-
-void() item_rockets =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- self.touch = ammo_touch;
-
- if (self.spawnflags & WEAPON_BIG2)
- {
-
- if (!self.mdl_body && world.r_lg_mdl) self.mdl_body = world.r_lg_mdl;
- if (world.style)
- {
- precache_body_model ("progs/a_mdls/m_rock2.mdl"); // models courtesy Lunaran -- dumptruck_ds
- body_model("progs/a_mdls/m_rock2.mdl");
- }
- else
- {
- precache_body_model ("maps/b_rock1.bsp");
- body_model ("maps/b_rock1.bsp");
- }
- // precache_model ("maps/b_rock1.bsp");
- // setmodel (self, "maps/b_rock1.bsp");
- self.particles_offset = '16 8 16';
- self.aflag = 10;
- }
- else
- {
- if (!self.mdl_body && world.r_sm_mdl) self.mdl_body = world.r_sm_mdl;
- if (world.style)
- {
- precache_body_model ("progs/a_mdls/m_rock1.mdl"); // models courtesy Lunaran -- dumptruck_ds
- body_model("progs/a_mdls/m_rock1.mdl");
- }
- else
- {
- precache_body_model ("maps/b_rock0.bsp");
- body_model ("maps/b_rock0.bsp");
- }
- // precache_model ("maps/b_rock0.bsp");
- // setmodel (self, "maps/b_rock0.bsp");
- if !(self.particles_offset)
- self.particles_offset = '8 8 16';
- self.aflag = 5;
- }
- self.weapon = 3;
- self.netname = "rockets";
- setsize (self, '0 0 0', '32 32 56');
- StartItem ();
-};
-
-
-/*QUAKED item_cells (0 .5 .8) (0 0 0) (32 32 32) LARGE_BOX X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
- model ( {{ spawnflags & 1 -> { "path" : "maps/b_batt1.bsp" }, "maps/b_batt0.bsp" }} );
-}
-Box of 6 cells.
-LARGE_BOX is a box of 12 cells.
-*/
-
-void() item_cells =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- self.touch = ammo_touch;
-
- if (self.spawnflags & WEAPON_BIG2)
- {
- if (!self.mdl_body && world.c_lg_mdl) self.mdl_body = world.c_lg_mdl;
- if (world.style)
- {
- precache_body_model ("progs/a_mdls/m_cells2.mdl"); // models courtesy Lunaran -- dumptruck_ds
- body_model("progs/a_mdls/m_cells2.mdl");
- }
- else
- {
- precache_body_model ("maps/b_batt1.bsp");
- body_model ("maps/b_batt1.bsp");
- }
- // precache_model ("maps/b_batt1.bsp");
- // setmodel (self, "maps/b_batt1.bsp");
- if !(self.particles_offset)
- self.particles_offset = '16 16 16';
- self.aflag = 12;
- }
- else
- {
- if (!self.mdl_body && world.c_sm_mdl) self.mdl_body = world.c_sm_mdl;
- if (world.style)
- {
- precache_body_model ("progs/a_mdls/m_cells2.mdl"); // models courtesy Lunaran -- dumptruck_ds
- body_model("progs/a_mdls/m_cells2.mdl");
- }
- else
- {
- precache_body_model ("maps/b_batt0.bsp");
- body_model ("maps/b_batt0.bsp");
- }
- // precache_model ("maps/b_batt0.bsp");
- // setmodel (self, "maps/b_batt0.bsp");
- if !(self.particles_offset)
- self.particles_offset = '12 12 12';
- self.aflag = 6;
- }
- self.weapon = 4;
- self.netname = "cells";
- setsize (self, '0 0 0', '32 32 56');
- StartItem ();
-};
-
-
-/*
-===============================================================================
-
-KEYS
-
-===============================================================================
-*/
-
-
-void() key_touch =
-{
- // from Copper -- dumptruck_ds
- if (!CheckValidTouch()) return;
-
-// support for item_key_custom -- iw
- if (HasKeys (other, self.items, self.customkeys))
- return;
-
- sprint (other, "You got the ");
- sprint (other, self.netname);
- sprint (other,"\n");
-
- sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
- stuffcmd (other, "bf\n");
-
-// support for item_key_custom -- iw
- GiveKeys (other, self.items, self.customkeys);
-
- if (!coop)
- {
- self.solid = SOLID_NOT;
- self.model = string_null;
- }
-
- activator = other;
-// fix key items firing their targets multiple times in coop -- iw
-// SUB_UseTargets(); // fire all targets / killtargets
- SUB_UseAndForgetTargets();
-};
-
-
-void() key_setsounds =
-{
-// support for item_key_custom -- iw
- if (self.noise != "")
- {
- precache_sound (self.noise);
- return;
- }
-
- if (world.worldtype == WORLDTYPE_MEDIEVAL)
- {
- precache_sound ("misc/medkey.wav");
- self.noise = "misc/medkey.wav";
- }
- if (world.worldtype == WORLDTYPE_METAL)
- {
- precache_sound ("misc/runekey.wav");
- self.noise = "misc/runekey.wav";
- }
- if (world.worldtype == WORLDTYPE_BASE)
- {
- precache_sound2 ("misc/basekey.wav");
- self.noise = "misc/basekey.wav";
- }
-};
-
-
-/*
-============
-key_start
-
-Finish initializing self as a key item. -- iw
-============
-*/
-void() key_start =
-{
- key_setsounds ();
- self.particles_offset = '0 0 18';
- self.touch = key_touch;
- setsize (self, '-16 -16 -24', '16 16 32');
- StartItem ();
-};
-
-
-/*QUAKED item_key1 (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model("progs/w_s_key.mdl"); }
-SILVER key
-In order for keys to work you MUST set your map's worldtype to one of the following:
-0: medieval
-1: metal
-2: base
-*/
-
-void() item_key1 =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- if (world.worldtype == WORLDTYPE_MEDIEVAL)
- {
- precache_body_model ("progs/w_s_key.mdl");
- body_model ("progs/w_s_key.mdl");
- }
- else if (world.worldtype == WORLDTYPE_METAL)
- {
- precache_body_model ("progs/m_s_key.mdl");
- body_model ("progs/m_s_key.mdl");
- }
- else if (world.worldtype == WORLDTYPE_BASE)
- {
- precache_body_model2 ("progs/b_s_key.mdl");
- body_model ("progs/b_s_key.mdl");
- }
-
- if (self.keyname != "") self.netname = self.keyname;
- else self.netname = SilverKeyName ();
-
- self.items = IT_KEY1;
-
-// support for item_key_custom -- iw
- self.customkeys = 0; // ignore any mapper-set value
- self.noise = ""; // ignore any mapper-set value
-
- key_start ();
-};
-
-
-/*QUAKED item_key2 (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
- model ("progs/w_g_key.mdl");
-}
-GOLD key
-In order for keys to work you MUST set your map's worldtype to one of the following:
-0: medieval
-1: metal
-2: base
-*/
-
-void() item_key2 =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- if (world.worldtype == WORLDTYPE_MEDIEVAL)
- {
- precache_body_model ("progs/w_g_key.mdl");
- body_model ("progs/w_g_key.mdl");
- }
- if (world.worldtype == WORLDTYPE_METAL)
- {
- precache_body_model ("progs/m_g_key.mdl");
- body_model ("progs/m_g_key.mdl");
- }
- if (world.worldtype == WORLDTYPE_BASE)
- {
- precache_body_model2 ("progs/b_g_key.mdl");
- body_model ("progs/b_g_key.mdl");
- }
-
- if (self.keyname != "") self.keyname = "";
- else self.netname = GoldKeyName ();
-
- self.items = IT_KEY2;
-
-// support for item_key_custom -- iw
- self.customkeys = 0; // ignore any mapper-set value
- self.noise = ""; // ignore any mapper-set value
-
- key_start ();
-};
-
-
-// item_key_custom is a brand-spanking-new entity class created for
-// progs_dump -- iw
-
-/*QUAKED item_key_custom (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
- model ({"path" : "progs/pd_w_key.mdl", "skin" : 1});
-}
-A customizable key item.
-
-"keyname" name of the key, e.g. "bronze key" (required)
-"mdl" model file (required)
-"noise" sound file for the pickup sound (default is per worldtype)
-"skin" skin index (default 0)
-
-The "keyname" value is used both for the pickup message and to associate
-the key with the entity that it unlocks.
-
-To make a func_door or trigger_usekey require this key, set the
-"keyname" value of that entity so that it matches the "keyname" value of
-the key.
-
-If different item_key_custom entities have the same "keyname" value,
-they will be treated as different copies of the same key and may be used
-interchangeably.
-
-A map may have a maximum of 23 unique "keyname" values across all
-entities.
-
-The behavior of an item_key_custom should be as the player expects
-(based on the behavior of the silver and gold keys), except for the fact
-that it will not appear as an icon in the player's status bar when
-picked up. This is a limitation of the engine.
-*/
-
-void() item_key_custom =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- if (self.keyname == "")
- {
- objerror ("no keyname specified");
- return;
- }
-
- if (self.mdl == "")
- {
- objerror ("no mdl specified");
- return;
- }
-
- precache_model (self.mdl);
- setmodel (self, self.mdl);
- self.mdl = ""; // this should not be referenced again
-
- self.netname = self.keyname;
- self.keyname = ""; // this should not be referenced again
-
- self.items = 0; // ignore any mapper-set value
- self.customkeys = CustomKeyFlag (self.netname);
-
- key_start ();
-};
-
-
-/*
-===============================================================================
-
-END OF LEVEL RUNES
-
-===============================================================================
-*/
-
-void() sigil_touch =
-{
- // from Copper -- dumptruck_ds
- if (!CheckValidTouch()) return;
-
- centerprint (other, "You got the rune!");
-
- sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
- stuffcmd (other, "bf\n");
- self.solid = SOLID_NOT;
- self.model = string_null;
- serverflags = serverflags | (self.spawnflags & 15);
- self.classname = ""; // so rune doors won't find it
-
- activator = other;
- SUB_UseTargets(); // fire all targets / killtargets
-};
-
-void() sigil_touch2 = //replacement for Skill Select Rune hack -- uses info_player_start2 if spawnflag 16 -- dumptruck_ds
-{
- if (other.classname != "player")
- return;
- if (other.health <= 0)
- return;
-
- // centerprint (other, "You got the rune!");
-
- // sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
- // stuffcmd (other, "bf\n");
- self.solid = SOLID_NOT;
- self.model = string_null;
- serverflags = serverflags | (self.spawnflags & 16);
- self.classname = ""; // so rune doors won't find it
-
- activator = other;
- // SUB_UseTargets(); // fire all targets / killtargets
-};
-
-
-/*QUAKED item_sigil (0 .5 .8) (-16 -16 -24) (16 16 32) E1 E2 E3 E4 X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
- model ( {{ spawnflags & 1 -> { "path" : "progs/end1.mdl" }, spawnflags & 2 -> { "path" : "progs/end2.mdl" },
- spawnflags & 4 -> { "path" : "progs/end3.mdl" }, spawnflags & 8 -> { "path" : "progs/end4.mdl" },
- "progs/end1.mdl" }} );
-}
-End of episode rune. Use in conjuction with func_bossgate and func_episodegate.
-Spawnflag must be set to the appropriate episode.
-Episode 1 - Dimension of the Doomed - Rune of Earth Magic
-Episode 2 - The Realm of Black Magic - Rune of Black Magic
-Episode 3 - The Netherworld - Rune of Hell Magic
-Episode 4 - The Elder World - Run of Elder Magic
-*/
-
-void() item_sigil =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- if (!self.spawnflags)
- objerror ("no spawnflags");
-
- precache_sound ("misc/runekey.wav");
- self.noise = "misc/runekey.wav";
-
- if (self.spawnflags & 1)
- {
- precache_model ("progs/end1.mdl");
- setmodel (self, "progs/end1.mdl");
- }
- if (self.spawnflags & 2)
- {
- precache_model2 ("progs/end2.mdl");
- setmodel (self, "progs/end2.mdl");
- }
- if (self.spawnflags & 4)
- {
- precache_model2 ("progs/end3.mdl");
- setmodel (self, "progs/end3.mdl");
- }
- if (self.spawnflags & 8)
- {
- precache_model2 ("progs/end4.mdl");
- setmodel (self, "progs/end4.mdl");
- }
-
- self.touch = sigil_touch;
- setsize (self, '-16 -16 -24', '16 16 32');
- self.particles_offset = '0 0 18';
- StartItem ();
-};
-
-/*
-===============================================================================
-
-POWERUPS
-
-===============================================================================
-*/
-
-void() powerup_touch;
-
-
-void() powerup_touch =
-{
- // from Copper -- dumptruck_ds
- if (!CheckValidTouch()) return;
-
- sprint (other, "You got the ");
- sprint (other, self.netname);
- sprint (other,"\n");
-
- // if (deathmatch)
- // {
- // self.mdl = self.model;
- //
- // if ((self.classname == "item_artifact_invulnerability") ||
- // (self.classname == "item_artifact_invisibility"))
- // self.nextthink = time + 60*5;
- // else
- // self.nextthink = time + 60;
- //
- // self.think = SUB_regen;
- // }
-
- // Supa, SP respawning items support
- self.mdl = self.model;
- self.think = SUB_regen;
-
- if (!deathmatch)
- {
- local float spawndelay;
-
- if (self.classname == "item_artifact_invulnerability" ||
- self.classname == "item_artifact_invisibility" ) spawndelay = 300;
- // else if (self.classname == "item_grappling_hook" ) spawndelay = 30;
- else spawndelay = 60;
-
- CheckItemRespawn(self, spawndelay);
- }
- else
- {
- if ((self.classname == "item_artifact_invulnerability") ||
- (self.classname == "item_artifact_invisibility"))
- self.nextthink = time + 60*5;
- else
- self.nextthink = time + 60;
- }
-
- sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
- stuffcmd (other, "bf\n");
- self.solid = SOLID_NOT;
- other.items = other.items | self.items;
- self.model = string_null;
-
-// do the apropriate action
- if (self.classname == "item_artifact_envirosuit")
- {
- other.rad_time = 1;
- other.radsuit_finished = time + 30;
- }
-
- if (self.classname == "item_artifact_invulnerability")
- {
- other.invincible_time = 1;
- other.invincible_finished = time + 30;
- }
-
- if (self.classname == "item_artifact_invisibility")
- {
- other.invisible_time = 1;
- other.invisible_finished = time + 30;
- }
-
- if (self.classname == "item_artifact_super_damage")
- {
- other.super_time = 1;
- other.super_damage_finished = time + 30;
- }
-
- activator = other;
- SUB_UseTargets(); // fire all targets / killtargets
-};
-
-/*QUAKED item_artifact_invulnerability (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model("progs/invulner.mdl"); }
-Pentagram of Protection
-Player is invulnerable for 30 seconds
-*/
-void() item_artifact_invulnerability =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- self.touch = powerup_touch;
-
- // precache_model ("progs/invulner.mdl");
- precache_body_model ("progs/invulner.mdl");
- precache_sound ("items/protect.wav");
- precache_sound ("items/protect2.wav"); // called in client.qc -- dumptruck_ds
- precache_sound ("items/protect3.wav"); // called in combat.qc -- dumptruck_ds
- self.noise = "items/protect.wav";
- // setmodel (self, "progs/invulner.mdl");
- body_model ("progs/invulner.mdl");
- self.netname = "Pentagram of Protection";
- self.items = IT_INVULNERABILITY;
- setsize (self, '-16 -16 -24', '16 16 32');
- if !(self.particles_offset) // t_fog fix for custom models dumptruck_ds
- self.particles_offset = '0 0 16';
- StartItem ();
-};
-
-/*QUAKED item_artifact_envirosuit (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model("progs/suit.mdl"); }
-Biosuit
-Player takes no damage from water or slime for 30 seconds
-*/
-void() item_artifact_envirosuit =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- self.touch = powerup_touch;
-
- precache_body_model ("progs/suit.mdl");
- precache_sound ("items/suit.wav");
- precache_sound ("items/suit2.wav");
- self.noise = "items/suit.wav";
- // setmodel (self, "progs/suit.mdl");
- body_model ("progs/suit.mdl");
- self.netname = "Biosuit";
- self.items = IT_SUIT;
- setsize (self, '-16 -16 -24', '16 16 32');
- if !(self.particles_offset) // t_fog fix for custom models dumptruck_ds
- self.particles_offset = '0 0 32';
- StartItem ();
-};
-
-
-/*QUAKED item_artifact_invisibility (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model("progs/invisibl.mdl"); }
-Ring of Shadows
-Player is invisible for 30 seconds
-*/
-void() item_artifact_invisibility =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- self.touch = powerup_touch;
-
- precache_body_model ("progs/invisibl.mdl");
- precache_sound ("items/inv1.wav");
- precache_sound ("items/inv2.wav");
- precache_sound ("items/inv3.wav");
- self.noise = "items/inv1.wav";
- // setmodel (self, "progs/invisibl.mdl");
- body_model ("progs/invisibl.mdl");
- self.netname = "Ring of Shadows";
- self.items = IT_INVISIBILITY;
- setsize (self, '-16 -16 -24', '16 16 32');
- if !(self.particles_offset) // t_fog fix for custom models dumptruck_ds
- self.particles_offset = '0 0 0';
- StartItem ();
-};
-
-
-/*QUAKED item_artifact_super_damage (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model("progs/quaddama.mdl"); }
-Quad Damage
-Player does 4x damage for 30 seconds
-*/
-void() item_artifact_super_damage =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- self.touch = powerup_touch;
-
- precache_body_model ("progs/quaddama.mdl");
- precache_sound ("items/damage.wav");
- precache_sound ("items/damage3.wav");
- self.noise = "items/damage.wav";
- // setmodel (self, "progs/quaddama.mdl");
- body_model ("progs/quaddama.mdl");
- if !(self.netname) // custom name -- dumptruck_ds
- self.netname = "Quad Damage";
- self.items = IT_QUAD;
- setsize (self, '-16 -16 -24', '16 16 32');
- if !(self.particles_offset) // t_fog fix for custom models dumptruck_ds
- self.particles_offset = '0 0 16';
- StartItem ();
-};
-
-
-
-/*
-===============================================================================
-
-PLAYER BACKPACKS
-
-===============================================================================
-*/
-
-void() BackpackTouch =
-{
- local string s;
- local float best, old, new;
- local entity stemp;
- local float acount;
- // from Copper -- dumptruck_ds
- if (other.movetype == MOVETYPE_NOCLIP)
- return;
- if (other.classname != "player")
- return;
- if (other.health <= 0)
- return;
-
- acount = 0;
- sprint (other, "You get ");
-
- if (self.items)
- if ((other.items & self.items) == 0)
- {
- acount = 1;
- sprint (other, "the ");
- sprint (other, self.netname);
- }
-
-// if the player was using his best weapon, change up to the new one if better
- stemp = self;
- self = other;
- best = W_BestWeapon();
- self = stemp;
-
-// change weapons
- other.ammo_shells = other.ammo_shells + self.ammo_shells;
- other.ammo_nails = other.ammo_nails + self.ammo_nails;
- other.ammo_rockets = other.ammo_rockets + self.ammo_rockets;
- other.ammo_cells = other.ammo_cells + self.ammo_cells;
-
- new = self.items;
- if (!new)
- new = other.weapon;
- old = other.items;
- other.items = other.items | new;
-
- bound_other_ammo ();
-
- if (self.ammo_shells) // hack to fix an issue with custom Grunt, Ogre and Enf ammo types. - dumptruck_ds
- // if (self.ammo_shells < 100)
- {
- if (acount)
- sprint(other, ", ");
- acount = 1;
- s = ftos(self.ammo_shells);
- sprint (other, s);
- sprint (other, " shells");
- }
- if (self.ammo_nails)
- {
- if (acount)
- sprint(other, ", ");
- acount = 1;
- s = ftos(self.ammo_nails);
- sprint (other, s);
- sprint (other, " nails");
- }
- if (self.ammo_rockets)
- {
- if (acount)
- sprint(other, ", ");
- acount = 1;
- s = ftos(self.ammo_rockets);
- sprint (other, s);
- sprint (other, " rockets");
- }
- if (self.ammo_cells)
- {
- if (acount)
- sprint(other, ", ");
- acount = 1;
- s = ftos(self.ammo_cells);
- sprint (other, s);
- sprint (other, " cells");
- }
-
- sprint (other, "\n");
-// backpack touch sound
- sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
- stuffcmd (other, "bf\n");
-
-// remove the backpack, change self to the player
- remove(self);
- self = other;
-
-// change to the weapon
-// 1997-12-23 Thunderbolt fix by Maddes start
-/* don't separate between SinglePlayer/Coop and Deathmatch
- if (!deathmatch)
- self.weapon = new;
- else
-*/
-// 1997-12-23 Thunderbolt fix by Maddes end
- Deathmatch_Weapon (old, new);
-
- W_SetCurrentAmmo ();
-
-};
-
-/*
-===============
-DropStuff -- dumptruck_ds
-
-set drops_item on a monster to a number:
-
-1 = Silver Key
-2 = Gold Key
-3 = Health Vial
-4 = Armor Shard
-5 = Health Vial & Armor Shard
-6 = random combination of 3 Vials and/or Shards
-===============
-*/
-
-void() DropKey1 =
-{
- local entity item;
-
- item = spawn();
- item.origin = self.origin - '0 0 24';
-
- item.velocity_z = 300;
- item.velocity_x = -100 + (random() * 200);
- item.velocity_y = -100 + (random() * 200);
-
- if (world.worldtype == WORLDTYPE_MEDIEVAL)
- {
- // precache_model ("progs/w_s_key.mdl");
- setmodel (item, "progs/w_s_key.mdl");
- item.noise = "misc/medkey.wav";
- }
- else if (world.worldtype == WORLDTYPE_METAL)
- {
- // precache_model ("progs/m_s_key.mdl");
- setmodel (item, "progs/m_s_key.mdl");
- item.noise = "misc/runekey.wav";
- }
- else if (world.worldtype == WORLDTYPE_BASE)
- {
- // precache_model2 ("progs/b_s_key.mdl");
- setmodel (item, "progs/b_s_key.mdl");
- item.noise = "misc/basekey.wav";
- }
- item.netname = SilverKeyName ();
- item.effects = 8;
- item.flags = FL_ITEM;
- item.items = IT_KEY1;
- item.solid = SOLID_TRIGGER;
- item.movetype = MOVETYPE_TOSS;
- setsize (item, '-16 -16 0', '16 16 56');
- item.touch = key_touch;
-};
-
-void() DropKey2 =
-{
- local entity item;
-
- item = spawn();
- item.origin = self.origin - '0 0 24';
-
- item.velocity_z = 300;
- item.velocity_x = -100 + (random() * 200);
- item.velocity_y = -100 + (random() * 200);
-
- if (world.worldtype == WORLDTYPE_MEDIEVAL)
- {
- // precache_model ("progs/w_s_key.mdl");
- setmodel (item, "progs/w_g_key.mdl");
- item.noise = "misc/medkey.wav";
- }
- else if (world.worldtype == WORLDTYPE_METAL)
- {
- // precache_model ("progs/m_s_key.mdl");
- setmodel (item, "progs/m_g_key.mdl");
- item.noise = "misc/runekey.wav";
- }
- else if (world.worldtype == WORLDTYPE_BASE)
- {
- // precache_model2 ("progs/b_s_key.mdl");
- setmodel (item, "progs/b_g_key.mdl");
- item.noise = "misc/basekey.wav";
- }
- item.netname = GoldKeyName ();
- item.effects = 8;
- item.flags = FL_ITEM;
- item.items = IT_KEY2;
- item.solid = SOLID_TRIGGER;
- item.movetype = MOVETYPE_TOSS;
- setsize (item, '-16 -16 0', '16 16 56');
- item.touch = key_touch;
-};
-
-void() DropVial = //
-{
- local entity item;
-
- item = spawn();
- item.origin = self.origin - '0 0 24';
-
- item.velocity_z = 300;
- item.velocity_x = -100 + (random() * 200);
- item.velocity_y = -100 + (random() * 200);
-
- setmodel(item, "progs/h_mdls/pd_vial.mdl");
- item.solid = SOLID_TRIGGER;
- item.movetype = MOVETYPE_TOSS;
- setsize (item, '-16 -16 0', '16 16 56');
- item.touch = health_touch;
- item.healamount = 5;
- item.healtype = 0;
- item.noise = "items/r_item1.wav";
-
- StartItem ();
-};
-
-void() DropShard = //
-{
- local entity item;
-
- item = spawn();
- item.origin = self.origin - '0 0 24';
-
- item.velocity_z = 300;
- item.velocity_x = -100 + (random() * 200);
- item.velocity_y = -100 + (random() * 200);
-
- setmodel(item, "progs/armshr.mdl");
- item.solid = SOLID_TRIGGER;
- item.movetype = MOVETYPE_TOSS;
- setsize (item, '-16 -16 0', '16 16 56');
- item.touch = shard_touch;
- item.snd_misc = "dump/armsh1.wav";
-
- StartItem ();
-};
-
-void() DropStuff =
-{
- local float rand_drop;
-
- if (self.drop_item == 1)
- {
- DropKey1();
- }
- if (self.drop_item == 2)
- {
- DropKey2();
- }
- if (self.drop_item == 3)
- {
- DropVial();
- }
- if (self.drop_item == 4)
- {
- DropShard();
- }
- if (self.drop_item == 5)
- {
- DropVial();
- DropShard();
- }
- else if (self.drop_item == 6)
- {
- rand_drop = rint(random() * 3);
- if (rand_drop == 1)
- {
- DropShard();
- DropVial();
- DropVial();
- }
- else if (rand_drop == 2)
- {
- DropShard();
- DropShard();
- DropVial();
- }
- else if (rand_drop == 0)
- {
- DropShard();
- DropShard();
- DropShard();
- }
- else
- {
- DropVial();
- DropVial();
- DropVial();
- }
- }
- return;
-};
-
-/*
-===============
-DropBackpack
-===============
-*/
-void() DropBackpack =
-{
- local entity item;
-
- if (!(self.ammo_shells + self.ammo_nails + self.ammo_rockets + self.ammo_cells))
- return; // nothing in it
-
- item = spawn();
- item.origin = self.origin - '0 0 24';
-
- item.items = self.weapon;
- if (item.items == IT_AXE)
- item.netname = "Axe";
- else if (item.items == IT_SHOTGUN)
- item.netname = "Shotgun";
- else if (item.items == IT_SUPER_SHOTGUN)
- item.netname = "Double-barrelled Shotgun";
- else if (item.items == IT_NAILGUN)
- item.netname = "Nailgun";
- else if (item.items == IT_SUPER_NAILGUN)
- item.netname = "Super Nailgun";
- else if (item.items == IT_GRENADE_LAUNCHER)
- item.netname = "Grenade Launcher";
- else if (item.items == IT_ROCKET_LAUNCHER)
- item.netname = "Rocket Launcher";
- else if (item.items == IT_LIGHTNING)
- item.netname = "Thunderbolt";
- else
- item.netname = "";
-
- item.ammo_shells = self.ammo_shells;
- item.ammo_nails = self.ammo_nails;
- item.ammo_rockets = self.ammo_rockets;
- item.ammo_cells = self.ammo_cells;
-
- item.velocity_z = 300;
- item.velocity_x = -100 + (random() * 200);
- item.velocity_y = -100 + (random() * 200);
-
- item.flags = FL_ITEM;
- item.solid = SOLID_TRIGGER;
- item.movetype = MOVETYPE_TOSS;
- setmodel (item, "progs/backpack.mdl");
- setsize (item, '-16 -16 0', '16 16 56');
- item.touch = BackpackTouch;
-
- item.nextthink = time + 120; // remove after 2 minutes
- item.think = SUB_Remove;
-};
-
-// dumptruck_ds
-float DEFAULT = 1;
-float SHELLS = 2;
-float NAILS = 4;
-float ROCKETS = 8;
-float CELLS = 16;
-
-void() item_backpack_message =
-{
-
- if (!CheckValidTouch()) return; // from Copper -- dumptruck_ds
-
- other.ammo_shells = other.ammo_shells + self.ammo_shells;
- other.ammo_nails = other.ammo_nails + self.ammo_nails;
- other.ammo_rockets = other.ammo_rockets + self.ammo_rockets;
- other.ammo_cells = other.ammo_cells + self.ammo_cells;
-
- if (self.netname != "")
- {
- sprint (other, "You got ");
- sprint (other, self.netname);
- sprint (other, "\n");
- }
- else
- sprint (other, "You got a backpack!\n");
-
- // backpack touch sound
- // sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
- sound_misc (other, CHAN_ITEM, self.snd_misc, 1, ATTN_NORM);
- stuffcmd (other, "bf\n");
- remove(self);
- self = other;
- bound_other_ammo();
- W_SetCurrentAmmo ();
-
-};
-// Some of this text is from Drake -- dumptruck_ds
-/*QUAKED item_backpack (0 .5 .8) (-16 -16 0) (16 16 72) SHELLS NAILS ROCKETS CELLS X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model("progs/backpack.mdl"); }
-By default, gives roughly half the ammo from the 4 standard pickups:
-
-10 Shells
-12 Nails
-2 Rockets
-3 Cells
-
-Or you can use the spawnflags to mix and match types.
-Override the spawnflags defaults by adding custom amounts to:
-
-ammo_shells
-ammo_nails
-ammo_rockets
-ammo_cells
-
-Can trigger spawn and suspend in air, but not respawn. You can set a skin
-index if you are using a custom model with skins.
-
-The default pickup message is `You got a backpack.` But you can
-set a custom message with the netname key. 'You got' will be the prefix
-and the mapper chooses the rest of the message.
-
-e.g. For 'You got a bunch of rockets!' the netname key would be
-'a bunch of rockets!'
-*/
-void() item_backpack =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- if (deathmatch)
- {
- remove(self);
- return;
- }
-
- self.flags = FL_ITEM;
- self.solid = SOLID_TRIGGER;
- self.movetype = MOVETYPE_TOSS;
- self.classname = "item_backpack";
- // self.netname = self.netname;
- if !(self.spawnflags)
- {
- objerror ("\bNO SPAWNFLAG SET ON item_backpack");
- return;
- }
-
- if (self.spawnflags & DEFAULT)
- {
- self.ammo_shells = 10;
- self.ammo_nails = 12;
- self.ammo_rockets = 2;
- self.ammo_cells = 3;
- }
-
- if (self.spawnflags & SHELLS)
- {
- if !(self.ammo_shells)
- {
- self.ammo_shells = 10;
- }
- }
- if (self.spawnflags & NAILS)
- {
- if !(self.ammo_nails)
- {
- self.ammo_nails = 12;
- }
- }
- if (self.spawnflags & ROCKETS)
- {
- if !(self.ammo_rockets)
- {
- self.ammo_rockets = 2;
- }
- }
- if (self.spawnflags & CELLS)
- {
- if !(self.ammo_cells)
- {
- self.ammo_cells = 3;
- }
- }
-
- self.touch = item_backpack_message;
-
- if !(self.snd_misc) //set the custom noise in editor -- dumptruck_ds
- self.snd_misc = "weapons/lock4.wav";
- precache_sound_misc(self.snd_misc);
- precache_body_model ("progs/pd_bpack.mdl");
- body_model ("progs/pd_bpack.mdl");
- // setmodel (self, "progs/backpack.mdl");
- setsize (self, '-16 -16 0', '16 16 56');
- StartItem ();
-};

Return to the top of this page or return to the overview of this repo.

Diff qc/items/ammo.qc

diff --git a/qc/items/ammo.qc b/qc/items/ammo.qc
new file mode 100644
index 0000000..3f17440
--- /dev/null
+++ b/qc/items/ammo.qc
@@ -0,0 +1,346 @@
+//==============================================================================
+// AMMO -- was in items.qc
+//==============================================================================
+
+// constants
+const float WEAPON_BIG2 = 1;
+
+//----------------------------------------------------------------------
+void() ammo_touch =
+{
+ local entity stemp;
+ local float best;
+
+ // from Copper -- dumptruck_ds
+ if (!CheckValidTouch())
+ return;
+
+ // if the player was using his best weapon, change up to the new
+ // one if better
+ stemp = self;
+ self = other;
+ best = W_BestWeapon ();
+ self = stemp;
+
+
+ // shotgun
+ if (self.weapon == 1)
+ {
+ if (other.ammo_shells >= 100)
+ return;
+ other.ammo_shells = other.ammo_shells + self.aflag;
+ }
+
+ // spikes
+ if (self.weapon == 2)
+ {
+ if (other.ammo_nails >= 200)
+ return;
+ other.ammo_nails = other.ammo_nails + self.aflag;
+ }
+
+ // rockets
+ if (self.weapon == 3)
+ {
+ if (other.ammo_rockets >= 100)
+ return;
+ other.ammo_rockets = other.ammo_rockets + self.aflag;
+ }
+
+ // cells
+ if (self.weapon == 4)
+ {
+ if (other.ammo_cells >= 100)
+ return;
+ other.ammo_cells = other.ammo_cells + self.aflag;
+ }
+
+ bound_other_ammo ();
+
+ sprint (other, "You got the ");
+ sprint (other, self.netname);
+ sprint (other, "\n");
+ // ammo touch sound
+ sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+
+ // change to a better weapon if appropriate
+
+ if (other.weapon == best)
+ {
+ stemp = self;
+ self = other;
+ self.weapon = W_BestWeapon ();
+ W_SetCurrentAmmo ();
+ self = stemp;
+ }
+
+ // if changed current ammo, update it
+ stemp = self;
+ self = other;
+ W_SetCurrentAmmo ();
+ self = stemp;
+
+ // remove it in single player, or setup for respawning in deathmatch
+ self.model = string_null;
+ self.solid = SOLID_NOT;
+ if (!deathmatch)
+ CheckItemRespawn (self, 30);
+ else if (deathmatch == 1)
+ // doesn't respawn in "deathmatch 2"
+ self.nextthink = time + 30;
+ self.think = SUB_Regen;
+
+ activator = other;
+ // fire all targets / killtargets
+ SUB_UseTargets ();
+};
+
+/*QUAKED item_shells (0 .5 .8) (0 0 0) (32 32 32) LARGE_BOX X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+ model ( {{ spawnflags & 1 -> { "path" : "maps/b_shell1.bsp" }, "maps/b_shell0.bsp" }} );
+}
+Box of 20 shells.
+LARGE_BOX is a box of 40 shells.
+*/
+void() item_shells =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.touch = ammo_touch;
+
+ if (self.spawnflags & WEAPON_BIG2)
+ {
+ if (!self.mdl_body && world.s_lg_mdl)
+ self.mdl_body = world.s_lg_mdl;
+
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/ammo/m_shell2.mdl");
+ body_model ("progs/ammo/m_shell2.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_shell1.bsp");
+ body_model ("maps/b_shell1.bsp");
+ }
+
+ if !(self.particles_offset)
+ self.particles_offset = '16 16 16';
+ self.aflag = 40;
+ }
+ else
+ {
+ if (!self.mdl_body && world.s_sm_mdl)
+ self.mdl_body = world.s_sm_mdl;
+
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/ammo/m_shell1.mdl");
+ body_model ("progs/ammo/m_shell1.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_shell0.bsp");
+ body_model ("maps/b_shell0.bsp");
+ }
+
+ if !(self.particles_offset)
+ self.particles_offset = '12 12 12';
+ self.aflag = 20;
+ }
+ self.weapon = 1;
+ self.netname = "shells";
+ setsize (self, '0 0 0', '32 32 56');
+ StartItem ();
+};
+
+/*QUAKED item_spikes (0 .5 .8) (0 0 0) (32 32 32) LARGE_BOX X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+ model ( {{ spawnflags & 1 -> { "path" : "maps/b_nail1.bsp" }, "maps/b_nail0.bsp" }} );
+}
+Box of 25 nails.
+LARGE_BOX is a box of 50 nails.
+*/
+void() item_spikes =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.touch = ammo_touch;
+
+ if (self.spawnflags & WEAPON_BIG2)
+ {
+ if (!self.mdl_body && world.n_lg_mdl)
+ self.mdl_body = world.n_lg_mdl;
+
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/ammo/m_nails2.mdl");
+ body_model ("progs/ammo/m_nails2.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_nail1.bsp");
+ body_model ("maps/b_nail1.bsp");
+ }
+
+ if !(self.particles_offset)
+ self.particles_offset = '16 16 16';
+ self.aflag = 50;
+ }
+ else
+ {
+ if (!self.mdl_body && world.n_sm_mdl)
+ self.mdl_body = world.n_sm_mdl;
+
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/ammo/m_nails1.mdl");
+ body_model ("progs/ammo/m_nails1.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_nail0.bsp");
+ body_model ("maps/b_nail0.bsp");
+ }
+
+ if !(self.particles_offset)
+ self.particles_offset = '12 12 12';
+ self.aflag = 25;
+ }
+ self.weapon = 2;
+ self.netname = "nails";
+ setsize (self, '0 0 0', '32 32 56');
+ StartItem ();
+};
+
+/*QUAKED item_rockets (0 .5 .8) (0 0 0) (32 32 32) LARGE_BOX X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+ model ( {{ spawnflags & 1 -> { "path" : "maps/b_rock1.bsp" }, "maps/b_rock0.bsp" }} );
+}
+*/
+void() item_rockets =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.touch = ammo_touch;
+
+ if (self.spawnflags & WEAPON_BIG2)
+ {
+ if (!self.mdl_body && world.r_lg_mdl)
+ self.mdl_body = world.r_lg_mdl;
+
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/ammo/m_rock2.mdl");
+ body_model ("progs/ammo/m_rock2.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_rock1.bsp");
+ body_model ("maps/b_rock1.bsp");
+ }
+
+ self.particles_offset = '16 8 16';
+ self.aflag = 10;
+ }
+ else
+ {
+ if (!self.mdl_body && world.r_sm_mdl)
+ self.mdl_body = world.r_sm_mdl;
+
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/ammo/m_rock1.mdl");
+ body_model ("progs/ammo/m_rock1.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_rock0.bsp");
+ body_model ("maps/b_rock0.bsp");
+ }
+
+ if !(self.particles_offset)
+ self.particles_offset = '8 8 16';
+ self.aflag = 5;
+ }
+ self.weapon = 3;
+ self.netname = "rockets";
+ setsize (self, '0 0 0', '32 32 56');
+ StartItem ();
+};
+
+/*QUAKED item_cells (0 .5 .8) (0 0 0) (32 32 32) LARGE_BOX X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+ model ( {{ spawnflags & 1 -> { "path" : "maps/b_batt1.bsp" }, "maps/b_batt0.bsp" }} );
+}
+Box of 6 cells.
+LARGE_BOX is a box of 12 cells.
+*/
+void() item_cells =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.touch = ammo_touch;
+
+ if (self.spawnflags & WEAPON_BIG2)
+ {
+ if (!self.mdl_body && world.c_lg_mdl)
+ self.mdl_body = world.c_lg_mdl;
+
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/ammo/m_cells2.mdl");
+ body_model ("progs/ammo/m_cells2.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_batt1.bsp");
+ body_model ("maps/b_batt1.bsp");
+ }
+
+ if !(self.particles_offset)
+ self.particles_offset = '16 16 16';
+ self.aflag = 12;
+ }
+ else
+ {
+ if (!self.mdl_body && world.c_sm_mdl)
+ self.mdl_body = world.c_sm_mdl;
+
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/ammo/m_cells2.mdl");
+ body_model ("progs/ammo/m_cells2.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_batt0.bsp");
+ body_model ("maps/b_batt0.bsp");
+ }
+
+ if !(self.particles_offset)
+ self.particles_offset = '12 12 12';
+ self.aflag = 6;
+ }
+ self.weapon = 4;
+ self.netname = "cells";
+ setsize (self, '0 0 0', '32 32 56');
+ StartItem ();
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/items/armor.qc

diff --git a/qc/items/armor.qc b/qc/items/armor.qc
new file mode 100644
index 0000000..34aeeb4
--- /dev/null
+++ b/qc/items/armor.qc
@@ -0,0 +1,278 @@
+//==============================================================================
+// armor.qc
+//==============================================================================
+
+// prototypes
+void() armor_touch;
+void() shard_touch;
+
+//----------------------------------------------------------------------
+// shard_touch -- this is from RMQ shard_touch
+//----------------------------------------------------------------------
+void() shard_touch =
+{
+ // from Copper -- dumptruck_ds
+ if (!CheckValidTouch())
+ return;
+
+ local float bit;
+
+ if ((other.items & IT_ARMOR1) || (other.items & IT_ARMOR2) ||
+ (other.items & IT_ARMOR3))
+ {
+ // has armor
+ // Supa, check bounds, original armourvalue + 25
+ if (other.items & IT_ARMOR1 && other.armorvalue >= 125)
+ return;
+ if (other.items & IT_ARMOR2 && other.armorvalue >= 175)
+ return;
+ if (other.items & IT_ARMOR3 && other.armorvalue >= 225)
+ return;
+
+ // was 2, RMQ team
+ other.armorvalue = other.armorvalue + 5;
+
+ // Supa, now cap armourvalue to bounds
+ if (other.items & IT_ARMOR1 && other.armorvalue >= 125)
+ other.armorvalue = 125;
+ else if (other.items & IT_ARMOR2 && other.armorvalue >= 175)
+ other.armorvalue = 175;
+ else if (other.items & IT_ARMOR3 && other.armorvalue >= 225)
+ other.armorvalue = 225;
+ }
+ else
+ {
+ // shard = Green armor level
+ other.armortype = 0.3;
+ other.armorvalue = 5;
+ bit = IT_ARMOR1;
+ other.items = other.items - (other.items &
+ (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + bit;
+ }
+ self.solid = SOLID_NOT;
+ self.model = string_null;
+
+ // Supa, SP respawning items support
+ if (!deathmatch)
+ CheckItemRespawn (self, 30);
+ else if (deathmatch == 1)
+ // doesn't respawn in "deathmatch 2"
+ self.nextthink = time + 20;
+ self.think = SUB_Regen;
+
+ if (self.obit_name != "")
+ {
+ sprint (other, "You got ");
+ // custom armor name
+ sprint (other, self.obit_name);
+ sprint (other, "\n");
+ }
+ else
+ {
+ sprint(other, "You got armor\n");
+ }
+
+ // armor touch sound
+ // dumptruck_ds custom models and sounds START
+ if (self.snd_misc != "")
+ sound_misc (other, CHAN_AUTO, self.snd_misc, 1, ATTN_NORM);
+ else
+ sound_misc (other, CHAN_AUTO,"dump/armsh1.wav", 1, ATTN_NORM);
+
+ // dumptruck_ds custom models and sounds END
+ stuffcmd (other, "bf\n");
+
+ activator = other;
+
+ // fire all targets / killtargets
+ SUB_UseTargets ();
+};
+
+//----------------------------------------------------------------------
+// armor_touch
+//----------------------------------------------------------------------
+void() armor_touch =
+{
+ local float type, value, bit;
+
+ // from Copper -- dumptruck_ds
+ if (!CheckValidTouch())
+ return;
+
+ if (self.classname == "item_armor1")
+ {
+ type = 0.3;
+ value = 100;
+ bit = IT_ARMOR1;
+ }
+ else if (self.classname == "item_armor2" ||
+ self.classname == "item_armor_combat")
+ {
+ type = 0.6;
+ value = 150;
+ bit = IT_ARMOR2;
+ }
+ else if (self.classname == "item_armorInv" ||
+ self.classname == "item_armor_body")
+ {
+ type = 0.8;
+ value = 200;
+ bit = IT_ARMOR3;
+ }
+ else
+ {
+ dprint ("WARNING: armor_touch: unknown classname: ");
+ dprint (self.classname);
+ dprint ("\n");
+ return;
+ }
+
+ if (other.armortype * other.armorvalue >= type * value)
+ return;
+
+ other.armortype = type;
+ other.armorvalue = value;
+
+ other.items = other.items - (other.items &
+ (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + bit;
+
+ self.solid = SOLID_NOT;
+ self.model = string_null;
+
+ // Supa, SP respawning items support
+ if (!deathmatch)
+ CheckItemRespawn (self, 30);
+ else if (deathmatch == 1)
+ // doesn't respawn in "deathmatch 2"
+ self.nextthink = time + 20;
+ self.think = SUB_Regen;
+
+ if (self.obit_name != "")
+ {
+ sprint (other, "You got ");
+ // custom armor name
+ sprint (other, self.obit_name);
+ sprint (other, "\n");
+ }
+ else
+ {
+ sprint(other, "You got armor\n");
+ }
+
+ // armor touch sound
+ // dumptruck_ds custom models and sounds START
+ if (self.snd_misc != "")
+ sound_misc (other, CHAN_ITEM, self.snd_misc, 1, ATTN_NORM);
+ else
+ sound_misc (other, CHAN_ITEM,"items/armor1.wav", 1, ATTN_NORM);
+ // dumptruck_ds custom models and sounds END
+ stuffcmd (other, "bf\n");
+
+ activator = other;
+ // fire all targets / killtargets
+ SUB_UseTargets ();
+};
+
+//----------------------------------------------------------------------
+// item_armor_shard
+//----------------------------------------------------------------------
+void() item_armor_shard =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (!self.mdl_body && world.a_shr_mdl)
+ self.mdl_body = world.a_shr_mdl;
+
+ self.touch = shard_touch;
+ // dumptruck_ds custom models and sounds START
+ precache_body_model ("progs/armshr.mdl");
+ // setmodel (self, "progs/armor.mdl");
+ body_model ("progs/armshr.mdl");
+ precache_sound_misc ("dump/armsh1.wav");
+ // dumptruck_ds custom models and sounds END
+ if !(self.skin)
+ self.skin = 0;
+ setsize (self, '-16 -16 0', '16 16 56');
+ StartItem ();
+};
+
+/*QUAKED item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/armor.mdl");
+}
+*/
+void() item_armor1 =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (!self.mdl_body && world.a_grn_mdl)
+ self.mdl_body = world.a_grn_mdl;
+
+ self.touch = armor_touch;
+ // dumptruck_ds custom models and sounds START
+ precache_body_model ("progs/armor.mdl");
+ // setmodel (self, "progs/armor.mdl");
+ body_model ("progs/armor.mdl");
+ precache_sound_misc ("items/armor1.wav");
+ // dumptruck_ds custom models and sounds END
+ if !(self.skin)
+ self.skin = 0;
+ setsize (self, '-16 -16 0', '16 16 56');
+ StartItem ();
+};
+
+/*QUAKED item_armor2 (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model({ "path": ":progs/armor.mdl", "skin": 1 }); }
+*/
+void() item_armor2 =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (!self.mdl_body && world.a_ylw_mdl)
+ self.mdl_body = world.a_ylw_mdl;
+
+ self.touch = armor_touch;
+ // dumptruck_ds custom models and sounds START
+ precache_body_model ("progs/armor.mdl");
+ // setmodel (self, "progs/armor.mdl");
+ body_model ("progs/armor.mdl");
+ // dumptruck_ds custom models and sounds END
+ if !(self.skin)
+ self.skin = 1;
+ precache_sound_misc ("items/armor1.wav");
+ setsize (self, '-16 -16 0', '16 16 56');
+ StartItem ();
+};
+
+/*QUAKED item_armorInv (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model({ "path": ":progs/armor.mdl", "skin": 2 });
+}
+*/
+void() item_armorInv =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (!self.mdl_body && world.a_red_mdl)
+ self.mdl_body = world.a_red_mdl;
+
+ self.touch = armor_touch;
+ // dumptruck_ds custom models and sounds START
+ precache_body_model ("progs/armor.mdl");
+ // setmodel (self, "progs/armor.mdl");
+ body_model ("progs/armor.mdl");
+ // dumptruck_ds custom models and sounds END
+ if !(self.skin)
+ self.skin = 2;
+ precache_sound_misc ("items/armor1.wav");
+ setsize (self, '-16 -16 0', '16 16 56');
+ StartItem ();
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/items/backpacks.qc

diff --git a/qc/items/backpacks.qc b/qc/items/backpacks.qc
new file mode 100644
index 0000000..5898e18
--- /dev/null
+++ b/qc/items/backpacks.qc
@@ -0,0 +1,501 @@
+//==============================================================================
+// backpacks -- Player Backpacks
+//==============================================================================
+
+// constants -- dumptruck_ds
+const float BACKPACK_DEFAULT = 1;
+const float BACKPACK_SHELLS = 2;
+const float BACKPACK_NAILS = 4;
+const float BACKPACK_ROCKETS = 8;
+const float BACKPACK_CELLS = 16;
+
+//----------------------------------------------------------------------
+void() BackpackTouch =
+{
+ local string s;
+ local float acount, best, old, new;
+ local entity stemp;
+
+ // from Copper -- dumptruck_ds
+ if (other.movetype == MOVETYPE_NOCLIP)
+ return;
+ if (other.classname != "player")
+ return;
+ if (other.health <= 0)
+ return;
+
+ acount = 0;
+ sprint (other, "You get ");
+
+ if (self.items)
+ {
+ if ((other.items & self.items) == 0)
+ {
+ acount = 1;
+ sprint (other, "the ");
+ sprint (other, self.netname);
+ }
+ }
+
+ // if the player was using his best weapon, change up to
+ // the new one if better
+ stemp = self;
+ self = other;
+ best = W_BestWeapon ();
+ self = stemp;
+
+ // change weapons
+ other.ammo_shells = other.ammo_shells + self.ammo_shells;
+ other.ammo_nails = other.ammo_nails + self.ammo_nails;
+ other.ammo_rockets = other.ammo_rockets + self.ammo_rockets;
+ other.ammo_cells = other.ammo_cells + self.ammo_cells;
+
+ new = self.items;
+ if (!new)
+ new = other.weapon;
+ old = other.items;
+ other.items = other.items | new;
+
+ bound_other_ammo ();
+
+ // hack to fix an issue with custom Grunt, Ogre and Enf ammo types.
+ // - dumptruck_ds
+ // if (self.ammo_shells < 100)
+ if (self.ammo_shells)
+ {
+ if (acount)
+ sprint (other, ", ");
+ acount = 1;
+ s = ftos (self.ammo_shells);
+ sprint (other, s);
+ sprint (other, " shells");
+ }
+ if (self.ammo_nails)
+ {
+ if (acount)
+ sprint (other, ", ");
+ acount = 1;
+ s = ftos (self.ammo_nails);
+ sprint (other, s);
+ sprint (other, " nails");
+ }
+ if (self.ammo_rockets)
+ {
+ if (acount)
+ sprint (other, ", ");
+ acount = 1;
+ s = ftos (self.ammo_rockets);
+ sprint (other, s);
+ sprint (other, " rockets");
+ }
+ if (self.ammo_cells)
+ {
+ if (acount)
+ sprint (other, ", ");
+ acount = 1;
+ s = ftos (self.ammo_cells);
+ sprint (other, s);
+ sprint (other, " cells");
+ }
+
+ sprint (other, "\n");
+ // backpack touch sound
+ sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+
+ // remove the backpack, change self to the player
+ remove (self);
+ self = other;
+
+ // change to the weapon
+ // 1997-12-23 Thunderbolt fix by Maddes start
+ /* don't separate between SinglePlayer/Coop and Deathmatch
+ if (!deathmatch)
+ self.weapon = new;
+ else
+ */
+ // 1997-12-23 Thunderbolt fix by Maddes end
+
+ Deathmatch_Weapon (old, new);
+ W_SetCurrentAmmo ();
+};
+
+//======================================================================
+// DropStuff -- dumptruck_ds
+// set drops_item on a monster to a number:
+//
+// 1 = Silver Key
+// 2 = Gold Key
+// 3 = Health Vial
+// 4 = Armor Shard
+// 5 = Health Vial & Armor Shard
+// 6 = random combination of 3 Vials and/or Shards
+//======================================================================
+
+//----------------------------------------------------------------------
+void() DropKey1 =
+{
+ local entity item;
+
+ item = spawn ();
+ item.origin = self.origin - '0 0 24';
+
+ item.velocity_z = 300;
+ item.velocity_x = -100 + (random() * 200);
+ item.velocity_y = -100 + (random() * 200);
+
+ if (world.worldtype == WORLDTYPE_MEDIEVAL)
+ {
+ // precache_model ("progs/w_s_key.mdl");
+ setmodel (item, "progs/w_s_key.mdl");
+ item.noise = "misc/medkey.wav";
+ }
+ else if (world.worldtype == WORLDTYPE_METAL)
+ {
+ // precache_model ("progs/m_s_key.mdl");
+ setmodel (item, "progs/m_s_key.mdl");
+ item.noise = "misc/runekey.wav";
+ }
+ else if (world.worldtype == WORLDTYPE_BASE)
+ {
+ // precache_model2 ("progs/b_s_key.mdl");
+ setmodel (item, "progs/b_s_key.mdl");
+ item.noise = "misc/basekey.wav";
+ }
+
+ item.netname = SilverKeyName ();
+ item.effects = 8;
+ item.flags = FL_ITEM;
+ item.items = IT_KEY1;
+ item.solid = SOLID_TRIGGER;
+ item.movetype = MOVETYPE_TOSS;
+ setsize (item, '-16 -16 0', '16 16 56');
+ item.touch = key_touch;
+};
+
+//----------------------------------------------------------------------
+void() DropKey2 =
+{
+ local entity item;
+
+ item = spawn ();
+ item.origin = self.origin - '0 0 24';
+
+ item.velocity_z = 300;
+ item.velocity_x = -100 + (random() * 200);
+ item.velocity_y = -100 + (random() * 200);
+
+ if (world.worldtype == WORLDTYPE_MEDIEVAL)
+ {
+ // precache_model ("progs/w_s_key.mdl");
+ setmodel (item, "progs/w_g_key.mdl");
+ item.noise = "misc/medkey.wav";
+ }
+ else if (world.worldtype == WORLDTYPE_METAL)
+ {
+ // precache_model ("progs/m_s_key.mdl");
+ setmodel (item, "progs/m_g_key.mdl");
+ item.noise = "misc/runekey.wav";
+ }
+ else if (world.worldtype == WORLDTYPE_BASE)
+ {
+ // precache_model2 ("progs/b_s_key.mdl");
+ setmodel (item, "progs/b_g_key.mdl");
+ item.noise = "misc/basekey.wav";
+ }
+ item.netname = GoldKeyName ();
+ item.effects = 8;
+ item.flags = FL_ITEM;
+ item.items = IT_KEY2;
+ item.solid = SOLID_TRIGGER;
+ item.movetype = MOVETYPE_TOSS;
+ setsize (item, '-16 -16 0', '16 16 56');
+ item.touch = key_touch;
+};
+
+//----------------------------------------------------------------------
+void() DropVial =
+{
+ local entity item;
+
+ item = spawn ();
+ item.origin = self.origin - '0 0 24';
+
+ item.velocity_z = 300;
+ item.velocity_x = -100 + (random() * 200);
+ item.velocity_y = -100 + (random() * 200);
+
+ setmodel (item, "progs/health/pd_vial.mdl");
+ item.solid = SOLID_TRIGGER;
+ item.movetype = MOVETYPE_TOSS;
+ setsize (item, '-16 -16 0', '16 16 56');
+ item.touch = health_touch;
+ item.healamount = 5;
+ item.healtype = 0;
+ item.noise = "items/r_item1.wav";
+
+ StartItem ();
+};
+
+//----------------------------------------------------------------------
+void() DropShard =
+{
+ local entity item;
+
+ item = spawn ();
+ item.origin = self.origin - '0 0 24';
+
+ item.velocity_z = 300;
+ item.velocity_x = -100 + (random() * 200);
+ item.velocity_y = -100 + (random() * 200);
+
+ setmodel (item, "progs/armshr.mdl");
+ item.solid = SOLID_TRIGGER;
+ item.movetype = MOVETYPE_TOSS;
+ setsize (item, '-16 -16 0', '16 16 56');
+ item.touch = shard_touch;
+ item.snd_misc = "dump/armsh1.wav";
+
+ StartItem ();
+};
+
+//----------------------------------------------------------------------
+void() DropStuff =
+{
+ local float rand_drop;
+
+ if (self.drop_item == 1)
+ {
+ DropKey1 ();
+ }
+ else if (self.drop_item == 2)
+ {
+ DropKey2 ();
+ }
+ else if (self.drop_item == 3)
+ {
+ DropVial ();
+ }
+ else if (self.drop_item == 4)
+ {
+ DropShard ();
+ }
+ else if (self.drop_item == 5)
+ {
+ DropVial ();
+ DropShard ();
+ }
+ else if (self.drop_item == 6)
+ {
+ rand_drop = rint(random() * 3);
+ if (rand_drop == 1)
+ {
+ DropShard ();
+ DropVial ();
+ DropVial ();
+ }
+ else if (rand_drop == 2)
+ {
+ DropShard ();
+ DropShard ();
+ DropVial ();
+ }
+ else if (rand_drop == 0)
+ {
+ DropShard ();
+ DropShard ();
+ DropShard ();
+ }
+ else
+ {
+ DropVial ();
+ DropVial ();
+ DropVial ();
+ }
+ }
+};
+
+//----------------------------------------------------------------------
+// DropBackpack
+//----------------------------------------------------------------------
+void() DropBackpack =
+{
+ local entity item;
+
+ if (!(self.ammo_shells + self.ammo_nails +
+ self.ammo_rockets + self.ammo_cells))
+ {
+ // nothing in it
+ return;
+ }
+
+ item = spawn ();
+ item.origin = self.origin - '0 0 24';
+
+ item.items = self.weapon;
+ if (item.items == IT_AXE)
+ item.netname = "Axe";
+ else if (item.items == IT_SHOTGUN)
+ item.netname = "Shotgun";
+ else if (item.items == IT_SUPER_SHOTGUN)
+ item.netname = "Double-barrelled Shotgun";
+ else if (item.items == IT_NAILGUN)
+ item.netname = "Nailgun";
+ else if (item.items == IT_SUPER_NAILGUN)
+ item.netname = "Super Nailgun";
+ else if (item.items == IT_GRENADE_LAUNCHER)
+ item.netname = "Grenade Launcher";
+ else if (item.items == IT_ROCKET_LAUNCHER)
+ item.netname = "Rocket Launcher";
+ else if (item.items == IT_LIGHTNING)
+ item.netname = "Thunderbolt";
+ else
+ item.netname = "";
+
+ item.ammo_shells = self.ammo_shells;
+ item.ammo_nails = self.ammo_nails;
+ item.ammo_rockets = self.ammo_rockets;
+ item.ammo_cells = self.ammo_cells;
+
+ item.velocity_z = 300;
+ item.velocity_x = -100 + (random() * 200);
+ item.velocity_y = -100 + (random() * 200);
+
+ item.flags = FL_ITEM;
+ item.solid = SOLID_TRIGGER;
+ item.movetype = MOVETYPE_TOSS;
+ setmodel (item, "progs/backpack.mdl");
+ setsize (item, '-16 -16 0', '16 16 56');
+ item.touch = BackpackTouch;
+
+ // remove after 2 minutes
+ item.nextthink = time + 120;
+ item.think = SUB_Remove;
+};
+
+//----------------------------------------------------------------------
+void() item_backpack_message =
+{
+
+ // from Copper -- dumptruck_ds
+ if (!CheckValidTouch())
+ return;
+
+ other.ammo_shells = other.ammo_shells + self.ammo_shells;
+ other.ammo_nails = other.ammo_nails + self.ammo_nails;
+ other.ammo_rockets = other.ammo_rockets + self.ammo_rockets;
+ other.ammo_cells = other.ammo_cells + self.ammo_cells;
+
+ if (self.netname != "")
+ {
+ sprint (other, "You got ");
+ sprint (other, self.netname);
+ sprint (other, "\n");
+ }
+ else
+ {
+ sprint (other, "You got a backpack!\n");
+ }
+
+ // backpack touch sound
+ // sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
+ sound_misc (other, CHAN_ITEM, self.snd_misc, 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ remove (self);
+ self = other;
+ bound_other_ammo ();
+ W_SetCurrentAmmo ();
+};
+
+// Some of this text is from Drake -- dumptruck_ds
+/*QUAKED item_backpack (0 .5 .8) (-16 -16 0) (16 16 72) SHELLS NAILS ROCKETS CELLS X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model("progs/backpack.mdl"); }
+By default, gives roughly half the ammo from the 4 standard pickups:
+
+10 Shells
+12 Nails
+2 Rockets
+3 Cells
+
+Or you can use the spawnflags to mix and match types.
+Override the spawnflags defaults by adding custom amounts to:
+
+ammo_shells
+ammo_nails
+ammo_rockets
+ammo_cells
+
+Can trigger spawn and suspend in air, but not respawn. You can set a skin
+index if you are using a custom model with skins.
+
+The default pickup message is `You got a backpack.` But you can
+set a custom message with the netname key. 'You got' will be the prefix
+and the mapper chooses the rest of the message.
+
+e.g. For 'You got a bunch of rockets!' the netname key would be
+'a bunch of rockets!'
+*/
+void() item_backpack =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (deathmatch)
+ {
+ remove (self);
+ return;
+ }
+
+ self.flags = FL_ITEM;
+ self.solid = SOLID_TRIGGER;
+ self.movetype = MOVETYPE_TOSS;
+ self.classname = "item_backpack";
+ // self.netname = self.netname;
+ if !(self.spawnflags)
+ {
+ objerror ("\bNO SPAWNFLAG SET ON item_backpack");
+ return;
+ }
+
+ if (self.spawnflags & BACKPACK_DEFAULT)
+ {
+ self.ammo_shells = 10;
+ self.ammo_nails = 12;
+ self.ammo_rockets = 2;
+ self.ammo_cells = 3;
+ }
+
+ if (self.spawnflags & BACKPACK_SHELLS)
+ {
+ if !(self.ammo_shells)
+ self.ammo_shells = 10;
+ }
+ if (self.spawnflags & BACKPACK_NAILS)
+ {
+ if !(self.ammo_nails)
+ self.ammo_nails = 12;
+ }
+ if (self.spawnflags & BACKPACK_ROCKETS)
+ {
+ if !(self.ammo_rockets)
+ self.ammo_rockets = 2;
+ }
+ if (self.spawnflags & BACKPACK_CELLS)
+ {
+ if !(self.ammo_cells)
+ self.ammo_cells = 3;
+ }
+
+ self.touch = item_backpack_message;
+
+ // set the custom noise in editor -- dumptruck_ds
+ if !(self.snd_misc)
+ self.snd_misc = "weapons/lock4.wav";
+ precache_sound_misc (self.snd_misc);
+ precache_body_model ("progs/pd_bpack.mdl");
+ body_model ("progs/pd_bpack.mdl");
+ // setmodel (self, "progs/backpack.mdl");
+ setsize (self, '-16 -16 0', '16 16 56');
+ StartItem ();
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/items/health.qc

diff --git a/qc/items/health.qc b/qc/items/health.qc
new file mode 100644
index 0000000..598a4c4
--- /dev/null
+++ b/qc/items/health.qc
@@ -0,0 +1,271 @@
+//==============================================================================
+// HEALTH BOXES
+//==============================================================================
+
+// constants
+const float H_ROTTEN = 1;
+const float H_MEGA = 2;
+const float H_VIAL = 4;
+
+// fields
+.float healamount, healtype;
+
+// primitives
+void() health_touch;
+// void() item_megahealth_rot;
+
+//======================================================================
+// T_Heal: add health to an entity, limiting health to max_health
+// "ignore" will ignore max_health limit
+//----------------------------------------------------------------------
+float (entity e, float healamount, float ignore) T_Heal =
+{
+ if (e.health <= 0)
+ return 0;
+ if ((!ignore) && (e.health >= other.max_health))
+ return 0;
+ healamount = ceil(healamount);
+
+ e.health = e.health + healamount;
+ if ((!ignore) && (e.health >= other.max_health))
+ e.health = other.max_health;
+
+ if (e.health > 250)
+ e.health = 250;
+ return 1;
+};
+
+/*QUAKED item_health (.3 .3 1) (0 0 0) (32 32 32) ROTTEN MEGAHEALTH X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+ model ( {{ spawnflags & 1 -> { "path" : "maps/b_bh10.bsp" }, spawnflags & 2 -> { "path" : "maps/b_bh100.bsp" },
+ "maps/b_bh25.bsp" }} );
+}
+Health box. Normally gives 25 points.
+Rotten box heals 15 points.
+Megahealth will add 100 health, then start to
+rot the player back down to 100 health after 5 seconds.
+*/
+//======================================================================
+// item_health
+//----------------------------------------------------------------------
+void() item_health =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.touch = health_touch;
+
+ if (self.spawnflags & H_ROTTEN)
+ {
+ if (!self.mdl_body && world.h_15_mdl)
+ self.mdl_body = world.h_15_mdl;
+
+ // dumptruck_ds custom health models and sounds START
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/health/m_h15.mdl");
+ body_model ("progs/health/m_h15.mdl");
+ }
+ else
+ {
+ // setmodel(self, "maps/b_bh10.bsp");
+ precache_body_model ("maps/b_bh10.bsp");
+ body_model ("maps/b_bh10.bsp");
+ }
+
+ // precache_sound("items/r_item1.wav");
+ precache_sound_misc("items/r_item1.wav");
+ // self.noise = "items/r_item1.wav";
+ if !(self.snd_misc)
+ //set the custom noise in editor -- dumptruck_ds
+ self.snd_misc = "items/r_item1.wav";
+ self.noise = self.snd_misc;
+
+ // if !(self.healamount)
+ // set your custom health amount here -- dumptruck_ds
+ self.healamount = 15;
+ self.healtype = 0;
+ if !(self.particles_offset)
+ self.particles_offset = '16 16 8';
+ // dumptruck_ds custom health models and sounds END
+ }
+ else
+ {
+ if (self.spawnflags & H_MEGA)
+ {
+ if (!self.mdl_body && world.h_mega_mdl)
+ self.mdl_body = world.h_mega_mdl;
+ // precache_model("maps/b_bh100.bsp");
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/health/m_h100.mdl");
+ body_model ("progs/health/m_h100.mdl");
+ }
+ else
+ {
+ // setmodel(self, "maps/b_bh100.bsp");
+ precache_body_model ("maps/b_bh100.bsp");
+ body_model ("maps/b_bh100.bsp");
+ }
+
+ precache_sound_misc("items/r_item2.wav");
+ // self.noise = "items/r_item2.wav";
+ if !(self.snd_misc)
+ //set the custom noise in editor -- dumptruck_ds
+ self.snd_misc = "items/r_item2.wav";
+ self.noise = self.snd_misc;
+
+ // if !(self.healamount)
+ // custom health amount -- dumptruck_ds
+ self.healamount = 100;
+ self.healtype = 2;
+ if !(self.particles_offset)
+ self.particles_offset = '16 16 16';
+ }
+ else
+ {
+ if (!self.mdl_body && world.h_25_mdl)
+ self.mdl_body = world.h_25_mdl;
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/health/m_h25.mdl");
+ body_model ("progs/health/m_h25.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_bh25.bsp");
+ body_model ("maps/b_bh25.bsp");
+ }
+ precache_sound_misc("items/health1.wav");
+ if !(self.snd_misc)
+ // set custom noise in editor -- dumptruck_ds
+ self.snd_misc = "items/health1.wav";
+ self.noise = self.snd_misc;
+
+ self.healamount = 25;
+ self.healtype = 1;
+ if !(self.particles_offset)
+ self.particles_offset = '16 16 8';
+ // dumptruck_ds custom health models and sounds END
+ }
+ }
+ setsize (self, '0 0 0', '32 32 56');
+ StartItem ();
+};
+
+//======================================================================
+// item_health_vial
+//----------------------------------------------------------------------
+void() item_health_vial =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.touch = health_touch;
+
+ if (!self.mdl_body && world.h_vial_mdl)
+ self.mdl_body = world.h_vial_mdl;
+
+ // model from Hexen 2 -- dumptruck_ds
+ precache_body_model ("progs/health/pd_vial.mdl");
+ body_model ("progs/health/pd_vial.mdl");
+ precache_sound_misc ("items/r_item1.wav");
+ if !(self.snd_misc)
+ // set the custom noise in editor -- dumptruck_ds
+ self.snd_misc = "items/r_item1.wav";
+ self.noise = self.snd_misc;
+
+ self.healamount = 5;
+ // over heal and count down like mega health -- dumptruck_ds
+ self.healtype = 2;
+ setsize (self, '-16 -16 0', '16 16 56');
+ if !(self.particles_offset)
+ self.particles_offset = '0 0 0';
+ StartItem ();
+};
+
+//======================================================================
+// health_touch
+//----------------------------------------------------------------------
+void() health_touch =
+{
+ local float amount;
+ local string s;
+ amount = self.healamount;
+ // from Copper -- dumptruck_ds
+ if (!CheckValidTouch())
+ return;
+
+ if (self.healtype == 2)
+ {
+ // Megahealth? Ignore max_health...
+ if (other.health >= 250) return;
+ if (!T_Heal(other, amount, 1)) return;
+ }
+ else
+ {
+ if (!T_Heal(other, amount, 0)) return;
+ }
+
+ sprint(other, "You receive ");
+ s = ftos (amount);
+ sprint(other, s);
+ sprint(other, " health\n");
+
+ // health touch sound
+ // sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
+ // custom sounds -- dumptruck_ds
+ sound_misc (other, CHAN_AUTO, self.noise, 1, ATTN_NORM);
+
+ stuffcmd (other, "bf\n");
+
+ self.model = string_null;
+ self.solid = SOLID_NOT;
+
+ self.think = SUB_Regen;
+
+ // Megahealth = rot down the player's super health
+ if (self.healtype == 2)
+ {
+ // thanks ydrol!!!
+ other.megahealth_rottime = time + 5;
+ other.items = other.items | IT_SUPERHEALTH;
+ self.owner = other;
+
+ // Regarding the deathmatch respawn time below: id's original
+ // code made the megahealth respawn 20 seconds after the health
+ // of the player who collected it finished rotting down.
+ // However, this mod has already got rid of the weird old
+ // megahealth behavior whereby it monitored the player who
+ // touched it, so the original respawn logic isn't applicable.
+ // As a solution, the code below uses a respawn time of 125
+ // seconds for deathmatch, because that was the worst-case
+ // scenario of id's original code (5 seconds before the player's
+ // health started to rot, plus 100 seconds to rot down 100
+ // health points, plus the original 20 second delay before the
+ // item respawned). -- iw
+ //
+ if (!deathmatch)
+ CheckItemRespawn (self, 30);
+ else if (deathmatch == 1)
+ // doesn't respawn in "deathmatch 2"
+ self.nextthink = time + 125;
+ }
+ else
+ {
+ if (!deathmatch)
+ CheckItemRespawn (self, 30);
+ else if (deathmatch == 1)
+ // doesn't respawn in "deathmatch 2"
+ self.nextthink = time + 20;
+ }
+
+ activator = other;
+ // fire all targets / killtargets
+ SUB_UseTargets ();
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/items/keys.qc

diff --git a/qc/items/keys.qc b/qc/items/keys.qc
new file mode 100644
index 0000000..c437966
--- /dev/null
+++ b/qc/items/keys.qc
@@ -0,0 +1,234 @@
+//==============================================================================
+// KEYS
+//==============================================================================
+
+//----------------------------------------------------------------------
+void() key_touch =
+{
+ // from Copper -- dumptruck_ds
+ if (!CheckValidTouch())
+ return;
+
+ // support for item_key_custom -- iw
+ if (HasKeys(other, self.items, self.customkeys))
+ return;
+
+ sprint (other, "You got the ");
+ sprint (other, self.netname);
+ sprint (other,"\n");
+
+ sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+
+ // support for item_key_custom -- iw
+ GiveKeys (other, self.items, self.customkeys);
+
+ if (!coop)
+ {
+ self.solid = SOLID_NOT;
+ self.model = string_null;
+ }
+
+ activator = other;
+ // fix key items firing their targets multiple times in coop -- iw
+ // SUB_UseTargets ();
+ // fire all targets / killtargets
+ SUB_UseAndForgetTargets ();
+};
+
+//----------------------------------------------------------------------
+void() key_setsounds =
+{
+ // support for item_key_custom -- iw
+ if (self.noise != "")
+ {
+ precache_sound (self.noise);
+ return;
+ }
+
+ if (world.worldtype == WORLDTYPE_MEDIEVAL)
+ {
+ precache_sound ("misc/medkey.wav");
+ self.noise = "misc/medkey.wav";
+ }
+ else if (world.worldtype == WORLDTYPE_METAL)
+ {
+ precache_sound ("misc/runekey.wav");
+ self.noise = "misc/runekey.wav";
+ }
+ else if (world.worldtype == WORLDTYPE_BASE)
+ {
+ precache_sound2 ("misc/basekey.wav");
+ self.noise = "misc/basekey.wav";
+ }
+};
+
+//----------------------------------------------------------------------
+// key_start -- Finish initializing self as a key item. -- iw
+//----------------------------------------------------------------------
+void() key_start =
+{
+ key_setsounds ();
+ self.particles_offset = '0 0 18';
+ self.touch = key_touch;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ StartItem ();
+};
+
+/*QUAKED item_key1 (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model("progs/w_s_key.mdl"); }
+SILVER key
+In order for keys to work you MUST set your map's worldtype to one of the following:
+0: medieval
+1: metal
+2: base
+*/
+void() item_key1 =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (world.worldtype == WORLDTYPE_MEDIEVAL)
+ {
+ precache_body_model ("progs/w_s_key.mdl");
+ body_model ("progs/w_s_key.mdl");
+ }
+ else if (world.worldtype == WORLDTYPE_METAL)
+ {
+ precache_body_model ("progs/m_s_key.mdl");
+ body_model ("progs/m_s_key.mdl");
+ }
+ else if (world.worldtype == WORLDTYPE_BASE)
+ {
+ precache_body_model2 ("progs/b_s_key.mdl");
+ body_model ("progs/b_s_key.mdl");
+ }
+
+ if (self.keyname != "")
+ self.netname = self.keyname;
+ else
+ self.netname = SilverKeyName ();
+
+ self.items = IT_KEY1;
+
+ // support for item_key_custom -- iw
+ self.customkeys = 0; // ignore any mapper-set value
+ self.noise = ""; // ignore any mapper-set value
+
+ key_start ();
+};
+
+/*QUAKED item_key2 (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+ model ("progs/w_g_key.mdl");
+}
+GOLD key
+In order for keys to work you MUST set your map's worldtype to one of the following:
+0: medieval
+1: metal
+2: base
+*/
+void() item_key2 =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (world.worldtype == WORLDTYPE_MEDIEVAL)
+ {
+ precache_body_model ("progs/w_g_key.mdl");
+ body_model ("progs/w_g_key.mdl");
+ }
+ else if (world.worldtype == WORLDTYPE_METAL)
+ {
+ precache_body_model ("progs/m_g_key.mdl");
+ body_model ("progs/m_g_key.mdl");
+ }
+ else if (world.worldtype == WORLDTYPE_BASE)
+ {
+ precache_body_model2 ("progs/b_g_key.mdl");
+ body_model ("progs/b_g_key.mdl");
+ }
+
+ if (self.keyname != "")
+ self.keyname = "";
+ else
+ self.netname = GoldKeyName ();
+
+ self.items = IT_KEY2;
+
+ // support for item_key_custom -- iw
+ self.customkeys = 0; // ignore any mapper-set value
+ self.noise = ""; // ignore any mapper-set value
+
+ key_start ();
+};
+
+//======================================================================
+// item_key_custom is a brand-spanking-new entity class created for
+// progs_dump -- iw
+//======================================================================
+
+/*QUAKED item_key_custom (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+ model ({"path" : "progs/pd_w_key.mdl", "skin" : 1});
+}
+A customizable key item.
+
+"keyname" name of the key, e.g. "bronze key" (required)
+"mdl" model file (required)
+"noise" sound file for the pickup sound (default is per worldtype)
+"skin" skin index (default 0)
+
+The "keyname" value is used both for the pickup message and to associate
+the key with the entity that it unlocks.
+
+To make a func_door or trigger_usekey require this key, set the
+"keyname" value of that entity so that it matches the "keyname" value of
+the key.
+
+If different item_key_custom entities have the same "keyname" value,
+they will be treated as different copies of the same key and may be used
+interchangeably.
+
+A map may have a maximum of 23 unique "keyname" values across all
+entities.
+
+The behavior of an item_key_custom should be as the player expects
+(based on the behavior of the silver and gold keys), except for the fact
+that it will not appear as an icon in the player's status bar when
+picked up. This is a limitation of the engine.
+*/
+void() item_key_custom =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (self.keyname == "")
+ {
+ objerror ("no keyname specified");
+ return;
+ }
+
+ if (self.mdl == "")
+ {
+ objerror ("no mdl specified");
+ return;
+ }
+
+ precache_model (self.mdl);
+ setmodel (self, self.mdl);
+ // this should not be referenced again
+ self.mdl = "";
+
+ self.netname = self.keyname;
+ // this should not be referenced again
+ self.keyname = "";
+
+ self.items = 0; // ignore any mapper-set value
+ self.customkeys = CustomKeyFlag (self.netname);
+
+ key_start ();
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/items/misc.qc

diff --git a/qc/items/misc.qc b/qc/items/misc.qc
new file mode 100644
index 0000000..051d938
--- /dev/null
+++ b/qc/items/misc.qc
@@ -0,0 +1,155 @@
+//==============================================================================
+// items.qc
+//==============================================================================
+
+/* LIGHTS SHOULD BE 0 1 0 IN COLOR OTHER ITEMS SHOULD BE .8 .3 .4 IN COLOR */
+
+// fields
+.vector particles_offset;
+
+// constants
+const float ITEM_SPAWNSILENT = 32;
+const float ITEM_SPAWNED = 64;
+const float ITEM_SUSPENDED = 128;
+const float ITEM_RESPAWNDM = 16384;
+const float ITEM_DONTDROP = 8388608;
+
+// prototypes
+void (vector org) spawn_tfog;
+
+/*QUAKED noclass (0 0 0) (-8 -8 -8) (8 8 8)
+prints a warning message when spawned
+*/
+void() noclass =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ dprint ("noclass spawned at");
+ dprint (vtos(self.origin));
+ dprint ("\n");
+ remove (self);
+};
+
+//----------------------------------------------------------------------
+// DelaySpawnItem -- this is from rmq-items.qc; Makes a SPAWNED item
+// ready for pickup on a trigger event - modified a bit -- dumptruck_ds
+//----------------------------------------------------------------------
+void() DelaySpawnItem =
+{
+ self.solid = SOLID_TRIGGER;
+ setmodel (self, self.mdl);
+ setsize (self, self.pos1, self.pos2);
+
+ if (!(self.spawnflags & ITEM_SPAWNSILENT))
+ // SILENT, gb
+ // sound (self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM);
+ spawn_tfog (self.origin + self.particles_offset);
+
+ if (self.spawnflags & ITEM_SUSPENDED)
+ self.movetype = MOVETYPE_FLY;
+ else
+ self.movetype = MOVETYPE_TOSS;
+
+ self.use = SUB_Null;
+};
+
+//----------------------------------------------------------------------
+// RefreshHull -- Supa, restore old hull and lock movement
+//----------------------------------------------------------------------
+void() RefreshHull =
+{
+ // dumptruck_ds -- fix for bounding boxes
+ // setsize (self, self.dest, self.dest2);
+ setsize (self, '0 0 0', '32 32 56');
+
+ self.movetype = MOVETYPE_NONE;
+ self.velocity = '0 0 0';
+};
+
+//----------------------------------------------------------------------
+// PlaceItem -- plants the object on the floor
+//----------------------------------------------------------------------
+void() PlaceItem =
+{
+ // so it can be restored on respawn
+ self.mdl = self.model;
+
+ // make extra wide
+ self.flags = FL_ITEM;
+
+ self.solid = SOLID_TRIGGER;
+ self.velocity = '0 0 0';
+
+ if (self.spawnflags & ITEM_SUSPENDED)
+ {
+ //ijed Don't drop spawnflag
+ self.movetype = MOVETYPE_FLY;
+ }
+ else
+ {
+ // The following hack for item_health was inherited from the RMQ
+ // code, and was here when the func_mapjamx maps were created.
+ // It would have been nice to remove this code entirely, because
+ // progs_dump doesn't need it, and it breaks item_health's
+ // collision with entities that have MOVETYPE_PUSH. However,
+ // removing this code would cause some of the item_health
+ // entities in some of the func_mapjamx maps to "fall out of the
+ // level", because they're accidentally touching solid surfaces.
+ // So, to maintain backwards-compatibility, this code has been
+ // left in, but will only be run if one of the func_mapjamx maps
+ // is being played. -- iw
+ if (known_release == KNOWN_RELEASE_FUNC_MAPJAMX)
+ {
+ if (self.classname == "item_health")
+ {
+ // Supa, CTF
+ // hacking around hull issues..
+ // void hull for now
+ setsize (self, '0 0 0', '0 0 0');
+ self.think = RefreshHull;
+ self.nextthink = time + 0.2;
+ }
+ }
+
+ self.movetype = MOVETYPE_TOSS;
+
+ if (!(self.spawnflags & ITEM_DONTDROP))
+ {
+ setorigin (self, self.origin + '0 0 6');
+
+ if (!droptofloor())
+ {
+ print_self ("bonus item", "fell out of level");
+ remove (self);
+ return;
+ }
+ }
+ }
+
+ if ((self.spawnflags & ITEM_SPAWNED))
+ {
+ // SPAWNED, gb
+ self.pos1 = self.mins;
+ self.pos2 = self.maxs;
+
+ self.model = "";
+ self.solid = SOLID_NOT;
+
+ if (self.spawnflags & ITEM_DONTDROP)
+ self.movetype = MOVETYPE_NONE;
+
+ self.use = DelaySpawnItem;
+ }
+};
+
+//----------------------------------------------------------------------
+// StartItem -- Sets the clipping size and plants the object on the floor
+//----------------------------------------------------------------------
+void() StartItem =
+{
+ // items start after other solids || was 0.2 -- dumptruck_ds
+ self.nextthink = time + 0.3;
+ self.think = PlaceItem;
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/items/powerups.qc

diff --git a/qc/items/powerups.qc b/qc/items/powerups.qc
new file mode 100644
index 0000000..4a81ec2
--- /dev/null
+++ b/qc/items/powerups.qc
@@ -0,0 +1,224 @@
+//==============================================================================
+// items/powerups.qc -- POWERUPS
+//==============================================================================
+
+//----------------------------------------------------------------------
+void() powerup_touch =
+{
+ // from Copper -- dumptruck_ds
+ if (!CheckValidTouch())
+ return;
+
+ sprint (other, "You got the ");
+ sprint (other, self.netname);
+ sprint (other,"\n");
+
+ // if (deathmatch)
+ // {
+ // self.mdl = self.model;
+ //
+ // if ((self.classname == "item_artifact_invulnerability") ||
+ // (self.classname == "item_artifact_invisibility"))
+ // self.nextthink = time + 60*5;
+ // else
+ // self.nextthink = time + 60;
+ //
+ // self.think = SUB_Regen;
+ // }
+
+ // Supa, SP respawning items support
+ self.mdl = self.model;
+ self.think = SUB_Regen;
+
+ if (!deathmatch)
+ {
+ local float spawndelay;
+
+ if (self.classname == "item_artifact_invulnerability" ||
+ self.classname == "item_artifact_invisibility")
+ {
+ spawndelay = 300;
+ }
+ else
+ {
+ spawndelay = 60;
+ }
+
+ CheckItemRespawn (self, spawndelay);
+ }
+ else
+ {
+ if ((self.classname == "item_artifact_invulnerability") ||
+ (self.classname == "item_artifact_invisibility"))
+ {
+ self.nextthink = time + 60 * 5;
+ }
+ else
+ {
+ self.nextthink = time + 60;
+ }
+ }
+
+ sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ self.solid = SOLID_NOT;
+ other.items = other.items | self.items;
+ self.model = string_null;
+
+ // do the apropriate action
+ if (self.classname == "item_artifact_envirosuit")
+ {
+ other.rad_time = 1;
+ other.radsuit_finished = time + 30;
+ }
+
+ if (self.classname == "item_artifact_invulnerability")
+ {
+ other.invincible_time = 1;
+ other.invincible_finished = time + 30;
+ }
+ else if (self.classname == "item_artifact_invisibility")
+ {
+ other.invisible_time = 1;
+ other.invisible_finished = time + 30;
+ }
+ else if (self.classname == "item_artifact_super_damage")
+ {
+ other.super_time = 1;
+ other.super_damage_finished = time + 30;
+ }
+
+ activator = other;
+ // fire all targets / killtargets
+ SUB_UseTargets ();
+};
+
+/*QUAKED item_artifact_invulnerability (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model("progs/invulner.mdl"); }
+Pentagram of Protection
+Player is invulnerable for 30 seconds
+*/
+void() item_artifact_invulnerability =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.touch = powerup_touch;
+
+ // precache_model ("progs/invulner.mdl");
+ precache_body_model ("progs/invulner.mdl");
+ precache_sound ("items/protect.wav");
+ // called in client.qc -- dumptruck_ds
+ precache_sound ("items/protect2.wav");
+ // called in combat.qc -- dumptruck_ds
+ precache_sound ("items/protect3.wav");
+ self.noise = "items/protect.wav";
+ // setmodel (self, "progs/invulner.mdl");
+ body_model ("progs/invulner.mdl");
+ self.netname = "Pentagram of Protection";
+ self.items = IT_INVULNERABILITY;
+ setsize (self, '-16 -16 -24', '16 16 32');
+
+ // t_fog fix for custom models dumptruck_ds
+ if !(self.particles_offset)
+ self.particles_offset = '0 0 16';
+
+ StartItem ();
+};
+
+/*QUAKED item_artifact_envirosuit (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model("progs/suit.mdl"); }
+Biosuit
+Player takes no damage from water or slime for 30 seconds
+*/
+void() item_artifact_envirosuit =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.touch = powerup_touch;
+
+ precache_body_model ("progs/suit.mdl");
+ precache_sound ("items/suit.wav");
+ precache_sound ("items/suit2.wav");
+ self.noise = "items/suit.wav";
+ // setmodel (self, "progs/suit.mdl");
+ body_model ("progs/suit.mdl");
+ self.netname = "Biosuit";
+ self.items = IT_SUIT;
+ setsize (self, '-16 -16 -24', '16 16 32');
+
+ // t_fog fix for custom models dumptruck_ds
+ if !(self.particles_offset)
+ self.particles_offset = '0 0 32';
+
+ StartItem ();
+};
+
+
+/*QUAKED item_artifact_invisibility (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model("progs/invisibl.mdl"); }
+Ring of Shadows
+Player is invisible for 30 seconds
+*/
+void() item_artifact_invisibility =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.touch = powerup_touch;
+
+ precache_body_model ("progs/invisibl.mdl");
+ precache_sound ("items/inv1.wav");
+ precache_sound ("items/inv2.wav");
+ precache_sound ("items/inv3.wav");
+ self.noise = "items/inv1.wav";
+ // setmodel (self, "progs/invisibl.mdl");
+ body_model ("progs/invisibl.mdl");
+ self.netname = "Ring of Shadows";
+ self.items = IT_INVISIBILITY;
+ setsize (self, '-16 -16 -24', '16 16 32');
+
+ // t_fog fix for custom models dumptruck_ds
+ if !(self.particles_offset)
+ self.particles_offset = '0 0 0';
+
+ StartItem ();
+};
+
+/*QUAKED item_artifact_super_damage (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model("progs/quaddama.mdl"); }
+Quad Damage
+Player does 4x damage for 30 seconds
+*/
+void() item_artifact_super_damage =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.touch = powerup_touch;
+
+ precache_body_model ("progs/quaddama.mdl");
+ precache_sound ("items/damage.wav");
+ precache_sound ("items/damage3.wav");
+ self.noise = "items/damage.wav";
+ // setmodel (self, "progs/quaddama.mdl");
+ body_model ("progs/quaddama.mdl");
+
+ // custom name -- dumptruck_ds
+ if !(self.netname)
+ self.netname = "Quad Damage";
+
+ self.items = IT_QUAD;
+ setsize (self, '-16 -16 -24', '16 16 32');
+
+ // t_fog fix for custom models dumptruck_ds
+ if !(self.particles_offset)
+ self.particles_offset = '0 0 16';
+
+ StartItem ();
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/items/runes.qc

diff --git a/qc/items/runes.qc b/qc/items/runes.qc
new file mode 100644
index 0000000..541baf5
--- /dev/null
+++ b/qc/items/runes.qc
@@ -0,0 +1,106 @@
+//==============================================================================
+// END OF LEVEL RUNES
+//==============================================================================
+
+//----------------------------------------------------------------------
+void() sigil_touch =
+{
+ // from Copper -- dumptruck_ds
+ if (!CheckValidTouch())
+ return;
+
+ centerprint (other, "You got the rune!");
+
+ sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ self.solid = SOLID_NOT;
+ self.model = string_null;
+ serverflags = serverflags | (self.spawnflags & 15);
+ // so rune doors won't find it
+ self.classname = "";
+
+ activator = other;
+ // fire all targets / killtargets
+ SUB_UseTargets ();
+};
+
+//----------------------------------------------------------------------
+// sigil_touch2 -- replacement for Skill Select Rune hack
+// uses info_player_start2 if spawnflag 16 -- dumptruck_ds
+//----------------------------------------------------------------------
+void() sigil_touch2 =
+{
+ if (other.classname != "player")
+ return;
+ if (other.health <= 0)
+ return;
+
+ // centerprint (other, "You got the rune!");
+
+ // sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
+ // stuffcmd (other, "bf\n");
+ self.solid = SOLID_NOT;
+ self.model = string_null;
+ serverflags = serverflags | (self.spawnflags & 16);
+ // so rune doors won't find it
+ self.classname = "";
+
+ activator = other;
+ // fire all targets / killtargets
+ // SUB_UseTargets ();
+};
+
+/*QUAKED item_sigil (0 .5 .8) (-16 -16 -24) (16 16 32) E1 E2 E3 E4 X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+ model ( {{ spawnflags & 1 -> { "path" : "progs/end1.mdl" }, spawnflags & 2 -> { "path" : "progs/end2.mdl" },
+ spawnflags & 4 -> { "path" : "progs/end3.mdl" }, spawnflags & 8 -> { "path" : "progs/end4.mdl" },
+ "progs/end1.mdl" }} );
+}
+End of episode rune. Use in conjuction with func_bossgate and func_episodegate.
+Spawnflag must be set to the appropriate episode.
+Episode 1 - Dimension of the Doomed - Rune of Earth Magic
+Episode 2 - The Realm of Black Magic - Rune of Black Magic
+Episode 3 - The Netherworld - Rune of Hell Magic
+Episode 4 - The Elder World - Run of Elder Magic
+*/
+void() item_sigil =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (!self.spawnflags)
+ objerror ("no spawnflags");
+
+ precache_sound ("misc/runekey.wav");
+ self.noise = "misc/runekey.wav";
+
+ if (self.spawnflags & 1)
+ {
+ precache_model ("progs/end1.mdl");
+ setmodel (self, "progs/end1.mdl");
+ }
+
+ if (self.spawnflags & 2)
+ {
+ precache_model2 ("progs/end2.mdl");
+ setmodel (self, "progs/end2.mdl");
+ }
+
+ if (self.spawnflags & 4)
+ {
+ precache_model2 ("progs/end3.mdl");
+ setmodel (self, "progs/end3.mdl");
+ }
+
+ if (self.spawnflags & 8)
+ {
+ precache_model2 ("progs/end4.mdl");
+ setmodel (self, "progs/end4.mdl");
+ }
+
+ self.touch = sigil_touch;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ self.particles_offset = '0 0 18';
+ StartItem ();
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/items/weapons.qc

diff --git a/qc/items/weapons.qc b/qc/items/weapons.qc
new file mode 100644
index 0000000..734167c
--- /dev/null
+++ b/qc/items/weapons.qc
@@ -0,0 +1,380 @@
+//==============================================================================
+// items/weapons.qc -- weapons
+//==============================================================================
+
+// prototypes
+float() W_BestWeapon;
+
+//----------------------------------------------------------------------
+void() bound_other_ammo =
+{
+ if (other.ammo_shells > 100)
+ other.ammo_shells = 100;
+ if (other.ammo_nails > 200)
+ other.ammo_nails = 200;
+ if (other.ammo_rockets > 100)
+ other.ammo_rockets = 100;
+ if (other.ammo_cells > 100)
+ other.ammo_cells = 100;
+};
+
+//----------------------------------------------------------------------
+float(float w) RankForWeapon =
+{
+ // 1997-12-23 Thunderbolt fix by Maddes recognize waterlevel
+ if (self.waterlevel <= 1 && w == IT_LIGHTNING)
+ return 1;
+ if (w == IT_ROCKET_LAUNCHER)
+ return 2;
+ if (w == IT_SUPER_NAILGUN)
+ return 3;
+ if (w == IT_GRENADE_LAUNCHER)
+ return 4;
+ if (w == IT_SUPER_SHOTGUN)
+ return 5;
+ if (w == IT_NAILGUN)
+ return 6;
+ if (w == IT_SHOTGUN)
+ return 7;
+ return 8;
+};
+
+//----------------------------------------------------------------------
+// Deathmatch_Weapon -- Deathmatch weapon change rules for picking up a weapon
+//----------------------------------------------------------------------
+void(float old, float new) Deathmatch_Weapon =
+{
+ local float or, nr;
+
+ // change self.weapon if desired
+ or = RankForWeapon (self.weapon);
+ nr = RankForWeapon (new);
+ if (nr < or)
+ self.weapon = new;
+};
+
+//----------------------------------------------------------------------
+// weapon_touch
+//----------------------------------------------------------------------
+void() weapon_touch =
+{
+ local float hadammo, best, new, old;
+ local entity stemp;
+ local float leave;
+
+ // from Copper -- dumptruck_ds
+ if (!CheckValidTouch())
+ return;
+
+ if (!(other.flags & FL_CLIENT))
+ return;
+
+ // if the player was using his best weapon, change up to the
+ // new one if better
+ stemp = self;
+ self = other;
+ best = W_BestWeapon ();
+ self = stemp;
+
+ if (deathmatch == 2 || coop)
+ {
+ leave = 1;
+ // fix weapon items never firing their targets in coop or
+ // "deathmatch 2" -- iw
+ activator = other;
+ SUB_UseAndForgetTargets ();
+ }
+ else
+ {
+ leave = 0;
+ }
+
+ // johnfitz added for axe, shotgun items
+ // -- dumptruck_ds from RRP / rubicon2
+ if (self.classname == "weapon_axe")
+ {
+ if (leave && (other.items & IT_AXE))
+ return;
+ new = IT_AXE;
+ }
+ else if (self.classname == "weapon_shotgun")
+ {
+ if (leave && (other.items & IT_SHOTGUN))
+ return;
+ hadammo = other.ammo_shells;
+ new = IT_SHOTGUN;
+ other.ammo_shells = other.ammo_shells + 5;
+ }
+ else if (self.classname == "weapon_nailgun")
+ {
+ // johnfitz
+ if (leave && (other.items & IT_NAILGUN))
+ return;
+ hadammo = other.ammo_nails;
+ new = IT_NAILGUN;
+ other.ammo_nails = other.ammo_nails + 30;
+ }
+ else if (self.classname == "weapon_supernailgun")
+ {
+ if (leave && (other.items & IT_SUPER_NAILGUN))
+ return;
+ hadammo = other.ammo_rockets;
+ new = IT_SUPER_NAILGUN;
+ other.ammo_nails = other.ammo_nails + 30;
+ }
+ else if (self.classname == "weapon_supershotgun")
+ {
+ if (leave && (other.items & IT_SUPER_SHOTGUN))
+ return;
+ hadammo = other.ammo_rockets;
+ new = IT_SUPER_SHOTGUN;
+ other.ammo_shells = other.ammo_shells + 5;
+ }
+ else if (self.classname == "weapon_rocketlauncher")
+ {
+ if (leave && (other.items & IT_ROCKET_LAUNCHER))
+ return;
+ hadammo = other.ammo_rockets;
+ new = IT_ROCKET_LAUNCHER;
+ other.ammo_rockets = other.ammo_rockets + 5;
+ }
+ else if (self.classname == "weapon_grenadelauncher")
+ {
+ if (leave && (other.items & IT_GRENADE_LAUNCHER))
+ return;
+ hadammo = other.ammo_rockets;
+ new = IT_GRENADE_LAUNCHER;
+ other.ammo_rockets = other.ammo_rockets + 5;
+ }
+ else if (self.classname == "weapon_lightning")
+ {
+ if (leave && (other.items & IT_LIGHTNING))
+ return;
+ hadammo = other.ammo_rockets;
+ new = IT_LIGHTNING;
+ other.ammo_cells = other.ammo_cells + 15;
+ }
+ else
+ {
+ objerror ("weapon_touch: unknown classname");
+ return;
+ }
+
+ sprint (other, "You got the ");
+ sprint (other, self.netname);
+ sprint (other, "\n");
+ // weapon touch sound
+ sound (other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+
+ bound_other_ammo ();
+
+ // change to the weapon
+ old = other.items;
+ other.items = other.items | new;
+
+ stemp = self;
+ self = other;
+
+ // 1997-12-23 Thunderbolt fix by Maddes start
+ /* don't separate between SinglePlayer/Coop and Deathmatch
+ if (!deathmatch)
+ self.weapon = new;
+ else
+ */
+ // 1997-12-23 Thunderbolt fix by Maddes end
+ Deathmatch_Weapon (old, new);
+
+ W_SetCurrentAmmo ();
+
+ self = stemp;
+
+ if (leave)
+ return;
+
+ // remove it in single player, or setup for respawning in deathmatch
+ self.model = string_null;
+ self.solid = SOLID_NOT;
+ // Supa, SP respawning items support
+ if (!deathmatch)
+ CheckItemRespawn (self, 30);
+ else if (deathmatch == 1)
+ // weapons never disappear in "deathmatch 2"
+ self.nextthink = time + 30;
+
+ self.think = SUB_Regen;
+
+ activator = other;
+ // fire all targets / killtargets
+ SUB_UseTargets ();
+};
+
+//======================================================================
+// johnfitz new items -- dumptruck_ds from RRP and rubicon2
+//======================================================================
+
+/*QUAKED weapon_axe (0 .5 .8) (-16 -16 0) (16 16 32)
+Axe
+*/
+void() weapon_axe =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/g_axe.mdl");
+ setmodel (self, "progs/g_axe.mdl");
+ self.weapon = IT_AXE;
+ self.netname = "Axe";
+ self.touch = weapon_touch;
+ setsize (self, '-16 -16 0', '16 16 56');
+ StartItem ();
+};
+
+/*QUAKED weapon_shotgun (0 .5 .8) (-16 -16 0) (16 16 32) X STYLE_1 STYLE_2 X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model("progs/g_shotgn.mdl"); }
+This is a pickup model that should be used when you want a player to spawn with only an axe and then later get the shotgun: (trigger_take_weapon or reset_items 2 in worldspawn). There are two models to choose from. Spawnflag 2 (the default) selects an unused “classic look” model from Rubicon 2 by metlslime. Spawnflag 4 is an alternate from Slapmap and has been used in a few mods.
+Single-barrelled Shotgun
+Shotgun
+*/
+void() weapon_shotgun =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/g_shotgu.mdl");
+ // new shotgun model by Starshipwaters
+ // - dumptruck_ds - removed 2 older shotguns that used spawnflags
+ setmodel (self, "progs/g_shotgu.mdl");
+ self.weapon = IT_SHOTGUN;
+ self.netname = "Shotgun";
+ self.touch = weapon_touch;
+ setsize (self, '-16 -16 0', '16 16 56');
+ StartItem ();
+};
+
+//======================================================================
+// johnfitz
+//======================================================================
+
+/*QUAKED weapon_supershotgun (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model("progs/g_shot.mdl"); }
+Double-barrelled Shotgun
+*/
+void() weapon_supershotgun =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/g_shot.mdl");
+ setmodel (self, "progs/g_shot.mdl");
+ self.weapon = IT_SUPER_SHOTGUN;
+ self.netname = "Double-barrelled Shotgun";
+ self.touch = weapon_touch;
+ setsize (self, '-16 -16 0', '16 16 56');
+ self.particles_offset = '0 0 33';
+ StartItem ();
+};
+
+/*QUAKED weapon_nailgun (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model("progs/g_nail.mdl"); }
+Nailgun
+*/
+void() weapon_nailgun =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/g_nail.mdl");
+ setmodel (self, "progs/g_nail.mdl");
+ self.weapon = IT_NAILGUN;
+ self.netname = "nailgun";
+ self.touch = weapon_touch;
+ setsize (self, '-16 -16 0', '16 16 56');
+ self.particles_offset = '0 0 31';
+ StartItem ();
+};
+
+/*QUAKED weapon_supernailgun (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model("progs/g_nail2.mdl"); }
+Perforator
+*/
+void() weapon_supernailgun =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/g_nail2.mdl");
+ setmodel (self, "progs/g_nail2.mdl");
+ self.weapon = IT_SUPER_NAILGUN;
+ self.netname = "Super Nailgun";
+ self.touch = weapon_touch;
+ setsize (self, '-16 -16 0', '16 16 56');
+ self.particles_offset = '0 0 34';
+ StartItem ();
+};
+
+/*QUAKED weapon_grenadelauncher (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model("progs/g_rock.mdl"); }
+Grenade Launcher
+*/
+void() weapon_grenadelauncher =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/g_rock.mdl");
+ setmodel (self, "progs/g_rock.mdl");
+ self.weapon = 3;
+ self.netname = "Grenade Launcher";
+ self.touch = weapon_touch;
+ setsize (self, '-16 -16 0', '16 16 56');
+ self.particles_offset = '0 0 28';
+ StartItem ();
+};
+
+/*QUAKED weapon_rocketlauncher (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model("progs/g_rock2.mdl"); }
+Rocket Launcher
+*/
+void() weapon_rocketlauncher =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/g_rock2.mdl");
+ setmodel (self, "progs/g_rock2.mdl");
+ self.weapon = 3;
+ self.netname = "Rocket Launcher";
+ self.touch = weapon_touch;
+ setsize (self, '-16 -16 0', '16 16 56');
+ self.particles_offset = '0 0 32';
+ StartItem ();
+};
+
+
+/*QUAKED weapon_lightning (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model("progs/g_light.mdl"); }
+Thunderbolt
+*/
+void() weapon_lightning =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/g_light.mdl");
+ setmodel (self, "progs/g_light.mdl");
+ self.weapon = 3;
+ self.netname = "Thunderbolt";
+ self.touch = weapon_touch;
+ setsize (self, '-16 -16 0', '16 16 56');
+ self.particles_offset = '0 0 31';
+ StartItem ();
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/items_armor.qc

diff --git a/qc/items_armor.qc b/qc/items_armor.qc
deleted file mode 100644
index f686488..0000000
--- a/qc/items_armor.qc
+++ /dev/null
@@ -1,290 +0,0 @@
-/*==============================================================================
- ARMOR.QC
-==============================================================================*/
-
-void() armor_touch;
-void() shard_touch;
-
-//======================================================================
-// shard_touch
-// this is from RMQ shard_touch
-//----------------------------------------------------------------------
-void() shard_touch =
-{
- // from Copper -- dumptruck_ds
- if (!CheckValidTouch())
- return;
-
- local float bit;
-
- if ((other.items & IT_ARMOR1) || (other.items & IT_ARMOR2) ||
- (other.items & IT_ARMOR3))
- {
- // has armor
- // Supa, check bounds, original armourvalue + 25
- if (other.items & IT_ARMOR1 && other.armorvalue >= 125)
- return;
- if (other.items & IT_ARMOR2 && other.armorvalue >= 175)
- return;
- if (other.items & IT_ARMOR3 && other.armorvalue >= 225)
- return;
-
- // was 2, RMQ team
- other.armorvalue = other.armorvalue + 5;
-
- // Supa, now cap armourvalue to bounds
- if (other.items & IT_ARMOR1 && other.armorvalue >= 125)
- other.armorvalue = 125;
- else if (other.items & IT_ARMOR2 && other.armorvalue >= 175)
- other.armorvalue = 175;
- else if (other.items & IT_ARMOR3 && other.armorvalue >= 225)
- other.armorvalue = 225;
- }
- else
- {
- // shard = Green armor level
- other.armortype = 0.3;
- other.armorvalue = 5;
- bit = IT_ARMOR1;
- other.items = other.items - (other.items &
- (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + bit;
- }
- self.solid = SOLID_NOT;
- self.model = string_null;
-
- // Supa, SP respawning items support
- if (!deathmatch)
- CheckItemRespawn(self, 30);
- else if (deathmatch == 1)
- // doesn't respawn in "deathmatch 2"
- self.nextthink = time + 20;
- self.think = SUB_regen;
-
- if (self.obit_name != "")
- {
- sprint (other, "You got ");
- // custom armor name
- sprint (other, self.obit_name);
- sprint (other, "\n");
- }
- else
- {
- sprint(other, "You got armor\n");
- }
-
- // armor touch sound
- // dumptruck_ds custom models and sounds START
- if (self.snd_misc != "")
- sound_misc(other, CHAN_AUTO, self.snd_misc, 1, ATTN_NORM);
- else
- sound_misc(other, CHAN_AUTO,"dump/armsh1.wav", 1, ATTN_NORM);
-
- // dumptruck_ds custom models and sounds END
- stuffcmd (other, "bf\n");
-
- activator = other;
-
- // fire all targets / killtargets
- SUB_UseTargets();
-};
-
-//======================================================================
-// armor_touch function
-//----------------------------------------------------------------------
-void() armor_touch =
-{
- local float type, value, bit;
-
- // from Copper -- dumptruck_ds
- if (!CheckValidTouch())
- return;
-
- if (self.classname == "item_armor1")
- {
- type = 0.3;
- value = 100;
- bit = IT_ARMOR1;
- }
- else if (self.classname == "item_armor2" ||
- self.classname == "item_armor_combat")
- {
- type = 0.6;
- value = 150;
- bit = IT_ARMOR2;
- }
- else if (self.classname == "item_armorInv" ||
- self.classname == "item_armor_body")
- {
- type = 0.8;
- value = 200;
- bit = IT_ARMOR3;
- }
- else
- {
- dprint ("WARNING: armor_touch: unknown classname: ");
- dprint (self.classname);
- dprint ("\n");
- return;
- }
-
- if (other.armortype*other.armorvalue >= type*value)
- return;
-
- other.armortype = type;
- other.armorvalue = value;
-
- other.items = other.items - (other.items &
- (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + bit;
-
- self.solid = SOLID_NOT;
- self.model = string_null;
-
- // Supa, SP respawning items support
- if (!deathmatch)
- CheckItemRespawn(self, 30);
- else if (deathmatch == 1)
- // doesn't respawn in "deathmatch 2"
- self.nextthink = time + 20;
- self.think = SUB_regen;
-
- if (self.obit_name != "")
- {
- sprint (other, "You got ");
- // custom armor name
- sprint (other, self.obit_name);
- sprint (other, "\n");
- }
- else
- {
- sprint(other, "You got armor\n");
- }
-
- // armor touch sound
- // dumptruck_ds custom models and sounds START
- if (self.snd_misc != "")
- sound_misc(other, CHAN_ITEM, self.snd_misc, 1, ATTN_NORM);
- else
- sound_misc(other, CHAN_ITEM,"items/armor1.wav", 1, ATTN_NORM);
- // dumptruck_ds custom models and sounds END
- stuffcmd (other, "bf\n");
-
- activator = other;
- // fire all targets / killtargets
- SUB_UseTargets();
-};
-
-//======================================================================
-// item_armor_shard
-//----------------------------------------------------------------------
-void() item_armor_shard =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (!self.mdl_body && world.a_shr_mdl)
- self.mdl_body = world.a_shr_mdl;
-
- self.touch = shard_touch;
- // dumptruck_ds custom models and sounds START
- precache_body_model ("progs/armshr.mdl");
- // setmodel (self, "progs/armor.mdl");
- body_model ("progs/armshr.mdl");
- precache_sound_misc ("dump/armsh1.wav");
- // dumptruck_ds custom models and sounds END
- if !(self.skin)
- self.skin = 0;
- setsize (self, '-16 -16 0', '16 16 56');
- StartItem ();
-};
-
-/*QUAKED item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/armor.mdl");
-}
-*/
-
-//======================================================================
-// item_armor1 (Green Armor)
-//----------------------------------------------------------------------
-void() item_armor1 =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (!self.mdl_body && world.a_grn_mdl)
- self.mdl_body = world.a_grn_mdl;
-
- self.touch = armor_touch;
- // dumptruck_ds custom models and sounds START
- precache_body_model ("progs/armor.mdl");
- // setmodel (self, "progs/armor.mdl");
- body_model ("progs/armor.mdl");
- precache_sound_misc ("items/armor1.wav");
- // dumptruck_ds custom models and sounds END
- if !(self.skin)
- self.skin = 0;
- setsize (self, '-16 -16 0', '16 16 56');
- StartItem ();
-};
-
-/*QUAKED item_armor2 (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model({ "path": ":progs/armor.mdl", "skin": 1 }); }
-*/
-
-//======================================================================
-// item_armor2 (Yellow Armor)
-//----------------------------------------------------------------------
-void() item_armor2 =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (!self.mdl_body && world.a_ylw_mdl)
- self.mdl_body = world.a_ylw_mdl;
-
- self.touch = armor_touch;
- // dumptruck_ds custom models and sounds START
- precache_body_model ("progs/armor.mdl");
- // setmodel (self, "progs/armor.mdl");
- body_model ("progs/armor.mdl");
- // dumptruck_ds custom models and sounds END
- if !(self.skin)
- self.skin = 1;
- precache_sound_misc ("items/armor1.wav");
- setsize (self, '-16 -16 0', '16 16 56');
- StartItem ();
-};
-
-/*QUAKED item_armorInv (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model({ "path": ":progs/armor.mdl", "skin": 2 });
-}
-*/
-
-//======================================================================
-// item_armorInv (Red Armor)
-//----------------------------------------------------------------------
-void() item_armorInv =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit ())
- return;
-
- if (!self.mdl_body && world.a_red_mdl)
- self.mdl_body = world.a_red_mdl;
-
- self.touch = armor_touch;
- // dumptruck_ds custom models and sounds START
- precache_body_model ("progs/armor.mdl");
- // setmodel (self, "progs/armor.mdl");
- body_model ("progs/armor.mdl");
- // dumptruck_ds custom models and sounds END
- if !(self.skin)
- self.skin = 2;
- precache_sound_misc ("items/armor1.wav");
- setsize (self, '-16 -16 0', '16 16 56');
- StartItem ();
-};

Return to the top of this page or return to the overview of this repo.

Diff qc/items_health.qc

diff --git a/qc/items_health.qc b/qc/items_health.qc
deleted file mode 100644
index 2aac1ff..0000000
--- a/qc/items_health.qc
+++ /dev/null
@@ -1,271 +0,0 @@
-//==============================================================================
-// HEALTH BOXES
-//==============================================================================
-
-// constants
-float H_ROTTEN = 1;
-float H_MEGA = 2;
-float H_VIAL = 4;
-
-// fields
-.float healamount, healtype;
-
-// primitives
-void() health_touch;
-// void() item_megahealth_rot;
-
-//======================================================================
-// T_Heal: add health to an entity, limiting health to max_health
-// "ignore" will ignore max_health limit
-//----------------------------------------------------------------------
-float (entity e, float healamount, float ignore) T_Heal =
-{
- if (e.health <= 0)
- return 0;
- if ((!ignore) && (e.health >= other.max_health))
- return 0;
- healamount = ceil(healamount);
-
- e.health = e.health + healamount;
- if ((!ignore) && (e.health >= other.max_health))
- e.health = other.max_health;
-
- if (e.health > 250)
- e.health = 250;
- return 1;
-};
-
-/*QUAKED item_health (.3 .3 1) (0 0 0) (32 32 32) ROTTEN MEGAHEALTH X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
- model ( {{ spawnflags & 1 -> { "path" : "maps/b_bh10.bsp" }, spawnflags & 2 -> { "path" : "maps/b_bh100.bsp" },
- "maps/b_bh25.bsp" }} );
-}
-Health box. Normally gives 25 points.
-Rotten box heals 15 points.
-Megahealth will add 100 health, then start to
-rot the player back down to 100 health after 5 seconds.
-*/
-//======================================================================
-// item_health
-//----------------------------------------------------------------------
-void() item_health =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.touch = health_touch;
-
- if (self.spawnflags & H_ROTTEN)
- {
- if (!self.mdl_body && world.h_15_mdl)
- self.mdl_body = world.h_15_mdl;
-
- // dumptruck_ds custom health models and sounds START
- if (world.style)
- {
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model ("progs/h_mdls/m_h15.mdl");
- body_model("progs/h_mdls/m_h15.mdl");
- }
- else
- {
- // setmodel(self, "maps/b_bh10.bsp");
- precache_body_model ("maps/b_bh10.bsp");
- body_model ("maps/b_bh10.bsp");
- }
-
- // precache_sound("items/r_item1.wav");
- precache_sound_misc("items/r_item1.wav");
- // self.noise = "items/r_item1.wav";
- if !(self.snd_misc)
- //set the custom noise in editor -- dumptruck_ds
- self.snd_misc = "items/r_item1.wav";
- self.noise = self.snd_misc;
-
- // if !(self.healamount)
- // set your custom health amount here -- dumptruck_ds
- self.healamount = 15;
- self.healtype = 0;
- if !(self.particles_offset)
- self.particles_offset = '16 16 8';
- // dumptruck_ds custom health models and sounds END
- }
- else
- {
- if (self.spawnflags & H_MEGA)
- {
- if (!self.mdl_body && world.h_mega_mdl)
- self.mdl_body = world.h_mega_mdl;
- // precache_model("maps/b_bh100.bsp");
- if (world.style)
- {
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model ("progs/h_mdls/m_h100.mdl");
- body_model("progs/h_mdls/m_h100.mdl");
- }
- else
- {
- // setmodel(self, "maps/b_bh100.bsp");
- precache_body_model ("maps/b_bh100.bsp");
- body_model ("maps/b_bh100.bsp");
- }
-
- precache_sound_misc("items/r_item2.wav");
- // self.noise = "items/r_item2.wav";
- if !(self.snd_misc)
- //set the custom noise in editor -- dumptruck_ds
- self.snd_misc = "items/r_item2.wav";
- self.noise = self.snd_misc;
-
- // if !(self.healamount)
- // custom health amount -- dumptruck_ds
- self.healamount = 100;
- self.healtype = 2;
- if !(self.particles_offset)
- self.particles_offset = '16 16 16';
- }
- else
- {
- if (!self.mdl_body && world.h_25_mdl)
- self.mdl_body = world.h_25_mdl;
- if (world.style)
- {
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model ("progs/h_mdls/m_h25.mdl");
- body_model("progs/h_mdls/m_h25.mdl");
- }
- else
- {
- precache_body_model ("maps/b_bh25.bsp");
- body_model ("maps/b_bh25.bsp");
- }
- precache_sound_misc("items/health1.wav");
- if !(self.snd_misc)
- // set custom noise in editor -- dumptruck_ds
- self.snd_misc = "items/health1.wav";
- self.noise = self.snd_misc;
-
- self.healamount = 25;
- self.healtype = 1;
- if !(self.particles_offset)
- self.particles_offset = '16 16 8';
- // dumptruck_ds custom health models and sounds END
- }
- }
- setsize (self, '0 0 0', '32 32 56');
- StartItem ();
-};
-
-//======================================================================
-// item_health_vial
-//----------------------------------------------------------------------
-void() item_health_vial =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.touch = health_touch;
-
- if (!self.mdl_body && world.h_vial_mdl)
- self.mdl_body = world.h_vial_mdl;
-
- // model from Hexen 2 -- dumptruck_ds
- precache_body_model ("progs/h_mdls/pd_vial.mdl");
- body_model ("progs/h_mdls/pd_vial.mdl");
- precache_sound_misc ("items/r_item1.wav");
- if !(self.snd_misc)
- // set the custom noise in editor -- dumptruck_ds
- self.snd_misc = "items/r_item1.wav";
- self.noise = self.snd_misc;
-
- self.healamount = 5;
- // over heal and count down like mega health -- dumptruck_ds
- self.healtype = 2;
- setsize (self, '-16 -16 0', '16 16 56');
- if !(self.particles_offset)
- self.particles_offset = '0 0 0';
- StartItem ();
-};
-
-//======================================================================
-// health_touch
-//----------------------------------------------------------------------
-void() health_touch =
-{
- local float amount;
- local string s;
- amount = self.healamount;
- // from Copper -- dumptruck_ds
- if (!CheckValidTouch())
- return;
-
- if (self.healtype == 2)
- {
- // Megahealth? Ignore max_health...
- if (other.health >= 250) return;
- if (!T_Heal(other, amount, 1)) return;
- }
- else
- {
- if (!T_Heal(other, amount, 0)) return;
- }
-
- sprint(other, "You receive ");
- s = ftos (amount);
- sprint(other, s);
- sprint(other, " health\n");
-
- // health touch sound
- // sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
- // custom sounds -- dumptruck_ds
- sound_misc (other, CHAN_AUTO, self.noise, 1, ATTN_NORM);
-
- stuffcmd (other, "bf\n");
-
- self.model = string_null;
- self.solid = SOLID_NOT;
-
- self.think = SUB_regen;
-
- // Megahealth = rot down the player's super health
- if (self.healtype == 2)
- {
- // thanks ydrol!!!
- other.megahealth_rottime = time + 5;
- other.items = other.items | IT_SUPERHEALTH;
- self.owner = other;
-
- // Regarding the deathmatch respawn time below: id's original
- // code made the megahealth respawn 20 seconds after the health
- // of the player who collected it finished rotting down.
- // However, this mod has already got rid of the weird old
- // megahealth behavior whereby it monitored the player who
- // touched it, so the original respawn logic isn't applicable.
- // As a solution, the code below uses a respawn time of 125
- // seconds for deathmatch, because that was the worst-case
- // scenario of id's original code (5 seconds before the player's
- // health started to rot, plus 100 seconds to rot down 100
- // health points, plus the original 20 second delay before the
- // item respawned). -- iw
- //
- if (!deathmatch)
- CheckItemRespawn (self, 30);
- else if (deathmatch == 1)
- // doesn't respawn in "deathmatch 2"
- self.nextthink = time + 125;
- }
- else
- {
- if (!deathmatch)
- CheckItemRespawn (self, 30);
- else if (deathmatch == 1)
- // doesn't respawn in "deathmatch 2"
- self.nextthink = time + 20;
- }
-
- activator = other;
- // fire all targets / killtargets
- SUB_UseTargets ();
-};

Return to the top of this page or return to the overview of this repo.

Diff qc/keydata.qc

diff --git a/qc/keydata.qc b/qc/keydata.qc
index 4c78ea0..07d54c0 100644
--- a/qc/keydata.qc
+++ b/qc/keydata.qc
@@ -1,11 +1,9 @@
-/*
-========================================================================
-
-FUNCTIONS WHICH DEAL WITH KEY ITEM BITFLAGS AND NAMES
+//==============================================================================
+// FUNCTIONS WHICH DEAL WITH KEY ITEM BITFLAGS AND NAMES
+//==============================================================================

+/*
========================================================================
-
-
This file was created for progs_dump by Ian "iw" Walshaw, January 2020.

It defines functions which deal with the bitflags and names which refer
@@ -14,12 +12,16 @@ to the key items, including the new item_key_custom.
These functions are a dependency of the updated code for the key items
(in items.qc) and also the updated code for unlockable entities (in
keylock.qc).
-
-
========================================================================
*/

+// The highest bitflag that will be assigned to a custom key.
+float FINAL_CUSTOM_KEY = 4194304;

+// The highest bitflag that has been assigned to a custom key.
+float highest_custom_key;
+
+// prototypes
string() SilverKeyName;
string() GoldKeyName;
float(string key_name) CustomKeyFlag;
@@ -30,22 +32,12 @@ void(entity client, float item_flags, float customkey_flags) GiveKeys;
void(entity client) GiveAllKeys;
void(entity client, float item_flags, float customkey_flags) RemoveKeys;

-
-// The highest bitflag that will be assigned to a custom key.
-float FINAL_CUSTOM_KEY = 4194304;
-
-// The highest bitflag that has been assigned to a custom key.
-float highest_custom_key;
-
-
-/*
-============
-SilverKeyName
-
-Return the name that should be used for the silver key as per
-world.worldtype. -- iw
-============
-*/
+//----------------------------------------------------------------------
+// SilverKeyName
+//
+// Return the name that should be used for the silver key as per
+// world.worldtype. -- iw
+//----------------------------------------------------------------------
string() SilverKeyName =
{
if (world.worldtype == WORLDTYPE_BASE)
@@ -55,15 +47,12 @@ string() SilverKeyName =
return "silver key";
};

-
-/*
-============
-GoldKeyName
-
-Return the name that should be used for the gold key as per
-world.worldtype. -- iw
-============
-*/
+//----------------------------------------------------------------------
+// GoldKeyName
+//
+// Return the name that should be used for the gold key as per
+// world.worldtype. -- iw
+//----------------------------------------------------------------------
string() GoldKeyName =
{
if (world.worldtype == WORLDTYPE_BASE)
@@ -73,21 +62,18 @@ string() GoldKeyName =
return "gold key";
};

-
-/*
-================
-CustomKeyFlag
-
-Return the bitflag that should be used to represent the custom key named
-key_name.
-
-More specifically, if this is the first time that this function has been
-called for the specified key_name, then return a bitflag which has not
-previously been returned by this function for any key_name. Otherwise,
-return the same bitflag that was previously returned for the specified
-key_name. -- iw
-================
-*/
+//----------------------------------------------------------------------
+// CustomKeyFlag
+//
+// Return the bitflag that should be used to represent the custom key named
+// key_name.
+
+// More specifically, if this is the first time that this function has been
+// called for the specified key_name, then return a bitflag which has not
+// previously been returned by this function for any key_name. Otherwise,
+// return the same bitflag that was previously returned for the specified
+// key_name. -- iw
+//----------------------------------------------------------------------
float(string key_name) CustomKeyFlag =
{
local entity key_def;
@@ -98,18 +84,15 @@ float(string key_name) CustomKeyFlag =
return key_def.customkeys;
};

-
-/*
-================
-SpawnCustomKeyDef
-
-Spawn and return a new custom_key_def entity which will define the
-custom key named key_name.
-
-The value of the entity's customkeys field will be a bitflag which has
-not yet been used to represent a custom key. -- iw
-================
-*/
+//----------------------------------------------------------------------
+// SpawnCustomKeyDef
+//
+// Spawn and return a new custom_key_def entity which will define the
+// custom key named key_name.
+//
+// The value of the entity's customkeys field will be a bitflag which has
+// not yet been used to represent a custom key. -- iw
+//----------------------------------------------------------------------
entity(string key_name) SpawnCustomKeyDef =
{
local entity key_def;
@@ -130,19 +113,16 @@ entity(string key_name) SpawnCustomKeyDef =
return key_def;
};

-
-/*
-================
-FindCustomKeyDef
-
-If a custom_key_def entity exists which defines the custom key named
-key_name, then find and return it, otherwise return world.
-
-If a custom_key_def entity is returned, then the value of its customkeys
-field will be the bitflag that should be used to represent the custom
-key named key_name. -- iw
-================
-*/
+//----------------------------------------------------------------------
+// FindCustomKeyDef
+//
+// If a custom_key_def entity exists which defines the custom key named
+// key_name, then find and return it, otherwise return world.
+//
+// If a custom_key_def entity is returned, then the value of its customkeys
+// field will be the bitflag that should be used to represent the custom
+// key named key_name. -- iw
+//----------------------------------------------------------------------
entity(string key_name) FindCustomKeyDef =
{
local entity key_def;
@@ -157,62 +137,50 @@ entity(string key_name) FindCustomKeyDef =
return world;
};

-
-/*
-================
-HasKeys
-
-Return TRUE if the specified client has all of the non-custom keys
-represented by the item_flags and all of the custom keys represented by
-the customkey_flags, otherwise return FALSE. -- iw
-================
-*/
+//----------------------------------------------------------------------
+// HasKeys
+//
+// Return TRUE if the specified client has all of the non-custom keys
+// represented by the item_flags and all of the custom keys represented by
+// the customkey_flags, otherwise return FALSE. -- iw
+//----------------------------------------------------------------------
float(entity client, float item_flags, float customkey_flags) HasKeys =
{
return (client.items & item_flags) == item_flags &&
- (client.customkeys & customkey_flags) == customkey_flags;
+ (client.customkeys & customkey_flags) == customkey_flags;
};

-
-/*
-================
-GiveKeys
-
-Give the specified client all of the non-custom keys represented by the
-item_flags and all of the custom keys represented by the
-customkey_flags. -- iw
-================
-*/
+//----------------------------------------------------------------------
+// GiveKeys
+//
+// Give the specified client all of the non-custom keys represented by the
+// item_flags and all of the custom keys represented by the
+// customkey_flags. -- iw
+//----------------------------------------------------------------------
void(entity client, float item_flags, float customkey_flags) GiveKeys =
{
client.items = client.items | item_flags;
client.customkeys = client.customkeys | customkey_flags;
};

-
-/*
-================
-GiveAllKeys
-
-Give the specified client the silver key, the gold key, and all of the
-custom keys that have been defined for the current map. -- iw
-================
-*/
+//----------------------------------------------------------------------
+// GiveAllKeys
+//
+// Give the specified client the silver key, the gold key, and all of the
+// custom keys that have been defined for the current map. -- iw
+//----------------------------------------------------------------------
void(entity client) GiveAllKeys =
{
GiveKeys (client, IT_KEY1 | IT_KEY2, highest_custom_key * 2 - 1);
};

-
-/*
-================
-RemoveKeys
-
-Remove all of the non-custom keys represented by the item_flags and all
-of the custom keys represented by the customkey_flags from the specified
-client's inventory. -- iw
-================
-*/
+//----------------------------------------------------------------------
+// RemoveKeys
+//
+// Remove all of the non-custom keys represented by the item_flags and all
+// of the custom keys represented by the customkey_flags from the specified
+// client's inventory. -- iw
+//----------------------------------------------------------------------
void(entity client, float item_flags, float customkey_flags) RemoveKeys =
{
client.items = client.items -

Return to the top of this page or return to the overview of this repo.

Diff qc/keylock.qc

diff --git a/qc/keylock.qc b/qc/keylock.qc
index 1566671..ccc619b 100644
--- a/qc/keylock.qc
+++ b/qc/keylock.qc
@@ -1,11 +1,9 @@
-/*
-========================================================================
-
-COMMON CODE FOR ENTITIES WHICH CAN BE UNLOCKED WITH KEYS
+//==============================================================================
+// COMMON CODE FOR ENTITIES WHICH CAN BE UNLOCKED WITH KEYS
+//==============================================================================

+/*
========================================================================
-
-
This file was created for progs_dump by Ian "iw" Walshaw, December 2019.

It defines functions which implement the logic of the player using a key
@@ -35,14 +33,11 @@ calling these functions must not use these fields for other purposes:
- self.netname
- self.noise3
- self.noise4
-
-
========================================================================
*/

-
/*
-================
+------------------------------------------------------------------------
keylock_init

Initialize self for use with the other keylock_* functions.
@@ -55,7 +50,7 @@ already been set:
- self.noise4 (the "key used" sound file).

The default values are determined by world.worldtype. -- iw
-================
+------------------------------------------------------------------------
*/
void() keylock_init =
{
@@ -87,15 +82,12 @@ void() keylock_init =
precache_sound (self.noise4);
};

-
-/*
-================
-keylock_set_silver_key
-
-Make it so that the player will need to use the silver key in order to
-unlock self. -- iw
-================
-*/
+//----------------------------------------------------------------------
+// keylock_set_silver_key
+//
+// Make it so that the player will need to use the silver key in order to
+// unlock self. -- iw
+//----------------------------------------------------------------------
void() keylock_set_silver_key =
{
self.items = IT_KEY1;
@@ -103,32 +95,28 @@ void() keylock_set_silver_key =
self.netname = SilverKeyName ();
};

-
-/*
-================
-keylock_set_gold_key
-
-Make it so that the player will need to use the gold key in order to
-unlock self. -- iw
-================
-*/
+//----------------------------------------------------------------------
+// keylock_set_gold_key
+//
+// Make it so that the player will need to use the gold key in order to
+// unlock self. -- iw
+//----------------------------------------------------------------------
void() keylock_set_gold_key =
{
self.items = IT_KEY2;
- self.customkeys = 0; // support for item_key_custom -- iw
+ // support for item_key_custom -- iw
+ self.customkeys = 0;
self.netname = GoldKeyName ();
};

-
+//----------------------------------------------------------------------
+// keylock_set_custom_key
+//
+// Make it so that the player will need to use the custom key named
+// key_name in order to unlock self. -- iw
+//
// support for item_key_custom -- iw
-/*
-================
-keylock_set_custom_key
-
-Make it so that the player will need to use the custom key named
-key_name in order to unlock self. -- iw
-================
-*/
+//----------------------------------------------------------------------
void(string key_name) keylock_set_custom_key =
{
self.items = 0;
@@ -136,24 +124,20 @@ void(string key_name) keylock_set_custom_key =
self.netname = key_name;
};

-
-/*
-================
-keylock_has_key_set
-
-Return TRUE if one of the keylock_set_*_key functions has been called
-for self, otherwise return FALSE. -- iw
-================
-*/
+//----------------------------------------------------------------------
+// keylock_has_key_set
+//
+// Return TRUE if one of the keylock_set_*_key functions has been called
+// for self, otherwise return FALSE. -- iw
+//----------------------------------------------------------------------
float() keylock_has_key_set =
{
-// support for item_key_custom -- iw
+ // support for item_key_custom -- iw
return self.items != 0 || self.customkeys != 0;
};

-
/*
-================
+------------------------------------------------------------------------
keylock_try_to_unlock

Handle the logic of the specified client trying to unlock self.
@@ -183,14 +167,14 @@ then do the following:

The self.cnt functionality is a feature of progs_dump and was not part
of the original game. -- iw
-================
+------------------------------------------------------------------------
*/
void(entity client, string custom_message,
void() success_func) keylock_try_to_unlock =
{
local string s;

-// support for item_key_custom -- iw
+ // support for item_key_custom -- iw
if (!HasKeys (client, self.items, self.customkeys))
{
if (custom_message != "")
@@ -201,15 +185,15 @@ void(entity client, string custom_message,
return;
}

-// the old code in door_touch included a comment from dumptruck_ds
-// thanking RennyC re self.cnt
+ // the old code in door_touch included a comment from dumptruck_ds
+ // thanking RennyC re self.cnt
if (self.cnt)
{
s = "You used (and kept) the ";
}
else
{
- // support for item_key_custom -- iw
+ // support for item_key_custom -- iw
RemoveKeys (client, self.items, self.customkeys);
s = "You used the ";
}
@@ -218,8 +202,8 @@ void(entity client, string custom_message,
sprint (client, self.netname);
sprint (client, "\n");

-// the old code in door_fire included a comment from dumptruck_ds
-// thanking c0burn re changing CHAN_VOICE to CHAN_ITEM
+ // the old code in door_fire included a comment from dumptruck_ds
+ // thanking c0burn re changing CHAN_VOICE to CHAN_ITEM
sound (self, CHAN_ITEM, self.noise4, 1, ATTN_NORM);

success_func ();

Return to the top of this page or return to the overview of this repo.

Diff qc/lights.qc

diff --git a/qc/lights.qc b/qc/lights.qc
deleted file mode 100644
index f693524..0000000
--- a/qc/lights.qc
+++ /dev/null
@@ -1,490 +0,0 @@
-/*========================================
-lights.qc taken from c0burn's Slipgate mod -- dumptruck_ds
-========================================*/
-
-float START_OFF = 1;
-float FADE_IN_OUT= 2;
-float SILENT_TORCH = 4; // for silent torch -- dumptruck_ds
-
-/*QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-
-Used as a positional target for spotlights, etc.
-*/
-void() info_null =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- remove(self);
-};
-
-/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-
-Never used in the or
-*/
-void() info_notnull =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-};
-
-/*==========
-lightstyle_lookup
-==========*/
-string(float num) lightstyle_lookup =
-{
- switch (num)
- {
- case 0:
- // 0 normal
- return "m";
- case 1:
- // 1 FLICKER (first variety)
- return "mmnmmommommnonmmonqnmmo";
- case 2:
- // 2 SLOW STRONG PULSE
- return "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba";
- case 3:
- // 3 CANDLE (first variety)
- return "mmmmmaaaaammmmmaaaaaabcdefgabcdefg";
- case 4:
- // 4 FAST STROBE
- return "mamamamamama";
- case 5:
- // 5 GENTLE PULSE 1
- return "jklmnopqrstuvwxyzyxwvutsrqponmlkj";
- case 6:
- // 6 FLICKER (second variety)
- return "nmonqnmomnmomomno";
- case 7:
- // 7 CANDLE (second variety)
- return "mmmaaaabcdefgmmmmaaaammmaamm";
- case 8:
- // 8 CANDLE (third variety)
- return "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa";
- case 9:
- // 9 SLOW STROBE (fourth variety)
- return "aaaaaaaazzzzzzzz";
- case 10:
- // 10 FLUORESCENT FLICKER
- return "mmamammmmammamamaaamammma";
- case 11:
- // 11 SLOW PULSE NOT FADE TO BLACK
- return "abcdefghijklmnopqrrqponmlkjihgfedcba";
- case 12:
- // 12 BLINK OFF / ON (can be synced with animated
- // textures, e.g. +0light and +1light)
- // textures animate at 5fps but lights are
- // 10fps...
- return "aamm";
- default:
- // DEFAULT
- return "a";
- }
-};
-
-/*==========
-setup_lightstyles
-
-Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
-Styles 32+ are assigned by the light program for switchable lights.
-==========*/
-void() setup_lightstyles =
-{
- for (float i = 0; i <= 12; i++)
- {
- lightstyle (i, lightstyle_lookup(i));
- }
-};
-
-/*==========
-lightstyle_fade_lookup
-==========*/
-string(float num) lightstyle_fade_lookup =
-{
- switch (num)
- {
- case 0:
- return "a";
- case 1:
- return "b";
- case 2:
- return "c";
- case 3:
- return "d";
- case 4:
- return "e";
- case 5:
- return "f";
- case 6:
- return "g";
- case 7:
- return "h";
- case 8:
- return "i";
- case 9:
- return "j";
- case 10:
- return "k";
- case 11:
- return "l";
- case 12:
- return "m";
- default:
- error("count out of range\n");
- break;
- }
-};
-
-/*==========
-light_fade_in
-==========*/
-void() light_fade_in =
-{
- if (self.count < 0)
- self.count = 0;
- if (self.count > 12)
- self.count = 12;
-
- lightstyle (self.style, lightstyle_fade_lookup(self.count));
- self.count = self.count + 1;
- if (self.count > 12)
- return;
-
- self.think = light_fade_in;
- self.nextthink = time + self.speed;
-};
-
-/*==========
-light_fade_out
-==========*/
-void() light_fade_out =
-{
- if (self.count < 0)
- self.count = 0;
- if (self.count > 12)
- self.count = 12;
-
- lightstyle (self.style, lightstyle_fade_lookup(self.count));
- self.count = self.count - 1;
- if (self.count < 0)
- return;
-
- self.think = light_fade_out;
- self.nextthink = time + self.speed;
-};
-
-/*==========
-light_use
-
-using a light will turn it on and off
-==========*/
-void() light_use =
-{
- if (self.spawnflags & START_OFF)
- {
- self.spawnflags = self.spawnflags - START_OFF;
- if (self.spawnflags & FADE_IN_OUT && !self.style2)
- light_fade_in ();
- else
- lightstyle (self.style, lightstyle_lookup(self.style2));
- }
- else
- {
- self.spawnflags = self.spawnflags + START_OFF;
- if (self.spawnflags & FADE_IN_OUT && !self.style2)
- light_fade_out ();
- else
- lightstyle (self.style, "a");
- }
-};
-
-/*QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) START_OFF FADE_IN_OUT X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-
-Light
-
-==========
-Spawnflags
-==========
-START_OFF - switchable lights only - light is off by default
-FADE_IN_OUT - switchable lights only - light fades in and out. can't be combined with animated lights.
-
-==========
-Keys
-==========
-"light" "n"
-Set the light intensity. Negative values are also allowed and will cause the entity to subtract light cast by other entities. Default 300.
-
-"wait" "n"
-Scale the fade distance of the light by "n". Values of n > 1 make the light fade more quickly with distance, and values < 1 make the light fade more slowly (and thus reach further). Default 1.
-
-"delay" "n"
-Select an attenuation formaula for the light:
-0 => Linear attenuation (default)
-1 => 1/x attenuation
-2 => 1/(x^2) attenuation
-3 => No attenuation (same brightness at any distance)
-4 => "local minlight" - No attenuation and like minlight,
-it won't raise the lighting above it's light value.
-Unlike minlight, it will only affect surfaces within
-line of sight of the entity.
-5 => 1/(x^2) attenuation, but slightly more attenuated and
-without the extra bright effect that "delay 2" has
-near the source.
-
-"_falloff" "n"
-Sets the distance at which the light drops to 0, in map units.
-In this mode, "wait" is ignored and "light" only controls the brightness at the center of the light, and no longer affects the falloff distance.
-Only supported on linear attenuation (delay 0) lights currently.
-
-"_color" "r g b"
-Specify red(r), green(g) and blue(b) components for the colour of the light. RGB component values are between 0 and 255 (between 0 and 1 is also accepted). Default is white light ("255 255 255").
-
-"target" "name"
-Turns the light into a spotlight, with the direction of light being towards another entity with it�s "targetname" key set to "name".
-"mangle" "yaw pitch roll"
-Turns the light into a spotlight and specifies the direction of light using yaw, pitch and roll in degrees. Yaw specifies the angle around the Z-axis from 0 to 359 degrees and pitch specifies the angle from 90 (straight up) to -90 (straight down). Roll has no effect, so use any value (e.g. 0). Often easier than the "target" method.
-
-"angle" "n"
-Specifies the angle in degrees for a spotlight cone. Default 40.
-
-"_softangle" "n"
-Specifies the angle in degrees for an inner spotlight cone (must be less than the "angle" cone. Creates a softer transition between the full brightness of the inner cone to the edge of the outer cone. Default 0 (disabled).
-
-"targetname" "name"
-Turns the light into a switchable light, toggled by another entity targeting it�s name.
-
-"speed" "n"
-If the light is switchable and FADE_IN_OUT is set, the speed at which the light transitions. Default 0.1.
-
-"style" "n"
-Set the animated light style. Default 0.
-
-"style2" "n"
-Set the animated light style for a switchable light, because style will be overriden if a targetname is set. Default 0.
-
-"_anglescale" "n" | "_anglesense" "n"
-Sets a scaling factor for how much influence the angle of incidence of light on a surface has on the brightness of the surface. n must be between 0.0 and 1.0. Smaller values mean less attenuation, with zero meaning that angle of incidence has no effect at all on the brightness. Default 0.5.
-
-"_dirtscale" "n" | "_dirtgain" "n"
-Override the global "_dirtscale" or "_dirtgain" settings to change how this light is affected by dirtmapping (ambient occlusion). See descriptions of these keys in the worldspawn section.
-
-"_dirt" "n"
-Overrides the worldspawn setting of "_dirt" for this particular light. -1 to disable dirtmapping (ambient occlusion) for this light, making it illuminate the dirtmapping shadows. 1 to enable ambient occlusion for this light. Default is to defer to the worldspawn setting.
-
-"_deviance" "n"
-Split up the light into a sphere of randomly positioned lights within radius "n" (in world units). Useful to give shadows a wider penumbra. "_samples" specifies the number of lights in the sphere. The "light" value is automatically scaled down for most lighting formulas (except linear and non-additive minlight) to attempt to keep the brightness equal. Default is 0, do not split up lights.
-
-"_samples" "n"
-Number of lights to use for "_deviance". Default 16 (only used if "_deviance" is set).
-
-"_surface" "texturename"
-Makes surfaces with the given texture name emit light, by using this light as a template which is copied across those surfaces. Lights are spaced about 128 units (though possibly closer due to bsp splitting) apart and positioned 2 units above the surfaces.
-
-"_surface_offset" "n"
-Controls the offset lights are placed above surfaces for "_surface". Default 2.
-
-"_surface_spotlight" "n"
-For a surface light template (i.e. a light with "_surface" set), setting this to "1" makes each instance into a spotlight, with the direction of light pointing along the surface normal. In other words, it automatically sets "mangle" on each of the generated lights.
-
-"_project_texture" "texture"
-Specifies that a light should project this texture. The texture must be used in the map somewhere.
-
-"_project_mangle" "yaw pitch roll"
-Specifies the yaw/pitch/roll angles for a texture projection (overriding mangle).
-
-"_project_fov" "n"
-Specifies the fov angle for a texture projection. Default 90.
-
-"_bouncescale" "n"
-Scales the amount of light that is contributed by bounces. Default is 1.0, 0.0 disables bounce lighting for this light.
-
-"_sun" "n"
-Set to 1 to make this entity a sun, as an alternative to using the sunlight worldspawn keys. If the light targets an info_null entity, the direction towards that entity sets sun direction. The light itself is disabled, so it can be placed anywhere in the map.
-
-The following light properties correspond to these sunlight settings:
-light => _sunlight
-mangle => _sunlight_mangle
-deviance => _sunlight_penumbra
-_color => _sunlight_color
-_dirt => _sunlight_dirt
-_anglescale => _anglescale
-*/
-void() light =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- // default speed for fading in/out
- if (self.speed <= 0)
- self.speed = 0.1;
-
- // non-switchable light
- if (!self.targetname)
- {
- remove (self);
- return;
- }
-
- // switchable light
- if (self.style >= 32)
- {
- self.use = light_use;
- if (self.spawnflags & START_OFF)
- {
- self.count = 0;
- lightstyle (self.style, "a");
- }
- else
- {
- self.count = 12;
- lightstyle (self.style, lightstyle_lookup(self.style2));
- }
- }
-};
-
-/*QUAKED light_fluoro (0 1 0) (-8 -8 -8) (8 8 8) START_OFF FADE_IN_OUT X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-
-Non-displayed light.
-Makes steady fluorescent humming sound.
-See the "light" entity for a full description.
-*/
-void() light_fluoro =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- ambient_light_buzz ();
- light ();
-};
-
-/*QUAKED light_fluorospark (0 1 0) (-8 -8 -8) (8 8 8) START_OFF FADE_IN_OUT X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-
-Non-displayed light.
-Makes sparking, broken fluorescent sound.
-Can't be toggled.
-Default style is 10.
-See the "light" entity for a full description.
-*/
-void() light_fluorospark =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (!self.style)
- self.style = 10;
- ambient_flouro_buzz ();
- remove (self);
-};
-
-/*QUAKED light_globe (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-Sphere globe light.
-Can't be toggled.
-See the "light" entity for a full description.
-*/
-void() light_globe =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/s_light.spr");
- setmodel (self, "progs/s_light.spr");
- makestatic (self);
-};
-
-/*QUAKED light_torch_small_walltorch (0 .5 0) (-10 -10 -20) (10 10 20) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model ("progs/flame.mdl"); }
-Short wall torch
-See the "light" entity for a full description.
-*/
-void() light_torch_small_walltorch =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- // precache_model ("progs/flame.mdl");
- precache_body_model ("progs/flame.mdl");
- // setmodel (self, "progs/flame.mdl");
- body_model ("progs/flame.mdl");
- // for silent torch -- dumptruck_ds
- if !(self.spawnflags && SILENT_TORCH)
- FireAmbient ();
- makestatic (self);
-};
-
-/*QUAKED light_flame_large_yellow (0 1 0) (-10 -10 -12) (12 12 18) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model ( { "path" : "progs/flame2.mdl", "frame" : 1 } ); }
-Large yellow flame
-See the "light" entity for a full description.
-*/
-void() light_flame_large_yellow =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/flame2.mdl");
- setmodel (self, "progs/flame2.mdl");
- self.frame = 1;
- FireAmbient ();
- makestatic (self);
-};
-
-/*QUAKED light_flame_small_yellow (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model ("progs/flame2.mdl"); }
-Small yellow flame
-See the "light" entity for a full description.
-*/
-void() light_flame_small_yellow =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/flame2.mdl");
- setmodel (self, "progs/flame2.mdl");
- FireAmbient ();
- makestatic (self);
-};
-
-/*QUAKED light_flame_small_white (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model ("progs/flame2.mdl"); }
-Left for compatability
-Identical to "light_flame_small_yellow"
-*/
-void() light_flame_small_white =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- light_flame_small_yellow ();
-};
-
-/*QUAKED light_sprite_flame (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model ("progs/s_flame.spr"); }
-Large flame spite*/
-void() light_sprite_flame =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/s_flame.spr");
- setmodel (self, "progs/s_flame.spr");
- FireAmbient ();
-
- self.frame = rint(random() * 13);
- self.first_frame = 0;
- self.last_frame = 13;
- self.speed = 0.05;
- self.think = misc_model_think;
- self.nextthink = time + 0.1;
-};

Return to the top of this page or return to the overview of this repo.

Diff qc/misc.qc

diff --git a/qc/misc.qc b/qc/misc.qc
deleted file mode 100644
index ce251f5..0000000
--- a/qc/misc.qc
+++ /dev/null
@@ -1,1341 +0,0 @@
-// these were moved for various reasons -- dumptruck_ds
-// /*QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4)
-// Used as a positional target for spotlights, etc.
-// */
-// /void() info_null =
-// {
-// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
-// return;
-//
-// remove(self);
-// };
-//
-// /*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4)
-// Used as a positional target for lightning.
-// */
-// void() info_notnull =
-// {
-// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
-// return;
-// };
-//
-// //============================================================================
-//
-// float START_OFF = 1;
-//
-// void() light_use =
-// {
-// if (self.spawnflags & START_OFF)
-// {
-// lightstyle(self.style, "m");
-// self.spawnflags = self.spawnflags - START_OFF;
-// }
-// else
-// {
-// lightstyle(self.style, "a");
-// self.spawnflags = self.spawnflags + START_OFF;
-// }
-// };
-//
-// /*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, it will toggle between on or off.
-// */
-// void() light =
-// {
-// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
-// return;
-//
-// if (!self.targetname)
-// { // inert light
-// remove(self);
-// return;
-// }
-//
-// if (self.style >= 32)
-// {
-// self.use = light_use;
-// if (self.spawnflags & START_OFF)
-// lightstyle(self.style, "a");
-// else
-// lightstyle(self.style, "m");
-// }
-// };
-//
-// /*QUAKED light_fluoro (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, it will toggle between on or off.
-// Makes steady fluorescent humming sound
-// */
-// void() light_fluoro =
-// {
-// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
-// return;
-//
-// if (self.style >= 32)
-// {
-// self.use = light_use;
-// if (self.spawnflags & START_OFF)
-// lightstyle(self.style, "a");
-// else
-// lightstyle(self.style, "m");
-// }
-//
-// precache_sound ("ambience/fl_hum1.wav");
-// ambientsound (self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC);
-// };
-//
-// /*QUAKED light_fluorospark (0 1 0) (-8 -8 -8) (8 8 8)
-// Non-displayed light.
-// Default light value is 300
-// Default style is 10
-// Makes sparking, broken fluorescent sound
-// */
-// void() light_fluorospark =
-// {
-// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
-// return;
-//
-// if (!self.style)
-// self.style = 10;
-//
-// precache_sound ("ambience/buzz1.wav");
-// ambientsound (self.origin, "ambience/buzz1.wav", 0.5, ATTN_STATIC);
-// };
-//
-// /*QUAKED light_globe (0 1 0) (-8 -8 -8) (8 8 8)
-// Sphere globe light.
-// Default light value is 300
-// Default style is 0
-// */
-// void() light_globe =
-// {
-// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
-// return;
-//
-// precache_model ("progs/s_light.spr");
-// setmodel (self, "progs/s_light.spr");
-// makestatic (self);
-// };
-//
-/*QUAKED FireAmbient (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
-*/
-void() FireAmbient =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_sound ("ambience/fire1.wav");
-// attenuate fast
- ambientsound (self.origin, "ambience/fire1.wav", 0.5, ATTN_STATIC);
-};
-
-/*QUAKED ambient_fire (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-ambinet fire sound effects added for consistency
-same as FireAmbient
-*/
-void() ambient_fire =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
-FireAmbient();
-};
-
-//
-// /*QUAKED light_torch_small_walltorch (0 .5 0) (-10 -10 -20) (10 10 20)
-// Short wall torch
-// Default light value is 200
-// Default style is 0
-// */
-// void() light_torch_small_walltorch =
-// {
-// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
-// return;
-//
-// precache_model ("progs/flame.mdl");
-// setmodel (self, "progs/flame.mdl");
-// FireAmbient ();
-// makestatic (self);
-// };
-//
-// /*QUAKED light_flame_large_yellow (0 1 0) (-10 -10 -12) (12 12 18)
-// Large yellow flame ball
-// */
-// void() light_flame_large_yellow =
-// {
-// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
-// return;
-//
-// precache_model ("progs/flame2.mdl");
-// setmodel (self, "progs/flame2.mdl");
-// self.frame = 1;
-// FireAmbient ();
-// makestatic (self);
-// };
-//
-// /*QUAKED light_flame_small_yellow (0 1 0) (-8 -8 -8) (8 8 8) START_OFF
-// Small yellow flame ball
-// */
-// void() light_flame_small_yellow =
-// {
-// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
-// return;
-//
-// precache_model ("progs/flame2.mdl");
-// setmodel (self, "progs/flame2.mdl");
-// FireAmbient ();
-// makestatic (self);
-// };
-//
-// /*QUAKED light_flame_small_white (0 1 0) (-10 -10 -40) (10 10 40) START_OFF
-// Small white flame ball
-// */
-// void() light_flame_small_white =
-// {
-// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
-// return;
-//
-// precache_model ("progs/flame2.mdl");
-// setmodel (self, "progs/flame2.mdl");
-// FireAmbient ();
-// makestatic (self);
-// };
-//
-/*QUAKED light_candle (0 1 0) (-10 -10 -40) (10 10 40) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model("progs/candle.mdl"); }
-==========
-Spawnflags
-==========
-START_OFF - switchable lights only - light is off by default
-FADE_IN_OUT - switchable lights only - light fades in and out. can't be combined with animated lights.
-
-==========
-Keys
-==========
-"light" "n"
-Set the light intensity. Negative values are also allowed and will cause the entity to subtract light cast by other entities. Default 300.
-
-"wait" "n"
-Scale the fade distance of the light by "n". Values of n > 1 make the light fade more quickly with distance, and values < 1 make the light fade more slowly (and thus reach further). Default 1.
-
-"delay" "n"
-Select an attenuation formaula for the light:
-0 => Linear attenuation (default)
-1 => 1/x attenuation
-2 => 1/(x^2) attenuation
-3 => No attenuation (same brightness at any distance)
-4 => "local minlight" - No attenuation and like minlight,
-it won't raise the lighting above it's light value.
-Unlike minlight, it will only affect surfaces within
-line of sight of the entity.
-5 => 1/(x^2) attenuation, but slightly more attenuated and
-without the extra bright effect that "delay 2" has
-near the source.
-
-"_falloff" "n"
-Sets the distance at which the light drops to 0, in map units.
-In this mode, "wait" is ignored and "light" only controls the brightness at the center of the light, and no longer affects the falloff distance.
-Only supported on linear attenuation (delay 0) lights currently.
-
-"_color" "r g b"
-Specify red(r), green(g) and blue(b) components for the colour of the light. RGB component values are between 0 and 255 (between 0 and 1 is also accepted). Default is white light ("255 255 255").
-
-"target" "name"
-Turns the light into a spotlight, with the direction of light being towards another entity with it�s "targetname" key set to "name".
-"mangle" "yaw pitch roll"
-Turns the light into a spotlight and specifies the direction of light using yaw, pitch and roll in degrees. Yaw specifies the angle around the Z-axis from 0 to 359 degrees and pitch specifies the angle from 90 (straight up) to -90 (straight down). Roll has no effect, so use any value (e.g. 0). Often easier than the "target" method.
-
-"angle" "n"
-Specifies the angle in degrees for a spotlight cone. Default 40.
-
-"_softangle" "n"
-Specifies the angle in degrees for an inner spotlight cone (must be less than the "angle" cone. Creates a softer transition between the full brightness of the inner cone to the edge of the outer cone. Default 0 (disabled).
-
-"targetname" "name"
-Turns the light into a switchable light, toggled by another entity targeting it�s name.
-
-"speed" "n"
-If the light is switchable and FADE_IN_OUT is set, the speed at which the light transitions. Default 0.1.
-
-"style" "n"
-Set the animated light style. Default 0.
-
-"style2" "n"
-Set the animated light style for a switchable light, because style will be overriden if a targetname is set. Default 0.
-
-"_anglescale" "n" | "_anglesense" "n"
-Sets a scaling factor for how much influence the angle of incidence of light on a surface has on the brightness of the surface. n must be between 0.0 and 1.0. Smaller values mean less attenuation, with zero meaning that angle of incidence has no effect at all on the brightness. Default 0.5.
-
-"_dirtscale" "n" | "_dirtgain" "n"
-Override the global "_dirtscale" or "_dirtgain" settings to change how this light is affected by dirtmapping (ambient occlusion). See descriptions of these keys in the worldspawn section.
-
-"_dirt" "n"
-Overrides the worldspawn setting of "_dirt" for this particular light. -1 to disable dirtmapping (ambient occlusion) for this light, making it illuminate the dirtmapping shadows. 1 to enable ambient occlusion for this light. Default is to defer to the worldspawn setting.
-
-"_deviance" "n"
-Split up the light into a sphere of randomly positioned lights within radius "n" (in world units). Useful to give shadows a wider penumbra. "_samples" specifies the number of lights in the sphere. The "light" value is automatically scaled down for most lighting formulas (except linear and non-additive minlight) to attempt to keep the brightness equal. Default is 0, do not split up lights.
-
-"_samples" "n"
-Number of lights to use for "_deviance". Default 16 (only used if "_deviance" is set).
-
-"_surface" "texturename"
-Makes surfaces with the given texture name emit light, by using this light as a template which is copied across those surfaces. Lights are spaced about 128 units (though possibly closer due to bsp splitting) apart and positioned 2 units above the surfaces.
-
-"_surface_offset" "n"
-Controls the offset lights are placed above surfaces for "_surface". Default 2.
-
-"_surface_spotlight" "n"
-For a surface light template (i.e. a light with "_surface" set), setting this to "1" makes each instance into a spotlight, with the direction of light pointing along the surface normal. In other words, it automatically sets "mangle" on each of the generated lights.
-
-"_project_texture" "texture"
-Specifies that a light should project this texture. The texture must be used in the map somewhere.
-
-"_project_mangle" "yaw pitch roll"
-Specifies the yaw/pitch/roll angles for a texture projection (overriding mangle).
-
-"_project_fov" "n"
-Specifies the fov angle for a texture projection. Default 90.
-
-"_bouncescale" "n"
-Scales the amount of light that is contributed by bounces. Default is 1.0, 0.0 disables bounce lighting for this light.
-
-"_sun" "n"
-Set to 1 to make this entity a sun, as an alternative to using the sunlight worldspawn keys. If the light targets an info_null entity, the direction towards that entity sets sun direction. The light itself is disabled, so it can be placed anywhere in the map.
-
-The following light properties correspond to these sunlight settings:
-light => _sunlight
-mangle => _sunlight_mangle
-deviance => _sunlight_penumbra
-_color => _sunlight_color
-_dirt => _sunlight_dirt
-_anglescale => _anglescale
-
- //dumptruck_ds taken from honey (originally from Rogue)
-White candle
-*/
-void() light_candle =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model ("progs/candle.mdl");
- setmodel (self, "progs/candle.mdl");
- makestatic (self);
-};
-
-void() model_candle_think =
-{
- self.frame = self.frame + 1;
- if (self.frame > 3)
- self.frame = 0;
- self.nextthink = time + 0.1;
-};
-
-void() model_candle =
-{
-
- precache_model ("progs/candle.mdl");
-
- setmodel (self, "progs/candle.mdl");
-
- self.think = model_candle_think;
- self.nextthink = time + 0.1;
-};
-
-
-//============================================================================
-
-
-/*QUAKED misc_fireball (0 .5 .8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model ("progs/lavaball.mdl"); }
-Flying lava balls
-speed - set vertical speed of fireballs. default 1000.
-*/
-
-void() fire_fly;
-void() fire_touch;
-void() misc_fireball =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_model ("progs/lavaball.mdl");
- self.classname = "fireball";
-// 1998-08-14 Incorrect setting of nextthink fix by Maddes/Lord Sméagol
-// self.nextthink = time + (random() * 5);
- self.nextthink = time + 0.1 + (random() * 5);
-// 1998-08-14 Incorrect setting of nextthink fix by Maddes/Lord Sméagol
- self.think = fire_fly;
- if (!self.speed)
- self.speed = 1000; // fixed typo QIP - dumptruck_ds
-};
-
-void() fire_fly =
-{
-local entity fireball;
-
- fireball = spawn();
- fireball.solid = SOLID_TRIGGER;
- fireball.movetype = MOVETYPE_TOSS;
- fireball.velocity = '0 0 1000';
- fireball.velocity_x = (random() * 100) - 50;
- fireball.velocity_y = (random() * 100) - 50;
- fireball.velocity_z = self.speed + (random() * 200);
- fireball.classname = "fireball";
- setmodel (fireball, "progs/lavaball.mdl");
- setsize (fireball, '0 0 0', '0 0 0');
- setorigin (fireball, self.origin);
- fireball.nextthink = time + 5;
- fireball.think = SUB_Remove;
- fireball.touch = fire_touch;
-
- self.nextthink = time + (random() * 5) + 3;
- self.think = fire_fly;
-};
-
-
-void() fire_touch =
-{
- T_Damage (other, self, self, 20);
- remove(self);
-};
-
-//============================================================================
-
-
-void() barrel_explode =
-{
- self.takedamage = DAMAGE_NO;
- self.classname = "explo_box";
- // did say self.owner
- T_RadiusDamage (self, self, 160, world);
- sound (self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
- particle (self.origin, '0 0 0', 75, 255);
-
- self.origin_z = self.origin_z + 32;
- BecomeExplosion ();
-};
-
-
-
-/*QUAKED misc_explobox (0 .5 .8) (0 0 0) (32 32 64) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
- model("maps/b_explob.bsp");
-}
-Explosive box
-*/
-
-void() misc_explobox =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- local float oldz;
-
- self.solid = SOLID_BBOX;
- self.movetype = MOVETYPE_NONE;
- precache_model ("maps/b_explob.bsp");
- setmodel (self, "maps/b_explob.bsp");
- precache_sound ("weapons/r_exp3.wav");
- self.health = 20;
- self.th_die = barrel_explode;
- self.takedamage = DAMAGE_AIM;
- self.touch = monster_touch; // 1998-09-16 Sliding/not-jumping on monsters/boxes/players fix by Maddes/Kryten
-
- self.origin_z = self.origin_z + 2;
- oldz = self.origin_z;
- droptofloor();
- if (oldz - self.origin_z > 250)
- {
- dprint ("item fell out of level at ");
- dprint (vtos(self.origin));
- dprint ("\n");
- remove(self);
- }
-};
-
-
-
-
-/*QUAKED misc_explobox2 (0 .5 .8) (0 0 0) (32 32 64) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
- model("maps/b_exbox2.bsp");
-}
-Smaller explosive box
-*/
-
-void() misc_explobox2 =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- local float oldz;
-
- self.solid = SOLID_BBOX;
- self.movetype = MOVETYPE_NONE;
- precache_model2 ("maps/b_exbox2.bsp");
- setmodel (self, "maps/b_exbox2.bsp");
- precache_sound ("weapons/r_exp3.wav");
- self.health = 20;
- self.th_die = barrel_explode;
- self.takedamage = DAMAGE_AIM;
- self.touch = monster_touch; // 1998-09-16 Sliding/not-jumping on monsters/boxes/players fix by Maddes/Kryten
-
- self.origin_z = self.origin_z + 2;
- oldz = self.origin_z;
- droptofloor();
- if (oldz - self.origin_z > 250)
- {
- dprint ("item fell out of level at ");
- dprint (vtos(self.origin));
- dprint ("\n");
- remove(self);
- }
-};
-
-/*==============================================================================
-trap_spikeshooter from Hipnotic -- with additions by dumptruck_ds
-==============================================================================*/
-
-//MED 11/09/96 added new spawnflags -- taken from hipdefs.qc - dumptruck_ds
-float SPAWNFLAG_SUPERSPIKE = 1;
-float SPAWNFLAG_LASER = 2;
-float SPAWNFLAG_LAVABALL = 4;
-float SPAWNFLAG_ROCKET = 8;
-float SPAWNFLAG_VOREBALL = 16;
-float SPAWNFLAG_GRENADE = 32;
-float SPAWNFLAG_GIBS = 64;
-float SPAWNFLAG_SILENT = 128;
-
-void() ShalMissileTouch = //moved from Shalrath to enable shooter version
-{
- if (other == self.owner)
- return; // don't explode on owner
-
- if (other.classname == "monster_zombie")
- T_Damage (other, self, self, 110);
- T_RadiusDamage (self, self.owner, 40, world);
- sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
-
- WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
- WriteByte (MSG_BROADCAST, TE_EXPLOSION);
- WriteCoord (MSG_BROADCAST, self.origin_x);
- WriteCoord (MSG_BROADCAST, self.origin_y);
- WriteCoord (MSG_BROADCAST, self.origin_z);
-
- BecomeExplosion ();
-
-
- // self.velocity = '0 0 0';
- // self.touch = SUB_Null;
- // setmodel (self, "progs/s_explod.spr");
- // self.solid = SOLID_NOT;
- // s_explode1 ();
-};
-
-void() ZombieGrenadeTouch = //moved from zombie.qc to enable shooter version
-{
- if (other == self.owner)
- return; // don't explode on owner
- if (other.takedamage)
- {
- T_Damage (other, self, self.owner, 10 );
- sound (self, CHAN_WEAPON, "zombie/z_hit.wav", 1, ATTN_NORM);
- remove (self);
- return;
- }
- sound (self, CHAN_WEAPON, "zombie/z_miss.wav", 1, ATTN_NORM); // bounce sound
- self.velocity = '0 0 0';
- self.avelocity = '0 0 0';
- self.touch = SUB_Remove;
-};
-
-
-void(vector org, vector vec) LaunchLaser;
-
-//MED 11/09/96 added lava ball and rocket
-//dumptruck_ds added voreball and grenades
-void() spikeshooter_use =
-{
- local entity lavaball;
- local entity voreball;
- local entity rockettrap;
- local entity gnade;
- local entity zgibs;
-
- if (self.spawnflags & SPAWNFLAG_LASER)
- {
- if (!(self.spawnflags & SPAWNFLAG_SILENT))
- sound (self, CHAN_VOICE, "enforcer/enfire.wav", 1, ATTN_NORM);
- LaunchLaser (self.origin, self.movedir);
- newmis.spawnflags = self.spawnflags;
- }
- else if (self.spawnflags & SPAWNFLAG_LAVABALL)
- {
- if (!(self.spawnflags & SPAWNFLAG_SILENT))
- sound (self, CHAN_VOICE, "boss1/throw.wav", 1, ATTN_NORM); //dms
- // sound (self, CHAN_VOICE, "knight/sword2.wav", 1, ATTN_NORM); //dms
- // sound (self, CHAN_VOICE, "weapons/ax1.wav", 1, ATTN_NORM); //dms
- lavaball = spawn();
- lavaball.movetype = MOVETYPE_FLYMISSILE;
- lavaball.solid = SOLID_BBOX;
- lavaball.classname = "lavaball";
- // set lavaball speed
- lavaball.velocity = self.movedir * 600; //was 300 dms
- lavaball.angles = vectoangles(lavaball.velocity);
- lavaball.owner = self;
- lavaball.touch = ShalMissileTouch;
- setmodel (lavaball, "progs/lavaball.mdl"); //dms
- setsize (lavaball, '0 0 0', '0 0 0');
- setorigin (lavaball, self.origin);
- lavaball.avelocity = '0 0 400';
- lavaball.nextthink = time + 5;
- lavaball.think = SUB_Remove;
- }
-
- else if (self.spawnflags & SPAWNFLAG_ROCKET)
- {
- if (!(self.spawnflags & SPAWNFLAG_SILENT))
- sound (self, CHAN_VOICE, "weapons/sgun1.wav", 1, ATTN_NORM);
- rockettrap = spawn();
- rockettrap.movetype = MOVETYPE_FLYMISSILE;
- rockettrap.solid = SOLID_BBOX;
- rockettrap.classname = "rockettrap";
- // set rocket speed
- rockettrap.velocity = self.movedir * 1000;
- rockettrap.angles = vectoangles(rockettrap.velocity);
- rockettrap.owner = self;
- rockettrap.touch = T_MissileTouch;
- setmodel (rockettrap, "progs/missile.mdl"); //dms
- setsize (rockettrap, '0 0 0', '0 0 0');
- setorigin (rockettrap, self.origin);
- // rockettrap.avelocity = '0 0 400';
- rockettrap.nextthink = time + 5;
- rockettrap.think = SUB_Remove;
- }
- else if (self.spawnflags & SPAWNFLAG_VOREBALL)
- {
- if (!(self.spawnflags & SPAWNFLAG_SILENT))
- sound (self, CHAN_VOICE, "shalrath/attack2.wav", 1, ATTN_NORM);
- voreball = spawn();
- voreball.movetype = MOVETYPE_FLYMISSILE;
- voreball.solid = SOLID_BBOX;
- voreball.classname = "voreball";
- // set voreball speed
- voreball.velocity = self.movedir * 600; //was 300 dms
- voreball.angles = vectoangles(voreball.velocity);
- voreball.owner = self;
- voreball.touch = ShalMissileTouch;
- setmodel (voreball, "progs/v_spike.mdl"); //dms
- setsize (voreball, '0 0 0', '0 0 0');
- setorigin (voreball, self.origin);
- voreball.avelocity = '0 0 400';
- voreball.nextthink = time + 5;
- voreball.think = SUB_Remove;
- }
-
- else if (self.spawnflags & SPAWNFLAG_GRENADE)
- {
- if (!(self.spawnflags & SPAWNFLAG_SILENT))
- sound (self, CHAN_VOICE, "weapons/grenade.wav", 1, ATTN_NORM);
- gnade = spawn();
- gnade.movetype = MOVETYPE_BOUNCE;
- // gnade.movetype = MOVETYPE_FLYMISSILE;
- gnade.solid = SOLID_BBOX;
- gnade.classname = "gnade";
- // set grenade speed
- // gnade.velocity = self.movedir * 600; //was 300 dms
- gnade.velocity = self.movedir * 600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
- gnade.angles = vectoangles(gnade.velocity);
- gnade.owner = self;
- gnade.touch = GrenadeTouch;
- setmodel (gnade, "progs/grenade.mdl"); //dms
- setsize (gnade, '0 0 0', '0 0 0');
- setorigin (gnade, self.origin);
- gnade.avelocity = '300 300 300';
- gnade.nextthink = time + 2.5;
- gnade.think = GrenadeExplode;
- }
-
- else if (self.spawnflags & SPAWNFLAG_GIBS)
- {
- if (!(self.spawnflags & SPAWNFLAG_SILENT))
- sound (self, CHAN_VOICE, "zombie/z_shot1.wav", 1, ATTN_NORM);
- zgibs = spawn ();
- zgibs.owner = self;
- zgibs.movetype = MOVETYPE_BOUNCE;
- zgibs.solid = SOLID_BBOX;
- zgibs.classname = "zgibs";
- setmodel (zgibs, "progs/zom_gib.mdl");
- setsize (zgibs, '0 0 0', '0 0 0');
- setorigin (zgibs, self.origin);
- zgibs.velocity = self.movedir * 600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
- zgibs.avelocity = '3000 1000 2000';
- zgibs.touch = ZombieGrenadeTouch;
- // set missile duration
- zgibs.nextthink = time + 2.5;
- zgibs.think = SUB_Remove;
- }
-
- else
- {
- if (!(self.spawnflags & SPAWNFLAG_SILENT))
- sound (self, CHAN_VOICE, "weapons/spike2.wav", 1, ATTN_NORM);
- launch_spike (self.origin, self.movedir);
- newmis.velocity = self.movedir * 500;
- if (self.spawnflags & SPAWNFLAG_SUPERSPIKE)
- newmis.touch = superspike_touch;
- }
-};
-
-//MED 11/01/96 added state capability
-void() shooter_think =
-{
- if (self.state)
- {
- spikeshooter_use ();
- }
- self.nextthink = time + self.wait;
-};
-
-
-/*QUAKED trap_spikeshooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser lavaball rocket silent X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-
-When triggered, fires a spike in the direction set in QuakeEd.
-Laser is only for REGISTERED.
-*/
-
-//MED 11/01/96 commented out setmovedir
-void() trap_spikeshooter =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- if (self.proj_speed_mod <= 0)
- self.proj_speed_mod = 1;
- SetMovedir ();
- self.use = spikeshooter_use;
- if (self.spawnflags & SPAWNFLAG_LASER)
- {
- precache_model2 ("progs/laser.mdl");
-
- precache_sound2 ("enforcer/enfire.wav");
- precache_sound2 ("enforcer/enfstop.wav");
- }
- else if (self.spawnflags & SPAWNFLAG_LAVABALL)
- {
- precache_model ("progs/lavaball.mdl");
- // precache_sound2 ("knight/sword2.wav"); //dms
- precache_sound2 ("boss1/throw.wav"); //dms
- }
- else if (self.spawnflags & SPAWNFLAG_ROCKET)
- {
- precache_model ("progs/missile.mdl");
- precache_sound ("weapons/sgun1.wav");
- }
- else if (self.spawnflags & SPAWNFLAG_VOREBALL)
- {
- precache_model ("progs/v_spike.mdl");
- precache_sound ("shalrath/attack2.wav");
- }
- else if (self.spawnflags & SPAWNFLAG_GRENADE)
- {
- precache_model ("progs/grenade.mdl");
- precache_sound ("weapons/grenade.wav"); // grenade launcher
- }
- else if (self.spawnflags & SPAWNFLAG_GIBS)
- {
- precache_model ("progs/zom_gib.mdl");
- precache_sound ("zombie/z_shot1.wav"); // Zombie gibs
- precache_sound ("zombie/z_miss.wav");
- precache_sound ("zombie/z_hit.wav");
- }
-
- else
- precache_sound ("weapons/spike2.wav");
-};
-
-
-/*QUAKED trap_shooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser lavaball rocket silent X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-Continuously fires spikes.
-"wait" time between spike (1.0 default)
-"nextthink" delay before firing first spike, so multiple shooters can be stagered.
-*/
-void() trap_shooter =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- trap_spikeshooter ();
-
- if (self.wait == 0)
- self.wait = 1;
-//MED 11/01/96 added state capability
- self.state = 1;
- self.nextthink = self.nextthink + self.wait + self.ltime;
- self.think = shooter_think;
-};
-
-//MED 11/01/96 added new use function
-void() trap_shooter_use =
- {
- self.state = 1 - self.state;
- };
-//MED 11/01/96 added new function
-/*QUAKED trap_switched_shooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser lavaball rocket silent X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-Continuously fires spikes.
-"wait" time between spike (1.0 default)
-"nextthink" delay before firing first spike, so multiple shooters can be stagered.
-"state" 0 initially off, 1 initially on. (0 default)
-*/
-void() trap_switched_shooter =
- {
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- trap_spikeshooter ();
-
- if (self.wait == 0)
- self.wait = 1;
-//MED 11/01/96 added state capability
- self.nextthink = self.nextthink + self.wait + self.ltime;
- self.think = shooter_think;
- self.use = trap_shooter_use;
- };
-
-/*
-===============================================================================
-
-
-===============================================================================
-*/
-
-
-void() make_bubbles;
-void() bubble_remove;
-void() bubble_bob;
-
-/*QUAKED air_bubbles (0 .5 .8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-
-air bubbles entity
-
-*/
-
-void() air_bubbles =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- if (deathmatch)
- {
- remove (self);
- return;
- }
- precache_model ("progs/s_bubble.spr");
- self.nextthink = time + 1;
- self.think = make_bubbles;
-};
-
-void() make_bubbles =
-{
-local entity bubble;
-
- bubble = spawn();
- setmodel (bubble, "progs/s_bubble.spr");
- setorigin (bubble, self.origin);
- bubble.movetype = MOVETYPE_NOCLIP;
- bubble.solid = SOLID_NOT;
- bubble.velocity = '0 0 15';
- bubble.nextthink = time + 0.5;
- bubble.think = bubble_bob;
- bubble.touch = bubble_remove;
- bubble.classname = "bubble";
- bubble.frame = 0;
- bubble.cnt = 0;
- setsize (bubble, '-8 -8 -8', '8 8 8');
- self.nextthink = time + random() + 0.5;
- self.think = make_bubbles;
-};
-
-void() bubble_split =
-{
-local entity bubble;
- bubble = spawn();
- setmodel (bubble, "progs/s_bubble.spr");
- setorigin (bubble, self.origin);
- bubble.movetype = MOVETYPE_NOCLIP;
- bubble.solid = SOLID_NOT;
- bubble.velocity = self.velocity;
- bubble.nextthink = time + 0.5;
- bubble.think = bubble_bob;
- bubble.touch = bubble_remove;
- bubble.classname = "bubble";
- bubble.frame = 1;
- bubble.cnt = 10;
- setsize (bubble, '-8 -8 -8', '8 8 8');
- self.frame = 1;
- self.cnt = 10;
- if (self.waterlevel != 3)
- remove (self);
-};
-
-void() bubble_remove =
-{
- if (other.classname == self.classname)
- {
-// dprint ("bump");
- return;
- }
- remove(self);
-};
-
-void() bubble_bob =
-{
-local float rnd1, rnd2, rnd3;
-
-
- self.cnt = self.cnt + 1;
- if (self.cnt == 4)
- bubble_split();
- if (self.cnt == 20)
- remove(self);
-
- rnd1 = self.velocity_x + (-10 + (random() * 20));
- rnd2 = self.velocity_y + (-10 + (random() * 20));
- rnd3 = self.velocity_z + 10 + random() * 10;
-
- if (rnd1 > 10)
- rnd1 = 5;
- if (rnd1 < -10)
- rnd1 = -5;
-
- if (rnd2 > 10)
- rnd2 = 5;
- if (rnd2 < -10)
- rnd2 = -5;
-
- if (rnd3 < 10)
- rnd3 = 15;
- if (rnd3 > 30)
- rnd3 = 25;
-
- self.velocity_x = rnd1;
- self.velocity_y = rnd2;
- self.velocity_z = rnd3;
-
- self.nextthink = time + 0.5;
- self.think = bubble_bob;
-};
-
-/*~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>
-~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~*/
-
-/*QUAKED viewthing (0 .5 .8) (-8 -8 -8) (8 8 8)
-
-Just for the debugging level. Don't use
-*/
-
-void() viewthing =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_NOT;
- precache_model ("progs/player.mdl");
- setmodel (self, "progs/player.mdl");
-};
-
-/*
-misc_infight
-
-target = monster that gets mad
-target2 = who target1 will be angry at
-
-spawnflag 1 = mutual hate, both targets get angry at each other instantly
-spawnflag 2 = maintain activator, makes it so the player that triggers the infighting sees centerprints triggered by it
-*/
-
-float INFIGHT_MUTUAL = 1;
-float INFIGHT_PLAYER_ACTIVATION = 2;
-
-void(entity t1, entity t2) make_angry_at =
-{
- if (t2.health > 0 && t1.health > 0) { // checks if targets are alive
- if (t1.enemy.classname == "player")
- t1.oldenemy = t1.enemy;
- t1.enemy = t2;
-
- entity oself = self;
- self = t1; // FoundTarget() only acts on self
- FoundTarget();
- self = oself;
- }
-};
-
-void() misc_infight_use =
-{
- local entity t1, t2;
-
- for (t1 = world; (t1 = find(t1, targetname, self.target)); )
- {
- for (t2 = world; (t2 = find(t2, targetname, self.target2)); )
- {
- // t1 = find(world, targetname, self.target);
- // t2 = find(world, targetname, self.target2);
-
- if (!t1)
- {
- dprint("[trigger_infight] Cannot find target, checking targetname2\n");
- t1 = find(world, targetname2, self.target);
- }
- if (!t1)
- {
- dprint("[trigger_infight] Cannot find target, checking targetname3\n");
- t1 = find(world, targetname3, self.target);
- }
- if (!t1)
- {
- dprint("[trigger_infight] Cannot find target, checking targetname4\n");
- t1 = find(world, targetname4, self.target);
- }
- if (!t1)
- {
- dprint("[trigger_infight] Cannot find target, exhausted all targetnames\n");
- return;
- }
- if (!t2)
- {
- dprint("[trigger_infight] Cannot find target2 checking targetname2\n");
- t2 = find(world, targetname2, self.target2);
- }
- if (!t2)
- {
- dprint("[trigger_infight] Cannot find target2 checking targetname3\n");
- t2 = find(world, targetname3, self.target2);
- }
- if (!t2)
- {
- dprint("[trigger_infight] Cannot find target2 checking targetname4\n");
- t2 = find(world, targetname4, self.target2);
- }
- if (!t2)
- {
- dprint("[trigger_infight] Cannot find target2, exhausted all targetnames\n");
- return;
- }
-
- make_angry_at(t1, t2);
-
- if (self.spawnflags & INFIGHT_PLAYER_ACTIVATION)
- {
- t1.infight_activator = activator;
- t2.infight_activator = activator;
- }
-
- if (self.spawnflags & INFIGHT_MUTUAL)
- make_angry_at(t2, t1);
- }
- }
-};
-
-void() misc_infight =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- self.use = misc_infight_use;
-};
-
-
-
-
-
-//============================================================================
-/*QUAKED ambient_suck_wind (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-*/
-void() ambient_suck_wind =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_sound ("ambience/suck1.wav");
- ambientsound (self.origin, "ambience/suck1.wav", 1, ATTN_STATIC);
-};
-
-/*QUAKED ambient_drone (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-*/
-void() ambient_drone =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_sound ("ambience/drone6.wav");
- ambientsound (self.origin, "ambience/drone6.wav", 0.5, ATTN_STATIC);
-};
-
-/*QUAKED ambient_flouro_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-*/
-void() ambient_flouro_buzz =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_sound ("ambience/buzz1.wav");
- ambientsound (self.origin, "ambience/buzz1.wav", 1, ATTN_STATIC);
-};
-/*QUAKED ambient_drip (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-*/
-void() ambient_drip =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_sound ("ambience/drip1.wav");
- ambientsound (self.origin, "ambience/drip1.wav", 0.5, ATTN_STATIC);
-};
-/*QUAKED ambient_comp_hum (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-
-*/
-void() ambient_comp_hum =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_sound ("ambience/comp1.wav");
- ambientsound (self.origin, "ambience/comp1.wav", 1, ATTN_STATIC);
-};
-/*QUAKED ambient_light_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-*/
-void() ambient_light_buzz =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_sound ("ambience/fl_hum1.wav");
- ambientsound (self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC);
-};
-/*QUAKED ambient_swamp1 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-*/
-void() ambient_swamp1 =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_sound ("ambience/swamp1.wav");
- ambientsound (self.origin, "ambience/swamp1.wav", 0.5, ATTN_STATIC);
-};
-/*QUAKED ambient_swamp2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-*/
-void() ambient_swamp2 =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_sound ("ambience/swamp2.wav");
- ambientsound (self.origin, "ambience/swamp2.wav", 0.5, ATTN_STATIC);
-};
-/////////////////////////////////////////////////////////////
-////////// dumptruck_ds ////////////////////////////////////
-///////////////////////////////////////////////////////////
-
-/* Additions to Ambient Sound effects. These are hard coded into the engine and
- usually play back automatically when the sky or water textures are used. If
- you'd prefer to use these in custom setups, you can use the command line
- switch -nomabient in when you VIS your map to disable the hard coded sounds. */
-
-/*QUAKED ambient_water1 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-*/
-void() ambient_water1 =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_sound ("ambience/water1.wav");
- ambientsound (self.origin, "ambience/water1.wav", 1, ATTN_STATIC);
-};
-/*QUAKED ambient_wind2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-*/
-void() ambient_wind2 =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_sound ("ambience/wind2.wav");
- ambientsound (self.origin, "ambience/wind2.wav", 1, ATTN_STATIC);
-};
-/////////////////////////////////////////////////////////////
-////////// dumptruck_ds ////////////////////////////////////
-///////////////////////////////////////////////////////////
-
-/* The original ambient_thunder was included in Quake but the code was missing.
- This version is borrowed from the Zerstörer mod but modified to only play the
- original thumder1.wav included in the game. This is also different than the
- other ambient sounds as it plays back randomly as opposed to looping. You
- only need one of these in your level. It will play everywhere. */
-
-void() thunder_go_boom =
-{
- if (random() < 0.5)
- sound (self, CHAN_AUTO, "ambience/thunder1.wav", 0.7, ATTN_NONE);
- else
- sound (self, CHAN_AUTO, "ambience/thunder1.wav", 1, ATTN_NONE);
-
- self.think = thunder_go_boom;
- self.nextthink = time + 40*random();
-};
-
-/*QUAKED ambient_thunder (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-The original ambient_thunder was included in Quake but the code was missing.
-This version is borrowed from the Zerstörer mod but modified to only play the
-original thumder1.wav included in the game. This is also different than the
-other ambient sounds as it plays back randomly as opposed to looping. You
-only need one of these in your level. It will play everywhere.
-*/
-void() ambient_thunder =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- // changed from ambient to delayed sound (sounds better)
- precache_sound ("ambience/thunder1.wav");
- // precache_sound ("ambience/thunder2.wav"); this file in not included in the game
- self.think = thunder_go_boom;
- self.nextthink = time + random();
-};
-
-
-
-//============================================================================
-
-void() noise_think =
-{
- self.nextthink = time + 0.5;
- sound (self, 1, "enforcer/enfire.wav", 1, ATTN_NORM);
- sound (self, 2, "enforcer/enfstop.wav", 1, ATTN_NORM);
- sound (self, 3, "enforcer/sight1.wav", 1, ATTN_NORM);
- sound (self, 4, "enforcer/sight2.wav", 1, ATTN_NORM);
- sound (self, 5, "enforcer/sight3.wav", 1, ATTN_NORM);
- sound (self, 6, "enforcer/sight4.wav", 1, ATTN_NORM);
- sound (self, 7, "enforcer/pain1.wav", 1, ATTN_NORM);
-};
-
-/*QUAKED misc_noisemaker (1 0.5 0) (-10 -10 -10) (10 10 10) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-
-For optimzation testing, starts a lot of sounds.
-*/
-
-void() misc_noisemaker =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-
- precache_sound2 ("enforcer/enfire.wav");
- precache_sound2 ("enforcer/enfstop.wav");
- precache_sound2 ("enforcer/sight1.wav");
- precache_sound2 ("enforcer/sight2.wav");
- precache_sound2 ("enforcer/sight3.wav");
- precache_sound2 ("enforcer/sight4.wav");
- precache_sound2 ("enforcer/pain1.wav");
- precache_sound2 ("enforcer/pain2.wav");
- precache_sound2 ("enforcer/death1.wav");
- precache_sound2 ("enforcer/idle1.wav");
-
- self.nextthink = time + 0.1 + random();
- self.think = noise_think;
-};
-
-
-/***********************************************
-
-target_autosave
-from Copper
-
-***********************************************/
-
-void() target_autosave_use =
-{
- if (self.enemy)
- {
- activator = self.enemy;
- self.enemy = world;
- }
- if (activator.classname != "player") return;
- if (time < 2) // make sure an autosave fired from a player start doesn't happen too early
- {
- //if (serverflags & SVFL_RESPAWNING)
- //{
- // dprint("RESPAWNING flag set, skipping autosave\n");
- // return;
- //}
- self.enemy = activator;
- self.think = target_autosave_use;
- self.nextthink = 2;
- return;
- }
- // sound(activator, CHAN_VOICE, "misc/sav.wav", 0.3, ATTN_NORM);
- autosave(activator, self.message);
-}
-
-void() toggle_autosave =
-{
- entity e = world;
- float printed = FALSE;
- do {
- e = find(e, classname, "target_autosave");
- if (!e) break;
-
- if (e.use == target_autosave_use)
- {
- e.use = SUB_Null;
- if (!printed)
- {
- bprint("Autosaves disabled\n");
- printed = TRUE;
- }
- } else {
- e.use = target_autosave_use;
- if (!printed)
- {
- bprint("Autosaves reenabled\n");
- printed = TRUE;
- }
- }
-
- } while (e != world);
-}
-
-/*QUAKED target_autosave (1 .0 .5) (-8 -8 -8) (8 8 8)
-Saves the game when triggered by a player. Never appears in multiplayer. the bprint tends to stomp any other prints on screen in most quake clients, so use a delayed trigger_relay if you fire this from an important pickup/trigger_counter/something else that puts text on screen more important than the autosave blurb.
-
-Keys:
-"message" change save file name, defaults to 'auto'
-*/
-/*FGD
-@Pointclass base(Target, Targetname, Appearflags) color(255 0 128) size(32 32 32) = target_autosave :
-"Saves the game when triggered by a player. Never appears in multiplayer.
-the bprint tends to stomp any other prints on screen in most quake clients, so use a delayed trigger_relay if you fire this from an important pickup/trigger_counter/something else that puts text on screen more important than the autosave blurb."
-[
- message(string) : "Change save filename" : "auto"
-]
-*/
-void() target_autosave =
-{
- if (deathmatch || coop)
- {
- remove(self);
- return;
- }
-
-
- if (self.message == string_null)
- self.message = "auto";
- // precache_sound2("misc/sav.wav");
- self.use = target_autosave_use;
-}
-

Return to the top of this page or return to the overview of this repo.

Diff qc/misc/air_bubbles.qc

diff --git a/qc/misc/air_bubbles.qc b/qc/misc/air_bubbles.qc
new file mode 100644
index 0000000..e9f4ded
--- /dev/null
+++ b/qc/misc/air_bubbles.qc
@@ -0,0 +1,124 @@
+//==============================================================================
+// air_bubbles
+//==============================================================================
+
+// prototypes
+void() make_bubbles;
+void() bubble_remove;
+void() bubble_bob;
+
+/*QUAKED air_bubbles (0 .5 .8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+
+air bubbles entity
+
+*/
+void() air_bubbles =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (deathmatch)
+ {
+ remove (self);
+ return;
+ }
+
+ precache_model ("progs/s_bubble.spr");
+ self.nextthink = time + 1;
+ self.think = make_bubbles;
+};
+
+//----------------------------------------------------------------------
+void() make_bubbles =
+{
+ local entity bubble;
+
+ bubble = spawn ();
+ setmodel (bubble, "progs/s_bubble.spr");
+ setorigin (bubble, self.origin);
+ bubble.movetype = MOVETYPE_NOCLIP;
+ bubble.solid = SOLID_NOT;
+ bubble.velocity = '0 0 15';
+ bubble.nextthink = time + 0.5;
+ bubble.think = bubble_bob;
+ bubble.touch = bubble_remove;
+ bubble.classname = "bubble";
+ bubble.frame = 0;
+ bubble.cnt = 0;
+ setsize (bubble, '-8 -8 -8', '8 8 8');
+ self.nextthink = time + random() + 0.5;
+ self.think = make_bubbles;
+};
+
+//----------------------------------------------------------------------
+void() bubble_split =
+{
+ local entity bubble;
+ bubble = spawn ();
+ setmodel (bubble, "progs/s_bubble.spr");
+ setorigin (bubble, self.origin);
+ bubble.movetype = MOVETYPE_NOCLIP;
+ bubble.solid = SOLID_NOT;
+ bubble.velocity = self.velocity;
+ bubble.nextthink = time + 0.5;
+ bubble.think = bubble_bob;
+ bubble.touch = bubble_remove;
+ bubble.classname = "bubble";
+ bubble.frame = 1;
+ bubble.cnt = 10;
+ setsize (bubble, '-8 -8 -8', '8 8 8');
+ self.frame = 1;
+ self.cnt = 10;
+ if (self.waterlevel != 3)
+ remove (self);
+};
+
+//----------------------------------------------------------------------
+void() bubble_remove =
+{
+ if (other.classname == self.classname)
+ {
+ // dprint ("bump");
+ return;
+ }
+ remove (self);
+};
+
+//----------------------------------------------------------------------
+void() bubble_bob =
+{
+ local float rnd1, rnd2, rnd3;
+
+ self.cnt = self.cnt + 1;
+ if (self.cnt == 4)
+ bubble_split ();
+ if (self.cnt == 20)
+ remove (self);
+
+ rnd1 = self.velocity_x + (-10 + (random() * 20));
+ rnd2 = self.velocity_y + (-10 + (random() * 20));
+ rnd3 = self.velocity_z + 10 + random() * 10;
+
+ if (rnd1 > 10)
+ rnd1 = 5;
+ if (rnd1 < -10)
+ rnd1 = -5;
+
+ if (rnd2 > 10)
+ rnd2 = 5;
+ if (rnd2 < -10)
+ rnd2 = -5;
+
+ if (rnd3 < 10)
+ rnd3 = 15;
+ if (rnd3 > 30)
+ rnd3 = 25;
+
+ self.velocity_x = rnd1;
+ self.velocity_y = rnd2;
+ self.velocity_z = rnd3;
+
+ self.nextthink = time + 0.5;
+ self.think = bubble_bob;
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/misc/ambient_sound.qc

diff --git a/qc/misc/ambient_sound.qc b/qc/misc/ambient_sound.qc
new file mode 100644
index 0000000..8a500c8
--- /dev/null
+++ b/qc/misc/ambient_sound.qc
@@ -0,0 +1,259 @@
+//==============================================================================
+// ambient_sound -- miscellaneous ambient sound entities
+//==============================================================================
+
+//======================================================================
+//johnfitz -- ambient_general (this is from Rubicon Rumble dev kit)
+//======================================================================
+
+/*QUAKED ambient_general (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+Plays any looped sound
+
+Keys:
+
+"noise" is the wav file to play
+
+"volume" default 1
+
+"speed" attenuation, default 3
+*/
+void() ambient_general =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ // dumptruck_ds
+ if (!self.noise)
+ {
+ objerror ("no soundfile set in noise!\n");
+ remove (self);
+ return;
+ }
+
+ precache_sound (self.noise);
+
+ if (!self.speed)
+ {
+ self.speed = ATTN_NORM;
+ }
+
+ if (self.speed == 0)
+ self.speed = 1;
+ if (self.speed == -1)
+ // self.speed = 0;
+ self.speed = ATTN_NONE;
+
+ if (!self.volume)
+ {
+ self.volume = 0.5;
+ }
+
+ ambientsound (self.origin, self.noise, self.volume, self.speed);
+ remove (self);
+};
+
+//======================================================================
+
+/*QUAKED FireAmbient (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() FireAmbient =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_sound ("ambience/fire1.wav");
+ // attenuate fast
+ ambientsound (self.origin, "ambience/fire1.wav", 0.5, ATTN_STATIC);
+};
+
+/*QUAKED ambient_fire (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+ambinet fire sound effects added for consistency
+same as FireAmbient
+*/
+void() ambient_fire =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ FireAmbient ();
+};
+
+//======================================================================
+
+/*QUAKED ambient_comp_hum (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+
+*/
+void() ambient_comp_hum =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_sound ("ambience/comp1.wav");
+ ambientsound (self.origin, "ambience/comp1.wav", 1, ATTN_STATIC);
+};
+
+/*QUAKED ambient_drip (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+*/
+void() ambient_drip =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_sound ("ambience/drip1.wav");
+ ambientsound (self.origin, "ambience/drip1.wav", 0.5, ATTN_STATIC);
+};
+
+/*QUAKED ambient_drone (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+*/
+void() ambient_drone =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_sound ("ambience/drone6.wav");
+ ambientsound (self.origin, "ambience/drone6.wav", 0.5, ATTN_STATIC);
+};
+
+/*QUAKED ambient_flouro_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+*/
+void() ambient_flouro_buzz =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_sound ("ambience/buzz1.wav");
+ ambientsound (self.origin, "ambience/buzz1.wav", 1, ATTN_STATIC);
+};
+
+/*QUAKED ambient_light_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+*/
+void() ambient_light_buzz =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_sound ("ambience/fl_hum1.wav");
+ ambientsound (self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC);
+};
+
+/*QUAKED ambient_suck_wind (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+*/
+void() ambient_suck_wind =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_sound ("ambience/suck1.wav");
+ ambientsound (self.origin, "ambience/suck1.wav", 1, ATTN_STATIC);
+};
+
+/*QUAKED ambient_swamp1 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+*/
+void() ambient_swamp1 =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_sound ("ambience/swamp1.wav");
+ ambientsound (self.origin, "ambience/swamp1.wav", 0.5, ATTN_STATIC);
+};
+
+/*QUAKED ambient_swamp2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+*/
+void() ambient_swamp2 =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_sound ("ambience/swamp2.wav");
+ ambientsound (self.origin, "ambience/swamp2.wav", 0.5, ATTN_STATIC);
+};
+
+//======================================================================
+
+/////////////////////////////////////////////////////////////
+////////// dumptruck_ds ////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// Additions to Ambient Sound effects. These are hard coded into the engine and
+// usually play back automatically when the sky or water textures are used. If
+// you'd prefer to use these in custom setups, you can use the command line
+// switch -nomabient in when you VIS your map to disable the hard coded sounds.
+
+/*QUAKED ambient_water1 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+*/
+void() ambient_water1 =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_sound ("ambience/water1.wav");
+ ambientsound (self.origin, "ambience/water1.wav", 1, ATTN_STATIC);
+};
+
+/*QUAKED ambient_wind2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+*/
+void() ambient_wind2 =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_sound ("ambience/wind2.wav");
+ ambientsound (self.origin, "ambience/wind2.wav", 1, ATTN_STATIC);
+};
+
+/////////////////////////////////////////////////////////////
+////////// dumptruck_ds ////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// The original ambient_thunder was included in Quake but the code was missing.
+// This version is borrowed from the Zerstörer mod but modified to only play the
+// original thumder1.wav included in the game. This is also different than the
+// other ambient sounds as it plays back randomly as opposed to looping. You
+// only need one of these in your level. It will play everywhere.
+
+//----------------------------------------------------------------------
+void() thunder_go_boom =
+{
+ if (random() < 0.5)
+ sound (self, CHAN_AUTO, "ambience/thunder1.wav", 0.7, ATTN_NONE);
+ else
+ sound (self, CHAN_AUTO, "ambience/thunder1.wav", 1, ATTN_NONE);
+
+ self.think = thunder_go_boom;
+ self.nextthink = time + 40 * random ();
+};
+
+/*QUAKED ambient_thunder (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+The original ambient_thunder was included in Quake but the code was missing.
+This version is borrowed from the Zerstörer mod but modified to only play the
+original thumder1.wav included in the game. This is also different than the
+other ambient sounds as it plays back randomly as opposed to looping. You
+only need one of these in your level. It will play everywhere.
+*/
+void() ambient_thunder =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ // changed from ambient to delayed sound (sounds better)
+ precache_sound ("ambience/thunder1.wav");
+ // this file in not included in the game
+ // precache_sound ("ambience/thunder2.wav");
+ self.think = thunder_go_boom;
+ self.nextthink = time + random ();
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/misc/deadstuff.qc

diff --git a/qc/misc/deadstuff.qc b/qc/misc/deadstuff.qc
new file mode 100644
index 0000000..3bfbd42
--- /dev/null
+++ b/qc/misc/deadstuff.qc
@@ -0,0 +1,361 @@
+//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+// deadstuff.qc -- misc gore
+// Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
+//
+// deadstuff version 1.0 - tony collen - manero@canweb.net -
+// EfNet IRC #QuakeEd or #Trinity
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+/*QUAKED gib_head_demon (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_demon.mdl");
+}
+*/
+void() gib_head_demon =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/h_demon.mdl");
+ setmodel (self, "progs/h_demon.mdl");
+ self.frame = 0;
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize(self,'-13.64 -16.77 -0.11','17.44 16.22 30');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};
+
+/*QUAKED gib_head_dog (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_dog.mdl");
+}
+*/
+void() gib_head_dog =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/h_dog.mdl");
+ setmodel (self, "progs/h_dog.mdl");
+ self.frame = 0; // was 1 -- dumptruck_ds
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize (self,'-9.66 -11.89 -0.2','6.57 7.96 13.29');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};
+
+/*QUAKED gib_head_army (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_guard.mdl");
+}
+*/
+void() gib_head_army =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/h_guard.mdl");
+ setmodel (self, "progs/h_guard.mdl");
+ self.frame = 0;
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize (self,'-9.67 -8.27 -0.28','4.05 4.8 13.41');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};
+
+/*QUAKED gib_head_hell_knight (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_hellkn.mdl");
+}*/
+void() gib_head_hell_knight =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/h_hellkn.mdl");
+ setmodel (self, "progs/h_hellkn.mdl");
+ self.frame = 0;
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize (self,'-7.9 -12.97 -0.63','10.55 8.87 21.06');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};
+
+/*QUAKED gib_head_knight (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_knight.mdl");
+}*/
+void() gib_head_knight =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/h_knight.mdl");
+ setmodel (self, "progs/h_knight.mdl");
+ self.frame = 0;
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize (self,'-8.17 -7.47 -0.13','8.36 6.5 30');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};
+
+/*QUAKED gib_head_enforcer (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_mega.mdl");
+}
+*/
+void() gib_head_enforcer =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/h_mega.mdl");
+ setmodel (self, "progs/h_mega.mdl");
+ self.frame = 0;
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize (self,'-10.63 -10.23 -0.05','9.27 8.25 30');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};
+
+/*QUAKED gib_head_ogre (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_ogre.mdl");
+}*/
+void() gib_head_ogre =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/h_ogre.mdl");
+ setmodel (self, "progs/h_ogre.mdl");
+ self.frame = 0;
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize (self,'-12.35 -15.7 -0.17','10.67 13.88 30');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};
+
+/*QUAKED gib_head_player (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_player.mdl");
+}*/
+void() gib_head_player =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/h_player.mdl");
+ setmodel (self, "progs/h_player.mdl");
+ self.frame = 0;
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize (self,'-9.67 -12.38 -2.1','11.49 50.7 30');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};
+
+/*QUAKED gib_head_shalrath (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_shal.mdl");
+}*/
+void() gib_head_shalrath =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/h_shal.mdl");
+ setmodel (self, "progs/h_shal.mdl");
+ self.frame = 0;
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize (self,'-19.85 -19.09 -1.44','13.72 16.8 30');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};
+
+/*QUAKED gib_head_shambler (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_shams.mdl");
+}*/
+void() gib_head_shambler =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/h_shams.mdl");
+ setmodel (self, "progs/h_shams.mdl");
+ self.frame = 0; // was 1, caused an error -- dumptruck_ds
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize (self,'-15.15 -20.638 -0.45','21.44 21.76 30');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};
+
+/*QUAKED gib_head_wizard (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_wizard.mdl");
+}*/
+void() gib_head_wizard =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/h_wizard.mdl");
+ setmodel (self, "progs/h_wizard.mdl");
+ self.frame = 0;
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize (self,'-10.41 -8.66 -0.54','6.52 10.82 30');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};
+
+/*QUAKED gib_misc_1 (0 0.5 0.8) (-8 -8 -8) (8 8 8) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/gib1.mdl");
+}*/
+void() gib_misc_1 =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/gib1.mdl");
+ setmodel (self, "progs/gib1.mdl");
+ self.frame = 0;
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize (self,'-3.57 -8.06 -3.34','3.69 8.31 30');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};
+
+/*QUAKED gib_misc_2 (0 0.5 0.8) (-8 -8 -8) (8 8 8) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/gib2.mdl");
+}*/
+void() gib_misc_2 =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/gib2.mdl");
+ setmodel (self, "progs/gib2.mdl");
+ self.frame = 0;
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize (self,'-12.68 -14.83 -6.19','13.53 14.57 30');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};
+
+/*QUAKED gib_misc_3 (0 0.5 0.8) (-8 -8 -8) (8 8 8) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/gib3.mdl");
+}*/
+void() gib_misc_3 =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/gib3.mdl");
+ setmodel (self, "progs/gib3.mdl");
+ self.frame = 0;
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize (self,'-18.95 -15.92 -3.13','13.17 15.66 30');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/misc/explobox.qc

diff --git a/qc/misc/explobox.qc b/qc/misc/explobox.qc
new file mode 100644
index 0000000..9fff181
--- /dev/null
+++ b/qc/misc/explobox.qc
@@ -0,0 +1,93 @@
+//==============================================================================
+// misc_explobox
+//==============================================================================
+
+//----------------------------------------------------------------------
+void() barrel_explode =
+{
+ self.takedamage = DAMAGE_NO;
+ self.classname = "explo_box";
+ // did say self.owner
+ T_RadiusDamage (self, self, 160, world);
+ sound (self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
+ particle (self.origin, '0 0 0', 75, 255);
+
+ self.origin_z = self.origin_z + 32;
+ BecomeExplosion ();
+};
+
+/*QUAKED misc_explobox (0 .5 .8) (0 0 0) (32 32 64) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+ model("maps/b_explob.bsp");
+}
+Explosive box
+*/
+void() misc_explobox =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ local float oldz;
+
+ self.solid = SOLID_BBOX;
+ self.movetype = MOVETYPE_NONE;
+ precache_model ("maps/b_explob.bsp");
+ setmodel (self, "maps/b_explob.bsp");
+ precache_sound ("weapons/r_exp3.wav");
+ self.health = 20;
+ self.th_die = barrel_explode;
+ self.takedamage = DAMAGE_AIM;
+ // 1998-09-16 Sliding/not-jumping on monsters/boxes/players
+ // fix by Maddes/Kryten
+ self.touch = monster_touch;
+
+ self.origin_z = self.origin_z + 2;
+ oldz = self.origin_z;
+ droptofloor ();
+ if (oldz - self.origin_z > 250)
+ {
+ dprint ("item fell out of level at ");
+ dprint (vtos(self.origin));
+ dprint ("\n");
+ remove (self);
+ }
+};
+
+/*QUAKED misc_explobox2 (0 .5 .8) (0 0 0) (32 32 64) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+ model("maps/b_exbox2.bsp");
+}
+Smaller explosive box
+*/
+void() misc_explobox2 =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ local float oldz;
+
+ self.solid = SOLID_BBOX;
+ self.movetype = MOVETYPE_NONE;
+ precache_model2 ("maps/b_exbox2.bsp");
+ setmodel (self, "maps/b_exbox2.bsp");
+ precache_sound ("weapons/r_exp3.wav");
+ self.health = 20;
+ self.th_die = barrel_explode;
+ self.takedamage = DAMAGE_AIM;
+ // 1998-09-16 Sliding/not-jumping on monsters/boxes/players
+ // fix by Maddes/Kryten
+ self.touch = monster_touch;
+
+ self.origin_z = self.origin_z + 2;
+ oldz = self.origin_z;
+ droptofloor ();
+ if (oldz - self.origin_z > 250)
+ {
+ dprint ("item fell out of level at ");
+ dprint (vtos(self.origin));
+ dprint ("\n");
+ remove (self);
+ }
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/misc/fireball.qc

diff --git a/qc/misc/fireball.qc b/qc/misc/fireball.qc
new file mode 100644
index 0000000..39427e1
--- /dev/null
+++ b/qc/misc/fireball.qc
@@ -0,0 +1,61 @@
+//==============================================================================
+// misc_fireball
+//==============================================================================
+
+// prototypes
+void() fire_fly;
+void() fire_touch;
+
+/*QUAKED misc_fireball (0 .5 .8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model ("progs/lavaball.mdl"); }
+Flying lava balls
+speed - set vertical speed of fireballs. default 1000.
+*/
+void() misc_fireball =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/lavaball.mdl");
+ self.classname = "fireball";
+ // 1998-08-14 Incorrect setting of nextthink fix by Maddes/Lord Sméagol
+ // self.nextthink = time + (random() * 5);
+ self.nextthink = time + 0.1 + (random() * 5);
+ // 1998-08-14 Incorrect setting of nextthink fix by Maddes/Lord Sméagol
+ self.think = fire_fly;
+ if (!self.speed)
+ // fixed typo QIP - dumptruck_ds
+ self.speed = 1000;
+};
+
+//----------------------------------------------------------------------
+void() fire_fly =
+{
+ local entity fireball;
+
+ fireball = spawn ();
+ fireball.solid = SOLID_TRIGGER;
+ fireball.movetype = MOVETYPE_TOSS;
+ fireball.velocity = '0 0 1000';
+ fireball.velocity_x = (random() * 100) - 50;
+ fireball.velocity_y = (random() * 100) - 50;
+ fireball.velocity_z = self.speed + (random() * 200);
+ fireball.classname = "fireball";
+ setmodel (fireball, "progs/lavaball.mdl");
+ setsize (fireball, '0 0 0', '0 0 0');
+ setorigin (fireball, self.origin);
+ fireball.nextthink = time + 5;
+ fireball.think = SUB_Remove;
+ fireball.touch = fire_touch;
+
+ self.nextthink = time + (random() * 5) + 3;
+ self.think = fire_fly;
+};
+
+//----------------------------------------------------------------------
+void() fire_touch =
+{
+ T_Damage (other, self, self, 20);
+ remove (self);
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/misc/infight.qc

diff --git a/qc/misc/infight.qc b/qc/misc/infight.qc
new file mode 100644
index 0000000..24f16cb
--- /dev/null
+++ b/qc/misc/infight.qc
@@ -0,0 +1,120 @@
+//==============================================================================
+// misc_infight
+//==============================================================================
+
+//======================================================================
+// misc_infight
+//
+// target = monster that gets mad
+// target2 = who target1 will be angry at
+//
+// spawnflag 1 = mutual hate, both targets get angry at each other instantly
+// spawnflag 2 = maintain activator, makes it so the player that triggers
+// the infighting sees centerprints triggered by it
+//======================================================================
+
+// constants
+float INFIGHT_MUTUAL = 1;
+float INFIGHT_PLAYER_ACTIVATION = 2;
+
+//----------------------------------------------------------------------
+void(entity t1, entity t2) make_angry_at =
+{
+ // checks if targets are alive
+ if (t2.health > 0 && t1.health > 0)
+ {
+ if (t1.enemy.classname == "player")
+ t1.oldenemy = t1.enemy;
+ t1.enemy = t2;
+
+ entity oself = self;
+ // FoundTarget () only acts on self
+ self = t1;
+ FoundTarget ();
+ self = oself;
+ }
+};
+
+//----------------------------------------------------------------------
+void() misc_infight_use =
+{
+ local entity t1, t2;
+
+ for (t1 = world; (t1 = find (t1, targetname, self.target)); )
+ {
+ for (t2 = world; (t2 = find (t2, targetname, self.target2)); )
+ {
+ // t1 = find(world, targetname, self.target);
+ // t2 = find(world, targetname, self.target2);
+ if (!t1)
+ {
+ dprint ("[trigger_infight] Cannot find target, "
+ "checking targetname2\n");
+ t1 = find (world, targetname2, self.target);
+ }
+ if (!t1)
+ {
+ dprint ("[trigger_infight] Cannot find target, "
+ "checking targetname3\n");
+ t1 = find (world, targetname3, self.target);
+ }
+ if (!t1)
+ {
+ dprint ("[trigger_infight] Cannot find target, "
+ "checking targetname4\n");
+ t1 = find (world, targetname4, self.target);
+ }
+ if (!t1)
+ {
+ dprint ("[trigger_infight] Cannot find target, "
+ "exhausted all targetnames\n");
+ return;
+ }
+ if (!t2)
+ {
+ dprint ("[trigger_infight] Cannot find target2 "
+ "checking targetname2\n");
+ t2 = find (world, targetname2, self.target2);
+ }
+ if (!t2)
+ {
+ dprint ("[trigger_infight] Cannot find target2 "
+ "checking targetname3\n");
+ t2 = find (world, targetname3, self.target2);
+ }
+ if (!t2)
+ {
+ dprint ("[trigger_infight] Cannot find target2 "
+ "checking targetname4\n");
+ t2 = find (world, targetname4, self.target2);
+ }
+ if (!t2)
+ {
+ dprint ("[trigger_infight] Cannot find target2,"
+ " exhausted all targetnames\n");
+ return;
+ }
+
+ make_angry_at (t1, t2);
+
+ if (self.spawnflags & INFIGHT_PLAYER_ACTIVATION)
+ {
+ t1.infight_activator = activator;
+ t2.infight_activator = activator;
+ }
+
+ if (self.spawnflags & INFIGHT_MUTUAL)
+ make_angry_at (t2, t1);
+ }
+ }
+};
+
+//----------------------------------------------------------------------
+void() misc_infight =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.use = misc_infight_use;
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/misc/light_candle.qc

diff --git a/qc/misc/light_candle.qc b/qc/misc/light_candle.qc
new file mode 100644
index 0000000..4d42ea1
--- /dev/null
+++ b/qc/misc/light_candle.qc
@@ -0,0 +1,147 @@
+//==============================================================================
+// light_candle -- was in misc.qc
+//==============================================================================
+
+/*QUAKED light_candle (0 1 0) (-10 -10 -40) (10 10 40) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model("progs/candle.mdl"); }
+==========
+Spawnflags
+==========
+START_OFF - switchable lights only - light is off by default
+FADE_IN_OUT - switchable lights only - light fades in and out. can't be combined with animated lights.
+
+==========
+Keys
+==========
+"light" "n"
+Set the light intensity. Negative values are also allowed and will cause the entity to subtract light cast by other entities. Default 300.
+
+"wait" "n"
+Scale the fade distance of the light by "n". Values of n > 1 make the light fade more quickly with distance, and values < 1 make the light fade more slowly (and thus reach further). Default 1.
+
+"delay" "n"
+Select an attenuation formaula for the light:
+0 => Linear attenuation (default)
+1 => 1/x attenuation
+2 => 1/(x^2) attenuation
+3 => No attenuation (same brightness at any distance)
+4 => "local minlight" - No attenuation and like minlight,
+it won't raise the lighting above it's light value.
+Unlike minlight, it will only affect surfaces within
+line of sight of the entity.
+5 => 1/(x^2) attenuation, but slightly more attenuated and
+without the extra bright effect that "delay 2" has
+near the source.
+
+"_falloff" "n"
+Sets the distance at which the light drops to 0, in map units.
+In this mode, "wait" is ignored and "light" only controls the brightness at the center of the light, and no longer affects the falloff distance.
+Only supported on linear attenuation (delay 0) lights currently.
+
+"_color" "r g b"
+Specify red(r), green(g) and blue(b) components for the colour of the light. RGB component values are between 0 and 255 (between 0 and 1 is also accepted). Default is white light ("255 255 255").
+
+"target" "name"
+Turns the light into a spotlight, with the direction of light being towards another entity with it�s "targetname" key set to "name".
+"mangle" "yaw pitch roll"
+Turns the light into a spotlight and specifies the direction of light using yaw, pitch and roll in degrees. Yaw specifies the angle around the Z-axis from 0 to 359 degrees and pitch specifies the angle from 90 (straight up) to -90 (straight down). Roll has no effect, so use any value (e.g. 0). Often easier than the "target" method.
+
+"angle" "n"
+Specifies the angle in degrees for a spotlight cone. Default 40.
+
+"_softangle" "n"
+Specifies the angle in degrees for an inner spotlight cone (must be less than the "angle" cone. Creates a softer transition between the full brightness of the inner cone to the edge of the outer cone. Default 0 (disabled).
+
+"targetname" "name"
+Turns the light into a switchable light, toggled by another entity targeting it�s name.
+
+"speed" "n"
+If the light is switchable and FADE_IN_OUT is set, the speed at which the light transitions. Default 0.1.
+
+"style" "n"
+Set the animated light style. Default 0.
+
+"style2" "n"
+Set the animated light style for a switchable light, because style will be overriden if a targetname is set. Default 0.
+
+"_anglescale" "n" | "_anglesense" "n"
+Sets a scaling factor for how much influence the angle of incidence of light on a surface has on the brightness of the surface. n must be between 0.0 and 1.0. Smaller values mean less attenuation, with zero meaning that angle of incidence has no effect at all on the brightness. Default 0.5.
+
+"_dirtscale" "n" | "_dirtgain" "n"
+Override the global "_dirtscale" or "_dirtgain" settings to change how this light is affected by dirtmapping (ambient occlusion). See descriptions of these keys in the worldspawn section.
+
+"_dirt" "n"
+Overrides the worldspawn setting of "_dirt" for this particular light. -1 to disable dirtmapping (ambient occlusion) for this light, making it illuminate the dirtmapping shadows. 1 to enable ambient occlusion for this light. Default is to defer to the worldspawn setting.
+
+"_deviance" "n"
+Split up the light into a sphere of randomly positioned lights within radius "n" (in world units). Useful to give shadows a wider penumbra. "_samples" specifies the number of lights in the sphere. The "light" value is automatically scaled down for most lighting formulas (except linear and non-additive minlight) to attempt to keep the brightness equal. Default is 0, do not split up lights.
+
+"_samples" "n"
+Number of lights to use for "_deviance". Default 16 (only used if "_deviance" is set).
+
+"_surface" "texturename"
+Makes surfaces with the given texture name emit light, by using this light as a template which is copied across those surfaces. Lights are spaced about 128 units (though possibly closer due to bsp splitting) apart and positioned 2 units above the surfaces.
+
+"_surface_offset" "n"
+Controls the offset lights are placed above surfaces for "_surface". Default 2.
+
+"_surface_spotlight" "n"
+For a surface light template (i.e. a light with "_surface" set), setting this to "1" makes each instance into a spotlight, with the direction of light pointing along the surface normal. In other words, it automatically sets "mangle" on each of the generated lights.
+
+"_project_texture" "texture"
+Specifies that a light should project this texture. The texture must be used in the map somewhere.
+
+"_project_mangle" "yaw pitch roll"
+Specifies the yaw/pitch/roll angles for a texture projection (overriding mangle).
+
+"_project_fov" "n"
+Specifies the fov angle for a texture projection. Default 90.
+
+"_bouncescale" "n"
+Scales the amount of light that is contributed by bounces. Default is 1.0, 0.0 disables bounce lighting for this light.
+
+"_sun" "n"
+Set to 1 to make this entity a sun, as an alternative to using the sunlight worldspawn keys. If the light targets an info_null entity, the direction towards that entity sets sun direction. The light itself is disabled, so it can be placed anywhere in the map.
+
+The following light properties correspond to these sunlight settings:
+light => _sunlight
+mangle => _sunlight_mangle
+deviance => _sunlight_penumbra
+_color => _sunlight_color
+_dirt => _sunlight_dirt
+_anglescale => _anglescale
+
+ //dumptruck_ds taken from honey (originally from Rogue)
+White candle
+*/
+void() light_candle =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/candle.mdl");
+ setmodel (self, "progs/candle.mdl");
+ makestatic (self);
+};
+
+//----------------------------------------------------------------------
+void() model_candle_think =
+{
+ self.frame = self.frame + 1;
+ if (self.frame > 3)
+ self.frame = 0;
+ self.nextthink = time + 0.1;
+};
+
+//----------------------------------------------------------------------
+void() model_candle =
+{
+
+ precache_model ("progs/candle.mdl");
+
+ setmodel (self, "progs/candle.mdl");
+
+ self.think = model_candle_think;
+ self.nextthink = time + 0.1;
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/misc/lights.qc

diff --git a/qc/misc/lights.qc b/qc/misc/lights.qc
new file mode 100644
index 0000000..4680ec0
--- /dev/null
+++ b/qc/misc/lights.qc
@@ -0,0 +1,492 @@
+//==============================================================================
+// lights.qc taken from c0burn's Slipgate mod -- dumptruck_ds
+//==============================================================================
+
+// constants
+const float START_OFF = 1;
+const float FADE_IN_OUT = 2;
+const float SILENT_TORCH = 4; // for silent torch -- dumptruck_ds
+
+// prototypes
+void() FireAmbient;
+
+/*QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+
+Used as a positional target for spotlights, etc.
+*/
+void() info_null =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ remove (self);
+};
+
+/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+
+Never used in the or
+*/
+void() info_notnull =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+};
+
+//----------------------------------------------------------------------
+// lightstyle_lookup
+//----------------------------------------------------------------------
+string(float num) lightstyle_lookup =
+{
+ switch (num)
+ {
+ case 0:
+ // 0 normal
+ return "m";
+ case 1:
+ // 1 FLICKER (first variety)
+ return "mmnmmommommnonmmonqnmmo";
+ case 2:
+ // 2 SLOW STRONG PULSE
+ return "abcdefghijklmnopqrstuvwxyz"
+ "yxwvutsrqponmlkjihgfedcba";
+ case 3:
+ // 3 CANDLE (first variety)
+ return "mmmmmaaaaammmmmaaaaaabcdefgabcdefg";
+ case 4:
+ // 4 FAST STROBE
+ return "mamamamamama";
+ case 5:
+ // 5 GENTLE PULSE 1
+ return "jklmnopqrstuvwxyzyxwvutsrqponmlkj";
+ case 6:
+ // 6 FLICKER (second variety)
+ return "nmonqnmomnmomomno";
+ case 7:
+ // 7 CANDLE (second variety)
+ return "mmmaaaabcdefgmmmmaaaammmaamm";
+ case 8:
+ // 8 CANDLE (third variety)
+ return "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa";
+ case 9:
+ // 9 SLOW STROBE (fourth variety)
+ return "aaaaaaaazzzzzzzz";
+ case 10:
+ // 10 FLUORESCENT FLICKER
+ return "mmamammmmammamamaaamammma";
+ case 11:
+ // 11 SLOW PULSE NOT FADE TO BLACK
+ return "abcdefghijklmnopqrrqponmlkjihgfedcba";
+ case 12:
+ // 12 BLINK OFF / ON (can be synced with animated
+ // textures, e.g. +0light and +1light)
+ // textures animate at 5fps but lights are
+ // 10fps...
+ return "aamm";
+ default:
+ // DEFAULT
+ return "a";
+ }
+};
+
+//----------------------------------------------------------------------
+// setup_lightstyles
+// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
+// Styles 32+ are assigned by the light program for switchable lights.
+//----------------------------------------------------------------------
+void() setup_lightstyles =
+{
+ for (float i = 0; i <= 12; i++)
+ {
+ lightstyle (i, lightstyle_lookup(i));
+ }
+};
+
+//----------------------------------------------------------------------
+// lightstyle_fade_lookup
+//----------------------------------------------------------------------
+string(float num) lightstyle_fade_lookup =
+{
+ switch (num)
+ {
+ case 0:
+ return "a";
+ case 1:
+ return "b";
+ case 2:
+ return "c";
+ case 3:
+ return "d";
+ case 4:
+ return "e";
+ case 5:
+ return "f";
+ case 6:
+ return "g";
+ case 7:
+ return "h";
+ case 8:
+ return "i";
+ case 9:
+ return "j";
+ case 10:
+ return "k";
+ case 11:
+ return "l";
+ case 12:
+ return "m";
+ default:
+ error("count out of range\n");
+ break;
+ }
+};
+
+//----------------------------------------------------------------------
+// light_fade_in
+//----------------------------------------------------------------------
+void() light_fade_in =
+{
+ if (self.count < 0)
+ self.count = 0;
+ if (self.count > 12)
+ self.count = 12;
+
+ lightstyle (self.style, lightstyle_fade_lookup(self.count));
+ self.count = self.count + 1;
+ if (self.count > 12)
+ return;
+
+ self.think = light_fade_in;
+ self.nextthink = time + self.speed;
+};
+
+//----------------------------------------------------------------------
+// light_fade_out
+//----------------------------------------------------------------------
+void() light_fade_out =
+{
+ if (self.count < 0)
+ self.count = 0;
+ if (self.count > 12)
+ self.count = 12;
+
+ lightstyle (self.style, lightstyle_fade_lookup(self.count));
+ self.count = self.count - 1;
+ if (self.count < 0)
+ return;
+
+ self.think = light_fade_out;
+ self.nextthink = time + self.speed;
+};
+
+//----------------------------------------------------------------------
+// light_use -- using a light will turn it on and off
+//----------------------------------------------------------------------
+void() light_use =
+{
+ if (self.spawnflags & START_OFF)
+ {
+ self.spawnflags = self.spawnflags - START_OFF;
+ if (self.spawnflags & FADE_IN_OUT && !self.style2)
+ light_fade_in ();
+ else
+ lightstyle (self.style, lightstyle_lookup(self.style2));
+ }
+ else
+ {
+ self.spawnflags = self.spawnflags + START_OFF;
+ if (self.spawnflags & FADE_IN_OUT && !self.style2)
+ light_fade_out ();
+ else
+ lightstyle (self.style, "a");
+ }
+};
+
+/*QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) START_OFF FADE_IN_OUT X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+
+Light
+
+==========
+Spawnflags
+==========
+START_OFF - switchable lights only - light is off by default
+FADE_IN_OUT - switchable lights only - light fades in and out. can't be combined with animated lights.
+
+==========
+Keys
+==========
+"light" "n"
+Set the light intensity. Negative values are also allowed and will cause the entity to subtract light cast by other entities. Default 300.
+
+"wait" "n"
+Scale the fade distance of the light by "n". Values of n > 1 make the light fade more quickly with distance, and values < 1 make the light fade more slowly (and thus reach further). Default 1.
+
+"delay" "n"
+Select an attenuation formaula for the light:
+0 => Linear attenuation (default)
+1 => 1/x attenuation
+2 => 1/(x^2) attenuation
+3 => No attenuation (same brightness at any distance)
+4 => "local minlight" - No attenuation and like minlight,
+it won't raise the lighting above it's light value.
+Unlike minlight, it will only affect surfaces within
+line of sight of the entity.
+5 => 1/(x^2) attenuation, but slightly more attenuated and
+without the extra bright effect that "delay 2" has
+near the source.
+
+"_falloff" "n"
+Sets the distance at which the light drops to 0, in map units.
+In this mode, "wait" is ignored and "light" only controls the brightness at the center of the light, and no longer affects the falloff distance.
+Only supported on linear attenuation (delay 0) lights currently.
+
+"_color" "r g b"
+Specify red(r), green(g) and blue(b) components for the colour of the light. RGB component values are between 0 and 255 (between 0 and 1 is also accepted). Default is white light ("255 255 255").
+
+"target" "name"
+Turns the light into a spotlight, with the direction of light being towards another entity with it�s "targetname" key set to "name".
+"mangle" "yaw pitch roll"
+Turns the light into a spotlight and specifies the direction of light using yaw, pitch and roll in degrees. Yaw specifies the angle around the Z-axis from 0 to 359 degrees and pitch specifies the angle from 90 (straight up) to -90 (straight down). Roll has no effect, so use any value (e.g. 0). Often easier than the "target" method.
+
+"angle" "n"
+Specifies the angle in degrees for a spotlight cone. Default 40.
+
+"_softangle" "n"
+Specifies the angle in degrees for an inner spotlight cone (must be less than the "angle" cone. Creates a softer transition between the full brightness of the inner cone to the edge of the outer cone. Default 0 (disabled).
+
+"targetname" "name"
+Turns the light into a switchable light, toggled by another entity targeting it�s name.
+
+"speed" "n"
+If the light is switchable and FADE_IN_OUT is set, the speed at which the light transitions. Default 0.1.
+
+"style" "n"
+Set the animated light style. Default 0.
+
+"style2" "n"
+Set the animated light style for a switchable light, because style will be overriden if a targetname is set. Default 0.
+
+"_anglescale" "n" | "_anglesense" "n"
+Sets a scaling factor for how much influence the angle of incidence of light on a surface has on the brightness of the surface. n must be between 0.0 and 1.0. Smaller values mean less attenuation, with zero meaning that angle of incidence has no effect at all on the brightness. Default 0.5.
+
+"_dirtscale" "n" | "_dirtgain" "n"
+Override the global "_dirtscale" or "_dirtgain" settings to change how this light is affected by dirtmapping (ambient occlusion). See descriptions of these keys in the worldspawn section.
+
+"_dirt" "n"
+Overrides the worldspawn setting of "_dirt" for this particular light. -1 to disable dirtmapping (ambient occlusion) for this light, making it illuminate the dirtmapping shadows. 1 to enable ambient occlusion for this light. Default is to defer to the worldspawn setting.
+
+"_deviance" "n"
+Split up the light into a sphere of randomly positioned lights within radius "n" (in world units). Useful to give shadows a wider penumbra. "_samples" specifies the number of lights in the sphere. The "light" value is automatically scaled down for most lighting formulas (except linear and non-additive minlight) to attempt to keep the brightness equal. Default is 0, do not split up lights.
+
+"_samples" "n"
+Number of lights to use for "_deviance". Default 16 (only used if "_deviance" is set).
+
+"_surface" "texturename"
+Makes surfaces with the given texture name emit light, by using this light as a template which is copied across those surfaces. Lights are spaced about 128 units (though possibly closer due to bsp splitting) apart and positioned 2 units above the surfaces.
+
+"_surface_offset" "n"
+Controls the offset lights are placed above surfaces for "_surface". Default 2.
+
+"_surface_spotlight" "n"
+For a surface light template (i.e. a light with "_surface" set), setting this to "1" makes each instance into a spotlight, with the direction of light pointing along the surface normal. In other words, it automatically sets "mangle" on each of the generated lights.
+
+"_project_texture" "texture"
+Specifies that a light should project this texture. The texture must be used in the map somewhere.
+
+"_project_mangle" "yaw pitch roll"
+Specifies the yaw/pitch/roll angles for a texture projection (overriding mangle).
+
+"_project_fov" "n"
+Specifies the fov angle for a texture projection. Default 90.
+
+"_bouncescale" "n"
+Scales the amount of light that is contributed by bounces. Default is 1.0, 0.0 disables bounce lighting for this light.
+
+"_sun" "n"
+Set to 1 to make this entity a sun, as an alternative to using the sunlight worldspawn keys. If the light targets an info_null entity, the direction towards that entity sets sun direction. The light itself is disabled, so it can be placed anywhere in the map.
+
+The following light properties correspond to these sunlight settings:
+light => _sunlight
+mangle => _sunlight_mangle
+deviance => _sunlight_penumbra
+_color => _sunlight_color
+_dirt => _sunlight_dirt
+_anglescale => _anglescale
+*/
+void() light =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ // default speed for fading in/out
+ if (self.speed <= 0)
+ self.speed = 0.1;
+
+ // non-switchable light
+ if (!self.targetname)
+ {
+ remove (self);
+ return;
+ }
+
+ // switchable light
+ if (self.style >= 32)
+ {
+ self.use = light_use;
+ if (self.spawnflags & START_OFF)
+ {
+ self.count = 0;
+ lightstyle (self.style, "a");
+ }
+ else
+ {
+ self.count = 12;
+ lightstyle (self.style, lightstyle_lookup(self.style2));
+ }
+ }
+};
+
+/*QUAKED light_fluoro (0 1 0) (-8 -8 -8) (8 8 8) START_OFF FADE_IN_OUT X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+
+Non-displayed light.
+Makes steady fluorescent humming sound.
+See the "light" entity for a full description.
+*/
+void() light_fluoro =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ ambient_light_buzz ();
+ light ();
+};
+
+/*QUAKED light_fluorospark (0 1 0) (-8 -8 -8) (8 8 8) START_OFF FADE_IN_OUT X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+
+Non-displayed light.
+Makes sparking, broken fluorescent sound.
+Can't be toggled.
+Default style is 10.
+See the "light" entity for a full description.
+*/
+void() light_fluorospark =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (!self.style)
+ self.style = 10;
+ ambient_flouro_buzz ();
+ remove (self);
+};
+
+/*QUAKED light_globe (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+Sphere globe light.
+Can't be toggled.
+See the "light" entity for a full description.
+*/
+void() light_globe =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/s_light.spr");
+ setmodel (self, "progs/s_light.spr");
+ makestatic (self);
+};
+
+/*QUAKED light_torch_small_walltorch (0 .5 0) (-10 -10 -20) (10 10 20) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model ("progs/flame.mdl"); }
+Short wall torch
+See the "light" entity for a full description.
+*/
+void() light_torch_small_walltorch =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ // precache_model ("progs/flame.mdl");
+ precache_body_model ("progs/flame.mdl");
+ // setmodel (self, "progs/flame.mdl");
+ body_model ("progs/flame.mdl");
+ // for silent torch -- dumptruck_ds
+ if !(self.spawnflags && SILENT_TORCH)
+ FireAmbient ();
+ makestatic (self);
+};
+
+/*QUAKED light_flame_large_yellow (0 1 0) (-10 -10 -12) (12 12 18) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model ( { "path" : "progs/flame2.mdl", "frame" : 1 } ); }
+Large yellow flame
+See the "light" entity for a full description.
+*/
+void() light_flame_large_yellow =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/flame2.mdl");
+ setmodel (self, "progs/flame2.mdl");
+ self.frame = 1;
+ FireAmbient ();
+ makestatic (self);
+};
+
+/*QUAKED light_flame_small_yellow (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model ("progs/flame2.mdl"); }
+Small yellow flame
+See the "light" entity for a full description.
+*/
+void() light_flame_small_yellow =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/flame2.mdl");
+ setmodel (self, "progs/flame2.mdl");
+ FireAmbient ();
+ makestatic (self);
+};
+
+/*QUAKED light_flame_small_white (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model ("progs/flame2.mdl"); }
+Left for compatability
+Identical to "light_flame_small_yellow"
+*/
+void() light_flame_small_white =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ light_flame_small_yellow ();
+};
+
+/*QUAKED light_sprite_flame (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model ("progs/s_flame.spr"); }
+Large flame spite*/
+void() light_sprite_flame =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/s_flame.spr");
+ setmodel (self, "progs/s_flame.spr");
+ FireAmbient ();
+
+ self.frame = rint(random() * 13);
+ self.first_frame = 0;
+ self.last_frame = 13;
+ self.speed = 0.05;
+ self.think = misc_model_think;
+ self.nextthink = time + 0.1;
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/misc/model.qc

diff --git a/qc/misc/model.qc b/qc/misc/model.qc
new file mode 100644
index 0000000..aa72143
--- /dev/null
+++ b/qc/misc/model.qc
@@ -0,0 +1,194 @@
+//==============================================================================
+// misc_model -- Joshua Skelton
+//==============================================================================
+
+//======================================================================
+// misc_model.qc requires math.qc
+//
+// Author: Joshua Skelton joshua.skelton@gmail.com
+// Edited by: Inky 20201219 Minor changes for a better integration with their
+// own code
+// Edited by: bmFbr for solid and gravity spawnflags and custom bbox sizes
+// Edited by: dumptruck_ds to add start and stop animations
+//======================================================================
+
+// fields
+.float first_frame; // The starting frame of the animation
+.float last_frame; // The ending frame of the animation
+
+// constants
+const float MISC_MODEL_GRAVITY = 1;
+const float MISC_MODEL_SOLID = 2;
+const float MISC_MODEL_BACK_AND_FORTH = 4;
+const float MISC_MODEL_ONLY_ONCE = 8;
+const float MISC_MODEL_PLAY_COUNT = 16;
+const float MISC_MODEL_STARTOFF = 32;
+
+//----------------------------------------------------------------------
+void() misc_model_use =
+{
+ if (self.state == STATE_ACTIVE)
+ {
+ if (self.spawnflags & MISC_MODEL_SOLID)
+ self.solid = SOLID_NOT;
+ self.model = "";
+
+ self.state = STATE_INVISIBLE;
+ setorigin (self, self.origin);
+ }
+ else
+ {
+ if (self.spawnflags & MISC_MODEL_SOLID)
+ self.solid = SOLID_BBOX;
+ self.model = self.mdl;
+
+ self.state = STATE_ACTIVE;
+ setorigin (self, self.origin);
+ }
+};
+
+//----------------------------------------------------------------------
+// misc_model_think -- Handles animation for misc_model entity.
+//----------------------------------------------------------------------
+void() misc_model_think =
+{
+ self.nextthink = time + fabs (self.speed);
+ if (self.estate != STATE_ACTIVE)
+ return;
+
+ self.frame = self.frame + sign (self.speed);
+
+ if (self.spawnflags & MISC_MODEL_BACK_AND_FORTH
+ && self.frame < self.first_frame)
+ {
+ self.speed = -1 * self.speed;
+ self.frame += 2;
+ }
+ else if (self.spawnflags & MISC_MODEL_BACK_AND_FORTH
+ && self.frame > self.last_frame)
+ {
+ self.speed = -1 * self.speed;
+ self.frame -= 2;
+ }
+ else
+ {
+ self.frame = wrap (self.frame, self.first_frame,
+ self.last_frame);
+ }
+
+ if (self.spawnflags & MISC_MODEL_ONLY_ONCE
+ && self.frame == self.last_frame
+ && self.last_frame != self.first_frame)
+ self.nextthink = -1;
+
+ if (self.spawnflags & MISC_MODEL_PLAY_COUNT
+ && self.frame == self.last_frame
+ && self.last_frame != self.first_frame)
+ {
+ if !(self.count)
+ objerror ("Error: set count to the number of "
+ " animation cycles!");
+ self.cnt = self.cnt + 1;
+ dprint (ftos(self.cnt));
+ dprint ("\n");
+ if (self.cnt != self.count)
+ return FALSE;
+ else
+ self.nextthink = -1;
+ }
+};
+
+/*QUAKED misc_model (0 0.5 0.8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+ model ({"path" : mdl, "skin" : skin, "frame": frame});
+}
+An entity for displaying models. A frame range can be given to animate the
+model.
+
+mdl: The model to display. Can be of type mdl, bsp, or spr.
+
+frame: The frame to display. Can be used to offset the animation.
+
+first_frame: The starting frame of the animation.
+
+last_frame: The last frame of the animation.
+*/
+void() misc_model =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (!self.mdl || self.mdl == "")
+ objerror ("Model not defined");
+
+ if (!self.centeroffset)
+ self.centeroffset = '0 0 0';
+ if (!self.mdlsz)
+ self.mdlsz = '32 32 32';
+
+ vector vmin, vmax;
+
+ vmin_x = self.centeroffset_x - (self.mdlsz_x / 2);
+ vmin_y = self.centeroffset_y - (self.mdlsz_y / 2);
+ vmin_z = self.centeroffset_z - (self.mdlsz_z / 2);
+
+ vmax_x = self.centeroffset_x + (self.mdlsz_x / 2);
+ vmax_y = self.centeroffset_y + (self.mdlsz_y / 2);
+ vmax_z = self.centeroffset_z + (self.mdlsz_z / 2);
+
+ precache_model (self.mdl);
+ setmodel (self, self.mdl);
+
+ setsize (self, vmin, vmax);
+
+ if (self.spawnflags & MISC_MODEL_SOLID)
+ self.solid = SOLID_BBOX;
+ else self.solid = SOLID_NOT;
+
+ if (self.spawnflags & MISC_MODEL_GRAVITY)
+ self.movetype = MOVETYPE_TOSS;
+ else self.movetype = MOVETYPE_NONE;
+
+ self.use = misc_model_use;
+
+ if (!self.frame)
+ self.frame = self.first_frame;
+
+ // Make static (not animate) if not given a frame range, and
+ // not affected by gravity; also remains active if it has a
+ // targetname (so it can be killtargeted/toggled)
+ if (!self.last_frame
+ && !(self.spawnflags & MISC_MODEL_GRAVITY)
+ && !(self.spawnflags & MISC_MODEL_SOLID)
+ && !self.targetname
+ && !self.targetname2)
+ // && !(self.spawnflags & MISC_MODEL_DONTMAKESTATIC)
+ makestatic (self);
+
+ // Make static (not animate) if not given a frame range, and
+ // not affected by gravity
+ // changed by bmFbr
+ // if (!self.last_frame && !(self.spawnflags & MISC_MODEL_GRAVITY))
+ // {
+ // makestatic(self);
+ // return;
+ // }
+
+ // if it as a custom animation range
+ if (self.last_frame)
+ {
+ // Default animation speed to 10 fps
+ if (!self.speed)
+ self.speed = 0.1;
+ self.nextthink = time + self.speed;
+ self.think = misc_model_think;
+ }
+
+ if (self.spawnflags & MISC_MODEL_STARTOFF)
+ self.state = STATE_ACTIVE;
+ else
+ self.state = STATE_INVISIBLE;
+
+ misc_model_use ();
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/misc/noisemaker.qc

diff --git a/qc/misc/noisemaker.qc b/qc/misc/noisemaker.qc
new file mode 100644
index 0000000..1d536a1
--- /dev/null
+++ b/qc/misc/noisemaker.qc
@@ -0,0 +1,41 @@
+//==============================================================================
+// misc_noisemaker
+//==============================================================================
+
+//----------------------------------------------------------------------
+void() noise_think =
+{
+ self.nextthink = time + 0.5;
+ sound (self, 1, "enforcer/enfire.wav", 1, ATTN_NORM);
+ sound (self, 2, "enforcer/enfstop.wav", 1, ATTN_NORM);
+ sound (self, 3, "enforcer/sight1.wav", 1, ATTN_NORM);
+ sound (self, 4, "enforcer/sight2.wav", 1, ATTN_NORM);
+ sound (self, 5, "enforcer/sight3.wav", 1, ATTN_NORM);
+ sound (self, 6, "enforcer/sight4.wav", 1, ATTN_NORM);
+ sound (self, 7, "enforcer/pain1.wav", 1, ATTN_NORM);
+};
+
+/*QUAKED misc_noisemaker (1 0.5 0) (-10 -10 -10) (10 10 10) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+
+For optimzation testing, starts a lot of sounds.
+*/
+void() misc_noisemaker =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_sound2 ("enforcer/enfire.wav");
+ precache_sound2 ("enforcer/enfstop.wav");
+ precache_sound2 ("enforcer/sight1.wav");
+ precache_sound2 ("enforcer/sight2.wav");
+ precache_sound2 ("enforcer/sight3.wav");
+ precache_sound2 ("enforcer/sight4.wav");
+ precache_sound2 ("enforcer/pain1.wav");
+ precache_sound2 ("enforcer/pain2.wav");
+ precache_sound2 ("enforcer/death1.wav");
+ precache_sound2 ("enforcer/idle1.wav");
+
+ self.nextthink = time + 0.1 + random ();
+ self.think = noise_think;
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/misc/play.qc

diff --git a/qc/misc/play.qc b/qc/misc/play.qc
new file mode 100644
index 0000000..afd18df
--- /dev/null
+++ b/qc/misc/play.qc
@@ -0,0 +1,468 @@
+//==============================================================================
+// a collection of various pieces of mods and some new code -- dumptruck_ds
+//==============================================================================
+
+//======================================================================
+// Miscelanneous QuickC program
+// Copyright (c)1996 Hipnotic Interactive, Inc.
+// All rights reserved.
+// Distributed (unsupported) on 3.12.97
+//======================================================================
+
+//----------------------------------------------------------------------
+void() play_sound_use =
+{
+ if (self.spawnflags & 1)
+ {
+ if (self.state == 0)
+ {
+ self.state = 1;
+ sound (self, self.impulse, self.noise, self.volume,
+ self.speed);
+ }
+ else
+ {
+ self.state = 0;
+ sound (self, self.impulse, "misc/null.wav",
+ self.volume, self.speed);
+ }
+ }
+ else
+ {
+ sound (self, self.impulse, self.noise, self.volume, self.speed);
+ }
+};
+
+//----------------------------------------------------------------------
+void() PlaySoundThink =
+{
+ local float t;
+ t = self.wait * random ();
+
+ if (t < self.delay)
+ t = self.delay;
+
+ self.nextthink = time + t;
+ play_sound_use ();
+};
+
+/*QUAKED play_sound_triggered (0.3 0.1 0.6) (-8 -8 -8) (8 8 8) toggle
+play a sound when it is used
+"toggle" determines whether sound should be stopped when triggered again
+"volume" how loud (1 default full volume)
+"noise" sound to play
+"impulse" channel on which to play sound (0-7) (0 automatic is default)
+"speed" attenuation factor
+ -1 - no attenuation
+ 1 - normal
+ 2 - idle
+ 3 - static
+*/
+void() play_sound_triggered =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ // dumptruck_ds
+ if (!self.noise)
+ {
+ objerror ("no soundfile set in noise!\n");
+ remove (self);
+ return;
+ }
+
+ precache_sound (self.noise);
+ precache_sound ("misc/null.wav");
+ if (self.volume == 0)
+ self.volume = 1;
+ if (self.speed == 0)
+ self.speed = 1;
+ if (self.speed == -1)
+ // self.speed = 0;
+ self.speed = ATTN_NONE;
+ if (self.spawnflags & 1)
+ if (self.impulse == 0)
+ self.impulse = 7;
+ self.use = play_sound_use;
+};
+
+/*QUAKED play_sound (0.3 0.1 0.6) (-8 -8 -8) (8 8 8)
+play a sound on a periodic basis
+"volume" how loud (1 default full volume)
+"noise" sound to play
+"wait" random time between sounds (default 20)
+"delay" minimum delay between sounds (default 2)
+"impulse" channel on which to play sound (0-7) (0 automatic is default)
+"speed" attenuation factor
+ -1 - no attenuation
+ 1 - normal
+ 2 - idle
+ 3 - static
+*/
+void() play_sound =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ local float t;
+
+ // dumptruck_ds
+ if (!self.noise)
+ {
+ objerror ("no soundfile set in noise!\n");
+ remove (self);
+ return;
+ }
+
+ play_sound_triggered ();
+
+ if (self.wait == 0)
+ self.wait = 20;
+ if (self.delay == 0)
+ self.delay = 2;
+
+ self.think = PlaySoundThink;
+
+ t = self.wait * random ();
+ if (t < self.delay)
+ t = self.delay;
+
+ self.nextthink = time + t;
+};
+
+/*QUAKED tele_fog (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+
+When triggered, tele_fog shows the teleport particle effects and sounds.
+
+Use this when killtageting an entity if the player can see.
+
+*/
+void() play_tfog =
+{
+ // thanks Khreathor -- dumptruck_ds
+ spawn_tfog (self.origin);
+};
+
+//----------------------------------------------------------------------
+void() tele_fog =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.use = play_tfog;
+};
+
+/*QUAKED play_tele (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+
+When triggered, tele_fog shows the teleport particle effects and sounds.
+Same os tele_fog.
+
+Use this when killtageting an entity if the player can see.
+
+*/
+void() play_tele =
+{
+ // same as tele_fog, added for "play_xxxx" consistancy
+
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.use = play_tfog;
+};
+
+/*QUAKED play_explosion (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+
+When triggered, creates a explosion at it's origin. Causes damage.
+
+*/
+void() play_explosion_fx =
+{
+ // thanks Khreathor -- dumptruck_ds
+ // GrenadeExplode uses self.owner as the attacker -- iw
+ self.owner = self;
+ GrenadeExplode ();
+};
+
+//----------------------------------------------------------------------
+void() play_explosion =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.use = play_explosion_fx;
+};
+
+/*QUAKED play_lavasplash (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+
+When triggered, plays the lavasplash effect from E1M7.
+
+Use noise key for a custom sound.
+
+*/
+void() play_lavasplash_fx =
+{
+ // thanks Khreathor -- dumptruck_ds
+ if (self.noise != "")
+ {
+ sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
+ }
+ else
+ {
+ sound (self, CHAN_AUTO, "boss1/out1.wav", 1, ATTN_NORM);
+ }
+
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_LAVASPLASH);
+ WriteCoord (MSG_BROADCAST, self.origin_x);
+ WriteCoord (MSG_BROADCAST, self.origin_y);
+ WriteCoord (MSG_BROADCAST, self.origin_z);
+};
+
+//----------------------------------------------------------------------
+void() play_lavasplash =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (self.noise != "")
+ precache_sound (self.noise);
+
+ precache_sound("boss1/out1.wav");
+ self.use = play_lavasplash_fx;
+};
+
+/*QUAKED meat_shower (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+
+When triggered, plays a gib effect.
+
+Use style 0 for normal and 1 for extra large. fly_sound 0 is silent, 1 for regular gib sounds.
+
+*/
+void() play_meatspray =
+{
+ // -- dumptruck_ds -- thanks to Spike for helping with errors
+ if (self.style == 1)
+ {
+ ThrowGib ("progs/gib1.mdl", random() * -80);
+ ThrowGib ("progs/gib2.mdl", random() * -80);
+ ThrowGib ("progs/gib3.mdl", random() * -80);
+ ThrowGib ("progs/gib1.mdl", random() * -75);
+ ThrowGib ("progs/gib2.mdl", random() * -75);
+ ThrowGib ("progs/gib3.mdl", random() * -75);
+ }
+ else
+ {
+ ThrowGib ("progs/gib1.mdl", random() * -65);
+ ThrowGib ("progs/gib2.mdl", random() * -65);
+ ThrowGib ("progs/gib3.mdl", random() * -65);
+ }
+
+ if (self.fly_sound != 1)
+ return;
+
+ if (random() < 0.5)
+ sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NORM);
+ else
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+};
+
+//----------------------------------------------------------------------
+void() meat_shower =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.use = play_meatspray;
+};
+
+/*QUAKED play_gibs (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+
+When triggered, plays a gib effect. Same as meat_shower.
+
+Use style 0 for normal and 1 for extra large. fly_sound 0 is silent, 1 for regular gib sounds.
+
+*/
+void() play_gibs =
+{
+ // same as meat_shower, added for "play_xxxx" consistancy
+
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.use = play_meatspray;
+};
+
+//----------------------------------------------------------------------
+void() mflash_use =
+{
+ self.effects = self.effects | EF_MUZZLEFLASH;
+
+ if (self.noise != "")
+ sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
+};
+
+/*QUAKED play_mflash (0 .5 .8) (-8 -8 -8) (8 8 8)
+triggable muzzle flash effect entity
+*/
+void() play_mflash =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/s_null.spr");
+ if (self.noise != "")
+ precache_sound (self.noise);
+
+ setmodel (self, "progs/s_null.spr");
+ setorigin (self, self.origin);
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_NOT;
+ setsize (self, '0 0 0', '0 0 0');
+ self.use = mflash_use;
+};
+
+//======================================================================
+// play_bfield triggerable effect
+//======================================================================
+
+//----------------------------------------------------------------------
+void() bfield_toggle =
+{
+ if (!self.state)
+ {
+ self.state = 1;
+ self.effects = self.effects | EF_BRIGHTFIELD;
+ sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
+ }
+ else
+ {
+ self.state = 0;
+ self.effects = self.effects - (self.effects & EF_BRIGHTFIELD);
+ sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
+ }
+};
+
+/*QUAKED play_bfield (0 .5 .8) (-8 -8 -8) (8 8 8)
+a triggerable, spherical field of yellow particles
+state 1 = start on
+*/
+void() play_bfield =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/s_null.spr");
+ if (self.noise != "")
+ precache_sound (self.noise);
+
+ setmodel (self, "progs/s_null.spr");
+ setorigin (self, self.origin);
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_NOT;
+ setsize (self, '0 0 0', '0 0 0');
+ if (self.state)
+ self.effects = self.effects | EF_BRIGHTFIELD;
+ self.use = bfield_toggle;
+};
+
+//======================================================================
+// play_brlight triggerable effect
+//======================================================================
+
+//----------------------------------------------------------------------
+void() brlight_toggle =
+{
+ // dumptruck_ds -- thanks to c0burn
+ if (!self.state)
+ {
+ self.state = 1;
+ self.effects = self.effects | EF_BRIGHTLIGHT;
+ sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
+ }
+ else
+ {
+ self.state = 0;
+ self.effects = self.effects - (self.effects & EF_BRIGHTLIGHT);
+ sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
+ }
+};
+
+/*QUAKED play_brlight (0 .5 .8) (-8 -8 -8) (8 8 8)
+a triggerable bright lighting effect
+state 1 = start on
+*/
+void() play_brlight =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/s_null.spr");
+ if (self.noise != "")
+ precache_sound (self.noise);
+
+ setmodel (self, "progs/s_null.spr");
+ setorigin (self, self.origin);
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_NOT;
+ setsize (self, '0 0 0', '0 0 0');
+ if (self.state)
+ self.effects = self.effects | EF_BRIGHTLIGHT;
+ self.use = brlight_toggle;
+};
+
+//======================================================================
+// play_dimlight triggerable effect
+//======================================================================
+
+//----------------------------------------------------------------------
+void() dim_toggle =
+{
+ if (!self.state)
+ {
+ self.state = 1;
+ self.effects = self.effects | EF_DIMLIGHT;
+ sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
+ }
+ else
+ {
+ self.state = 0;
+ self.effects = self.effects - (self.effects & EF_DIMLIGHT);
+ sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
+ }
+};
+
+/*QUAKED play_dimlight (0 .5 .8) (-8 -8 -8) (8 8 8)
+a triggerable lighting effect
+state 1 = start on
+*/
+void() play_dimlight =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/s_null.spr");
+ if (self.noise != "")
+ precache_sound (self.noise);
+
+ setmodel (self, "progs/s_null.spr");
+ // setorigin (self, self.origin);
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_NOT;
+ setsize (self, '0 0 0', '0 0 0');
+ if (self.state)
+ self.effects = self.effects | EF_DIMLIGHT;
+ setorigin (self, self.origin);
+ self.use = dim_toggle;
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/misc/target_autosave.qc

diff --git a/qc/misc/target_autosave.qc b/qc/misc/target_autosave.qc
new file mode 100644
index 0000000..43b7553
--- /dev/null
+++ b/qc/misc/target_autosave.qc
@@ -0,0 +1,96 @@
+//==============================================================================
+// target_autosave -- from Copper
+//==============================================================================
+
+//----------------------------------------------------------------------
+void() target_autosave_use =
+{
+ if (self.enemy)
+ {
+ activator = self.enemy;
+ self.enemy = world;
+ }
+
+ if (activator.classname != "player")
+ return;
+
+ // make sure an autosave fired from a player start doesn't
+ // happen too early
+ if (time < 2)
+ {
+ // if (serverflags & SVFL_RESPAWNING)
+ // {
+ // dprint("RESPAWNING flag set, skipping autosave\n");
+ // return;
+ // }
+ self.enemy = activator;
+ self.think = target_autosave_use;
+ self.nextthink = 2;
+ return;
+ }
+
+ // sound(activator, CHAN_VOICE, "misc/sav.wav", 0.3, ATTN_NORM);
+ autosave (activator, self.message);
+};
+
+//----------------------------------------------------------------------
+void() toggle_autosave =
+{
+ local entity e = world;
+ local float printed = FALSE;
+
+ do {
+ e = find (e, classname, "target_autosave");
+ if (!e)
+ break;
+
+ if (e.use == target_autosave_use)
+ {
+ e.use = SUB_Null;
+ if (!printed)
+ {
+ bprint ("Autosaves disabled\n");
+ printed = TRUE;
+ }
+ }
+ else
+ {
+ e.use = target_autosave_use;
+ if (!printed)
+ {
+ bprint ("Autosaves reenabled\n");
+ printed = TRUE;
+ }
+ }
+
+ }
+ while (e != world);
+};
+
+/*QUAKED target_autosave (1 .0 .5) (-8 -8 -8) (8 8 8)
+Saves the game when triggered by a player. Never appears in multiplayer. the bprint tends to stomp any other prints on screen in most quake clients, so use a delayed trigger_relay if you fire this from an important pickup/trigger_counter/something else that puts text on screen more important than the autosave blurb.
+
+Keys:
+"message" change save file name, defaults to 'auto'
+*/
+/*FGD
+@Pointclass base(Target, Targetname, Appearflags) color(255 0 128) size(32 32 32) = target_autosave :
+"Saves the game when triggered by a player. Never appears in multiplayer.
+the bprint tends to stomp any other prints on screen in most quake clients, so use a delayed trigger_relay if you fire this from an important pickup/trigger_counter/something else that puts text on screen more important than the autosave blurb."
+[
+ message(string) : "Change save filename" : "auto"
+]
+*/
+void() target_autosave =
+{
+ if (deathmatch || coop)
+ {
+ remove (self);
+ return;
+ }
+
+ if (self.message == string_null)
+ self.message = "auto";
+ // precache_sound2 ("misc/sav.wav");
+ self.use = target_autosave_use;
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/misc/viewthing.qc

diff --git a/qc/misc/viewthing.qc b/qc/misc/viewthing.qc
new file mode 100644
index 0000000..985dd4a
--- /dev/null
+++ b/qc/misc/viewthing.qc
@@ -0,0 +1,21 @@
+//==============================================================================
+// viewthing -- was in misc.qc
+//==============================================================================
+
+//~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>
+
+/*QUAKED viewthing (0 .5 .8) (-8 -8 -8) (8 8 8)
+
+Just for the debugging level. Don't use
+*/
+void() viewthing =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_NOT;
+ precache_model ("progs/player.mdl");
+ setmodel (self, "progs/player.mdl");
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/misc_model.qc

diff --git a/qc/misc_model.qc b/qc/misc_model.qc
deleted file mode 100644
index c801bc2..0000000
--- a/qc/misc_model.qc
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * misc_model.qc requires math.qc
- *
- * Author: Joshua Skelton joshua.skelton@gmail.com
- * Edited by: Inky 20201219 Minor changes for a better integration with my own code
- * Edited by: bmFbr for solid and gravity spawnflags and custom bbox sizes
- * Edited by: dumptruck_ds to add start and stop animations
- */
-
-.float first_frame; // The starting frame of the animation
-.float last_frame; // The ending frame of the animation
-
-/*QUAKED misc_model (0 0.5 0.8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
- model ({"path" : mdl, "skin" : skin, "frame": frame});
-}
-An entity for displaying models. A frame range can be given to animate the
-model.
-
-mdl: The model to display. Can be of type mdl, bsp, or spr.
-
-frame: The frame to display. Can be used to offset the animation.
-
-first_frame: The starting frame of the animation.
-
-last_frame: The last frame of the animation.
-*/
-
-float MISC_MODEL_GRAVITY = 1;
-float MISC_MODEL_SOLID = 2;
-float MISC_MODEL_BACK_AND_FORTH = 4;
-float MISC_MODEL_ONLY_ONCE = 8;
-float MISC_MODEL_PLAY_COUNT = 16;
-float MISC_MODEL_STARTOFF = 32;
-
-void() misc_model_use =
-{
- if (self.state == STATE_ACTIVE)
- {
- if (self.spawnflags & MISC_MODEL_SOLID)
- self.solid = SOLID_NOT;
- self.model = "";
-
- self.state = STATE_INVISIBLE;
- setorigin (self, self.origin);
- }
- else
- {
- if (self.spawnflags & MISC_MODEL_SOLID)
- self.solid = SOLID_BBOX;
- self.model = self.mdl;
-
- self.state = STATE_ACTIVE;
- setorigin (self, self.origin);
- }
-};
-
-/*
- * misc_model_think
- *
- * Handles animation for misc_model entity.
- */
-void() misc_model_think =
-{
- self.nextthink = time + fabs(self.speed);
- if (self.estate != STATE_ACTIVE)
- return;
-
- self.frame = self.frame + sign (self.speed);
-
- if (self.spawnflags & MISC_MODEL_BACK_AND_FORTH
- && self.frame < self.first_frame)
- {
- self.speed = -1 * self.speed;
- self.frame += 2;
- }
- else if (self.spawnflags & MISC_MODEL_BACK_AND_FORTH
- && self.frame > self.last_frame)
- {
- self.speed = -1 * self.speed;
- self.frame -= 2;
- }
- else
- {
- self.frame = wrap (self.frame, self.first_frame,
- self.last_frame);
- }
-
- if (self.spawnflags & MISC_MODEL_ONLY_ONCE
- && self.frame == self.last_frame
- && self.last_frame != self.first_frame)
- self.nextthink = -1;
-
- if (self.spawnflags & MISC_MODEL_PLAY_COUNT
- && self.frame == self.last_frame
- && self.last_frame != self.first_frame)
- {
- if !(self.count)
- objerror ("Error: set count to the number of animation cycles!");
- self.cnt = self.cnt + 1;
- dprint (ftos(self.cnt));
- dprint ("\n");
- if (self.cnt != self.count)
- return FALSE;
- else
- self.nextthink = -1;
- }
-};
-
-void() misc_model =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit ())
- return;
-
- if (!self.mdl || self.mdl == "")
- objerror("Model not defined");
-
- if (!self.centeroffset)
- self.centeroffset = '0 0 0';
- if (!self.mdlsz)
- self.mdlsz = '32 32 32';
-
- vector vmin, vmax;
-
- vmin_x = self.centeroffset_x - (self.mdlsz_x / 2);
- vmin_y = self.centeroffset_y - (self.mdlsz_y / 2);
- vmin_z = self.centeroffset_z - (self.mdlsz_z / 2);
-
- vmax_x = self.centeroffset_x + (self.mdlsz_x / 2);
- vmax_y = self.centeroffset_y + (self.mdlsz_y / 2);
- vmax_z = self.centeroffset_z + (self.mdlsz_z / 2);
-
- precache_model(self.mdl);
- setmodel(self, self.mdl);
-
- setsize(self, vmin, vmax);
-
- if (self.spawnflags & MISC_MODEL_SOLID)
- self.solid = SOLID_BBOX;
- else self.solid = SOLID_NOT;
-
- if (self.spawnflags & MISC_MODEL_GRAVITY)
- self.movetype = MOVETYPE_TOSS;
- else self.movetype = MOVETYPE_NONE;
-
- self.use = misc_model_use;
-
- if (!self.frame)
- self.frame = self.first_frame;
-
- // Make static (not animate) if not given a frame range, and
- // not affected by gravity; also remains active if it has a
- // targetname (so it can be killtargeted/toggled)
- if (!self.last_frame
- && !(self.spawnflags & MISC_MODEL_GRAVITY)
- && !(self.spawnflags & MISC_MODEL_SOLID)
- && !self.targetname
- && !self.targetname2)
- // && !(self.spawnflags & MISC_MODEL_DONTMAKESTATIC)
- makestatic(self);
-
- // Make static (not animate) if not given a frame range, and
- // not affected by gravity
- // changed by bmFbr
- // if (!self.last_frame && !(self.spawnflags & MISC_MODEL_GRAVITY))
- // {
- // makestatic(self);
- // return;
- // }
-
- // if it as a custom animation range
- if (self.last_frame)
- {
- // Default animation speed to 10 fps
- if (!self.speed)
- self.speed = 0.1;
- self.nextthink = time + self.speed;
- self.think = misc_model_think;
- }
-
- if (self.spawnflags & MISC_MODEL_STARTOFF)
- self.state = STATE_ACTIVE;
- else
- self.state = STATE_INVISIBLE;
-
- misc_model_use ();
-};

Return to the top of this page or return to the overview of this repo.

Diff qc/player.qc

diff --git a/qc/player.qc b/qc/player.qc
index 6d7e89a..5ae36f4 100644
--- a/qc/player.qc
+++ b/qc/player.qc
@@ -1,100 +1,74 @@
+//==============================================================================
+// player
+//==============================================================================

+// prototypes
void() bubble_bob;
+void() player_run;
+void() player_diea1;
+void() player_dieb1;
+void() player_diec1;
+void() player_died1;
+void() player_diee1;
+void() player_die_ax1;

-/*
-==============================================================================
-
-PLAYER
-
-==============================================================================
-*/
-
+// frame macros
$cd id1/models/player_4
$origin 0 -6 24
$base base
$skin skin

-//
+//----------------------------------------------------------------------
// running
-//
$frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
-
$frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6

-//
+//----------------------------------------------------------------------
// standing
-//
$frame stand1 stand2 stand3 stand4 stand5
-
$frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
$frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12

-
-//
+//----------------------------------------------------------------------
// pain
-//
$frame axpain1 axpain2 axpain3 axpain4 axpain5 axpain6
-
$frame pain1 pain2 pain3 pain4 pain5 pain6

-
-//
+//----------------------------------------------------------------------
// death
-//
-
$frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6
$frame axdeth7 axdeth8 axdeth9
-
$frame deatha1 deatha2 deatha3 deatha4 deatha5 deatha6 deatha7 deatha8
$frame deatha9 deatha10 deatha11
-
$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
$frame deathb9
-
$frame deathc1 deathc2 deathc3 deathc4 deathc5 deathc6 deathc7 deathc8
$frame deathc9 deathc10 deathc11 deathc12 deathc13 deathc14 deathc15
-
$frame deathd1 deathd2 deathd3 deathd4 deathd5 deathd6 deathd7
$frame deathd8 deathd9
-
$frame deathe1 deathe2 deathe3 deathe4 deathe5 deathe6 deathe7
$frame deathe8 deathe9

-//
+//----------------------------------------------------------------------
// attacks
-//
$frame nailatt1 nailatt2
-
$frame light1 light2
-
$frame rockatt1 rockatt2 rockatt3 rockatt4 rockatt5 rockatt6
-
$frame shotatt1 shotatt2 shotatt3 shotatt4 shotatt5 shotatt6
-
$frame axatt1 axatt2 axatt3 axatt4 axatt5 axatt6
-
$frame axattb1 axattb2 axattb3 axattb4 axattb5 axattb6
-
$frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
-
$frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6

+//======================================================================

-/*
-==============================================================================
-PLAYER
-==============================================================================
-*/
-
-void() player_run;
-
-void() player_stand1 =[ $axstnd1, player_stand1 ]
+void() player_stand1 = [$axstnd1, player_stand1]
{
- self.weaponframe=0;
+ self.weaponframe = 0;
if (self.velocity_x || self.velocity_y)
{
- self.walkframe=0;
- player_run();
+ self.walkframe = 0;
+ player_run ();
return;
}

@@ -113,13 +87,13 @@ void() player_stand1 =[ $axstnd1, player_stand1 ]
self.walkframe = self.walkframe + 1;
};

-void() player_run =[ $rockrun1, player_run ]
+void() player_run = [$rockrun1, player_run]
{
- self.weaponframe=0;
+ self.weaponframe = 0;
if (!self.velocity_x && !self.velocity_y)
{
- self.walkframe=0;
- player_stand1();
+ self.walkframe = 0;
+ player_stand1 ();
return;
}

@@ -138,37 +112,56 @@ void() player_run =[ $rockrun1, player_run ]
self.walkframe = self.walkframe + 1;
};

+void() player_shot1 = [$shotatt1, player_shot2]
+{
+ self.weaponframe = 1;
+ self.effects = self.effects | EF_MUZZLEFLASH;
+};
+void() player_shot2 = [$shotatt2, player_shot3] { self.weaponframe = 2; };
+void() player_shot3 = [$shotatt3, player_shot4] { self.weaponframe = 3; };
+void() player_shot4 = [$shotatt4, player_shot5] { self.weaponframe = 4; };
+void() player_shot5 = [$shotatt5, player_shot6] { self.weaponframe = 5; };
+void() player_shot6 = [$shotatt6, player_run] { self.weaponframe = 6; };
+
+void() player_axe1 = [$axatt1, player_axe2] { self.weaponframe = 1; };
+void() player_axe2 = [$axatt2, player_axe3] { self.weaponframe = 2; };
+void() player_axe3 = [$axatt3, player_axe4]
+{
+ self.weaponframe = 3;
+ W_FireAxe ();
+};
+void() player_axe4 = [$axatt4, player_run] { self.weaponframe = 4; };

-void() player_shot1 = [$shotatt1, player_shot2 ] {self.weaponframe=1;
-self.effects = self.effects | EF_MUZZLEFLASH;};
-void() player_shot2 = [$shotatt2, player_shot3 ] {self.weaponframe=2;};
-void() player_shot3 = [$shotatt3, player_shot4 ] {self.weaponframe=3;};
-void() player_shot4 = [$shotatt4, player_shot5 ] {self.weaponframe=4;};
-void() player_shot5 = [$shotatt5, player_shot6 ] {self.weaponframe=5;};
-void() player_shot6 = [$shotatt6, player_run ] {self.weaponframe=6;};
-
-void() player_axe1 = [$axatt1, player_axe2 ] {self.weaponframe=1;};
-void() player_axe2 = [$axatt2, player_axe3 ] {self.weaponframe=2;};
-void() player_axe3 = [$axatt3, player_axe4 ] {self.weaponframe=3;W_FireAxe();};
-void() player_axe4 = [$axatt4, player_run ] {self.weaponframe=4;};
-
-void() player_axeb1 = [$axattb1, player_axeb2 ] {self.weaponframe=5;};
-void() player_axeb2 = [$axattb2, player_axeb3 ] {self.weaponframe=6;};
-void() player_axeb3 = [$axattb3, player_axeb4 ] {self.weaponframe=7;W_FireAxe();};
-void() player_axeb4 = [$axattb4, player_run ] {self.weaponframe=8;};
+void() player_axeb1 = [$axattb1, player_axeb2] { self.weaponframe = 5; };
+void() player_axeb2 = [$axattb2, player_axeb3] { self.weaponframe = 6; };
+void() player_axeb3 = [$axattb3, player_axeb4]
+{
+ self.weaponframe = 7;
+ W_FireAxe ();
+};
+void() player_axeb4 = [$axattb4, player_run] { self.weaponframe = 8; };

-void() player_axec1 = [$axattc1, player_axec2 ] {self.weaponframe=1;};
-void() player_axec2 = [$axattc2, player_axec3 ] {self.weaponframe=2;};
-void() player_axec3 = [$axattc3, player_axec4 ] {self.weaponframe=3;W_FireAxe();};
-void() player_axec4 = [$axattc4, player_run ] {self.weaponframe=4;};
+void() player_axec1 = [$axattc1, player_axec2] { self.weaponframe = 1; };
+void() player_axec2 = [$axattc2, player_axec3] { self.weaponframe = 2; };
+void() player_axec3 = [$axattc3, player_axec4]
+{
+ self.weaponframe = 3;
+ W_FireAxe ();
+};
+void() player_axec4 = [$axattc4, player_run] { self.weaponframe = 4; };

-void() player_axed1 = [$axattd1, player_axed2 ] {self.weaponframe=5;};
-void() player_axed2 = [$axattd2, player_axed3 ] {self.weaponframe=6;};
-void() player_axed3 = [$axattd3, player_axed4 ] {self.weaponframe=7;W_FireAxe();};
-void() player_axed4 = [$axattd4, player_run ] {self.weaponframe=8;};
+void() player_axed1 = [$axattd1, player_axed2] { self.weaponframe = 5; };
+void() player_axed2 = [$axattd2, player_axed3] { self.weaponframe = 6; };
+void() player_axed3 = [$axattd3, player_axed4]
+{
+ self.weaponframe = 7;
+ W_FireAxe ();
+};
+void() player_axed4 = [$axattd4, player_run] { self.weaponframe = 8; };

+//======================================================================

-//============================================================================
+// TODO CEV

void() player_nail1 =[$nailatt1, player_nail2 ]
{
@@ -197,7 +190,7 @@ void() player_nail2 =[$nailatt2, player_nail1 ]
self.attack_finished = time + 0.2;
};

-//============================================================================
+//======================================================================

void() player_light1 =[$light1, player_light2 ]
{
@@ -226,8 +219,7 @@ void() player_light2 =[$light2, player_light1 ]
self.attack_finished = time + 0.2;
};

-//============================================================================
-
+//======================================================================

void() player_rocket1 =[$rockatt1, player_rocket2 ] {self.weaponframe=1;
self.effects = self.effects | EF_MUZZLEFLASH;};
@@ -352,13 +344,6 @@ void(entity attacker, float damage) player_pain =
player_pain1 ();
};

-void() player_diea1;
-void() player_dieb1;
-void() player_diec1;
-void() player_died1;
-void() player_diee1;
-void() player_die_ax1;
-
void() DeathBubblesSpawn =
{
local entity bubble;
@@ -680,7 +665,7 @@ void() player_die_ax7 = [ $axdeth7, player_die_ax8 ] {};
void() player_die_ax8 = [ $axdeth8, player_die_ax9 ] {};
void() player_die_ax9 = [ $axdeth9, player_die_ax9 ] {PlayerDead();};

-/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */
+//======================================================================

/*QUAKED player_dead_axe (0 0.5 0.8) (-16 -16 -24) (16 16 32) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
@@ -689,23 +674,23 @@ void() player_die_ax9 = [ $axdeth9, player_die_ax9 ] {PlayerDead();};
*/
void() player_dead_axe =
{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
return;

- precache_model("progs/player.mdl");
- setmodel(self, "progs/player.mdl");
+ precache_model ("progs/player.mdl");
+ setmodel (self, "progs/player.mdl");
self.frame = $axdeth9;

if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
- setsize(self,'-38.72 -5.83 -50.45','28.73 33.85 30');
+ setsize (self,'-38.72 -5.83 -50.45','28.73 33.85 30');
}
else
{
self.solid = SOLID_NOT;
}
-
};

/*QUAKED player_dead_face_down (0 0.5 0.8) (-16 -16 -24) (16 16 32) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -715,23 +700,23 @@ void() player_dead_axe =
*/
void() player_dead_face_down =
{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
return;

- precache_model("progs/player.mdl");
- setmodel(self, "progs/player.mdl");
+ precache_model ("progs/player.mdl");
+ setmodel (self, "progs/player.mdl");
self.frame = $deathc14;

if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
- setsize(self,'-50.28 -23.55 -49.85','30.66 14.49 30');
+ setsize (self,'-50.28 -23.55 -49.85','30.66 14.49 30');
}
else
{
self.solid = SOLID_NOT;
}
-
};

/*QUAKED player_dead_on_side (0 0.5 0.8) (-16 -16 -24) (16 16 32) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -741,22 +726,22 @@ void() player_dead_face_down =
*/
void() player_dead_on_side =
{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
return;

- precache_model("progs/player.mdl");
- setmodel(self, "progs/player.mdl");
+ precache_model ("progs/player.mdl");
+ setmodel (self, "progs/player.mdl");
self.frame = $deathe9;

if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
- setsize(self,'-38.72 -5.83 -50.45','28.73 33.85 30');
+ setsize (self,'-38.72 -5.83 -50.45','28.73 33.85 30');
}
else
{
self.solid = SOLID_NOT;
}
-
};
-/* END Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */
+// END Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds

Return to the top of this page or return to the overview of this repo.

Diff qc/pmove.qc

diff --git a/qc/pmove.qc b/qc/pmove.qc
index b15ce7b..74788fa 100644
--- a/qc/pmove.qc
+++ b/qc/pmove.qc
@@ -5,6 +5,7 @@
// TODO CEV: crouching
// TODO CEV: crouch sliding (useful for sliding up stairs)
// TODO CEV: crouch-wall-thing (wallrunning? wall sliding?)
+// TODO CEV: improved player unstick function
// TODO CEV: more work on walking
// TODO CEV: varied sounds (footsteps, different jump sounds)

@@ -939,7 +940,7 @@ void() PM_WallJump =
// vertical, we hit it at a speed greater than -90, and
// that something is within 20 (units?) -- CEV
if (trace_fraction < 1.0f &&
- trace_plane_normal_z < 0.2f &&
+ trace_plane_normal_z <= 0.7f &&
trace_plane_normal_z >= 0 &&
self.velocity * trace_plane_normal >= -90 &&
vlen(self.origin - trace_endpos) <= 20)

Return to the top of this page or return to the overview of this repo.

Diff qc/progs.src

diff --git a/qc/progs.src b/qc/progs.src
index 6923255..761389d 100644
--- a/qc/progs.src
+++ b/qc/progs.src
@@ -14,36 +14,58 @@ defs_entvars.qc // entvars_t
defs_builtins.qc // builtin functions (& overrides)
defs_misc.qc // additional

+//----------------------------------------------------------------------
+// utility & helper functions
+//----------------------------------------------------------------------
math.qc // Code by Joshua Skelton
utility.qc
newflags.qc // new spawnflags for all entities
-
+cshift.qc // background color shift controller
subs.qc // modified targets, triggers and killtargets
keydata.qc // functions which deal with key item bitflags + names
keylock.qc // common code for entities unlockable with keys
-
-fight.qc
custom_snd.qc // mapper-settable sound FX for monsters - iw
custom_mdls.qc // mapper-settable models for monsters - iw
+
+//----------------------------------------------------------------------
+// world -- TODO CEV
+//----------------------------------------------------------------------
+world.qc
+
+//----------------------------------------------------------------------
+// combat & monster AI -- TODO CEV
+//----------------------------------------------------------------------
+fight.qc
ai.qc
combat.qc
-world.qc
-intermission.qc
+
+//----------------------------------------------------------------------
+// client code -- TODO CEV
+//----------------------------------------------------------------------
+client/impulse.qc // impulse cmd handling; was in weapons.qc -- CEV
+client/intermission.qc // intermission & exit screen text
+
pmove.qc // QC player movement code -- CEV
client.qc
cutscene.qc // Drake version -- dumptruck_ds
player.qc
+weapons.qc

//----------------------------------------------------------------------
-// items
+// item entities
//----------------------------------------------------------------------
-items.qc
-items_armor.qc
-items_health.qc
-weapons.qc
+items/ammo.qc // ammo; was in items.qc
+items/armor.qc // armor; was in items.qc
+items/backpacks.qc // backpack code; was in items.qc
+items/keys.qc // key pickups; was in items.qc
+items/health.qc // health; was in items.qc
+items/misc.qc // miscellaneous item helper functions & noclass
+items/powerups.qc // envirosuit, pent, ring, quad; was in items.qc
+items/runes.qc // end-of-episode runes; was in items.qc
+items/weapons.qc // weapon pickups; was in items.qc

//----------------------------------------------------------------------
-// func
+// func entities
//----------------------------------------------------------------------
func/bob.qc // RennyC's stand alone version based on AD
func/bossgate.qc // was misc.qc -- CEV
@@ -65,19 +87,20 @@ func/plat.qc // was plats.qc -- CEV
func/particlefield.qc // Hipnotic particlefield and func_togglewall
func/rotate.qc // from Hipnotic thanks RennyC; was rotate.qc
func/shadow.qc //
-func/togglevisiblewall.qc// was misc.qc -- CEV
+func/togglevisiblewall.qc // was misc.qc -- CEV
func/togglewall.qc // was hippart.qc -- CEV
func/train.qc // was plats.qc -- CEV
func/wall.qc // was misc.qc -- CEV

//----------------------------------------------------------------------
-// triggers
+// trigger entities
//----------------------------------------------------------------------
triggers/changelevel.qc //
triggers/changemusic.qc //
-triggers/changetarget.qc//
+triggers/changetarget.qc
triggers/counter.qc //
triggers/filter.qc //
+triggers/fog.qc // fog triggers
triggers/heal.qc // trigger_heal (was in dtmisc.qc) -- CEV
triggers/hurt.qc //
triggers/ladder.qc // ladders (from rubicon2) -- CEV
@@ -85,7 +108,7 @@ triggers/look.qc //
triggers/misc.qc // was triggers.qc -- CEV
triggers/monsterface.qc //
triggers/monsterjump.qc //
-triggers/onlyregistered.qc//
+triggers/onlyregistered.qc
triggers/push.qc // wind/push brushes, jumppads -- CEV
triggers/remove.qc // was in hip_trig.qc; currently commented out -- CEV
triggers/secret.qc //
@@ -99,10 +122,8 @@ triggers/usekey.qc // was in hip_trig.qc -- CEV
triggers/void.qc //

//----------------------------------------------------------------------
-// monsters
+// monster entities
//----------------------------------------------------------------------
-monsters.qc // modified by dumptruck_ds from Preach's
- // spawning tutorial | fish count fixed
monsters/boss.qc
monsters/boss2.qc // killable Chthon
monsters/dog.qc
@@ -120,26 +141,42 @@ monsters/oldone.qc // registered
monsters/oldone2.qc // killable Shub
monsters/shalrath.qc // registered

+monsters.qc // modified by dumptruck_ds from Preach's
+ // spawning tutorial | fish count fixed
+ // TODO CEV
+
+//----------------------------------------------------------------------
+// hazards
+//----------------------------------------------------------------------
+hazards/ltrail.qc // from DOE lightnin.qc
+hazards/shooter.qc // was in misc.qc
+
//----------------------------------------------------------------------
-// misc
+// miscellaneous entities
//----------------------------------------------------------------------
+misc/air_bubbles.qc // was in misc.qc -- CEV
+misc/ambient_sound.qc // misc. ambient_ entities w/additions by dumptruck_ds
+misc/deadstuff.qc // misc gore from DeadStuff mod
+misc/explobox.qc // was in misc.qc -- CEV
+misc/fireball.qc // was in misc.qc -- CEV
+misc/infight.qc // was in misc.qc -- CEV
+misc/light_candle.qc // was in misc.qc -- CEV
+misc/lights.qc // c0burn's excellent switchable lights
+misc/model.qc // Code by Joshua Skelton
misc/modeltrain.qc // was in plats.qc -- CEV
+misc/noisemaker.qc // was in misc.qc -- CEV
misc/particles.qc // selections from Rubicon2 QC; was rubicon2.qc -- CEV
misc/particlespray.qc // selections from Rubicon2 QC; was rubicon2.qc -- CEV
misc/particle_stream.qc // from Zerstrorer mod -- dumptruck_ds; was dtmisc.qc
+misc/play.qc // sound code from Hip & Rubicon Rumble + misc visuals
misc/sparks.qc // selections from Rubicon2 QC; was rubicon2.qc -- CEV
+misc/target_autosave.qc // was in misc.qc -- CEV
misc/teleporttrain.qc // was in plats.qc -- CEV
+misc/viewthing.qc // was in misc.qc -- CEV

-misc.qc
-fog.qc // fog triggers
-
-cshift.qc // background color shift controller
-dtmisc.qc // sound code from Hipnotic & Rubicon Rumble
- // and misc visual effects
-lights.qc // c0burn's excellent switchable lights
-misc_model.qc // Code by Joshua Skelton
-
-doe_ltrail.qc // from DOE lightnin.qc
-
+//----------------------------------------------------------------------
+// compatibility spawn functions & misc
+//----------------------------------------------------------------------
compat_quake3.qc // entrypoints & support for Quake 3 entities
#endlist
+

Return to the top of this page or return to the overview of this repo.

Diff qc/subs.qc

diff --git a/qc/subs.qc b/qc/subs.qc
index 06eb3fa..279a426 100644
--- a/qc/subs.qc
+++ b/qc/subs.qc
@@ -1,11 +1,66 @@
+//==============================================================================
+// subs.qc
+//==============================================================================

+// Supa, Quoth respawning items support Respawn item like in DM if 'ritem' TRUE,
+// override respawn time with 'respawndelay' if set, inc 'cnt' with each respawn
+// and if 'respawncount' is set we'll remove the item if cnt > respawncount
+// remember that SUB_Regen is already set on every item that can respawn, all we
+// need to do is give a nextthink time in order to trigger it
+.float ritem, respawndelay, respawncount;

-void() SUB_Null = {};
+void() SUB_CalcAngleMoveDoneController;
+float (entity targ) visible;
+
+//----------------------------------------------------------------------
+// CheckItemRespawn -- was in items.qc
+//----------------------------------------------------------------------
+void(entity whatitem, float defaultdelay) CheckItemRespawn =
+{
+ // respawn item if true, otherwise abort
+ if (!whatitem.ritem)
+ return;

-void(entity attacker, float damage) SUB_NullPain = {};
+ // inc before check to account for zero indexing
+ whatitem.cnt = whatitem.cnt + 1;

-void() SUB_Remove = {remove(self);};
+ // limited respawns
+ if (whatitem.respawncount && whatitem.respawncount < whatitem.cnt)
+ return;
+
+ // okay, we're clear to set up a respawn
+ if (whatitem.respawndelay)
+ // custom respawn delay
+ whatitem.nextthink = time + whatitem.respawndelay;
+ else
+ whatitem.nextthink = time + defaultdelay;
+};
+
+//----------------------------------------------------------------------
+// CheckValidTouch -- health and playerhood checks were duplicated everywhere
+// added noclip check because Quake's default still-touch-everything noclip
+// is awful -- from Copper -- dumptruck_ds (orginally found in triggers.qc)
+//----------------------------------------------------------------------
+float() CheckValidTouch =
+{
+ if (other.classname != "player")
+ return FALSE;
+ if (other.health <= 0)
+ return FALSE;
+ if (other.movetype == MOVETYPE_NOCLIP)
+ return FALSE;
+ if (self.estate != STATE_ACTIVE)
+ return FALSE;
+ return TRUE;
+};

+//----------------------------------------------------------------------
+void() DelayThink =
+{
+ activator = self.enemy;
+ SUB_UseTargets ();
+ remove (self);
+};

/*
QuakeEd only writes a single float for angles (bad idea), so up and down are
@@ -14,9 +69,13 @@ just constant angles.
void() SetMovedir =
{
if (self.angles == '0 -1 0')
+ {
self.movedir = '0 0 1';
+ }
else if (self.angles == '0 -2 0')
+ {
self.movedir = '0 0 -1';
+ }
else
{
makevectors (self.angles);
@@ -26,67 +85,83 @@ void() SetMovedir =
self.angles = '0 0 0';
};

-
-/*
-=============
-SUB_CallAsSelf
-
-wrap the self/oself shuffle for code cleanliness elsewhere
-===============
-*/
-void(void() fun, entity newself) SUB_CallAsSelf =
-{
- local entity oself;
-
- oself = self;
- self = newself;
- fun();
- self = oself;
-}
-
-/*
-================
-InitTrigger
-================
-*/
+//----------------------------------------------------------------------
+// InitTrigger
+//----------------------------------------------------------------------
void() InitTrigger =
{
-// trigger angles are used for one-way touches. An angle of 0 is assumed
-// to mean no restrictions, so use a yaw of 360 instead.
+ // trigger angles are used for one-way touches.
+ // An angle of 0 is assumed to mean no restrictions, so use a
+ // yaw of 360 instead.
if (self.angles != '0 0 0')
SetMovedir ();
+
self.solid = SOLID_TRIGGER;
- setmodel (self, self.model); // set size and link into world
+ // set size and link into world
+ setmodel (self, self.model);
self.movetype = MOVETYPE_NONE;
self.modelindex = 0;
self.model = "";
};

-// Drake -- dumptruck_ds
-// PM: The point trigger version of InitTrigger.
+//----------------------------------------------------------------------
+// InitPointTrigger -- Drake -- dumptruck_ds
+// PM: The point trigger version of InitTrigger.
+//----------------------------------------------------------------------
void() InitPointTrigger =
{
- local vector v1, v2;
+ local vector v1, v2;

- v1 = self.origin;
- v2 = v1 + self.mangle;
- self.model = "";
- setorigin (self, '0 0 0');
- InitTrigger (); // Calls 'setmodel', so do first.
- setsize (self, v1, v2); // Calling 'setmodel' resets entity size.
+ v1 = self.origin;
+ v2 = v1 + self.mangle;
+ self.model = "";
+ setorigin (self, '0 0 0');
+
+ // Calls 'setmodel', so do first.
+ InitTrigger ();
+
+ // Calling 'setmodel' resets entity size.
+ setsize (self, v1, v2);
};

-/*
-=============
-SUB_CalcMove
+//----------------------------------------------------------------------
+void() SUB_Null =
+{
+ // no-op
+};

-calculate self.velocity and self.nextthink to reach dest from
-self.origin traveling at speed
-===============
-*/
+//----------------------------------------------------------------------
+void(entity attacker, float damage) SUB_NullPain =
+{
+ // no-op
+};
+
+//----------------------------------------------------------------------
+void() SUB_Remove =
+{
+ remove (self);
+};
+
+//----------------------------------------------------------------------
+// SUB_CallAsSelf -- wrap the self/oself shuffle for code cleanliness elsewhere
+//----------------------------------------------------------------------
+void(void() fun, entity newself) SUB_CallAsSelf =
+{
+ local entity oself;
+
+ oself = self;
+ self = newself;
+ fun();
+ self = oself;
+};
+
+//----------------------------------------------------------------------
+// SUB_CalcMove -- calculate self.velocity and self.nextthink to reach
+// dest from self.origin traveling at speed
+//----------------------------------------------------------------------
void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt =
{
- local entity stemp;
+ local entity stemp;
stemp = self;
self = ent;

@@ -94,16 +169,19 @@ void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt =
self = stemp;
};

+//----------------------------------------------------------------------
void(vector tdest, float tspeed, void() func) SUB_CalcMove =
{
- local vector vdestdelta;
- local float len, traveltime, localtime;
+ local vector vdestdelta;
+ local float len, traveltime, localtime;

if (!tspeed)
- objerror("No speed is defined!");
+ objerror ("No speed is defined!");

- if (self.movetype == MOVETYPE_PUSH) localtime = self.ltime;
- else localtime = time;
+ if (self.movetype == MOVETYPE_PUSH)
+ localtime = self.ltime;
+ else
+ localtime = time;

self.think1 = func;
self.finaldest = tdest;
@@ -116,13 +194,13 @@ void(vector tdest, float tspeed, void() func) SUB_CalcMove =
return;
}

-// set destdelta to the vector needed to move
+ // set destdelta to the vector needed to move
vdestdelta = tdest - self.origin;

-// calculate length of vector
+ // calculate length of vector
len = vlen (vdestdelta);

-// divide by speed to get time to reach dest
+ // divide by speed to get time to reach dest
traveltime = len / tspeed;

if (traveltime < 0.1)
@@ -132,67 +210,66 @@ void(vector tdest, float tspeed, void() func) SUB_CalcMove =
return;
}

-// set nextthink to trigger a think when dest is reached
+ // set nextthink to trigger a think when dest is reached
self.nextthink = localtime + traveltime;

-// scale the destdelta vector by the time spent traveling to get velocity
- self.velocity = vdestdelta * (1/traveltime); // qcc won't take vec/float
+ // scale the destdelta vector by the time spent traveling
+ // to get velocity
+ // qcc won't take vec/float
+ self.velocity = vdestdelta * (1 / traveltime);
};

-/*
-============
-After moving, set origin to exact final destination
-============
-*/
-void() SUB_CalcMoveDone =
+//----------------------------------------------------------------------
+// SUB_CalcMoveDone -- After moving, set origin to exact final destination
+//----------------------------------------------------------------------
+void() SUB_CalcMoveDone =
{
- setorigin(self, self.finaldest);
+ setorigin (self, self.finaldest);
self.velocity = '0 0 0';
self.nextthink = -1;
if (self.think1)
- self.think1();
+ self.think1 ();
};

-/*
-=============
-SUB_CalcAngleMove
-
-calculate self.avelocity and self.nextthink to reach destangle from
-self.angles rotating
-
-The calling function should make sure self.think is valid
-===============
-*/
-void(entity ent, vector destangle, float tspeed, void() func) SUB_CalcAngleMoveEnt =
+//----------------------------------------------------------------------
+// SUB_CalcAngleMove
+// calculate self.avelocity and self.nextthink to reach destangle from
+// self.angles rotating. The calling function should make sure self.think
+// is valid
+//----------------------------------------------------------------------
+void(entity ent, vector destangle, float tspeed, void() func)
+ SUB_CalcAngleMoveEnt =
{
-local entity stemp;
+ local entity stemp;
stemp = self;
self = ent;
SUB_CalcAngleMove (destangle, tspeed, func);
self = stemp;
};

+//----------------------------------------------------------------------
void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove =
{
-local vector destdelta;
-local float len, traveltime;
+ local vector destdelta;
+ local float len, traveltime;

if (!tspeed)
objerror("No speed is defined!");

-// set destdelta to the vector needed to move
+ // set destdelta to the vector needed to move
destdelta = destangle - self.angles;

-// calculate length of vector
+ // calculate length of vector
len = vlen (destdelta);

-// divide by speed to get time to reach dest
+ // divide by speed to get time to reach dest
traveltime = len / tspeed;

-// set nextthink to trigger a think when dest is reached
+ // set nextthink to trigger a think when dest is reached
self.nextthink = self.ltime + traveltime;

-// scale the destdelta vector by the time spent traveling to get velocity
+ // scale the destdelta vector by the time spent traveling to
+ // get velocity
self.avelocity = destdelta * (1 / traveltime);

self.think1 = func;
@@ -200,45 +277,38 @@ local float len, traveltime;
self.think = SUB_CalcAngleMoveDone;
};

-/*
-============
-After rotating, set angle to exact final angle
-============
-*/
+//----------------------------------------------------------------------
+// SUB_CalcAngleMoveDone -- After rotating, set angle to exact final angle
+//----------------------------------------------------------------------
void() SUB_CalcAngleMoveDone =
{
self.angles = self.finalangle;
self.avelocity = '0 0 0';
self.nextthink = -1;
if (self.think1)
- self.think1();
+ self.think1 ();
};

-/*
-=============
-SUB_CalcAngleMoveController
-
-Same as SUB_CalcAngleMove, but using a separate controller entity
-to not lose track of current think functions.
-
-===============
-*/
-void() SUB_CalcAngleMoveDoneController;
-
-void(vector destangle, float tspeed, void() func, entity controller) SUB_CalcAngleMoveController =
+//----------------------------------------------------------------------
+// SUB_CalcAngleMoveController -- Same as SUB_CalcAngleMove, but using a
+// separate controller entity to not lose track of current think functions.
+//----------------------------------------------------------------------
+void(vector destangle, float tspeed, void() func, entity controller)
+ SUB_CalcAngleMoveController =
{
- local vector destdelta;
- local float len, traveltime;
+ local vector destdelta;
+ local float len, traveltime;

if (!tspeed)
objerror("No speed is defined!");

// set destdelta to the vector needed to move

- destdelta = normalizeAngles180(destangle - self.angles);
- /*dprint3("destangle: ", vtos(destangle), "\n");
- dprint3("self.angles: ", vtos( self.angles), "\n");
- dprint3("destdelta: ", vtos(destdelta), "\n");
+ destdelta = normalizeAngles180 (destangle - self.angles);
+ /*
+ dprint3 ("destangle: ", vtos(destangle), "\n");
+ dprint3 ("self.angles: ", vtos( self.angles), "\n");
+ dprint3 ("destdelta: ", vtos(destdelta), "\n");
*/

// calculate length of vector
@@ -250,21 +320,22 @@ void(vector destangle, float tspeed, void() func, entity controller) SUB_CalcAng
// set nextthink to trigger a think when dest is reached
controller.nextthink = time + traveltime;

- // scale the destdelta vector by the time spent traveling to get velocity
+ // scale the destdelta vector by the time spent traveling to
+ // get velocity
self.avelocity = destdelta * (1 / traveltime);

- // Makes sure controller.owner points to self so it can be referenced later in the think function
+ // Makes sure controller.owner points to self so it can be
+ // referenced later in the think function
controller.owner = self;
controller.think1 = func;
controller.finalangle = destangle;
controller.think = SUB_CalcAngleMoveDoneController;
};

-/*
-============
-After rotating, set angle to exact final angle
-============
-*/
+//----------------------------------------------------------------------
+// SUB_CalcAngleMoveDoneController
+// After rotating, set angle to exact final angle
+//----------------------------------------------------------------------
void() SUB_CalcAngleMoveDoneController =
{
self.owner.angles = self.finalangle;
@@ -274,18 +345,8 @@ void() SUB_CalcAngleMoveDoneController =
SUB_CallAsSelf(self.think1, self.owner);
};

-
-//=============================================================================
-
-void() DelayThink =
-{
- activator = self.enemy;
- SUB_UseTargets ();
- remove(self);
-};
-
/* ### (added targets, killtargets, and targetnames)
-==============================
+------------------------------------------------------------------------
SUB_UseTargets

the global "activator" should be set to the entity that initiated the firing.
@@ -301,7 +362,7 @@ or killtarget2, so some events can remove other triggers.
Search for (string)targetname, targetname2, targetname3, and targetname 4
in all entities that match (string)self.target, self.target2, self.target3,
or self.target4 and use their .use function.
-==============================
+------------------------------------------------------------------------
*/
void(string matchstring, .string matchfield) SUB_UseSpecificTarget =
{
@@ -309,7 +370,7 @@ void(string matchstring, .string matchfield) SUB_UseSpecificTarget =

act = activator;
t = find (world, matchfield, matchstring);
- while ( t != world )
+ while (t != world)
{
stemp = self;
otemp = other;
@@ -330,19 +391,20 @@ void(string matchstring, .string matchfield) SUB_UseSpecificTarget =
}
};

+//----------------------------------------------------------------------
void() SUB_UseTargets =
{
-// local entity t, stemp, otemp, act;
+ // local entity t, stemp, otemp, act;
local entity t;

- if (self.estate != STATE_ACTIVE) return;
-//
-// check for a delay
-//
+ if (self.estate != STATE_ACTIVE)
+ return;
+
+ // check for a delay
if (self.delay)
{
- // create a temp object to fire at a later time
- t = spawn();
+ // create a temp object to fire at a later time
+ t = spawn ();
t.classname = "DelayedUse";
t.nextthink = time + self.delay;
t.think = DelayThink;
@@ -357,165 +419,173 @@ void() SUB_UseTargets =
return;
}

-
-//
-// print the message
-//
- if (self.message != "" && !(self.flags & FL_NOCENTERPRINT)) {
- if (self.spawnflags & TRIGGER_CENTERPRINTALL) {
- t = find(world, classname, "player");
- while (t) {
+ // print the message
+ if (self.message != "" && !(self.flags & FL_NOCENTERPRINT))
+ {
+ if (self.spawnflags & TRIGGER_CENTERPRINTALL)
+ {
+ t = find (world, classname, "player");
+ while (t)
+ {
centerprint (t, self.message);
if (!self.noise)
- sound (t, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
- t = find(t, classname, "player");
+ sound (t, CHAN_VOICE, "misc/talk.wav",
+ 1, ATTN_NORM);
+ t = find (t, classname, "player");
}
}
-
- else if (activator.classname == "player") {
+
+ else if (activator.classname == "player")
+ {
centerprint (activator, self.message);
if (!self.noise)
- sound (activator, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
- }
+ sound (activator, CHAN_VOICE, "misc/talk.wav",
+ 1, ATTN_NORM);
+ }
}

-//
-// kill the killtarget entities
-//
+ // kill the killtarget entities
if (self.killtarget != "")
{
- t = find(world, targetname, self.killtarget);
- while(t != world)
+ t = find (world, targetname, self.killtarget);
+ while (t != world)
{
- if(t.switchshadstyle) lightstyle(t.switchshadstyle, "m");
- remove(t);
- t = find(t, targetname, self.killtarget);
+ if (t.switchshadstyle)
+ lightstyle (t.switchshadstyle, "m");
+ remove (t);
+ t = find (t, targetname, self.killtarget);
}
- t = find(world, targetname2, self.killtarget);
- while(t != world)
+
+ t = find (world, targetname2, self.killtarget);
+ while (t != world)
{
- if(t.switchshadstyle) lightstyle(t.switchshadstyle, "m");
- remove(t);
- t = find(t, targetname2, self.killtarget);
+ if (t.switchshadstyle)
+ lightstyle (t.switchshadstyle, "m");
+ remove (t);
+ t = find (t, targetname2, self.killtarget);
}
- t = find(world, targetname3, self.killtarget);
- while(t != world)
+
+ t = find (world, targetname3, self.killtarget);
+ while (t != world)
{
- if(t.switchshadstyle) lightstyle(t.switchshadstyle, "m");
- remove(t);
- t = find(t, targetname3, self.killtarget);
+ if (t.switchshadstyle)
+ lightstyle (t.switchshadstyle, "m");
+ remove (t);
+ t = find (t, targetname3, self.killtarget);
}
- t = find(world, targetname4, self.killtarget);
- while(t != world)
+
+ t = find (world, targetname4, self.killtarget);
+ while (t != world)
{
- if(t.switchshadstyle) lightstyle(t.switchshadstyle, "m");
- remove(t);
- t = find(t, targetname4, self.killtarget);
+ if (t.switchshadstyle)
+ lightstyle (t.switchshadstyle, "m");
+ remove (t);
+ t = find (t, targetname4, self.killtarget);
}
}

-//
-// kill the killtaget2 entities
-//
+ // kill the killtaget2 entities
if (self.killtarget2 != "")
{
- t = find(world, targetname, self.killtarget2);
- while(t != world)
+ t = find (world, targetname, self.killtarget2);
+ while (t != world)
{
- if(t.switchshadstyle) lightstyle(t.switchshadstyle, "m");
- remove(t);
- t = find(t, targetname, self.killtarget2);
+ if (t.switchshadstyle)
+ lightstyle (t.switchshadstyle, "m");
+ remove (t);
+ t = find (t, targetname, self.killtarget2);
}
- t = find(world, targetname2, self.killtarget2);
- while(t != world)
+
+ t = find (world, targetname2, self.killtarget2);
+ while (t != world)
{
- if(t.switchshadstyle) lightstyle(t.switchshadstyle, "m");
- remove(t);
- t = find(t, targetname2, self.killtarget2);
+ if (t.switchshadstyle)
+ lightstyle (t.switchshadstyle, "m");
+ remove (t);
+ t = find (t, targetname2, self.killtarget2);
}
- t = find(world, targetname3, self.killtarget2);
- while(t != world)
+
+ t = find (world, targetname3, self.killtarget2);
+ while (t != world)
{
- if(t.switchshadstyle) lightstyle(t.switchshadstyle, "m");
- remove(t);
- t = find(t, targetname3, self.killtarget2);
+ if (t.switchshadstyle)
+ lightstyle (t.switchshadstyle, "m");
+ remove (t);
+ t = find (t, targetname3, self.killtarget2);
}
- t = find(world, targetname4, self.killtarget2);
- while(t != world)
+
+ t = find (world, targetname4, self.killtarget2);
+ while (t != world)
{
- if(t.switchshadstyle) lightstyle(t.switchshadstyle, "m");
- remove(t);
- t = find(t, targetname4, self.killtarget2);
+ if (t.switchshadstyle)
+ lightstyle (t.switchshadstyle, "m");
+ remove (t);
+ t = find (t, targetname4, self.killtarget2);
}
}

-//
-// fire targets
-//
-
-// target 1
+ // fire targets; target 1
if (self.target != "")
{
- SUB_UseSpecificTarget(self.target, targetname);
- SUB_UseSpecificTarget(self.target, targetname2);
- SUB_UseSpecificTarget(self.target, targetname3);
- SUB_UseSpecificTarget(self.target, targetname4);
+ SUB_UseSpecificTarget (self.target, targetname);
+ SUB_UseSpecificTarget (self.target, targetname2);
+ SUB_UseSpecificTarget (self.target, targetname3);
+ SUB_UseSpecificTarget (self.target, targetname4);
}

-// target 2
+ // target 2
if (self.target2 != "")
{
- SUB_UseSpecificTarget(self.target2, targetname);
- SUB_UseSpecificTarget(self.target2, targetname2);
- SUB_UseSpecificTarget(self.target2, targetname3);
- SUB_UseSpecificTarget(self.target2, targetname4);
+ SUB_UseSpecificTarget (self.target2, targetname);
+ SUB_UseSpecificTarget (self.target2, targetname2);
+ SUB_UseSpecificTarget (self.target2, targetname3);
+ SUB_UseSpecificTarget (self.target2, targetname4);
}

-// target 3
+ // target 3
if (self.target3 != "")
{
- SUB_UseSpecificTarget(self.target3, targetname);
- SUB_UseSpecificTarget(self.target3, targetname2);
- SUB_UseSpecificTarget(self.target3, targetname3);
- SUB_UseSpecificTarget(self.target3, targetname4);
+ SUB_UseSpecificTarget (self.target3, targetname);
+ SUB_UseSpecificTarget (self.target3, targetname2);
+ SUB_UseSpecificTarget (self.target3, targetname3);
+ SUB_UseSpecificTarget (self.target3, targetname4);
}

-// target 4
+ // target 4
if (self.target4 != "")
{
- SUB_UseSpecificTarget(self.target4, targetname);
- SUB_UseSpecificTarget(self.target4, targetname2);
- SUB_UseSpecificTarget(self.target4, targetname3);
- SUB_UseSpecificTarget(self.target4, targetname4);
+ SUB_UseSpecificTarget (self.target4, targetname);
+ SUB_UseSpecificTarget (self.target4, targetname2);
+ SUB_UseSpecificTarget (self.target4, targetname3);
+ SUB_UseSpecificTarget (self.target4, targetname4);
}
};

+//----------------------------------------------------------------------
void(string matchstring) SUB_UseName =
{
- SUB_UseSpecificTarget(matchstring, targetname);
- SUB_UseSpecificTarget(matchstring, targetname2);
- SUB_UseSpecificTarget(matchstring, targetname3);
- SUB_UseSpecificTarget(matchstring, targetname4);
+ SUB_UseSpecificTarget (matchstring, targetname);
+ SUB_UseSpecificTarget (matchstring, targetname2);
+ SUB_UseSpecificTarget (matchstring, targetname3);
+ SUB_UseSpecificTarget (matchstring, targetname4);
};
-// ### end of Custents triggering code

-/*
-=============
-SUB_UseEntTargets
-===============
-*/
+//----------------------------------------------------------------------
+// SUB_UseEntTargets
+//----------------------------------------------------------------------
void(entity t) SUB_UseEntTargets =
{
- if (t == world) return;
+ if (t == world)
+ return;
activator = self;
entity oself = self;
self = t;
- SUB_UseTargets();
+ SUB_UseTargets ();
self = oself;
-}
+};

/*
-================
+------------------------------------------------------------------------
SUB_UseAndForgetTargets

This calls SUB_UseTargets, then clears all of self's fields that cause
@@ -528,7 +598,7 @@ Note that this function relies on the fact that SUB_UseTargets has
already been modified to work around the engine bug involving tests of
the form 'if (string)', i.e. that the tests in SUB_UseTargets are now of
the form 'if (string != "")'. -- iw
-================
+------------------------------------------------------------------------
*/
void() SUB_UseAndForgetTargets =
{
@@ -544,15 +614,13 @@ void() SUB_UseAndForgetTargets =
self.target4 = "";
};

-/*
-================
-SUB_FieldIsTargeted
-
-Return TRUE if the "fld" field of this entity is non-empty and matches
-the target (or target2/3/4 or pain_target) field of any other entity,
-otherwise return FALSE. -- iw
-================
-*/
+//----------------------------------------------------------------------
+// SUB_FieldIsTargeted
+//
+// Return TRUE if the "fld" field of this entity is non-empty and matches
+// the target (or target2/3/4 or pain_target) field of any other entity,
+// otherwise return FALSE. -- iw
+//----------------------------------------------------------------------
float(.string fld) SUB_FieldIsTargeted =
{
if (self.fld == "")
@@ -579,20 +647,17 @@ float(.string fld) SUB_FieldIsTargeted =
return FALSE;
};

-/*
-================
-SUB_IsTargeted
-
-Return TRUE if the targetname (or targetname2/3/4) field of this entity
-is non-empty and matches the target (or target2/3/4 or pain_target)
-field of any other entity, otherwise return FALSE. -- iw
-================
-*/
+//----------------------------------------------------------------------
+// SUB_IsTargeted
+//
+// Return TRUE if the targetname (or targetname2/3/4) field of this entity
+// is non-empty and matches the target (or target2/3/4 or pain_target)
+// field of any other entity, otherwise return FALSE. -- iw
+//----------------------------------------------------------------------
float() SUB_IsTargeted =
{
// the following function calls are staggered to avoid the silly
// "return value conflict" problem with traditional compilers -- iw
-
if (SUB_FieldIsTargeted (targetname))
return TRUE;

@@ -608,9 +673,9 @@ float() SUB_IsTargeted =
return FALSE;
};

-//
-// pain_target //dumptruck_ds
-//
+//----------------------------------------------------------------------
+// SUB_UsePain -- pain_target //dumptruck_ds
+//----------------------------------------------------------------------
void() SUB_UsePain =
{
if (self.pain_target != "")
@@ -620,25 +685,24 @@ void() SUB_UsePain =
SUB_UseSpecificTarget (self.pain_target, targetname3);
SUB_UseSpecificTarget (self.pain_target, targetname4);
}
- self.pain_target = ""; //dumptruck_ds via Discord - thanks Spike, Snaut and QueenJazz
+ // dumptruck_ds via Discord - thanks Spike, Snaut and QueenJazz
+ self.pain_target = "";
};

-/*
-
-in nightmare mode, all attack_finished times become 0
-some monsters refire twice automatically
-
-*/
-
+//----------------------------------------------------------------------
+// SUB_AttackFinished
+// in nightmare mode, all attack_finished times become 0
+// some monsters refire twice automatically
+//----------------------------------------------------------------------
void(float normal) SUB_AttackFinished =
{
- self.cnt = 0; // refire count for nightmare
+ // refire count for nightmare
+ self.cnt = 0;
if (skill != 3)
self.attack_finished = time + normal;
};

-float (entity targ) visible;
-
+//----------------------------------------------------------------------
void (void() thinkst) SUB_CheckRefire =
{
if (skill != 3)
@@ -647,12 +711,13 @@ void (void() thinkst) SUB_CheckRefire =
return;
if (!visible (self.enemy))
return;
+
self.cnt = 1;
self.think = thinkst;
};

/*
-================
+------------------------------------------------------------------------
SUB_DislodgeRestingEntities

This clears the FL_ONGROUND flag from any entities that are on top of
@@ -664,7 +729,7 @@ floating in mid-air if the entity they are resting on is removed from
under them. This function is intended to be called in the case where
self is going to be removed, to ensure that other entities are not left
floating. -- iw
-================
+------------------------------------------------------------------------
*/
void() SUB_DislodgeRestingEntities =
{
@@ -678,63 +743,72 @@ void() SUB_DislodgeRestingEntities =
e = nextent (e);
}
};
-//------------------------------------------------------------------------//
-// Drake -- This makes an entity do a think function right now.
-//------------------------------------------------------------------------//
+
+//--------------------------------------------------------------------//
+// SUB_Think -- Drake -- This makes an entity do a think function right now.
+//--------------------------------------------------------------------//
void(entity ent, void() thinkst) SUB_Think =
{
- local entity swap;
+ local entity swap;

- swap = self;
- self = ent;
- thinkst ();
- self = swap;
+ swap = self;
+ self = ent;
+ thinkst ();
+ self = swap;
};

-/// from Copper -- dumptruck_ds (orginally found in triggers.qc)
-/*
-================================
-CheckValidTouch
-health and playerhood checks were duplicated everywhere
-added noclip check because Quake's default still-touch-everything noclip is awful
-================================
-*/
-float() CheckValidTouch =
+//----------------------------------------------------------------------
+void() SUB_EndWaiting =
{
- if (other.classname != "player")
- return FALSE;
- if (other.health <= 0)
- return FALSE;
- if (other.movetype == MOVETYPE_NOCLIP)
- return FALSE;
- if (self.estate != STATE_ACTIVE)
- return FALSE;
- return TRUE;
-}
-
-void() SUB_EndWaiting = {
self.is_waiting = 0;
self.estate = STATE_ACTIVE;
- if (self.use == SUB_EndWaiting) self.use = self.dormant_use;
+ if (self.use == SUB_EndWaiting)
+ self.use = self.dormant_use;

- // special case for teleports, makes it ignore the fact that it has a targetname when touched
- if (self.classname == "trigger_teleport") {
+ // special case for teleports, makes it ignore the fact that it
+ // has a targetname when touched
+ if (self.classname == "trigger_teleport")
self.is_waiting = -1;
- }
};

-void() SUB_CheckWaiting = {
- if (self.is_waiting > 0) {
+//----------------------------------------------------------------------
+void() SUB_CheckWaiting =
+{
+ if (self.is_waiting > 0)
+ {
self.dormant_use = self.use;
self.use = SUB_EndWaiting;
self.estate = STATE_INACTIVE;

- dprint("Spawned a waiting ");
- dprint(self.classname);
- dprint(" with targetname ");
- dprint(self.targetname);
- dprint(" and target ");
- dprint(self.target);
- dprint("\n");
+ dprint ("Spawned a waiting ");
+ dprint (self.classname);
+ dprint (" with targetname ");
+ dprint (self.targetname);
+ dprint (" and target ");
+ dprint (self.target);
+ dprint ("\n");
}
};
+
+//----------------------------------------------------------------------
+// SUB_Regen -- was in items.qc
+//----------------------------------------------------------------------
+void() SUB_Regen =
+{
+ // restore original model
+ self.model = self.mdl;
+
+ // allow it to be touched again
+ self.solid = SOLID_TRIGGER;
+
+ // TODO CEV
+ // Respawn with DM effects
+ // if (deathmatch || (self.spawnflags & ITEM_RESPAWNDM))
+ // play respawn sound
+ sound (self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM);
+ // else
+ // play teleport sound and display particles
+ // spawn_tfog (self.origin + self.particles_offset);
+
+ setorigin (self, self.origin);
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/triggers/fog.qc

diff --git a/qc/triggers/fog.qc b/qc/triggers/fog.qc
new file mode 100644
index 0000000..a1c7979
--- /dev/null
+++ b/qc/triggers/fog.qc
@@ -0,0 +1,598 @@
+//==============================================================================
+// Fog controllers -- Based on Copper's fog by Lunaran, Changed by bmFbr
+//==============================================================================
+
+/*FGD
+@baseclass = Fog [
+ fog_density(string) : "Fog Density"
+ fog_color(string) : "Fog Color"
+]
+@baseclass = FogShift [
+ fog_density(string) : "Start Fog Density"
+ fog_color(string) : "Start Fog Color"
+ fog_density2(string) : "End Fog Density"
+ fog_color2(string) : "End Fog Color"
+]
+*/
+
+// constants
+const float FOG_INTERVAL = 0.04166667; // 1/24;
+
+//----------------------------------------------------------------------
+// fog_save
+//----------------------------------------------------------------------
+void(entity client, float density, vector color) fog_save =
+{
+ if (client.classname != "player")
+ return;
+
+ // save whatever we set the client's fog to in case of saves/loads
+ client.fog_density = density;
+ client.fog_color = color;
+};
+
+//----------------------------------------------------------------------
+void(entity client) fog_save_to_previous =
+{
+ if (client.classname != "player")
+ return;
+
+ // copies the current fog to the secondary fields to transition
+ // from the current fog
+ client.fog_density2 = client.fog_density;
+ client.fog_color2 = client.fog_color;
+};
+
+//----------------------------------------------------------------------
+void(entity client, float density) skyfog_save =
+{
+ if (client.classname != "player")
+ return;
+
+ client.skyfog_density = density;
+};
+
+//----------------------------------------------------------------------
+void(entity client) skyfog_save_to_previous =
+{
+ if (client.classname != "player")
+ return;
+
+ client.skyfog_density2 = client.skyfog_density;
+};
+
+//----------------------------------------------------------------------
+// fog_setFromEnt
+//----------------------------------------------------------------------
+void(entity client, entity fogger) fog_setFromEnt =
+{
+ local float density;
+
+ // Don't set the fog if the entity has no values, because it
+ // might be a custom map with _fog on the worldspawn instead.
+ // To actually get an entity to clear the fog, density to -1.
+ // The same applies to skyfog
+
+ // eprint (fogger);
+
+ // dprint3 ("fog_density: ", ftos(fogger.fog_density*100), "\n");
+ if (fogger.fog_density)
+ {
+ dprint ("setting fog\n");
+ density = zeroconvert (fogger.fog_density);
+ fog_set (client, density, fogger.fog_color);
+ }
+
+ //dprint3 ("skyfog_density: ", ftos(fogger.skyfog_density*100), "\n");
+ if (fogger.skyfog_density)
+ {
+ dprint ("setting skyfog\n");
+ density = zeroconvert (fogger.skyfog_density);
+ skyfog_set (client, density);
+ }
+};
+
+//----------------------------------------------------------------------
+// fog_set
+//----------------------------------------------------------------------
+void(entity client, float density, vector color) fog_set =
+{
+ if (client.classname != "player")
+ return;
+
+ // dprint9 ("Setting fog: ", ftos(density), " ", ftos(color_x),
+ // " ", ftos(color_y), " ", ftos(color_z), "\n");
+
+ stuffcmd (client, "\nfog ");
+ stuffcmd_float (client, density);
+ stuffcmd (client, " ");
+ stuffcmd_float (client, color_x);
+ stuffcmd (client, " ");
+ stuffcmd_float (client, color_y);
+ stuffcmd (client, " ");
+ stuffcmd_float (client, color_z);
+ stuffcmd (client, "\n");
+
+ fog_save (client, density, color);
+};
+
+//----------------------------------------------------------------------
+void(entity client, float density) skyfog_set =
+{
+ if (client.classname != "player")
+ return;
+
+ // dprint3 ("Setting skyfog: ", ftos(density), "\n");
+
+ stuffcmd (client, "\nr_skyfog ");
+ stuffcmd_float (client, density);
+ stuffcmd (client, "\n");
+
+ skyfog_save (client, density);
+};
+
+//----------------------------------------------------------------------
+// fog_blendTouch
+//----------------------------------------------------------------------
+void() fog_blendTouch =
+{
+ if (other.classname != "player")
+ return;
+
+ if (other.health <= 0)
+ return;
+
+ if (self.estate != STATE_ACTIVE)
+ return;
+
+ // fix for only first client getting a fog change when
+ // multiple coop clients are touching this at once
+ if (time != self.rad_time) // because fog is rad
+ if (time < self.attack_finished)
+ return;
+
+ local float f, lerp_density, leaving;
+ local float lerp_sdensity;
+ local float ent_density, ent_density2, ent_sdensity, ent_sdensity2;
+ local vector dorg, mid, ovel;
+ local vector lerp_color;
+
+ ent_density = zeroconvert (self.fog_density);
+ ent_density2 = zeroconvert (self.fog_density2);
+
+ ent_sdensity = zeroconvert (self.skyfog_density);
+ ent_sdensity2 = zeroconvert (self.skyfog_density2);
+
+ // if you run/fall through a fogblend fast enough you can come
+ // out the other side partially blended, so check if player will
+ // exit the trigger bounds before the next touch (same class of
+ // bug as leaping through lasers in Q2)
+ ovel = other.velocity * FOG_INTERVAL;
+ leaving = ((other.absmax_x + ovel_x < self.absmin_x) ||
+ (other.absmax_y + ovel_y < self.absmin_y) ||
+ (other.absmax_z + ovel_z < self.absmin_z) ||
+ (other.absmin_x + ovel_x > self.absmax_x) ||
+ (other.absmin_y + ovel_y > self.absmax_y) ||
+ (other.absmin_z + ovel_z > self.absmax_z));
+
+ if (leaving)
+ {
+ // last chance to set fog correctly, so snap it to the
+ // final values
+ leaving = other.velocity * self.movedir;
+ if (leaving > 0)
+ {
+ lerp_density = ent_density2;
+ lerp_color = self.fog_color2;
+ lerp_sdensity = ent_sdensity2;
+ }
+ else
+ {
+ lerp_density = ent_density;
+ lerp_color = self.fog_color;
+ lerp_sdensity = ent_sdensity;
+ }
+ }
+ else
+ {
+ // in transition, blend proportionally between the two fogs
+ mid = (self.mins + self.maxs) * 0.5;
+ dorg = other.origin + other.view_ofs - mid;
+
+ f = dorg * self.movedir;
+ f = (f / self.distance) + 0.5;
+
+ lerp_density = lerp (ent_density, ent_density2, f);
+ lerp_color = lerpVector (self.fog_color, self.fog_color2, f);
+ lerp_sdensity = lerp (ent_sdensity, ent_sdensity2, f);
+ }
+
+ if (self.fog_density || self.fog_density2)
+ fog_set (other, lerp_density, lerp_color);
+ if (self.skyfog_density || self.skyfog_density2)
+ skyfog_set (other, lerp_sdensity);
+
+ self.rad_time = time;
+ self.attack_finished = time + FOG_INTERVAL;
+
+ // reset client's fogblend_entity in case it's currently being
+ // transitioned by another entity
+ other.fogblend_entity = world;
+};
+
+/*QUAKED trigger_fogblend (.5 .5 .2) ?
+Acts as a smoothly blending portal between two zones of different fog. Sets the fog for any client passing through it, blending their global fog settings between "fog_color"/"fog_density" and "fog_color2"/"fog_density2" proportional to their position within the trigger.
+The axis of motion on which the blend happens is defined by "angle", pointing to whatever zone has color2 and density2. Trigger therefore has two 'sides' - the side that "angle" points to, and the opposite side.
+
+"distance" - override the length of the blend period in world units - defaults to bounds size
+ on 'angle' otherwise. this is only useful for diagonal triggers.
+
+CAVEATS:
+- will 'stuffcmd' 2 dozen times per frame so try not to make these huge
+- a bug in most quake engine ports will reset the eye position smoothing that happens when climbing stairs or riding a plat on every frame that a 'stuffcmd' is sent, so fog transitions during upwards motion will cause noticeable stuttering.
+*/
+/*FGD
+@SolidClass base(Appearflags, Targetname, Target, FogShift) = trigger_fogblend :
+"Trigger: Fog Blend
+Acts as a smoothly blending portal between two zones of different fog. Sets the fog for any client passing through it, blending their global fog settings between start and end values proportional to their position within the trigger.
+
+- will 'stuffcmd' 2 dozen times per frame so try not to make these huge
+- a bug in most quake engine ports will reset the eye position smoothing that happens when climbing stairs or riding a plat on every frame that a 'stuffcmd' is sent, so fog transitions during upwards motion will cause noticeable stuttering."
+[
+ distance(integer) : "Length of blend distance (defaults to size of trigger)"
+ angle(integer) : "Axis of motion of blend (points toward end values)"
+]
+*/
+void() trigger_fogblend =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ // InitTrigger assumes angle 0 means no angle
+ if (self.angles == '0 0 0')
+ self.angles = '0 360 0';
+
+ InitTrigger ();
+ self.touch = fog_blendTouch;
+ self.distance = zeroconvertdefault (self.distance,
+ BoundsAngleSize(self.movedir, self.size));
+
+ SUB_CheckWaiting ();
+};
+
+//======================================================================
+// fog_blendTimeThink -- used by both trigger_fog and target_fogblend
+//======================================================================
+
+// constants
+const float FOGBLEND_ONEWAY = 1;
+const float FOGBLEND_REVERSE = 2;
+const float FOGBLEND_ALLCLIENTS = 4;
+const float FOGBLEND_BLENDTO = 8;
+
+//----------------------------------------------------------------------
+void(entity cl, float sTo, float f) skyfog_blendSetFraction =
+{
+ local float s;
+
+ s = lerpHermite (cl.skyfog_density2, sTo, f);
+
+ // eprint (cl);
+ // dprint3 ("Fraction skyfog density: ", ftos(s), "\n");
+
+ skyfog_set (cl, s);
+};
+
+//----------------------------------------------------------------------
+void(entity cl, vector cTo, float dTo, float f) fog_blendSetFraction =
+{
+ local float d;
+ local vector c;
+
+ d = lerpHermite (cl.fog_density2, dTo, f);
+ c = lerpVectorHermite (cl.fog_color2, cTo, f);
+
+ /*
+ eprint (cl);
+ dprint3 ("fog density: ", ftos(d), "\n");
+ dprint3 ("color: ", vtos(c), "\n");
+ dprint3 ("fraction: ", ftos(f), "\n");
+ */
+
+ fog_set (cl, d, c);
+};
+
+//----------------------------------------------------------------------
+void() fog_blendTimeThink =
+{
+ local float f;
+ local float dTo, sTo;
+ local vector cTo;
+
+ if (time >= self.pain_finished)
+ {
+ f = 1;
+ }
+ else
+ {
+ self.nextthink = time + FOG_INTERVAL;
+ if (self.state && self.speed)
+ f = 1 - (self.pain_finished - time) / self.speed;
+ else if (self.speed2)
+ f = 1 - (self.pain_finished - time) / self.speed2;
+ else
+ f = 1;
+ }
+
+ if (self.state)
+ {
+ dTo = self.fog_density2;
+ cTo = self.fog_color2;
+ sTo = self.skyfog_density2;
+ }
+ else
+ {
+ dTo = self.fog_density;
+ cTo = self.fog_color;
+ sTo = self.skyfog_density;
+ }
+
+ if (self.spawnflags & FOGBLEND_ALLCLIENTS)
+ {
+ entity pl;
+ pl = nextent (world);
+ while (pl.flags & FL_CLIENT)
+ {
+ if (pl.fogblend_entity == self)
+ {
+ if (dTo && !(pl.fog_density2 == dTo &&
+ pl.fog_color2 == cTo))
+ {
+ fog_blendSetFraction (pl, cTo,
+ zeroconvert(dTo), f);
+ }
+
+ if (sTo)
+ {
+ skyfog_blendSetFraction (pl,
+ zeroconvert(sTo), f);
+ }
+
+ if (time >= self.pain_finished)
+ {
+ pl.fogblend_entity = world;
+ }
+ }
+
+ pl = nextent (pl);
+ }
+ }
+ else
+ {
+ if (self.enemy.fogblend_entity == self)
+ {
+ if (dTo && !(self.enemy.fog_density2 == dTo &&
+ self.enemy.fog_color2 == cTo))
+ {
+ fog_blendSetFraction (self.enemy, cTo,
+ zeroconvert(dTo), f);
+ }
+
+ if (sTo)
+ {
+ skyfog_blendSetFraction (self.enemy,
+ zeroconvert(sTo), f);
+ }
+
+ if (time >= self.pain_finished)
+ {
+ self.enemy.fogblend_entity = world;
+
+ }
+ }
+ }
+
+ if (self.classname == "fog_controller")
+ {
+ if (self.enemy.fogblend_entity != self ||
+ time >= self.pain_finished)
+ {
+ remove (self);
+ return;
+ }
+ }
+};
+
+//======================================================================
+// target_fogblend
+//======================================================================
+
+//----------------------------------------------------------------------
+void() target_fogblend_use =
+{
+
+ self.enemy = activator;
+ if (self.enemy.classname != "player")
+ return;
+
+ if (!(self.spawnflags & FOGBLEND_ONEWAY))
+ self.state = 1 - self.state;
+
+ if (self.state)
+ self.pain_finished = time + self.delay + self.speed;
+ else
+ self.pain_finished = time + self.delay + self.speed2;
+
+
+ if (self.spawnflags & FOGBLEND_ALLCLIENTS)
+ {
+ entity pl;
+ pl = nextent (world);
+ while (pl.flags & FL_CLIENT)
+ {
+ if (self.fog_density)
+ fog_save_to_previous (pl);
+ if (self.skyfog_density)
+ skyfog_save_to_previous (pl);
+
+ pl.fogblend_entity = self;
+
+ pl = nextent(pl);
+ }
+ }
+ else
+ {
+ if (self.fog_density)
+ fog_save_to_previous (self.enemy);
+ if (self.skyfog_density)
+ skyfog_save_to_previous (self.enemy);
+
+ self.enemy.fogblend_entity = self;
+ }
+
+ self.nextthink = time + self.delay;
+};
+
+/*QUAKED target_fogblend (.5 .5 .2) (-8 -8 -8) (8 8 8) ONE_WAY REVERSE GLOBAL BLENDTO
+Blends the fog for a client. activator's fog will be blended from "fog_color" and "fog_density"
+to "fog_color2" and "fog_density2". Triggering again will blend it back, unless ONE_WAY is set.
+Set REVERSE if you're tired of swapping the values by hand.
+Set GLOBAL to affect all clients in multiplayer, not just the activator.
+
+"delay" - pause before beginning to blend
+"speed" - time to spend blending, -1 for an instant change to fog2.
+"speed2" - time to spend blending back, if different than "speed". -1 for instant.
+
+CAVEATS:
+- will 'stuffcmd' 2 dozen times per frame so try not to make this take too long
+- a bug in most quake engine ports will reset the eye position smoothing that happens when climbing stairs or riding a plat on every frame that a 'stuffcmd' is sent, so fog transitions during upwards motion will cause noticeable stuttering.
+*/
+/*FGD
+@PointClass base(Appearflags, Targetname, Target, FogShift) color(128 128 50) = target_fogblend :
+"Target: Fog Blend
+Activator's fog will be blended over time from start to end values.
+
+- will 'stuffcmd' 2 dozen times per frame so try not to make this take too long
+- a bug in most quake engine ports will reset the eye position smoothing that happens when climbing stairs or riding a plat on every frame that a 'stuffcmd' is sent, so fog transitions during upwards motion will cause noticeable stuttering."
+[
+ spawnflags(flags) = [
+ 1 : "One-Way Only" : 0
+ 2 : "Reverse Start/End" : 0
+ 4 : "All clients" : 0
+ ]
+ delay(string) : "Pause before starting blend"
+ speed(string) : "Time to blend (-1 for instant)"
+ speed2(string) : "Time to blend back, if different (-1 for instant)"
+]
+*/
+void() target_fogblend =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (!self.fog_density && !self.skyfog_density)
+ {
+ objerror ("Neither fog density nor skyfog density set");
+ return;
+ }
+
+ self.use = target_fogblend_use;
+ self.think = fog_blendTimeThink;
+
+ if (self.spawnflags & FOGBLEND_REVERSE)
+ self.state = 1;
+ else
+ self.state = 0;
+
+ if (self.spawnflags & FOGBLEND_ONEWAY)
+ self.state = 1 - self.state;
+
+ if (!self.speed)
+ self.speed = 1;
+ if (!self.speed2)
+ self.speed2 = self.speed;
+
+ if (self.speed == -1)
+ self.speed = 0;
+ if (self.speed2 == -1)
+ self.speed2 = 0;
+};
+
+//======================================================================
+// trigger_fog
+//======================================================================
+
+//----------------------------------------------------------------------
+void() trigger_fog_touch =
+{
+ if (self.estate != STATE_ACTIVE)
+ return;
+
+ if (!(other.flags & FL_CLIENT))
+ return;
+
+ // fog already set to this value
+ if (other.fog_color == self.fog_color &&
+ other.fog_density == self.fog_density)
+ return;
+
+ // transition already occurring from this trigger
+ if (other.fogblend_entity.owner == self)
+ return;
+
+ if (self.fog_density)
+ fog_save_to_previous (other);
+ if (self.skyfog_density)
+ skyfog_save_to_previous (other);
+
+ // spawn a temp entity to control the transition for this client
+ entity controller;
+
+ controller = spawn ();
+ controller.classname = "fog_controller";
+ controller.owner = self;
+ controller.enemy = other;
+ controller.speed2 = self.speed; // speed2 is used when state is 0
+ controller.fog_color = self.fog_color;
+ controller.fog_density = self.fog_density;
+ controller.skyfog_density = self.skyfog_density;
+
+ controller.pain_finished = time + self.delay + self.speed;
+
+ controller.think = fog_blendTimeThink;
+ controller.nextthink = time + controller.delay;
+
+ other.fogblend_entity = controller;
+};
+
+/*QUAKED trigger_fog (.5 .5 .2) ?
+Smoothly blends touching client's currently applied fog to "fog_color" and "fog_density" over time.
+
+"delay" - pause before beginning to blend.
+"speed" - time to spend blending, -1 for an instant change.
+
+CAVEATS:
+- will 'stuffcmd' 2 dozen times per second so try not to make these huge
+- a bug in most quake engine ports will reset the eye position smoothing that happens when climbing stairs or riding a plat on every frame that a 'stuffcmd' is sent, so fog transitions during upwards motion will cause noticeable stuttering.
+*/
+void() trigger_fog =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (!self.fog_density && !self.skyfog_density)
+ {
+ objerror ("Neither fog density nor skyfog density set");
+ return;
+ }
+
+ InitTrigger ();
+ self.touch = trigger_fog_touch;
+ if (!self.speed)
+ self.speed = 1;
+
+ SUB_CheckWaiting ();
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/triggers/void.qc

diff --git a/qc/triggers/void.qc b/qc/triggers/void.qc
index cdd6a5c..9ab4f4d 100644
--- a/qc/triggers/void.qc
+++ b/qc/triggers/void.qc
@@ -4,9 +4,11 @@

//This is necros' trigger_void from Lost Chapters pack, modified by dumptruck_ds

-float MONSTER_SAFE = 1;
-float PLAYER_SAFE = 2;
+// constants
+const float MONSTER_SAFE = 1;
+const float PLAYER_SAFE = 2;

+//----------------------------------------------------------------------
void() trigger_void_touch =
{
if (self.estate != STATE_ACTIVE)
@@ -36,7 +38,9 @@ void() trigger_void_touch =

if (other.classname == "gib" || other.classname == "grenade" ||
other.classname == "spike" || other.classname == "missile")
+ {
remove (other);
+ }

if (other.flags & FL_ITEM)
remove (other);

Return to the top of this page or return to the overview of this repo.

Diff qc/utility.qc

diff --git a/qc/utility.qc b/qc/utility.qc
index d0cbe0d..55fddea 100644
--- a/qc/utility.qc
+++ b/qc/utility.qc
@@ -11,6 +11,7 @@ void(string s1, string s2) dprint2 =
dprint (s2);
};

+//----------------------------------------------------------------------
void(string s1, string s2, string s3) dprint3 =
{
dprint (s1);
@@ -18,6 +19,7 @@ void(string s1, string s2, string s3) dprint3 =
dprint (s3);
};

+//----------------------------------------------------------------------
void(string s1, string s2, string s3, string s4) dprint4 =
{
dprint (s1);
@@ -26,6 +28,7 @@ void(string s1, string s2, string s3, string s4) dprint4 =
dprint (s4);
};

+//----------------------------------------------------------------------
void(string s1, string s2, string s3, string s4, string s5) dprint5 =
{
dprint (s1);
@@ -35,6 +38,7 @@ void(string s1, string s2, string s3, string s4, string s5) dprint5 =
dprint (s5);
};

+//----------------------------------------------------------------------
void(string s1, string s2, string s3, string s4, string s5, string s6) dprint6 =
{
dprint (s1);
@@ -45,6 +49,7 @@ void(string s1, string s2, string s3, string s4, string s5, string s6) dprint6 =
dprint (s6);
};

+//----------------------------------------------------------------------
void(string s1, string s2, string s3, string s4, string s5, string s6,
string s7) dprint7 =
{
@@ -57,6 +62,7 @@ void(string s1, string s2, string s3, string s4, string s5, string s6,
dprint (s7);
};

+//----------------------------------------------------------------------
void(string s1, string s2, string s3, string s4, string s5, string s6,
string s7, string s8) dprint8 =
{
@@ -70,6 +76,7 @@ void(string s1, string s2, string s3, string s4, string s5, string s6,
dprint (s8);
};

+//----------------------------------------------------------------------
void(string s1, string s2, string s3, string s4, string s5, string s6,
string s7, string s8, string s9) dprint9 =
{
@@ -165,7 +172,7 @@ float(vector v, vector s) BoundsAngleSize =
};

//----------------------------------------------------------------------
-//count -4 = numclients in coop
+// count -4 = numclients in coop
//----------------------------------------------------------------------
/*
void(.float fld) playercount_convert =

Return to the top of this page or return to the overview of this repo.

Diff qc/weapons.qc

diff --git a/qc/weapons.qc b/qc/weapons.qc
index f674b26..3cbb724 100644
--- a/qc/weapons.qc
+++ b/qc/weapons.qc
@@ -1433,40 +1433,6 @@ void() W_ChangeWeapon =

/*
============
-CheatCommand
-============
-*/
-void() CheatCommand =
-{
-// 1998-07-29 Cheats coop fix by Maddes start
-// if (deathmatch || coop)
- if (deathmatch)
-// 1998-07-29 Cheats coop fix by Maddes end
- return;
-
- self.ammo_rockets = 100;
- self.ammo_nails = 200;
- self.ammo_shells = 100;
- self.items = self.items |
- IT_AXE |
- IT_SHOTGUN |
- IT_SUPER_SHOTGUN |
- IT_NAILGUN |
- IT_SUPER_NAILGUN |
- IT_GRENADE_LAUNCHER |
- IT_ROCKET_LAUNCHER;
- GiveAllKeys (self); // support for item_key_custom -- iw
-
- self.ammo_cells = 200;
- self.items = self.items | IT_LIGHTNING;
-
- self.weapon = IT_ROCKET_LAUNCHER;
- self.impulse = 0;
- W_SetCurrentAmmo ();
-};
-
-/*
-============
CycleWeaponCommand

Go to the next weapon with ammo
@@ -1615,69 +1581,6 @@ void() CycleWeaponReverseCommand =

/*
============
-ServerflagsCommand
-
-Just for development
-============
-*/
-void() ServerflagsCommand =
-{
-// 1998-07-29 Cheats coop fix by Maddes start
- if (deathmatch)
- return;
-// 1998-07-29 Cheats coop fix by Maddes end
- serverflags = serverflags * 2 + 1;
-};
-
-void() QuadCheat =
-{
-// 1998-07-29 Cheats coop fix by Maddes start
-// if (deathmatch || coop)
- if (deathmatch)
-// 1998-07-29 Cheats coop fix by Maddes end
- return;
- self.super_time = 1;
- self.super_damage_finished = time + 30;
- self.items = self.items | IT_QUAD;
- dprint ("quad cheat\n");
-};
-
-/*
-============
-ImpulseCommands
-
-============
-*/
-void() ImpulseCommands =
-{
- if (self.impulse >= 1 && self.impulse <= 8)
- W_ChangeWeapon ();
-
- if (self.impulse == 9)
- CheatCommand ();
- if (self.impulse == 10)
- CycleWeaponCommand ();
- if (self.impulse == 11)
- ServerflagsCommand ();
- if (self.impulse == 12)
- CycleWeaponReverseCommand ();
-
- if (self.impulse == 255)
- QuadCheat ();
-// dumptruck_ds version inspired by Copper
- if (self.impulse == 100)
- sprint(self, version);
-
- // if (self.impulse == 101) // debugging armor shards -- dumptruck_ds
- // dprint ("Armortype is");
- // dprint (ftos(self.armortype));
- // dprint ("\n");
-
- self.impulse = 0;
-};
-
-/*
-============
W_WeaponFrame

Called every frame so impulse events can be handled as well as possible

Return to the top of this page or return to the overview of this repo.

Diff qc/world.qc

diff --git a/qc/world.qc b/qc/world.qc
index ea6f277..c349420 100644
--- a/qc/world.qc
+++ b/qc/world.qc
@@ -1,8 +1,8 @@
-/*==============================================================================
- WORLD
-==============================================================================*/
+//==============================================================================
+// WORLD
+//==============================================================================

-//
+// prototypes
void() InitBodyQue;

//----------------------------------------------------------------------
@@ -474,7 +474,7 @@ void() worldspawn =
precache_sound2 ("misc/basekey.wav");
precache_model2 ("progs/b_s_key.mdl");
precache_model2 ("progs/b_g_key.mdl");
- precache_model ("progs/h_mdls/pd_vial.mdl"); // DropVial -- dumptruck_ds
+ precache_model ("progs/health/pd_vial.mdl"); // DropVial -- dumptruck_ds
precache_sound ("items/r_item1.wav");
precache_sound ("dump/armsh1.wav"); // DropShard -- dumptruck_ds
precache_model ("progs/armshr.mdl");

Return to the top of this page or return to the overview of this repo.

Diff sound/oldone2/pd_pop2.wav

diff --git a/sound/oldone2/pd_pop2.wav b/sound/oldone2/pd_pop2.wav
new file mode 100644
index 0000000..16dda6e
Binary files /dev/null and b/sound/oldone2/pd_pop2.wav differ

Return to the top of this page or return to the overview of this repo.