first commit

This commit is contained in:
2019-12-30 17:23:05 +01:00
commit 7fe19ee89f
1149 changed files with 271279 additions and 0 deletions

View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser General
Public License instead of this License.

View File

@@ -0,0 +1,2 @@
# progs_dump_qc
This is the most current version of progs_dump .qc source.

748
mod_mine/quakec_src/ai.qc Normal file
View File

@@ -0,0 +1,748 @@
void() movetarget_f;
void() t_movetarget;
void() knight_walk1;
void() knight_bow6;
void() knight_bow1;
void(entity etemp, entity stemp, entity stemp, float dmg) T_Damage;
/*
.enemy
Will be world if not currently angry at anyone.
.movetarget
The next path spot to walk toward. If .enemy, ignore .movetarget.
When an enemy is killed, the monster will try to return to it's path.
.huntt_ime
Set to time + something when the player is in sight, but movement straight for
him is blocked. This causes the monster to use wall following code for
movement direction instead of sighting on the player.
.ideal_yaw
A yaw angle of the intended direction, which will be turned towards at up
to 45 deg / state. If the enemy is in view and hunt_time is not active,
this will be the exact line towards the enemy.
.pausetime
A monster will leave it's stand state and head towards it's .movetarget when
time > .pausetime.
walkmove(angle, speed) primitive is all or nothing
*/
//
// globals
//
//
// when a monster becomes angry at a player, that monster will be used
// as the sight target the next frame so that monsters near that one
// will wake up even if they wouldn't have noticed the player
//
entity sight_entity;
float sight_entity_time;
float(float v) anglemod =
{
while (v >= 360)
v = v - 360;
while (v < 0)
v = v + 360;
return v;
};
/*
==============================================================================
MOVETARGET CODE
The angle of the movetarget effects standing and bowing direction, but has no effect on movement, which allways heads to the next target.
targetname
must be present. The name of this movetarget.
target
the next spot to move to. If not present, stop here for good.
pausetime
The number of seconds to spend standing or bowing for path_stand or path_bow
==============================================================================
*/
void() movetarget_f =
{
if (!self.targetname)
objerror ("monster_movetarget: no targetname");
self.solid = SOLID_TRIGGER;
self.touch = t_movetarget;
setsize (self, '-8 -8 -8', '8 8 8');
};
/*QUAKED path_corner (0.5 0.3 0) (-8 -8 -8) (8 8 8)
Monsters will continue walking towards the next target corner.
*/
void() path_corner =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
movetarget_f ();
};
/*
=============
t_movetarget
Something has bumped into a movetarget. If it is a monster
moving towards it, change the next destination and continue.
==============
*/
void() t_movetarget =
{
local entity temp;
if (other.movetarget != self)
return;
if (other.enemy)
return; // fighting, not following a path
temp = self;
self = other;
other = temp;
if (self.classname == "monster_ogre")
sound (self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE);// play chainsaw drag sound
//dprint ("t_movetarget\n");
self.goalentity = self.movetarget = find (world, targetname, other.target);
self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
if (!self.movetarget)
{
self.pausetime = time + 999999;
self.th_stand ();
return;
}
};
//============================================================================
/*
=============
range
returns the range catagorization of an entity reletive to self
0 melee range, will become hostile even if back is turned
1 visibility and infront, or visibility and show hostile
2 infront and show hostile
3 only triggered by damage
=============
*/
float(entity targ) range =
{
local vector spot1, spot2;
local float r;
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
r = vlen (spot1 - spot2);
if (r < 120)
return RANGE_MELEE;
if (r < 500)
return RANGE_NEAR;
if (r < 1000)
return RANGE_MID;
return RANGE_FAR;
};
/*
=============
visible
returns 1 if the entity is visible to self, even if not infront ()
=============
*/
float (entity targ) visible =
{
local vector spot1, spot2;
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
traceline (spot1, spot2, TRUE, self); // see through other monsters
if (trace_inopen && trace_inwater)
return FALSE; // sight line crossed contents
if (trace_fraction == 1)
return TRUE;
return FALSE;
};
/*
=============
infront
returns 1 if the entity is in front (in sight) of self
=============
*/
float(entity targ) infront =
{
local vector vec;
local float dot;
makevectors (self.angles);
vec = normalize (targ.origin - self.origin);
dot = vec * v_forward;
if ( dot > 0.3)
{
return TRUE;
}
return FALSE;
};
//============================================================================
/*
===========
ChangeYaw
Turns towards self.ideal_yaw at self.yaw_speed
Sets the global variable current_yaw
Called every 0.1 sec by monsters
============
*/
/*
void() ChangeYaw =
{
local float ideal, move;
//current_yaw = self.ideal_yaw;
// mod down the current angle
current_yaw = anglemod( self.angles_y );
ideal = self.ideal_yaw;
if (current_yaw == ideal)
return;
move = ideal - current_yaw;
if (ideal > current_yaw)
{
if (move > 180)
move = move - 360;
}
else
{
if (move < -180)
move = move + 360;
}
if (move > 0)
{
if (move > self.yaw_speed)
move = self.yaw_speed;
}
else
{
if (move < 0-self.yaw_speed )
move = 0-self.yaw_speed;
}
current_yaw = anglemod (current_yaw + move);
self.angles_y = current_yaw;
};
*/
//============================================================================
void() HuntTarget =
{
self.goalentity = self.enemy;
self.think = self.th_run;
self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin);
self.nextthink = time + 0.1;
SUB_AttackFinished (1); // wait a while before first attack
};
void() SightSound =
{
local float rsnd;
if (self.classname == "monster_ogre")
sound (self, CHAN_VOICE, "ogre/ogwake.wav", 1, ATTN_NORM);
else if (self.classname == "monster_knight")
sound (self, CHAN_VOICE, "knight/ksight.wav", 1, ATTN_NORM);
else if (self.classname == "monster_shambler")
sound (self, CHAN_VOICE, "shambler/ssight.wav", 1, ATTN_NORM);
else if (self.classname == "monster_demon1")
sound (self, CHAN_VOICE, "demon/sight2.wav", 1, ATTN_NORM);
else if (self.classname == "monster_wizard")
sound (self, CHAN_VOICE, "wizard/wsight.wav", 1, ATTN_NORM);
else if (self.classname == "monster_zombie")
sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_NORM);
else if (self.classname == "monster_dog")
sound (self, CHAN_VOICE, "dog/dsight.wav", 1, ATTN_NORM);
else if (self.classname == "monster_hell_knight")
sound (self, CHAN_VOICE, "hknight/sight1.wav", 1, ATTN_NORM);
else if (self.classname == "monster_tarbaby")
sound (self, CHAN_VOICE, "blob/sight1.wav", 1, ATTN_NORM);
else if (self.classname == "monster_enforcer")
{
rsnd = rint(random() * 3);
if (rsnd == 1)
sound (self, CHAN_VOICE, "enforcer/sight1.wav", 1, ATTN_NORM);
else if (rsnd == 2)
sound (self, CHAN_VOICE, "enforcer/sight2.wav", 1, ATTN_NORM);
else if (rsnd == 0)
sound (self, CHAN_VOICE, "enforcer/sight3.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "enforcer/sight4.wav", 1, ATTN_NORM);
}
else if (self.classname == "monster_army")
sound (self, CHAN_VOICE, "soldier/sight1.wav", 1, ATTN_NORM);
else if (self.classname == "monster_shalrath")
sound (self, CHAN_VOICE, "shalrath/sight.wav", 1, ATTN_NORM);
};
void() FoundTarget =
{
if (self.enemy.classname == "player")
{ // let other monsters see this monster for a while
sight_entity = self;
sight_entity_time = time;
}
self.show_hostile = time + 1; // wake up other monsters
SightSound ();
HuntTarget ();
if (self.sight_trigger == 1) //thanks RennyC -- dumptruck_ds
{
activator = self.enemy;
SUB_UseAndForgetTargets ();
}
};
/*
===========
FindTarget
Self is currently not attacking anything, so try to find a target
Returns TRUE if an enemy was sighted
When a player fires a missile, the point of impact becomes a fakeplayer so
that monsters that see the impact will respond as if they had seen the
player.
To avoid spending too much time, only a single client (or fakeclient) is
checked each frame. This means multi player games will have slightly
slower noticing monsters.
============
*/
float() FindTarget =
{
local entity client;
local float r;
// if the first spawnflag bit is set, the monster will only wake up on
// really seeing the player, not another monster getting angry
// spawnflags & 3 is a big hack, because zombie crucified used the first
// spawn flag prior to the ambush flag, and I forgot about it, so the second
// spawn flag works as well
if (sight_entity_time >= time - 0.1 && !(self.spawnflags & 3) )
{
client = sight_entity;
if (client.enemy == self.enemy)
return TRUE;
}
else
{
client = checkclient ();
if (!client)
return FALSE; // current check entity isn't in PVS
}
if (client == self.enemy)
return FALSE;
if (client.flags & FL_NOTARGET)
return FALSE;
if (client.items & IT_INVISIBILITY)
return FALSE;
r = range (client);
if (r == RANGE_FAR)
return FALSE;
if (!visible (client))
return FALSE;
if (r == RANGE_NEAR)
{
if (client.show_hostile < time && !infront (client))
return FALSE;
}
else if (r == RANGE_MID)
{
if ( /* client.show_hostile < time || */ !infront (client))
return FALSE;
}
//
// got one
//
self.enemy = client;
if (self.enemy.classname != "player")
{
self.enemy = self.enemy.enemy;
if (self.enemy.classname != "player")
{
self.enemy = world;
return FALSE;
}
}
FoundTarget ();
return TRUE;
};
//=============================================================================
void(float dist) ai_forward =
{
walkmove (self.angles_y, dist);
};
void(float dist) ai_back =
{
walkmove ( (self.angles_y+180), dist);
};
/*
=============
ai_pain
stagger back a bit
=============
*/
void(float dist) ai_pain =
{
ai_back (dist);
/*
local float away;
away = anglemod (vectoyaw (self.origin - self.enemy.origin)
+ 180*(random()- 0.5) );
walkmove (away, dist);
*/
};
/*
=============
ai_painforward
stagger back a bit
=============
*/
void(float dist) ai_painforward =
{
walkmove (self.ideal_yaw, dist);
};
/*
=============
ai_walk
The monster is walking it's beat
=============
*/
void(float dist) ai_walk =
{
movedist = dist;
if (self.classname == "monster_dragon")
{
movetogoal (dist);
return;
}
// check for noticing a player
if (FindTarget ())
return;
movetogoal (dist);
};
/*
=============
ai_stand
The monster is staying in one place for a while, with slight angle turns
=============
*/
void() ai_stand =
{
if (FindTarget ())
return;
if (time > self.pausetime)
{
self.th_walk ();
return;
}
// change angle slightly
};
/*
=============
ai_turn
don't move, but turn towards ideal_yaw
=============
*/
void() ai_turn =
{
if (FindTarget ())
return;
ChangeYaw ();
};
//=============================================================================
/*
=============
ChooseTurn
=============
*/
void(vector dest3) ChooseTurn =
{
local vector dir, newdir;
dir = self.origin - dest3;
newdir_x = trace_plane_normal_y;
newdir_y = 0 - trace_plane_normal_x;
newdir_z = 0;
if (dir * newdir > 0)
{
dir_x = 0 - trace_plane_normal_y;
dir_y = trace_plane_normal_x;
}
else
{
dir_x = trace_plane_normal_y;
dir_y = 0 - trace_plane_normal_x;
}
dir_z = 0;
self.ideal_yaw = vectoyaw(dir);
};
/*
============
FacingIdeal
============
*/
float() FacingIdeal =
{
local float delta;
delta = anglemod(self.angles_y - self.ideal_yaw);
if (delta > 45 && delta < 315)
return FALSE;
return TRUE;
};
//=============================================================================
float() WizardCheckAttack;
float() DogCheckAttack;
float() CheckAnyAttack =
{
if (!enemy_vis)
return FALSE;
if (self.classname == "monster_army")
return SoldierCheckAttack ();
if (self.classname == "monster_ogre")
return OgreCheckAttack ();
if (self.classname == "monster_shambler")
return ShamCheckAttack ();
if (self.classname == "monster_demon1")
return DemonCheckAttack ();
if (self.classname == "monster_dog")
return DogCheckAttack ();
if (self.classname == "monster_wizard")
return WizardCheckAttack ();
return CheckAttack ();
};
/*
=============
ai_run_melee
Turn and close until within an angle to launch a melee attack
=============
*/
void() ai_run_melee =
{
self.ideal_yaw = enemy_yaw;
ChangeYaw ();
if (FacingIdeal())
{
self.th_melee ();
self.attack_state = AS_STRAIGHT;
}
};
/*
=============
ai_run_missile
Turn in place until within an angle to launch a missile attack
=============
*/
void() ai_run_missile =
{
self.ideal_yaw = enemy_yaw;
ChangeYaw ();
if (FacingIdeal())
{
self.th_missile ();
self.attack_state = AS_STRAIGHT;
}
};
/*
=============
ai_run_slide
Strafe sideways, but stay at aproximately the same range
=============
*/
void() ai_run_slide =
{
local float ofs;
self.ideal_yaw = enemy_yaw;
ChangeYaw ();
if (self.lefty)
ofs = 90;
else
ofs = -90;
if (walkmove (self.ideal_yaw + ofs, movedist))
return;
self.lefty = 1 - self.lefty;
walkmove (self.ideal_yaw - ofs, movedist);
};
/*
=============
ai_run
The monster has an enemy it is trying to kill
=============
*/
void(float dist) ai_run =
{
movedist = dist;
// see if the enemy is dead
if (self.enemy.health <= 0)
{
self.enemy = world;
// FIXME: look all around for other targets
if (self.oldenemy.health > 0)
{
self.enemy = self.oldenemy;
HuntTarget ();
}
else
{
if (self.movetarget)
self.th_walk ();
else
self.th_stand ();
return;
}
}
self.show_hostile = time + 1; // wake up other monsters
// check knowledge of enemy
enemy_vis = visible(self.enemy);
if (enemy_vis)
self.search_time = time + 5;
// look for other coop players
if (coop && self.search_time < time)
{
if (FindTarget ())
return;
}
enemy_infront = infront(self.enemy);
enemy_range = range(self.enemy);
enemy_yaw = vectoyaw(self.enemy.origin - self.origin);
if (self.attack_state == AS_MISSILE)
{
//dprint ("ai_run_missile\n");
ai_run_missile ();
return;
}
if (self.attack_state == AS_MELEE)
{
//dprint ("ai_run_melee\n");
ai_run_melee ();
return;
}
if (CheckAnyAttack ())
return; // beginning an attack
if (self.attack_state == AS_SLIDING)
{
ai_run_slide ();
return;
}
// head straight in
movetogoal (dist); // done in C code...
};

391
mod_mine/quakec_src/boss.qc Normal file
View File

@@ -0,0 +1,391 @@
/*
==============================================================================
BOSS-ONE
==============================================================================
*/
$cd id1/models/boss1
$origin 0 0 -15
$base base
$skin skin
$scale 5
$frame rise1 rise2 rise3 rise4 rise5 rise6 rise7 rise8 rise9 rise10
$frame rise11 rise12 rise13 rise14 rise15 rise16 rise17
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8
$frame walk9 walk10 walk11 walk12 walk13 walk14 walk15
$frame walk16 walk17 walk18 walk19 walk20 walk21 walk22
$frame walk23 walk24 walk25 walk26 walk27 walk28 walk29 walk30 walk31
$frame death1 death2 death3 death4 death5 death6 death7 death8 death9
$frame attack1 attack2 attack3 attack4 attack5 attack6 attack7 attack8
$frame attack9 attack10 attack11 attack12 attack13 attack14 attack15
$frame attack16 attack17 attack18 attack19 attack20 attack21 attack22
$frame attack23
$frame shocka1 shocka2 shocka3 shocka4 shocka5 shocka6 shocka7 shocka8
$frame shocka9 shocka10
$frame shockb1 shockb2 shockb3 shockb4 shockb5 shockb6
$frame shockc1 shockc2 shockc3 shockc4 shockc5 shockc6 shockc7 shockc8
$frame shockc9 shockc10
void(vector p) boss_missile;
void() boss_face =
{
// go for another player if multi player
if (self.enemy.health <= 0 || random() < 0.02)
{
self.enemy = find(self.enemy, classname, "player");
if (!self.enemy)
self.enemy = find(self.enemy, classname, "player");
}
ai_face();
};
void() boss_rise1 =[ $rise1, boss_rise2 ] {
sound (self, CHAN_WEAPON, "boss1/out1.wav", 1, ATTN_NORM);
};
void() boss_rise2 =[ $rise2, boss_rise3 ] {
sound (self, CHAN_VOICE, "boss1/sight1.wav", 1, ATTN_NORM);
};
void() boss_rise3 =[ $rise3, boss_rise4 ] {};
void() boss_rise4 =[ $rise4, boss_rise5 ] {};
void() boss_rise5 =[ $rise5, boss_rise6 ] {};
void() boss_rise6 =[ $rise6, boss_rise7 ] {};
void() boss_rise7 =[ $rise7, boss_rise8 ] {};
void() boss_rise8 =[ $rise8, boss_rise9 ] {};
void() boss_rise9 =[ $rise9, boss_rise10 ] {};
void() boss_rise10 =[ $rise10, boss_rise11 ] {};
void() boss_rise11 =[ $rise11, boss_rise12 ] {};
void() boss_rise12 =[ $rise12, boss_rise13 ] {};
void() boss_rise13 =[ $rise13, boss_rise14 ] {};
void() boss_rise14 =[ $rise14, boss_rise15 ] {};
void() boss_rise15 =[ $rise15, boss_rise16 ] {};
void() boss_rise16 =[ $rise16, boss_rise17 ] {};
void() boss_rise17 =[ $rise17, boss_missile1 ] {};
void() boss_idle1 =[ $walk1, boss_idle2 ]
{
// look for other players
};
void() boss_idle2 =[ $walk2, boss_idle3 ] {boss_face();};
void() boss_idle3 =[ $walk3, boss_idle4 ] {boss_face();};
void() boss_idle4 =[ $walk4, boss_idle5 ] {boss_face();};
void() boss_idle5 =[ $walk5, boss_idle6 ] {boss_face();};
void() boss_idle6 =[ $walk6, boss_idle7 ] {boss_face();};
void() boss_idle7 =[ $walk7, boss_idle8 ] {boss_face();};
void() boss_idle8 =[ $walk8, boss_idle9 ] {boss_face();};
void() boss_idle9 =[ $walk9, boss_idle10 ] {boss_face();};
void() boss_idle10 =[ $walk10, boss_idle11 ] {boss_face();};
void() boss_idle11 =[ $walk11, boss_idle12 ] {boss_face();};
void() boss_idle12 =[ $walk12, boss_idle13 ] {boss_face();};
void() boss_idle13 =[ $walk13, boss_idle14 ] {boss_face();};
void() boss_idle14 =[ $walk14, boss_idle15 ] {boss_face();};
void() boss_idle15 =[ $walk15, boss_idle16 ] {boss_face();};
void() boss_idle16 =[ $walk16, boss_idle17 ] {boss_face();};
void() boss_idle17 =[ $walk17, boss_idle18 ] {boss_face();};
void() boss_idle18 =[ $walk18, boss_idle19 ] {boss_face();};
void() boss_idle19 =[ $walk19, boss_idle20 ] {boss_face();};
void() boss_idle20 =[ $walk20, boss_idle21 ] {boss_face();};
void() boss_idle21 =[ $walk21, boss_idle22 ] {boss_face();};
void() boss_idle22 =[ $walk22, boss_idle23 ] {boss_face();};
void() boss_idle23 =[ $walk23, boss_idle24 ] {boss_face();};
void() boss_idle24 =[ $walk24, boss_idle25 ] {boss_face();};
void() boss_idle25 =[ $walk25, boss_idle26 ] {boss_face();};
void() boss_idle26 =[ $walk26, boss_idle27 ] {boss_face();};
void() boss_idle27 =[ $walk27, boss_idle28 ] {boss_face();};
void() boss_idle28 =[ $walk28, boss_idle29 ] {boss_face();};
void() boss_idle29 =[ $walk29, boss_idle30 ] {boss_face();};
void() boss_idle30 =[ $walk30, boss_idle31 ] {boss_face();};
void() boss_idle31 =[ $walk31, boss_idle1 ] {boss_face();};
void() boss_missile1 =[ $attack1, boss_missile2 ] {boss_face();};
void() boss_missile2 =[ $attack2, boss_missile3 ] {boss_face();};
void() boss_missile3 =[ $attack3, boss_missile4 ] {boss_face();};
void() boss_missile4 =[ $attack4, boss_missile5 ] {boss_face();};
void() boss_missile5 =[ $attack5, boss_missile6 ] {boss_face();};
void() boss_missile6 =[ $attack6, boss_missile7 ] {boss_face();};
void() boss_missile7 =[ $attack7, boss_missile8 ] {boss_face();};
void() boss_missile8 =[ $attack8, boss_missile9 ] {boss_face();};
void() boss_missile9 =[ $attack9, boss_missile10 ] {boss_missile('100 100 200');};
void() boss_missile10 =[ $attack10, boss_missile11 ] {boss_face();};
void() boss_missile11 =[ $attack11, boss_missile12 ] {boss_face();};
void() boss_missile12 =[ $attack12, boss_missile13 ] {boss_face();};
void() boss_missile13 =[ $attack13, boss_missile14 ] {boss_face();};
void() boss_missile14 =[ $attack14, boss_missile15 ] {boss_face();};
void() boss_missile15 =[ $attack15, boss_missile16 ] {boss_face();};
void() boss_missile16 =[ $attack16, boss_missile17 ] {boss_face();};
void() boss_missile17 =[ $attack17, boss_missile18 ] {boss_face();};
void() boss_missile18 =[ $attack18, boss_missile19 ] {boss_face();};
void() boss_missile19 =[ $attack19, boss_missile20 ] {boss_face();};
void() boss_missile20 =[ $attack20, boss_missile21 ] {boss_missile('100 -100 200');};
void() boss_missile21 =[ $attack21, boss_missile22 ] {boss_face();};
void() boss_missile22 =[ $attack22, boss_missile23 ] {boss_face();};
void() boss_missile23 =[ $attack23, boss_missile1 ] {boss_face();};
void() boss_shocka1 =[ $shocka1, boss_shocka2 ] {};
void() boss_shocka2 =[ $shocka2, boss_shocka3 ] {};
void() boss_shocka3 =[ $shocka3, boss_shocka4 ] {};
void() boss_shocka4 =[ $shocka4, boss_shocka5 ] {};
void() boss_shocka5 =[ $shocka5, boss_shocka6 ] {};
void() boss_shocka6 =[ $shocka6, boss_shocka7 ] {};
void() boss_shocka7 =[ $shocka7, boss_shocka8 ] {};
void() boss_shocka8 =[ $shocka8, boss_shocka9 ] {};
void() boss_shocka9 =[ $shocka9, boss_shocka10 ] {};
void() boss_shocka10 =[ $shocka10, boss_missile1 ] {};
void() boss_shockb1 =[ $shockb1, boss_shockb2 ] {};
void() boss_shockb2 =[ $shockb2, boss_shockb3 ] {};
void() boss_shockb3 =[ $shockb3, boss_shockb4 ] {};
void() boss_shockb4 =[ $shockb4, boss_shockb5 ] {};
void() boss_shockb5 =[ $shockb5, boss_shockb6 ] {};
void() boss_shockb6 =[ $shockb6, boss_shockb7 ] {};
void() boss_shockb7 =[ $shockb1, boss_shockb8 ] {};
void() boss_shockb8 =[ $shockb2, boss_shockb9 ] {};
void() boss_shockb9 =[ $shockb3, boss_shockb10 ] {};
void() boss_shockb10 =[ $shockb4, boss_missile1 ] {};
void() boss_shockc1 =[ $shockc1, boss_shockc2 ] {};
void() boss_shockc2 =[ $shockc2, boss_shockc3 ] {};
void() boss_shockc3 =[ $shockc3, boss_shockc4 ] {};
void() boss_shockc4 =[ $shockc4, boss_shockc5 ] {};
void() boss_shockc5 =[ $shockc5, boss_shockc6 ] {};
void() boss_shockc6 =[ $shockc6, boss_shockc7 ] {};
void() boss_shockc7 =[ $shockc7, boss_shockc8 ] {};
void() boss_shockc8 =[ $shockc8, boss_shockc9 ] {};
void() boss_shockc9 =[ $shockc9, boss_shockc10 ] {};
void() boss_shockc10 =[ $shockc10, boss_death1 ] {};
void() boss_death1 = [$death1, boss_death2] {
sound (self, CHAN_VOICE, "boss1/death.wav", 1, ATTN_NORM);
};
void() boss_death2 = [$death2, boss_death3] {};
void() boss_death3 = [$death3, boss_death4] {};
void() boss_death4 = [$death4, boss_death5] {};
void() boss_death5 = [$death5, boss_death6] {};
void() boss_death6 = [$death6, boss_death7] {};
void() boss_death7 = [$death7, boss_death8] {};
void() boss_death8 = [$death8, boss_death9] {};
void() boss_death9 = [$death9, boss_death10]
{
sound (self, CHAN_BODY, "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() boss_death10 = [$death9, boss_death10]
{
killed_monsters = killed_monsters + 1;
WriteByte (MSG_ALL, SVC_KILLEDMONSTER); // FIXME: reliable broadcast
SUB_UseTargets ();
remove (self);
};
void(vector p) boss_missile =
{
local vector offang;
local vector org, vec, d;
local float t;
offang = vectoangles (self.enemy.origin - self.origin);
makevectors (offang);
org = self.origin + p_x*v_forward + p_y*v_right + p_z*'0 0 1';
// lead the player on hard mode
if (skill > 1)
{
t = vlen(self.enemy.origin - org) / 300;
vec = self.enemy.velocity;
vec_z = 0;
d = self.enemy.origin + t * vec;
}
else
{
d = self.enemy.origin;
}
vec = normalize (d - org);
launch_spike (org, vec);
setmodel (newmis, "progs/lavaball.mdl");
newmis.avelocity = '200 100 300';
setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
newmis.velocity = vec*300;
newmis.touch = T_MissileTouch; // rocket explosion
sound (self, CHAN_WEAPON, "boss1/throw.wav", 1, ATTN_NORM);
// check for dead enemy
if (self.enemy.health <= 0)
boss_idle1 ();
};
void() boss_awake =
{
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
self.takedamage = DAMAGE_NO;
setmodel (self, "progs/boss.mdl");
setsize (self, '-128 -128 -24', '128 128 256');
if (skill == 0)
self.health = 1;
else
self.health = 3;
self.enemy = activator;
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);
self.yaw_speed = 20;
boss_rise1 ();
};
/*QUAKED monster_boss (1 0 0) (-128 -128 -24) (128 128 256)
*/
void() monster_boss =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (deathmatch)
{
remove(self);
return;
}
precache_model ("progs/boss.mdl");
precache_model ("progs/lavaball.mdl");
precache_sound ("weapons/rocket1i.wav");
precache_sound ("boss1/out1.wav");
precache_sound ("boss1/sight1.wav");
precache_sound ("misc/power.wav");
precache_sound ("boss1/throw.wav");
precache_sound ("boss1/pain.wav");
precache_sound ("boss1/death.wav");
total_monsters = total_monsters + 1;
self.use = boss_awake;
};
//===========================================================================
entity le1, le2;
float lightning_end;
void() lightning_fire =
{
local vector p1, p2;
if (time >= lightning_end)
{ // done here, put the terminals back up
self = le1;
door_go_down ();
self = le2;
door_go_down ();
return;
}
p1 = (le1.mins + le1.maxs) * 0.5;
p1_z = le1.absmin_z - 16;
p2 = (le2.mins + le2.maxs) * 0.5;
p2_z = le2.absmin_z - 16;
// compensate for length of bolt
p2 = p2 - normalize(p2-p1)*100;
self.nextthink = time + 0.1;
self.think = lightning_fire;
WriteByte (MSG_ALL, SVC_TEMPENTITY);
WriteByte (MSG_ALL, TE_LIGHTNING3);
WriteEntity (MSG_ALL, world);
WriteCoord (MSG_ALL, p1_x);
WriteCoord (MSG_ALL, p1_y);
WriteCoord (MSG_ALL, p1_z);
WriteCoord (MSG_ALL, p2_x);
WriteCoord (MSG_ALL, p2_y);
WriteCoord (MSG_ALL, p2_z);
};
void() lightning_use =
{
if (lightning_end >= time + 1)
return;
le1 = find( world, target, "lightning");
le2 = find( le1, target, "lightning");
if (!le1 || !le2)
{
dprint ("missing lightning targets\n");
return;
}
if (
(le1.state != STATE_TOP && le1.state != STATE_BOTTOM)
|| (le2.state != STATE_TOP && le2.state != STATE_BOTTOM)
|| (le1.state != le2.state) )
{
// dprint ("not aligned\n");
return;
}
// don't let the electrodes go back up until the bolt is done
le1.nextthink = -1;
le2.nextthink = -1;
lightning_end = time + 1;
sound (self, CHAN_VOICE, "misc/power.wav", 1, ATTN_NORM);
lightning_fire ();
// advance the boss pain if down
self = find (world, classname, "monster_boss");
if (!self)
return;
self.enemy = activator;
if (le1.state == STATE_TOP && self.health > 0)
{
sound (self, CHAN_VOICE, "boss1/pain.wav", 1, ATTN_NORM);
self.health = self.health - 1;
if (self.health >= 2)
boss_shocka1();
else if (self.health == 1)
boss_shockb1();
else if (self.health == 0)
boss_shockc1();
}
};
/*QUAKED event_lightning (0 1 1) (-16 -16 -16) (16 16 16)
Just for boss level.
*/
void() event_lightning =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
self.use = lightning_use;
};

View File

@@ -0,0 +1,142 @@
// button and multiple button
void() button_wait;
void() button_return;
void() button_wait =
{
self.state = STATE_TOP;
self.nextthink = self.ltime + self.wait;
self.think = button_return;
activator = self.enemy;
SUB_UseTargets();
self.frame = 1; // use alternate textures
};
void() button_done =
{
self.state = STATE_BOTTOM;
};
void() button_return =
{
self.state = STATE_DOWN;
SUB_CalcMove (self.pos1, self.speed, button_done);
self.frame = 0; // use normal textures
if (self.health)
self.takedamage = DAMAGE_YES; // can be shot again
};
void() button_blocked =
{ // do nothing, just don't ome all the way back out
};
void() button_fire =
{
if (self.state == STATE_UP || self.state == STATE_TOP)
return;
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
self.state = STATE_UP;
SUB_CalcMove (self.pos2, self.speed, button_wait);
};
void() button_use =
{
self.enemy = activator;
button_fire ();
};
void() button_touch =
{
if (other.classname != "player")
return;
self.enemy = other;
button_fire ();
};
void() button_killed =
{
self.enemy = damage_attacker;
self.health = self.max_health;
self.takedamage = DAMAGE_NO; // wil be reset upon return
button_fire ();
};
/*QUAKED func_button (0 .5 .8) ?
When a button is touched, it moves some distance in the direction of it's angle, triggers all of it's targets, waits some time, then returns to it's original position where it can be triggered again.
"angle" determines the opening direction
"target" all entities with a matching targetname will be used
"speed" override the default 40 speed
"wait" override the default 1 second wait (-1 = never return)
"lip" override the default 4 pixel lip remaining at end of move
"health" if set, the button must be killed instead of touched
"sounds"
0) steam metal
1) wooden clunk
2) metallic click
3) in-out
*/
void() func_button =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (self.sounds == 0)
{
precache_sound ("buttons/airbut1.wav");
self.noise = "buttons/airbut1.wav";
}
if (self.sounds == 1)
{
precache_sound ("buttons/switch21.wav");
self.noise = "buttons/switch21.wav";
}
if (self.sounds == 2)
{
precache_sound ("buttons/switch02.wav");
self.noise = "buttons/switch02.wav";
}
if (self.sounds == 3)
{
precache_sound ("buttons/switch04.wav");
self.noise = "buttons/switch04.wav";
}
SetMovedir ();
self.movetype = MOVETYPE_PUSH;
self.solid = SOLID_BSP;
setmodel (self, self.model);
self.blocked = button_blocked;
self.use = button_use;
if (self.health)
{
self.max_health = self.health;
self.th_die = button_killed;
self.takedamage = DAMAGE_YES;
}
else
self.touch = button_touch;
if (!self.speed)
self.speed = 40;
if (!self.wait)
self.wait = 1;
if (!self.lip)
self.lip = 4;
self.state = STATE_BOTTOM;
self.pos1 = self.origin;
self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip);
};

View File

@@ -0,0 +1,130 @@
1.1.2 October 2019
* Added newflags.qc (iw)
* Added new spawnflags (iw)
4096 Not in Coop
8192 Not in Single Player
32768 Not on Hard Only
65536 Not on Nightmare Only
* Fixed collision issues in trap_shooter, trap_spikeshooter, trap_switched_shooter
* Added workaround for if(string) engine bug (iw)
* Added function SUB_UseAndForgetTargets() to subs.qc (iw)
* Fixed sight_target firing targets multiple times (iw)
* Fixed pain_target not using targetname2/3/4 (iw)
* Fixed messages not displaying with sight_trigger (iw)
* Make weapons fire their targets in Coop and DM2 modes (iw)
* Prevent keys firing multiple targets multiple times in Coop (iw)
* Fixes to func_bob (iw)
* Fixed messages not displaying with func_counter (iw)
* Fixed "delay" making func_counter not work (iw)
* Added SUB_DislodgeRestingEntities to subs.qc (iw)
* Fixed func_breakable debris sometimes floating (iw)
* Added pd_lightning demo map
* Fixed func_laser audio issue when used with func_counter
* Added GNU License and source to my_mod directory
1.1.1 August 2019
* Added func_elvtr_button and ELEVATOR functionality to func_new_plat (iw)
* Fix Fiends never going into their pain animation (iw)
* Fix a critical bug involving func_elvtr_button (iw)
* Address various FTEQCC warnings (iw)
* Fix kill count bug with trigger-spawned Rotfish (iw)
* Fixed qc syntax errors in monsters.qc (iw)
* Fix various issues involving gravity and ladders (iw)
* Make trigger_ladder ignore bad (up/down) angles (iw)
* Fix items not respawning in deathmatch mode (iw)
* Fix a "friendly monster" bug in trigger spawned monsters (iw)
* Fix pain_target never firing in some cases (iw)
* Fix item_health collision with BSP model entities (iw)
* Fix the weapon_shotgun spawnflag test (iw)
* Allow "wait" to be set for elevators (iw)
* other tweaks to DOE elevator code in doeplats.qc (iw)
* pd_elevator demo level (iw)
1.1.0 Official Release
* Added func_bob and misc_bob (RennyC adapted from AD)
* Added misc_sparks (Rubicon2)
* Added misc_particles (misc_splash from Rubicon2)
* Added sight_trigger - monsters fire targets upon seeing the player
* Added keep_ammo to Ogre, Soldier and Enforcer (no "DropBackpack" if set to 1)
* Added misc_particlespray (from custents)
1.1.0 Release Candidate 3
* Fixed Megahealth respawning issue from RC1 / RC2
* Fixed incorrect item_health bounding box from RC1 / RC2
* Fixed Attenuation issue on custom sound entities
* Added Khreathor's self.particle_offset to spawning items for better tfog
* Added custom health to monsters (except zombies)
* Added trigger_take_weapon (a.k.a. axe start)
* Added weapon_shotgun pickup
* Added RennyC's func_fall - trap brush that falls out from under the player
* Added Hipnotic version of trap_spikeshooter (with lavaball and rockets)
* Added Voreballs, Grenades to trap_spikeshooter
* Added Rubicon2 "retriggerable" spawnflag and custom sounds to func_train
* Added gibs to trap_spikeshooter
* Added lightning trail entities from DOE (for traps and visual effects)
* Added visual effect entities:
play_explosion
play_tbabyexplode
play_lavasplash
* Added c0burn's switchable light styles
* Added custom sound option to play_lavasplash
* Added custom sound option to func_fall
* Added Zerstrorer misc_particle_stream
* Added silent option to func_rotate_door (sounds 4)
* Added DONT_FADE spawnflag to func_fall
* Added elec22k.wav for looped lightning sound effects
* Added pd_lasers test level
1.1.0 Release Candidate 1 & 2
* Added reset_items key to worldspawn entity; resets players items on map load (no need for Rune hacks for custom start maps!)
* Added classnames to "bonus item fell out of level" and "monster stuck in wall" errors when developer is set to 1.
* Add entities for Thunder, Water and Sky sounds. Use these when you want to hand place these instead of having VIS.exe add them automatically.
* Fixed door unlock sound not playing (id software bug)
* Added ladders
* Added breakables
* Added spawn_angry key/value for use with Trigger Spawned monsters
* Added meat_shower (regular or large, triggerable, silent or random gib sounds)
* Added trigger_void
* Added trigger_shake (earthquake)
* Renamed dtsounds.qc to dtmisc.qc
* Added deadstuff entities
* Added ritem (items respawn)
* Added trigger spawning to items
* Added items suspended flag
* Fixed trigger_ladder conflict with trigger_setgravity
* Added pain_target and pain_threshold
* Added func_togglewall, func_counter, func_oncount and func_particlefield from Hipnotic
* Added pd_ladders test level
* Added pd_zombies and pd_meat maps
* Added Persistent Key behavior (cnt = 1) to func_door and trigger_usekey
* Added candle.mdl from Rogue and light_candle qc from Honey
1.0.0 (omitted)
RC 4
* added tele_fog //thanks Khreathor!
* added FireAmbient to fgd
* revisions to progs_dump_100 sample map.
RC 3
* removed unused spawnflags from fgd
* revised progs_dump_100 map
* reverted trigger_hurt, trigger_push to id1 code
RC2 2018-9-15
* added trigger_setgravity from Hipnotic
* added trigger_usekey from Hipnotic
* added func_new_plat from Rogue
* revised dtsounds.qc to avoid crashes when noise values were missing
* updated manual
* "new" test map to illustrate additions
RC1 (omitted)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,303 @@
void() T_MissileTouch;
void() info_player_start;
void(entity targ, entity attacker) ClientObituary;
void() monster_death_use;
//============================================================================
/*
============
CanDamage
Returns true if the inflictor can directly damage the target. Used for
explosions and melee attacks.
============
*/
float(entity targ, entity inflictor) CanDamage =
{
// bmodels need special checking because their origin is 0,0,0
if (targ.movetype == MOVETYPE_PUSH)
{
traceline(inflictor.origin, 0.5 * (targ.absmin + targ.absmax), TRUE, self);
if (trace_fraction == 1)
return TRUE;
if (trace_ent == targ)
return TRUE;
return FALSE;
}
traceline(inflictor.origin, targ.origin, TRUE, self);
if (trace_fraction == 1)
return TRUE;
traceline(inflictor.origin, targ.origin + '15 15 0', TRUE, self);
if (trace_fraction == 1)
return TRUE;
traceline(inflictor.origin, targ.origin + '-15 -15 0', TRUE, self);
if (trace_fraction == 1)
return TRUE;
traceline(inflictor.origin, targ.origin + '-15 15 0', TRUE, self);
if (trace_fraction == 1)
return TRUE;
traceline(inflictor.origin, targ.origin + '15 -15 0', TRUE, self);
if (trace_fraction == 1)
return TRUE;
return FALSE;
};
/*
============
Killed
============
*/
void(entity targ, entity attacker) Killed =
{
local entity oself;
oself = self;
self = targ;
if (self.health < -99)
self.health = -99; // don't let sbar look bad if a player
if (self.movetype == MOVETYPE_PUSH || self.movetype == MOVETYPE_NONE)
{ // doors, triggers, etc
self.th_die ();
self = oself;
return;
}
self.enemy = attacker;
// bump the monster counter
if (self.flags & FL_MONSTER)
{
killed_monsters = killed_monsters + 1;
WriteByte (MSG_ALL, SVC_KILLEDMONSTER);
}
ClientObituary(self, attacker);
self.takedamage = DAMAGE_NO;
self.touch = SUB_Null;
monster_death_use();
self.th_die ();
self = oself;
};
/*
============
T_Damage
The damage is coming from inflictor, but get mad at attacker
This should be the only function that ever reduces health.
============
*/
void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
{
local vector dir;
local entity oldself;
local float save;
local float take;
if (!targ.takedamage)
return;
//johnfitz -- some func_breakables ignore monster damage //added from Rubicon2 combat.qc dumptruck_ds
if (targ.classname == "func_breakable")
{
if (targ.spawnflags & BREAKABLE_NO_MONSTERS && attacker.flags & FL_MONSTER)
return;
}
//johnfitz
// used by buttons and triggers to set activator for target firing
damage_attacker = attacker;
// check for quad damage powerup on the attacker
if (attacker.super_damage_finished > time)
damage = damage * 4;
// save damage based on the target's armor level
save = ceil(targ.armortype*damage);
if (save >= targ.armorvalue)
{
save = targ.armorvalue;
targ.armortype = 0; // lost all armor
targ.items = targ.items - (targ.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3));
}
targ.armorvalue = targ.armorvalue - save;
take = ceil(damage-save);
// add to the damage total for clients, which will be sent as a single
// message at the end of the frame
// FIXME: remove after combining shotgun blasts?
if (targ.flags & FL_CLIENT)
{
targ.dmg_take = targ.dmg_take + take;
targ.dmg_save = targ.dmg_save + save;
targ.dmg_inflictor = inflictor;
}
// figure momentum add
if ( (inflictor != world) && (targ.movetype == MOVETYPE_WALK) )
{
dir = targ.origin - (inflictor.absmin + inflictor.absmax) * 0.5;
dir = normalize(dir);
targ.velocity = targ.velocity + dir*damage*8;
}
// check for godmode or invincibility
if (targ.flags & FL_GODMODE)
return;
if (targ.invincible_finished >= time)
{
if (self.invincible_sound < time)
{
sound (targ, CHAN_ITEM, "items/protect3.wav", 1, ATTN_NORM);
self.invincible_sound = time + 2;
}
return;
}
// team play damage avoidance
if ( (teamplay == 1) && (targ.team > 0)&&(targ.team == attacker.team) )
return;
// do the damage
targ.health = targ.health - take;
// fire pain_target if appropriate
if ((targ.flags & FL_MONSTER) &&
targ.pain_target != "" &&
targ.health <= targ.pain_threshold)
{
oldself = self;
self = targ;
monster_pain_use ();
self = oldself;
}
if (targ.health <= 0)
{
Killed (targ, attacker);
return;
}
// react to the damage
oldself = self;
self = targ;
if ( (self.flags & FL_MONSTER) && attacker != world)
{
// get mad unless of the same class (except for soldiers)
if (self != attacker && attacker != self.enemy)
{
if ( (self.classname != attacker.classname)
|| (self.classname == "monster_army" ) )
{
if (self.enemy.classname == "player")
self.oldenemy = self.enemy;
self.enemy = attacker;
FoundTarget ();
}
}
}
if (self.th_pain)
{
self.th_pain (attacker, take);
// nightmare mode monsters don't go into pain frames often
if (skill == 3)
self.pain_finished = time + 5;
}
self = oldself;
};
/*
============
T_RadiusDamage
============
*/
void(entity inflictor, entity attacker, float damage, entity ignore) T_RadiusDamage =
{
local float points;
local entity head;
local vector org;
head = findradius(inflictor.origin, damage+40);
while (head)
{
if (head != ignore)
{
if (head.takedamage)
{
org = head.origin + (head.mins + head.maxs)*0.5;
points = 0.5*vlen (inflictor.origin - org);
if (points < 0)
points = 0;
points = damage - points;
if (head == attacker)
points = points * 0.5;
if (points > 0)
{
if (CanDamage (head, inflictor))
{ // shambler takes half damage from all explosions
if (head.classname == "monster_shambler")
T_Damage (head, inflictor, attacker, points*0.5);
else
T_Damage (head, inflictor, attacker, points);
}
}
}
}
head = head.chain;
}
};
/*
============
T_BeamDamage
============
*/
void(entity attacker, float damage) T_BeamDamage =
{
local float points;
local entity head;
head = findradius(attacker.origin, damage+40);
while (head)
{
if (head.takedamage)
{
points = 0.5*vlen (attacker.origin - head.origin);
if (points < 0)
points = 0;
points = damage - points;
if (head == attacker)
points = points * 0.5;
if (points > 0)
{
if (CanDamage (head, attacker))
{
if (head.classname == "monster_shambler")
T_Damage (head, attacker, attacker, points*0.5);
else
T_Damage (head, attacker, attacker, points);
}
}
}
head = head.chain;
}
};

791
mod_mine/quakec_src/defs.qc Normal file
View File

@@ -0,0 +1,791 @@
/*
==============================================================================
SOURCE FOR GLOBALVARS_T C STRUCTURE
==============================================================================
*/
//
// system globals
//
entity self;
entity other;
entity world;
float time;
float frametime;
float force_retouch; // force all entities to touch triggers
// next frame. this is needed because
// non-moving things don't normally scan
// for triggers, and when a trigger is
// created (like a teleport trigger), it
// needs to catch everything.
// decremented each frame, so set to 2
// to guarantee everything is touched
string mapname;
float deathmatch;
float coop;
float teamplay;
float serverflags; // propagated from level to level, used to
// keep track of completed episodes
float total_secrets;
float total_monsters;
float found_secrets; // number of secrets found
float killed_monsters; // number of monsters killed
// spawnparms are used to encode information about clients across server
// level changes
float parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
//
// global variables set by built in functions
//
vector v_forward, v_up, v_right; // set by makevectors()
// set by traceline / tracebox
float trace_allsolid;
float trace_startsolid;
float trace_fraction;
vector trace_endpos;
vector trace_plane_normal;
float trace_plane_dist;
entity trace_ent;
float trace_inopen;
float trace_inwater;
entity msg_entity; // destination of single entity writes
//
// required prog functions
//
void() main; // only for testing
void() StartFrame;
void() PlayerPreThink;
void() PlayerPostThink;
void() ClientKill;
void() ClientConnect;
void() PutClientInServer; // call after setting the parm1... parms
void() ClientDisconnect;
void() SetNewParms; // called when a client first connects to
// a server. sets parms so they can be
// saved off for restarts
void() SetChangeParms; // call to set parms for self so they can
// be saved for a level transition
//================================================
void end_sys_globals; // flag for structure dumping
//================================================
/*
==============================================================================
SOURCE FOR ENTVARS_T C STRUCTURE
==============================================================================
*/
//
// system fields (*** = do not set in prog code, maintained by C code)
//
.float modelindex; // *** model index in the precached list
.vector absmin, absmax; // *** origin + mins / maxs
.float ltime; // local time for entity
.float movetype;
.float solid;
.vector origin; // ***
.vector oldorigin; // ***
.vector velocity;
.vector angles;
.vector avelocity;
.vector punchangle; // temp angle adjust from damage or recoil
.string classname; // spawn function
.string model;
.float frame;
.float skin;
.float effects;
.vector mins, maxs; // bounding box extents reletive to origin
.vector size; // maxs - mins
.void() touch;
.void() use;
.void() think;
.void() blocked; // for doors or plats, called when can't push other
.float nextthink;
.entity groundentity;
// stats
.float health;
.float frags;
.float weapon; // one of the IT_SHOTGUN, etc flags
.string weaponmodel;
.float weaponframe;
.float currentammo;
.float ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
.float items; // bit flags
.float takedamage;
.entity chain;
.float deadflag;
.vector view_ofs; // add to origin to get eye point
.float button0; // fire
.float button1; // use
.float button2; // jump
.float impulse; // weapon changes
.float fixangle;
.vector v_angle; // view / targeting angle for players
.float idealpitch; // calculated pitch angle for lookup up slopes
.string netname;
.entity enemy;
.float flags;
.float colormap;
.float team;
.float max_health; // players maximum health is stored here
.float teleport_time; // don't back up
.float armortype; // save this fraction of incoming damage
.float armorvalue;
.float waterlevel; // 0 = not in, 1 = feet, 2 = wast, 3 = eyes
.float watertype; // a contents value
.float ideal_yaw;
.float yaw_speed;
.entity aiment;
.entity goalentity; // a movetarget or an enemy
.float spawnflags;
.string target;
.string targetname;
// damage is accumulated through a frame. and sent as one single
// message, so the super shotgun doesn't generate huge messages
.float dmg_take;
.float dmg_save;
.entity dmg_inflictor;
.entity owner; // who launched a missile
.vector movedir; // mostly for doors, but also used for waterjump
.string message; // trigger messages
.float sounds; // either a cd track number or sound number
.string noise, noise1, noise2, noise3; // contains names of wavs to play
//================================================
void end_sys_fields; // flag for structure dumping
//================================================
/*
==============================================================================
VARS NOT REFERENCED BY C CODE
==============================================================================
*/
//
// constants
//
float FALSE = 0;
float TRUE = 1;
// edict.flags
float FL_FLY = 1;
float FL_SWIM = 2;
float FL_CLIENT = 8; // set for all client edicts
float FL_INWATER = 16; // for enter / leave water splash
float FL_MONSTER = 32;
float FL_GODMODE = 64; // player cheat
float FL_NOTARGET = 128; // player cheat
float FL_ITEM = 256; // extra wide size for bonus items
float FL_ONGROUND = 512; // standing on something
float FL_PARTIALGROUND = 1024; // not all corners are valid
float FL_WATERJUMP = 2048; // player jumping out of water
float FL_JUMPRELEASED = 4096; // for jump debouncing
// edict.movetype values
float MOVETYPE_NONE = 0; // never moves
//float MOVETYPE_ANGLENOCLIP = 1;
//float MOVETYPE_ANGLECLIP = 2;
float MOVETYPE_WALK = 3; // players only
float MOVETYPE_STEP = 4; // discrete, not real time unless fall
float MOVETYPE_FLY = 5;
float MOVETYPE_TOSS = 6; // gravity
float MOVETYPE_PUSH = 7; // no clip to world, push and crush
float MOVETYPE_NOCLIP = 8;
float MOVETYPE_FLYMISSILE = 9; // fly with extra size against monsters
float MOVETYPE_BOUNCE = 10;
float MOVETYPE_BOUNCEMISSILE = 11; // bounce with extra size
// edict.solid values
float SOLID_NOT = 0; // no interaction with other objects
float SOLID_TRIGGER = 1; // touch on edge, but not blocking
float SOLID_BBOX = 2; // touch on edge, block
float SOLID_SLIDEBOX = 3; // touch on edge, but not an onground
float SOLID_BSP = 4; // bsp clip, touch on edge, block
// range values
float RANGE_MELEE = 0;
float RANGE_NEAR = 1;
float RANGE_MID = 2;
float RANGE_FAR = 3;
// deadflag values
float DEAD_NO = 0;
float DEAD_DYING = 1;
float DEAD_DEAD = 2;
float DEAD_RESPAWNABLE = 3;
// takedamage values
float DAMAGE_NO = 0;
float DAMAGE_YES = 1;
float DAMAGE_AIM = 2;
// items
float IT_AXE = 4096;
float IT_SHOTGUN = 1;
float IT_SUPER_SHOTGUN = 2;
float IT_NAILGUN = 4;
float IT_SUPER_NAILGUN = 8;
float IT_GRENADE_LAUNCHER = 16;
float IT_ROCKET_LAUNCHER = 32;
float IT_LIGHTNING = 64;
float IT_EXTRA_WEAPON = 128;
float IT_SHELLS = 256;
float IT_NAILS = 512;
float IT_ROCKETS = 1024;
float IT_CELLS = 2048;
float IT_ARMOR1 = 8192;
float IT_ARMOR2 = 16384;
float IT_ARMOR3 = 32768;
float IT_SUPERHEALTH = 65536;
float IT_KEY1 = 131072;
float IT_KEY2 = 262144;
float IT_INVISIBILITY = 524288;
float IT_INVULNERABILITY = 1048576;
float IT_SUIT = 2097152;
float IT_QUAD = 4194304;
// point content values
float CONTENT_EMPTY = -1;
float CONTENT_SOLID = -2;
float CONTENT_WATER = -3;
float CONTENT_SLIME = -4;
float CONTENT_LAVA = -5;
float CONTENT_SKY = -6;
float STATE_TOP = 0;
float STATE_BOTTOM = 1;
float STATE_UP = 2;
float STATE_DOWN = 3;
vector VEC_ORIGIN = '0 0 0';
vector VEC_HULL_MIN = '-16 -16 -24';
vector VEC_HULL_MAX = '16 16 32';
vector VEC_HULL2_MIN = '-32 -32 -24';
vector VEC_HULL2_MAX = '32 32 64';
// protocol bytes
float SVC_TEMPENTITY = 23;
float SVC_KILLEDMONSTER = 27;
float SVC_FOUNDSECRET = 28;
float SVC_INTERMISSION = 30;
float SVC_FINALE = 31;
float SVC_CDTRACK = 32;
float SVC_SELLSCREEN = 33;
float TE_SPIKE = 0;
float TE_SUPERSPIKE = 1;
float TE_GUNSHOT = 2;
float TE_EXPLOSION = 3;
float TE_TAREXPLOSION = 4;
float TE_LIGHTNING1 = 5;
float TE_LIGHTNING2 = 6;
float TE_WIZSPIKE = 7;
float TE_KNIGHTSPIKE = 8;
float TE_LIGHTNING3 = 9;
float TE_LAVASPLASH = 10;
float TE_TELEPORT = 11;
// sound channels
// channel 0 never willingly overrides
// other channels (1-7) allways override a playing sound on that channel
float CHAN_AUTO = 0;
float CHAN_WEAPON = 1;
float CHAN_VOICE = 2;
float CHAN_ITEM = 3;
float CHAN_BODY = 4;
float ATTN_NONE = 0;
float ATTN_NORM = 1;
float ATTN_IDLE = 2;
float ATTN_STATIC = 3;
// update types
float UPDATE_GENERAL = 0;
float UPDATE_STATIC = 1;
float UPDATE_BINARY = 2;
float UPDATE_TEMP = 3;
// entity effects
float EF_BRIGHTFIELD = 1;
float EF_MUZZLEFLASH = 2;
float EF_BRIGHTLIGHT = 4;
float EF_DIMLIGHT = 8;
// messages
float MSG_BROADCAST = 0; // unreliable to all
float MSG_ONE = 1; // reliable to one (msg_entity)
float MSG_ALL = 2; // reliable to all
float MSG_INIT = 3; // write to the init string
// known_release values -- iw
float KNOWN_RELEASE_NOT = 0;
float KNOWN_RELEASE_FUNC_MAPJAMX = 1;
//================================================
//
// globals
//
float movedist;
float gameover; // set when a rule exits
string string_null; // null string, nothing should be held here
//float empty_float;
entity newmis; // launch_spike sets this after spawning it
entity activator; // the entity that activated a trigger or brush
entity damage_attacker; // set by T_Damage
float framecount;
float skill;
float known_release; // unique id for a release; see values above -- iw
//================================================
//
// world fields (FIXME: make globals)
//
.string wad;
.string map;
.float worldtype; // 0=medieval 1=metal 2=base
//================================================
.string killtarget;
//
// quakeed fields
//
.float light_lev; // not used by game, but parsed by light util
.float style;
//
// monster ai
//
.void() th_stand;
.void() th_walk;
.void() th_run;
.void() th_missile;
.void() th_melee;
.void(entity attacker, float damage) th_pain;
.void() th_die;
.entity oldenemy; // mad at this player before taking damage
.float speed;
.float lefty;
.float search_time;
.float attack_state;
float AS_STRAIGHT = 1;
float AS_SLIDING = 2;
float AS_MELEE = 3;
float AS_MISSILE = 4;
//
// player only fields
//
.float walkframe;
.float attack_finished;
.float pain_finished;
.float invincible_finished;
.float invisible_finished;
.float super_damage_finished;
.float radsuit_finished;
.float invincible_time, invincible_sound;
.float invisible_time, invisible_sound;
.float super_time, super_sound;
.float rad_time;
.float fly_sound;
.float axhitme;
.float show_hostile; // set to time+0.2 whenever a client fires a
// weapon or takes damage. Used to alert
// monsters that otherwise would let the player go
.float jump_flag; // player jump flag
.float swim_flag; // player swimming sound flag
.float air_finished; // when time > air_finished, start drowning
.float bubble_count; // keeps track of the number of bubbles
.string deathtype; // keeps track of how the player died
//
// object stuff
//
.string mdl;
.vector mangle; // angle at start
.vector oldorigin; // only used by secret door
.float t_length, t_width;
//
// doors, etc
//
.vector /*dest,*/ dest1, dest2;
.float wait; // time from firing to restarting
.float delay; // time from activation to firing
.entity trigger_field; // door's trigger entity
.string noise4;
//
// monsters
//
.float pausetime;
.entity movetarget;
//
// doors
//
.float aflag;
.float dmg; // damage done by door when hit
//
// misc
//
.float cnt; // misc flag
//
// subs
//
.void() think1;
.vector finaldest, finalangle;
//
// triggers
//
.float count; // for counting triggers
//
// plats / doors / buttons
//
.float lip;
.float state;
.vector pos1, pos2; // top and bottom positions
.float height;
//
// sounds
//
.float waitmin /*, waitmax*/;
// .float distance;
.float volume;
// variables for enhanced triggering from Custents - dumptruck_ds
.string target2; // second target's name
.string target3; // third target's name
.string target4; // fourth target's name
.string targetname2; // second name
.string targetname3; // third name
.string targetname4; // fourth name
.string killtarget2; // second target to kill
string lastnameused; // the targetname that was last used to trigger somthing
//===========================================================================
//
// builtin functions
//
void(vector ang) makevectors = #1; // sets v_forward, etc globals
void(entity e, vector o) setorigin = #2;
void(entity e, string m) setmodel = #3; // set movetype and solid first
void(entity e, vector min, vector max) setsize = #4;
// #5 was removed
void() break = #6;
float() random = #7; // returns 0 - 1
void(entity e, float chan, string samp, float vol, float atten) sound = #8;
vector(vector v) normalize = #9;
void(string e) error = #10;
void(string e) objerror = #11;
float(vector v) vlen = #12;
float(vector v) vectoyaw = #13;
entity() spawn = #14;
void(entity e) remove = #15;
// sets trace_* globals
// nomonsters can be:
// An entity will also be ignored for testing if forent == test,
// forent->owner == test, or test->owner == forent
// a forent of world is ignored
void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
entity() checkclient = #17; // returns a client to look for
entity(entity start, .string fld, string match) find = #18;
string(string s) precache_sound = #19;
string(string s) precache_model = #20;
void(entity client, string s)stuffcmd = #21;
entity(vector org, float rad) findradius = #22;
void(string s) bprint = #23;
void(entity client, string s) sprint = #24;
void(string s) dprint = #25;
string(float f) ftos = #26;
string(vector v) vtos = #27;
void() coredump = #28; // prints all edicts
void() traceon = #29; // turns statment trace on
void() traceoff = #30;
void(entity e) eprint = #31; // prints an entire edict
float(float yaw, float dist) walkmove = #32; // returns TRUE or FALSE
// #33 was removed
float() droptofloor= #34; // TRUE if landed on floor
void(float style, string value) lightstyle = #35;
float(float v) rint = #36; // round to nearest int
float(float v) floor = #37; // largest integer <= v
float(float v) ceil = #38; // smallest integer >= v
// #39 was removed
float(entity e) checkbottom = #40; // true if self is on ground
float(vector v) pointcontents = #41; // returns a CONTENT_*
// #42 was removed
float(float f) fabs = #43;
vector(entity e, float speed) aim = #44; // returns the shooting vector
float(string s) cvar = #45; // return cvar.value
void(string s) localcmd = #46; // put string into local que
entity(entity e) nextent = #47; // for looping through all ents
void(vector o, vector d, float color, float count) particle = #48;// start a particle effect
void() ChangeYaw = #49; // turn towards self.ideal_yaw
// at self.yaw_speed
// #50 was removed
vector(vector v) vectoangles = #51;
//
// direct client message generation
//
void(float to, float f) WriteByte = #52;
void(float to, float f) WriteChar = #53;
void(float to, float f) WriteShort = #54;
void(float to, float f) WriteLong = #55;
void(float to, float f) WriteCoord = #56;
void(float to, float f) WriteAngle = #57;
void(float to, string s) WriteString = #58;
void(float to, entity s) WriteEntity = #59;
//
// broadcast client message generation
//
// void(float f) bWriteByte = #59;
// void(float f) bWriteChar = #60;
// void(float f) bWriteShort = #61;
// void(float f) bWriteLong = #62;
// void(float f) bWriteCoord = #63;
// void(float f) bWriteAngle = #64;
// void(string s) bWriteString = #65;
// void(entity e) bWriteEntity = #66;
void(float step) movetogoal = #67;
string(string s) precache_file = #68; // no effect except for -copy
void(entity e) makestatic = #69;
void(string s) changelevel = #70;
//#71 was removed
void(string var, string val) cvar_set = #72; // sets cvar.value
void(entity client, string s) centerprint = #73; // sprint, but in middle
void(vector pos, string samp, float vol, float atten) ambientsound = #74;
string(string s) precache_model2 = #75; // registered version only
string(string s) precache_sound2 = #76; // registered version only
string(string s) precache_file2 = #77; // registered version only
void(entity e) setspawnparms = #78; // set parm1... to the
// values at level start
// for coop respawn
//============================================================================
//
// subs.qc
//
void(vector tdest, float tspeed, void() func) SUB_CalcMove;
void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt;
void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove;
void() SUB_CalcMoveDone;
void() SUB_CalcAngleMoveDone;
void() SUB_Null;
void() SUB_UseTargets;
void() SUB_Remove;
//
// combat.qc
//
void(entity targ, entity inflictor, entity attacker, float damage) T_Damage;
float (entity e, float healamount, float ignore) T_Heal; // health function
float(entity targ, entity inflictor) CanDamage;
void() DummyFunction = //gets rid of the last compiler warnings ; - )
{
local string w;
local float l;
w = self.wad;
l = self.light_lev;
}
.float is_waiting; // Supa, triggers, wait until activated before we can trigger?
.float gravity; //from custdefs.qc by way of Hipnotic
// These are required by the Hipnotic code
//added update stat message
float SVC_UPDATESTAT = 3;
//added total monster message
float STAT_TOTALMONSTERS = 12;
//dumptruck_ds from Rogue eod defs
//
// elevator fields
//
.float elevatorLastUse;
.float elevatorOnFloor;
.float elevatorToFloor;
.vector elevatorDestination;
//
// plat2 fields
//
.float plat2Called;
.float plat2LastMove;
.float plat2GoTime;
.float plat2GoTo;
.float reset_items; //dumptruck_ds
.float spawn_angry; //dumptruck_ds
.string mdl_debris; //dumptruck_ds
.float keep_ammo; //dumptruck_ds
/*============================================================================
johnfitz new defs from Rubicon2
============================================================================*/
float BREAKABLE_NO_MONSTERS = 1;
.float wantedgravity; // thanks Spike!
.float onladder;
//.float ladder_step_finished; //footsteps on ladder no uses -- dumptruck_ds
//dumptruck_ds defs for breakables in rubcon2.qc -- thanks to Qmaster and the Arcane Dimensions team
.string break_template1_e;
.string break_template2_e;
.string break_template3_e;
.string break_template4_e;
.string break_template5_e;
.string find_brk_template_model;
//from remakequake -- dumptruck_ds
.vector dest, dest1, dest2;
void(string type, string text) print_self =
{
dprint (type);
dprint (" '");
dprint (self.classname);
dprint ("' ");
dprint (text);
dprint (" at ");
dprint (vtos(self.origin));
dprint ("\n");
};
void() monster_pain_use; //dumptruck_ds
void() SUB_UsePain; //dumptruck_ds
.float pain_threshold; //dumptruck_ds
.string pain_target; //dumptruck_ds
.float color; //Hipnotic
.float megahealth_rottime; // dumptruck_ds
.float alpha; // from RennyC func_fall in dtmisc.qc
.float ltrailLastUsed; //from DOE lighnin
.float style2; //c0burn's switchable lights
.float sight_trigger; //dumptruck_ds
.float keep_ammo; //dumptruck_ds

View File

@@ -0,0 +1,389 @@
/*
==============================================================================
DEMON
==============================================================================
*/
$cd id1/models/demon3
$scale 0.8
$origin 0 0 24
$base base
$skin base
$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
$frame stand10 stand11 stand12 stand13
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8
$frame run1 run2 run3 run4 run5 run6
$frame leap1 leap2 leap3 leap4 leap5 leap6 leap7 leap8 leap9 leap10
$frame leap11 leap12
$frame pain1 pain2 pain3 pain4 pain5 pain6
$frame death1 death2 death3 death4 death5 death6 death7 death8 death9
$frame attacka1 attacka2 attacka3 attacka4 attacka5 attacka6 attacka7 attacka8
$frame attacka9 attacka10 attacka11 attacka12 attacka13 attacka14 attacka15
//============================================================================
void() Demon_JumpTouch;
void() demon1_stand1 =[ $stand1, demon1_stand2 ] {ai_stand();};
void() demon1_stand2 =[ $stand2, demon1_stand3 ] {ai_stand();};
void() demon1_stand3 =[ $stand3, demon1_stand4 ] {ai_stand();};
void() demon1_stand4 =[ $stand4, demon1_stand5 ] {ai_stand();};
void() demon1_stand5 =[ $stand5, demon1_stand6 ] {ai_stand();};
void() demon1_stand6 =[ $stand6, demon1_stand7 ] {ai_stand();};
void() demon1_stand7 =[ $stand7, demon1_stand8 ] {ai_stand();};
void() demon1_stand8 =[ $stand8, demon1_stand9 ] {ai_stand();};
void() demon1_stand9 =[ $stand9, demon1_stand10 ] {ai_stand();};
void() demon1_stand10 =[ $stand10, demon1_stand11 ] {ai_stand();};
void() demon1_stand11 =[ $stand11, demon1_stand12 ] {ai_stand();};
void() demon1_stand12 =[ $stand12, demon1_stand13 ] {ai_stand();};
void() demon1_stand13 =[ $stand13, demon1_stand1 ] {ai_stand();};
void() demon1_walk1 =[ $walk1, demon1_walk2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "demon/idle1.wav", 1, ATTN_IDLE);
ai_walk(8);
};
void() demon1_walk2 =[ $walk2, demon1_walk3 ] {ai_walk(6);};
void() demon1_walk3 =[ $walk3, demon1_walk4 ] {ai_walk(6);};
void() demon1_walk4 =[ $walk4, demon1_walk5 ] {ai_walk(7);};
void() demon1_walk5 =[ $walk5, demon1_walk6 ] {ai_walk(4);};
void() demon1_walk6 =[ $walk6, demon1_walk7 ] {ai_walk(6);};
void() demon1_walk7 =[ $walk7, demon1_walk8 ] {ai_walk(10);};
void() demon1_walk8 =[ $walk8, demon1_walk1 ] {ai_walk(10);};
void() demon1_run1 =[ $run1, demon1_run2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "demon/idle1.wav", 1, ATTN_IDLE);
ai_run(20);};
void() demon1_run2 =[ $run2, demon1_run3 ] {ai_run(15);};
void() demon1_run3 =[ $run3, demon1_run4 ] {ai_run(36);};
void() demon1_run4 =[ $run4, demon1_run5 ] {ai_run(20);};
void() demon1_run5 =[ $run5, demon1_run6 ] {ai_run(15);};
void() demon1_run6 =[ $run6, demon1_run1 ] {ai_run(36);};
void() demon1_jump1 =[ $leap1, demon1_jump2 ] {ai_face();};
void() demon1_jump2 =[ $leap2, demon1_jump3 ] {ai_face();};
void() demon1_jump3 =[ $leap3, demon1_jump4 ] {ai_face();};
void() demon1_jump4 =[ $leap4, demon1_jump5 ]
{
ai_face();
self.touch = Demon_JumpTouch;
makevectors (self.angles);
self.origin_z = self.origin_z + 1;
self.velocity = v_forward * 600 + '0 0 250';
if (self.flags & FL_ONGROUND)
self.flags = self.flags - FL_ONGROUND;
};
void() demon1_jump5 =[ $leap5, demon1_jump6 ] {};
void() demon1_jump6 =[ $leap6, demon1_jump7 ] {};
void() demon1_jump7 =[ $leap7, demon1_jump8 ] {};
void() demon1_jump8 =[ $leap8, demon1_jump9 ] {};
void() demon1_jump9 =[ $leap9, demon1_jump10 ] {};
void() demon1_jump10 =[ $leap10, demon1_jump1 ] {
self.nextthink = time + 3;
// if three seconds pass, assume demon is stuck and jump again
};
void() demon1_jump11 =[ $leap11, demon1_jump12 ] {};
void() demon1_jump12 =[ $leap12, demon1_run1 ] {};
void() demon1_atta1 =[ $attacka1, demon1_atta2 ] {ai_charge(4);};
void() demon1_atta2 =[ $attacka2, demon1_atta3 ] {ai_charge(0);};
void() demon1_atta3 =[ $attacka3, demon1_atta4 ] {ai_charge(0);};
void() demon1_atta4 =[ $attacka4, demon1_atta5 ] {ai_charge(1);};
void() demon1_atta5 =[ $attacka5, demon1_atta6 ] {ai_charge(2); Demon_Melee(200);};
void() demon1_atta6 =[ $attacka6, demon1_atta7 ] {ai_charge(1);};
void() demon1_atta7 =[ $attacka7, demon1_atta8 ] {ai_charge(6);};
void() demon1_atta8 =[ $attacka8, demon1_atta9 ] {ai_charge(8);};
void() demon1_atta9 =[ $attacka9, demon1_atta10] {ai_charge(4);};
void() demon1_atta10 =[ $attacka10, demon1_atta11] {ai_charge(2);};
void() demon1_atta11 =[ $attacka11, demon1_atta12] {Demon_Melee(-200);};
void() demon1_atta12 =[ $attacka12, demon1_atta13] {ai_charge(5);};
void() demon1_atta13 =[ $attacka13, demon1_atta14] {ai_charge(8);};
void() demon1_atta14 =[ $attacka14, demon1_atta15] {ai_charge(4);};
void() demon1_atta15 =[ $attacka15, demon1_run1] {ai_charge(4);};
void() demon1_pain1 =[ $pain1, demon1_pain2 ] {};
void() demon1_pain2 =[ $pain2, demon1_pain3 ] {};
void() demon1_pain3 =[ $pain3, demon1_pain4 ] {};
void() demon1_pain4 =[ $pain4, demon1_pain5 ] {};
void() demon1_pain5 =[ $pain5, demon1_pain6 ] {};
void() demon1_pain6 =[ $pain6, demon1_run1 ] {};
void(entity attacker, float damage) demon1_pain =
{
if (self.touch == Demon_JumpTouch)
return;
if (self.pain_finished > time)
return;
self.pain_finished = time + 1;
sound (self, CHAN_VOICE, "demon/dpain1.wav", 1, ATTN_NORM);
if (random()*200 > damage)
return; // didn't flinch
demon1_pain1 ();
};
void() demon1_die1 =[ $death1, demon1_die2 ] {
sound (self, CHAN_VOICE, "demon/ddeath.wav", 1, ATTN_NORM);};
void() demon1_die2 =[ $death2, demon1_die3 ] {};
void() demon1_die3 =[ $death3, demon1_die4 ] {};
void() demon1_die4 =[ $death4, demon1_die5 ] {};
void() demon1_die5 =[ $death5, demon1_die6 ] {};
void() demon1_die6 =[ $death6, demon1_die7 ]
{self.solid = SOLID_NOT;};
void() demon1_die7 =[ $death7, demon1_die8 ] {};
void() demon1_die8 =[ $death8, demon1_die9 ] {};
void() demon1_die9 =[ $death9, demon1_die9 ] {};
void() demon_die =
{
// check for gib
if (self.health < -80)
{
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_demon.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
return;
}
// regular death
demon1_die1 ();
};
void() Demon_MeleeAttack =
{
demon1_atta1 ();
};
/*QUAKED monster_demon1 (1 0 0) (-32 -32 -24) (32 32 64) Ambush
*/
void() monster_demon1 =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (deathmatch)
{
remove(self);
return;
}
precache_model ("progs/demon.mdl");
precache_model ("progs/h_demon.mdl");
precache_sound ("demon/ddeath.wav");
precache_sound ("demon/dhit2.wav");
precache_sound ("demon/djump.wav");
precache_sound ("demon/dpain1.wav");
precache_sound ("demon/idle1.wav");
precache_sound ("demon/sight2.wav");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/demon.mdl");
setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
if (!self.health) //thanks RennyC -- dumptruck_ds
self.health = 300;
self.th_stand = demon1_stand1;
self.th_walk = demon1_walk1;
self.th_run = demon1_run1;
self.th_die = demon_die;
self.th_melee = Demon_MeleeAttack; // one of two attacks
self.th_missile = demon1_jump1; // jump attack
self.th_pain = demon1_pain;
walkmonster_start();
};
/*
==============================================================================
DEMON
==============================================================================
*/
/*
==============
CheckDemonMelee
Returns TRUE if a melee attack would hit right now
==============
*/
float() CheckDemonMelee =
{
if (enemy_range == RANGE_MELEE)
{ // FIXME: check canreach
self.attack_state = AS_MELEE;
return TRUE;
}
return FALSE;
};
/*
==============
CheckDemonJump
==============
*/
float() CheckDemonJump =
{
local vector dist;
local float d;
if (self.origin_z + self.mins_z > self.enemy.origin_z + self.enemy.mins_z
+ 0.75 * self.enemy.size_z)
return FALSE;
if (self.origin_z + self.maxs_z < self.enemy.origin_z + self.enemy.mins_z
+ 0.25 * self.enemy.size_z)
return FALSE;
dist = self.enemy.origin - self.origin;
dist_z = 0;
d = vlen(dist);
if (d < 100)
return FALSE;
if (d > 200)
{
if (random() < 0.9)
return FALSE;
}
return TRUE;
};
float() DemonCheckAttack =
{
// if close enough for slashing, go for it
if (CheckDemonMelee ())
{
self.attack_state = AS_MELEE;
return TRUE;
}
if (CheckDemonJump ())
{
self.attack_state = AS_MISSILE;
sound (self, CHAN_VOICE, "demon/djump.wav", 1, ATTN_NORM);
return TRUE;
}
return FALSE;
};
//===========================================================================
void(float side) Demon_Melee =
{
local float ldmg;
local vector delta;
ai_face ();
walkmove (self.ideal_yaw, 12); // allow a little closing
delta = self.enemy.origin - self.origin;
if (vlen(delta) > 100)
return;
if (!CanDamage (self.enemy, self))
return;
sound (self, CHAN_WEAPON, "demon/dhit2.wav", 1, ATTN_NORM);
ldmg = 10 + 5*random();
T_Damage (self.enemy, self, self, ldmg);
makevectors (self.angles);
SpawnMeatSpray (self.origin + v_forward*16, side * v_right);
};
void() Demon_JumpTouch =
{
local float ldmg;
if (self.health <= 0)
return;
if (other.takedamage)
{
if ( vlen(self.velocity) > 400 )
{
ldmg = 40 + 10*random();
T_Damage (other, self, self, ldmg);
}
}
if (!checkbottom(self))
{
if (self.flags & FL_ONGROUND)
{ // jump randomly to not get hung up
//dprint ("popjump\n");
self.touch = SUB_Null;
self.think = demon1_jump1;
self.nextthink = time + 0.1;
// self.velocity_x = (random() - 0.5) * 600;
// self.velocity_y = (random() - 0.5) * 600;
// self.velocity_z = 200;
// self.flags = self.flags - FL_ONGROUND;
}
return; // not on ground yet
}
self.touch = SUB_Null;
self.think = demon1_jump11;
self.nextthink = time + 0.1;
};
/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */
/*QUAKED monster_dead_demon (0 0.5 0.8) (-32 -32 -24) (32 32 64)
*/
void() monster_dead_demon =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_model("progs/demon.mdl");
setmodel(self, "progs/demon.mdl");
self.frame = $death9;
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
setsize(self,'-43.63 -47.26 -50.53','32.48 24.65 30');
}
else
{
self.solid = SOLID_NOT;
}
};

View File

@@ -0,0 +1,193 @@
// 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
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)
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)
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;
};

View File

@@ -0,0 +1,628 @@
// newplats.qc
// pmack
// september 1996
// TYPES
float DN_N_WAIT = 1;
float PLT_TOGGLE = 2;
float ELEVATOR = 4;
float START_AT_TOP = 8;
float PLAT2 = 16;
float PLAT2_BOTTOM = 32;
float elv_butn_dir;
// ==================================
// down N and wait code
// ==================================
void() dn_and_wait_go_up;
void() dn_and_wait_go_down;
void() dn_and_wait_crush;
void() dn_and_wait_hit_top =
{
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_TOP;
};
void() dn_and_wait_hit_bottom =
{
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_BOTTOM;
self.think = dn_and_wait_go_up;
self.nextthink = self.ltime + self.health;
};
void() dn_and_wait_go_down =
{
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
self.state = STATE_DOWN;
SUB_CalcMove (self.pos2, self.speed, dn_and_wait_hit_bottom);
};
void() dn_and_wait_go_up =
{
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
self.state = STATE_UP;
SUB_CalcMove (self.pos1, self.speed, dn_and_wait_hit_top);
};
void() dn_and_wait_crush =
{
T_Damage (other, self, self, 1);
if (self.state == STATE_UP)
dn_and_wait_go_down ();
else if (self.state == STATE_DOWN)
dn_and_wait_go_up ();
else
objerror ("plat_new_crush: bad self.state\n");
};
void() dn_and_wait_use =
{
if (self.state != STATE_TOP)
return;
dn_and_wait_go_down ();
};
// ==================================
// toggle type code
// ==================================
void() toggle_go_up;
void() toggle_go_down;
void() toggle_crush;
void() toggle_hit_top =
{
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_TOP;
};
void() toggle_hit_bottom =
{
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_BOTTOM;
};
void() toggle_go_down =
{
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
self.state = STATE_DOWN;
SUB_CalcMove (self.pos2, self.speed, toggle_hit_bottom);
};
void() toggle_go_up =
{
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
self.state = STATE_UP;
SUB_CalcMove (self.pos1, self.speed, toggle_hit_top);
};
void() toggle_crush =
{
T_Damage (other, self, self, 1);
if (self.state == STATE_UP)
toggle_go_down ();
else if (self.state == STATE_DOWN)
toggle_go_up ();
else
objerror ("plat_new_crush: bad self.state\n");
};
void() toggle_use =
{
if (self.state == STATE_TOP)
toggle_go_down ();
else if(self.state == STATE_BOTTOM)
toggle_go_up ();
};
// ==================================
// elvtr type code
// ==================================
void() elvtr_crush;
void() elvtr_stop =
{
self.elevatorOnFloor = self.elevatorToFloor;
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_BOTTOM;
self.elevatorLastUse = time;
};
void() elvtr_go =
{
self.elevatorDestination = self.pos2;
self.elevatorDestination_z = self.pos2_z +
(self.height * self.elevatorToFloor);
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
self.state = STATE_UP;
SUB_CalcMove (self.elevatorDestination, self.speed, elvtr_stop);
self.elevatorLastUse = time;
};
void() elvtr_crush =
{
local float tmp;
// T_Damage (other, self, self, 1);
// the elevator is changing direction, so swap the floor it's coming
// from and the floor it's going to -- iw
tmp = self.elevatorOnFloor;
self.elevatorOnFloor = self.elevatorToFloor;
self.elevatorToFloor = tmp;
elvtr_go ();
};
// ===============
// elevator use function
// self = plat, other = elevator button, other.enemy = player
// ===============
void() elvtr_use =
{
local float tempDist, elvPos, btnPos;
// the original DoE code allowed an elevator to be activated again
// when it was in the process of moving between floors (assuming the
// wait period was over); this resulted in sometimes unintuitive
// behavior, so, the following test prevents this -- iw
if (self.elevatorToFloor != self.elevatorOnFloor)
return;
// the original DoE code had a hard-coded two second wait period;
// this has been changed for progs_dump so that self.wait is used
// instead -- iw
if ((self.elevatorLastUse + self.wait) > time)
return;
self.elevatorLastUse = time;
if (elv_butn_dir == 0)
return;
elvPos = (self.absmin_z + self.absmax_z) * 0.5;
btnPos = (other.absmin_z + other.absmax_z) * 0.5;
if (elvPos > btnPos)
{
tempDist = (elvPos - btnPos) / self.height;
tempDist = ceil ( tempDist);
self.elevatorToFloor = self.elevatorOnFloor - tempDist;
elvtr_go ();
return;
}
else
{
tempDist = btnPos - elvPos;
if (tempDist > self.height)
{
tempDist = tempDist / self.height;
tempDist = floor ( tempDist );
self.elevatorToFloor = self.elevatorOnFloor + tempDist;
elvtr_go ();
return;
}
}
if (elv_butn_dir == -1)
{
if(self.elevatorOnFloor > 0)
{
self.elevatorToFloor = self.elevatorOnFloor - 1;
elvtr_go ();
}
}
else if(elv_butn_dir == 1)
{
if(self.elevatorOnFloor < (self.cnt - 1))
{
self.elevatorToFloor = self.elevatorOnFloor + 1;
elvtr_go ();
}
}
};
// ==================================
// PLAT2 type code
// ==================================
void() plat2_center_touch;
void() plat2_go_up;
void() plat2_go_down;
void() plat2_crush;
void() plat2_spawn_inside_trigger =
{
local entity trigger;
local vector tmin, tmax;
//
// middle trigger
//
trigger = spawn();
trigger.touch = plat2_center_touch;
trigger.movetype = MOVETYPE_NONE;
trigger.solid = SOLID_TRIGGER;
trigger.enemy = self;
tmin = self.mins + '25 25 0';
tmax = self.maxs - '25 25 -8';
tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8);
if (self.spawnflags & PLAT_LOW_TRIGGER)
tmax_z = tmin_z + 8;
if (self.size_x <= 50)
{
tmin_x = (self.mins_x + self.maxs_x) / 2;
tmax_x = tmin_x + 1;
}
if (self.size_y <= 50)
{
tmin_y = (self.mins_y + self.maxs_y) / 2;
tmax_y = tmin_y + 1;
}
setsize (trigger, tmin, tmax);
};
void() plat2_hit_top =
{
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_TOP;
self.plat2LastMove = time;
if(self.plat2Called == 1)
{
self.think = plat2_go_down;
self.nextthink = self.ltime + 1.5;
self.plat2Called = 0;
self.plat2LastMove = 0; // allow immediate move
}
else if(!(self.spawnflags & START_AT_TOP))
{
self.think = plat2_go_down;
self.nextthink = self.ltime + self.delay;
self.plat2Called = 0;
}
};
void() plat2_hit_bottom =
{
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_BOTTOM;
self.plat2LastMove = time;
if(self.plat2Called == 1)
{
self.think = plat2_go_up;
self.nextthink = self.ltime + 1.5;
self.plat2Called = 0;
self.plat2LastMove = 0; // allow immediate move
}
else if(self.spawnflags & START_AT_TOP)
{
self.think = plat2_go_up;
self.nextthink = self.ltime + self.delay;
self.plat2Called = 0;
}
};
void() plat2_go_down =
{
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
self.state = STATE_DOWN;
SUB_CalcMove (self.pos2, self.speed, plat2_hit_bottom);
};
void() plat2_go_up =
{
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
self.state = STATE_UP;
SUB_CalcMove (self.pos1, self.speed, plat2_hit_top);
};
void() plat2_use =
{
if(self.state > 4)
self.state = self.state - 10;
self.use = SUB_Null;
};
void() plat2_center_touch =
{
local float otherState;
local vector platPosition;
if (other.classname != "player")
return;
if (other.health <= 0)
return;
// at this point, self is the trigger. self.enemy is the plat.
// this changes self to be the plat, other is the player.
self = self.enemy;
if ((self.plat2LastMove + 2) > time)
return;
if (self.state > 4) // disabled.
return;
if (self.plat2GoTo > STATE_BOTTOM)
{
if (self.plat2GoTime < time)
{
if (self.plat2GoTo == STATE_UP)
plat2_go_up();
else
plat2_go_down();
self.plat2GoTo = 0;
}
return;
}
if (self.state > STATE_BOTTOM) // STATE_UP or STATE_DOWN
return;
platPosition = (self.absmax + self.absmin) * 0.5;
if (self.state == STATE_TOP)
{
otherState = STATE_TOP;
if ( platPosition_z > other.origin_z )
otherState = STATE_BOTTOM;
}
else
{
otherState = STATE_BOTTOM;
if ( (other.origin_z - platPosition_z) > self.height)
otherState = STATE_TOP;
}
if (self.state == otherState)
{
self.plat2Called = 0;
self.plat2GoTime = time + 0.5;
}
else
{
self.plat2GoTime = time + 0.1;
self.plat2Called = 1;
}
if (self.state == STATE_BOTTOM)
self.plat2GoTo = STATE_UP;
else if(self.state == STATE_TOP)
self.plat2GoTo = STATE_DOWN;
};
void() plat2_crush =
{
T_Damage (other, self, self, 1);
if (self.state == STATE_UP)
plat2_go_down ();
else if (self.state == STATE_DOWN)
plat2_go_up ();
else
objerror ("plat2_crush: bad self.state\n");
};
// ==================================
// Common Plat Code
// ==================================
/*QUAKED func_new_plat (0 .5 .8) ? DN_N_WAIT PLT_TOGGLE ELEVATOR START_AT_TOP PLAT2 P2_BOTTOM
--------------
DN_N_WAIT is a plat that starts at the top and when triggered, goes down, waits, then comes back up.
health - number of seconds to wait (default 5)
--------------
PLT_TOGGLE is a plat that will change between the top and bottom each time it is triggered.
--------------
ELEVATOR is an elevator plat. You can have as many levels as you want but they must be all the same distance away. Use elevator button entity as the trigger.
cnt is the number of floors
height is the distance between floors
wait is the number of seconds before the elevator can be activated again after starting or stopping (default 0)
START_AT_TOP is an optional flag for elevators. It just tells the elevator that it's position is the top floor. (Default is the bottom floor) USE THIS ONLY WITH ELEVATORS!
--------------
PLAT2 is a fixed version of the original plat. If you want the plat to start at the bottom and move to the top on demand, use a negative height. That will tell Quake to lower the plat at spawn time. Always place this plat type in the top position when making the map. This will ensure correct lighting, hopefully. If a plat2 is the target of a trigger, it will be disabled until it has been triggered. Delay is the wait before the plat returns to original position.
If you don't want to bother figuring out the height, don't put a
value in the height
delay default 3
speed default 150
cnt default 2
P2_BOTTOM is an optional switch to have an auto-sized plat2 start at the bottom.
--------------
Plats are always drawn in the extended position, so they will light correctly.
If the plat is the target of another trigger or button, it will start out disabled in the extended position until it is trigger, when it will lower and become a normal plat.
If the "height" key is set, that will determine the amount the plat moves, instead of being implicitly determined by the model's height.
Set "sounds" to one of the following:
1) base fast
2) chain slow
*/
void() func_new_plat =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
//local entity t;
local float negativeHeight;
negativeHeight = 0;
if (!self.t_length)
self.t_length = 80;
if (!self.t_width)
self.t_width = 10;
if (self.sounds == 0)
self.sounds = 2;
// FIX THIS TO LOAD A GENERIC PLAT SOUND
if (self.sounds == 1)
{
precache_sound ("plats/plat1.wav");
precache_sound ("plats/plat2.wav");
self.noise = "plats/plat1.wav";
self.noise1 = "plats/plat2.wav";
}
if (self.sounds == 2)
{
precache_sound ("plats/medplat1.wav");
precache_sound ("plats/medplat2.wav");
self.noise = "plats/medplat1.wav";
self.noise1 = "plats/medplat2.wav";
}
self.mangle = self.angles;
self.angles = '0 0 0';
self.classname = "plat";
self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH;
setorigin (self, self.origin);
setmodel (self, self.model);
setsize (self, self.mins , self.maxs);
if (!self.speed)
self.speed = 150;
// pos1 is the top position, pos2 is the bottom
self.pos1 = self.origin;
self.pos2 = self.origin;
if (self.height < 0)
{
negativeHeight = 1;
self.height = 0 - self.height;
}
if (self.height)
self.pos2_z = self.origin_z - self.height;
else
{
negativeHeight = 1;
self.height = self.size_z - 8;
self.pos2_z = self.origin_z - self.height;
}
if (self.spawnflags & DN_N_WAIT)
{
self.use = dn_and_wait_use;
self.blocked = dn_and_wait_crush;
if (negativeHeight == 1)
{
self.state = STATE_BOTTOM;
setorigin (self, self.pos2);
}
else
self.state = STATE_TOP;
if (!self.health)
self.health = 5;
}
else if (self.spawnflags & PLT_TOGGLE)
{
self.use = toggle_use;
self.blocked = toggle_crush;
if (negativeHeight == 1)
{
setorigin (self, self.pos2);
self.state = STATE_BOTTOM;
}
else
{
self.state = STATE_TOP;
}
}
else if (self.spawnflags & ELEVATOR)
{
self.elevatorLastUse = 0;
// allow the mapper to set self.wait, but don't allow a negative
// wait period -- iw
if (self.wait < 0)
self.wait = 0;
if (self.spawnflags & START_AT_TOP)
{
self.pos1 = self.origin;
self.pos2 = self.origin;
self.pos2_z = self.origin_z - (self.height * (self.cnt - 1));
self.elevatorOnFloor = self.cnt - 1;
self.elevatorToFloor = self.elevatorOnFloor;
}
else
{
self.pos1 = self.origin;
self.pos2 = self.origin;
self.pos1_z = self.origin_z + (self.height * (self.cnt - 1));
self.elevatorOnFloor = 0;
self.elevatorToFloor = self.elevatorOnFloor;
}
self.use = elvtr_use;
self.blocked = elvtr_crush;
}
else if (self.spawnflags & PLAT2)
{
plat2_spawn_inside_trigger (); // the "start moving" trigger
self.plat2Called = 0;
self.plat2LastMove = 0;
self.plat2GoTo = 0;
self.plat2GoTime = 0;
self.blocked = plat2_crush;
if (!self.delay)
self.delay = 3;
if (negativeHeight == 1)
{
self.state = STATE_BOTTOM;
// make sure START_AT_TOP isn't set. We need that...
self.spawnflags = PLAT2;
setorigin (self, self.pos2);
}
else
{
// default position is top.
self.spawnflags = self.spawnflags | START_AT_TOP;
self.state = STATE_TOP;
}
if (self.targetname != "")
{
self.use = plat2_use;
self.state = self.state + 10;
}
}
};

390
mod_mine/quakec_src/dog.qc Normal file
View File

@@ -0,0 +1,390 @@
/*
==============================================================================
DOG
==============================================================================
*/
$cd id1/models/dog
$origin 0 0 24
$base base
$skin skin
$frame attack1 attack2 attack3 attack4 attack5 attack6 attack7 attack8
$frame death1 death2 death3 death4 death5 death6 death7 death8 death9
$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
$frame deathb9
$frame pain1 pain2 pain3 pain4 pain5 pain6
$frame painb1 painb2 painb3 painb4 painb5 painb6 painb7 painb8 painb9 painb10
$frame painb11 painb12 painb13 painb14 painb15 painb16
$frame run1 run2 run3 run4 run5 run6 run7 run8 run9 run10 run11 run12
$frame leap1 leap2 leap3 leap4 leap5 leap6 leap7 leap8 leap9
$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8
void() dog_leap1;
void() dog_run1;
/*
================
dog_bite
================
*/
void() dog_bite =
{
local vector delta;
local float ldmg;
if (!self.enemy)
return;
ai_charge(10);
if (!CanDamage (self.enemy, self))
return;
delta = self.enemy.origin - self.origin;
if (vlen(delta) > 100)
return;
ldmg = (random() + random() + random()) * 8;
T_Damage (self.enemy, self, self, ldmg);
};
void() Dog_JumpTouch =
{
local float ldmg;
if (self.health <= 0)
return;
if (other.takedamage)
{
if ( vlen(self.velocity) > 300 )
{
ldmg = 10 + 10*random();
T_Damage (other, self, self, ldmg);
}
}
if (!checkbottom(self))
{
if (self.flags & FL_ONGROUND)
{ // jump randomly to not get hung up
//dprint ("popjump\n");
self.touch = SUB_Null;
self.think = dog_leap1;
self.nextthink = time + 0.1;
// self.velocity_x = (random() - 0.5) * 600;
// self.velocity_y = (random() - 0.5) * 600;
// self.velocity_z = 200;
// self.flags = self.flags - FL_ONGROUND;
}
return; // not on ground yet
}
self.touch = SUB_Null;
self.think = dog_run1;
self.nextthink = time + 0.1;
};
void() dog_stand1 =[ $stand1, dog_stand2 ] {ai_stand();};
void() dog_stand2 =[ $stand2, dog_stand3 ] {ai_stand();};
void() dog_stand3 =[ $stand3, dog_stand4 ] {ai_stand();};
void() dog_stand4 =[ $stand4, dog_stand5 ] {ai_stand();};
void() dog_stand5 =[ $stand5, dog_stand6 ] {ai_stand();};
void() dog_stand6 =[ $stand6, dog_stand7 ] {ai_stand();};
void() dog_stand7 =[ $stand7, dog_stand8 ] {ai_stand();};
void() dog_stand8 =[ $stand8, dog_stand9 ] {ai_stand();};
void() dog_stand9 =[ $stand9, dog_stand1 ] {ai_stand();};
void() dog_walk1 =[ $walk1 , dog_walk2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "dog/idle.wav", 1, ATTN_IDLE);
ai_walk(8);};
void() dog_walk2 =[ $walk2 , dog_walk3 ] {ai_walk(8);};
void() dog_walk3 =[ $walk3 , dog_walk4 ] {ai_walk(8);};
void() dog_walk4 =[ $walk4 , dog_walk5 ] {ai_walk(8);};
void() dog_walk5 =[ $walk5 , dog_walk6 ] {ai_walk(8);};
void() dog_walk6 =[ $walk6 , dog_walk7 ] {ai_walk(8);};
void() dog_walk7 =[ $walk7 , dog_walk8 ] {ai_walk(8);};
void() dog_walk8 =[ $walk8 , dog_walk1 ] {ai_walk(8);};
void() dog_run1 =[ $run1 , dog_run2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "dog/idle.wav", 1, ATTN_IDLE);
ai_run(16);};
void() dog_run2 =[ $run2 , dog_run3 ] {ai_run(32);};
void() dog_run3 =[ $run3 , dog_run4 ] {ai_run(32);};
void() dog_run4 =[ $run4 , dog_run5 ] {ai_run(20);};
void() dog_run5 =[ $run5 , dog_run6 ] {ai_run(64);};
void() dog_run6 =[ $run6 , dog_run7 ] {ai_run(32);};
void() dog_run7 =[ $run7 , dog_run8 ] {ai_run(16);};
void() dog_run8 =[ $run8 , dog_run9 ] {ai_run(32);};
void() dog_run9 =[ $run9 , dog_run10 ] {ai_run(32);};
void() dog_run10 =[ $run10 , dog_run11 ] {ai_run(20);};
void() dog_run11 =[ $run11 , dog_run12 ] {ai_run(64);};
void() dog_run12 =[ $run12 , dog_run1 ] {ai_run(32);};
void() dog_atta1 =[ $attack1, dog_atta2 ] {ai_charge(10);};
void() dog_atta2 =[ $attack2, dog_atta3 ] {ai_charge(10);};
void() dog_atta3 =[ $attack3, dog_atta4 ] {ai_charge(10);};
void() dog_atta4 =[ $attack4, dog_atta5 ] {
sound (self, CHAN_VOICE, "dog/dattack1.wav", 1, ATTN_NORM);
dog_bite();};
void() dog_atta5 =[ $attack5, dog_atta6 ] {ai_charge(10);};
void() dog_atta6 =[ $attack6, dog_atta7 ] {ai_charge(10);};
void() dog_atta7 =[ $attack7, dog_atta8 ] {ai_charge(10);};
void() dog_atta8 =[ $attack8, dog_run1 ] {ai_charge(10);};
void() dog_leap1 =[ $leap1, dog_leap2 ] {ai_face();};
void() dog_leap2 =[ $leap2, dog_leap3 ]
{
ai_face();
self.touch = Dog_JumpTouch;
makevectors (self.angles);
self.origin_z = self.origin_z + 1;
self.velocity = v_forward * 300 + '0 0 200';
if (self.flags & FL_ONGROUND)
self.flags = self.flags - FL_ONGROUND;
};
void() dog_leap3 =[ $leap3, dog_leap4 ] {};
void() dog_leap4 =[ $leap4, dog_leap5 ] {};
void() dog_leap5 =[ $leap5, dog_leap6 ] {};
void() dog_leap6 =[ $leap6, dog_leap7 ] {};
void() dog_leap7 =[ $leap7, dog_leap8 ] {};
void() dog_leap8 =[ $leap8, dog_leap9 ] {};
void() dog_leap9 =[ $leap9, dog_leap9 ] {};
void() dog_pain1 =[ $pain1 , dog_pain2 ] {};
void() dog_pain2 =[ $pain2 , dog_pain3 ] {};
void() dog_pain3 =[ $pain3 , dog_pain4 ] {};
void() dog_pain4 =[ $pain4 , dog_pain5 ] {};
void() dog_pain5 =[ $pain5 , dog_pain6 ] {};
void() dog_pain6 =[ $pain6 , dog_run1 ] {};
void() dog_painb1 =[ $painb1 , dog_painb2 ] {};
void() dog_painb2 =[ $painb2 , dog_painb3 ] {};
void() dog_painb3 =[ $painb3 , dog_painb4 ] {ai_pain(4);};
void() dog_painb4 =[ $painb4 , dog_painb5 ] {ai_pain(12);};
void() dog_painb5 =[ $painb5 , dog_painb6 ] {ai_pain(12);};
void() dog_painb6 =[ $painb6 , dog_painb7 ] {ai_pain(2);};
void() dog_painb7 =[ $painb7 , dog_painb8 ] {};
void() dog_painb8 =[ $painb8 , dog_painb9 ] {ai_pain(4);};
void() dog_painb9 =[ $painb9 , dog_painb10 ] {};
void() dog_painb10 =[ $painb10 , dog_painb11 ] {ai_pain(10);};
void() dog_painb11 =[ $painb11 , dog_painb12 ] {};
void() dog_painb12 =[ $painb12 , dog_painb13 ] {};
void() dog_painb13 =[ $painb13 , dog_painb14 ] {};
void() dog_painb14 =[ $painb14 , dog_painb15 ] {};
void() dog_painb15 =[ $painb15 , dog_painb16 ] {};
void() dog_painb16 =[ $painb16 , dog_run1 ] {};
void(entity attacker, float damage) dog_pain =
{
sound (self, CHAN_VOICE, "dog/dpain1.wav", 1, ATTN_NORM);
if (random() > 0.5)
dog_pain1 ();
else
dog_painb1 ();
};
void() dog_die1 =[ $death1, dog_die2 ] {};
void() dog_die2 =[ $death2, dog_die3 ] {};
void() dog_die3 =[ $death3, dog_die4 ] {};
void() dog_die4 =[ $death4, dog_die5 ] {};
void() dog_die5 =[ $death5, dog_die6 ] {};
void() dog_die6 =[ $death6, dog_die7 ] {};
void() dog_die7 =[ $death7, dog_die8 ] {};
void() dog_die8 =[ $death8, dog_die9 ] {};
void() dog_die9 =[ $death9, dog_die9 ] {};
void() dog_dieb1 =[ $deathb1, dog_dieb2 ] {};
void() dog_dieb2 =[ $deathb2, dog_dieb3 ] {};
void() dog_dieb3 =[ $deathb3, dog_dieb4 ] {};
void() dog_dieb4 =[ $deathb4, dog_dieb5 ] {};
void() dog_dieb5 =[ $deathb5, dog_dieb6 ] {};
void() dog_dieb6 =[ $deathb6, dog_dieb7 ] {};
void() dog_dieb7 =[ $deathb7, dog_dieb8 ] {};
void() dog_dieb8 =[ $deathb8, dog_dieb9 ] {};
void() dog_dieb9 =[ $deathb9, dog_dieb9 ] {};
void() dog_die =
{
// check for gib
if (self.health < -35)
{
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowGib ("progs/gib3.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
ThrowHead ("progs/h_dog.mdl", self.health);
return;
}
// regular death
sound (self, CHAN_VOICE, "dog/ddeath.wav", 1, ATTN_NORM);
self.solid = SOLID_NOT;
if (random() > 0.5)
dog_die1 ();
else
dog_dieb1 ();
};
//============================================================================
/*
==============
CheckDogMelee
Returns TRUE if a melee attack would hit right now
==============
*/
float() CheckDogMelee =
{
if (enemy_range == RANGE_MELEE)
{ // FIXME: check canreach
self.attack_state = AS_MELEE;
return TRUE;
}
return FALSE;
};
/*
==============
CheckDogJump
==============
*/
float() CheckDogJump =
{
local vector dist;
local float d;
if (self.origin_z + self.mins_z > self.enemy.origin_z + self.enemy.mins_z
+ 0.75 * self.enemy.size_z)
return FALSE;
if (self.origin_z + self.maxs_z < self.enemy.origin_z + self.enemy.mins_z
+ 0.25 * self.enemy.size_z)
return FALSE;
dist = self.enemy.origin - self.origin;
dist_z = 0;
d = vlen(dist);
if (d < 80)
return FALSE;
if (d > 150)
return FALSE;
return TRUE;
};
float() DogCheckAttack =
{
// if close enough for slashing, go for it
if (CheckDogMelee ())
{
self.attack_state = AS_MELEE;
return TRUE;
}
if (CheckDogJump ())
{
self.attack_state = AS_MISSILE;
return TRUE;
}
return FALSE;
};
//===========================================================================
/*QUAKED monster_dog (1 0 0) (-32 -32 -24) (32 32 40) Ambush
*/
void() monster_dog =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (deathmatch)
{
remove(self);
return;
}
precache_model ("progs/h_dog.mdl");
precache_model ("progs/dog.mdl");
precache_sound ("dog/dattack1.wav");
precache_sound ("dog/ddeath.wav");
precache_sound ("dog/dpain1.wav");
precache_sound ("dog/dsight.wav");
precache_sound ("dog/idle.wav");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/dog.mdl");
setsize (self, '-32 -32 -24', '32 32 40');
if (!self.health) //thanks RennyC -- dumptruck_ds
self.health = 25;
self.th_stand = dog_stand1;
self.th_walk = dog_walk1;
self.th_run = dog_run1;
self.th_pain = dog_pain;
self.th_die = dog_die;
self.th_melee = dog_atta1;
self.th_missile = dog_leap1;
walkmonster_start();
};
/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */
/*QUAKED monster_dead_dog (0 0.5 0.8) (-32 -32 -24) (32 32 64)
*/
void() monster_dead_dog =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_model("progs/dog.mdl");
setmodel(self, "progs/dog.mdl");
self.frame = $death8;
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
setsize(self,'-24.51 -16.5 -50.37','28.2 13.81 30');
}
else
{
self.solid = SOLID_NOT;
}
};

View File

@@ -0,0 +1,784 @@
float DOOR_START_OPEN = 1;
float DOOR_DONT_LINK = 4;
float DOOR_GOLD_KEY = 8;
float DOOR_SILVER_KEY = 16;
float DOOR_TOGGLE = 32;
/*
Doors are similar to buttons, but can spawn a fat trigger field around them
to open without a touch, and they link together to form simultanious
double/quad doors.
Door.owner is the master door. If there is only one door, it points to itself.
If multiple doors, all will point to a single one.
Door.enemy chains from the master door through all doors linked in the chain.
*/
/*
=============================================================================
THINK FUNCTIONS
=============================================================================
*/
void() door_go_down;
void() door_go_up;
void() door_blocked =
{
T_Damage (other, self, self, self.dmg);
// if a door has a negative wait, it would never come back if blocked,
// so let it just squash the object to death real fast
if (self.wait >= 0)
{
if (self.state == STATE_DOWN)
door_go_up ();
else
door_go_down ();
}
};
void() door_hit_top =
{
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_TOP;
if (self.spawnflags & DOOR_TOGGLE)
return; // don't come down automatically
self.think = door_go_down;
self.nextthink = self.ltime + self.wait;
};
void() door_hit_bottom =
{
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_BOTTOM;
};
void() door_go_down =
{
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
if (self.max_health)
{
self.takedamage = DAMAGE_YES;
self.health = self.max_health;
}
self.state = STATE_DOWN;
SUB_CalcMove (self.pos1, self.speed, door_hit_bottom);
};
void() door_go_up =
{
if (self.state == STATE_UP)
return; // allready going up
if (self.state == STATE_TOP)
{ // reset top wait time
self.nextthink = self.ltime + self.wait;
return;
}
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
self.state = STATE_UP;
SUB_CalcMove (self.pos2, self.speed, door_hit_top);
SUB_UseTargets();
};
/*
=============================================================================
ACTIVATION FUNCTIONS
=============================================================================
*/
void() door_fire =
{
local entity oself;
local entity starte;
if (self.owner != self)
objerror ("door_fire: self.owner != self");
// play use key sound
if (self.items)
sound (self, CHAN_ITEM, self.noise4, 1, ATTN_NORM); //dumptruck_ds CHAN_VOICE to ITEM thx c0burn
self.message = string_null; // no more message
oself = self;
if (self.spawnflags & DOOR_TOGGLE)
{
if (self.state == STATE_UP || self.state == STATE_TOP)
{
starte = self;
do
{
door_go_down ();
self = self.enemy;
} while ( (self != starte) && (self != world) );
self = oself;
return;
}
}
// trigger all paired doors
starte = self;
do
{
door_go_up ();
self = self.enemy;
} while ( (self != starte) && (self != world) );
self = oself;
};
void() door_use =
{
local entity oself;
self.message = ""; // door message are for touch only
self.owner.message = "";
self.enemy.message = "";
oself = self;
self = self.owner;
door_fire ();
self = oself;
};
void() door_trigger_touch =
{
if (other.health <= 0)
return;
if (time < self.attack_finished)
return;
self.attack_finished = time + 1;
activator = other;
self = self.owner;
door_use ();
};
void() door_killed =
{
local entity oself;
oself = self;
self = self.owner;
self.health = self.max_health;
self.takedamage = DAMAGE_NO; // wil be reset upon return
door_use ();
self = oself;
};
/*
================
door_touch
Prints messages and opens key doors
================
*/
void() door_touch =
{
if (other.classname != "player")
return;
if (self.owner.attack_finished > time)
return;
self.owner.attack_finished = time + 2;
if (self.owner.message != "")
{
centerprint (other, self.owner.message);
sound (other, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
}
// key door stuff
if (!self.items)
return;
// FIXME: blink key on player's status bar
if ( (self.items & other.items) != self.items )
{
if (self.owner.items == IT_KEY1)
{
if (world.worldtype == 2)
{
centerprint (other, "You need the silver keycard");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
else if (world.worldtype == 1)
{
centerprint (other, "You need the silver runekey");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
else if (world.worldtype == 0)
{
centerprint (other, "You need the silver key");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
}
else
{
if (world.worldtype == 2)
{
centerprint (other, "You need the gold keycard");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
else if (world.worldtype == 1)
{
centerprint (other, "You need the gold runekey");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
else if (world.worldtype == 0)
{
centerprint (other, "You need the gold key");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
}
return;
}
if (!self.cnt) //dumptruck_ds thanks RennyC -- set cnt 1 to leave key in player inventory
other.items = other.items - self.items;
self.touch = SUB_Null;
if (self.enemy)
self.enemy.touch = SUB_Null; // get paired door
door_use ();
};
/*
=============================================================================
SPAWNING FUNCTIONS
=============================================================================
*/
entity(vector fmins, vector fmaxs) spawn_field =
{
local entity trigger;
local vector t1, t2;
trigger = spawn();
trigger.movetype = MOVETYPE_NONE;
trigger.solid = SOLID_TRIGGER;
trigger.owner = self;
trigger.touch = door_trigger_touch;
t1 = fmins;
t2 = fmaxs;
setsize (trigger, t1 - '60 60 8', t2 + '60 60 8');
return (trigger);
};
float (entity e1, entity e2) EntitiesTouching =
{
if (e1.mins_x > e2.maxs_x)
return FALSE;
if (e1.mins_y > e2.maxs_y)
return FALSE;
if (e1.mins_z > e2.maxs_z)
return FALSE;
if (e1.maxs_x < e2.mins_x)
return FALSE;
if (e1.maxs_y < e2.mins_y)
return FALSE;
if (e1.maxs_z < e2.mins_z)
return FALSE;
return TRUE;
};
/*
=============
LinkDoors
=============
*/
void() LinkDoors =
{
local entity t, starte;
local vector cmins, cmaxs;
if (self.enemy)
return; // already linked by another door
if (self.spawnflags & 4)
{
self.owner = self.enemy = self;
return; // don't want to link this door
}
cmins = self.mins;
cmaxs = self.maxs;
starte = self;
t = self;
do
{
self.owner = starte; // master door
if (self.health)
starte.health = self.health;
if (self.targetname != "")
starte.targetname = self.targetname;
if (self.message != "")
starte.message = self.message;
t = find (t, classname, self.classname);
if (!t)
{
self.enemy = starte; // make the chain a loop
// shootable, fired, or key doors just needed the owner/enemy links,
// they don't spawn a field
self = self.owner;
if (self.health)
return;
if (self.targetname != "")
return;
if (self.items)
return;
self.owner.trigger_field = spawn_field(cmins, cmaxs);
return;
}
if (EntitiesTouching(self,t))
{
if (t.enemy)
objerror ("cross connected doors");
self.enemy = t;
self = t;
if (t.mins_x < cmins_x)
cmins_x = t.mins_x;
if (t.mins_y < cmins_y)
cmins_y = t.mins_y;
if (t.mins_z < cmins_z)
cmins_z = t.mins_z;
if (t.maxs_x > cmaxs_x)
cmaxs_x = t.maxs_x;
if (t.maxs_y > cmaxs_y)
cmaxs_y = t.maxs_y;
if (t.maxs_z > cmaxs_z)
cmaxs_z = t.maxs_z;
}
} while (1 );
};
/*QUAKED func_door (0 .5 .8) ? START_OPEN x DOOR_DONT_LINK GOLD_KEY SILVER_KEY TOGGLE
if two doors touch, they are assumed to be connected and operate as a unit.
TOGGLE causes the door to wait in both the start and end states for a trigger event.
START_OPEN causes the door to move to its destination when spawned, and operate in reverse. It is used to temporarily or permanently close off an area when triggered (not usefull for touch or takedamage doors).
Key doors are allways wait -1.
"message" is printed when the door is touched if it is a trigger door and it hasn't been fired yet
"angle" determines the opening direction
"targetname" if set, no touch field will be spawned and a remote button or trigger field activates the door.
"health" if set, door must be shot open
"speed" movement speed (100 default)
"wait" wait before returning (3 default, -1 = never return)
"lip" lip remaining at end of move (8 default)
"dmg" damage to inflict when blocked (2 default)
"sounds"
0) no sound
1) stone
2) base
3) stone chain
4) screechy metal
*/
void() func_door =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (world.worldtype == 0)
{
precache_sound ("doors/medtry.wav");
precache_sound ("doors/meduse.wav");
self.noise3 = "doors/medtry.wav";
self.noise4 = "doors/meduse.wav";
}
else if (world.worldtype == 1)
{
precache_sound ("doors/runetry.wav");
precache_sound ("doors/runeuse.wav");
self.noise3 = "doors/runetry.wav";
self.noise4 = "doors/runeuse.wav";
}
else if (world.worldtype == 2)
{
precache_sound ("doors/basetry.wav");
precache_sound ("doors/baseuse.wav");
self.noise3 = "doors/basetry.wav";
self.noise4 = "doors/baseuse.wav";
}
else
{
dprint ("no worldtype set!\n");
}
if (self.sounds == 0)
{
precache_sound ("misc/null.wav");
precache_sound ("misc/null.wav");
self.noise1 = "misc/null.wav";
self.noise2 = "misc/null.wav";
}
if (self.sounds == 1)
{
precache_sound ("doors/drclos4.wav");
precache_sound ("doors/doormv1.wav");
self.noise1 = "doors/drclos4.wav";
self.noise2 = "doors/doormv1.wav";
}
if (self.sounds == 2)
{
precache_sound ("doors/hydro1.wav");
precache_sound ("doors/hydro2.wav");
self.noise2 = "doors/hydro1.wav";
self.noise1 = "doors/hydro2.wav";
}
if (self.sounds == 3)
{
precache_sound ("doors/stndr1.wav");
precache_sound ("doors/stndr2.wav");
self.noise2 = "doors/stndr1.wav";
self.noise1 = "doors/stndr2.wav";
}
if (self.sounds == 4)
{
precache_sound ("doors/ddoor1.wav");
precache_sound ("doors/ddoor2.wav");
self.noise1 = "doors/ddoor2.wav";
self.noise2 = "doors/ddoor1.wav";
}
SetMovedir ();
self.max_health = self.health;
self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH;
setorigin (self, self.origin);
setmodel (self, self.model);
self.classname = "door";
self.blocked = door_blocked;
self.use = door_use;
if (self.spawnflags & DOOR_SILVER_KEY)
self.items = IT_KEY1;
if (self.spawnflags & DOOR_GOLD_KEY)
self.items = IT_KEY2;
if (!self.speed)
self.speed = 100;
if (!self.wait)
self.wait = 3;
if (!self.lip)
self.lip = 8;
if (!self.dmg)
self.dmg = 2;
self.pos1 = self.origin;
self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip);
// DOOR_START_OPEN is to allow an entity to be lighted in the closed position
// but spawn in the open position
if (self.spawnflags & DOOR_START_OPEN)
{
setorigin (self, self.pos2);
self.pos2 = self.pos1;
self.pos1 = self.origin;
}
self.state = STATE_BOTTOM;
if (self.health)
{
self.takedamage = DAMAGE_YES;
self.th_die = door_killed;
}
if (self.items)
self.wait = -1;
self.touch = door_touch;
// LinkDoors can't be done until all of the doors have been spawned, so
// the sizes can be detected properly.
self.think = LinkDoors;
self.nextthink = self.ltime + 0.1;
};
/*
=============================================================================
SECRET DOORS
=============================================================================
*/
void() fd_secret_move1;
void() fd_secret_move2;
void() fd_secret_move3;
void() fd_secret_move4;
void() fd_secret_move5;
void() fd_secret_move6;
void() fd_secret_done;
float SECRET_OPEN_ONCE = 1; // stays open
float SECRET_1ST_LEFT = 2; // 1st move is left of arrow
float SECRET_1ST_DOWN = 4; // 1st move is down from arrow
float SECRET_NO_SHOOT = 8; // only opened by trigger
float SECRET_YES_SHOOT = 16; // shootable even if targeted
void () fd_secret_use =
{
local float temp;
self.health = 10000;
// exit if still moving around...
if (self.origin != self.oldorigin)
return;
self.message = string_null; // no more message
SUB_UseTargets(); // fire all targets / killtargets
if (!(self.spawnflags & SECRET_NO_SHOOT))
{
self.th_pain = SUB_NullPain;
self.takedamage = DAMAGE_NO;
}
self.velocity = '0 0 0';
// Make a sound, wait a little...
sound(self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.nextthink = self.ltime + 0.1;
temp = 1 - (self.spawnflags & SECRET_1ST_LEFT); // 1 or -1
makevectors(self.mangle);
if (!self.t_width)
{
if (self.spawnflags & SECRET_1ST_DOWN)
self. t_width = fabs(v_up * self.size);
else
self. t_width = fabs(v_right * self.size);
}
if (!self.t_length)
self. t_length = fabs(v_forward * self.size);
if (self.spawnflags & SECRET_1ST_DOWN)
self.dest1 = self.origin - v_up * self.t_width;
else
self.dest1 = self.origin + v_right * (self.t_width * temp);
self.dest2 = self.dest1 + v_forward * self.t_length;
SUB_CalcMove(self.dest1, self.speed, fd_secret_move1);
sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
};
void(entity attacker, float damage) fd_secret_pain = { fd_secret_use(); };
// Wait after first movement...
void () fd_secret_move1 =
{
self.nextthink = self.ltime + 1.0;
self.think = fd_secret_move2;
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
};
// Start moving sideways w/sound...
void () fd_secret_move2 =
{
sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
SUB_CalcMove(self.dest2, self.speed, fd_secret_move3);
};
// Wait here until time to go back...
void () fd_secret_move3 =
{
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
if (!(self.spawnflags & SECRET_OPEN_ONCE))
{
self.nextthink = self.ltime + self.wait;
self.think = fd_secret_move4;
}
};
// Move backward...
void () fd_secret_move4 =
{
sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
SUB_CalcMove(self.dest1, self.speed, fd_secret_move5);
};
// Wait 1 second...
void () fd_secret_move5 =
{
self.nextthink = self.ltime + 1.0;
self.think = fd_secret_move6;
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
};
void () fd_secret_move6 =
{
sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
SUB_CalcMove(self.oldorigin, self.speed, fd_secret_done);
};
void () fd_secret_done =
{
if (!self.targetname || self.spawnflags&SECRET_YES_SHOOT)
{
self.health = 10000;
self.takedamage = DAMAGE_YES;
self.th_pain = fd_secret_pain;
}
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
};
void () secret_blocked =
{
if (time < self.attack_finished)
return;
self.attack_finished = time + 0.5;
T_Damage (other, self, self, self.dmg);
};
/*
================
secret_touch
Prints messages
================
*/
void() secret_touch =
{
if (other.classname != "player")
return;
if (self.attack_finished > time)
return;
self.attack_finished = time + 2;
if (self.message != "")
{
centerprint (other, self.message);
sound (other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
}
};
/*QUAKED func_door_secret (0 .5 .8) ? open_once 1st_left 1st_down no_shoot always_shoot
Basic secret door. Slides back, then to the side. Angle determines direction.
wait = # of seconds before coming back
1st_left = 1st move is left of arrow
1st_down = 1st move is down from arrow
always_shoot = even if targeted, keep shootable
t_width = override WIDTH to move back (or height if going down)
t_length = override LENGTH to move sideways
"dmg" damage to inflict when blocked (2 default)
If a secret door has a targetname, it will only be opened by it's botton or trigger, not by damage.
"sounds"
1) medieval
2) metal
3) base
*/
void () func_door_secret =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (self.sounds == 0)
self.sounds = 3;
if (self.sounds == 1)
{
precache_sound ("doors/latch2.wav");
precache_sound ("doors/winch2.wav");
precache_sound ("doors/drclos4.wav");
self.noise1 = "doors/latch2.wav";
self.noise2 = "doors/winch2.wav";
self.noise3 = "doors/drclos4.wav";
}
if (self.sounds == 2)
{
precache_sound ("doors/airdoor1.wav");
precache_sound ("doors/airdoor2.wav");
self.noise2 = "doors/airdoor1.wav";
self.noise1 = "doors/airdoor2.wav";
self.noise3 = "doors/airdoor2.wav";
}
if (self.sounds == 3)
{
precache_sound ("doors/basesec1.wav");
precache_sound ("doors/basesec2.wav");
self.noise2 = "doors/basesec1.wav";
self.noise1 = "doors/basesec2.wav";
self.noise3 = "doors/basesec2.wav";
}
if (!self.dmg)
self.dmg = 2;
// Magic formula...
self.mangle = self.angles;
self.angles = '0 0 0';
self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH;
self.classname = "door";
setmodel (self, self.model);
setorigin (self, self.origin);
self.touch = secret_touch;
self.blocked = secret_blocked;
self.speed = 50;
self.use = fd_secret_use;
if ( !self.targetname || self.spawnflags&SECRET_YES_SHOOT)
{
self.health = 10000;
self.takedamage = DAMAGE_YES;
self.th_pain = fd_secret_pain;
self.th_die = fd_secret_use;
}
self.oldorigin = self.origin;
if (!self.wait)
self.wait = 5; // 5 seconds before closing
};

View File

@@ -0,0 +1,821 @@
//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)
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_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();
}
void() play_explosion =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
self.use = play_explosion_fx;
};
/*QUAKED play_tbabyexplode (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
When triggered, creates a Spawn death explosion at it's origin. Causes damage.
*/
void () play_tbaby_fx = //thanks Khreathor -- dumptruck_ds
{
tbaby_die2();
}
void() play_tbabyexplode =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_sound2 ("blob/death1.wav");
self.use = play_tbaby_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;
}
/* 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)
*/
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)
*/
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)
*/
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)
*/
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)
*/
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)
*/
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)
*/
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)
*/
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)
*/
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)
*/
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)
*/
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)
*/
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)
*/
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)
*/
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 */
/*==============================================================================
func_fall from RennyC
A brush that drops and fades away when touched or triggered.
dumptruck_ds
noise = sound to play when triggered
wait = wait this long before falling
==============================================================================*/
float DONT_FADE = 1;
void() func_fall_think =
{
if (self.cnt == TRUE && self.attack_finished < time)
{
self.solid = SOLID_BBOX;
// self.solid = SOLID_NOT;
self.movetype = MOVETYPE_TOSS;
if (!(self.spawnflags & DONT_FADE))
{
if (self.alpha > 0.1)
self.alpha = self.alpha - 0.03;
else
{
remove(self);
return;
}
}
}
self.nextthink = time + 0.1;
};
void() fall_touch =
{
if (other.classname == "player")
{
if (!(other.flags & FL_ONGROUND))
other.flags = other.flags | FL_ONGROUND;
}
else if (other.flags & FL_MONSTER)
T_Damage (other, self, other, 50000);
else
return;
if (self.cnt == TRUE)
return;
self.attack_finished = time + self.wait;
self.cnt = TRUE;
if (self.noise != "")
sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
else
sound (self, CHAN_AUTO, "buttons/switch21.wav", 1, ATTN_NORM);
};
void() fall_use = // thanks again RennyC for help on revisions --dumptruck_ds
{
self.attack_finished = time + self.wait;
self.cnt = TRUE;
if (self.noise != "")
sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
else
sound (self, CHAN_AUTO, "buttons/switch21.wav", 1, ATTN_NORM);
};
/*QUAKED func_fall (0 .5 .8) ?
Falling brush upon touch
*/
void() func_fall =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_sound("buttons/switch21.wav");
if (self.noise != "") precache_sound (self.noise);
self.alpha = 1;
self.cnt = FALSE;
self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH;
self.think = func_fall_think;
self.nextthink = time;
self.touch = fall_touch;
self.use = fall_use;
setmodel (self, self.model);
};
//=START PARTICLE-STREAM==================================================
// from Zerstrorer mod -- dumptruck_ds
void(vector start, vector end, float color1, float color2, float pdensity) Particle_Beam =
{
local vector spray, next;
local float dist, loop, clr;
clr = color1;
spray = start - end;
dist = vlen(spray);
loop = dist / 24;
spray = normalize(spray);
next = spray * 24;
while(loop > 0)
{
particle (end, spray, clr, pdensity);
end = end + next;
loop = loop - 1;
if (clr == color1)
clr = color2;
else
clr = color1;
}
};
void() particle_use =
{
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
Particle_Beam(self.origin, self.enemy.origin, self.dmg, self.cnt, 15); // was 40 - too many particles for my taste --dumptruck_ds
};
void() particle_stream_start =
{
local entity pspot;
pspot = find(world, targetname, self.target);
if(!pspot)
{
dprint("Particle stream can't find target!");
return;
}
self.enemy = pspot;
};
/*QUAKED misc_particle_stream (0 .5 .8) (-8 -8 -8) (8 8 8)
A particle stream! It appears when triggered. This entity is
one end of the stream, target another entity as the other end-point.
I used the info_notnull, but you should be able to target anything
(like monsters).
"target" This entities origin is the end-point of the stream
"dmg" 1st Color - Use if you want a single color stream
"cnt" 2nd Color - Mixes particles of both colors
"noise" Sound to play when triggered
*/
void() misc_particle_stream =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if(!self.target)
objerror("misc_particle_stream with not target!");
if(!self.dmg)
self.dmg = 73;
if(!self.cnt)
self.cnt = self.dmg;
if(!self.noise)
self.noise = "misc/null.wav";
precache_sound(self.noise);
self.use = particle_use;
self.think = particle_stream_start;
self.nextthink = time + 0.2;
};
void() mflash_use =
{
self.effects = self.effects | EF_MUZZLEFLASH;
// dprint("flash\n");
};
/*QUAKED play_mflash (0 .5 .8) (-8 -8 -8) (8 8 8)
this is a work in progress in ver. 1.1.2 and not exposed in the FGD
*/
void() play_mflash =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_model ("progs/s_null.spr");
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;
};

View File

@@ -0,0 +1,105 @@
/*this is a point entity from Rubicon Rumble Pack Devkit; REQUIRES A TARGETNAME*/
// ===== TRIGGER_SHAKE =======================================================
float VIEWONLY = 1;
void() shake_think =
{
if (self.attack_finished < time) // Done
{
self.nextthink = -1;
if (self.noise1 != "")
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
return;
}
local entity plyr;
// Shake all players in the effect radius...
plyr = findradius(self.origin, self.count);
while(plyr)
{
if (plyr.flags & FL_CLIENT)
{
local float d;
// Scale effect by distance
d = vlen(self.origin - plyr.origin);
d = (self.count - d)/self.count;
if (d > 0)
{
// shake up the view
plyr.punchangle_x = -1 * (random() + (0.025*self.dmg*d));
// push the player around
if (plyr.flags & FL_ONGROUND && !(self.spawnflags & VIEWONLY))
{
d = self.dmg*d;
plyr.velocity_x = plyr.velocity_x + (random()*d*2 - d);
plyr.velocity_y = plyr.velocity_y + (random()*d*2 - d);
plyr.velocity_z = plyr.velocity_z + (random()*d);// always push up
}
}
}
plyr = plyr.chain;
}
// keep going
self.nextthink = time + 0.1;
};
void() shake_use =
{
if (self.attack_finished > time) return;// already active
// Start...
if (self.noise != "")
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
self.attack_finished = time + self.wait;
self.nextthink = time + 0.1;
};
/*QUAKED trigger_shake (.5 .5 .5) (-8 -8 -8) (8 8 8) VIEWONLY
Earthquake trigger - shakes players in it's radius when active.
Strength of tremor is greatest at the centre.
"dmg" Strength at center (default is 120)
"wait" Duration of shake (default is 1)
"count" Affect radius (defalt is 200)
"noise" Noise to play when starting to shake
"noise1" Noise to play when stopping
"targetname" Must be triggered
Spawnflags:
"VIEWONLY" Shakes the view, but player movement is not affected
*/
void() trigger_shake =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (!self.targetname) objerror("trigger_shake without name");
if (self.noise != "") precache_sound (self.noise);
if (self.noise1 != "") precache_sound (self.noise1);
if (!self.dmg) self.dmg = 120;
if (self.count <= 0) self.count = 200;
if (self.wait <= 0) self.wait = 1.0;
setorigin(self, self.origin);
self.nextthink = -1;
self.think = shake_think;
self.use = shake_use;
};

View File

@@ -0,0 +1,157 @@
// elevator button
// pmack
// sept 96
float ELVTR_DOWN = 1;
void() elvtr_button_wait;
void() elvtr_button_return;
void() elvtr_button_wait =
{
elv_butn_dir = 0;
if (self.spawnflags & ELVTR_DOWN)
elv_butn_dir = -1;
else
elv_butn_dir = 1;
self.state = STATE_TOP;
self.nextthink = self.ltime + self.wait;
self.think = elvtr_button_return;
activator = self.enemy;
SUB_UseTargets();
self.frame = 1; // use alternate textures
};
void() elvtr_button_done =
{
self.state = STATE_BOTTOM;
};
void() elvtr_button_return =
{
self.state = STATE_DOWN;
SUB_CalcMove (self.pos1, self.speed, elvtr_button_done);
self.frame = 0; // use normal textures
if (self.health)
self.takedamage = DAMAGE_YES; // can be shot again
};
void() elvtr_button_blocked =
{ // do nothing, just don't ome all the way back out
};
void() elvtr_button_fire =
{
if (self.state == STATE_UP || self.state == STATE_TOP)
return;
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
self.state = STATE_UP;
SUB_CalcMove (self.pos2, self.speed, elvtr_button_wait);
};
void() elvtr_button_use =
{
self.enemy = activator;
elvtr_button_fire ();
};
void() elvtr_button_touch =
{
if (other.classname != "player")
return;
self.enemy = other;
elvtr_button_fire ();
};
void() elvtr_button_killed =
{
self.enemy = damage_attacker;
self.health = self.max_health;
self.takedamage = DAMAGE_NO; // wil be reset upon return
elvtr_button_fire ();
};
/*QUAKED func_elvtr_button (0 .5 .8) ? ELVTR_DOWN
ELEVATOR BUTTON ONLY!
ELVTR_DOWN causes this to be a DOWN button.
Default is UP.
When a button is touched, it moves some distance in the direction of it's angle, triggers all of it's targets, waits some time, then returns to it's original position where it can be triggered again.
"angle" determines the opening direction
"target" all entities with a matching targetname will be used
"speed" override the default 40 speed
"wait" override the default 1 second wait (-1 = never return)
"lip" override the default 4 pixel lip remaining at end of move
"health" if set, the button must be killed instead of touched
"sounds"
0) steam metal
1) wooden clunk
2) metallic click
3) in-out
*/
void() func_elvtr_button =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (self.sounds == 0)
{
precache_sound ("buttons/airbut1.wav");
self.noise = "buttons/airbut1.wav";
}
if (self.sounds == 1)
{
precache_sound ("buttons/switch21.wav");
self.noise = "buttons/switch21.wav";
}
if (self.sounds == 2)
{
precache_sound ("buttons/switch02.wav");
self.noise = "buttons/switch02.wav";
}
if (self.sounds == 3)
{
precache_sound ("buttons/switch04.wav");
self.noise = "buttons/switch04.wav";
}
SetMovedir ();
self.movetype = MOVETYPE_PUSH;
self.solid = SOLID_BSP;
setmodel (self, self.model);
self.blocked = elvtr_button_blocked;
self.use = elvtr_button_use;
if (self.health)
{
self.max_health = self.health;
self.th_die = elvtr_button_killed;
self.takedamage = DAMAGE_YES;
}
else
self.touch = elvtr_button_touch;
if (!self.speed)
self.speed = 40;
if (!self.wait)
self.wait = 1;
if (!self.lip)
self.lip = 4;
self.state = STATE_BOTTOM;
self.pos1 = self.origin;
self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip);
};

View File

@@ -0,0 +1,395 @@
/*
==============================================================================
SOLDIER / PLAYER
==============================================================================
*/
$cd id1/models/enforcer
$origin 0 -6 24
$base base
$skin skin
$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10
$frame walk11 walk12 walk13 walk14 walk15 walk16
$frame run1 run2 run3 run4 run5 run6 run7 run8
$frame attack1 attack2 attack3 attack4 attack5 attack6
$frame attack7 attack8 attack9 attack10
$frame death1 death2 death3 death4 death5 death6 death7 death8
$frame death9 death10 death11 death12 death13 death14
$frame fdeath1 fdeath2 fdeath3 fdeath4 fdeath5 fdeath6 fdeath7 fdeath8
$frame fdeath9 fdeath10 fdeath11
$frame paina1 paina2 paina3 paina4
$frame painb1 painb2 painb3 painb4 painb5
$frame painc1 painc2 painc3 painc4 painc5 painc6 painc7 painc8
$frame paind1 paind2 paind3 paind4 paind5 paind6 paind7 paind8
$frame paind9 paind10 paind11 paind12 paind13 paind14 paind15 paind16
$frame paind17 paind18 paind19
void() Laser_Touch =
{
local vector org;
if (other == self.owner)
return; // don't explode on owner
if (pointcontents(self.origin) == CONTENT_SKY)
{
remove(self);
return;
}
sound (self, CHAN_WEAPON, "enforcer/enfstop.wav", 1, ATTN_STATIC);
org = self.origin - 8*normalize(self.velocity);
if (other.health)
{
SpawnBlood (org, self.velocity*0.2, 15);
T_Damage (other, self, self.owner, 15);
}
else
{
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_GUNSHOT);
WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y);
WriteCoord (MSG_BROADCAST, org_z);
}
remove(self);
};
void(vector org, vector vec) LaunchLaser =
{
if (self.classname == "monster_enforcer")
sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM);
vec = normalize(vec);
newmis = spawn();
newmis.owner = self;
newmis.movetype = MOVETYPE_FLY;
newmis.solid = SOLID_BBOX;
newmis.effects = EF_DIMLIGHT;
setmodel (newmis, "progs/laser.mdl");
setsize (newmis, '0 0 0', '0 0 0');
setorigin (newmis, org);
newmis.velocity = vec * 600;
newmis.angles = vectoangles(newmis.velocity);
newmis.nextthink = time + 5;
newmis.think = SUB_Remove;
newmis.touch = Laser_Touch;
};
void() enforcer_fire =
{
local vector org;
self.effects = self.effects | EF_MUZZLEFLASH;
makevectors (self.angles);
org = self.origin + v_forward * 30 + v_right * 8.5 + '0 0 16';
LaunchLaser(org, self.enemy.origin - self.origin);
};
//============================================================================
void() enf_stand1 =[ $stand1, enf_stand2 ] {ai_stand();};
void() enf_stand2 =[ $stand2, enf_stand3 ] {ai_stand();};
void() enf_stand3 =[ $stand3, enf_stand4 ] {ai_stand();};
void() enf_stand4 =[ $stand4, enf_stand5 ] {ai_stand();};
void() enf_stand5 =[ $stand5, enf_stand6 ] {ai_stand();};
void() enf_stand6 =[ $stand6, enf_stand7 ] {ai_stand();};
void() enf_stand7 =[ $stand7, enf_stand1 ] {ai_stand();};
void() enf_walk1 =[ $walk1 , enf_walk2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "enforcer/idle1.wav", 1, ATTN_IDLE);
ai_walk(2);};
void() enf_walk2 =[ $walk2 , enf_walk3 ] {ai_walk(4);};
void() enf_walk3 =[ $walk3 , enf_walk4 ] {ai_walk(4);};
void() enf_walk4 =[ $walk4 , enf_walk5 ] {ai_walk(3);};
void() enf_walk5 =[ $walk5 , enf_walk6 ] {ai_walk(1);};
void() enf_walk6 =[ $walk6 , enf_walk7 ] {ai_walk(2);};
void() enf_walk7 =[ $walk7 , enf_walk8 ] {ai_walk(2);};
void() enf_walk8 =[ $walk8 , enf_walk9 ] {ai_walk(1);};
void() enf_walk9 =[ $walk9 , enf_walk10 ] {ai_walk(2);};
void() enf_walk10 =[ $walk10, enf_walk11 ] {ai_walk(4);};
void() enf_walk11 =[ $walk11, enf_walk12 ] {ai_walk(4);};
void() enf_walk12 =[ $walk12, enf_walk13 ] {ai_walk(1);};
void() enf_walk13 =[ $walk13, enf_walk14 ] {ai_walk(2);};
void() enf_walk14 =[ $walk14, enf_walk15 ] {ai_walk(3);};
void() enf_walk15 =[ $walk15, enf_walk16 ] {ai_walk(4);};
void() enf_walk16 =[ $walk16, enf_walk1 ] {ai_walk(2);};
void() enf_run1 =[ $run1 , enf_run2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "enforcer/idle1.wav", 1, ATTN_IDLE);
ai_run(18);};
void() enf_run2 =[ $run2 , enf_run3 ] {ai_run(14);};
void() enf_run3 =[ $run3 , enf_run4 ] {ai_run(7);};
void() enf_run4 =[ $run4 , enf_run5 ] {ai_run(12);};
void() enf_run5 =[ $run5 , enf_run6 ] {ai_run(14);};
void() enf_run6 =[ $run6 , enf_run7 ] {ai_run(14);};
void() enf_run7 =[ $run7 , enf_run8 ] {ai_run(7);};
void() enf_run8 =[ $run8 , enf_run1 ] {ai_run(11);};
void() enf_atk1 =[ $attack1, enf_atk2 ] {ai_face();};
void() enf_atk2 =[ $attack2, enf_atk3 ] {ai_face();};
void() enf_atk3 =[ $attack3, enf_atk4 ] {ai_face();};
void() enf_atk4 =[ $attack4, enf_atk5 ] {ai_face();};
void() enf_atk5 =[ $attack5, enf_atk6 ] {ai_face();};
void() enf_atk6 =[ $attack6, enf_atk7 ] {enforcer_fire();};
void() enf_atk7 =[ $attack7, enf_atk8 ] {ai_face();};
void() enf_atk8 =[ $attack8, enf_atk9 ] {ai_face();};
void() enf_atk9 =[ $attack5, enf_atk10 ] {ai_face();};
void() enf_atk10 =[ $attack6, enf_atk11 ] {enforcer_fire();};
void() enf_atk11 =[ $attack7, enf_atk12 ] {ai_face();};
void() enf_atk12 =[ $attack8, enf_atk13 ] {ai_face();};
void() enf_atk13 =[ $attack9, enf_atk14 ] {ai_face();};
void() enf_atk14 =[ $attack10, enf_run1 ] {ai_face();
SUB_CheckRefire (enf_atk1);
};
void() enf_paina1 =[ $paina1, enf_paina2 ] {};
void() enf_paina2 =[ $paina2, enf_paina3 ] {};
void() enf_paina3 =[ $paina3, enf_paina4 ] {};
void() enf_paina4 =[ $paina4, enf_run1 ] {};
void() enf_painb1 =[ $painb1, enf_painb2 ] {};
void() enf_painb2 =[ $painb2, enf_painb3 ] {};
void() enf_painb3 =[ $painb3, enf_painb4 ] {};
void() enf_painb4 =[ $painb4, enf_painb5 ] {};
void() enf_painb5 =[ $painb5, enf_run1 ] {};
void() enf_painc1 =[ $painc1, enf_painc2 ] {};
void() enf_painc2 =[ $painc2, enf_painc3 ] {};
void() enf_painc3 =[ $painc3, enf_painc4 ] {};
void() enf_painc4 =[ $painc4, enf_painc5 ] {};
void() enf_painc5 =[ $painc5, enf_painc6 ] {};
void() enf_painc6 =[ $painc6, enf_painc7 ] {};
void() enf_painc7 =[ $painc7, enf_painc8 ] {};
void() enf_painc8 =[ $painc8, enf_run1 ] {};
void() enf_paind1 =[ $paind1, enf_paind2 ] {};
void() enf_paind2 =[ $paind2, enf_paind3 ] {};
void() enf_paind3 =[ $paind3, enf_paind4 ] {};
void() enf_paind4 =[ $paind4, enf_paind5 ] {ai_painforward(2);};
void() enf_paind5 =[ $paind5, enf_paind6 ] {ai_painforward(1);};
void() enf_paind6 =[ $paind6, enf_paind7 ] {};
void() enf_paind7 =[ $paind7, enf_paind8 ] {};
void() enf_paind8 =[ $paind8, enf_paind9 ] {};
void() enf_paind9 =[ $paind9, enf_paind10 ] {};
void() enf_paind10 =[ $paind10, enf_paind11 ] {};
void() enf_paind11 =[ $paind11, enf_paind12 ] {ai_painforward(1);};
void() enf_paind12 =[ $paind12, enf_paind13 ] {ai_painforward(1);};
void() enf_paind13 =[ $paind13, enf_paind14 ] {ai_painforward(1);};
void() enf_paind14 =[ $paind14, enf_paind15 ] {};
void() enf_paind15 =[ $paind15, enf_paind16 ] {};
void() enf_paind16 =[ $paind16, enf_paind17 ] {ai_pain(1);};
void() enf_paind17 =[ $paind17, enf_paind18 ] {ai_pain(1);};
void() enf_paind18 =[ $paind18, enf_paind19 ] {};
void() enf_paind19 =[ $paind19, enf_run1 ] {};
void(entity attacker, float damage) enf_pain =
{
local float r;
r = random ();
if (self.pain_finished > time)
return;
if (r < 0.5)
sound (self, CHAN_VOICE, "enforcer/pain1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "enforcer/pain2.wav", 1, ATTN_NORM);
if (r < 0.2)
{
self.pain_finished = time + 1;
enf_paina1 ();
}
else if (r < 0.4)
{
self.pain_finished = time + 1;
enf_painb1 ();
}
else if (r < 0.7)
{
self.pain_finished = time + 1;
enf_painc1 ();
}
else
{
self.pain_finished = time + 2;
enf_paind1 ();
}
};
//============================================================================
void() enf_die1 =[ $death1, enf_die2 ] {};
void() enf_die2 =[ $death2, enf_die3 ] {};
void() enf_die3 =[ $death3, enf_die4 ]
{self.solid = SOLID_NOT;self.ammo_cells = 5;if(!self.keep_ammo)DropBackpack();};
void() enf_die4 =[ $death4, enf_die5 ] {ai_forward(14);};
void() enf_die5 =[ $death5, enf_die6 ] {ai_forward(2);};
void() enf_die6 =[ $death6, enf_die7 ] {};
void() enf_die7 =[ $death7, enf_die8 ] {};
void() enf_die8 =[ $death8, enf_die9 ] {};
void() enf_die9 =[ $death9, enf_die10 ] {ai_forward(3);};
void() enf_die10 =[ $death10, enf_die11 ] {ai_forward(5);};
void() enf_die11 =[ $death11, enf_die12 ] {ai_forward(5);};
void() enf_die12 =[ $death12, enf_die13 ] {ai_forward(5);};
void() enf_die13 =[ $death13, enf_die14 ] {};
void() enf_die14 =[ $death14, enf_die14 ] {};
void() enf_fdie1 =[ $fdeath1, enf_fdie2 ] {
};
void() enf_fdie2 =[ $fdeath2, enf_fdie3 ] {};
void() enf_fdie3 =[ $fdeath3, enf_fdie4 ]
{self.solid = SOLID_NOT;self.ammo_cells = 5;if(!self.keep_ammo)DropBackpack();};
void() enf_fdie4 =[ $fdeath4, enf_fdie5 ] {};
void() enf_fdie5 =[ $fdeath5, enf_fdie6 ] {};
void() enf_fdie6 =[ $fdeath6, enf_fdie7 ] {};
void() enf_fdie7 =[ $fdeath7, enf_fdie8 ] {};
void() enf_fdie8 =[ $fdeath8, enf_fdie9 ] {};
void() enf_fdie9 =[ $fdeath9, enf_fdie10 ] {};
void() enf_fdie10 =[ $fdeath10, enf_fdie11 ] {};
void() enf_fdie11 =[ $fdeath11, enf_fdie11 ] {};
void() enf_die =
{
// check for gib
if (self.health < -35)
{
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_mega.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
return;
}
// regular death
sound (self, CHAN_VOICE, "enforcer/death1.wav", 1, ATTN_NORM);
if (random() > 0.5)
enf_die1 ();
else
enf_fdie1 ();
};
/*QUAKED monster_enforcer (1 0 0) (-16 -16 -24) (16 16 40) Ambush
*/
void() monster_enforcer =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (deathmatch)
{
remove(self);
return;
}
precache_model2 ("progs/enforcer.mdl");
precache_model2 ("progs/h_mega.mdl");
precache_model2 ("progs/laser.mdl");
precache_sound2 ("enforcer/death1.wav");
precache_sound2 ("enforcer/enfire.wav");
precache_sound2 ("enforcer/enfstop.wav");
precache_sound2 ("enforcer/idle1.wav");
precache_sound2 ("enforcer/pain1.wav");
precache_sound2 ("enforcer/pain2.wav");
precache_sound2 ("enforcer/sight1.wav");
precache_sound2 ("enforcer/sight2.wav");
precache_sound2 ("enforcer/sight3.wav");
precache_sound2 ("enforcer/sight4.wav");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/enforcer.mdl");
setsize (self, '-16 -16 -24', '16 16 40');
if (!self.health) //thanks RennyC -- dumptruck_ds
self.health = 80;
self.th_stand = enf_stand1;
self.th_walk = enf_walk1;
self.th_run = enf_run1;
self.th_pain = enf_pain;
self.th_die = enf_die;
self.th_missile = enf_atk1;
walkmonster_start();
};
/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */
/*QUAKED monster_dead_enforcer (0 0.5 0.8) (-16 -16 -24) (16 16 32)
*/
void() monster_dead_enforcer =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_model("progs/enforcer.mdl");
setmodel(self, "progs/enforcer.mdl");
if (self.spawnflags & 2)
{
self.frame = $fdeath11;
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
setsize(self,'-41.16 -45.65 -51.95','21.45 25.49 30');
}
else
{
self.solid = SOLID_NOT;
}
}
else
{
self.frame = $death14;
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
setsize(self,'-39.85 -29.35 -49.07','20.52 33.17 30');
}
else
{
self.solid = SOLID_NOT;
}
}
};

View File

@@ -0,0 +1,407 @@
/*
A monster is in fight mode if it thinks it can effectively attack its
enemy.
When it decides it can't attack, it goes into hunt mode.
*/
float(float v) anglemod;
void() knight_atk1;
void() knight_runatk1;
void() ogre_smash1;
void() ogre_swing1;
void() sham_smash1;
void() sham_swingr1;
void() sham_swingl1;
float() DemonCheckAttack;
void(float side) Demon_Melee;
void(vector dest) ChooseTurn;
void() ai_face;
float enemy_vis, enemy_infront, enemy_range;
float enemy_yaw;
void() knight_attack =
{
local float len;
// decide if now is a good swing time
len = vlen(self.enemy.origin+self.enemy.view_ofs - (self.origin+self.view_ofs));
if (len<80)
knight_atk1 ();
else
knight_runatk1 ();
};
//=============================================================================
/*
===========
CheckAttack
The player is in view, so decide to move or launch an attack
Returns FALSE if movement should continue
============
*/
float() CheckAttack =
{
local vector spot1, spot2;
local entity targ;
local float chance;
targ = self.enemy;
// see if any entities are in the way of the shot
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
traceline (spot1, spot2, FALSE, self);
if (trace_ent != targ)
return FALSE; // don't have a clear shot
if (trace_inopen && trace_inwater)
return FALSE; // sight line crossed contents
if (enemy_range == RANGE_MELEE)
{ // melee attack
if (self.th_melee)
{
if (self.classname == "monster_knight")
knight_attack ();
else
self.th_melee ();
return TRUE;
}
}
// missile attack
if (!self.th_missile)
return FALSE;
if (time < self.attack_finished)
return FALSE;
if (enemy_range == RANGE_FAR)
return FALSE;
if (enemy_range == RANGE_MELEE)
{
chance = 0.9;
self.attack_finished = 0;
}
else if (enemy_range == RANGE_NEAR)
{
if (self.th_melee)
chance = 0.2;
else
chance = 0.4;
}
else if (enemy_range == RANGE_MID)
{
if (self.th_melee)
chance = 0.05;
else
chance = 0.1;
}
else
chance = 0;
if (random () < chance)
{
self.th_missile ();
SUB_AttackFinished (2*random());
return TRUE;
}
return FALSE;
};
/*
=============
ai_face
Stay facing the enemy
=============
*/
void() ai_face =
{
self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin);
ChangeYaw ();
};
/*
=============
ai_charge
The monster is in a melee attack, so get as close as possible to .enemy
=============
*/
float (entity targ) visible;
float(entity targ) infront;
float(entity targ) range;
void(float d) ai_charge =
{
ai_face ();
movetogoal (d); // done in C code...
};
void() ai_charge_side =
{
local vector dtemp;
local float heading;
// aim to the left of the enemy for a flyby
self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin);
ChangeYaw ();
makevectors (self.angles);
dtemp = self.enemy.origin - 30*v_right;
heading = vectoyaw(dtemp - self.origin);
walkmove(heading, 20);
};
/*
=============
ai_melee
=============
*/
void() ai_melee =
{
local vector delta;
local float ldmg;
if (!self.enemy)
return; // removed before stroke
delta = self.enemy.origin - self.origin;
if (vlen(delta) > 60)
return;
ldmg = (random() + random() + random()) * 3;
T_Damage (self.enemy, self, self, ldmg);
};
void() ai_melee_side =
{
local vector delta;
local float ldmg;
if (!self.enemy)
return; // removed before stroke
ai_charge_side();
delta = self.enemy.origin - self.origin;
if (vlen(delta) > 60)
return;
if (!CanDamage (self.enemy, self))
return;
ldmg = (random() + random() + random()) * 3;
T_Damage (self.enemy, self, self, ldmg);
};
//=============================================================================
/*
===========
SoldierCheckAttack
The player is in view, so decide to move or launch an attack
Returns FALSE if movement should continue
============
*/
float() SoldierCheckAttack =
{
local vector spot1, spot2;
local entity targ;
local float chance;
targ = self.enemy;
// see if any entities are in the way of the shot
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
traceline (spot1, spot2, FALSE, self);
if (trace_inopen && trace_inwater)
return FALSE; // sight line crossed contents
if (trace_ent != targ)
return FALSE; // don't have a clear shot
// missile attack
if (time < self.attack_finished)
return FALSE;
if (enemy_range == RANGE_FAR)
return FALSE;
if (enemy_range == RANGE_MELEE)
chance = 0.9;
else if (enemy_range == RANGE_NEAR)
chance = 0.4;
else if (enemy_range == RANGE_MID)
chance = 0.05;
else
chance = 0;
if (random () < chance)
{
self.th_missile ();
SUB_AttackFinished (1 + random());
if (random() < 0.3)
self.lefty = !self.lefty;
return TRUE;
}
return FALSE;
};
//=============================================================================
/*
===========
ShamCheckAttack
The player is in view, so decide to move or launch an attack
Returns FALSE if movement should continue
============
*/
float() ShamCheckAttack =
{
local vector spot1, spot2;
local entity targ;
if (enemy_range == RANGE_MELEE)
{
if (CanDamage (self.enemy, self))
{
self.attack_state = AS_MELEE;
return TRUE;
}
}
if (time < self.attack_finished)
return FALSE;
if (!enemy_vis)
return FALSE;
targ = self.enemy;
// see if any entities are in the way of the shot
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
if (vlen(spot1 - spot2) > 600)
return FALSE;
traceline (spot1, spot2, FALSE, self);
if (trace_inopen && trace_inwater)
return FALSE; // sight line crossed contents
if (trace_ent != targ)
{
return FALSE; // don't have a clear shot
}
// missile attack
if (enemy_range == RANGE_FAR)
return FALSE;
self.attack_state = AS_MISSILE;
SUB_AttackFinished (2 + 2*random());
return TRUE;
};
//============================================================================
/*
===========
OgreCheckAttack
The player is in view, so decide to move or launch an attack
Returns FALSE if movement should continue
============
*/
float() OgreCheckAttack =
{
local vector spot1, spot2;
local entity targ;
local float chance;
if (enemy_range == RANGE_MELEE)
{
if (CanDamage (self.enemy, self))
{
self.attack_state = AS_MELEE;
return TRUE;
}
}
if (time < self.attack_finished)
return FALSE;
if (!enemy_vis)
return FALSE;
targ = self.enemy;
// see if any entities are in the way of the shot
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
traceline (spot1, spot2, FALSE, self);
if (trace_inopen && trace_inwater)
return FALSE; // sight line crossed contents
if (trace_ent != targ)
{
return FALSE; // don't have a clear shot
}
// missile attack
if (time < self.attack_finished)
return FALSE;
if (enemy_range == RANGE_FAR)
return FALSE;
else if (enemy_range == RANGE_NEAR)
chance = 0.10;
else if (enemy_range == RANGE_MID)
chance = 0.05;
else
chance = 0;
self.attack_state = AS_MISSILE;
SUB_AttackFinished (1 + 2*random());
return TRUE;
};

191
mod_mine/quakec_src/fish.qc Normal file
View File

@@ -0,0 +1,191 @@
$cd id1/models/fish
$origin 0 0 24
$base base
$skin skin
$frame attack1 attack2 attack3 attack4 attack5 attack6
$frame attack7 attack8 attack9 attack10 attack11 attack12 attack13
$frame attack14 attack15 attack16 attack17 attack18
$frame death1 death2 death3 death4 death5 death6 death7
$frame death8 death9 death10 death11 death12 death13 death14 death15
$frame death16 death17 death18 death19 death20 death21
$frame swim1 swim2 swim3 swim4 swim5 swim6 swim7 swim8
$frame swim9 swim10 swim11 swim12 swim13 swim14 swim15 swim16 swim17
$frame swim18
$frame pain1 pain2 pain3 pain4 pain5 pain6 pain7 pain8
$frame pain9
void() swimmonster_start;
void() f_stand1 =[ $swim1, f_stand2 ] {ai_stand();};
void() f_stand2 =[ $swim2, f_stand3 ] {ai_stand();};
void() f_stand3 =[ $swim3, f_stand4 ] {ai_stand();};
void() f_stand4 =[ $swim4, f_stand5 ] {ai_stand();};
void() f_stand5 =[ $swim5, f_stand6 ] {ai_stand();};
void() f_stand6 =[ $swim6, f_stand7 ] {ai_stand();};
void() f_stand7 =[ $swim7, f_stand8 ] {ai_stand();};
void() f_stand8 =[ $swim8, f_stand9 ] {ai_stand();};
void() f_stand9 =[ $swim9, f_stand10 ] {ai_stand();};
void() f_stand10 =[ $swim10, f_stand11 ] {ai_stand();};
void() f_stand11 =[ $swim11, f_stand12 ] {ai_stand();};
void() f_stand12 =[ $swim12, f_stand13 ] {ai_stand();};
void() f_stand13 =[ $swim13, f_stand14 ] {ai_stand();};
void() f_stand14 =[ $swim14, f_stand15 ] {ai_stand();};
void() f_stand15 =[ $swim15, f_stand16 ] {ai_stand();};
void() f_stand16 =[ $swim16, f_stand17 ] {ai_stand();};
void() f_stand17 =[ $swim17, f_stand18 ] {ai_stand();};
void() f_stand18 =[ $swim18, f_stand1 ] {ai_stand();};
void() f_walk1 =[ $swim1, f_walk2 ] {ai_walk(8);};
void() f_walk2 =[ $swim2, f_walk3 ] {ai_walk(8);};
void() f_walk3 =[ $swim3, f_walk4 ] {ai_walk(8);};
void() f_walk4 =[ $swim4, f_walk5 ] {ai_walk(8);};
void() f_walk5 =[ $swim5, f_walk6 ] {ai_walk(8);};
void() f_walk6 =[ $swim6, f_walk7 ] {ai_walk(8);};
void() f_walk7 =[ $swim7, f_walk8 ] {ai_walk(8);};
void() f_walk8 =[ $swim8, f_walk9 ] {ai_walk(8);};
void() f_walk9 =[ $swim9, f_walk10 ] {ai_walk(8);};
void() f_walk10 =[ $swim10, f_walk11 ] {ai_walk(8);};
void() f_walk11 =[ $swim11, f_walk12 ] {ai_walk(8);};
void() f_walk12 =[ $swim12, f_walk13 ] {ai_walk(8);};
void() f_walk13 =[ $swim13, f_walk14 ] {ai_walk(8);};
void() f_walk14 =[ $swim14, f_walk15 ] {ai_walk(8);};
void() f_walk15 =[ $swim15, f_walk16 ] {ai_walk(8);};
void() f_walk16 =[ $swim16, f_walk17 ] {ai_walk(8);};
void() f_walk17 =[ $swim17, f_walk18 ] {ai_walk(8);};
void() f_walk18 =[ $swim18, f_walk1 ] {ai_walk(8);};
void() f_run1 =[ $swim1, f_run2 ] {ai_run(12);
if (random() < 0.5)
sound (self, CHAN_VOICE, "fish/idle.wav", 1, ATTN_NORM);
};
void() f_run2 =[ $swim3, f_run3 ] {ai_run(12);};
void() f_run3 =[ $swim5, f_run4 ] {ai_run(12);};
void() f_run4 =[ $swim7, f_run5 ] {ai_run(12);};
void() f_run5 =[ $swim9, f_run6 ] {ai_run(12);};
void() f_run6 =[ $swim11, f_run7 ] {ai_run(12);};
void() f_run7 =[ $swim13, f_run8 ] {ai_run(12);};
void() f_run8 =[ $swim15, f_run9 ] {ai_run(12);};
void() f_run9 =[ $swim17, f_run1 ] {ai_run(12);};
void() fish_melee =
{
local vector delta;
local float ldmg;
if (!self.enemy)
return; // removed before stroke
delta = self.enemy.origin - self.origin;
if (vlen(delta) > 60)
return;
sound (self, CHAN_VOICE, "fish/bite.wav", 1, ATTN_NORM);
ldmg = (random() + random()) * 3;
T_Damage (self.enemy, self, self, ldmg);
};
void() f_attack1 =[ $attack1, f_attack2 ] {ai_charge(10);};
void() f_attack2 =[ $attack2, f_attack3 ] {ai_charge(10);};
void() f_attack3 =[ $attack3, f_attack4 ] {fish_melee();};
void() f_attack4 =[ $attack4, f_attack5 ] {ai_charge(10);};
void() f_attack5 =[ $attack5, f_attack6 ] {ai_charge(10);};
void() f_attack6 =[ $attack6, f_attack7 ] {ai_charge(10);};
void() f_attack7 =[ $attack7, f_attack8 ] {ai_charge(10);};
void() f_attack8 =[ $attack8, f_attack9 ] {ai_charge(10);};
void() f_attack9 =[ $attack9, f_attack10] {fish_melee();};
void() f_attack10 =[ $attack10, f_attack11] {ai_charge(10);};
void() f_attack11 =[ $attack11, f_attack12] {ai_charge(10);};
void() f_attack12 =[ $attack12, f_attack13] {ai_charge(10);};
void() f_attack13 =[ $attack13, f_attack14] {ai_charge(10);};
void() f_attack14 =[ $attack14, f_attack15] {ai_charge(10);};
void() f_attack15 =[ $attack15, f_attack16] {fish_melee();};
void() f_attack16 =[ $attack16, f_attack17] {ai_charge(10);};
void() f_attack17 =[ $attack17, f_attack18] {ai_charge(10);};
void() f_attack18 =[ $attack18, f_run1 ] {ai_charge(10);};
void() f_death1 =[ $death1, f_death2 ]
{
self.solid = SOLID_NOT;
sound (self, CHAN_VOICE, "fish/death.wav", 1, ATTN_NORM);
};
void() f_death2 =[ $death2, f_death3 ] {};
void() f_death3 =[ $death3, f_death4 ] {};
void() f_death4 =[ $death4, f_death5 ] {};
void() f_death5 =[ $death5, f_death6 ] {};
void() f_death6 =[ $death6, f_death7 ] {};
void() f_death7 =[ $death7, f_death8 ] {};
void() f_death8 =[ $death8, f_death9 ] {};
void() f_death9 =[ $death9, f_death10 ] {};
void() f_death10 =[ $death10, f_death11 ] {};
void() f_death11 =[ $death11, f_death12 ] {};
void() f_death12 =[ $death12, f_death13 ] {};
void() f_death13 =[ $death13, f_death14 ] {};
void() f_death14 =[ $death14, f_death15 ] {};
void() f_death15 =[ $death15, f_death16 ] {};
void() f_death16 =[ $death16, f_death17 ] {};
void() f_death17 =[ $death17, f_death18 ] {};
void() f_death18 =[ $death18, f_death19 ] {};
void() f_death19 =[ $death19, f_death20 ] {};
void() f_death20 =[ $death20, f_death21 ] {};
void() f_death21 =[ $death21, f_death21 ] {};
void() f_pain1 =[ $pain1, f_pain2 ] {};
void() f_pain2 =[ $pain2, f_pain3 ] {ai_pain(6);};
void() f_pain3 =[ $pain3, f_pain4 ] {ai_pain(6);};
void() f_pain4 =[ $pain4, f_pain5 ] {ai_pain(6);};
void() f_pain5 =[ $pain5, f_pain6 ] {ai_pain(6);};
void() f_pain6 =[ $pain6, f_pain7 ] {ai_pain(6);};
void() f_pain7 =[ $pain7, f_pain8 ] {ai_pain(6);};
void() f_pain8 =[ $pain8, f_pain9 ] {ai_pain(6);};
void() f_pain9 =[ $pain9, f_run1 ] {ai_pain(6);};
void(entity attacker, float damage) fish_pain =
{
// fish allways do pain frames
f_pain1 ();
};
/*QUAKED monster_fish (1 0 0) (-16 -16 -24) (16 16 24) Ambush
*/
void() monster_fish =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (deathmatch)
{
remove(self);
return;
}
precache_model2 ("progs/fish.mdl");
precache_sound2 ("fish/death.wav");
precache_sound2 ("fish/bite.wav");
precache_sound2 ("fish/idle.wav");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/fish.mdl");
setsize (self, '-16 -16 -24', '16 16 24');
if (!self.health) //thanks RennyC -- dumptruck_ds
self.health = 25;
self.th_stand = f_stand1;
self.th_walk = f_walk1;
self.th_run = f_run1;
self.th_die = f_death1;
self.th_pain = fish_pain;
self.th_melee = f_attack1;
swimmonster_start ();
};

View File

@@ -0,0 +1,194 @@
.float attack_timer;
.float bsporigin; // All bmodel origins are 0,0,0 check this first
.float distance;
.float waitmin2;
float BOB_COLLISION = 2; // Collision for misc_bob
float BOB_NONSOLID = 4; // Non solid for func_bob
/*QUAKED func_bob (0 .5 .8) ?
A SOLID bmodel that gently moves back and forth
-------- KEYS --------
targetname : trigger entity (works with entity state system)
angle : direction movement, use "360" for angle 0
height : direction intensity (def=8)
count : direction cycle timer (def=2s, minimum=1s)
waitmin : Speed up scale (def=1) 1+=non linear
waitmin2 : Slow down scale (def=0.75)
delay : Starting time delay (def=0, -1=random)
style : If set to 1, starts off and waits for trigger
_dirt : -1 = will be excluded from dirtmapping
_minlight : Minimum light level for any surface of the brush model
_mincolor : Minimum light color for any surface (def='1 1 1' RGB)
_shadow : Will cast shadows on other models and itself
_shadowself : Will cast shadows on itself
-------- SPAWNFLAGS --------
STARTOFF : Starts off and waits for trigger - DISABLED, Ripped out ESTATE System (RennyC)
-------- NOTES --------
A SOLID bmodel that gently moves back and forth
*/
//----------------------------------------------------------------------
void() func_bob_timer =
{
// Keep ticking in background, use local timer (faster)
self.think = func_bob_timer;
if (self.bsporigin)
self.nextthink = self.ltime + 0.1;
else
self.nextthink = time + 0.1;
// Has the cycle completed?
if (self.attack_timer < time)
{
// Setup bob cycle and half way point for slowdown
self.attack_timer = time + self.count;
self.distance = time + (self.count * 0.5);
// Flip direction of bmodel bob
self.lefty = 1 - self.lefty;
if (self.lefty < 1)
self.t_length = self.height;
else
self.t_length = -self.height;
// Always reset velocity and flags
self.velocity = '0 0 0';
self.flags = 0;
}
// Is the direction set?
// This is a block condition to prevent the bmodel moving
if (self.lefty != -1)
{
// Slow down velocity (gradually)
if (self.distance < time)
self.velocity = self.velocity * self.waitmin2;
else
{
// Speed up velocity (linear/exponentially)
self.t_length = self.t_length * self.waitmin;
self.velocity = self.velocity + (self.movedir * self.t_length);
}
}
};
//----------------------------------------------------------------------
void() func_bob_on =
{
// This may have been called as a "use" function, so don't allow it
// to be called repeatedly -- iw
self.use = SUB_Null;
if (self.bsporigin)
{
self.movetype = MOVETYPE_PUSH;
self.solid = SOLID_BSP;
}
else
{
self.movetype = MOVETYPE_FLY;
self.solid = SOLID_BBOX;
self.flags = 0; // Reset any onground flags
}
if (self.spawnflags & BOB_NONSOLID)
self.solid = SOLID_NOT;
setmodel (self, self.mdl);
setsize (self, self.mins , self.maxs);
self.think = func_bob_timer;
if (self.bsporigin)
self.nextthink = self.ltime + 0.1 + self.delay;
else
self.nextthink = time + 0.1 + self.delay;
};
//----------------------------------------------------------------------
void() func_bob_off =
{
if (self.bsporigin)
{
self.movetype = MOVETYPE_PUSH;
self.solid = SOLID_BSP;
}
else
{
self.movetype = MOVETYPE_FLY;
self.solid = SOLID_BBOX;
}
if (self.spawnflags & BOB_NONSOLID)
self.solid = SOLID_NOT;
setmodel (self, self.mdl);
setsize (self, self.mins , self.maxs);
self.velocity = '0 0 0';
if (self.style & 1)
self.use = func_bob_on;
};
//----------------------------------------------------------------------
void() func_bob =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
self.spawnflags = self.spawnflags | BOB_COLLISION;
if (self.spawnflags & BOB_NONSOLID)
self.spawnflags = self.spawnflags - (self.spawnflags & BOB_COLLISION);
// Using a custom model?
if (self.mdl == "")
{
self.bsporigin = TRUE;
self.mdl = self.model;
}
else
{
self.bsporigin = FALSE;
self.modelindex = 0;
self.model = "";
}
SetMovedir ();
self.movedir = normalize(self.movedir);
if (self.height <= 0)
self.height = 8; // Direction intensity
if (self.count < 1)
self.count = 2; // Direction switch timer
if (self.waitmin <= 0)
self.waitmin = 1; // Speed up
if (self.waitmin2 <= 0)
self.waitmin2 = 0.75; // Slow down
if (self.delay < 0)
self.delay = random() + random() + random();
// Setup Entity State functionality - Nope! (RennyC)
// if (self.targetname != "")
// self.use = func_bob_on;
if (!self.style) //added style key 1 for start off -- dumptruck_ds
func_bob_on();
else
func_bob_off();
};
//----------------------------------------------------------------------
/*QUAKED misc_bob (0 0.5 0.8) (-8 -8 -8) (8 8 8)
*/
void() misc_bob =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (self.mdl == "")
self.mdl = string_null;
precache_model(self.mdl);
func_bob();
};

View File

@@ -0,0 +1,219 @@
/* Counter QuickC program
By Jim Dose' 9/13/96
Copyright (c)1996 Hipnotic Interactive, Inc.
All rights reserved.
Do not distribute.
*/
float COUNTER_TOGGLE = 1;
float COUNTER_LOOP = 2;
float COUNTER_STEP = 4;
float COUNTER_RESET = 8;
float COUNTER_RANDOM = 16;
float COUNTER_FINISHCOUNT = 32;
float COUNTER_START_ON = 64;
void() counter_on_use;
void() counter_off_use;
void() counter_think =
{
self.cnt = self.cnt + 1;
if ( self.spawnflags & COUNTER_RANDOM )
{
self.state = random() * self.count;
self.state = floor( self.state ) + 1;
}
else
{
self.state = self.cnt;
}
// fix func_counter and func_oncount handling of activator -- iw
//activator = other;
activator = self.enemy;
SUB_UseTargets();
self.nextthink = time + self.wait;
if ( self.spawnflags & COUNTER_STEP )
{
counter_on_use();
}
if ( self.cnt >= self.count )
{
self.cnt = 0;
if ( ( self.aflag ) || !( self.spawnflags & COUNTER_LOOP ) )
{
if (self.spawnflags & COUNTER_TOGGLE)
{
counter_on_use();
}
else
{
remove (self);
}
}
}
};
// fix func_counter and func_oncount handling of activator -- iw
void() counter_start_on_think =
{
activator = world; // to ensure it's not a random entity -- iw
counter_off_use();
};
void() counter_on_use =
{
if ( ( self.cnt != 0 ) && ( self.spawnflags & COUNTER_FINISHCOUNT ) )
{
self.aflag = TRUE;
return;
}
self.use = counter_off_use;
self.think = SUB_Null;
self.aflag = FALSE;
};
void() counter_off_use =
{
self.aflag = FALSE;
if (self.spawnflags & COUNTER_TOGGLE)
{
self.use = counter_on_use;
}
else
{
self.use = SUB_Null;
}
if ( self.spawnflags & COUNTER_RESET )
{
self.cnt = 0;
self.state = 0;
}
// fix func_counter and func_oncount handling of activator -- iw
self.enemy = activator;
self.think = counter_think;
// fix "delay" making func_counter not work -- iw
//if (self.delay)
if (self.pausetime)
{
// fix "delay" making func_counter not work -- iw
//self.nextthink = time + self.delay;
self.nextthink = time + self.pausetime;
}
else
{
counter_think();
}
};
float( entity counter ) counter_GetCount =
{
if ( counter.classname == "counter" )
{
return counter.state;
}
return 0;
};
/*QUAKED func_counter (0 0 0.5) (0 0 0) (32 32 32) TOGGLE LOOP STEP RESET RANDOM FINISHCOUNT START_ON
TOGGLE causes the counter to switch between an on and off state
each time the counter is triggered.
LOOP causes the counter to repeat infinitly. The count resets to zero
after reaching the value in "count".
STEP causes the counter to only increment when triggered. Effectively,
this turns the counter into a relay with counting abilities.
RESET causes the counter to reset to 0 when restarted.
RANDOM causes the counter to generate random values in the range 1 to "count"
at the specified interval.
FINISHCOUNT causes the counter to continue counting until it reaches "count"
before shutting down even after being set to an off state.
START_ON causes the counter to be on when the level starts.
"count" specifies how many times to repeat the event. If LOOP is set,
it specifies how high to count before reseting to zero. Default is 10.
"wait" the length of time between each trigger event. Default is 1 second.
"delay" how much time to wait before firing after being switched on.
*/
void() func_counter =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if ( !self.wait )
{
self.wait = 1;
}
self.count = floor( self.count );
if ( self.count <= 0 )
{
self.count = 10;
}
// fix "delay" making func_counter not work -- iw
self.pausetime = self.delay;
self.delay = 0;
self.cnt = 0;
self.state = 0;
self.classname = "counter";
self.use = counter_off_use;
self.think = SUB_Null;
if ( self.spawnflags & COUNTER_START_ON )
{
// fix func_counter and func_oncount handling of activator -- iw
//self.think = counter_off_use;
self.think = counter_start_on_think;
self.nextthink = time + 0.1;
}
};
void() oncount_use =
{
if ( counter_GetCount( other ) == self.count )
{
// fix func_counter and func_oncount handling of activator -- iw
//activator = other;
SUB_UseTargets();
}
};
/*QUAKED func_oncount (0 0 0.5) (0 0 0) (16 16 16)
Must be used as the target for func_counter. When the counter
reaches the value set by count, func_oncount triggers its targets.
"count" specifies the value to trigger on. Default is 1.
"delay" how much time to wait before firing after being triggered.
*/
void() func_oncount =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
self.count = floor( self.count );
if ( self.count <= 0 )
{
self.count = 1;
}
self.classname = "oncount";
self.use = oncount_use;
self.think = SUB_Null;
};

View File

@@ -0,0 +1,314 @@
/* Particle effects QuickC program
By Jim Dose' 9/19/96
Copyright (c)1996 Hipnotic Interactive, Inc.
All rights reserved.
Do not distribute.
*/
//float START_OFF = 1;
float USE_COUNT = 1;
void () particlefield_XZ =
{
local vector pos;
local vector start;
local vector end;
if ( ( self.spawnflags & USE_COUNT ) &&
( counter_GetCount( other ) != self.cnt ) )
{
return;
}
// dprint( "XZ\n" );
self.ltime = time + 0.25;
if ( self.noise != "" )
{
sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
}
// Only show particles if client is visible.
// This helps to keep network traffic down to a minimum.
if (!checkclient() )
return;
start = self.dest1 + self.origin;
end = self.dest2 + self.origin;
pos_y = start_y;
pos_z = start_z;
while( pos_z <= end_z )
{
pos_x = start_x;
while( pos_x <= end_x )
{
particle ( pos, '0 0 0', self.color, self.count );
pos_x = pos_x + 16;
}
pos_z = pos_z + 16;
}
};
void () particlefield_YZ =
{
local vector pos;
local vector start;
local vector end;
if ( ( self.spawnflags & USE_COUNT ) &&
( counter_GetCount( other ) != self.cnt ) )
{
return;
}
// dprint( "YZ: " );
// dprint( vtos( self.dest1 ) );
// dprint( " - " );
// dprint( vtos( self.dest2 ) );
// dprint( "\n" );
self.ltime = time + 0.25;
if ( self.noise != "" )
{
sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
}
// Only show particles if client is visible.
// This helps to keep network traffic down to a minimum.
if (!checkclient() )
return;
start = self.dest1 + self.origin;
end = self.dest2 + self.origin;
pos_x = start_x;
pos_z = start_z;
while( pos_z < end_z )
{
pos_y = start_y;
while( pos_y < end_y )
{
particle ( pos, '0 0 0', self.color, self.count );
pos_y = pos_y + 16;
}
pos_z = pos_z + 16;
}
};
void () particlefield_XY =
{
local vector pos;
local vector start;
local vector end;
if ( ( self.spawnflags & USE_COUNT ) &&
( counter_GetCount( other ) != self.cnt ) )
{
return;
}
// dprint( "XY\n" );
self.ltime = time + 0.25;
if ( self.noise != "" )
{
sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
}
// Only show particles if client is visible.
// This helps to keep network traffic down to a minimum.
if (!checkclient() )
return;
start = self.dest1 + self.origin;
end = self.dest2 + self.origin;
pos_x = start_x;
pos_z = start_z;
while( pos_x < end_x )
{
pos_y = start_y;
while( pos_y < end_y )
{
particle ( pos, '0 0 0', self.color, self.count );
pos_y = pos_y + 16;
}
pos_x = pos_x + 16;
}
};
void () particlefield_touch =
{
if ( !self.dmg )
return;
if ( time > self.ltime)
return;
if (time < self.attack_finished)
return;
self.attack_finished = time + 0.5;
T_Damage (other, self, self, self.dmg);
};
/*QUAKED func_particlefield (0 .5 .8) ? USE_COUNT
Creates a brief particle flash roughly the size of the defining
brush each time it is triggered.
USE_COUNT when the activator is a func_counter, the field will only
activate when count is equal to "cnt". Same as using a func_oncount
to trigger.
"cnt" is the count to activate on when USE_COUNT is set.
"color" is the color of the particles. Default is 192 (yellow).
"count" is the density of the particles. Default is 2.
"noise" is the sound to play when triggered. Do not use a looping sound here.
"dmg" is the amount of damage to cause when touched.
*/
void() func_particlefield =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if ( !self.color )
{
self.color = 192;
}
if ( self.count == 0 )
{
self.count = 2;
}
self.classname = "particlefield";
self.solid = SOLID_NOT;
self.movetype = MOVETYPE_NONE;
setmodel (self, self.model);
self.model = string_null;
self.origin = ( self.mins + self.maxs ) * 0.5;
setorigin (self, self.origin);
self.dest = self.maxs - self.mins - '16 16 16';
self.dest1 = self.mins + '8 8 8' - self.origin;
self.dest2 = self.maxs + '7.9 7.9 7.9' - self.origin;
setsize (self, self.mins, self.maxs);
self.touch = particlefield_touch;
// dprint( vtos( self.dest ) );
// dprint( " " );
if ( self.dest_x > self.dest_z )
{
if ( self.dest_y > self.dest_z )
{
// dprint( "XY1 - " );
// dprint( ftos( self.cnt ) );
// dprint( "\n" );
self.use = particlefield_XY;
self.dest1_z = ( self.dest1_z + self.dest2_z ) / 2;
}
else
{
// dprint( "XZ1 - " );
// dprint( ftos( self.cnt ) );
// dprint( "\n" );
self.use = particlefield_XZ;
self.dest1_y = ( self.dest1_y + self.dest2_y ) / 2;
}
}
else
{
if ( self.dest_y > self.dest_x )
{
// dprint( "YZ2 - " );
// dprint( ftos( self.cnt ) );
// dprint( "\n" );
self.use = particlefield_YZ;
self.dest1_x = ( self.dest1_x + self.dest2_x ) / 2;
}
else
{
// dprint( "XZ2 - " );
// dprint( ftos( self.cnt ) );
// dprint( "\n" );
self.use = particlefield_XZ;
self.dest1_y = ( self.dest1_y + self.dest2_y ) / 2;
}
}
if ( self.noise != "" )
{
precache_sound( self.noise );
}
self.ltime = time;
};
void () blocker_touch =
{
if ( !self.dmg )
return;
if (time < self.attack_finished)
return;
self.attack_finished = time + 0.5;
T_Damage (other, self, self, self.dmg);
sound(self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
};
void () blocker_use =
{
if ( !self.state )
{
self.state = 1;
setorigin( self, self.origin - '8000 8000 8000' );
// sound(self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
}
else
{
self.state = 0;
setorigin( self, self.origin + '8000 8000 8000' );
sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
}
};
/*QUAKED func_togglewall (0 .5 .8) ? START_OFF
Creates a invisible wall that can be toggled on and off.
START_OFF wall doesn't block until triggered.
"noise" is the sound to play when wall is turned off.
"noise1" is the sound to play when wall is blocking.
"dmg" is the amount of damage to cause when touched.
*/
void() func_togglewall =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
self.classname = "togglewall";
self.movetype = MOVETYPE_PUSH;
self.mdl = self.model;
setmodel (self, self.model);
setsize (self, self.mins, self.maxs);
setorigin (self, self.origin);
self.touch = blocker_touch;
self.use = blocker_use;
if ( !self.noise )
{
self.noise = ("misc/null.wav");
}
if ( !self.noise1 )
{
self.noise1 = ("misc/null.wav");
}
precache_sound( self.noise );
precache_sound( self.noise1 );
self.solid = SOLID_BSP;
self.model = string_null;
if ( self.spawnflags & START_OFF )
{
self.state = 0;
setorigin( self, self.origin + '8000 8000 8000' );
}
else
{
self.state = 1;
sound(self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
}
};

View File

@@ -0,0 +1,238 @@
//Selections from hiptrig.qc NOT the entire file
/* Trigger QuickC program
By Jim Dose' 12/2/96
Copyright (c)1996 Hipnotic Interactive, Inc.
All rights reserved.
Do not distribute.
*/
float USE_SILV_KEY = 8;
float USE_GOLD_KEY = 16;
void() keytrigger_use =
{
if (activator.classname != "player")
return;
if (self.attack_finished > time)
return;
self.attack_finished = time + 2;
// FIXME: blink key on player's status bar
if ( (self.items & activator.items) != self.items )
{
if (self.message != "")
centerprint (activator, self.message);
else
{
if (self.items == IT_KEY1) //self.items was incorrect here, thanks Khreathor and spike
{
if (world.worldtype == 2)
centerprint (activator, "You need the silver keycard");
else if (world.worldtype == 1)
centerprint (activator, "You need the silver runekey");
else if (world.worldtype == 0)
centerprint (activator, "You need the silver key");
}
else
{
if (world.worldtype == 2)
centerprint (activator, "You need the gold keycard");
else if (world.worldtype == 1)
centerprint (activator, "You need the gold runekey");
else if (world.worldtype == 0)
centerprint (activator, "You need the gold key");
}
}
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
return;
}
if (!self.cnt) //dumptruck_ds thanks RennyC -- set cnt 1 to leave key in player inventory
activator.items = activator.items - self.items;
// we can't just remove (self) here, because this is a touch function
// called while C code is looping through area links...
self.touch = SUB_Null;
self.use = SUB_Null;
self.nextthink = time + 0.1;
self.think = SUB_Remove;
self.message = "";
sound (self, CHAN_ITEM, self.noise4, 1, ATTN_NORM); //dumptruck_ds CHAN_VOICE becomes CHAN_ITEM
SUB_UseTargets();
};
void() keytrigger_touch =
{
activator = other;
keytrigger_use();
};
/*QUAKED trigger_usekey (0 .5 0) ? USE_GOLD_KEY
Variable sized single use trigger that requires a key to trigger targets. Must be targeted at one or more entities.
"message" is printed when the trigger is touched without having the right key.
*/
void() trigger_usekey =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (world.worldtype == 0)
{
precache_sound ("doors/medtry.wav");
precache_sound ("doors/meduse.wav");
self.noise3 = "doors/medtry.wav";
self.noise4 = "doors/meduse.wav";
}
else if (world.worldtype == 1)
{
precache_sound ("doors/runetry.wav");
precache_sound ("doors/runeuse.wav");
self.noise3 = "doors/runetry.wav";
self.noise4 = "doors/runeuse.wav";
}
else if (world.worldtype == 2)
{
precache_sound ("doors/basetry.wav");
precache_sound ("doors/baseuse.wav");
self.noise3 = "doors/basetry.wav";
self.noise4 = "doors/baseuse.wav";
}
else
dprint ("no worldtype set!\n");
if (!self.spawnflags) //dumptruck_ds thanks c0burn
{
objerror ("no spawnflags set!\n");
remove(self);
return;
}
if (self.spawnflags & USE_SILV_KEY) //dumptruck_ds
self.items = IT_KEY1;
if (self.spawnflags & USE_GOLD_KEY) //dumptruck_ds
self.items = IT_KEY2;
self.use = keytrigger_use;
self.touch = keytrigger_touch;
InitTrigger ();
};
// void() remove_touch =
// {
// if (other.flags & self.cnt)
// return;
// other.touch = SUB_Null;
// other.model = "";
// remove(self);
// };
//
// /*QUAKED trigger_remove (.5 .5 .5) ? ignoremonsters ignoreplayers
// Variable sized trigger that removes the thing
// that touches it. Does not affect monsters or
// players.
// */
// void() trigger_remove =
// {
// if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
// return;
//
// self.cnt = FL_CLIENT|FL_MONSTER;
// if (self.spawnflags & 1)
// self.cnt = self.cnt - FL_MONSTER;
// if (self.spawnflags & 2)
// self.cnt = self.cnt - FL_CLIENT;
// InitTrigger ();
// self.touch = remove_touch;
// };
/*
==============================================================================
trigger_setgravity
==============================================================================
*/
float DT_GRAVTOFF = 8; // trigger will start off
void() grav_toggle = //dumptruck_ds based on hipnotic blocker_use
{
if ( !self.state )
{
self.state = 1;
setorigin( self, self.origin - '8000 8000 8000');
}
else
{
self.state = 0;
setorigin( self, self.origin + '8000 8000 8000');
}
};
void() trigger_gravity_touch =
{
local float grav;
// This is commented out so that the changing gravity will
// affect everything, if you don't want to use all affecting
// gravity changes, then uncomment these two lines.
// if (other.classname != "player")
// return;
if (self.gravity == -1)
grav = 1;
else
grav = self.gravity;
// the player's gravity is now managed in PlayerPreThink(), however
// other entities don't have special gravity management, so their
// gravity is still set directly -- iw
if (other.classname == "player")
other.wantedgravity = grav;
else
other.gravity = grav;
};
/*QUAKED trigger_setgravity (.5 .5 .5) ?
set the gravity of a player
"gravity" what to set the players gravity to
- 0 (default) normal gravity
- 1 no gravity
- 2 almost no gravity
- 10 is a good setting
- ...
- 101 normal gravity
- 102 slightly higher gravity
- ...
- 1000 very high gravity
*/
void() trigger_setgravity =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
InitTrigger ();
self.use = grav_toggle; // dumptruck_ds
self.touch = trigger_gravity_touch;
if ( self.spawnflags & DT_GRAVTOFF ) //dumptruck_ds
{
self.state = 0;
setorigin( self, self.origin + '8000 8000 8000' );
}
else
{
self.state = 1;
} //end dumptruck_ds
if (!self.gravity)
self.gravity = -1;
else
self.gravity = ((self.gravity - 1) / 100);
};

View File

@@ -0,0 +1,485 @@
/*
==============================================================================
KNIGHT
==============================================================================
*/
$cd id1/models/knight2
$origin 0 0 24
$base base
$skin skin
$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9
$frame walk10 walk11 walk12 walk13 walk14 walk15 walk16 walk17
$frame walk18 walk19 walk20
$frame run1 run2 run3 run4 run5 run6 run7 run8
$frame pain1 pain2 pain3 pain4 pain5
$frame death1 death2 death3 death4 death5 death6 death7 death8
$frame death9 death10 death11 death12
$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
$frame deathb9
$frame char_a1 char_a2 char_a3 char_a4 char_a5 char_a6 char_a7 char_a8
$frame char_a9 char_a10 char_a11 char_a12 char_a13 char_a14 char_a15 char_a16
$frame magica1 magica2 magica3 magica4 magica5 magica6 magica7 magica8
$frame magica9 magica10 magica11 magica12 magica13 magica14
$frame magicb1 magicb2 magicb3 magicb4 magicb5 magicb6 magicb7 magicb8
$frame magicb9 magicb10 magicb11 magicb12 magicb13
$frame char_b1 char_b2 char_b3 char_b4 char_b5 char_b6
$frame slice1 slice2 slice3 slice4 slice5 slice6 slice7 slice8 slice9 slice10
$frame smash1 smash2 smash3 smash4 smash5 smash6 smash7 smash8 smash9 smash10
$frame smash11
$frame w_attack1 w_attack2 w_attack3 w_attack4 w_attack5 w_attack6 w_attack7
$frame w_attack8 w_attack9 w_attack10 w_attack11 w_attack12 w_attack13 w_attack14
$frame w_attack15 w_attack16 w_attack17 w_attack18 w_attack19 w_attack20
$frame w_attack21 w_attack22
$frame magicc1 magicc2 magicc3 magicc4 magicc5 magicc6 magicc7 magicc8
$frame magicc9 magicc10 magicc11
void() hknight_char_a1;
void() hknight_run1;
void() hk_idle_sound;
void(float offset) hknight_shot =
{
local vector offang;
local vector org, vec;
offang = vectoangles (self.enemy.origin - self.origin);
offang_y = offang_y + offset * 6;
makevectors (offang);
org = self.origin + self.mins + self.size*0.5 + v_forward * 20;
// set missile speed
vec = normalize (v_forward);
vec_z = 0 - vec_z + (random() - 0.5)*0.1;
launch_spike (org, vec);
newmis.classname = "knightspike";
setmodel (newmis, "progs/k_spike.mdl");
setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
newmis.velocity = vec*300;
sound (self, CHAN_WEAPON, "hknight/attack1.wav", 1, ATTN_NORM);
};
void() CheckForCharge =
{
// check for mad charge
if (!enemy_vis)
return;
if (time < self.attack_finished)
return;
if ( fabs(self.origin_z - self.enemy.origin_z) > 20)
return; // too much height change
if ( vlen (self.origin - self.enemy.origin) < 80)
return; // use regular attack
// charge
SUB_AttackFinished (2);
hknight_char_a1 ();
};
void() CheckContinueCharge =
{
if (time > self.attack_finished)
{
SUB_AttackFinished (3);
hknight_run1 ();
return; // done charging
}
if (random() > 0.5)
sound (self, CHAN_WEAPON, "knight/sword2.wav", 1, ATTN_NORM);
else
sound (self, CHAN_WEAPON, "knight/sword1.wav", 1, ATTN_NORM);
};
//===========================================================================
void() hknight_stand1 =[ $stand1, hknight_stand2 ] {ai_stand();};
void() hknight_stand2 =[ $stand2, hknight_stand3 ] {ai_stand();};
void() hknight_stand3 =[ $stand3, hknight_stand4 ] {ai_stand();};
void() hknight_stand4 =[ $stand4, hknight_stand5 ] {ai_stand();};
void() hknight_stand5 =[ $stand5, hknight_stand6 ] {ai_stand();};
void() hknight_stand6 =[ $stand6, hknight_stand7 ] {ai_stand();};
void() hknight_stand7 =[ $stand7, hknight_stand8 ] {ai_stand();};
void() hknight_stand8 =[ $stand8, hknight_stand9 ] {ai_stand();};
void() hknight_stand9 =[ $stand9, hknight_stand1 ] {ai_stand();};
//===========================================================================
void() hknight_walk1 =[ $walk1, hknight_walk2 ] {
hk_idle_sound();
ai_walk(2);};
void() hknight_walk2 =[ $walk2, hknight_walk3 ] {ai_walk(5);};
void() hknight_walk3 =[ $walk3, hknight_walk4 ] {ai_walk(5);};
void() hknight_walk4 =[ $walk4, hknight_walk5 ] {ai_walk(4);};
void() hknight_walk5 =[ $walk5, hknight_walk6 ] {ai_walk(4);};
void() hknight_walk6 =[ $walk6, hknight_walk7 ] {ai_walk(2);};
void() hknight_walk7 =[ $walk7, hknight_walk8 ] {ai_walk(2);};
void() hknight_walk8 =[ $walk8, hknight_walk9 ] {ai_walk(3);};
void() hknight_walk9 =[ $walk9, hknight_walk10 ] {ai_walk(3);};
void() hknight_walk10 =[ $walk10, hknight_walk11 ] {ai_walk(4);};
void() hknight_walk11 =[ $walk11, hknight_walk12 ] {ai_walk(3);};
void() hknight_walk12 =[ $walk12, hknight_walk13 ] {ai_walk(4);};
void() hknight_walk13 =[ $walk13, hknight_walk14 ] {ai_walk(6);};
void() hknight_walk14 =[ $walk14, hknight_walk15 ] {ai_walk(2);};
void() hknight_walk15 =[ $walk15, hknight_walk16 ] {ai_walk(2);};
void() hknight_walk16 =[ $walk16, hknight_walk17 ] {ai_walk(4);};
void() hknight_walk17 =[ $walk17, hknight_walk18 ] {ai_walk(3);};
void() hknight_walk18 =[ $walk18, hknight_walk19 ] {ai_walk(3);};
void() hknight_walk19 =[ $walk19, hknight_walk20 ] {ai_walk(3);};
void() hknight_walk20 =[ $walk20, hknight_walk1 ] {ai_walk(2);};
//===========================================================================
void() hknight_run1 =[ $run1, hknight_run2 ] {
hk_idle_sound();
ai_run (20); CheckForCharge (); };
void() hknight_run2 =[ $run2, hknight_run3 ] {ai_run(25);};
void() hknight_run3 =[ $run3, hknight_run4 ] {ai_run(18);};
void() hknight_run4 =[ $run4, hknight_run5 ] {ai_run(16);};
void() hknight_run5 =[ $run5, hknight_run6 ] {ai_run(14);};
void() hknight_run6 =[ $run6, hknight_run7 ] {ai_run(25);};
void() hknight_run7 =[ $run7, hknight_run8 ] {ai_run(21);};
void() hknight_run8 =[ $run8, hknight_run1 ] {ai_run(13);};
//============================================================================
void() hknight_pain1 =[ $pain1, hknight_pain2 ] {sound (self, CHAN_VOICE, "hknight/pain1.wav", 1, ATTN_NORM);};
void() hknight_pain2 =[ $pain2, hknight_pain3 ] {};
void() hknight_pain3 =[ $pain3, hknight_pain4 ] {};
void() hknight_pain4 =[ $pain4, hknight_pain5 ] {};
void() hknight_pain5 =[ $pain5, hknight_run1 ] {};
//============================================================================
void() hknight_die1 =[ $death1, hknight_die2 ] {ai_forward(10);};
void() hknight_die2 =[ $death2, hknight_die3 ] {ai_forward(8);};
void() hknight_die3 =[ $death3, hknight_die4 ]
{self.solid = SOLID_NOT; ai_forward(7);};
void() hknight_die4 =[ $death4, hknight_die5 ] {};
void() hknight_die5 =[ $death5, hknight_die6 ] {};
void() hknight_die6 =[ $death6, hknight_die7 ] {};
void() hknight_die7 =[ $death7, hknight_die8 ] {};
void() hknight_die8 =[ $death8, hknight_die9 ] {ai_forward(10);};
void() hknight_die9 =[ $death9, hknight_die10 ] {ai_forward(11);};
void() hknight_die10 =[ $death10, hknight_die11 ] {};
void() hknight_die11 =[ $death11, hknight_die12 ] {};
void() hknight_die12 =[ $death12, hknight_die12 ] {};
void() hknight_dieb1 =[ $deathb1, hknight_dieb2 ] {};
void() hknight_dieb2 =[ $deathb2, hknight_dieb3 ] {};
void() hknight_dieb3 =[ $deathb3, hknight_dieb4 ]
{self.solid = SOLID_NOT;};
void() hknight_dieb4 =[ $deathb4, hknight_dieb5 ] {};
void() hknight_dieb5 =[ $deathb5, hknight_dieb6 ] {};
void() hknight_dieb6 =[ $deathb6, hknight_dieb7 ] {};
void() hknight_dieb7 =[ $deathb7, hknight_dieb8 ] {};
void() hknight_dieb8 =[ $deathb8, hknight_dieb9 ] {};
void() hknight_dieb9 =[ $deathb9, hknight_dieb9 ] {};
void() hknight_die =
{
// check for gib
if (self.health < -40)
{
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_hellkn.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
return;
}
// regular death
sound (self, CHAN_VOICE, "hknight/death1.wav", 1, ATTN_NORM);
if (random() > 0.5)
hknight_die1 ();
else
hknight_dieb1 ();
};
//============================================================================
void() hknight_magica1 =[ $magica1, hknight_magica2 ] {ai_face();};
void() hknight_magica2 =[ $magica2, hknight_magica3 ] {ai_face();};
void() hknight_magica3 =[ $magica3, hknight_magica4 ] {ai_face();};
void() hknight_magica4 =[ $magica4, hknight_magica5 ] {ai_face();};
void() hknight_magica5 =[ $magica5, hknight_magica6 ] {ai_face();};
void() hknight_magica6 =[ $magica6, hknight_magica7 ] {ai_face();};
void() hknight_magica7 =[ $magica7, hknight_magica8 ] {hknight_shot(-2);};
void() hknight_magica8 =[ $magica8, hknight_magica9 ] {hknight_shot(-1);};
void() hknight_magica9 =[ $magica9, hknight_magica10] {hknight_shot(0);};
void() hknight_magica10 =[ $magica10, hknight_magica11] {hknight_shot(1);};
void() hknight_magica11 =[ $magica11, hknight_magica12] {hknight_shot(2);};
void() hknight_magica12 =[ $magica12, hknight_magica13] {hknight_shot(3);};
void() hknight_magica13 =[ $magica13, hknight_magica14] {ai_face();};
void() hknight_magica14 =[ $magica14, hknight_run1 ] {ai_face();};
//============================================================================
void() hknight_magicb1 =[ $magicb1, hknight_magicb2 ] {ai_face();};
void() hknight_magicb2 =[ $magicb2, hknight_magicb3 ] {ai_face();};
void() hknight_magicb3 =[ $magicb3, hknight_magicb4 ] {ai_face();};
void() hknight_magicb4 =[ $magicb4, hknight_magicb5 ] {ai_face();};
void() hknight_magicb5 =[ $magicb5, hknight_magicb6 ] {ai_face();};
void() hknight_magicb6 =[ $magicb6, hknight_magicb7 ] {ai_face();};
void() hknight_magicb7 =[ $magicb7, hknight_magicb8 ] {hknight_shot(-2);};
void() hknight_magicb8 =[ $magicb8, hknight_magicb9 ] {hknight_shot(-1);};
void() hknight_magicb9 =[ $magicb9, hknight_magicb10] {hknight_shot(0);};
void() hknight_magicb10 =[ $magicb10, hknight_magicb11] {hknight_shot(1);};
void() hknight_magicb11 =[ $magicb11, hknight_magicb12] {hknight_shot(2);};
void() hknight_magicb12 =[ $magicb12, hknight_magicb13] {hknight_shot(3);};
void() hknight_magicb13 =[ $magicb13, hknight_run1] {ai_face();};
//============================================================================
void() hknight_magicc1 =[ $magicc1, hknight_magicc2 ] {ai_face();};
void() hknight_magicc2 =[ $magicc2, hknight_magicc3 ] {ai_face();};
void() hknight_magicc3 =[ $magicc3, hknight_magicc4 ] {ai_face();};
void() hknight_magicc4 =[ $magicc4, hknight_magicc5 ] {ai_face();};
void() hknight_magicc5 =[ $magicc5, hknight_magicc6 ] {ai_face();};
void() hknight_magicc6 =[ $magicc6, hknight_magicc7 ] {hknight_shot(-2);};
void() hknight_magicc7 =[ $magicc7, hknight_magicc8 ] {hknight_shot(-1);};
void() hknight_magicc8 =[ $magicc8, hknight_magicc9 ] {hknight_shot(0);};
void() hknight_magicc9 =[ $magicc9, hknight_magicc10] {hknight_shot(1);};
void() hknight_magicc10 =[ $magicc10, hknight_magicc11] {hknight_shot(2);};
void() hknight_magicc11 =[ $magicc11, hknight_run1] {hknight_shot(3);};
//===========================================================================
void() hknight_char_a1 =[ $char_a1, hknight_char_a2 ] {ai_charge(20);};
void() hknight_char_a2 =[ $char_a2, hknight_char_a3 ] {ai_charge(25);};
void() hknight_char_a3 =[ $char_a3, hknight_char_a4 ] {ai_charge(18);};
void() hknight_char_a4 =[ $char_a4, hknight_char_a5 ] {ai_charge(16);};
void() hknight_char_a5 =[ $char_a5, hknight_char_a6 ] {ai_charge(14);};
void() hknight_char_a6 =[ $char_a6, hknight_char_a7 ] {ai_charge(20); ai_melee();};
void() hknight_char_a7 =[ $char_a7, hknight_char_a8 ] {ai_charge(21); ai_melee();};
void() hknight_char_a8 =[ $char_a8, hknight_char_a9 ] {ai_charge(13); ai_melee();};
void() hknight_char_a9 =[ $char_a9, hknight_char_a10 ] {ai_charge(20); ai_melee();};
void() hknight_char_a10=[ $char_a10, hknight_char_a11 ] {ai_charge(20); ai_melee();};
void() hknight_char_a11=[ $char_a11, hknight_char_a12 ] {ai_charge(18); ai_melee();};
void() hknight_char_a12=[ $char_a12, hknight_char_a13 ] {ai_charge(16);};
void() hknight_char_a13=[ $char_a13, hknight_char_a14 ] {ai_charge(14);};
void() hknight_char_a14=[ $char_a14, hknight_char_a15 ] {ai_charge(25);};
void() hknight_char_a15=[ $char_a15, hknight_char_a16 ] {ai_charge(21);};
void() hknight_char_a16=[ $char_a16, hknight_run1 ] {ai_charge(13);};
//===========================================================================
void() hknight_char_b1 =[ $char_b1, hknight_char_b2 ]
{CheckContinueCharge (); ai_charge(23); ai_melee();};
void() hknight_char_b2 =[ $char_b2, hknight_char_b3 ] {ai_charge(17); ai_melee();};
void() hknight_char_b3 =[ $char_b3, hknight_char_b4 ] {ai_charge(12); ai_melee();};
void() hknight_char_b4 =[ $char_b4, hknight_char_b5 ] {ai_charge(22); ai_melee();};
void() hknight_char_b5 =[ $char_b5, hknight_char_b6 ] {ai_charge(18); ai_melee();};
void() hknight_char_b6 =[ $char_b6, hknight_char_b1 ] {ai_charge(8); ai_melee();};
//===========================================================================
void() hknight_slice1 =[ $slice1, hknight_slice2 ] {ai_charge(9);};
void() hknight_slice2 =[ $slice2, hknight_slice3 ] {ai_charge(6);};
void() hknight_slice3 =[ $slice3, hknight_slice4 ] {ai_charge(13);};
void() hknight_slice4 =[ $slice4, hknight_slice5 ] {ai_charge(4);};
void() hknight_slice5 =[ $slice5, hknight_slice6 ] {ai_charge(7); ai_melee();};
void() hknight_slice6 =[ $slice6, hknight_slice7 ] {ai_charge(15); ai_melee();};
void() hknight_slice7 =[ $slice7, hknight_slice8 ] {ai_charge(8); ai_melee();};
void() hknight_slice8 =[ $slice8, hknight_slice9 ] {ai_charge(2); ai_melee();};
void() hknight_slice9 =[ $slice9, hknight_slice10 ] {ai_melee();};
void() hknight_slice10 =[ $slice10, hknight_run1 ] {ai_charge(3);};
//===========================================================================
void() hknight_smash1 =[ $smash1, hknight_smash2 ] {ai_charge(1);};
void() hknight_smash2 =[ $smash2, hknight_smash3 ] {ai_charge(13);};
void() hknight_smash3 =[ $smash3, hknight_smash4 ] {ai_charge(9);};
void() hknight_smash4 =[ $smash4, hknight_smash5 ] {ai_charge(11);};
void() hknight_smash5 =[ $smash5, hknight_smash6 ] {ai_charge(10); ai_melee();};
void() hknight_smash6 =[ $smash6, hknight_smash7 ] {ai_charge(7); ai_melee();};
void() hknight_smash7 =[ $smash7, hknight_smash8 ] {ai_charge(12); ai_melee();};
void() hknight_smash8 =[ $smash8, hknight_smash9 ] {ai_charge(2); ai_melee();};
void() hknight_smash9 =[ $smash9, hknight_smash10 ] {ai_charge(3); ai_melee();};
void() hknight_smash10 =[ $smash10, hknight_smash11 ] {ai_charge(0);};
void() hknight_smash11 =[ $smash11, hknight_run1 ] {ai_charge(0);};
//============================================================================
void() hknight_watk1 =[ $w_attack1, hknight_watk2 ] {ai_charge(2);};
void() hknight_watk2 =[ $w_attack2, hknight_watk3 ] {ai_charge(0);};
void() hknight_watk3 =[ $w_attack3, hknight_watk4 ] {ai_charge(0);};
void() hknight_watk4 =[ $w_attack4, hknight_watk5 ] {ai_melee();};
void() hknight_watk5 =[ $w_attack5, hknight_watk6 ] {ai_melee();};
void() hknight_watk6 =[ $w_attack6, hknight_watk7 ] {ai_melee();};
void() hknight_watk7 =[ $w_attack7, hknight_watk8 ] {ai_charge(1);};
void() hknight_watk8 =[ $w_attack8, hknight_watk9 ] {ai_charge(4);};
void() hknight_watk9 =[ $w_attack9, hknight_watk10 ] {ai_charge(5);};
void() hknight_watk10 =[ $w_attack10, hknight_watk11 ] {ai_charge(3); ai_melee();};
void() hknight_watk11 =[ $w_attack11, hknight_watk12 ] {ai_charge(2); ai_melee();};
void() hknight_watk12 =[ $w_attack12, hknight_watk13 ] {ai_charge(2); ai_melee();};
void() hknight_watk13 =[ $w_attack13, hknight_watk14 ] {ai_charge(0);};
void() hknight_watk14 =[ $w_attack14, hknight_watk15 ] {ai_charge(0);};
void() hknight_watk15 =[ $w_attack15, hknight_watk16 ] {ai_charge(0);};
void() hknight_watk16 =[ $w_attack16, hknight_watk17 ] {ai_charge(1);};
void() hknight_watk17 =[ $w_attack17, hknight_watk18 ] {ai_charge(1); ai_melee();};
void() hknight_watk18 =[ $w_attack18, hknight_watk19 ] {ai_charge(3); ai_melee();};
void() hknight_watk19 =[ $w_attack19, hknight_watk20 ] {ai_charge(4); ai_melee();};
void() hknight_watk20 =[ $w_attack20, hknight_watk21 ] {ai_charge(6);};
void() hknight_watk21 =[ $w_attack21, hknight_watk22 ] {ai_charge(7);};
void() hknight_watk22 =[ $w_attack22, hknight_run1 ] {ai_charge(3);};
//============================================================================
void() hk_idle_sound =
{
if (random() < 0.2)
sound (self, CHAN_VOICE, "hknight/idle.wav", 1, ATTN_NORM);
};
void(entity attacker, float damage) hknight_pain =
{
if (self.pain_finished > time)
return;
sound (self, CHAN_VOICE, "hknight/pain1.wav", 1, ATTN_NORM);
if (time - self.pain_finished > 5)
{ // allways go into pain frame if it has been a while
hknight_pain1 ();
self.pain_finished = time + 1;
return;
}
if ((random()*30 > damage) )
return; // didn't flinch
self.pain_finished = time + 1;
hknight_pain1 ();
};
float hknight_type;
void() hknight_melee =
{
hknight_type = hknight_type + 1;
sound (self, CHAN_WEAPON, "hknight/slash1.wav", 1, ATTN_NORM);
if (hknight_type == 1)
hknight_slice1 ();
else if (hknight_type == 2)
hknight_smash1 ();
else if (hknight_type == 3)
{
hknight_watk1 ();
hknight_type = 0;
}
};
/*QUAKED monster_hell_knight (1 0 0) (-16 -16 -24) (16 16 40) Ambush
*/
void() monster_hell_knight =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (deathmatch)
{
remove(self);
return;
}
precache_model2 ("progs/hknight.mdl");
precache_model2 ("progs/k_spike.mdl");
precache_model2 ("progs/h_hellkn.mdl");
precache_sound2 ("hknight/attack1.wav");
precache_sound2 ("hknight/death1.wav");
precache_sound2 ("hknight/pain1.wav");
precache_sound2 ("hknight/sight1.wav");
precache_sound ("hknight/hit.wav"); // used by C code, so don't sound2
precache_sound2 ("hknight/slash1.wav");
precache_sound2 ("hknight/idle.wav");
precache_sound2 ("hknight/grunt.wav");
precache_sound ("knight/sword1.wav");
precache_sound ("knight/sword2.wav");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/hknight.mdl");
setsize (self, '-16 -16 -24', '16 16 40');
if (!self.health) //thanks RennyC -- dumptruck_ds
self.health = 250;
self.th_stand = hknight_stand1;
self.th_walk = hknight_walk1;
self.th_run = hknight_run1;
self.th_melee = hknight_melee;
self.th_missile = hknight_magicc1;
self.th_pain = hknight_pain;
self.th_die = hknight_die;
walkmonster_start ();
};
/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */
/*QUAKED monster_dead_hell_knight (0 0.5 0.8) (-16 -16 -24) (16 16 32)
*/
void() monster_dead_hell_knight =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_model("progs/hknight.mdl");
setmodel(self, "progs/hknight.mdl");
if (self.spawnflags & 2)
{
self.frame = $deathb9;
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
setsize(self,'-68.96 -20.43 -53.98','34.8 21.15 30');
}
else
{
self.solid = SOLID_NOT;
}
}
else
{
self.frame = $death12;
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
setsize(self,'-42.05 -31.07 -51.56','46.34 25.02 30');
}
else
{
self.solid = SOLID_NOT;
}
}
};

1738
mod_mine/quakec_src/items.qc Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,316 @@
/*
==============================================================================
KNIGHT
==============================================================================
*/
$cd id1/models/knight
$origin 0 0 24
$base base
$skin badass3
$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
$frame runb1 runb2 runb3 runb4 runb5 runb6 runb7 runb8
//frame runc1 runc2 runc3 runc4 runc5 runc6
$frame runattack1 runattack2 runattack3 runattack4 runattack5
$frame runattack6 runattack7 runattack8 runattack9 runattack10
$frame runattack11
$frame pain1 pain2 pain3
$frame painb1 painb2 painb3 painb4 painb5 painb6 painb7 painb8 painb9
$frame painb10 painb11
//frame attack1 attack2 attack3 attack4 attack5 attack6 attack7
//frame attack8 attack9 attack10 attack11
$frame attackdummy
$frame attackb1 attackb2 attackb3 attackb4 attackb5
$frame attackb6 attackb7 attackb8 attackb9 attackb10
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9
$frame walk10 walk11 walk12 walk13 walk14
$frame kneel1 kneel2 kneel3 kneel4 kneel5
$frame standing2 standing3 standing4 standing5
$frame death1 death2 death3 death4 death5 death6 death7 death8
$frame death9 death10
$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
$frame deathb9 deathb10 deathb11
void() knight_stand1 =[ $stand1, knight_stand2 ] {ai_stand();};
void() knight_stand2 =[ $stand2, knight_stand3 ] {ai_stand();};
void() knight_stand3 =[ $stand3, knight_stand4 ] {ai_stand();};
void() knight_stand4 =[ $stand4, knight_stand5 ] {ai_stand();};
void() knight_stand5 =[ $stand5, knight_stand6 ] {ai_stand();};
void() knight_stand6 =[ $stand6, knight_stand7 ] {ai_stand();};
void() knight_stand7 =[ $stand7, knight_stand8 ] {ai_stand();};
void() knight_stand8 =[ $stand8, knight_stand9 ] {ai_stand();};
void() knight_stand9 =[ $stand9, knight_stand1 ] {ai_stand();};
void() knight_walk1 =[ $walk1, knight_walk2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "knight/idle.wav", 1, ATTN_IDLE);
ai_walk(3);};
void() knight_walk2 =[ $walk2, knight_walk3 ] {ai_walk(2);};
void() knight_walk3 =[ $walk3, knight_walk4 ] {ai_walk(3);};
void() knight_walk4 =[ $walk4, knight_walk5 ] {ai_walk(4);};
void() knight_walk5 =[ $walk5, knight_walk6 ] {ai_walk(3);};
void() knight_walk6 =[ $walk6, knight_walk7 ] {ai_walk(3);};
void() knight_walk7 =[ $walk7, knight_walk8 ] {ai_walk(3);};
void() knight_walk8 =[ $walk8, knight_walk9 ] {ai_walk(4);};
void() knight_walk9 =[ $walk9, knight_walk10 ] {ai_walk(3);};
void() knight_walk10 =[ $walk10, knight_walk11 ] {ai_walk(3);};
void() knight_walk11 =[ $walk11, knight_walk12 ] {ai_walk(2);};
void() knight_walk12 =[ $walk12, knight_walk13 ] {ai_walk(3);};
void() knight_walk13 =[ $walk13, knight_walk14 ] {ai_walk(4);};
void() knight_walk14 =[ $walk14, knight_walk1 ] {ai_walk(3);};
void() knight_run1 =[ $runb1, knight_run2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "knight/idle.wav", 1, ATTN_IDLE);
ai_run(16);};
void() knight_run2 =[ $runb2, knight_run3 ] {ai_run(20);};
void() knight_run3 =[ $runb3, knight_run4 ] {ai_run(13);};
void() knight_run4 =[ $runb4, knight_run5 ] {ai_run(7);};
void() knight_run5 =[ $runb5, knight_run6 ] {ai_run(16);};
void() knight_run6 =[ $runb6, knight_run7 ] {ai_run(20);};
void() knight_run7 =[ $runb7, knight_run8 ] {ai_run(14);};
void() knight_run8 =[ $runb8, knight_run1 ] {ai_run(6);};
void() knight_runatk1 =[ $runattack1, knight_runatk2 ]
{
if (random() > 0.5)
sound (self, CHAN_WEAPON, "knight/sword2.wav", 1, ATTN_NORM);
else
sound (self, CHAN_WEAPON, "knight/sword1.wav", 1, ATTN_NORM);
ai_charge(20);
};
void() knight_runatk2 =[ $runattack2, knight_runatk3 ] {ai_charge_side();};
void() knight_runatk3 =[ $runattack3, knight_runatk4 ] {ai_charge_side();};
void() knight_runatk4 =[ $runattack4, knight_runatk5 ] {ai_charge_side();};
void() knight_runatk5 =[ $runattack5, knight_runatk6 ] {ai_melee_side();};
void() knight_runatk6 =[ $runattack6, knight_runatk7 ] {ai_melee_side();};
void() knight_runatk7 =[ $runattack7, knight_runatk8 ] {ai_melee_side();};
void() knight_runatk8 =[ $runattack8, knight_runatk9 ] {ai_melee_side();};
void() knight_runatk9 =[ $runattack9, knight_runatk10 ] {ai_melee_side();};
void() knight_runatk10 =[ $runattack10, knight_runatk11 ] {ai_charge_side();};
void() knight_runatk11 =[ $runattack11, knight_run1 ] {ai_charge(10);};
void() knight_atk1 =[ $attackb1, knight_atk2 ]
{
sound (self, CHAN_WEAPON, "knight/sword1.wav", 1, ATTN_NORM);
ai_charge(0);};
void() knight_atk2 =[ $attackb2, knight_atk3 ] {ai_charge(7);};
void() knight_atk3 =[ $attackb3, knight_atk4 ] {ai_charge(4);};
void() knight_atk4 =[ $attackb4, knight_atk5 ] {ai_charge(0);};
void() knight_atk5 =[ $attackb5, knight_atk6 ] {ai_charge(3);};
void() knight_atk6 =[ $attackb6, knight_atk7 ] {ai_charge(4); ai_melee();};
void() knight_atk7 =[ $attackb7, knight_atk8 ] {ai_charge(1); ai_melee();};
void() knight_atk8 =[ $attackb8, knight_atk9 ] {ai_charge(3);
ai_melee();};
void() knight_atk9 =[ $attackb9, knight_atk10] {ai_charge(1);};
void() knight_atk10=[ $attackb10, knight_run1 ] {ai_charge(5);};
//void() knight_atk9 =[ $attack9, knight_atk10 ] {};
//void() knight_atk10 =[ $attack10, knight_atk11 ] {};
//void() knight_atk11 =[ $attack11, knight_run1 ] {};
//===========================================================================
void() knight_pain1 =[ $pain1, knight_pain2 ] {};
void() knight_pain2 =[ $pain2, knight_pain3 ] {};
void() knight_pain3 =[ $pain3, knight_run1 ] {};
void() knight_painb1 =[ $painb1, knight_painb2 ] {ai_painforward(0);};
void() knight_painb2 =[ $painb2, knight_painb3 ] {ai_painforward(3);};
void() knight_painb3 =[ $painb3, knight_painb4 ] {};
void() knight_painb4 =[ $painb4, knight_painb5 ] {};
void() knight_painb5 =[ $painb5, knight_painb6 ] {ai_painforward(2);};
void() knight_painb6 =[ $painb6, knight_painb7 ] {ai_painforward(4);};
void() knight_painb7 =[ $painb7, knight_painb8 ] {ai_painforward(2);};
void() knight_painb8 =[ $painb8, knight_painb9 ] {ai_painforward(5);};
void() knight_painb9 =[ $painb9, knight_painb10 ] {ai_painforward(5);};
void() knight_painb10 =[ $painb10, knight_painb11 ] {ai_painforward(0);};
void() knight_painb11 =[ $painb11, knight_run1 ] {};
void(entity attacker, float damage) knight_pain =
{
local float r;
if (self.pain_finished > time)
return;
r = random();
sound (self, CHAN_VOICE, "knight/khurt.wav", 1, ATTN_NORM);
if (r < 0.85)
{
knight_pain1 ();
self.pain_finished = time + 1;
}
else
{
knight_painb1 ();
self.pain_finished = time + 1;
}
};
//===========================================================================
void() knight_bow1 =[ $kneel1, knight_bow2 ] {ai_turn();};
void() knight_bow2 =[ $kneel2, knight_bow3 ] {ai_turn();};
void() knight_bow3 =[ $kneel3, knight_bow4 ] {ai_turn();};
void() knight_bow4 =[ $kneel4, knight_bow5 ] {ai_turn();};
void() knight_bow5 =[ $kneel5, knight_bow5 ] {ai_turn();};
void() knight_bow6 =[ $kneel4, knight_bow7 ] {ai_turn();};
void() knight_bow7 =[ $kneel3, knight_bow8 ] {ai_turn();};
void() knight_bow8 =[ $kneel2, knight_bow9 ] {ai_turn();};
void() knight_bow9 =[ $kneel1, knight_bow10 ] {ai_turn();};
void() knight_bow10 =[ $walk1, knight_walk1 ] {ai_turn();};
void() knight_die1 =[ $death1, knight_die2 ] {};
void() knight_die2 =[ $death2, knight_die3 ] {};
void() knight_die3 =[ $death3, knight_die4 ]
{self.solid = SOLID_NOT;};
void() knight_die4 =[ $death4, knight_die5 ] {};
void() knight_die5 =[ $death5, knight_die6 ] {};
void() knight_die6 =[ $death6, knight_die7 ] {};
void() knight_die7 =[ $death7, knight_die8 ] {};
void() knight_die8 =[ $death8, knight_die9 ] {};
void() knight_die9 =[ $death9, knight_die10] {};
void() knight_die10=[ $death10, knight_die10] {};
void() knight_dieb1 =[ $deathb1, knight_dieb2 ] {};
void() knight_dieb2 =[ $deathb2, knight_dieb3 ] {};
void() knight_dieb3 =[ $deathb3, knight_dieb4 ]
{self.solid = SOLID_NOT;};
void() knight_dieb4 =[ $deathb4, knight_dieb5 ] {};
void() knight_dieb5 =[ $deathb5, knight_dieb6 ] {};
void() knight_dieb6 =[ $deathb6, knight_dieb7 ] {};
void() knight_dieb7 =[ $deathb7, knight_dieb8 ] {};
void() knight_dieb8 =[ $deathb8, knight_dieb9 ] {};
void() knight_dieb9 =[ $deathb9, knight_dieb10] {};
void() knight_dieb10 = [ $deathb10, knight_dieb11] {};
void() knight_dieb11 = [ $deathb11, knight_dieb11] {};
void() knight_die =
{
// check for gib
if (self.health < -40)
{
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_knight.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
return;
}
// regular death
sound (self, CHAN_VOICE, "knight/kdeath.wav", 1, ATTN_NORM);
if (random() < 0.5)
knight_die1 ();
else
knight_dieb1 ();
};
/*QUAKED monster_knight (1 0 0) (-16 -16 -24) (16 16 40) Ambush
*/
void() monster_knight =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (deathmatch)
{
remove(self);
return;
}
precache_model ("progs/knight.mdl");
precache_model ("progs/h_knight.mdl");
precache_sound ("knight/kdeath.wav");
precache_sound ("knight/khurt.wav");
precache_sound ("knight/ksight.wav");
precache_sound ("knight/sword1.wav");
precache_sound ("knight/sword2.wav");
precache_sound ("knight/idle.wav");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/knight.mdl");
setsize (self, '-16 -16 -24', '16 16 40');
if (!self.health) //thanks RennyC -- dumptruck_ds
self.health = 75;
self.th_stand = knight_stand1;
self.th_walk = knight_walk1;
self.th_run = knight_run1;
self.th_melee = knight_atk1;
self.th_pain = knight_pain;
self.th_die = knight_die;
walkmonster_start ();
};
/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */
/*QUAKED monster_dead_knight (0 0.5 0.8) (-16 -16 -24) (16 16 32)
*/
void() monster_dead_knight =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_model("progs/knight.mdl");
setmodel(self, "progs/knight.mdl");
if (self.spawnflags & 2)
{
self.frame = $death10;
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
setsize(self,'-25.56 -14.56 -50.49','26.45 40.2 30');
}
else
{
self.solid = SOLID_NOT;
}
}
else
{
self.frame = $deathb11;
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
setsize(self,'-30.36 -45.6 -50.18','28.29 11.59 30');
}
else
{
self.solid = SOLID_NOT;
}
}
};

View File

@@ -0,0 +1,469 @@
/*========================================
lights.qc taken from c0burn's Slipgate mod -- dumptruck_ds
========================================*/
float START_OFF = 1;
float FADE_IN_OUT = 2;
/*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)
Never used in the or
*/
void() info_notnull =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
};
/*==========
lightstyle_lookup
==========*/
string(float num) lightstyle_lookup =
{
switch (num)
{
// 0 normal
case 0:
return "m";
break;
// 1 FLICKER (first variety)
case 1:
return "mmnmmommommnonmmonqnmmo";
break;
// 2 SLOW STRONG PULSE
case 2:
return "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba";
break;
// 3 CANDLE (first variety)
case 3:
return "mmmmmaaaaammmmmaaaaaabcdefgabcdefg";
break;
// 4 FAST STROBE
case 4:
return "mamamamamama";
break;
// 5 GENTLE PULSE 1
case 5:
return "jklmnopqrstuvwxyzyxwvutsrqponmlkj";
break;
// 6 FLICKER (second variety)
case 6:
return "nmonqnmomnmomomno";
break;
// 7 CANDLE (second variety)
case 7:
return "mmmaaaabcdefgmmmmaaaammmaamm";
break;
// 8 CANDLE (third variety)
case 8:
return "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa";
break;
// 9 SLOW STROBE (fourth variety)
case 9:
return "aaaaaaaazzzzzzzz";
break;
// 10 FLUORESCENT FLICKER
case 10:
return "mmamammmmammamamaaamammma";
break;
// 11 SLOW PULSE NOT FADE TO BLACK
case 11:
return "abcdefghijklmnopqrrqponmlkjihgfedcba";
break;
// 12 BLINK OFF / ON (can be synced with animated textures, e.g. +0light and +1light)
case 12:
return "aamm"; // textures animate at 5fps but lights are 10fps...
break;
// DEFAULT
default:
return "a";
break;
}
};
/*==========
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";
break;
case 1:
return "b";
break;
case 2:
return "c";
break;
case 3:
return "d";
break;
case 4:
return "e";
break;
case 5:
return "f";
break;
case 6:
return "g";
break;
case 7:
return "h";
break;
case 8:
return "i";
break;
case 9:
return "j";
break;
case 10:
return "k";
break;
case 11:
return "l";
break;
case 12:
return "m";
break;
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
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<6F>t raise the lighting above it<69>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<69>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<69>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 =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
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
Non-displayed light.
Makes steady fluorescent humming sound.
See the "light" entity for a full description.
*/
void() light_fluoro =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
ambient_light_buzz();
light();
};
/*QUAKED light_fluorospark (0 1 0) (-8 -8 -8) (8 8 8)
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 =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (!self.style)
self.style = 10;
ambient_flouro_buzz();
remove(self);
};
/*QUAKED light_globe (0 1 0) (-8 -8 -8) (8 8 8)
Sphere globe light.
Can't be toggled.
See the "light" entity for a full description.
*/
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 light_torch_small_walltorch (0 .5 0) (-10 -10 -20) (10 10 20)
Short wall torch
See the "light" entity for a full description.
*/
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
See the "light" entity for a full description.
*/
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)
Small yellow flame ball
See the "light" entity for a full description.
*/
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) (-8 -8 -8) (8 8 8)
Left for compatability
Identical to "light_flame_small_yellow"
*/
void() light_flame_small_white =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
light_flame_small_yellow();
};

View File

@@ -0,0 +1,92 @@
/*
* math.qc
*
* Author: Joshua Skelton joshua.skelton@gmail.com
*
* A collection of helpful math functions.
*/
// Forward declarations
float(float value, float minValue, float maxValue) clamp;
float(float a, float b) mod;
float(float x) sign;
float(float value, float minValue, float maxValue) wrap;
/*
* clamp
*
* Limits the given value to the given range.
*
* value: A number
*
* minValue: The minimum value of the range
*
* maxValue: The maximum value of the range
*
* Returns: A number within the given range.
*/
float(float value, float minValue, float maxValue) clamp = {
if (value < minValue) {
return minValue;
}
else if (value > maxValue) {
return maxValue;
}
return value;
};
/*
* mod
*
* Returns the remainder after the division of a by n
*
* a: The dividend
*
* b: The divisor
*
* Returns: The remainder of a divided by n
*/
float(float a, float n) mod = {
return a - (n * floor(a / n));
};
/*
* sign
*
* Returns an indication of the sign of the given number.
*
* x: A number
*
* Returns: -1 if x < 0, 0 if x == 0, 1 if x > 0.
*/
float(float x) sign = {
if (x > 0) {
return 1;
}
else if (x < 0) {
return -1;
}
return 0;
};
/*
* wrap
*
* Limits the given value to the given range and will wrap the value to the
* the other end of the range if exceeded.
*
* value: A number
*
* minValue: The minimum value of the range
*
* maxValue: The maximum value of the range
*
* Returns: A number within the given range.
*/
float(float value, float minValue, float maxValue) wrap = {
local float range = maxValue - minValue;
return mod(value - minValue, range + 1) + minValue;
};

1091
mod_mine/quakec_src/misc.qc Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,63 @@
/*
* misc_model.qc
*
* Author: Joshua Skelton joshua.skelton@gmail.com
*/
// The starting frame of the animation
.float first_frame;
// The ending frame of the animation
.float last_frame;
// Forward declarations
void() misc_model_think;
/*QUAKED misc_model (0 0.5 0.8) (-8 -8 -8) (8 8 8)
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 = {
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_model(self.mdl);
setmodel(self, self.mdl);
if (!self.frame) {
self.frame = self.first_frame;
}
// Only animate if given a frame range
if (!self.last_frame) {
makestatic(self);
return;
}
// Default animation speed to 10 fps
if (!self.speed) {
self.speed = 10 / 60;
}
self.nextthink = time + self.speed;
self.think = misc_model_think;
};
/*
* misc_model_think
*
* Handles animation for misc_model entity.
*/
void() misc_model_think = {
self.nextthink = time + fabs(self.speed);
self.frame = self.frame + sign(self.speed);
self.frame = wrap(self.frame, self.first_frame, self.last_frame);
};

View File

@@ -0,0 +1,440 @@
/* ALL MONSTERS SHOULD BE 1 0 0 IN COLOR */
// name =[framenum, nexttime, nextthink] {code}
// expands to:
// name ()
// {
// self.frame=framenum;
// self.nextthink = time + nexttime;
// self.think = nextthink
// <code>
// };
/*
================
monster_update_total
Call this function to safely update total_monsters when the game is in
progress. It adds "n" to total_monsters, then notifies all clients of
the change. -- iw
================
*/
void(float n) monster_update_total =
{
total_monsters = total_monsters + n;
WriteByte (MSG_ALL, SVC_UPDATESTAT);
WriteByte (MSG_ALL, STAT_TOTALMONSTERS);
WriteLong (MSG_ALL, total_monsters);
};
/* From Preach's tutorial here: https://tomeofpreach.wordpress.com/2017/10/08/teleporting-monsters-flag/#more-2281 */
//define Preach's new fields dumptruck_ds
.string tele_model;
.vector tele_mins;
.vector tele_maxs;
.float tele_solid;
.float tele_movetype;
void(vector org) spawn_tfog;
void(vector org, entity death_owner) spawn_tdeath;
void() monster_teleport_go =
{
self.solid = self.tele_solid;
self.movetype = self.tele_movetype;
setmodel(self, self.tele_model);
setsize (self, self.tele_mins, self.tele_maxs);
self.delay = 0; //fix for cumulative delays for counters etc. -- dumptruck_ds
self.think1();
//override the random delay some go functions apply
self.nextthink = time + 0.1;
{
if (self.wait == 0/* || self.classname == "monster_zombie"*/) //dumptruck_ds: if wait value is >0 spawn silently, hack for zombies broke this, fixed with pos1!
spawn_tfog (self.origin);
spawn_tdeath(self.origin, self);
}
}
void() monster_teleport_delay = //new from Qmaster func coding help thread
{
self.think = monster_teleport_go;
self.nextthink = time + 0.1 + self.delay;
};
/*
================
monster_teleport_check
This detects and eliminates a common map bug: a trigger-spawned monster
which can't be activated either because it has no targetname or because
its targetname isn't targeted by any other entity. (This map bug would
otherwise make it impossible for the player to get 100% kills.) -- iw
================
*/
void() monster_teleport_check =
{
if (!SUB_IsTargeted ())
{
dprint ("WARNING: removed untargeted trigger-spawned ");
dprint (self.classname);
dprint (" at ");
dprint (vtos (self.origin));
dprint ("\n");
remove (self);
return;
}
// the targetname appears to be OK, so let's finish setting up the
// trigger-spawned monster -- iw
self.use = monster_teleport_delay; // qmaster
monster_update_total (1);
};
float (void() monster_start_fn) monster_teleport =
{
if(!(self.spawnflags & 8))
return FALSE;
//PREACH: This monster is to be teleported in, so hide it
self.tele_model= self.model;
self.tele_mins = self.mins;
self.tele_maxs = self.maxs;
self.tele_solid = self.solid;
self.tele_movetype = self.movetype;
self.model = "";
self.modelindex = 0;
self.solid = SOLID_NOT;
self.movetype = MOVETYPE_NONE;
self.think1 = monster_start_fn;
// wait for other entities to finish spawning, then check that
// something targets this -- iw
self.think = monster_teleport_check;
self.nextthink = time + 0.1;
return TRUE;
}
//end of Preach's new fields here
/*
================
monster_use
Using a monster makes it angry at the current activator
================
*/
void() monster_use =
{
if (self.enemy)
return;
if (self.health <= 0)
return;
if (activator.items & IT_INVISIBILITY)
return;
if (activator.flags & FL_NOTARGET)
return;
if (activator.classname != "player")
return;
// delay reaction so if the monster is teleported, its sound is still
// heard
self.enemy = activator;
self.nextthink = time + 0.1;
self.think = FoundTarget;
};
/*
================
monster_death_use
When a mosnter dies, it fires all of its targets with the current
enemy as activator.
================
*/
void() monster_death_use =
{
// fall to ground
if (self.flags & FL_FLY)
self.flags = self.flags - FL_FLY;
if (self.flags & FL_SWIM)
self.flags = self.flags - FL_SWIM;
if (!self.target)
return;
activator = self.enemy;
SUB_UseTargets ();
};
/*
================
monster_pain_use //dumptruck_ds
When a monster reaches pain_threshold, it fires all of its pain_targets
with the current enemy as activator.
================
*/
void() monster_pain_use =
{
if (!self.pain_target)
return;
activator = self.enemy;
SUB_UsePain ();
};
//============================================================================
void() walkmonster_start_go =
{
self.origin_z = self.origin_z + 1; // raise off floor a bit
//Preach's "check" here
// if(time <= 0.5)
if(!(self.spawnflags & 8))
{
droptofloor();
if (!walkmove(0,0))
{
dprint ("\n\n");
dprint (self.classname);
dprint (" in wall at: ");
dprint (vtos(self.origin));
dprint ("\n\n");
}
}
self.takedamage = DAMAGE_AIM;
self.ideal_yaw = self.angles * '0 1 0';
if (!self.yaw_speed)
self.yaw_speed = 20;
self.view_ofs = '0 0 25';
self.use = monster_use;
self.flags = self.flags | FL_MONSTER;
if (self.target != "")
{
self.goalentity = self.movetarget = find(world, targetname, self.target);
self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
if (!self.movetarget)
{
dprint ("Monster can't find target at ");
dprint (vtos(self.origin));
dprint ("\n");
}
// this used to be an objerror
if (self.movetarget.classname == "path_corner")
{
self.th_walk ();
}
else
{
self.pausetime = 99999999;
self.th_stand ();
}
}
else
{
self.pausetime = 99999999;
self.th_stand ();
}
// spread think times so they don't all happen at same time
self.nextthink = self.nextthink + random()*0.5;
if ((self.spawnflags & 8) && self.spawn_angry == 1) //dumptruck_ds -- using spawn_angry set to 1 in order to spawn in "angry" monsters
{
monster_use();
}
// local entity pl; //dumptruck_ds -- this is Shamblernaut's method
//
// pl = find (world, classname, "player");
//
// if (self.spawn_angry == 1)
// {
// activator = pl;
// monster_use();
// }
};
void() walkmonster_start =
//Preach's tutorial
{
if(monster_teleport(walkmonster_start_go))
return;
// delay drop to floor to make sure all doors have been spawned
// spread think times so they don't all happen at same time
self.nextthink = self.nextthink + random()*0.5;
self.think = walkmonster_start_go;
total_monsters = total_monsters + 1;
/// Trigger enemy after spawn (khreathor)
};
void() flymonster_start_go =
{
self.takedamage = DAMAGE_AIM;
self.ideal_yaw = self.angles * '0 1 0';
if (!self.yaw_speed)
self.yaw_speed = 10;
self.view_ofs = '0 0 25';
self.use = monster_use;
self.flags = self.flags | FL_FLY;
self.flags = self.flags | FL_MONSTER;
if (!walkmove(0,0))
{
dprint ("flymonster in wall at: ");
dprint (vtos(self.origin));
dprint ("\n");
}
if (self.target != "")
{
self.goalentity = self.movetarget = find(world, targetname, self.target);
if (!self.movetarget)
{
dprint ("Monster can't find target at ");
dprint (vtos(self.origin));
dprint ("\n");
}
// this used to be an objerror
if (self.movetarget.classname == "path_corner")
{
self.th_walk ();
}
else
{
self.pausetime = 99999999;
self.th_stand ();
}
}
else
{
self.pausetime = 99999999;
self.th_stand ();
}
if ((self.spawnflags & 8) && self.spawn_angry == 1) //dumptruck_ds -- using spawn_angry set to 1 in order to spawn in "angry" monsters
{
monster_use();
}
// local entity pl; //dumptruck_ds -- this is Shamblernaut's method
//
// local entity pl;
//
// pl = find (world, classname, "player");
//
// if (self.spawn_angry == 1)
// {
// activator = pl;
// monster_use();
// }
};
void() flymonster_start =
{
//Preach's tutorial
if(monster_teleport(flymonster_start_go))
return;
// spread think times so they don't all happen at same time
self.nextthink = self.nextthink + random()*0.5;
self.think = flymonster_start_go;
total_monsters = total_monsters + 1;
};
void() swimmonster_start_go =
{
if (deathmatch)
{
remove(self);
return;
}
self.takedamage = DAMAGE_AIM;
self.ideal_yaw = self.angles * '0 1 0';
if (!self.yaw_speed)
self.yaw_speed = 10;
self.view_ofs = '0 0 10';
self.use = monster_use;
self.flags = self.flags | FL_SWIM;
self.flags = self.flags | FL_MONSTER;
if (self.target != "")
{
self.goalentity = self.movetarget = find(world, targetname, self.target);
if (!self.movetarget)
{
dprint ("Monster can't find target at ");
dprint (vtos(self.origin));
dprint ("\n");
}
// this used to be an objerror
self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
self.th_walk ();
}
else
{
self.pausetime = 99999999;
self.th_stand ();
}
// spread think times so they don't all happen at same time
self.nextthink = self.nextthink + random()*0.5;
if ((self.spawnflags & 8) && self.spawn_angry == 1) //dumptruck_ds -- using spawn_angry set to 1 in order to spawn in "angry" monsters
{
monster_use();
}
// local entity pl; //dumptruck_ds -- this is Shamblernaut's method
//
// pl = find (world, classname, "player");
//
// if (self.spawn_angry == 1)
// {
// activator = pl;
// monster_use();
// }
};
void() swimmonster_start =
{
//Preach's tutorial
if(monster_teleport(swimmonster_start_go))
return;
// spread think times so they don't all happen at same time
self.nextthink = self.nextthink + random()*0.5;
self.think = swimmonster_start_go;
total_monsters = total_monsters + 1;
};

View File

@@ -0,0 +1,205 @@
/*
========================================================================
NEW SPAWNFLAGS FOR ALL ENTITIES
========================================================================
This file was created for progs_dump by Ian "iw" Walshaw, August 2019.
It defines functions which can be called to implement the following new
spawnflags:
4096 Not in Coop
8192 Not in Single Player
32768 Not on Hard Only
65536 Not on Nightmare Only
(Spawnflag 16384 is not used here because it's already used for
something else in progs_dump.)
The new spawnflags complement and complete the set of built-in
spawnflags provided by the engine, which of course are:
256 Not on Easy
512 Not on Normal
1024 Not on Hard or Nightmare
2048 Not in Deathmatch
In conjunction with the old spawnflags, the new spawnflags make it
possible to exclude any entity from any combination of game modes and/or
skill levels.
"Not in Coop" and "Not in Single Player"
----------------------------------------
These spawnflags were inspired by Quoth 2 (Kell and Necros, 2008), which
included two additional spawnflags for all entities: "Not in Coop" and
"Coop Only". In contrast to Quoth 2, the spawnflags implemented here
are "Not in Coop" and "Not in Single Player", for symmetry with the
built-in "Not in Deathmatch" spawnflag.
"Not on Hard Only" and "Not on Nightmare Only"
----------------------------------------------
The set of built-in spawnflags doesn't allow a mapper to treat the Hard
and Nightmare skill levels differently, because it only includes one
spawnflag, 1024, which excludes an entity from both Hard and Nightmare.
The new "Not on Hard Only" and "Not on Nightmare Only" spawnflags allow
the mapper to exclude an entity from one of these skill levels without
affecting the other.
========================================================================
*/
// The new spawnflags. (16384 is already used elsewhere.)
float SPAWNFLAG_NOT_IN_COOP = 4096; // Not in Coop
float SPAWNFLAG_NOT_IN_SP = 8192; // Not in Single Player
float SPAWNFLAG_NOT_ON_SKILL2 = 32768; // Not on Hard Only
float SPAWNFLAG_NOT_ON_SKILL3 = 65536; // Not on Nightmare Only
// The number of entities inhibited by each of the new spawnflags.
float total_not_in_coop;
float total_not_in_sp;
float total_not_on_skill2;
float total_not_on_skill3;
// TRUE if the developer summary has been printed.
float done_inhibition_summary;
/*
================
InitNewSpawnflags
This function is intended to be called from the top of the worldspawn
function (in world.qc). -- iw
================
*/
void() InitNewSpawnflags =
{
// Initialize the global variables.
total_not_in_coop = 0;
total_not_in_sp = 0;
total_not_on_skill2 = 0;
total_not_on_skill3 = 0;
done_inhibition_summary = FALSE;
// In the original code, the value of the skill cvar was not copied
// into the skill global until the first call to StartFrame.
// However, the new SUB_Inhibit function will need to check what the
// skill is before then, so, the value is copied here. -- iw
skill = cvar ("skill");
};
/*
================
SUB_Inhibit
This function is intended to be called from the top of every spawn
function, like this:
if (SUB_Inhibit ())
return;
If the entity's spawnflags mean that it should be inhibited in the
current game mode or on the current skill level, this function will
remove the entity and return TRUE, otherwise this function will take no
action and return FALSE. -- iw
================
*/
float() SUB_Inhibit =
{
if (coop && (self.spawnflags & SPAWNFLAG_NOT_IN_COOP))
{
total_not_in_coop = total_not_in_coop + 1;
remove (self);
return TRUE;
}
if (!coop && !deathmatch && (self.spawnflags & SPAWNFLAG_NOT_IN_SP))
{
total_not_in_sp = total_not_in_sp + 1;
remove (self);
return TRUE;
}
// The built-in skill level spawnflags are ignored in Deathmatch, so
// we ignore the new ones in Deathmatch, too. -- iw
if (!deathmatch)
{
if (skill == 2 && (self.spawnflags & SPAWNFLAG_NOT_ON_SKILL2))
{
total_not_on_skill2 = total_not_on_skill2 + 1;
remove (self);
return TRUE;
}
if (skill == 3 && (self.spawnflags & SPAWNFLAG_NOT_ON_SKILL3))
{
total_not_on_skill3 = total_not_on_skill3 + 1;
remove (self);
return TRUE;
}
}
return FALSE;
};
/*
================
PrintInhibitionTotal
This just dprints the summary line about the total number of entities
inhibited by one of the new spawnflags (see PrintInhibitionSummary
below). -- iw
================
*/
void(float total, string spawnflag_name) PrintInhibitionTotal =
{
if (total == 0)
return;
dprint ("... ");
dprint (ftos (total));
dprint (" with '");
dprint (spawnflag_name);
dprint ("' spawnflag\n");
};
/*
================
PrintInhibitionSummary
This function is intended to be called from the top of the StartFrame
function (in world.qc), like this:
if (!done_inhibition_summary)
PrintInhibitionSummary ();
The engine already logs a developer message about the number of entities
inhibited by the built-in spawnflags; this function logs a message about
the number of entities inhibited by the new spawnflags. -- iw
================
*/
void() PrintInhibitionSummary =
{
dprint (ftos (total_not_in_coop + total_not_in_sp +
total_not_on_skill2 + total_not_on_skill3));
dprint (" additional entities inhibited by the progs.dat\n");
PrintInhibitionTotal (total_not_in_coop, "Not in Coop");
PrintInhibitionTotal (total_not_in_sp, "Not in Single Player");
PrintInhibitionTotal (total_not_on_skill2, "Not on Hard Only");
PrintInhibitionTotal (total_not_on_skill3, "Not on Nightmare Only");
done_inhibition_summary = TRUE;
};

508
mod_mine/quakec_src/ogre.qc Normal file
View File

@@ -0,0 +1,508 @@
/*
==============================================================================
OGRE
==============================================================================
*/
$cd id1/models/ogre_c
$origin 0 0 24
$base base
$skin base
$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7
$frame walk8 walk9 walk10 walk11 walk12 walk13 walk14 walk15 walk16
$frame run1 run2 run3 run4 run5 run6 run7 run8
$frame swing1 swing2 swing3 swing4 swing5 swing6 swing7
$frame swing8 swing9 swing10 swing11 swing12 swing13 swing14
$frame smash1 smash2 smash3 smash4 smash5 smash6 smash7
$frame smash8 smash9 smash10 smash11 smash12 smash13 smash14
$frame shoot1 shoot2 shoot3 shoot4 shoot5 shoot6
$frame pain1 pain2 pain3 pain4 pain5
$frame painb1 painb2 painb3
$frame painc1 painc2 painc3 painc4 painc5 painc6
$frame paind1 paind2 paind3 paind4 paind5 paind6 paind7 paind8 paind9 paind10
$frame paind11 paind12 paind13 paind14 paind15 paind16
$frame paine1 paine2 paine3 paine4 paine5 paine6 paine7 paine8 paine9 paine10
$frame paine11 paine12 paine13 paine14 paine15
$frame death1 death2 death3 death4 death5 death6
$frame death7 death8 death9 death10 death11 death12
$frame death13 death14
$frame bdeath1 bdeath2 bdeath3 bdeath4 bdeath5 bdeath6
$frame bdeath7 bdeath8 bdeath9 bdeath10
$frame pull1 pull2 pull3 pull4 pull5 pull6 pull7 pull8 pull9 pull10 pull11
//=============================================================================
void() OgreGrenadeExplode =
{
T_RadiusDamage (self, self.owner, 40, world);
sound (self, CHAN_VOICE, "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);
self.velocity = '0 0 0';
self.touch = SUB_Null;
setmodel (self, "progs/s_explod.spr");
self.solid = SOLID_NOT;
s_explode1 ();
};
void() OgreGrenadeTouch =
{
if (other == self.owner)
return; // don't explode on owner
if (other.takedamage == DAMAGE_AIM)
{
OgreGrenadeExplode();
return;
}
sound (self, CHAN_VOICE, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
if (self.velocity == '0 0 0')
self.avelocity = '0 0 0';
};
/*
================
OgreFireGrenade
================
*/
void() OgreFireGrenade =
{
local entity missile;
self.effects = self.effects | EF_MUZZLEFLASH;
sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
missile = spawn ();
missile.owner = self;
missile.movetype = MOVETYPE_BOUNCE;
missile.solid = SOLID_BBOX;
// set missile speed
makevectors (self.angles);
missile.velocity = normalize(self.enemy.origin - self.origin);
missile.velocity = missile.velocity * 600;
missile.velocity_z = 200;
missile.avelocity = '300 300 300';
missile.angles = vectoangles(missile.velocity);
missile.touch = OgreGrenadeTouch;
// set missile duration
missile.nextthink = time + 2.5;
missile.think = OgreGrenadeExplode;
setmodel (missile, "progs/grenade.mdl");
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin);
};
//=============================================================================
/*
================
chainsaw
FIXME
================
*/
void(float side) chainsaw =
{
local vector delta;
local float ldmg;
if (!self.enemy)
return;
if (!CanDamage (self.enemy, self))
return;
ai_charge(10);
delta = self.enemy.origin - self.origin;
if (vlen(delta) > 100)
return;
ldmg = (random() + random() + random()) * 4;
T_Damage (self.enemy, self, self, ldmg);
if (side)
{
makevectors (self.angles);
if (side == 1)
SpawnMeatSpray (self.origin + v_forward*16, crandom() * 100 * v_right);
else
SpawnMeatSpray (self.origin + v_forward*16, side * v_right);
}
};
void() ogre_stand1 =[ $stand1, ogre_stand2 ] {ai_stand();};
void() ogre_stand2 =[ $stand2, ogre_stand3 ] {ai_stand();};
void() ogre_stand3 =[ $stand3, ogre_stand4 ] {ai_stand();};
void() ogre_stand4 =[ $stand4, ogre_stand5 ] {ai_stand();};
void() ogre_stand5 =[ $stand5, ogre_stand6 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "ogre/ogidle.wav", 1, ATTN_IDLE);
ai_stand();
};
void() ogre_stand6 =[ $stand6, ogre_stand7 ] {ai_stand();};
void() ogre_stand7 =[ $stand7, ogre_stand8 ] {ai_stand();};
void() ogre_stand8 =[ $stand8, ogre_stand9 ] {ai_stand();};
void() ogre_stand9 =[ $stand9, ogre_stand1 ] {ai_stand();};
void() ogre_walk1 =[ $walk1, ogre_walk2 ] {ai_walk(3);};
void() ogre_walk2 =[ $walk2, ogre_walk3 ] {ai_walk(2);};
void() ogre_walk3 =[ $walk3, ogre_walk4 ] {
ai_walk(2);
if (random() < 0.2)
sound (self, CHAN_VOICE, "ogre/ogidle.wav", 1, ATTN_IDLE);
};
void() ogre_walk4 =[ $walk4, ogre_walk5 ] {ai_walk(2);};
void() ogre_walk5 =[ $walk5, ogre_walk6 ] {ai_walk(2);};
void() ogre_walk6 =[ $walk6, ogre_walk7 ] {
ai_walk(5);
if (random() < 0.1)
sound (self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE);
};
void() ogre_walk7 =[ $walk7, ogre_walk8 ] {ai_walk(3);};
void() ogre_walk8 =[ $walk8, ogre_walk9 ] {ai_walk(2);};
void() ogre_walk9 =[ $walk9, ogre_walk10 ] {ai_walk(3);};
void() ogre_walk10 =[ $walk10, ogre_walk11 ] {ai_walk(1);};
void() ogre_walk11 =[ $walk11, ogre_walk12 ] {ai_walk(2);};
void() ogre_walk12 =[ $walk12, ogre_walk13 ] {ai_walk(3);};
void() ogre_walk13 =[ $walk13, ogre_walk14 ] {ai_walk(3);};
void() ogre_walk14 =[ $walk14, ogre_walk15 ] {ai_walk(3);};
void() ogre_walk15 =[ $walk15, ogre_walk16 ] {ai_walk(3);};
void() ogre_walk16 =[ $walk16, ogre_walk1 ] {ai_walk(4);};
void() ogre_run1 =[ $run1, ogre_run2 ] {ai_run(9);
if (random() < 0.2)
sound (self, CHAN_VOICE, "ogre/ogidle2.wav", 1, ATTN_IDLE);
};
void() ogre_run2 =[ $run2, ogre_run3 ] {ai_run(12);};
void() ogre_run3 =[ $run3, ogre_run4 ] {ai_run(8);};
void() ogre_run4 =[ $run4, ogre_run5 ] {ai_run(22);};
void() ogre_run5 =[ $run5, ogre_run6 ] {ai_run(16);};
void() ogre_run6 =[ $run6, ogre_run7 ] {ai_run(4);};
void() ogre_run7 =[ $run7, ogre_run8 ] {ai_run(13);};
void() ogre_run8 =[ $run8, ogre_run1 ] {ai_run(24);};
void() ogre_swing1 =[ $swing1, ogre_swing2 ] {ai_charge(11);
sound (self, CHAN_WEAPON, "ogre/ogsawatk.wav", 1, ATTN_NORM);
};
void() ogre_swing2 =[ $swing2, ogre_swing3 ] {ai_charge(1);};
void() ogre_swing3 =[ $swing3, ogre_swing4 ] {ai_charge(4);};
void() ogre_swing4 =[ $swing4, ogre_swing5 ] {ai_charge(13);};
void() ogre_swing5 =[ $swing5, ogre_swing6 ] {ai_charge(9); chainsaw(0);self.angles_y = self.angles_y + random()*25;};
void() ogre_swing6 =[ $swing6, ogre_swing7 ] {chainsaw(200);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing7 =[ $swing7, ogre_swing8 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing8 =[ $swing8, ogre_swing9 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing9 =[ $swing9, ogre_swing10 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing10 =[ $swing10, ogre_swing11 ] {chainsaw(-200);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing11 =[ $swing11, ogre_swing12 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing12 =[ $swing12, ogre_swing13 ] {ai_charge(3);};
void() ogre_swing13 =[ $swing13, ogre_swing14 ] {ai_charge(8);};
void() ogre_swing14 =[ $swing14, ogre_run1 ] {ai_charge(9);};
void() ogre_smash1 =[ $smash1, ogre_smash2 ] {ai_charge(6);
sound (self, CHAN_WEAPON, "ogre/ogsawatk.wav", 1, ATTN_NORM);
};
void() ogre_smash2 =[ $smash2, ogre_smash3 ] {ai_charge(0);};
void() ogre_smash3 =[ $smash3, ogre_smash4 ] {ai_charge(0);};
void() ogre_smash4 =[ $smash4, ogre_smash5 ] {ai_charge(1);};
void() ogre_smash5 =[ $smash5, ogre_smash6 ] {ai_charge(4);};
void() ogre_smash6 =[ $smash6, ogre_smash7 ] {ai_charge(4); chainsaw(0);};
void() ogre_smash7 =[ $smash7, ogre_smash8 ] {ai_charge(4); chainsaw(0);};
void() ogre_smash8 =[ $smash8, ogre_smash9 ] {ai_charge(10); chainsaw(0);};
void() ogre_smash9 =[ $smash9, ogre_smash10 ] {ai_charge(13); chainsaw(0);};
void() ogre_smash10 =[ $smash10, ogre_smash11 ] {chainsaw(1);};
void() ogre_smash11 =[ $smash11, ogre_smash12 ] {ai_charge(2); chainsaw(0);
self.nextthink = self.nextthink + random()*0.2;}; // slight variation
void() ogre_smash12 =[ $smash12, ogre_smash13 ] {ai_charge(0);};
void() ogre_smash13 =[ $smash13, ogre_smash14 ] {ai_charge(4);};
void() ogre_smash14 =[ $smash14, ogre_run1 ] {ai_charge(12);};
void() ogre_nail1 =[ $shoot1, ogre_nail2 ] {ai_face();};
void() ogre_nail2 =[ $shoot2, ogre_nail3 ] {ai_face();};
void() ogre_nail3 =[ $shoot2, ogre_nail4 ] {ai_face();};
void() ogre_nail4 =[ $shoot3, ogre_nail5 ] {ai_face();OgreFireGrenade();};
void() ogre_nail5 =[ $shoot4, ogre_nail6 ] {ai_face();};
void() ogre_nail6 =[ $shoot5, ogre_nail7 ] {ai_face();};
void() ogre_nail7 =[ $shoot6, ogre_run1 ] {ai_face();};
void() ogre_pain1 =[ $pain1, ogre_pain2 ] {};
void() ogre_pain2 =[ $pain2, ogre_pain3 ] {};
void() ogre_pain3 =[ $pain3, ogre_pain4 ] {};
void() ogre_pain4 =[ $pain4, ogre_pain5 ] {};
void() ogre_pain5 =[ $pain5, ogre_run1 ] {};
void() ogre_painb1 =[ $painb1, ogre_painb2 ] {};
void() ogre_painb2 =[ $painb2, ogre_painb3 ] {};
void() ogre_painb3 =[ $painb3, ogre_run1 ] {};
void() ogre_painc1 =[ $painc1, ogre_painc2 ] {};
void() ogre_painc2 =[ $painc2, ogre_painc3 ] {};
void() ogre_painc3 =[ $painc3, ogre_painc4 ] {};
void() ogre_painc4 =[ $painc4, ogre_painc5 ] {};
void() ogre_painc5 =[ $painc5, ogre_painc6 ] {};
void() ogre_painc6 =[ $painc6, ogre_run1 ] {};
void() ogre_paind1 =[ $paind1, ogre_paind2 ] {};
void() ogre_paind2 =[ $paind2, ogre_paind3 ] {ai_pain(10);};
void() ogre_paind3 =[ $paind3, ogre_paind4 ] {ai_pain(9);};
void() ogre_paind4 =[ $paind4, ogre_paind5 ] {ai_pain(4);};
void() ogre_paind5 =[ $paind5, ogre_paind6 ] {};
void() ogre_paind6 =[ $paind6, ogre_paind7 ] {};
void() ogre_paind7 =[ $paind7, ogre_paind8 ] {};
void() ogre_paind8 =[ $paind8, ogre_paind9 ] {};
void() ogre_paind9 =[ $paind9, ogre_paind10 ] {};
void() ogre_paind10=[ $paind10, ogre_paind11 ] {};
void() ogre_paind11=[ $paind11, ogre_paind12 ] {};
void() ogre_paind12=[ $paind12, ogre_paind13 ] {};
void() ogre_paind13=[ $paind13, ogre_paind14 ] {};
void() ogre_paind14=[ $paind14, ogre_paind15 ] {};
void() ogre_paind15=[ $paind15, ogre_paind16 ] {};
void() ogre_paind16=[ $paind16, ogre_run1 ] {};
void() ogre_paine1 =[ $paine1, ogre_paine2 ] {};
void() ogre_paine2 =[ $paine2, ogre_paine3 ] {ai_pain(10);};
void() ogre_paine3 =[ $paine3, ogre_paine4 ] {ai_pain(9);};
void() ogre_paine4 =[ $paine4, ogre_paine5 ] {ai_pain(4);};
void() ogre_paine5 =[ $paine5, ogre_paine6 ] {};
void() ogre_paine6 =[ $paine6, ogre_paine7 ] {};
void() ogre_paine7 =[ $paine7, ogre_paine8 ] {};
void() ogre_paine8 =[ $paine8, ogre_paine9 ] {};
void() ogre_paine9 =[ $paine9, ogre_paine10 ] {};
void() ogre_paine10=[ $paine10, ogre_paine11 ] {};
void() ogre_paine11=[ $paine11, ogre_paine12 ] {};
void() ogre_paine12=[ $paine12, ogre_paine13 ] {};
void() ogre_paine13=[ $paine13, ogre_paine14 ] {};
void() ogre_paine14=[ $paine14, ogre_paine15 ] {};
void() ogre_paine15=[ $paine15, ogre_run1 ] {};
void(entity attacker, float damage) ogre_pain =
{
local float r;
// don't make multiple pain sounds right after each other
if (self.pain_finished > time)
return;
sound (self, CHAN_VOICE, "ogre/ogpain1.wav", 1, ATTN_NORM);
r = random();
if (r < 0.25)
{
ogre_pain1 ();
self.pain_finished = time + 1;
}
else if (r < 0.5)
{
ogre_painb1 ();
self.pain_finished = time + 1;
}
else if (r < 0.75)
{
ogre_painc1 ();
self.pain_finished = time + 1;
}
else if (r < 0.88)
{
ogre_paind1 ();
self.pain_finished = time + 2;
}
else
{
ogre_paine1 ();
self.pain_finished = time + 2;
}
};
void() ogre_die1 =[ $death1, ogre_die2 ] {};
void() ogre_die2 =[ $death2, ogre_die3 ] {};
void() ogre_die3 =[ $death3, ogre_die4 ]
{self.solid = SOLID_NOT;
self.ammo_rockets = 2;if(!self.keep_ammo)DropBackpack();};
void() ogre_die4 =[ $death4, ogre_die5 ] {};
void() ogre_die5 =[ $death5, ogre_die6 ] {};
void() ogre_die6 =[ $death6, ogre_die7 ] {};
void() ogre_die7 =[ $death7, ogre_die8 ] {};
void() ogre_die8 =[ $death8, ogre_die9 ] {};
void() ogre_die9 =[ $death9, ogre_die10 ] {};
void() ogre_die10 =[ $death10, ogre_die11 ] {};
void() ogre_die11 =[ $death11, ogre_die12 ] {};
void() ogre_die12 =[ $death12, ogre_die13 ] {};
void() ogre_die13 =[ $death13, ogre_die14 ] {};
void() ogre_die14 =[ $death14, ogre_die14 ] {};
void() ogre_bdie1 =[ $bdeath1, ogre_bdie2 ] {};
void() ogre_bdie2 =[ $bdeath2, ogre_bdie3 ] {ai_forward(5);};
void() ogre_bdie3 =[ $bdeath3, ogre_bdie4 ]
{self.solid = SOLID_NOT;
self.ammo_rockets = 2;if(!self.keep_ammo)DropBackpack();};
void() ogre_bdie4 =[ $bdeath4, ogre_bdie5 ] {ai_forward(1);};
void() ogre_bdie5 =[ $bdeath5, ogre_bdie6 ] {ai_forward(3);};
void() ogre_bdie6 =[ $bdeath6, ogre_bdie7 ] {ai_forward(7);};
void() ogre_bdie7 =[ $bdeath7, ogre_bdie8 ] {ai_forward(25);};
void() ogre_bdie8 =[ $bdeath8, ogre_bdie9 ] {};
void() ogre_bdie9 =[ $bdeath9, ogre_bdie10 ] {};
void() ogre_bdie10 =[ $bdeath10, ogre_bdie10 ] {};
void() ogre_die =
{
// check for gib
if (self.health < -80)
{
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_ogre.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
return;
}
sound (self, CHAN_VOICE, "ogre/ogdth.wav", 1, ATTN_NORM);
if (random() < 0.5)
ogre_die1 ();
else
ogre_bdie1 ();
};
void() ogre_melee =
{
if (random() > 0.5)
ogre_smash1 ();
else
ogre_swing1 ();
};
/*QUAKED monster_ogre (1 0 0) (-32 -32 -24) (32 32 64) Ambush
*/
void() monster_ogre =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (deathmatch)
{
remove(self);
return;
}
precache_model ("progs/ogre.mdl");
precache_model ("progs/h_ogre.mdl");
precache_model ("progs/grenade.mdl");
precache_sound ("ogre/ogdrag.wav");
precache_sound ("ogre/ogdth.wav");
precache_sound ("ogre/ogidle.wav");
precache_sound ("ogre/ogidle2.wav");
precache_sound ("ogre/ogpain1.wav");
precache_sound ("ogre/ogsawatk.wav");
precache_sound ("ogre/ogwake.wav");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/ogre.mdl");
setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
if (!self.health) //thanks RennyC -- dumptruck_ds
self.health = 200;
self.th_stand = ogre_stand1;
self.th_walk = ogre_walk1;
self.th_run = ogre_run1;
self.th_die = ogre_die;
self.th_melee = ogre_melee;
self.th_missile = ogre_nail1;
self.th_pain = ogre_pain;
walkmonster_start();
};
/*QUAKED monster_ogre_marksman (1 0 0) (-32 -32 -24) (32 32 64) Ambush
*/
void() monster_ogre_marksman =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
monster_ogre ();
};
/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */
/*QUAKED monster_dead_ogre (0 0.5 0.8) (-32 -32 -24) (32 32 64)
*/
void() monster_dead_ogre =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_model("progs/ogre.mdl");
setmodel(self, "progs/ogre.mdl");
if (self.spawnflags & 2)
{
self.frame = $death14;
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
setsize(self,'-40.64 -54.06 -54.1','29.42 54.63 30');
}
else
{
self.solid = SOLID_NOT;
}
}
else
{
self.frame = $bdeath10;
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
setsize(self,'-45.64 -29.46 -54.52','33.87 39.18 30');
}
else
{
self.solid = SOLID_NOT;
}
}
};

View File

@@ -0,0 +1,286 @@
/*
==============================================================================
OLD ONE
==============================================================================
*/
$cd id1/models/old_one
$origin 0 0 24
$base base
$skin skin
$scale 1
void() finale_1;
void() finale_2;
void() finale_3;
void() finale_4;
entity shub;
$frame old1 old2 old3 old4 old5 old6 old7 old8 old9
$frame old10 old11 old12 old13 old14 old15 old16 old17 old18 old19
$frame old20 old21 old22 old23 old24 old25 old26 old27 old28 old29
$frame old30 old31 old32 old33 old34 old35 old36 old37 old38 old39
$frame old40 old41 old42 old43 old44 old45 old46
$frame shake1 shake2 shake3 shake4 shake5 shake6 shake7 shake8
$frame shake9 shake10 shake11 shake12 shake13 shake14
$frame shake15 shake16 shake17 shake18 shake19 shake20
//void() old_stand =[ $old1, old_stand ] {};
void() old_idle1 =[ $old1, old_idle2 ] {};
void() old_idle2 =[ $old2, old_idle3 ] {};
void() old_idle3 =[ $old3, old_idle4 ] {};
void() old_idle4 =[ $old4, old_idle5 ] {};
void() old_idle5 =[ $old5, old_idle6 ] {};
void() old_idle6 =[ $old6, old_idle7 ] {};
void() old_idle7 =[ $old7, old_idle8 ] {};
void() old_idle8 =[ $old8, old_idle9 ] {};
void() old_idle9 =[ $old9, old_idle10 ] {};
void() old_idle10 =[ $old10, old_idle11 ] {};
void() old_idle11 =[ $old11, old_idle12 ] {};
void() old_idle12 =[ $old12, old_idle13 ] {};
void() old_idle13 =[ $old13, old_idle14 ] {};
void() old_idle14 =[ $old14, old_idle15 ] {};
void() old_idle15 =[ $old15, old_idle16 ] {};
void() old_idle16 =[ $old16, old_idle17 ] {};
void() old_idle17 =[ $old17, old_idle18 ] {};
void() old_idle18 =[ $old18, old_idle19 ] {};
void() old_idle19 =[ $old19, old_idle20 ] {};
void() old_idle20 =[ $old20, old_idle21 ] {};
void() old_idle21 =[ $old21, old_idle22 ] {};
void() old_idle22 =[ $old22, old_idle23 ] {};
void() old_idle23 =[ $old23, old_idle24 ] {};
void() old_idle24 =[ $old24, old_idle25 ] {};
void() old_idle25 =[ $old25, old_idle26 ] {};
void() old_idle26 =[ $old26, old_idle27 ] {};
void() old_idle27 =[ $old27, old_idle28 ] {};
void() old_idle28 =[ $old28, old_idle29 ] {};
void() old_idle29 =[ $old29, old_idle30 ] {};
void() old_idle30 =[ $old30, old_idle31 ] {};
void() old_idle31 =[ $old31, old_idle32 ] {};
void() old_idle32 =[ $old32, old_idle33 ] {};
void() old_idle33 =[ $old33, old_idle34 ] {};
void() old_idle34 =[ $old34, old_idle35 ] {};
void() old_idle35 =[ $old35, old_idle36 ] {};
void() old_idle36 =[ $old36, old_idle37 ] {};
void() old_idle37 =[ $old37, old_idle38 ] {};
void() old_idle38 =[ $old38, old_idle39 ] {};
void() old_idle39 =[ $old39, old_idle40 ] {};
void() old_idle40 =[ $old40, old_idle41 ] {};
void() old_idle41 =[ $old41, old_idle42 ] {};
void() old_idle42 =[ $old42, old_idle43 ] {};
void() old_idle43 =[ $old43, old_idle44 ] {};
void() old_idle44 =[ $old44, old_idle45 ] {};
void() old_idle45 =[ $old45, old_idle46 ] {};
void() old_idle46 =[ $old46, old_idle1 ] {};
void() old_thrash1 =[ $shake1, old_thrash2 ] {lightstyle(0, "m");};
void() old_thrash2 =[ $shake2, old_thrash3 ] {lightstyle(0, "k");};
void() old_thrash3 =[ $shake3, old_thrash4 ] {lightstyle(0, "k");};
void() old_thrash4 =[ $shake4, old_thrash5 ] {lightstyle(0, "i");};
void() old_thrash5 =[ $shake5, old_thrash6 ] {lightstyle(0, "g");};
void() old_thrash6 =[ $shake6, old_thrash7 ] {lightstyle(0, "e");};
void() old_thrash7 =[ $shake7, old_thrash8 ] {lightstyle(0, "c");};
void() old_thrash8 =[ $shake8, old_thrash9 ] {lightstyle(0, "a");};
void() old_thrash9 =[ $shake9, old_thrash10 ] {lightstyle(0, "c");};
void() old_thrash10 =[ $shake10, old_thrash11 ] {lightstyle(0, "e");};
void() old_thrash11 =[ $shake11, old_thrash12 ] {lightstyle(0, "g");};
void() old_thrash12 =[ $shake12, old_thrash13 ] {lightstyle(0, "i");};
void() old_thrash13 =[ $shake13, old_thrash14 ] {lightstyle(0, "k");};
void() old_thrash14 =[ $shake14, old_thrash15 ] {lightstyle(0, "m");};
void() old_thrash15 =[ $shake15, old_thrash16 ] {lightstyle(0, "m");
self.cnt = self.cnt + 1;
if (self.cnt != 3)
self.think = old_thrash1;
};
void() old_thrash16 =[ $shake16, old_thrash17 ] {lightstyle(0, "g");};
void() old_thrash17 =[ $shake17, old_thrash18 ] {lightstyle(0, "c");};
void() old_thrash18 =[ $shake18, old_thrash19 ] {lightstyle(0, "b");};
void() old_thrash19 =[ $shake19, old_thrash20 ] {lightstyle(0, "a");};
void() old_thrash20 =[ $shake20, old_thrash20 ] {finale_4();};
//============================================================================
void() finale_1 =
{
local entity pos, pl;
local entity timer;
intermission_exittime = time + 10000000; // never allow exit
intermission_running = 1;
// find the intermission spot
pos = find (world, classname, "info_intermission");
if (!pos)
error ("no info_intermission");
pl = find (world, classname, "misc_teleporttrain");
if (!pl)
error ("no teleporttrain");
remove (pl);
WriteByte (MSG_ALL, SVC_FINALE);
WriteString (MSG_ALL, "");
pl = find (world, classname, "player");
while (pl != world)
{
pl.view_ofs = '0 0 0';
pl.angles = other.v_angle = pos.mangle;
pl.fixangle = TRUE; // turn this way immediately
pl.map = self.map;
pl.nextthink = time + 0.5;
pl.takedamage = DAMAGE_NO;
pl.solid = SOLID_NOT;
pl.movetype = MOVETYPE_NONE;
pl.modelindex = 0;
setorigin (pl, pos.origin);
pl = find (pl, classname, "player");
}
// make fake versions of all players as standins, and move the real
// players to the intermission spot
// wait for 1 second
timer = spawn();
timer.nextthink = time + 1;
timer.think = finale_2;
};
void() finale_2 =
{
local vector o;
// start a teleport splash inside shub
o = shub.origin - '0 100 0';
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_TELEPORT);
WriteCoord (MSG_BROADCAST, o_x);
WriteCoord (MSG_BROADCAST, o_y);
WriteCoord (MSG_BROADCAST, o_z);
sound (shub, CHAN_VOICE, "misc/r_tele1.wav", 1, ATTN_NORM);
self.nextthink = time + 2;
self.think = finale_3;
};
void() finale_3 =
{
// start shub thrashing wildly
shub.think = old_thrash1;
sound (shub, CHAN_VOICE, "boss2/death.wav", 1, ATTN_NORM);
lightstyle(0, "abcdefghijklmlkjihgfedcb");
};
void() finale_4 =
{
// throw tons of meat chunks
local vector oldo;
local float x, y, z;
local float r;
local entity n;
sound (self, CHAN_VOICE, "boss2/pop2.wav", 1, ATTN_NORM);
oldo = self.origin;
z = 16;
while (z <= 144)
{
x = -64;
while (x <= 64)
{
y = -64;
while (y <= 64)
{
self.origin_x = oldo_x + x;
self.origin_y = oldo_y + y;
self.origin_z = oldo_z + z;
r = random();
if (r < 0.3)
ThrowGib ("progs/gib1.mdl", -999);
else if (r < 0.6)
ThrowGib ("progs/gib2.mdl", -999);
else
ThrowGib ("progs/gib3.mdl", -999);
y = y + 32;
}
x = x + 32;
}
z = z + 96;
}
// start the end text
WriteByte (MSG_ALL, SVC_FINALE);
WriteString (MSG_ALL, "Congratulations and well done! You have\nbeaten the hideous Shub-Niggurath, and\nher hundreds of ugly changelings and\nmonsters. You have proven that your\nskill and your cunning are greater than\nall the powers of Quake. You are the\nmaster now. Id Software salutes you.");
// put a player model down
n = spawn();
setmodel (n, "progs/player.mdl");
oldo = oldo - '32 264 0';
setorigin (n, oldo);
n.angles = '0 290 0';
n.frame = 1;
remove (self);
// switch cd track
WriteByte (MSG_ALL, SVC_CDTRACK);
WriteByte (MSG_ALL, 3);
WriteByte (MSG_ALL, 3);
lightstyle(0, "m");
};
//============================================================================
void(entity attacker, float damage) nopain =
{
self.health = 40000;
};
//============================================================================
/*QUAKED monster_oldone (1 0 0) (-16 -16 -24) (16 16 32)
*/
void() monster_oldone =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (deathmatch)
{
remove(self);
return;
}
precache_model2 ("progs/oldone.mdl");
precache_sound2 ("boss2/death.wav");
precache_sound2 ("boss2/idle.wav");
precache_sound2 ("boss2/sight.wav");
precache_sound2 ("boss2/pop2.wav");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/oldone.mdl");
setsize (self, '-160 -128 -24', '160 128 256');
self.health = 40000; // kill by telefrag
self.think = old_idle1;
self.nextthink = time + 0.1;
self.takedamage = DAMAGE_YES;
self.th_pain = nopain;
self.th_die = finale_1;
shub = self;
total_monsters = total_monsters + 1;
};

View File

@@ -0,0 +1,434 @@
void() plat_center_touch;
void() plat_outside_touch;
void() plat_trigger_use;
void() plat_go_up;
void() plat_go_down;
void() plat_crush;
float PLAT_LOW_TRIGGER = 1;
void() plat_spawn_inside_trigger =
{
local entity trigger;
local vector tmin, tmax;
//
// middle trigger
//
trigger = spawn();
trigger.touch = plat_center_touch;
trigger.movetype = MOVETYPE_NONE;
trigger.solid = SOLID_TRIGGER;
trigger.enemy = self;
tmin = self.mins + '25 25 0';
tmax = self.maxs - '25 25 -8';
tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8);
if (self.spawnflags & PLAT_LOW_TRIGGER)
tmax_z = tmin_z + 8;
if (self.size_x <= 50)
{
tmin_x = (self.mins_x + self.maxs_x) / 2;
tmax_x = tmin_x + 1;
}
if (self.size_y <= 50)
{
tmin_y = (self.mins_y + self.maxs_y) / 2;
tmax_y = tmin_y + 1;
}
setsize (trigger, tmin, tmax);
};
void() plat_hit_top =
{
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_TOP;
self.think = plat_go_down;
self.nextthink = self.ltime + 3;
};
void() plat_hit_bottom =
{
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_BOTTOM;
};
void() plat_go_down =
{
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
self.state = STATE_DOWN;
SUB_CalcMove (self.pos2, self.speed, plat_hit_bottom);
};
void() plat_go_up =
{
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
self.state = STATE_UP;
SUB_CalcMove (self.pos1, self.speed, plat_hit_top);
};
void() plat_center_touch =
{
if (other.classname != "player")
return;
if (other.health <= 0)
return;
self = self.enemy;
if (self.state == STATE_BOTTOM)
plat_go_up ();
else if (self.state == STATE_TOP)
self.nextthink = self.ltime + 1; // delay going down
};
void() plat_outside_touch =
{
if (other.classname != "player")
return;
if (other.health <= 0)
return;
//dprint ("plat_outside_touch\n");
self = self.enemy;
if (self.state == STATE_TOP)
plat_go_down ();
};
void() plat_trigger_use =
{
if (self.think)
return; // allready activated
plat_go_down();
};
void() plat_crush =
{
//dprint ("plat_crush\n");
T_Damage (other, self, self, 1);
if (self.state == STATE_UP)
plat_go_down ();
else if (self.state == STATE_DOWN)
plat_go_up ();
else
objerror ("plat_crush: bad self.state\n");
};
void() plat_use =
{
self.use = SUB_Null;
if (self.state != STATE_UP)
objerror ("plat_use: not in up state");
plat_go_down();
};
/*QUAKED func_plat (0 .5 .8) ? PLAT_LOW_TRIGGER
speed default 150
Plats are always drawn in the extended position, so they will light correctly.
If the plat is the target of another trigger or button, it will start out disabled in the extended position until it is trigger, when it will lower and become a normal plat.
If the "height" key is set, that will determine the amount the plat moves, instead of being implicitly determined by the model's height.
Set "sounds" to one of the following:
1) base fast
2) chain slow
*/
void() func_plat =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (!self.t_length)
self.t_length = 80;
if (!self.t_width)
self.t_width = 10;
if (self.sounds == 0)
self.sounds = 2;
// FIX THIS TO LOAD A GENERIC PLAT SOUND
if (self.sounds == 1)
{
precache_sound ("plats/plat1.wav");
precache_sound ("plats/plat2.wav");
self.noise = "plats/plat1.wav";
self.noise1 = "plats/plat2.wav";
}
if (self.sounds == 2)
{
precache_sound ("plats/medplat1.wav");
precache_sound ("plats/medplat2.wav");
self.noise = "plats/medplat1.wav";
self.noise1 = "plats/medplat2.wav";
}
self.mangle = self.angles;
self.angles = '0 0 0';
self.classname = "plat";
self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH;
setorigin (self, self.origin);
setmodel (self, self.model);
setsize (self, self.mins , self.maxs);
self.blocked = plat_crush;
if (!self.speed)
self.speed = 150;
// pos1 is the top position, pos2 is the bottom
self.pos1 = self.origin;
self.pos2 = self.origin;
if (self.height)
self.pos2_z = self.origin_z - self.height;
else
self.pos2_z = self.origin_z - self.size_z + 8;
self.use = plat_trigger_use;
plat_spawn_inside_trigger (); // the "start moving" trigger
if (self.targetname != "")
{
self.state = STATE_UP;
self.use = plat_use;
}
else
{
setorigin (self, self.pos2);
self.state = STATE_BOTTOM;
}
};
//============================================================================
//re-triggered trains from Rubicon 2 - dumptruck_ds
//============================================================================
void() train_next;
void() func_train_find;
float TRAIN_RETRIGGER = 1; //johnfitz -- retriggerable trains
void() train_blocked =
{
if (time < self.attack_finished)
return;
self.attack_finished = time + 0.5;
T_Damage (other, self, self, self.dmg);
};
void() train_use =
{
//johnfitz -- retriggerable trains
if (self.spawnflags & TRAIN_RETRIGGER) {
train_next();
return;
}
//johnfitz
if (self.think != func_train_find)
return; // already activated
train_next();
};
//johnfitz
void() train_moving_use =
{
//still moving, so save it for later
self.cnt = self.cnt + 1;
}
//johnfitz
void() train_wait =
{
//johnfitz -- retriggerable trains
if (self.spawnflags & TRAIN_RETRIGGER) {
if (self.cnt > 0) { //triggered early, so continue now
self.cnt = self.cnt - 1;
self.nextthink = self.ltime + 0.1;
self.think = train_next;
return;
}
self.use = train_use; //ready to be re-triggered
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM); //play stopping sound
return;
}
//johnfitz
if (self.wait)
{
self.nextthink = self.ltime + self.wait;
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
}
else
self.nextthink = self.ltime + 0.1;
self.think = train_next;
};
void() train_next =
{
local entity targ;
//johnfitz -- retriggerable trains
if (self.spawnflags & TRAIN_RETRIGGER) {
self.use = train_moving_use; //store up any premature triggerings until current movement is finished
}
//johnfitz
targ = find (world, targetname, self.target);
self.target = targ.target;
if (!self.target)
objerror ("train_next: no next target");
if (targ.wait)
self.wait = targ.wait;
else
self.wait = 0;
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
SUB_CalcMove (targ.origin - self.mins, self.speed, train_wait);
};
void() func_train_find =
{
local entity targ;
targ = find (world, targetname, self.target);
self.target = targ.target;
setorigin (self, targ.origin - self.mins);
if (!self.targetname)
{ // not triggered, so start immediately
self.nextthink = self.ltime + 0.1;
self.think = train_next;
}
};
/*QUAKED func_train (0 .5 .8) ? RETRIGGER
Trains are moving platforms that players can ride.
The targets origin specifies the min point of the train at each corner.
The train spawns at the first target it is pointing at.
If the train is the target of a button or trigger, it will not begin moving until activated.
RETRIGGER: stop at each path_corner and don't resume until triggered again (ignores wait time)
speed default 100
dmg default 2
noise path to custom sound
sounds
1) ratchet metal
2) base
3) custom
*/
void() func_train =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (!self.speed)
self.speed = 100;
if (!self.target)
objerror ("func_train without a target");
if (!self.dmg)
self.dmg = 2;
if (self.sounds == 0)
{
self.noise = ("misc/null.wav");
precache_sound ("misc/null.wav");
self.noise1 = ("misc/null.wav");
precache_sound ("misc/null.wav");
}
if (self.sounds == 1)
{
self.noise = ("plats/train2.wav");
precache_sound ("plats/train2.wav");
self.noise1 = ("plats/train1.wav");
precache_sound ("plats/train1.wav");
}
//johnfitz -- more sounds
if (self.sounds == 2)
{
self.noise = "doors/hydro2.wav";
precache_sound ("doors/hydro2.wav");
self.noise1 = "doors/hydro1.wav";
precache_sound ("doors/hydro1.wav");
}
if (self.sounds == 3) //custom sounds -- dumptruck_ds
{
self.noise = self.noise3; //stop sound
precache_sound (self.noise3);
self.noise1 = self.noise4; //sound in motion
precache_sound (self.noise4);
}
//johnfitz
self.cnt = 0; //johnfitz -- used to store premature trigger events when TRAIN_RETRIGGER is set
self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH;
self.blocked = train_blocked;
self.use = train_use;
self.classname = "train";
setmodel (self, self.model);
setsize (self, self.mins , self.maxs);
setorigin (self, self.origin);
// start trains on the second frame, to make sure their targets have had
// a chance to spawn
self.nextthink = self.ltime + 0.1;
self.think = func_train_find;
};
/*QUAKED misc_teleporttrain (0 .5 .8) (-8 -8 -8) (8 8 8)
This is used for the final bos
*/
void() misc_teleporttrain =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (!self.speed)
self.speed = 100;
if (!self.target)
objerror ("func_train without a target");
self.cnt = 1;
self.solid = SOLID_NOT;
self.movetype = MOVETYPE_PUSH;
self.blocked = train_blocked;
self.use = train_use;
self.avelocity = '100 200 300';
self.noise = ("misc/null.wav");
precache_sound ("misc/null.wav");
self.noise1 = ("misc/null.wav");
precache_sound ("misc/null.wav");
precache_model2 ("progs/teleport.mdl");
setmodel (self, "progs/teleport.mdl");
setsize (self, self.mins , self.maxs);
setorigin (self, self.origin);
// start trains on the second frame, to make sure their targets have had
// a chance to spawn
self.nextthink = self.ltime + 0.1;
self.think = func_train_find;
};

View File

@@ -0,0 +1,731 @@
void() bubble_bob;
/*
==============================================================================
PLAYER
==============================================================================
*/
$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 ]
{
self.weaponframe=0;
if (self.velocity_x || self.velocity_y)
{
self.walkframe=0;
player_run();
return;
}
if (self.weapon == IT_AXE)
{
if (self.walkframe >= 12)
self.walkframe = 0;
self.frame = $axstnd1 + self.walkframe;
}
else
{
if (self.walkframe >= 5)
self.walkframe = 0;
self.frame = $stand1 + self.walkframe;
}
self.walkframe = self.walkframe + 1;
};
void() player_run =[ $rockrun1, player_run ]
{
self.weaponframe=0;
if (!self.velocity_x && !self.velocity_y)
{
self.walkframe=0;
player_stand1();
return;
}
if (self.weapon == IT_AXE)
{
if (self.walkframe == 6)
self.walkframe = 0;
self.frame = $axrun1 + self.walkframe;
}
else
{
if (self.walkframe == 6)
self.walkframe = 0;
self.frame = self.frame + self.walkframe;
}
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_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_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_nail1 =[$nailatt1, player_nail2 ]
{
self.effects = self.effects | EF_MUZZLEFLASH;
if (!self.button0)
{player_run ();return;}
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe = 1;
SuperDamageSound();
W_FireSpikes (4);
self.attack_finished = time + 0.2;
};
void() player_nail2 =[$nailatt2, player_nail1 ]
{
self.effects = self.effects | EF_MUZZLEFLASH;
if (!self.button0)
{player_run ();return;}
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe = 1;
SuperDamageSound();
W_FireSpikes (-4);
self.attack_finished = time + 0.2;
};
//============================================================================
void() player_light1 =[$light1, player_light2 ]
{
self.effects = self.effects | EF_MUZZLEFLASH;
if (!self.button0)
{player_run ();return;}
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 5)
self.weaponframe = 1;
SuperDamageSound();
W_FireLightning();
self.attack_finished = time + 0.2;
};
void() player_light2 =[$light2, player_light1 ]
{
self.effects = self.effects | EF_MUZZLEFLASH;
if (!self.button0)
{player_run ();return;}
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 5)
self.weaponframe = 1;
SuperDamageSound();
W_FireLightning();
self.attack_finished = time + 0.2;
};
//============================================================================
void() player_rocket1 =[$rockatt1, player_rocket2 ] {self.weaponframe=1;
self.effects = self.effects | EF_MUZZLEFLASH;};
void() player_rocket2 =[$rockatt2, player_rocket3 ] {self.weaponframe=2;};
void() player_rocket3 =[$rockatt3, player_rocket4 ] {self.weaponframe=3;};
void() player_rocket4 =[$rockatt4, player_rocket5 ] {self.weaponframe=4;};
void() player_rocket5 =[$rockatt5, player_rocket6 ] {self.weaponframe=5;};
void() player_rocket6 =[$rockatt6, player_run ] {self.weaponframe=6;};
void(float num_bubbles) DeathBubbles;
void() PainSound =
{
local float rs;
if (self.health < 0)
return;
if (damage_attacker.classname == "teledeath")
{
sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
return;
}
// water pain sounds
if (self.watertype == CONTENT_WATER && self.waterlevel == 3)
{
DeathBubbles(1);
if (random() > 0.5)
sound (self, CHAN_VOICE, "player/drown1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "player/drown2.wav", 1, ATTN_NORM);
return;
}
// slime pain sounds
if (self.watertype == CONTENT_SLIME)
{
// FIX ME put in some steam here
if (random() > 0.5)
sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
return;
}
if (self.watertype == CONTENT_LAVA)
{
if (random() > 0.5)
sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
return;
}
if (self.pain_finished > time)
{
self.axhitme = 0;
return;
}
self.pain_finished = time + 0.5;
// don't make multiple pain sounds right after each other
// ax pain sound
if (self.axhitme == 1)
{
self.axhitme = 0;
sound (self, CHAN_VOICE, "player/axhit1.wav", 1, ATTN_NORM);
return;
}
rs = rint((random() * 5) + 1);
self.noise = "";
if (rs == 1)
self.noise = "player/pain1.wav";
else if (rs == 2)
self.noise = "player/pain2.wav";
else if (rs == 3)
self.noise = "player/pain3.wav";
else if (rs == 4)
self.noise = "player/pain4.wav";
else if (rs == 5)
self.noise = "player/pain5.wav";
else
self.noise = "player/pain6.wav";
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
return;
};
void() player_pain1 = [ $pain1, player_pain2 ] {PainSound();self.weaponframe=0;};
void() player_pain2 = [ $pain2, player_pain3 ] {};
void() player_pain3 = [ $pain3, player_pain4 ] {};
void() player_pain4 = [ $pain4, player_pain5 ] {};
void() player_pain5 = [ $pain5, player_pain6 ] {};
void() player_pain6 = [ $pain6, player_run ] {};
void() player_axpain1 = [ $axpain1, player_axpain2 ] {PainSound();self.weaponframe=0;};
void() player_axpain2 = [ $axpain2, player_axpain3 ] {};
void() player_axpain3 = [ $axpain3, player_axpain4 ] {};
void() player_axpain4 = [ $axpain4, player_axpain5 ] {};
void() player_axpain5 = [ $axpain5, player_axpain6 ] {};
void() player_axpain6 = [ $axpain6, player_run ] {};
void(entity attacker, float damage) player_pain =
{
if (self.weaponframe)
return;
if (self.invisible_finished > time)
return; // eyes don't have pain frames
if (self.weapon == IT_AXE)
player_axpain1 ();
else
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;
if (self.owner.waterlevel != 3)
return;
bubble = spawn();
setmodel (bubble, "progs/s_bubble.spr");
setorigin (bubble, self.owner.origin + '0 0 24');
bubble.movetype = MOVETYPE_NOCLIP;
bubble.solid = SOLID_NOT;
bubble.velocity = '0 0 15';
bubble.nextthink = time + 0.5;
bubble.think = bubble_bob;
bubble.classname = "bubble";
bubble.frame = 0;
bubble.cnt = 0;
setsize (bubble, '-8 -8 -8', '8 8 8');
self.nextthink = time + 0.1;
self.think = DeathBubblesSpawn;
self.air_finished = self.air_finished + 1;
if (self.air_finished >= self.bubble_count)
remove(self);
};
void(float num_bubbles) DeathBubbles =
{
local entity bubble_spawner;
bubble_spawner = spawn();
setorigin (bubble_spawner, self.origin);
bubble_spawner.movetype = MOVETYPE_NONE;
bubble_spawner.solid = SOLID_NOT;
bubble_spawner.nextthink = time + 0.1;
bubble_spawner.think = DeathBubblesSpawn;
bubble_spawner.air_finished = 0;
bubble_spawner.owner = self;
bubble_spawner.bubble_count = num_bubbles;
return;
};
void() DeathSound =
{
local float rs;
// water death sounds
if (self.waterlevel == 3)
{
DeathBubbles(20);
sound (self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
return;
}
rs = rint ((random() * 4) + 1);
if (rs == 1)
self.noise = "player/death1.wav";
if (rs == 2)
self.noise = "player/death2.wav";
if (rs == 3)
self.noise = "player/death3.wav";
if (rs == 4)
self.noise = "player/death4.wav";
if (rs == 5)
self.noise = "player/death5.wav";
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
return;
};
void() PlayerDead =
{
self.nextthink = -1;
// allow respawn after a certain time
self.deadflag = DEAD_DEAD;
};
vector(float dm) VelocityForDamage =
{
local vector v;
v_x = 100 * crandom();
v_y = 100 * crandom();
v_z = 200 + 100 * random();
if (dm > -50)
{
// dprint ("level 1\n");
v = v * 0.7;
}
else if (dm > -200)
{
// dprint ("level 3\n");
v = v * 2;
}
else
v = v * 10;
return v;
};
void(string gibname, float dm) ThrowGib =
{
local entity new;
new = spawn();
new.origin = self.origin;
setmodel (new, gibname);
setsize (new, '0 0 0', '0 0 0');
new.velocity = VelocityForDamage (dm);
new.movetype = MOVETYPE_BOUNCE;
new.solid = SOLID_NOT;
new.avelocity_x = random()*600;
new.avelocity_y = random()*600;
new.avelocity_z = random()*600;
new.think = SUB_Remove;
new.ltime = time;
new.nextthink = time + 10 + random()*10;
new.frame = 0;
new.flags = 0;
};
void(string gibname, float dm) ThrowHead =
{
setmodel (self, gibname);
self.frame = 0;
self.nextthink = -1;
self.movetype = MOVETYPE_BOUNCE;
self.takedamage = DAMAGE_NO;
self.solid = SOLID_NOT;
self.view_ofs = '0 0 8';
setsize (self, '-16 -16 0', '16 16 56');
self.velocity = VelocityForDamage (dm);
self.origin_z = self.origin_z - 24;
self.flags = self.flags - (self.flags & FL_ONGROUND);
self.avelocity = crandom() * '0 600 0';
};
void() GibPlayer =
{
ThrowHead ("progs/h_player.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
self.deadflag = DEAD_DEAD;
if (damage_attacker.classname == "teledeath")
{
sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
return;
}
if (damage_attacker.classname == "teledeath2")
{
sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
return;
}
if (random() < 0.5)
sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
else
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
};
void() PlayerDie =
{
local float i;
self.items = self.items - (self.items & IT_INVISIBILITY);
self.invisible_finished = 0; // don't die as eyes
self.invincible_finished = 0;
self.super_damage_finished = 0;
self.radsuit_finished = 0;
self.modelindex = modelindex_player; // don't use eyes
if (deathmatch || coop)
DropBackpack();
self.weaponmodel="";
self.view_ofs = '0 0 -8';
self.deadflag = DEAD_DYING;
self.solid = SOLID_NOT;
self.flags = self.flags - (self.flags & FL_ONGROUND);
self.movetype = MOVETYPE_TOSS;
if (self.velocity_z < 10)
self.velocity_z = self.velocity_z + random()*300;
if (self.health < -40)
{
GibPlayer ();
return;
}
DeathSound();
self.angles_x = 0;
self.angles_z = 0;
if (self.weapon == IT_AXE)
{
player_die_ax1 ();
return;
}
i = cvar("temp1");
if (!i)
i = 1 + floor(random()*6);
if (i == 1)
player_diea1();
else if (i == 2)
player_dieb1();
else if (i == 3)
player_diec1();
else if (i == 4)
player_died1();
else
player_diee1();
};
void() set_suicide_frame =
{ // used by klill command and diconnect command
if (self.model != "progs/player.mdl")
return; // allready gibbed
self.frame = $deatha11;
self.solid = SOLID_NOT;
self.movetype = MOVETYPE_TOSS;
self.deadflag = DEAD_DEAD;
self.nextthink = -1;
};
void() player_diea1 = [ $deatha1, player_diea2 ] {};
void() player_diea2 = [ $deatha2, player_diea3 ] {};
void() player_diea3 = [ $deatha3, player_diea4 ] {};
void() player_diea4 = [ $deatha4, player_diea5 ] {};
void() player_diea5 = [ $deatha5, player_diea6 ] {};
void() player_diea6 = [ $deatha6, player_diea7 ] {};
void() player_diea7 = [ $deatha7, player_diea8 ] {};
void() player_diea8 = [ $deatha8, player_diea9 ] {};
void() player_diea9 = [ $deatha9, player_diea10 ] {};
void() player_diea10 = [ $deatha10, player_diea11 ] {};
void() player_diea11 = [ $deatha11, player_diea11 ] {PlayerDead();};
void() player_dieb1 = [ $deathb1, player_dieb2 ] {};
void() player_dieb2 = [ $deathb2, player_dieb3 ] {};
void() player_dieb3 = [ $deathb3, player_dieb4 ] {};
void() player_dieb4 = [ $deathb4, player_dieb5 ] {};
void() player_dieb5 = [ $deathb5, player_dieb6 ] {};
void() player_dieb6 = [ $deathb6, player_dieb7 ] {};
void() player_dieb7 = [ $deathb7, player_dieb8 ] {};
void() player_dieb8 = [ $deathb8, player_dieb9 ] {};
void() player_dieb9 = [ $deathb9, player_dieb9 ] {PlayerDead();};
void() player_diec1 = [ $deathc1, player_diec2 ] {};
void() player_diec2 = [ $deathc2, player_diec3 ] {};
void() player_diec3 = [ $deathc3, player_diec4 ] {};
void() player_diec4 = [ $deathc4, player_diec5 ] {};
void() player_diec5 = [ $deathc5, player_diec6 ] {};
void() player_diec6 = [ $deathc6, player_diec7 ] {};
void() player_diec7 = [ $deathc7, player_diec8 ] {};
void() player_diec8 = [ $deathc8, player_diec9 ] {};
void() player_diec9 = [ $deathc9, player_diec10 ] {};
void() player_diec10 = [ $deathc10, player_diec11 ] {};
void() player_diec11 = [ $deathc11, player_diec12 ] {};
void() player_diec12 = [ $deathc12, player_diec13 ] {};
void() player_diec13 = [ $deathc13, player_diec14 ] {};
void() player_diec14 = [ $deathc14, player_diec15 ] {};
void() player_diec15 = [ $deathc15, player_diec15 ] {PlayerDead();};
void() player_died1 = [ $deathd1, player_died2 ] {};
void() player_died2 = [ $deathd2, player_died3 ] {};
void() player_died3 = [ $deathd3, player_died4 ] {};
void() player_died4 = [ $deathd4, player_died5 ] {};
void() player_died5 = [ $deathd5, player_died6 ] {};
void() player_died6 = [ $deathd6, player_died7 ] {};
void() player_died7 = [ $deathd7, player_died8 ] {};
void() player_died8 = [ $deathd8, player_died9 ] {};
void() player_died9 = [ $deathd9, player_died9 ] {PlayerDead();};
void() player_diee1 = [ $deathe1, player_diee2 ] {};
void() player_diee2 = [ $deathe2, player_diee3 ] {};
void() player_diee3 = [ $deathe3, player_diee4 ] {};
void() player_diee4 = [ $deathe4, player_diee5 ] {};
void() player_diee5 = [ $deathe5, player_diee6 ] {};
void() player_diee6 = [ $deathe6, player_diee7 ] {};
void() player_diee7 = [ $deathe7, player_diee8 ] {};
void() player_diee8 = [ $deathe8, player_diee9 ] {};
void() player_diee9 = [ $deathe9, player_diee9 ] {PlayerDead();};
void() player_die_ax1 = [ $axdeth1, player_die_ax2 ] {};
void() player_die_ax2 = [ $axdeth2, player_die_ax3 ] {};
void() player_die_ax3 = [ $axdeth3, player_die_ax4 ] {};
void() player_die_ax4 = [ $axdeth4, player_die_ax5 ] {};
void() player_die_ax5 = [ $axdeth5, player_die_ax6 ] {};
void() player_die_ax6 = [ $axdeth6, player_die_ax7 ] {};
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)
*/
void() player_dead_axe =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
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');
}
else
{
self.solid = SOLID_NOT;
}
};
/*QUAKED player_dead_face_down (0 0.5 0.8) (-16 -16 -24) (16 16 32)
*/
void() player_dead_face_down =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
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');
}
else
{
self.solid = SOLID_NOT;
}
};
/*QUAKED player_dead_on_side (0 0.5 0.8) (-16 -16 -24) (16 16 32)
*/
void() player_dead_on_side =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
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');
}
else
{
self.solid = SOLID_NOT;
}
};
/* END Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */

View File

@@ -0,0 +1,51 @@
../progs.dat
defs.qc //added fields, see comments for details
newflags.qc //new spawnflags for all entities
subs.qc //modified targets, triggers and killtargets
fight.qc
ai.qc
combat.qc
items.qc
weapons.qc
world.qc
client.qc
player.qc
monsters.qc //modified by dumptruck_ds from Preach's spawning tutorial | fish count fixed
doors.qc
buttons.qc
triggers.qc //added trigger_push_custom based on Hipnotic
plats.qc
misc.qc
lights.qc //c0burn's excellent switchable lights
ogre.qc
demon.qc
shambler.qc
knight.qc
soldier.qc
wizard.qc
dog.qc
zombie.qc //modified version of Ace_Dave's zombies from Rubicon2 source
boss.qc
tarbaby.qc // registered
hknight.qc // registered
fish.qc // registered
shalrath.qc // registered
enforcer.qc // registered
oldone.qc // registered
dtmisc.qc // sound code from Hipnotic & Rubicon Rumble and misc visual effects
math.qc // Code by Joshua Skelton
misc_model.qc // Code by Joshua Skelton
hipcount.qc //Hipnotic counter
hippart.qc //Hipnotic particlefield and func_togglewall
hiptrig.qc //Hipnotic triggers qc
doelightning.qc //from DOE lightnin.qc
doeplats.qc //Rogue MP newplats.qc
elevatr.qc //Rogue elevator code
rubicon2.qc //selections from Rubicon2 QC
dtquake.qc //triggerable earthquake from Zer cutscenes
rotate.qc //from Hipnotic thanks RennyC
func_bob.qc //RennyC's stand alone version based on Acrcane Dimensions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,830 @@
//selections from Rubicon 2 qc by john fitzgibbons
//and AD breakable code modified by Qmaster and dumptruck_ds
float BREAKABLE_NO_MONSTERS = 1;
float BREAK_EXPLODE = 2;
float BREAK_CUSTOM = 4;
float SPARKS_BLUE = 2;
float SPARKS_PALE = 4;
void() make_breakable_debris;
/*
===============================================================================
func_explobox
===============================================================================
*/
void () func_explobox_explode_silent =
{
self.takedamage = DAMAGE_NO;
self.origin = ((self.absmin + self.absmax) * 0.5);
self.classname = "explo_box";
T_RadiusDamage (self, self, self.dmg, world);
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 ();
};
void () func_explobox_explode = {
// sound (self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
func_explobox_explode_silent();
};
void () func_explobox_die =
{
self.nextthink = 0.2; //for some reason, time + 0.2 doesn't work
self.think = func_explobox_explode;
};
/*QUAKED func_explobox (0 .5 .8) ? START_OFF
An exploding brush entity. Works just like misc_explobox.
Keys:
"health" Default 20
"dmg" default 100
*/
void () func_explobox =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH;
setmodel (self, self.model);
precache_sound ("weapons/r_exp3.wav");
if (!self.health)
{
self.health = 20;
}
if (!self.dmg)
{
self.dmg = 100;
}
self.th_die = func_explobox_die;
self.takedamage = DAMAGE_AIM;
};
/*
===============================================================================
func_breakable
===============================================================================
*/
.string break_template1;
.string break_template2;
.string break_template3;
.string break_template4;
.string break_template5;
.float brk_obj_count1;
.float brk_obj_count2;
.float brk_obj_count3;
.float brk_obj_count4;
.float brk_obj_count5;
// template system from Qmaster -- dumptruck_ds
void() make_breakable_templates_debris = {
local float i;
local entity new;
i = 0;
if (self.break_template1 != "") {
while (i < self.brk_obj_count1) {
new = spawn();
new.model = self.break_template1;
new.origin_x = (self.maxs_x - self.mins_x)*random() + self.mins_x;
new.origin_y = (self.maxs_y - self.mins_y)*random() + self.mins_y;
new.origin_z = (self.maxs_z - self.mins_z)*random() + self.mins_z;
setmodel (new, new.model); //dumptruck_ds
setsize (new, '0 0 0', '0 0 0');
new.velocity = VelocityForDamage (self.health*2);
new.movetype = MOVETYPE_BOUNCE;
new.solid = SOLID_NOT;
new.avelocity_x = random()*600;
new.avelocity_y = random()*600;
new.avelocity_z = random()*600;
new.think = SUB_Remove;
new.ltime = time;
new.nextthink = time + 10 + random()*10;
new.flags = 0;
i++;
}
}
i = 0;
if (self.break_template2 != "") {
while (i < self.brk_obj_count2) {
new = spawn();
new.model = self.break_template2;
new.origin_x = (self.maxs_x - self.mins_x)*random() + self.mins_x;
new.origin_y = (self.maxs_y - self.mins_y)*random() + self.mins_y;
new.origin_z = (self.maxs_z - self.mins_z)*random() + self.mins_z;
setmodel (new, new.model); //dumptruck_ds
setsize (new, '0 0 0', '0 0 0');
new.velocity = VelocityForDamage (self.health*2);
new.movetype = MOVETYPE_BOUNCE;
new.solid = SOLID_NOT;
new.avelocity_x = random()*600;
new.avelocity_y = random()*600;
new.avelocity_z = random()*600;
new.think = SUB_Remove;
new.ltime = time;
new.nextthink = time + 10 + random()*10;
new.flags = 0;
i++;
}
}
i = 0;
if (self.break_template3 != "") {
while (i < self.brk_obj_count3) {
new = spawn();
new.model = self.break_template3;
new.origin_x = (self.maxs_x - self.mins_x)*random() + self.mins_x;
new.origin_y = (self.maxs_y - self.mins_y)*random() + self.mins_y;
new.origin_z = (self.maxs_z - self.mins_z)*random() + self.mins_z;
setmodel (new, new.model); //dumptruck_ds
setsize (new, '0 0 0', '0 0 0');
new.velocity = VelocityForDamage (self.health*2);
new.movetype = MOVETYPE_BOUNCE;
new.solid = SOLID_NOT;
new.avelocity_x = random()*600;
new.avelocity_y = random()*600;
new.avelocity_z = random()*600;
new.think = SUB_Remove;
new.ltime = time;
new.nextthink = time + 10 + random()*10;
new.flags = 0;
i++;
}
}
i = 0;
if (self.break_template4 != "") {
while (i < self.brk_obj_count4) {
new = spawn();
new.model = self.break_template4;
new.origin_x = (self.maxs_x - self.mins_x)*random() + self.mins_x;
new.origin_y = (self.maxs_y - self.mins_y)*random() + self.mins_y;
new.origin_z = (self.maxs_z - self.mins_z)*random() + self.mins_z;
setmodel (new, new.model); //dumptruck_ds
setsize (new, '0 0 0', '0 0 0');
new.velocity = VelocityForDamage (self.health*2);
new.movetype = MOVETYPE_BOUNCE;
new.solid = SOLID_NOT;
new.avelocity_x = random()*600;
new.avelocity_y = random()*600;
new.avelocity_z = random()*600;
new.think = SUB_Remove;
new.ltime = time;
new.nextthink = time + 10 + random()*10;
new.flags = 0;
i++;
}
}
i = 0;
if (self.break_template5 != "") {
while (i < self.brk_obj_count5) {
new = spawn();
new.model = self.break_template5;
new.origin_x = (self.maxs_x - self.mins_x)*random() + self.mins_x;
new.origin_y = (self.maxs_y - self.mins_y)*random() + self.mins_y;
new.origin_z = (self.maxs_z - self.mins_z)*random() + self.mins_z;
setmodel (new, new.model); //dumptruck_ds
setsize (new, '0 0 0', '0 0 0');
new.velocity = VelocityForDamage (self.health*2);
new.movetype = MOVETYPE_BOUNCE;
new.solid = SOLID_NOT;
new.avelocity_x = random()*600;
new.avelocity_y = random()*600;
new.avelocity_z = random()*600;
new.think = SUB_Remove;
new.ltime = time;
new.nextthink = time + 10 + random()*10;
new.flags = 0;
i++;
}
}
};
//Below this is from Rubicon2 -- dumptruck_ds
void() make_breakable_debris = {
local float i;
i = 0;
while (i < self.cnt)
{
local entity new;
new = spawn();
new.origin_x = (self.maxs_x - self.mins_x)*random() + self.mins_x;
new.origin_y = (self.maxs_y - self.mins_y)*random() + self.mins_y;
new.origin_z = (self.maxs_z - self.mins_z)*random() + self.mins_z;
// setmodel (new, "progs/debris.mdl"); this was originally just an mdl from Rubicon2, now you set custom model via spawnflag or use the builtin from Rubicon2 -- dumptruck_ds
setmodel (new, self.mdl_debris); //dumptruck_ds
setsize (new, '0 0 0', '0 0 0');
new.velocity = VelocityForDamage (self.health*2);
new.movetype = MOVETYPE_BOUNCE;
new.solid = SOLID_NOT;
new.avelocity_x = random()*600;
new.avelocity_y = random()*600;
new.avelocity_z = random()*600;
new.think = SUB_Remove;
new.ltime = time;
new.nextthink = time + 10 + random()*10;
new.flags = 0;
// randomly choose size
if (random() > 0.333)
new.frame = 1; //larger
else
new.frame = 2; //smaller
// choose skin based on "style" key
if (self.style == 1)
new.skin = 1;
if (self.style == 2)
new.skin = 2;
i = i + 1;
}
};
void () func_breakable_die = {
//dumptruck_ds -- set the spawnflag for cosmetic explosion effect; use "dmg" value to hurt the player
{
local entity ent; //thanks to Qmaster!!! He helped me sort out noise1 playing from 0 0 0 with this temp entity - dumptruck_ds
ent = spawn();
ent.origin = ((self.absmin + self.absmax) * 0.5);
setsize (ent, '0 0 0', '0 0 0');
ent.solid = SOLID_NOT;
ent.think = SUB_Remove;
// ent.ltime = time;
ent.nextthink = time + 60;
sound(ent, CHAN_AUTO, self.noise1, 1, ATTN_NORM);
// remove (self);
}
// this is to ensure that any debris from another func_breakable
// which is resting on top of this func_breakable is not left
// floating in mid-air after this entity is removed -- iw
SUB_DislodgeRestingEntities ();
if (self.spawnflags & BREAK_EXPLODE) {
if (self.spawnflags & BREAK_CUSTOM) {
make_breakable_templates_debris ();
} else {
make_breakable_debris ();
}
func_explobox_explode_silent(); // to let us use noise2
// sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM); this is broken as of 1.1.0 no custom explosion sound for now -- dumptruck_ds
remove (self);
} else {
self.origin = ((self.absmin + self.absmax) * 0.5);
setorigin (self, self.origin);
if (self.spawnflags & BREAK_CUSTOM) {
make_breakable_templates_debris ();
remove (self);
} else {
make_breakable_debris ();
remove (self);
}
}
};
void () func_breakable_killed =
{
activator = damage_attacker;
SUB_UseTargets ();
func_breakable_die ();
};
void () func_breakable_use =
{
activator = other;
SUB_UseTargets ();
func_breakable_die ();
};
/*QUAKED func_breakable (0 .5 .8) ? NO_MONSTERS
A visible object that can be destroyed by shooting it. If it has a targetname, it will not be directly damageable.
BREAKABLE_NO_MONSTERS: object ignores damage from monsters
"health" Default 20
"cnt" number of pieces of debris to spawn. default 5. (was 6 -- dumptruck_ds)
"style" The style of the debris:
0 = green metal (default)
1 = red metal
2 = concrete
*/
void() break_template_setup = {
if (self.break_template1 != "") precache_model(self.break_template1);
if (self.break_template2 != "") precache_model(self.break_template2);
if (self.break_template3 != "") precache_model(self.break_template3);
if (self.break_template4 != "") precache_model(self.break_template4);
if (self.break_template5 != "") precache_model(self.break_template5);
};
void () func_breakable = {
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
break_template_setup();
self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH;
setmodel (self, self.model);
self.mdl_debris = "progs/debris.mdl";
precache_model (self.mdl_debris);
precache_sound ("blob/hit1.wav");
if (self.noise1 != "") precache_sound(self.noise1);
else
(self.noise1 = "blob/hit1.wav");
if (!self.health)
self.health = 20;
if (!self.cnt)
self.cnt = 5; // was 6 dumptruck_ds
if (self.targetname != "")
{
self.use = func_breakable_use;
}
else
{
self.takedamage = DAMAGE_YES;
self.th_die = func_breakable_killed;
}
};
/*
===============================================================================
trigger_ladder
===============================================================================
*/
void() ladder_touch =
{
if (other.classname != "player")
return;
// prevent the player "sticking" to a ladder if they are standing on
// the platform at the top of the ladder with the bottom of their
// bounding box flush with the top of the trigger -- iw
if (other.absmin_z + 1 >= self.absmax_z - 1)
return;
// if the trigger has an angles field, check player's facing direction
if (self.movedir != '0 0 0')
{
makevectors (other.angles);
if (v_forward * self.movedir < 0)
return; // not facing the right way
}
other.onladder = 1;
}
/*QUAKED trigger_ladder (.5 .5 .5) ?
invisible ladder entity. when player is touching this entity, he can climb by pushing 'jump'
Keys:
"angle" the direction player must be facing to climb ladder
*/
void() trigger_ladder =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
// ignore an "up" or "down" angle (doesn't make sense for a ladder)
if (self.angles_y == -1 || self.angles_y == -2)
{
dprint ("WARNING: trigger_ladder ignored bad 'angle' value: ");
dprint (ftos (self.angles_y));
dprint ("\n");
self.angles_y = 0;
}
InitTrigger ();
self.touch = ladder_touch;
};
/*
===============================================================================
func_laser
===============================================================================
*/
float LASER_SOLID = 2;
.string message2;
.float alpha;
void() laser_helper_think =
{
if (!self.owner || self.owner.classname != "func_laser")
{
remove(self);
return;
}
if (!(self.owner.spawnflags & START_OFF))
self.owner.alpha = self.alpha * 0.8 + self.alpha * random() * 0.4;
self.nextthink = time + 0.05;
};
void() func_laser_touch =
{
if (other.takedamage && self.attack_finished < time)
{
T_Damage (other, self, self, self.dmg);
self.attack_finished = time + 0.1;
}
};
void () func_laser_use =
{
if (self.spawnflags & START_OFF)
{
setorigin(self, '0 0 0');
self.spawnflags = self.spawnflags - START_OFF;
// changed for progs_dump: the laser sound is now emitted from
// the func_laser itself instead of from the activator -- iw
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
if (activator.classname == "player" && self.message != "")
{
centerprint (activator, self.message);
}
}
else
{
// changed for progs_dump: the laser sound is now emitted from
// the func_laser itself instead of from the activator -- iw
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
setorigin(self, '0 0 9000');
self.spawnflags = self.spawnflags + START_OFF;
if (activator.classname == "player" && self.message2 != "")
{
centerprint (activator, self.message2);
}
}
};
/*QUAKED func_laser (0 .5 .8) ? START_OFF LASER_SOLID
A togglable laser, hurts to touch, can be used to block players
START_OFF: Laser starts off.
LASER_SOLID: Laser blocks movement while turned on.
Keys:
"dmg" damage to do on touch. default 1
"alpha" approximate alpha you want the laser drawn at. default 0.5. alpha will vary by 20% of this value.
"message" message to display when activated
"message2" message to display when deactivated
*/
void () func_laser =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
local entity helper;
setmodel (self, self.model);
precache_sound ("buttons/switch02.wav");
precache_sound ("buttons/switch04.wav");
if (self.spawnflags & LASER_SOLID)
{
self.solid = SOLID_BSP; //so you can shoot between lasers in a single bmodel
self.movetype = MOVETYPE_PUSH; //required becuase of SOLID_BSP
}
else
{
self.solid = SOLID_TRIGGER;
self.movetype = MOVETYPE_NONE;
}
if (!self.alpha)
self.alpha = 0.5;
if (!self.dmg)
self.dmg = 1;
self.use = func_laser_use;
self.touch = func_laser_touch;
if (self.spawnflags & START_OFF)
setorigin(self, '0 0 9000');
{
if (self.noise != "") precache_sound(self.noise);
else
(self.noise = "buttons/switch02.wav");
}
{
if (self.noise1 != "") precache_sound(self.noise1);
else
(self.noise1 = "buttons/switch04.wav");
}
//spawn a second entity to handle alpha changes, since MOVETYPE_PUSH doesn't support think functions
helper = spawn();
helper.alpha = self.alpha;
helper.owner = self;
helper.nextthink = 0.05;
helper.think = laser_helper_think;
};
/*
===============================================================================
misc_sparks
===============================================================================
*/
void() sparks_fade1 = [0, sparks_fade2] {self.alpha = 0.8; self.nextthink = time + 0.05;};
void() sparks_fade2 = [0, sparks_fade3] {self.alpha = 0.6; self.nextthink = time + 0.05;};
void() sparks_fade3 = [0, sparks_fade4] {self.alpha = 0.4; self.nextthink = time + 0.05;};
void() sparks_fade4 = [0, SUB_Remove] {self.alpha = 0.2; self.nextthink = time + 0.05;};
void() sparks_use =
{
if (self.spawnflags & START_OFF)
self.spawnflags = self.spawnflags - START_OFF;
else
self.spawnflags = self.spawnflags + START_OFF;
};
void() make_sparks;
void() spark_turnofflight =
{
SUB_UseTargets();
self.think = make_sparks;
self.nextthink = time + (random() + 0.5)*self.wait - 0.15;
}
void() make_sparks =
{
if (self.spawnflags & START_OFF)
{
self.nextthink = time + 0.1;
self.think = make_sparks;
}
else
{
local float i;
i = -0.25*self.cnt + random()*0.5*self.cnt;
while (i < self.cnt)
{
local entity spark;
spark = spawn();
spark.owner = self;
setmodel (spark, "progs/spark.mdl");
setorigin (spark, self.origin);
spark.movetype = MOVETYPE_BOUNCE;
spark.solid = SOLID_TRIGGER;
spark.gravity = 0.3;
spark.velocity_x = -40 + random() * 80;
spark.velocity_y = -40 + random() * 80;
spark.velocity_z = -40 + random() * 80;
spark.avelocity = '3000 3000 3000';
spark.nextthink = time + 0.5 + 1.5*random();
spark.think = sparks_fade1;
spark.classname = "spark";
if (random() < 0.33)
spark.skin = 0;
else if (random() < 0.5)
spark.skin = 1;
else
spark.skin = 2;
if (self.spawnflags & SPARKS_PALE)
spark.skin = spark.skin + 6;
else if (self.spawnflags & SPARKS_BLUE)
spark.skin = spark.skin + 3;
setsize (spark, '0 0 0', '0 0 0');
i = i + 1;
}
if (self.sounds == 1)
sound (self, CHAN_AUTO, "dump/spark.wav", 1, ATTN_STATIC);
SUB_UseTargets();
self.nextthink = time + 0.1 + random() * 0.1;
self.think = spark_turnofflight;
}
};
/*QUAKED misc_sparks (0 .5 .8) (-8 -8 -8) (8 8 8) START_OFF SPARKS_BLUE SPARKS_PALE
Produces a burst of yellow sparks at random intervals. If targeted, it will toggle between on or off. If it targets a light, that light will flash allong with each burst of sparks. Note: targeted lights should be set to START_OFF.
SPARKS_BLUE: sparks are blue in color
SPARKS_PALE: sparks are pale yellow in color
Keys:
"wait" is the average delay between bursts (variance is 1/2 wait). Default is 2.
"cnt" is the average number of sparks in a burst (variance is 1/4 cnt). Default is 15.
"sounds"
0) no sound
1) sparks
*/
void() misc_sparks =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_model ("progs/spark.mdl");
precache_sound ("dump/spark.wav");
if (!self.movedir)
self.movedir = '0 0 -30';
if (!self.wait)
self.wait = 2;
if (!self.cnt)
self.cnt = 15;
self.use = sparks_use;
self.nextthink = time + random()*0.1;
self.think = make_sparks;
};
/*
===============================================================================
misc_particles a.k.a. misc_splash
===============================================================================
*/
void() splash_use =
{
if (self.spawnflags & START_OFF)
self.spawnflags = self.spawnflags - START_OFF;
else
self.spawnflags = self.spawnflags + START_OFF;
};
void() splash_think =
{
if (self.spawnflags & START_OFF)
{
self.nextthink = time + 0.1;
self.think = splash_think;
}
else
{
local vector vec;
local float variance;
variance = vlen(self.movedir) / 2;
vec_x = self.movedir_x - variance + random() * variance * 2;
vec_y = self.movedir_y - variance + random() * variance * 2;
vec_z = self.movedir_z - variance + random() * variance * 2;
particle (self.origin, vec, self.color, self.volume);
self.nextthink = time + self.wait;
}
};
//
//misc_particles
//
// renamed from misc_splash (Rubcion 2) --dumptruck_ds
//
/*QUAKED misc_particles (0 .5 .8) (-8 -8 -8) (8 8 8) START_OFF
Produces a continuous particle splash for waterfalls and other effects
"color" color of particles. 0 through 15, corresponds to a row of the quake palette. (default 0)
"movedir" average movement vector of particles (default 0 0 4)
"wait" time between particle generation cycles. (default 0.1)
"volume" density of particles. (default 10)
*/
void() misc_particles =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (!self.wait)
self.wait = 0.1;
if (!self.movedir)
self.movedir = '0 0 4';
if (!self.volume)
self.volume = 10;
self.color = self.color * 16;
self.use = splash_use;
self.nextthink = time + self.wait;
self.think = splash_think;
};
//##########################################
//#### Particle Sprayer ####
//##########################################
//this is from Custents not Rubicon2 -- dumptruck_ds
//renamed from func to misc
/*QUAKED misc_particlespray (0 .5 .8) (-8 -8 -8) (8 8 8)
Shoots particles either when triggered, or contiuously when not triggered by anything.
"color" is the palette color of the particles
"count" is the number of particles to make each time
"delay" is the delay between each triggering
"noise" is the name of the wav file to play when triggered
"movedir" is the vector distance that the particles will travel before disappearing. (in x y z)
"duration" is the amount of time that the it will continue to release particles so that it can release a long stream of particles with only one triggering.*/
.float endtime;
.float duration;
void() partspray_think =
{
particle (self.origin, self.movedir, self.color, self.count);
if(!self.targetname || self.endtime > time)
self.nextthink = time + self.delay;
if(self.noise != "")
sound(self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
else
sound(self, CHAN_AUTO, "misc/null.wav", 1, ATTN_NORM);
};
void() partspray_use =
{
self.endtime = time + self.duration;
partspray_think();
};
void() misc_particlespray =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if ( !self.color )
self.color = 47;
if ( self.count <= 0 )
self.count = 15;
if(self.delay <= 0)
self.delay = 0.1;
self.classname = "particlespray";
if (self.noise != "")
precache_sound(self.noise);
precache_sound ("misc/null.wav");
self.think = partspray_think;
if(!self.targetname)
self.nextthink = time + 0.1 + self.delay;
else
self.use = partspray_use;
};

View File

@@ -0,0 +1,269 @@
/*
==============================================================================
SHAL-RATH
==============================================================================
*/
$cd id1/models/shalrath
$origin 0 0 24
$base base
$skin skin
$scale 0.7
$frame attack1 attack2 attack3 attack4 attack5 attack6 attack7 attack8
$frame attack9 attack10 attack11
$frame pain1 pain2 pain3 pain4 pain5
$frame death1 death2 death3 death4 death5 death6 death7
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10
$frame walk11 walk12
void(entity attacker, float damage) shalrath_pain;
void() ShalMissile;
void() shal_stand =[ $walk1, shal_stand ] {ai_stand();};
void() shal_walk1 =[ $walk2, shal_walk2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "shalrath/idle.wav", 1, ATTN_IDLE);
ai_walk(6);};
void() shal_walk2 =[ $walk3, shal_walk3 ] {ai_walk(4);};
void() shal_walk3 =[ $walk4, shal_walk4 ] {ai_walk(0);};
void() shal_walk4 =[ $walk5, shal_walk5 ] {ai_walk(0);};
void() shal_walk5 =[ $walk6, shal_walk6 ] {ai_walk(0);};
void() shal_walk6 =[ $walk7, shal_walk7 ] {ai_walk(0);};
void() shal_walk7 =[ $walk8, shal_walk8 ] {ai_walk(5);};
void() shal_walk8 =[ $walk9, shal_walk9 ] {ai_walk(6);};
void() shal_walk9 =[ $walk10, shal_walk10 ] {ai_walk(5);};
void() shal_walk10 =[ $walk11, shal_walk11 ] {ai_walk(0);};
void() shal_walk11 =[ $walk12, shal_walk12 ] {ai_walk(4);};
void() shal_walk12 =[ $walk1, shal_walk1 ] {ai_walk(5);};
void() shal_run1 =[ $walk2, shal_run2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "shalrath/idle.wav", 1, ATTN_IDLE);
ai_run(6);};
void() shal_run2 =[ $walk3, shal_run3 ] {ai_run(4);};
void() shal_run3 =[ $walk4, shal_run4 ] {ai_run(0);};
void() shal_run4 =[ $walk5, shal_run5 ] {ai_run(0);};
void() shal_run5 =[ $walk6, shal_run6 ] {ai_run(0);};
void() shal_run6 =[ $walk7, shal_run7 ] {ai_run(0);};
void() shal_run7 =[ $walk8, shal_run8 ] {ai_run(5);};
void() shal_run8 =[ $walk9, shal_run9 ] {ai_run(6);};
void() shal_run9 =[ $walk10, shal_run10 ] {ai_run(5);};
void() shal_run10 =[ $walk11, shal_run11 ] {ai_run(0);};
void() shal_run11 =[ $walk12, shal_run12 ] {ai_run(4);};
void() shal_run12 =[ $walk1, shal_run1 ] {ai_run(5);};
void() shal_attack1 =[ $attack1, shal_attack2 ] {
sound (self, CHAN_VOICE, "shalrath/attack.wav", 1, ATTN_NORM);
ai_face();
};
void() shal_attack2 =[ $attack2, shal_attack3 ] {ai_face();};
void() shal_attack3 =[ $attack3, shal_attack4 ] {ai_face();};
void() shal_attack4 =[ $attack4, shal_attack5 ] {ai_face();};
void() shal_attack5 =[ $attack5, shal_attack6 ] {ai_face();};
void() shal_attack6 =[ $attack6, shal_attack7 ] {ai_face();};
void() shal_attack7 =[ $attack7, shal_attack8 ] {ai_face();};
void() shal_attack8 =[ $attack8, shal_attack9 ] {ai_face();};
void() shal_attack9 =[ $attack9, shal_attack10 ] {ShalMissile();};
void() shal_attack10 =[ $attack10, shal_attack11 ] {ai_face();};
void() shal_attack11 =[ $attack11, shal_run1 ] {};
void() shal_pain1 =[ $pain1, shal_pain2 ] {};
void() shal_pain2 =[ $pain2, shal_pain3 ] {};
void() shal_pain3 =[ $pain3, shal_pain4 ] {};
void() shal_pain4 =[ $pain4, shal_pain5 ] {};
void() shal_pain5 =[ $pain5, shal_run1 ] {};
void() shal_death1 =[ $death1, shal_death2 ] {};
void() shal_death2 =[ $death2, shal_death3 ] {};
void() shal_death3 =[ $death3, shal_death4 ] {};
void() shal_death4 =[ $death4, shal_death5 ] {};
void() shal_death5 =[ $death5, shal_death6 ] {};
void() shal_death6 =[ $death6, shal_death7 ] {};
void() shal_death7 =[ $death7, shal_death7 ] {};
void(entity attacker, float damage) shalrath_pain =
{
if (self.pain_finished > time)
return;
sound (self, CHAN_VOICE, "shalrath/pain.wav", 1, ATTN_NORM);
shal_pain1();
self.pain_finished = time + 3;
};
void() shalrath_die =
{
// check for gib
if (self.health < -90)
{
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_shal.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
return;
}
sound (self, CHAN_VOICE, "shalrath/death.wav", 1, ATTN_NORM);
shal_death1();
self.solid = SOLID_NOT;
// insert death sounds here
};
/*
================
ShalMissile
================
*/
void() ShalMissileTouch;
void() ShalHome;
void() ShalMissile =
{
local entity missile;
local vector dir;
local float dist, flytime;
dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
dist = vlen (self.enemy.origin - self.origin);
flytime = dist * 0.002;
if (flytime < 0.1)
flytime = 0.1;
self.effects = self.effects | EF_MUZZLEFLASH;
sound (self, CHAN_WEAPON, "shalrath/attack2.wav", 1, ATTN_NORM);
missile = spawn ();
missile.owner = self;
missile.solid = SOLID_BBOX;
missile.movetype = MOVETYPE_FLYMISSILE;
setmodel (missile, "progs/v_spike.mdl");
setsize (missile, '0 0 0', '0 0 0');
missile.origin = self.origin + '0 0 10';
missile.velocity = dir * 400;
missile.avelocity = '300 300 300';
missile.nextthink = flytime + time;
missile.think = ShalHome;
missile.enemy = self.enemy;
missile.touch = ShalMissileTouch;
};
void() ShalHome =
{
local vector dir, vtemp;
vtemp = self.enemy.origin + '0 0 10';
if (self.enemy.health < 1)
{
remove(self);
return;
}
dir = normalize(vtemp - self.origin);
if (skill == 3)
self.velocity = dir * 350;
else
self.velocity = dir * 250;
self.nextthink = time + 0.2;
self.think = ShalHome;
};
// void() ShalMissileTouch = --moved to misc.qc for voreball shooter --dumptruck_ds
// {
// 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);
//
// self.velocity = '0 0 0';
// self.touch = SUB_Null;
// setmodel (self, "progs/s_explod.spr");
// self.solid = SOLID_NOT;
// s_explode1 ();
// };
//=================================================================
/*QUAKED monster_shalrath (1 0 0) (-32 -32 -24) (32 32 48) Ambush
*/
void() monster_shalrath =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (deathmatch)
{
remove(self);
return;
}
precache_model2 ("progs/shalrath.mdl");
precache_model2 ("progs/h_shal.mdl");
precache_model2 ("progs/v_spike.mdl");
precache_sound2 ("shalrath/attack.wav");
precache_sound2 ("shalrath/attack2.wav");
precache_sound2 ("shalrath/death.wav");
precache_sound2 ("shalrath/idle.wav");
precache_sound2 ("shalrath/pain.wav");
precache_sound2 ("shalrath/sight.wav");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/shalrath.mdl");
setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
if (!self.health) //thanks RennyC -- dumptruck_ds
self.health = 400;
self.th_stand = shal_stand;
self.th_walk = shal_walk1;
self.th_run = shal_run1;
self.th_die = shalrath_die;
self.th_pain = shalrath_pain;
self.th_missile = shal_attack1;
self.think = walkmonster_start;
self.nextthink = time + 0.1 + random ()*0.1;
};
/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */
/*QUAKED monster_dead_shalrath (0 0.5 0.8) (-32 -32 -24) (32 32 64)
*/
void() monster_dead_shalrath =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_model("progs/shalrath.mdl");
setmodel(self, "progs/shalrath.mdl");
self.frame = $death7;
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
setsize(self,'-41.41 -40.06 -49.38','34.52 24.32 30');
}
else
{
self.solid = SOLID_NOT;
}
};

View File

@@ -0,0 +1,394 @@
/*
==============================================================================
SHAMBLER
==============================================================================
*/
$cd id1/models/shams
$origin 0 0 24
$base base
$skin base
$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
$frame stand10 stand11 stand12 stand13 stand14 stand15 stand16 stand17
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7
$frame walk8 walk9 walk10 walk11 walk12
$frame run1 run2 run3 run4 run5 run6
$frame smash1 smash2 smash3 smash4 smash5 smash6 smash7
$frame smash8 smash9 smash10 smash11 smash12
$frame swingr1 swingr2 swingr3 swingr4 swingr5
$frame swingr6 swingr7 swingr8 swingr9
$frame swingl1 swingl2 swingl3 swingl4 swingl5
$frame swingl6 swingl7 swingl8 swingl9
$frame magic1 magic2 magic3 magic4 magic5
$frame magic6 magic7 magic8 magic9 magic10 magic11 magic12
$frame pain1 pain2 pain3 pain4 pain5 pain6
$frame death1 death2 death3 death4 death5 death6
$frame death7 death8 death9 death10 death11
void() sham_stand1 =[ $stand1, sham_stand2 ] {ai_stand();};
void() sham_stand2 =[ $stand2, sham_stand3 ] {ai_stand();};
void() sham_stand3 =[ $stand3, sham_stand4 ] {ai_stand();};
void() sham_stand4 =[ $stand4, sham_stand5 ] {ai_stand();};
void() sham_stand5 =[ $stand5, sham_stand6 ] {ai_stand();};
void() sham_stand6 =[ $stand6, sham_stand7 ] {ai_stand();};
void() sham_stand7 =[ $stand7, sham_stand8 ] {ai_stand();};
void() sham_stand8 =[ $stand8, sham_stand9 ] {ai_stand();};
void() sham_stand9 =[ $stand9, sham_stand10] {ai_stand();};
void() sham_stand10 =[ $stand10, sham_stand11] {ai_stand();};
void() sham_stand11 =[ $stand11, sham_stand12] {ai_stand();};
void() sham_stand12 =[ $stand12, sham_stand13] {ai_stand();};
void() sham_stand13 =[ $stand13, sham_stand14] {ai_stand();};
void() sham_stand14 =[ $stand14, sham_stand15] {ai_stand();};
void() sham_stand15 =[ $stand15, sham_stand16] {ai_stand();};
void() sham_stand16 =[ $stand16, sham_stand17] {ai_stand();};
void() sham_stand17 =[ $stand17, sham_stand1 ] {ai_stand();};
void() sham_walk1 =[ $walk1, sham_walk2 ] {ai_walk(10);};
void() sham_walk2 =[ $walk2, sham_walk3 ] {ai_walk(9);};
void() sham_walk3 =[ $walk3, sham_walk4 ] {ai_walk(9);};
void() sham_walk4 =[ $walk4, sham_walk5 ] {ai_walk(5);};
void() sham_walk5 =[ $walk5, sham_walk6 ] {ai_walk(6);};
void() sham_walk6 =[ $walk6, sham_walk7 ] {ai_walk(12);};
void() sham_walk7 =[ $walk7, sham_walk8 ] {ai_walk(8);};
void() sham_walk8 =[ $walk8, sham_walk9 ] {ai_walk(3);};
void() sham_walk9 =[ $walk9, sham_walk10] {ai_walk(13);};
void() sham_walk10 =[ $walk10, sham_walk11] {ai_walk(9);};
void() sham_walk11 =[ $walk11, sham_walk12] {ai_walk(7);};
void() sham_walk12 =[ $walk12, sham_walk1 ] {ai_walk(7);
if (random() > 0.8)
sound (self, CHAN_VOICE, "shambler/sidle.wav", 1, ATTN_IDLE);};
void() sham_run1 =[ $run1, sham_run2 ] {ai_run(20);};
void() sham_run2 =[ $run2, sham_run3 ] {ai_run(24);};
void() sham_run3 =[ $run3, sham_run4 ] {ai_run(20);};
void() sham_run4 =[ $run4, sham_run5 ] {ai_run(20);};
void() sham_run5 =[ $run5, sham_run6 ] {ai_run(24);};
void() sham_run6 =[ $run6, sham_run1 ] {ai_run(20);
if (random() > 0.8)
sound (self, CHAN_VOICE, "shambler/sidle.wav", 1, ATTN_IDLE);
};
void() sham_smash1 =[ $smash1, sham_smash2 ] {
sound (self, CHAN_VOICE, "shambler/melee1.wav", 1, ATTN_NORM);
ai_charge(2);};
void() sham_smash2 =[ $smash2, sham_smash3 ] {ai_charge(6);};
void() sham_smash3 =[ $smash3, sham_smash4 ] {ai_charge(6);};
void() sham_smash4 =[ $smash4, sham_smash5 ] {ai_charge(5);};
void() sham_smash5 =[ $smash5, sham_smash6 ] {ai_charge(4);};
void() sham_smash6 =[ $smash6, sham_smash7 ] {ai_charge(1);};
void() sham_smash7 =[ $smash7, sham_smash8 ] {ai_charge(0);};
void() sham_smash8 =[ $smash8, sham_smash9 ] {ai_charge(0);};
void() sham_smash9 =[ $smash9, sham_smash10 ] {ai_charge(0);};
void() sham_smash10 =[ $smash10, sham_smash11 ] {
local vector delta;
local float ldmg;
if (!self.enemy)
return;
ai_charge(0);
delta = self.enemy.origin - self.origin;
if (vlen(delta) > 100)
return;
if (!CanDamage (self.enemy, self))
return;
ldmg = (random() + random() + random()) * 40;
T_Damage (self.enemy, self, self, ldmg);
sound (self, CHAN_VOICE, "shambler/smack.wav", 1, ATTN_NORM);
SpawnMeatSpray (self.origin + v_forward*16, crandom() * 100 * v_right);
SpawnMeatSpray (self.origin + v_forward*16, crandom() * 100 * v_right);
};
void() sham_smash11 =[ $smash11, sham_smash12 ] {ai_charge(5);};
void() sham_smash12 =[ $smash12, sham_run1 ] {ai_charge(4);};
void() sham_swingr1;
void(float side) ShamClaw =
{
local vector delta;
local float ldmg;
if (!self.enemy)
return;
ai_charge(10);
delta = self.enemy.origin - self.origin;
if (vlen(delta) > 100)
return;
ldmg = (random() + random() + random()) * 20;
T_Damage (self.enemy, self, self, ldmg);
sound (self, CHAN_VOICE, "shambler/smack.wav", 1, ATTN_NORM);
if (side)
{
makevectors (self.angles);
SpawnMeatSpray (self.origin + v_forward*16, side * v_right);
}
};
void() sham_swingl1 =[ $swingl1, sham_swingl2 ] {
sound (self, CHAN_VOICE, "shambler/melee2.wav", 1, ATTN_NORM);
ai_charge(5);};
void() sham_swingl2 =[ $swingl2, sham_swingl3 ] {ai_charge(3);};
void() sham_swingl3 =[ $swingl3, sham_swingl4 ] {ai_charge(7);};
void() sham_swingl4 =[ $swingl4, sham_swingl5 ] {ai_charge(3);};
void() sham_swingl5 =[ $swingl5, sham_swingl6 ] {ai_charge(7);};
void() sham_swingl6 =[ $swingl6, sham_swingl7 ] {ai_charge(9);};
void() sham_swingl7 =[ $swingl7, sham_swingl8 ] {ai_charge(5); ShamClaw(250);};
void() sham_swingl8 =[ $swingl8, sham_swingl9 ] {ai_charge(4);};
void() sham_swingl9 =[ $swingl9, sham_run1 ] {
ai_charge(8);
if (random()<0.5)
self.think = sham_swingr1;
};
void() sham_swingr1 =[ $swingr1, sham_swingr2 ] {
sound (self, CHAN_VOICE, "shambler/melee1.wav", 1, ATTN_NORM);
ai_charge(1);};
void() sham_swingr2 =[ $swingr2, sham_swingr3 ] {ai_charge(8);};
void() sham_swingr3 =[ $swingr3, sham_swingr4 ] {ai_charge(14);};
void() sham_swingr4 =[ $swingr4, sham_swingr5 ] {ai_charge(7);};
void() sham_swingr5 =[ $swingr5, sham_swingr6 ] {ai_charge(3);};
void() sham_swingr6 =[ $swingr6, sham_swingr7 ] {ai_charge(6);};
void() sham_swingr7 =[ $swingr7, sham_swingr8 ] {ai_charge(6); ShamClaw(-250);};
void() sham_swingr8 =[ $swingr8, sham_swingr9 ] {ai_charge(3);};
void() sham_swingr9 =[ $swingr9, sham_run1 ] {ai_charge(1);
ai_charge(10);
if (random()<0.5)
self.think = sham_swingl1;
};
void() sham_melee =
{
local float chance;
chance = random();
if (chance > 0.6 || self.health == 600)
sham_smash1 ();
else if (chance > 0.3)
sham_swingr1 ();
else
sham_swingl1 ();
};
//============================================================================
void() CastLightning =
{
local vector org, dir;
self.effects = self.effects | EF_MUZZLEFLASH;
ai_face ();
org = self.origin + '0 0 40';
dir = self.enemy.origin + '0 0 16' - org;
dir = normalize (dir);
traceline (org, self.origin + dir*600, TRUE, self);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_LIGHTNING1);
WriteEntity (MSG_BROADCAST, self);
WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y);
WriteCoord (MSG_BROADCAST, org_z);
WriteCoord (MSG_BROADCAST, trace_endpos_x);
WriteCoord (MSG_BROADCAST, trace_endpos_y);
WriteCoord (MSG_BROADCAST, trace_endpos_z);
LightningDamage (org, trace_endpos, self, 10);
};
void() sham_magic1 =[ $magic1, sham_magic2 ] {ai_face();
sound (self, CHAN_WEAPON, "shambler/sattck1.wav", 1, ATTN_NORM);
};
void() sham_magic2 =[ $magic2, sham_magic3 ] {ai_face();};
void() sham_magic3 =[ $magic3, sham_magic4 ] {ai_face();self.nextthink = self.nextthink + 0.2;
local entity o;
self.effects = self.effects | EF_MUZZLEFLASH;
ai_face();
self.owner = spawn();
o = self.owner;
setmodel (o, "progs/s_light.mdl");
setorigin (o, self.origin);
o.angles = self.angles;
o.nextthink = time + 0.7;
o.think = SUB_Remove;
};
void() sham_magic4 =[ $magic4, sham_magic5 ]
{
self.effects = self.effects | EF_MUZZLEFLASH;
self.owner.frame = 1;
};
void() sham_magic5 =[ $magic5, sham_magic6 ]
{
self.effects = self.effects | EF_MUZZLEFLASH;
self.owner.frame = 2;
};
void() sham_magic6 =[ $magic6, sham_magic9 ]
{
remove (self.owner);
CastLightning();
sound (self, CHAN_WEAPON, "shambler/sboom.wav", 1, ATTN_NORM);
};
void() sham_magic9 =[ $magic9, sham_magic10 ]
{CastLightning();};
void() sham_magic10 =[ $magic10, sham_magic11 ]
{CastLightning();};
void() sham_magic11 =[ $magic11, sham_magic12 ]
{
if (skill == 3)
CastLightning();
};
void() sham_magic12 =[ $magic12, sham_run1 ] {};
void() sham_pain1 =[ $pain1, sham_pain2 ] {};
void() sham_pain2 =[ $pain2, sham_pain3 ] {};
void() sham_pain3 =[ $pain3, sham_pain4 ] {};
void() sham_pain4 =[ $pain4, sham_pain5 ] {};
void() sham_pain5 =[ $pain5, sham_pain6 ] {};
void() sham_pain6 =[ $pain6, sham_run1 ] {};
void(entity attacker, float damage) sham_pain =
{
sound (self, CHAN_VOICE, "shambler/shurt2.wav", 1, ATTN_NORM);
if (self.health <= 0)
return; // allready dying, don't go into pain frame
if (random()*400 > damage)
return; // didn't flinch
if (self.pain_finished > time)
return;
self.pain_finished = time + 2;
sham_pain1 ();
};
//============================================================================
void() sham_death1 =[ $death1, sham_death2 ] {};
void() sham_death2 =[ $death2, sham_death3 ] {};
void() sham_death3 =[ $death3, sham_death4 ] {self.solid = SOLID_NOT;};
void() sham_death4 =[ $death4, sham_death5 ] {};
void() sham_death5 =[ $death5, sham_death6 ] {};
void() sham_death6 =[ $death6, sham_death7 ] {};
void() sham_death7 =[ $death7, sham_death8 ] {};
void() sham_death8 =[ $death8, sham_death9 ] {};
void() sham_death9 =[ $death9, sham_death10 ] {};
void() sham_death10 =[ $death10, sham_death11 ] {};
void() sham_death11 =[ $death11, sham_death11 ] {};
void() sham_die =
{
// check for gib
if (self.health < -60)
{
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_shams.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
return;
}
// regular death
sound (self, CHAN_VOICE, "shambler/sdeath.wav", 1, ATTN_NORM);
sham_death1 ();
};
//============================================================================
/*QUAKED monster_shambler (1 0 0) (-32 -32 -24) (32 32 64) Ambush
*/
void() monster_shambler =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (deathmatch)
{
remove(self);
return;
}
precache_model ("progs/shambler.mdl");
precache_model ("progs/s_light.mdl");
precache_model ("progs/h_shams.mdl");
precache_model ("progs/bolt.mdl");
precache_sound ("shambler/sattck1.wav");
precache_sound ("shambler/sboom.wav");
precache_sound ("shambler/sdeath.wav");
precache_sound ("shambler/shurt2.wav");
precache_sound ("shambler/sidle.wav");
precache_sound ("shambler/ssight.wav");
precache_sound ("shambler/melee1.wav");
precache_sound ("shambler/melee2.wav");
precache_sound ("shambler/smack.wav");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/shambler.mdl");
setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
if (!self.health) //thanks RennyC -- dumptruck_ds
self.health = 600;
self.th_stand = sham_stand1;
self.th_walk = sham_walk1;
self.th_run = sham_run1;
self.th_die = sham_die;
self.th_melee = sham_melee;
self.th_missile = sham_magic1;
self.th_pain = sham_pain;
walkmonster_start();
};
/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */
/*QUAKED monster_dead_shambler (0 0.5 0.8) (-32 -32 -24) (32 32 64)
*/
void() monster_dead_shambler =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_model("progs/shambler.mdl");
setmodel(self, "progs/shambler.mdl");
self.frame = $death11;
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
setsize(self,'-77.09 -72.17 -51.52','47.44 98.15 30');
}
else
{
self.solid = SOLID_NOT;
}
};

View File

@@ -0,0 +1,329 @@
/*
==============================================================================
SOLDIER / PLAYER
==============================================================================
*/
$cd id1/models/soldier3
$origin 0 -6 24
$base base
$skin skin
$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8
$frame death1 death2 death3 death4 death5 death6 death7 death8
$frame death9 death10
$frame deathc1 deathc2 deathc3 deathc4 deathc5 deathc6 deathc7 deathc8
$frame deathc9 deathc10 deathc11
$frame load1 load2 load3 load4 load5 load6 load7 load8 load9 load10 load11
$frame pain1 pain2 pain3 pain4 pain5 pain6
$frame painb1 painb2 painb3 painb4 painb5 painb6 painb7 painb8 painb9 painb10
$frame painb11 painb12 painb13 painb14
$frame painc1 painc2 painc3 painc4 painc5 painc6 painc7 painc8 painc9 painc10
$frame painc11 painc12 painc13
$frame run1 run2 run3 run4 run5 run6 run7 run8
$frame shoot1 shoot2 shoot3 shoot4 shoot5 shoot6 shoot7 shoot8 shoot9
$frame prowl_1 prowl_2 prowl_3 prowl_4 prowl_5 prowl_6 prowl_7 prowl_8
$frame prowl_9 prowl_10 prowl_11 prowl_12 prowl_13 prowl_14 prowl_15 prowl_16
$frame prowl_17 prowl_18 prowl_19 prowl_20 prowl_21 prowl_22 prowl_23 prowl_24
/*
==============================================================================
SOLDIER CODE
==============================================================================
*/
void() army_fire;
void() army_stand1 =[ $stand1, army_stand2 ] {ai_stand();};
void() army_stand2 =[ $stand2, army_stand3 ] {ai_stand();};
void() army_stand3 =[ $stand3, army_stand4 ] {ai_stand();};
void() army_stand4 =[ $stand4, army_stand5 ] {ai_stand();};
void() army_stand5 =[ $stand5, army_stand6 ] {ai_stand();};
void() army_stand6 =[ $stand6, army_stand7 ] {ai_stand();};
void() army_stand7 =[ $stand7, army_stand8 ] {ai_stand();};
void() army_stand8 =[ $stand8, army_stand1 ] {ai_stand();};
void() army_walk1 =[ $prowl_1, army_walk2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "soldier/idle.wav", 1, ATTN_IDLE);
ai_walk(1);};
void() army_walk2 =[ $prowl_2, army_walk3 ] {ai_walk(1);};
void() army_walk3 =[ $prowl_3, army_walk4 ] {ai_walk(1);};
void() army_walk4 =[ $prowl_4, army_walk5 ] {ai_walk(1);};
void() army_walk5 =[ $prowl_5, army_walk6 ] {ai_walk(2);};
void() army_walk6 =[ $prowl_6, army_walk7 ] {ai_walk(3);};
void() army_walk7 =[ $prowl_7, army_walk8 ] {ai_walk(4);};
void() army_walk8 =[ $prowl_8, army_walk9 ] {ai_walk(4);};
void() army_walk9 =[ $prowl_9, army_walk10 ] {ai_walk(2);};
void() army_walk10 =[ $prowl_10, army_walk11 ] {ai_walk(2);};
void() army_walk11 =[ $prowl_11, army_walk12 ] {ai_walk(2);};
void() army_walk12 =[ $prowl_12, army_walk13 ] {ai_walk(1);};
void() army_walk13 =[ $prowl_13, army_walk14 ] {ai_walk(0);};
void() army_walk14 =[ $prowl_14, army_walk15 ] {ai_walk(1);};
void() army_walk15 =[ $prowl_15, army_walk16 ] {ai_walk(1);};
void() army_walk16 =[ $prowl_16, army_walk17 ] {ai_walk(1);};
void() army_walk17 =[ $prowl_17, army_walk18 ] {ai_walk(3);};
void() army_walk18 =[ $prowl_18, army_walk19 ] {ai_walk(3);};
void() army_walk19 =[ $prowl_19, army_walk20 ] {ai_walk(3);};
void() army_walk20 =[ $prowl_20, army_walk21 ] {ai_walk(3);};
void() army_walk21 =[ $prowl_21, army_walk22 ] {ai_walk(2);};
void() army_walk22 =[ $prowl_22, army_walk23 ] {ai_walk(1);};
void() army_walk23 =[ $prowl_23, army_walk24 ] {ai_walk(1);};
void() army_walk24 =[ $prowl_24, army_walk1 ] {ai_walk(1);};
void() army_run1 =[ $run1, army_run2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "soldier/idle.wav", 1, ATTN_IDLE);
ai_run(11);};
void() army_run2 =[ $run2, army_run3 ] {ai_run(15);};
void() army_run3 =[ $run3, army_run4 ] {ai_run(10);};
void() army_run4 =[ $run4, army_run5 ] {ai_run(10);};
void() army_run5 =[ $run5, army_run6 ] {ai_run(8);};
void() army_run6 =[ $run6, army_run7 ] {ai_run(15);};
void() army_run7 =[ $run7, army_run8 ] {ai_run(10);};
void() army_run8 =[ $run8, army_run1 ] {ai_run(8);};
void() army_atk1 =[ $shoot1, army_atk2 ] {ai_face();};
void() army_atk2 =[ $shoot2, army_atk3 ] {ai_face();};
void() army_atk3 =[ $shoot3, army_atk4 ] {ai_face();};
void() army_atk4 =[ $shoot4, army_atk5 ] {ai_face();};
void() army_atk5 =[ $shoot5, army_atk6 ] {ai_face();army_fire();
self.effects = self.effects | EF_MUZZLEFLASH;};
void() army_atk6 =[ $shoot6, army_atk7 ] {ai_face();};
void() army_atk7 =[ $shoot7, army_atk8 ] {ai_face();SUB_CheckRefire (army_atk1);};
void() army_atk8 =[ $shoot8, army_atk9 ] {ai_face();};
void() army_atk9 =[ $shoot9, army_run1 ] {ai_face();};
void() army_pain1 =[ $pain1, army_pain2 ] {};
void() army_pain2 =[ $pain2, army_pain3 ] {};
void() army_pain3 =[ $pain3, army_pain4 ] {};
void() army_pain4 =[ $pain4, army_pain5 ] {};
void() army_pain5 =[ $pain5, army_pain6 ] {};
void() army_pain6 =[ $pain6, army_run1 ] {ai_pain(1);};
void() army_painb1 =[ $painb1, army_painb2 ] {};
void() army_painb2 =[ $painb2, army_painb3 ] {ai_painforward(13);};
void() army_painb3 =[ $painb3, army_painb4 ] {ai_painforward(9);};
void() army_painb4 =[ $painb4, army_painb5 ] {};
void() army_painb5 =[ $painb5, army_painb6 ] {};
void() army_painb6 =[ $painb6, army_painb7 ] {};
void() army_painb7 =[ $painb7, army_painb8 ] {};
void() army_painb8 =[ $painb8, army_painb9 ] {};
void() army_painb9 =[ $painb9, army_painb10] {};
void() army_painb10=[ $painb10, army_painb11] {};
void() army_painb11=[ $painb11, army_painb12] {};
void() army_painb12=[ $painb12, army_painb13] {ai_pain(2);};
void() army_painb13=[ $painb13, army_painb14] {};
void() army_painb14=[ $painb14, army_run1 ] {};
void() army_painc1 =[ $painc1, army_painc2 ] {};
void() army_painc2 =[ $painc2, army_painc3 ] {ai_pain(1);};
void() army_painc3 =[ $painc3, army_painc4 ] {};
void() army_painc4 =[ $painc4, army_painc5 ] {};
void() army_painc5 =[ $painc5, army_painc6 ] {ai_painforward(1);};
void() army_painc6 =[ $painc6, army_painc7 ] {ai_painforward(1);};
void() army_painc7 =[ $painc7, army_painc8 ] {};
void() army_painc8 =[ $painc8, army_painc9 ] {ai_pain(1);};
void() army_painc9 =[ $painc9, army_painc10] {ai_painforward(4);};
void() army_painc10=[ $painc10, army_painc11] {ai_painforward(3);};
void() army_painc11=[ $painc11, army_painc12] {ai_painforward(6);};
void() army_painc12=[ $painc12, army_painc13] {ai_painforward(8);};
void() army_painc13=[ $painc13, army_run1] {};
void(entity attacker, float damage) army_pain =
{
local float r;
if (self.pain_finished > time)
return;
r = random();
if (r < 0.2)
{
self.pain_finished = time + 0.6;
army_pain1 ();
sound (self, CHAN_VOICE, "soldier/pain1.wav", 1, ATTN_NORM);
}
else if (r < 0.6)
{
self.pain_finished = time + 1.1;
army_painb1 ();
sound (self, CHAN_VOICE, "soldier/pain2.wav", 1, ATTN_NORM);
}
else
{
self.pain_finished = time + 1.1;
army_painc1 ();
sound (self, CHAN_VOICE, "soldier/pain2.wav", 1, ATTN_NORM);
}
};
void() army_fire =
{
local vector dir;
local entity en;
ai_face();
sound (self, CHAN_WEAPON, "soldier/sattck1.wav", 1, ATTN_NORM);
// fire somewhat behind the player, so a dodging player is harder to hit
en = self.enemy;
dir = en.origin - en.velocity*0.2;
dir = normalize (dir - self.origin);
FireBullets (4, dir, '0.1 0.1 0');
};
void() army_die1 =[ $death1, army_die2 ] {};
void() army_die2 =[ $death2, army_die3 ] {};
void() army_die3 =[ $death3, army_die4 ]
{self.solid = SOLID_NOT;self.ammo_shells = 5;if(!self.keep_ammo)DropBackpack();};
void() army_die4 =[ $death4, army_die5 ] {};
void() army_die5 =[ $death5, army_die6 ] {};
void() army_die6 =[ $death6, army_die7 ] {};
void() army_die7 =[ $death7, army_die8 ] {};
void() army_die8 =[ $death8, army_die9 ] {};
void() army_die9 =[ $death9, army_die10 ] {};
void() army_die10 =[ $death10, army_die10 ] {};
void() army_cdie1 =[ $deathc1, army_cdie2 ] {};
void() army_cdie2 =[ $deathc2, army_cdie3 ] {ai_back(5);};
void() army_cdie3 =[ $deathc3, army_cdie4 ]
{self.solid = SOLID_NOT;self.ammo_shells = 5;if(!self.keep_ammo)DropBackpack();ai_back(4);};
void() army_cdie4 =[ $deathc4, army_cdie5 ] {ai_back(13);};
void() army_cdie5 =[ $deathc5, army_cdie6 ] {ai_back(3);};
void() army_cdie6 =[ $deathc6, army_cdie7 ] {ai_back(4);};
void() army_cdie7 =[ $deathc7, army_cdie8 ] {};
void() army_cdie8 =[ $deathc8, army_cdie9 ] {};
void() army_cdie9 =[ $deathc9, army_cdie10 ] {};
void() army_cdie10 =[ $deathc10, army_cdie11 ] {};
void() army_cdie11 =[ $deathc11, army_cdie11 ] {};
void() army_die =
{
// check for gib
if (self.health < -35)
{
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_guard.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
return;
}
// regular death
sound (self, CHAN_VOICE, "soldier/death1.wav", 1, ATTN_NORM);
if (random() < 0.5)
army_die1 ();
else
army_cdie1 ();
};
/*QUAKED monster_army (1 0 0) (-16 -16 -24) (16 16 40) Ambush
*/
void() monster_army =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (deathmatch)
{
remove(self);
return;
}
precache_model ("progs/soldier.mdl");
precache_model ("progs/h_guard.mdl");
precache_model ("progs/gib1.mdl");
precache_model ("progs/gib2.mdl");
precache_model ("progs/gib3.mdl");
precache_sound ("soldier/death1.wav");
precache_sound ("soldier/idle.wav");
precache_sound ("soldier/pain1.wav");
precache_sound ("soldier/pain2.wav");
precache_sound ("soldier/sattck1.wav");
precache_sound ("soldier/sight1.wav");
precache_sound ("player/udeath.wav"); // gib death
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/soldier.mdl");
setsize (self, '-16 -16 -24', '16 16 40');
if (!self.health) //thanks RennyC -- dumptruck_ds
self.health = 30;
self.th_stand = army_stand1;
self.th_walk = army_walk1;
self.th_run = army_run1;
self.th_missile = army_atk1;
self.th_pain = army_pain;
self.th_die = army_die;
walkmonster_start ();
};
/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */
/*QUAKED monster_dead_army (0 0.5 0.8) (-16 -16 -24) (16 16 32)
*/
void() monster_dead_army =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_model("progs/soldier.mdl");
setmodel(self, "progs/soldier.mdl");
if (self.spawnflags & 2)
{
self.frame = $death10;
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
setsize(self,'-38.27 -30.47 -50.3','22.1 25.35 30');
}
else
{
self.solid = SOLID_NOT;
}
}
else
{
self.frame = $deathc11;
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
setsize(self,'-39.85 -29.35 -49.07','20.52 33.17 30');
}
else
{
self.solid = SOLID_NOT;
}
}
};

551
mod_mine/quakec_src/subs.qc Normal file
View File

@@ -0,0 +1,551 @@
void() SUB_Null = {};
void(entity attacker, float damage) SUB_NullPain = {};
void() SUB_Remove = {remove(self);};
/*
QuakeEd only writes a single float for angles (bad idea), so up and down are
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);
self.movedir = v_forward;
}
self.angles = '0 0 0';
};
/*
================
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.
if (self.angles != '0 0 0')
SetMovedir ();
self.solid = SOLID_TRIGGER;
setmodel (self, self.model); // set size and link into world
self.movetype = MOVETYPE_NONE;
self.modelindex = 0;
self.model = "";
};
/*
=============
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;
stemp = self;
self = ent;
SUB_CalcMove (tdest, tspeed, func);
self = stemp;
};
void(vector tdest, float tspeed, void() func) SUB_CalcMove =
{
local vector vdestdelta;
local float len, traveltime;
if (!tspeed)
objerror("No speed is defined!");
self.think1 = func;
self.finaldest = tdest;
self.think = SUB_CalcMoveDone;
if (tdest == self.origin)
{
self.velocity = '0 0 0';
self.nextthink = self.ltime + 0.1;
return;
}
// set destdelta to the vector needed to move
vdestdelta = tdest - self.origin;
// calculate length of vector
len = vlen (vdestdelta);
// divide by speed to get time to reach dest
traveltime = len / tspeed;
if (traveltime < 0.1)
{
self.velocity = '0 0 0';
self.nextthink = self.ltime + 0.1;
return;
}
// 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
self.velocity = vdestdelta * (1/traveltime); // qcc won't take vec/float
};
/*
============
After moving, set origin to exact final destination
============
*/
void() SUB_CalcMoveDone =
{
setorigin(self, self.finaldest);
self.velocity = '0 0 0';
self.nextthink = -1;
if (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 =
{
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;
if (!tspeed)
objerror("No speed is defined!");
// set destdelta to the vector needed to move
destdelta = destangle - self.angles;
// calculate length of vector
len = vlen (destdelta);
// divide by speed to get time to reach dest
traveltime = len / tspeed;
// 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
self.avelocity = destdelta * (1 / traveltime);
self.think1 = func;
self.finalangle = destangle;
self.think = 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();
};
//=============================================================================
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.
If self.delay is set, a DelayedUse entity will be created that will actually
do the SUB_UseTargets after that many seconds have passed.
Centerprints any self.message to the activator.
Removes all entities with a targetname that match self.killtarget,
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 =
{
local entity t, stemp, otemp, act;
act = activator;
t = find (world, matchfield, matchstring);
while ( t != world )
{
stemp = self;
otemp = other;
self = t;
other = stemp;
if (self.use != SUB_Null)
{
if (self.use)
{
lastnameused = matchstring;
self.use ();
}
}
self = stemp;
other = otemp;
activator = act;
t = find (t, matchfield, matchstring);
}
};
void() SUB_UseTargets =
{
// local entity t, stemp, otemp, act;
local entity t;
//
// check for a delay
//
if (self.delay)
{
// create a temp object to fire at a later time
t = spawn();
t.classname = "DelayedUse";
t.nextthink = time + self.delay;
t.think = DelayThink;
t.enemy = activator;
t.message = self.message;
t.killtarget = self.killtarget;
t.killtarget2 = self.killtarget2;
t.target = self.target;
t.target2 = self.target2;
t.target3 = self.target3;
t.target4 = self.target4;
return;
}
//
// print the message
//
if (activator.classname == "player" && self.message != "")
{
centerprint (activator, self.message);
if (!self.noise)
sound (activator, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
}
//
// kill the killtarget entities
//
if (self.killtarget != "")
{
t = find(world, targetname, self.killtarget);
while(t != world)
{
remove(t);
t = find(t, targetname, self.killtarget);
}
t = find(world, targetname2, self.killtarget);
while(t != world)
{
remove(t);
t = find(t, targetname2, self.killtarget);
}
t = find(world, targetname3, self.killtarget);
while(t != world)
{
remove(t);
t = find(t, targetname3, self.killtarget);
}
t = find(world, targetname4, self.killtarget);
while(t != world)
{
remove(t);
t = find(t, targetname4, self.killtarget);
}
}
//
// kill the killtaget2 entities
//
if (self.killtarget2 != "")
{
t = find(world, targetname, self.killtarget2);
while(t != world)
{
remove(t);
t = find(t, targetname, self.killtarget2);
}
t = find(world, targetname2, self.killtarget2);
while(t != world)
{
remove(t);
t = find(t, targetname2, self.killtarget2);
}
t = find(world, targetname3, self.killtarget2);
while(t != world)
{
remove(t);
t = find(t, targetname3, self.killtarget2);
}
t = find(world, targetname4, self.killtarget2);
while(t != world)
{
remove(t);
t = find(t, targetname4, self.killtarget2);
}
}
//
// 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);
}
// 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);
}
// 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);
}
// 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);
}
};
void(string matchstring) SUB_UseName =
{
SUB_UseSpecificTarget(matchstring, targetname);
SUB_UseSpecificTarget(matchstring, targetname2);
SUB_UseSpecificTarget(matchstring, targetname3);
SUB_UseSpecificTarget(matchstring, targetname4);
};
// ### end of Custents triggering code
/*
================
SUB_UseAndForgetTargets
This calls SUB_UseTargets, then clears all of self's fields that cause
SUB_UseTargets to do things. The intention is that if SUB_UseTargets
gets called again in the future, it won't do anything. Call this
function if you want an entity to fire its targets just this once, and
never again.
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 =
{
SUB_UseTargets ();
self.delay = 0;
self.killtarget = "";
self.killtarget2 = "";
self.message = "";
self.target = "";
self.target2 = "";
self.target3 = "";
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
================
*/
float(.string fld) SUB_FieldIsTargeted =
{
if (self.fld == "")
return FALSE;
// the following function calls are staggered to avoid the silly
// "return value conflict" problem with traditional compilers -- iw
if (find (world, target, self.fld) != world)
return TRUE;
if (find (world, target2, self.fld) != world)
return TRUE;
if (find (world, target3, self.fld) != world)
return TRUE;
if (find (world, target4, self.fld) != world)
return TRUE;
if (find (world, pain_target, self.fld) != world)
return TRUE;
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
================
*/
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;
if (SUB_FieldIsTargeted (targetname2))
return TRUE;
if (SUB_FieldIsTargeted (targetname3))
return TRUE;
if (SUB_FieldIsTargeted (targetname4))
return TRUE;
return FALSE;
};
//
// pain_target //dumptruck_ds
//
void() SUB_UsePain =
{
if (self.pain_target != "")
{
SUB_UseSpecificTarget (self.pain_target, targetname);
SUB_UseSpecificTarget (self.pain_target, targetname2);
SUB_UseSpecificTarget (self.pain_target, targetname3);
SUB_UseSpecificTarget (self.pain_target, targetname4);
}
self.pain_target = ""; //dumptruck_ds via Discord - thanks Spike, Snaut and QueenJazz
};
/*
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
if (skill != 3)
self.attack_finished = time + normal;
};
float (entity targ) visible;
void (void() thinkst) SUB_CheckRefire =
{
if (skill != 3)
return;
if (self.cnt == 1)
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
self.
The engine does not update the FL_ONGROUND flag automatically in some
cases, with the result that certain types of entities can be left
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 =
{
local entity e;
e = nextent (world);
while (e != world)
{
if ((e.flags & FL_ONGROUND) && e.groundentity == self)
e.flags = e.flags - (e.flags & FL_ONGROUND);
e = nextent (e);
}
};

View File

@@ -0,0 +1,225 @@
/*
==============================================================================
BLOB
==============================================================================
*/
$cd id1/models/tarbaby
$origin 0 0 24
$base base
$skin skin
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10
$frame walk11 walk12 walk13 walk14 walk15 walk16 walk17 walk18 walk19
$frame walk20 walk21 walk22 walk23 walk24 walk25
$frame run1 run2 run3 run4 run5 run6 run7 run8 run9 run10 run11 run12 run13
$frame run14 run15 run16 run17 run18 run19 run20 run21 run22 run23
$frame run24 run25
$frame jump1 jump2 jump3 jump4 jump5 jump6
$frame fly1 fly2 fly3 fly4
$frame exp
void() tbaby_stand1 =[ $walk1, tbaby_stand1 ] {ai_stand();};
void() tbaby_hang1 =[ $walk1, tbaby_hang1 ] {ai_stand();};
void() tbaby_walk1 =[ $walk1, tbaby_walk2 ] {ai_turn();};
void() tbaby_walk2 =[ $walk2, tbaby_walk3 ] {ai_turn();};
void() tbaby_walk3 =[ $walk3, tbaby_walk4 ] {ai_turn();};
void() tbaby_walk4 =[ $walk4, tbaby_walk5 ] {ai_turn();};
void() tbaby_walk5 =[ $walk5, tbaby_walk6 ] {ai_turn();};
void() tbaby_walk6 =[ $walk6, tbaby_walk7 ] {ai_turn();};
void() tbaby_walk7 =[ $walk7, tbaby_walk8 ] {ai_turn();};
void() tbaby_walk8 =[ $walk8, tbaby_walk9 ] {ai_turn();};
void() tbaby_walk9 =[ $walk9, tbaby_walk10 ] {ai_turn();};
void() tbaby_walk10 =[ $walk10, tbaby_walk11 ] {ai_turn();};
void() tbaby_walk11 =[ $walk11, tbaby_walk12 ] {ai_walk(2);};
void() tbaby_walk12 =[ $walk12, tbaby_walk13 ] {ai_walk(2);};
void() tbaby_walk13 =[ $walk13, tbaby_walk14 ] {ai_walk(2);};
void() tbaby_walk14 =[ $walk14, tbaby_walk15 ] {ai_walk(2);};
void() tbaby_walk15 =[ $walk15, tbaby_walk16 ] {ai_walk(2);};
void() tbaby_walk16 =[ $walk16, tbaby_walk17 ] {ai_walk(2);};
void() tbaby_walk17 =[ $walk17, tbaby_walk18 ] {ai_walk(2);};
void() tbaby_walk18 =[ $walk18, tbaby_walk19 ] {ai_walk(2);};
void() tbaby_walk19 =[ $walk19, tbaby_walk20 ] {ai_walk(2);};
void() tbaby_walk20 =[ $walk20, tbaby_walk21 ] {ai_walk(2);};
void() tbaby_walk21 =[ $walk21, tbaby_walk22 ] {ai_walk(2);};
void() tbaby_walk22 =[ $walk22, tbaby_walk23 ] {ai_walk(2);};
void() tbaby_walk23 =[ $walk23, tbaby_walk24 ] {ai_walk(2);};
void() tbaby_walk24 =[ $walk24, tbaby_walk25 ] {ai_walk(2);};
void() tbaby_walk25 =[ $walk25, tbaby_walk1 ] {ai_walk(2);};
void() tbaby_run1 =[ $run1, tbaby_run2 ] {ai_face();};
void() tbaby_run2 =[ $run2, tbaby_run3 ] {ai_face();};
void() tbaby_run3 =[ $run3, tbaby_run4 ] {ai_face();};
void() tbaby_run4 =[ $run4, tbaby_run5 ] {ai_face();};
void() tbaby_run5 =[ $run5, tbaby_run6 ] {ai_face();};
void() tbaby_run6 =[ $run6, tbaby_run7 ] {ai_face();};
void() tbaby_run7 =[ $run7, tbaby_run8 ] {ai_face();};
void() tbaby_run8 =[ $run8, tbaby_run9 ] {ai_face();};
void() tbaby_run9 =[ $run9, tbaby_run10 ] {ai_face();};
void() tbaby_run10 =[ $run10, tbaby_run11 ] {ai_face();};
void() tbaby_run11 =[ $run11, tbaby_run12 ] {ai_run(2);};
void() tbaby_run12 =[ $run12, tbaby_run13 ] {ai_run(2);};
void() tbaby_run13 =[ $run13, tbaby_run14 ] {ai_run(2);};
void() tbaby_run14 =[ $run14, tbaby_run15 ] {ai_run(2);};
void() tbaby_run15 =[ $run15, tbaby_run16 ] {ai_run(2);};
void() tbaby_run16 =[ $run16, tbaby_run17 ] {ai_run(2);};
void() tbaby_run17 =[ $run17, tbaby_run18 ] {ai_run(2);};
void() tbaby_run18 =[ $run18, tbaby_run19 ] {ai_run(2);};
void() tbaby_run19 =[ $run19, tbaby_run20 ] {ai_run(2);};
void() tbaby_run20 =[ $run20, tbaby_run21 ] {ai_run(2);};
void() tbaby_run21 =[ $run21, tbaby_run22 ] {ai_run(2);};
void() tbaby_run22 =[ $run22, tbaby_run23 ] {ai_run(2);};
void() tbaby_run23 =[ $run23, tbaby_run24 ] {ai_run(2);};
void() tbaby_run24 =[ $run24, tbaby_run25 ] {ai_run(2);};
void() tbaby_run25 =[ $run25, tbaby_run1 ] {ai_run(2);};
//============================================================================
void() tbaby_jump1;
void() Tar_JumpTouch =
{
local float ldmg;
if (other.takedamage && other.classname != self.classname)
{
if ( vlen(self.velocity) > 400 )
{
ldmg = 10 + 10*random();
T_Damage (other, self, self, ldmg);
sound (self, CHAN_WEAPON, "blob/hit1.wav", 1, ATTN_NORM);
}
}
else
sound (self, CHAN_WEAPON, "blob/land1.wav", 1, ATTN_NORM);
if (!checkbottom(self))
{
if (self.flags & FL_ONGROUND)
{ // jump randomly to not get hung up
// dprint ("popjump\n");
self.touch = SUB_Null;
self.think = tbaby_run1;
self.movetype = MOVETYPE_STEP;
self.nextthink = time + 0.1;
// self.velocity_x = (random() - 0.5) * 600;
// self.velocity_y = (random() - 0.5) * 600;
// self.velocity_z = 200;
// self.flags = self.flags - FL_ONGROUND;
}
return; // not on ground yet
}
self.touch = SUB_Null;
self.think = tbaby_jump1;
self.nextthink = time + 0.1;
};
void() tbaby_jump5;
void() tbaby_fly1 =[ $fly1, tbaby_fly2 ] {};
void() tbaby_fly2 =[ $fly2, tbaby_fly3 ] {};
void() tbaby_fly3 =[ $fly3, tbaby_fly4 ] {};
void() tbaby_fly4 =[ $fly4, tbaby_fly1 ] {
self.cnt = self.cnt + 1;
if (self.cnt == 4)
{
//dprint ("spawn hop\n");
tbaby_jump5 ();
}
};
void() tbaby_jump1 =[ $jump1, tbaby_jump2 ] {ai_face();};
void() tbaby_jump2 =[ $jump2, tbaby_jump3 ] {ai_face();};
void() tbaby_jump3 =[ $jump3, tbaby_jump4 ] {ai_face();};
void() tbaby_jump4 =[ $jump4, tbaby_jump5 ] {ai_face();};
void() tbaby_jump5 =[ $jump5, tbaby_jump6 ]
{
self.movetype = MOVETYPE_BOUNCE;
self.touch = Tar_JumpTouch;
makevectors (self.angles);
self.origin_z = self.origin_z + 1;
self.velocity = v_forward * 600 + '0 0 200';
self.velocity_z = self.velocity_z + random()*150;
if (self.flags & FL_ONGROUND)
self.flags = self.flags - FL_ONGROUND;
self.cnt = 0;
};
void() tbaby_jump6 =[ $jump6,tbaby_fly1 ] {};
//=============================================================================
void() tbaby_die1 =[ $exp, tbaby_die2 ] {
self.takedamage = DAMAGE_NO;
};
void() tbaby_die2 =[ $exp, tbaby_run1 ]
{
T_RadiusDamage (self, self, 120, world);
sound (self, CHAN_VOICE, "blob/death1.wav", 1, ATTN_NORM);
self.origin = self.origin - 8*normalize(self.velocity);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_TAREXPLOSION);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
BecomeExplosion ();
};
//=============================================================================
/*QUAKED monster_tarbaby (1 0 0) (-16 -16 -24) (16 16 24) Ambush
*/
void() monster_tarbaby =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (deathmatch)
{
remove(self);
return;
}
precache_model2 ("progs/tarbaby.mdl");
precache_sound2 ("blob/death1.wav");
precache_sound2 ("blob/hit1.wav");
precache_sound2 ("blob/land1.wav");
precache_sound2 ("blob/sight1.wav");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/tarbaby.mdl");
setsize (self, '-16 -16 -24', '16 16 40');
if (!self.health) //thanks RennyC -- dumptruck_ds
self.health = 80;
self.th_stand = tbaby_stand1;
self.th_walk = tbaby_walk1;
self.th_run = tbaby_run1;
self.th_missile = tbaby_jump1;
self.th_melee = tbaby_jump1;
self.th_die = tbaby_die1;
walkmonster_start ();
};

View File

@@ -0,0 +1,988 @@
entity s;
void() trigger_reactivate =
{
self.solid = SOLID_TRIGGER;
};
//=============================================================================
float SPAWNFLAG_NOMESSAGE = 1;
float SPAWNFLAG_NOTOUCH = 1;
// the wait time has passed, so set back up for another activation
void() multi_wait =
{
if (self.max_health)
{
self.health = self.max_health;
self.takedamage = DAMAGE_YES;
self.solid = SOLID_BBOX;
}
};
// the trigger was just touched/killed/used
// self.enemy should be set to the activator so it can be held through a delay
// so wait for the delay time before firing
void() multi_trigger =
{
if (self.nextthink > time)
{
return; // allready been triggered
}
if (self.classname == "trigger_secret")
{
if (self.enemy.classname != "player")
return;
found_secrets = found_secrets + 1;
WriteByte (MSG_ALL, SVC_FOUNDSECRET);
}
if (self.noise != "")
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
// don't trigger again until reset
self.takedamage = DAMAGE_NO;
activator = self.enemy;
SUB_UseTargets();
if (self.wait > 0)
{
self.think = multi_wait;
self.nextthink = time + self.wait;
}
else
{ // we can't just remove (self) here, because this is a touch function
// called wheil C code is looping through area links...
self.touch = SUB_Null;
self.nextthink = time + 0.1;
self.think = SUB_Remove;
}
};
void() multi_killed = //dumptruck_ds
{
if (self.is_waiting) // Supa, restore health and do nothing if we're still waiting to be activated
{
self.health = self.max_health; // nyah nyah~!
self.takedamage = DAMAGE_YES;
self.solid = SOLID_BBOX;
return;
}
self.enemy = damage_attacker;
multi_trigger();
};
void() multi_use = //dumptruck_ds
{
if (self.is_waiting) // Supa, if this trigger is waiting to be activated we'll tell it to get ready!
{
self.is_waiting = FALSE; // Get ready!
return; // Must be used or triggered again to do anything
}
self.enemy = activator;
multi_trigger();
};
void() multi_touch = //dumptruck_ds
{
if (other.classname != "player")
return;
if (self.is_waiting) // Supa, is this trigger waiting to be activated?
return;
// if the trigger has an angles field, check player's facing direction
if (self.movedir != '0 0 0')
{
makevectors (other.angles);
if (v_forward * self.movedir < 0)
return; // not facing the right way
}
self.enemy = other;
multi_trigger ();
};
/*QUAKED trigger_multiple (.5 .5 .5) ? notouch
Variable sized repeatable trigger. Must be targeted at one or more entities. If "health" is set, the trigger must be killed to activate each time.
If "delay" is set, the trigger waits some time after activating before firing.
"wait" : Seconds between triggerings. (.2 default)
If notouch is set, the trigger is only fired by other entities, not by touching.
NOTOUCH has been obsoleted by trigger_relay!
sounds
1) secret
2) beep beep
3) large switch
4)
set "message" to text string
"is_waiting" : If set to 1, this trigger will do nothing until another trigger activates it
*/
void() trigger_multiple =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (self.is_waiting)
{
dprint("Spawned a waiting ");
dprint(self.classname);
dprint(" with targetname ");
dprint(self.targetname);
dprint(" and target ");
dprint(self.target);
dprint("\n");
}
if (self.sounds == 1)
{
precache_sound ("misc/secret.wav");
self.noise = "misc/secret.wav";
}
else if (self.sounds == 2)
{
precache_sound ("misc/talk.wav");
self.noise = "misc/talk.wav";
}
else if (self.sounds == 3)
{
precache_sound ("misc/trigger1.wav");
self.noise = "misc/trigger1.wav";
}
if (!self.wait)
self.wait = 0.2;
self.use = multi_use;
InitTrigger ();
if (self.health)
{
if (self.spawnflags & SPAWNFLAG_NOTOUCH)
objerror ("health and notouch don't make sense\n");
self.max_health = self.health;
self.th_die = multi_killed;
self.takedamage = DAMAGE_YES;
self.solid = SOLID_BBOX;
setorigin (self, self.origin); // make sure it links into the world
}
else
{
if ( !(self.spawnflags & SPAWNFLAG_NOTOUCH) )
{
self.touch = multi_touch;
}
}
};
/*QUAKED trigger_once (.5 .5 .5) ? notouch
Variable sized trigger. Triggers once, then removes itself. You must set the key "target" to the name of another object in the level that has a matching
"targetname". If "health" is set, the trigger must be killed to activate.
If notouch is set, the trigger is only fired by other entities, not by touching.
if "killtarget" is set, any objects that have a matching "target" will be removed when the trigger is fired.
if "angle" is set, the trigger will only fire when someone is facing the direction of the angle. Use "360" for an angle of 0.
sounds
1) secret
2) beep beep
3) large switch
4)
set "message" to text string
*/
void() trigger_once =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
self.wait = -1;
trigger_multiple();
};
//=============================================================================
/*QUAKED trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8)
This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages.
*/
void() trigger_relay =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
self.use = SUB_UseTargets;
};
//=============================================================================
/*QUAKED trigger_secret (.5 .5 .5) ?
secret counter trigger
sounds
1) secret
2) beep beep
3)
4)
set "message" to text string
*/
void() trigger_secret =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
total_secrets = total_secrets + 1;
self.wait = -1;
if (!self.message)
self.message = "You found a secret area!";
if (!self.sounds)
self.sounds = 1;
if (self.sounds == 1)
{
precache_sound ("misc/secret.wav");
self.noise = "misc/secret.wav";
}
else if (self.sounds == 2)
{
precache_sound ("misc/talk.wav");
self.noise = "misc/talk.wav";
}
trigger_multiple ();
};
//=============================================================================
void() counter_use =
{
self.count = self.count - 1;
if (self.count < 0)
return;
if (self.count != 0)
{
if (activator.classname == "player"
&& (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
{
if (self.count >= 4)
centerprint (activator, "There are more to go...");
else if (self.count == 3)
centerprint (activator, "Only 3 more to go...");
else if (self.count == 2)
centerprint (activator, "Only 2 more to go...");
else
centerprint (activator, "Only 1 more to go...");
}
return;
}
if (activator.classname == "player"
&& (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
centerprint(activator, "Sequence completed!");
self.enemy = activator;
multi_trigger ();
};
/*QUAKED trigger_counter (.5 .5 .5) ? nomessage
Acts as an intermediary for an action that takes multiple inputs.
If nomessage is not set, t will print "1 more.. " etc when triggered and "sequence complete" when finished.
After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself.
*/
void() trigger_counter =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
self.wait = -1;
if (!self.count)
self.count = 2;
self.use = counter_use;
};
/*
==============================================================================
TELEPORT TRIGGERS
==============================================================================
*/
float PLAYER_ONLY = 1;
float SILENT = 2;
void() play_teleport =
{
local float v;
local string tmpstr;
v = random() * 5;
if (v < 1)
tmpstr = "misc/r_tele1.wav";
else if (v < 2)
tmpstr = "misc/r_tele2.wav";
else if (v < 3)
tmpstr = "misc/r_tele3.wav";
else if (v < 4)
tmpstr = "misc/r_tele4.wav";
else
tmpstr = "misc/r_tele5.wav";
sound (self, CHAN_VOICE, tmpstr, 1, ATTN_NORM);
remove (self);
};
void(vector org) spawn_tfog =
{
s = spawn ();
s.origin = org;
s.nextthink = time + 0.2;
s.think = play_teleport;
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_TELEPORT);
WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y);
WriteCoord (MSG_BROADCAST, org_z);
};
void() tdeath_touch =
{
if (other == self.owner)
return;
// frag anyone who teleports in on top of an invincible player
if (other.classname == "player")
{
if (other.invincible_finished > time)
self.classname = "teledeath2";
if (self.owner.classname != "player")
{ // other monsters explode themselves
T_Damage (self.owner, self, self, 50000);
return;
}
}
if (other.health)
{
T_Damage (other, self, self, 50000);
}
};
void(vector org, entity death_owner) spawn_tdeath =
{
local entity death;
death = spawn();
death.classname = "teledeath";
death.movetype = MOVETYPE_NONE;
death.solid = SOLID_TRIGGER;
death.angles = '0 0 0';
setsize (death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1');
setorigin (death, org);
death.touch = tdeath_touch;
death.nextthink = time + 0.2;
death.think = SUB_Remove;
death.owner = death_owner;
force_retouch = 2; // make sure even still objects get hit
};
void() teleport_touch =
{
local entity t;
local vector org;
if (self.targetname != "")
{
if (self.nextthink < time)
{
return; // not fired yet
}
}
if (self.spawnflags & PLAYER_ONLY)
{
if (other.classname != "player")
return;
}
if (self.is_waiting == TRUE) // Supa, is this trigger waiting to be activated?
return;
if (self.is_waiting != -1) // Special case
if (self.targetname != "")
{
if (self.nextthink < time)
{
return; // not fired yet
}
}
// only teleport living creatures
if (other.health <= 0 || other.solid != SOLID_SLIDEBOX)
return;
SUB_UseTargets ();
// put a tfog where the player was
spawn_tfog (other.origin);
t = find (world, targetname, self.target);
if (!t)
objerror ("couldn't find target");
// spawn a tfog flash in front of the destination
makevectors (t.mangle);
org = t.origin + 32 * v_forward;
spawn_tfog (org);
spawn_tdeath(t.origin, other);
// move the player and lock him down for a little while
if (!other.health)
{
other.origin = t.origin;
other.velocity = (v_forward * other.velocity_x) + (v_forward * other.velocity_y);
return;
}
setorigin (other, t.origin);
other.angles = t.mangle;
if (other.classname == "player")
{
other.fixangle = 1; // turn this way immediately
other.teleport_time = time + 0.7;
if (other.flags & FL_ONGROUND)
other.flags = other.flags - FL_ONGROUND;
other.velocity = v_forward * 300;
}
other.flags = other.flags - other.flags & FL_ONGROUND;
};
/*QUAKED info_teleport_destination (.5 .5 .5) (-8 -8 -8) (8 8 32)
This is the destination marker for a teleporter. It should have a "targetname" field with the same value as a teleporter's "target" field.
*/
void() info_teleport_destination =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
// this does nothing, just serves as a target spot
self.mangle = self.angles;
self.angles = '0 0 0';
self.model = "";
self.origin = self.origin + '0 0 27';
if (!self.targetname)
objerror ("no targetname");
};
void() teleport_use =
{
if (self.is_waiting) // Supa, if this trigger is waiting to be activated we'll tell it to get ready!
{
self.is_waiting = -1; // Special case to tell teleport_touch to ignore the usual targetname->nextthink check
return; // Must be used or triggered again to do anything
}
self.nextthink = time + 0.2;
force_retouch = 2; // make sure even still objects get hit
self.think = SUB_Null;
};
/*QUAKED trigger_teleport (.5 .5 .5) ? PLAYER_ONLY SILENT
Any object touching this will be transported to the corresponding info_teleport_destination entity. You must set the "target" field, and create an object with a "targetname" field that matches.
If the trigger_teleport has a targetname, it will only teleport entities when it has been fired.
*/
void() trigger_teleport =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
local vector o;
InitTrigger ();
self.touch = teleport_touch;
// find the destination
if (!self.target)
objerror ("no target");
self.use = teleport_use;
if (!(self.spawnflags & SILENT))
{
precache_sound ("ambience/hum1.wav");
o = (self.mins + self.maxs)*0.5;
ambientsound (o, "ambience/hum1.wav",0.5 , ATTN_STATIC);
}
};
/*
==============================================================================
trigger_setskill
==============================================================================
*/
void() trigger_skill_touch =
{
if (other.classname != "player")
return;
cvar_set ("skill", self.message);
};
/*QUAKED trigger_setskill (.5 .5 .5) ?
sets skill level to the value of "message".
Only used on start map.
*/
void() trigger_setskill =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
InitTrigger ();
self.touch = trigger_skill_touch;
};
/*
==============================================================================
ONLY REGISTERED TRIGGERS
==============================================================================
*/
void() trigger_onlyregistered_touch =
{
if (other.classname != "player")
return;
if (self.attack_finished > time)
return;
self.attack_finished = time + 2;
if (cvar("registered"))
{
self.message = "";
SUB_UseTargets ();
remove (self);
}
else
{
if (self.message != "")
{
centerprint (other, self.message);
sound (other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
}
}
};
/*QUAKED trigger_onlyregistered (.5 .5 .5) ?
Only fires if playing the registered version, otherwise prints the message
*/
void() trigger_onlyregistered =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_sound ("misc/talk.wav");
InitTrigger ();
self.touch = trigger_onlyregistered_touch;
};
//============================================================================
void() hurt_on =
{
self.solid = SOLID_TRIGGER;
self.nextthink = -1;
};
void() hurt_touch =
{
if (other.takedamage)
{
self.solid = SOLID_NOT;
T_Damage (other, self, self, self.dmg);
self.think = hurt_on;
self.nextthink = time + 1;
}
return;
};
/*QUAKED trigger_hurt (.5 .5 .5) ?
Any object touching this will be hurt
set dmg to damage amount
defalt dmg = 5
*/
void() trigger_hurt =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
InitTrigger ();
self.touch = hurt_touch;
if (!self.dmg)
self.dmg = 5;
};
//============================================================================
//////////////////////////////////////////////////////////////////////////////
// start dumptruck_ds additions //////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
float PUSH_ONCE = 1;
float DT_STARTOFF = 8; // trigger will start off
float DT_SILENT = 16; // push silently
float DT_NOISE = 32; // use custom sound using noise key/value
void() trigger_push_touch =
{
if (self.is_waiting) return;
if (other.classname == "grenade")
other.velocity = self.speed * self.movedir * 10;
else if (other.health > 0)
{
other.velocity = self.speed * self.movedir * 10;
if (other.classname == "player")
if (!(self.spawnflags & DT_SILENT))
{
if (other.fly_sound < time)
if (!(self.spawnflags & DT_NOISE))
{
other.fly_sound = time + 1.5;
sound (other, CHAN_AUTO, "ambience/windfly.wav", 1, ATTN_NORM);
}
else
{
other.fly_sound = time + 1.5;
sound (other, CHAN_AUTO, self.noise, 1, ATTN_NORM);
}
}
}
if (self.spawnflags & PUSH_ONCE)
remove(self);
};
// void() trigger_push_use = //dumptruck_ds
// {
// self.is_waiting = !self.is_waiting;
// }
/*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE
Pushes the player
*/
void() trigger_push = //dumptruck_ds
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
InitTrigger ();
precache_sound ("ambience/windfly.wav");
// if (self.targetname)
// { // digs 31.03.2012
// self.is_waiting = TRUE;
// self.use = trigger_push_use;
// }
// else self.is_waiting = FALSE;
self.touch = trigger_push_touch;
if (!self.speed)
self.speed = 1000;
};
void() push_toggle = //dumptruck_ds based on hipnotic blocker_use
{
if ( !self.state )
{
self.state = 1;
setorigin( self, self.origin - '8000 8000 8000');
}
else
{
self.state = 0;
setorigin( self, self.origin + '8000 8000 8000');
}
};
/*QUAKED trigger_push_custom (.5 .5 .5) ? PUSH_ONCE DT_STARTOFF DT_SILENT
dumptruck_ds
trigger_push_custom is a new entity. This can be used to create traps,
jumppads, currents in water and more.
If DT_STARTOFF flag is set, this moves the trigger
brush out of the playable area. This can be targeted
and toggled off and on. If the DT_SILENT flag is set it
won't make the windfly sound. Use DT_CUSTOM spawnflag
and the noise key/value to use a custom push sound. Custom
sounds should be "one off" sounds NOT be looping.
Adapted from Hipnotic's func_togglewall */
void() trigger_push_custom =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
InitTrigger();
self.use = push_toggle;
self.touch = trigger_push_touch;
if ( self.spawnflags & DT_STARTOFF )
{
self.state = 0;
setorigin( self, self.origin + '8000 8000 8000' );
}
else
{
self.state = 1;
}
if ( self.noise != "" )
{
precache_sound( self.noise );
}
if (!self.speed)
self.speed = 1000;
};
//============================================================================
void() trigger_monsterjump_touch =
{
if ( other.flags & (FL_MONSTER | FL_FLY | FL_SWIM) != FL_MONSTER )
return;
// set XY even if not on ground, so the jump will clear lips
other.velocity_x = self.movedir_x * self.speed;
other.velocity_y = self.movedir_y * self.speed;
if ( !(other.flags & FL_ONGROUND) )
return;
other.flags = other.flags - FL_ONGROUND;
other.velocity_z = self.height;
};
/*QUAKED trigger_monsterjump (.5 .5 .5) ?
Walking monsters that touch this will jump in the direction of the trigger's angle
"speed" default to 200, the speed thrown forward
"height" default to 200, the speed thrown upwards
If DT_STARTOFF flag is set, this moves the trigger
brush out of the playable area. This can be targeted
and toggled off and on.
*/
void() trigger_monsterjump =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
self.use = push_toggle;
if ( self.spawnflags & DT_STARTOFF ) // dumptruck_ds
{
self.state = 0;
setorigin( self, self.origin + '8000 8000 8000' );
}
else
{
self.state = 1;
}
if (!self.speed)
self.speed = 200;
if (!self.height)
self.height = 200;
if (self.angles == '0 0 0')
self.angles = '0 360 0';
InitTrigger ();
self.touch = trigger_monsterjump_touch;
};
//////////////////////////////////////////////////////////////////////////////
// end dumptruck_ds additions //////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//This is necros' trigger_void from Lost Chapters pack, modified by dumptruck_ds
float MONSTER_SAFE = 1;
float PLAYER_SAFE = 2;
void() trigger_void_touch =
{
if (self.spawnflags & MONSTER_SAFE && other.flags & FL_MONSTER) return; //ignore monsters
if (self.spawnflags & PLAYER_SAFE && other.flags & FL_CLIENT) return; // ignore players
if (other.takedamage)
{
other.invincible_finished = 0; // kills even with Pentagram, this took forever to figure out!! -- dumptruck_ds
T_Damage (other, self, self, other.health + 1000 /*, DTH_TRIGGER_VOID, 1, 1*/);
if (other.flags & FL_MONSTER)
remove(other);
}
if (other.classname == "gib" ||
other.classname == "grenade" ||
other.classname == "spike" ||
other.classname == "missile")
remove(other);
if (other.flags & FL_ITEM)
remove(other);
force_retouch = 2;
};
/*QUAKED trigger_void (.5 .5 .5) ?
Use this for a 'void' area. removes monsters, gibs, ammo, etc... also kills player.
*/
void() trigger_void =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
InitTrigger ();
self.touch = trigger_void_touch;
};
/*==============================================================================
GIVE AND TAKE STUFF (WIP)
This is Axe only at the moment. Need to research removing all weapons.
==============================================================================*/
void() take_weapon_use = //thanks to ShanJaq and Spike for their help on this.
{
if (!(other.flags & FL_CLIENT))
return;
{
multi_trigger();
other.items &= ~IT_SHOTGUN;
other.currentammo = !other.ammo_shells;
other.ammo_shells = !other.ammo_shells;
other.items = other.items - ( other.items & IT_SHELLS);
W_SetCurrentAmmo();
W_BestWeapon();
}
/*
if (self.spawnflags & 8)
{
multi_trigger();
other.items &= ~IT_SUPER_SHOTGUN;
other.currentammo = !other.ammo_shells;
other.ammo_shells = !other.ammo_shells;
other.items = other.items - ( other.items & IT_SHELLS);
W_SetCurrentAmmo();
W_BestWeapon();
}
if (self.spawnflags & 16)
{
multi_trigger();
other.items &= ~IT_NAILGUN;
other.currentammo = !other.ammo_nails;
other.ammo_nails = !other.ammo_nails;
other.items = other.items - ( other.items & IT_NAILS);
W_SetCurrentAmmo();
W_BestWeapon();
}
if (self.spawnflags & 32)
{
multi_trigger();
other.items &= ~IT_SUPER_NAILGUN;
other.currentammo = !other.ammo_nails;
other.ammo_nails = !other.ammo_nails;
other.items = other.items - ( other.items & IT_NAILS);
W_SetCurrentAmmo();
W_BestWeapon();
}
if (self.spawnflags & 64)
{
multi_trigger();
other.items &= ~IT_GRENADE_LAUNCHER;
other.currentammo = !other.ammo_rockets;
// if (!self.keep_ammo)
// {
// other.ammo_rockets = !other.ammo_rockets;
// other.items = other.items - ( other.items & IT_ROCKETS);
// W_SetCurrentAmmo();
// }
// else W_BestWeapon();
W_BestWeapon();
dprint ("best weapon 64\n");
}
if (self.spawnflags & 128)
{
multi_trigger();
other.items &= ~IT_ROCKET_LAUNCHER;
other.currentammo = !other.ammo_rockets;
// if (!self.keep_ammo)
// {
// other.ammo_rockets = !other.ammo_rockets;
// other.items = other.items - ( other.items & IT_ROCKETS);
// W_SetCurrentAmmo();
// }
// else W_BestWeapon();
W_BestWeapon();
dprint ("best weapon 128\n");
}
if (self.spawnflags & 256)
{
multi_trigger();
other.items &= ~IT_LIGHTNING;
other.currentammo = !other.ammo_cells;
other.ammo_cells = !other.ammo_cells;
other.items = other.items - ( other.items & IT_CELLS);
W_SetCurrentAmmo();
W_BestWeapon();
}
*/
};
/*QUAKED trigger_take_weapon (.5 .5 .5) ?
Removes shotgun upon touch.
*/
void() trigger_take_weapon =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
self.wait = -1;
trigger_multiple();
self.touch = take_weapon_use;
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,440 @@
/*
==============================================================================
WIZARD
==============================================================================
*/
$cd id1/models/a_wizard
$origin 0 0 24
$base wizbase
$skin wizbase
$frame hover1 hover2 hover3 hover4 hover5 hover6 hover7 hover8
$frame hover9 hover10 hover11 hover12 hover13 hover14 hover15
$frame fly1 fly2 fly3 fly4 fly5 fly6 fly7 fly8 fly9 fly10
$frame fly11 fly12 fly13 fly14
$frame magatt1 magatt2 magatt3 magatt4 magatt5 magatt6 magatt7
$frame magatt8 magatt9 magatt10 magatt11 magatt12 magatt13
$frame pain1 pain2 pain3 pain4
$frame death1 death2 death3 death4 death5 death6 death7 death8
/*
==============================================================================
WIZARD
If the player moves behind cover before the missile is launched, launch it
at the last visible spot with no velocity leading, in hopes that the player
will duck back out and catch it.
==============================================================================
*/
/*
=============
LaunchMissile
Sets the given entities velocity and angles so that it will hit self.enemy
if self.enemy maintains it's current velocity
0.1 is moderately accurate, 0.0 is totally accurate
=============
*/
void(entity missile, float mspeed, float accuracy) LaunchMissile =
{
local vector vec, move;
local float fly;
makevectors (self.angles);
// set missile speed
vec = self.enemy.origin + self.enemy.mins + self.enemy.size * 0.7 - missile.origin;
// calc aproximate time for missile to reach vec
fly = vlen (vec) / mspeed;
// get the entities xy velocity
move = self.enemy.velocity;
move_z = 0;
// project the target forward in time
vec = vec + move * fly;
vec = normalize(vec);
vec = vec + accuracy*v_up*(random()- 0.5) + accuracy*v_right*(random()- 0.5);
missile.velocity = vec * mspeed;
missile.angles = '0 0 0';
missile.angles_y = vectoyaw(missile.velocity);
// set missile duration
missile.nextthink = time + 5;
missile.think = SUB_Remove;
};
void() wiz_run1;
void() wiz_side1;
/*
=================
WizardCheckAttack
=================
*/
float() WizardCheckAttack =
{
local vector spot1, spot2;
local entity targ;
local float chance;
if (time < self.attack_finished)
return FALSE;
if (!enemy_vis)
return FALSE;
if (enemy_range == RANGE_FAR)
{
if (self.attack_state != AS_STRAIGHT)
{
self.attack_state = AS_STRAIGHT;
wiz_run1 ();
}
return FALSE;
}
targ = self.enemy;
// see if any entities are in the way of the shot
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
traceline (spot1, spot2, FALSE, self);
if (trace_ent != targ)
{ // don't have a clear shot, so move to a side
if (self.attack_state != AS_STRAIGHT)
{
self.attack_state = AS_STRAIGHT;
wiz_run1 ();
}
return FALSE;
}
if (enemy_range == RANGE_MELEE)
chance = 0.9;
else if (enemy_range == RANGE_NEAR)
chance = 0.6;
else if (enemy_range == RANGE_MID)
chance = 0.2;
else
chance = 0;
if (random () < chance)
{
self.attack_state = AS_MISSILE;
return TRUE;
}
if (enemy_range == RANGE_MID)
{
if (self.attack_state != AS_STRAIGHT)
{
self.attack_state = AS_STRAIGHT;
wiz_run1 ();
}
}
else
{
if (self.attack_state != AS_SLIDING)
{
self.attack_state = AS_SLIDING;
wiz_side1 ();
}
}
return FALSE;
};
/*
=================
WizardAttackFinished
=================
*/
void() WizardAttackFinished =
{
if (enemy_range >= RANGE_MID || !enemy_vis)
{
self.attack_state = AS_STRAIGHT;
self.think = wiz_run1;
}
else
{
self.attack_state = AS_SLIDING;
self.think = wiz_side1;
}
};
/*
==============================================================================
FAST ATTACKS
==============================================================================
*/
void() Wiz_FastFire =
{
local vector vec;
local vector dst;
if (self.owner.health > 0)
{
self.owner.effects = self.owner.effects | EF_MUZZLEFLASH;
makevectors (self.enemy.angles);
dst = self.enemy.origin - 13*self.movedir;
vec = normalize(dst - self.origin);
sound (self, CHAN_WEAPON, "wizard/wattack.wav", 1, ATTN_NORM);
launch_spike (self.origin, vec);
newmis.velocity = vec*600;
newmis.owner = self.owner;
newmis.classname = "wizspike";
setmodel (newmis, "progs/w_spike.mdl");
setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
}
remove (self);
};
void() Wiz_StartFast =
{
local entity missile;
sound (self, CHAN_WEAPON, "wizard/wattack.wav", 1, ATTN_NORM);
self.v_angle = self.angles;
makevectors (self.angles);
missile = spawn ();
missile.owner = self;
missile.nextthink = time + 0.6;
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin + '0 0 30' + v_forward*14 + v_right*14);
missile.enemy = self.enemy;
missile.nextthink = time + 0.8;
missile.think = Wiz_FastFire;
missile.movedir = v_right;
missile = spawn ();
missile.owner = self;
missile.nextthink = time + 1;
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin + '0 0 30' + v_forward*14 + v_right* -14);
missile.enemy = self.enemy;
missile.nextthink = time + 0.3;
missile.think = Wiz_FastFire;
missile.movedir = VEC_ORIGIN - v_right;
};
void() Wiz_idlesound =
{
local float wr;
wr = random() * 5;
if (self.waitmin < time)
{
self.waitmin = time + 2;
if (wr > 4.5)
sound (self, CHAN_VOICE, "wizard/widle1.wav", 1, ATTN_IDLE);
if (wr < 1.5)
sound (self, CHAN_VOICE, "wizard/widle2.wav", 1, ATTN_IDLE);
}
return;
};
void() wiz_stand1 =[ $hover1, wiz_stand2 ] {ai_stand();};
void() wiz_stand2 =[ $hover2, wiz_stand3 ] {ai_stand();};
void() wiz_stand3 =[ $hover3, wiz_stand4 ] {ai_stand();};
void() wiz_stand4 =[ $hover4, wiz_stand5 ] {ai_stand();};
void() wiz_stand5 =[ $hover5, wiz_stand6 ] {ai_stand();};
void() wiz_stand6 =[ $hover6, wiz_stand7 ] {ai_stand();};
void() wiz_stand7 =[ $hover7, wiz_stand8 ] {ai_stand();};
void() wiz_stand8 =[ $hover8, wiz_stand1 ] {ai_stand();};
void() wiz_walk1 =[ $hover1, wiz_walk2 ] {ai_walk(8);
Wiz_idlesound();};
void() wiz_walk2 =[ $hover2, wiz_walk3 ] {ai_walk(8);};
void() wiz_walk3 =[ $hover3, wiz_walk4 ] {ai_walk(8);};
void() wiz_walk4 =[ $hover4, wiz_walk5 ] {ai_walk(8);};
void() wiz_walk5 =[ $hover5, wiz_walk6 ] {ai_walk(8);};
void() wiz_walk6 =[ $hover6, wiz_walk7 ] {ai_walk(8);};
void() wiz_walk7 =[ $hover7, wiz_walk8 ] {ai_walk(8);};
void() wiz_walk8 =[ $hover8, wiz_walk1 ] {ai_walk(8);};
void() wiz_side1 =[ $hover1, wiz_side2 ] {ai_run(8);
Wiz_idlesound();};
void() wiz_side2 =[ $hover2, wiz_side3 ] {ai_run(8);};
void() wiz_side3 =[ $hover3, wiz_side4 ] {ai_run(8);};
void() wiz_side4 =[ $hover4, wiz_side5 ] {ai_run(8);};
void() wiz_side5 =[ $hover5, wiz_side6 ] {ai_run(8);};
void() wiz_side6 =[ $hover6, wiz_side7 ] {ai_run(8);};
void() wiz_side7 =[ $hover7, wiz_side8 ] {ai_run(8);};
void() wiz_side8 =[ $hover8, wiz_side1 ] {ai_run(8);};
void() wiz_run1 =[ $fly1, wiz_run2 ] {ai_run(16);
Wiz_idlesound();
};
void() wiz_run2 =[ $fly2, wiz_run3 ] {ai_run(16);};
void() wiz_run3 =[ $fly3, wiz_run4 ] {ai_run(16);};
void() wiz_run4 =[ $fly4, wiz_run5 ] {ai_run(16);};
void() wiz_run5 =[ $fly5, wiz_run6 ] {ai_run(16);};
void() wiz_run6 =[ $fly6, wiz_run7 ] {ai_run(16);};
void() wiz_run7 =[ $fly7, wiz_run8 ] {ai_run(16);};
void() wiz_run8 =[ $fly8, wiz_run9 ] {ai_run(16);};
void() wiz_run9 =[ $fly9, wiz_run10 ] {ai_run(16);};
void() wiz_run10 =[ $fly10, wiz_run11 ] {ai_run(16);};
void() wiz_run11 =[ $fly11, wiz_run12 ] {ai_run(16);};
void() wiz_run12 =[ $fly12, wiz_run13 ] {ai_run(16);};
void() wiz_run13 =[ $fly13, wiz_run14 ] {ai_run(16);};
void() wiz_run14 =[ $fly14, wiz_run1 ] {ai_run(16);};
void() wiz_fast1 =[ $magatt1, wiz_fast2 ] {ai_face();Wiz_StartFast();};
void() wiz_fast2 =[ $magatt2, wiz_fast3 ] {ai_face();};
void() wiz_fast3 =[ $magatt3, wiz_fast4 ] {ai_face();};
void() wiz_fast4 =[ $magatt4, wiz_fast5 ] {ai_face();};
void() wiz_fast5 =[ $magatt5, wiz_fast6 ] {ai_face();};
void() wiz_fast6 =[ $magatt6, wiz_fast7 ] {ai_face();};
void() wiz_fast7 =[ $magatt5, wiz_fast8 ] {ai_face();};
void() wiz_fast8 =[ $magatt4, wiz_fast9 ] {ai_face();};
void() wiz_fast9 =[ $magatt3, wiz_fast10 ] {ai_face();};
void() wiz_fast10 =[ $magatt2, wiz_run1 ] {ai_face();SUB_AttackFinished(2);WizardAttackFinished ();};
void() wiz_pain1 =[ $pain1, wiz_pain2 ] {};
void() wiz_pain2 =[ $pain2, wiz_pain3 ] {};
void() wiz_pain3 =[ $pain3, wiz_pain4 ] {};
void() wiz_pain4 =[ $pain4, wiz_run1 ] {};
void() wiz_death1 =[ $death1, wiz_death2 ] {
self.velocity_x = -200 + 400*random();
self.velocity_y = -200 + 400*random();
self.velocity_z = 100 + 100*random();
self.flags = self.flags - (self.flags & FL_ONGROUND);
sound (self, CHAN_VOICE, "wizard/wdeath.wav", 1, ATTN_NORM);
};
void() wiz_death2 =[ $death2, wiz_death3 ] {};
void() wiz_death3 =[ $death3, wiz_death4 ]{self.solid = SOLID_NOT;};
void() wiz_death4 =[ $death4, wiz_death5 ] {};
void() wiz_death5 =[ $death5, wiz_death6 ] {};
void() wiz_death6 =[ $death6, wiz_death7 ] {};
void() wiz_death7 =[ $death7, wiz_death8 ] {};
void() wiz_death8 =[ $death8, wiz_death8 ] {};
void() wiz_die =
{
// check for gib
if (self.health < -40)
{
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_wizard.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
return;
}
wiz_death1 ();
};
void(entity attacker, float damage) Wiz_Pain =
{
sound (self, CHAN_VOICE, "wizard/wpain.wav", 1, ATTN_NORM);
if (random()*70 > damage)
return; // didn't flinch
wiz_pain1 ();
};
void() Wiz_Missile =
{
wiz_fast1();
};
/*QUAKED monster_wizard (1 0 0) (-16 -16 -24) (16 16 40) Ambush
*/
void() monster_wizard =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (deathmatch)
{
remove(self);
return;
}
precache_model ("progs/wizard.mdl");
precache_model ("progs/h_wizard.mdl");
precache_model ("progs/w_spike.mdl");
precache_sound ("wizard/hit.wav"); // used by c code
precache_sound ("wizard/wattack.wav");
precache_sound ("wizard/wdeath.wav");
precache_sound ("wizard/widle1.wav");
precache_sound ("wizard/widle2.wav");
precache_sound ("wizard/wpain.wav");
precache_sound ("wizard/wsight.wav");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/wizard.mdl");
setsize (self, '-16 -16 -24', '16 16 40');
if (!self.health) //thanks RennyC -- dumptruck_ds
self.health = 80;
self.th_stand = wiz_stand1;
self.th_walk = wiz_walk1;
self.th_run = wiz_run1;
self.th_missile = Wiz_Missile;
self.th_pain = Wiz_Pain;
self.th_die = wiz_die;
flymonster_start ();
};
/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */
/*QUAKED monster_dead_wizard (0 0.5 0.8) (-16 -16 -24) (16 16 32)
*/
void() monster_dead_wizard =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_model("progs/wizard.mdl");
setmodel(self, "progs/wizard.mdl");
self.frame = $death8;
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
setsize(self,'-50.75 -27.46 -55.19','31.81 33.61 30');
}
else
{
self.solid = SOLID_NOT;
}
};

View File

@@ -0,0 +1,442 @@
void() InitBodyQue;
void() main =
{
dprint ("main function\n");
// these are just commands the the prog compiler to copy these files
precache_file ("progs.dat");
precache_file ("gfx.wad");
precache_file ("quake.rc");
precache_file ("default.cfg");
precache_file ("end1.bin");
precache_file2 ("end2.bin");
precache_file ("demo1.dem");
precache_file ("demo2.dem");
precache_file ("demo3.dem");
//
// these are all of the lumps from the cached.ls files
//
precache_file ("gfx/palette.lmp");
precache_file ("gfx/colormap.lmp");
precache_file2 ("gfx/pop.lmp");
precache_file ("gfx/complete.lmp");
precache_file ("gfx/inter.lmp");
precache_file ("gfx/ranking.lmp");
precache_file ("gfx/vidmodes.lmp");
precache_file ("gfx/finale.lmp");
precache_file ("gfx/conback.lmp");
precache_file ("gfx/qplaque.lmp");
precache_file ("gfx/menudot1.lmp");
precache_file ("gfx/menudot2.lmp");
precache_file ("gfx/menudot3.lmp");
precache_file ("gfx/menudot4.lmp");
precache_file ("gfx/menudot5.lmp");
precache_file ("gfx/menudot6.lmp");
precache_file ("gfx/menuplyr.lmp");
precache_file ("gfx/bigbox.lmp");
precache_file ("gfx/dim_modm.lmp");
precache_file ("gfx/dim_drct.lmp");
precache_file ("gfx/dim_ipx.lmp");
precache_file ("gfx/dim_tcp.lmp");
precache_file ("gfx/dim_mult.lmp");
precache_file ("gfx/mainmenu.lmp");
precache_file ("gfx/box_tl.lmp");
precache_file ("gfx/box_tm.lmp");
precache_file ("gfx/box_tr.lmp");
precache_file ("gfx/box_ml.lmp");
precache_file ("gfx/box_mm.lmp");
precache_file ("gfx/box_mm2.lmp");
precache_file ("gfx/box_mr.lmp");
precache_file ("gfx/box_bl.lmp");
precache_file ("gfx/box_bm.lmp");
precache_file ("gfx/box_br.lmp");
precache_file ("gfx/sp_menu.lmp");
precache_file ("gfx/ttl_sgl.lmp");
precache_file ("gfx/ttl_main.lmp");
precache_file ("gfx/ttl_cstm.lmp");
precache_file ("gfx/mp_menu.lmp");
precache_file ("gfx/netmen1.lmp");
precache_file ("gfx/netmen2.lmp");
precache_file ("gfx/netmen3.lmp");
precache_file ("gfx/netmen4.lmp");
precache_file ("gfx/netmen5.lmp");
precache_file ("gfx/sell.lmp");
precache_file ("gfx/help0.lmp");
precache_file ("gfx/help1.lmp");
precache_file ("gfx/help2.lmp");
precache_file ("gfx/help3.lmp");
precache_file ("gfx/help4.lmp");
precache_file ("gfx/help5.lmp");
precache_file ("gfx/pause.lmp");
precache_file ("gfx/loading.lmp");
precache_file ("gfx/p_option.lmp");
precache_file ("gfx/p_load.lmp");
precache_file ("gfx/p_save.lmp");
precache_file ("gfx/p_multi.lmp");
// sounds loaded by C code
precache_sound ("misc/menu1.wav");
precache_sound ("misc/menu2.wav");
precache_sound ("misc/menu3.wav");
precache_sound ("ambience/water1.wav");
precache_sound ("ambience/wind2.wav");
// shareware
precache_file ("maps/start.bsp");
precache_file ("maps/e1m1.bsp");
precache_file ("maps/e1m2.bsp");
precache_file ("maps/e1m3.bsp");
precache_file ("maps/e1m4.bsp");
precache_file ("maps/e1m5.bsp");
precache_file ("maps/e1m6.bsp");
precache_file ("maps/e1m7.bsp");
precache_file ("maps/e1m8.bsp");
// registered
precache_file2 ("gfx/pop.lmp");
precache_file2 ("maps/e2m1.bsp");
precache_file2 ("maps/e2m2.bsp");
precache_file2 ("maps/e2m3.bsp");
precache_file2 ("maps/e2m4.bsp");
precache_file2 ("maps/e2m5.bsp");
precache_file2 ("maps/e2m6.bsp");
precache_file2 ("maps/e2m7.bsp");
precache_file2 ("maps/e3m1.bsp");
precache_file2 ("maps/e3m2.bsp");
precache_file2 ("maps/e3m3.bsp");
precache_file2 ("maps/e3m4.bsp");
precache_file2 ("maps/e3m5.bsp");
precache_file2 ("maps/e3m6.bsp");
precache_file2 ("maps/e3m7.bsp");
precache_file2 ("maps/e4m1.bsp");
precache_file2 ("maps/e4m2.bsp");
precache_file2 ("maps/e4m3.bsp");
precache_file2 ("maps/e4m4.bsp");
precache_file2 ("maps/e4m5.bsp");
precache_file2 ("maps/e4m6.bsp");
precache_file2 ("maps/e4m7.bsp");
precache_file2 ("maps/e4m8.bsp");
precache_file2 ("maps/end.bsp");
precache_file2 ("maps/dm1.bsp");
precache_file2 ("maps/dm2.bsp");
precache_file2 ("maps/dm3.bsp");
precache_file2 ("maps/dm4.bsp");
precache_file2 ("maps/dm5.bsp");
precache_file2 ("maps/dm6.bsp");
};
/*
================
DetectKnownRelease
This detects whether the current map is from a known release for which
a backwards-compatibility hack should be applied, and sets the
known_release global accordingly. -- iw
================
*/
void() DetectKnownRelease =
{
local string release_name;
known_release = KNOWN_RELEASE_NOT;
release_name = "";
if (mapname == "jamx_artistical" ||
mapname == "jamx_bloodshot" ||
mapname == "jamx_fw" ||
mapname == "jamx_hcm" ||
mapname == "jamx_ionous" ||
mapname == "jamx_jcr" ||
mapname == "jamx_kalebclark" ||
mapname == "jamx_mafon" ||
//mapname == "jamx_mugwump" || // dummy map
mapname == "jamx_naitelveni" ||
mapname == "jamx_newhouse" ||
mapname == "jamx_pinchy" ||
mapname == "jamx_strwrk" ||
mapname == "jamx_ukko" ||
mapname == "jamx_yoder" ||
(mapname == "start" && world.message == "An Unending Dusk"))
{
known_release = KNOWN_RELEASE_FUNC_MAPJAMX;
release_name = "func_mapjamx";
}
if (release_name != "")
{
dprint ("WARNING: ");
dprint (release_name);
dprint (" map detected, behaving compatibly\n");
}
};
entity lastspawn;
//=======================
/*QUAKED worldspawn (0 0 0) ?
Only used for the world entity.
Set message to the level name.
Set sounds to the cd track to play.
World Types:
0: medieval
1: metal
2: base
*/
//=======================
void() worldspawn =
{
DetectKnownRelease ();
InitNewSpawnflags (); // new spawnflags for all entities -- iw
lastspawn = world;
InitBodyQue ();
// custom map attributes
if (self.model == "maps/e1m8.bsp")
cvar_set ("sv_gravity", "100");
else
cvar_set ("sv_gravity", "800");
// the area based ambient sounds MUST be the first precache_sounds
// player precaches
W_Precache (); // get weapon precaches
// sounds used from C physics code
precache_sound ("demon/dland2.wav"); // landing thud
precache_sound ("misc/h2ohit1.wav"); // landing splash
// setup precaches allways needed
precache_sound ("items/itembk2.wav"); // item respawn sound
precache_sound ("player/plyrjmp8.wav"); // player jump
precache_sound ("player/land.wav"); // player landing
precache_sound ("player/land2.wav"); // player hurt landing
precache_sound ("player/drown1.wav"); // drowning pain
precache_sound ("player/drown2.wav"); // drowning pain
precache_sound ("player/gasp1.wav"); // gasping for air
precache_sound ("player/gasp2.wav"); // taking breath
precache_sound ("player/h2odeath.wav"); // drowning death
precache_sound ("misc/talk.wav"); // talk
precache_sound ("player/teledth1.wav"); // telefrag
precache_sound ("misc/r_tele1.wav"); // teleport sounds
precache_sound ("misc/r_tele2.wav");
precache_sound ("misc/r_tele3.wav");
precache_sound ("misc/r_tele4.wav");
precache_sound ("misc/r_tele5.wav");
precache_sound ("weapons/lock4.wav"); // ammo pick up
precache_sound ("weapons/pkup.wav"); // weapon up
precache_sound ("items/armor1.wav"); // armor up
precache_sound ("weapons/lhit.wav"); //lightning
precache_sound ("weapons/lstart.wav"); //lightning start
precache_sound ("items/damage3.wav");
precache_sound ("misc/power.wav"); //lightning for boss
// player gib sounds
precache_sound ("player/gib.wav"); // player gib sound
precache_sound ("player/udeath.wav"); // player gib sound
precache_sound ("player/tornoff2.wav"); // gib sound
// player pain sounds
precache_sound ("player/pain1.wav");
precache_sound ("player/pain2.wav");
precache_sound ("player/pain3.wav");
precache_sound ("player/pain4.wav");
precache_sound ("player/pain5.wav");
precache_sound ("player/pain6.wav");
// player death sounds
precache_sound ("player/death1.wav");
precache_sound ("player/death2.wav");
precache_sound ("player/death3.wav");
precache_sound ("player/death4.wav");
precache_sound ("player/death5.wav");
// ax sounds
precache_sound ("weapons/ax1.wav"); // ax swoosh
precache_sound ("player/axhit1.wav"); // ax hit meat
precache_sound ("player/axhit2.wav"); // ax hit world
precache_sound ("player/h2ojump.wav"); // player jumping into water
precache_sound ("player/slimbrn2.wav"); // player enter slime
precache_sound ("player/inh2o.wav"); // player enter water
precache_sound ("player/inlava.wav"); // player enter lava
precache_sound ("misc/outwater.wav"); // leaving water sound
precache_sound ("player/lburn1.wav"); // lava burn
precache_sound ("player/lburn2.wav"); // lava burn
precache_sound ("misc/water1.wav"); // swimming
precache_sound ("misc/water2.wav"); // swimming
precache_model ("progs/player.mdl");
precache_model ("progs/eyes.mdl");
precache_model ("progs/h_player.mdl");
precache_model ("progs/gib1.mdl");
precache_model ("progs/gib2.mdl");
precache_model ("progs/gib3.mdl");
precache_model ("progs/s_bubble.spr"); // drowning bubbles
precache_model ("progs/s_explod.spr"); // sprite explosion
precache_model ("progs/v_axe.mdl");
precache_model ("progs/v_shot.mdl");
precache_model ("progs/v_nail.mdl");
precache_model ("progs/v_rock.mdl");
precache_model ("progs/v_shot2.mdl");
precache_model ("progs/v_nail2.mdl");
precache_model ("progs/v_rock2.mdl");
precache_model ("progs/bolt.mdl"); // for lightning gun
precache_model ("progs/bolt2.mdl"); // for lightning gun
precache_model ("progs/bolt3.mdl"); // for boss shock
precache_model ("progs/lavaball.mdl"); // for testing
precache_model ("progs/missile.mdl");
precache_model ("progs/grenade.mdl");
precache_model ("progs/spike.mdl");
precache_model ("progs/s_spike.mdl");
precache_model ("progs/backpack.mdl");
precache_model ("progs/zom_gib.mdl");
precache_model ("progs/v_light.mdl");
//
// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
//
// 0 normal
lightstyle(0, "m");
// 1 FLICKER (first variety)
lightstyle(1, "mmnmmommommnonmmonqnmmo");
// 2 SLOW STRONG PULSE
lightstyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
// 3 CANDLE (first variety)
lightstyle(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
// 4 FAST STROBE
lightstyle(4, "mamamamamama");
// 5 GENTLE PULSE 1
lightstyle(5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
// 6 FLICKER (second variety)
lightstyle(6, "nmonqnmomnmomomno");
// 7 CANDLE (second variety)
lightstyle(7, "mmmaaaabcdefgmmmmaaaammmaamm");
// 8 CANDLE (third variety)
lightstyle(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
// 9 SLOW STROBE (fourth variety)
lightstyle(9, "aaaaaaaazzzzzzzz");
// 10 FLUORESCENT FLICKER
lightstyle(10, "mmamammmmammamamaaamammma");
// 11 SLOW PULSE NOT FADE TO BLACK
lightstyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
// styles 32-62 are assigned by the light program for switchable lights
// 63 testing
lightstyle(63, "a");
};
void() StartFrame =
{
if (!done_inhibition_summary) // new spawnflags for all entities -- iw
PrintInhibitionSummary ();
teamplay = cvar("teamplay");
skill = cvar("skill");
framecount = framecount + 1;
};
/*
==============================================================================
BODY QUE
==============================================================================
*/
entity bodyque_head;
void() bodyque =
{ // just here so spawn functions don't complain after the world
// creates bodyques
};
void() InitBodyQue =
{
bodyque_head = spawn();
bodyque_head.classname = "bodyque";
bodyque_head.owner = spawn();
bodyque_head.owner.classname = "bodyque";
bodyque_head.owner.owner = spawn();
bodyque_head.owner.owner.classname = "bodyque";
bodyque_head.owner.owner.owner = spawn();
bodyque_head.owner.owner.owner.classname = "bodyque";
bodyque_head.owner.owner.owner.owner = bodyque_head;
};
// make a body que entry for the given ent so the ent can be
// respawned elsewhere
void(entity ent) CopyToBodyQue =
{
bodyque_head.angles = ent.angles;
bodyque_head.model = ent.model;
bodyque_head.modelindex = ent.modelindex;
bodyque_head.frame = ent.frame;
bodyque_head.colormap = ent.colormap;
bodyque_head.movetype = ent.movetype;
bodyque_head.velocity = ent.velocity;
bodyque_head.flags = 0;
setorigin (bodyque_head, ent.origin);
setsize (bodyque_head, ent.mins, ent.maxs);
bodyque_head = bodyque_head.owner;
};

View File

@@ -0,0 +1,649 @@
/*
==============================================================================
ZOMBIES!.qc - Version 1.1
by Ace_Dave
http://www.trenton.edu/~weiden/quake
Weiden@Trenton.EDU
==============================================================================
*/
$cd /raid/quake/id1/models/zombie
$origin 0 0 24
$base base
$skin skin
$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8
$frame stand9 stand10 stand11 stand12 stand13 stand14 stand15
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10 walk11
$frame walk12 walk13 walk14 walk15 walk16 walk17 walk18 walk19
$frame run1 run2 run3 run4 run5 run6 run7 run8 run9 run10 run11 run12
$frame run13 run14 run15 run16 run17 run18
$frame atta1 atta2 atta3 atta4 atta5 atta6 atta7 atta8 atta9 atta10 atta11
$frame atta12 atta13
$frame attb1 attb2 attb3 attb4 attb5 attb6 attb7 attb8 attb9 attb10 attb11
$frame attb12 attb13 attb14
$frame attc1 attc2 attc3 attc4 attc5 attc6 attc7 attc8 attc9 attc10 attc11
$frame attc12
$frame paina1 paina2 paina3 paina4 paina5 paina6 paina7 paina8 paina9 paina10
$frame paina11 paina12
$frame painb1 painb2 painb3 painb4 painb5 painb6 painb7 painb8 painb9 painb10
$frame painb11 painb12 painb13 painb14 painb15 painb16 painb17 painb18 painb19
$frame painb20 painb21 painb22 painb23 painb24 painb25 painb26 painb27 painb28
$frame painc1 painc2 painc3 painc4 painc5 painc6 painc7 painc8 painc9 painc10
$frame painc11 painc12 painc13 painc14 painc15 painc16 painc17 painc18
$frame paind1 paind2 paind3 paind4 paind5 paind6 paind7 paind8 paind9 paind10
$frame paind11 paind12 paind13
$frame paine1 paine2 paine3 paine4 paine5 paine6 paine7 paine8 paine9 paine10
$frame paine11 paine12 paine13 paine14 paine15 paine16 paine17 paine18 paine19
$frame paine20 paine21 paine22 paine23 paine24 paine25 paine26 paine27 paine28
$frame paine29 paine30
$frame cruc_1 cruc_2 cruc_3 cruc_4 cruc_5 cruc_6
float SPAWN_CRUCIFIED = 1;
float SPAWN_DEAD_CRUCIFIED = 4;
float SPAWN_SLEEPING = 16; //changed from 2 which was Zer default
// float SPAWN_DEAD = 4; -- not used in progs_dump -- dumptruck_ds -- this is from Zer src for my reference
// float SPAWN_DEAD_CRUCIFIED = 8; -- not used in progs_dump -- dumptruck_ds -- this is from Zer src for my reference
//=============================================================================
.float inpain;
// motionless crucified zombie
void() zombie_dead_cruc1 = [$cruc_1, zombie_dead_cruc1] {self.nextthink = time + 1;};
// new "stand" - for sleeping zombies
void() zombie_stand1 =[ $paine11, zombie_stand2 ]
{
self.solid = SOLID_NOT;
if (self.count == 0) //dumptruck_ds -- count value > 0 to leave the zombie sleeping until triggered!
ai_stand();
};
void() zombie_stand2 =[ $paine11, zombie_stand1 ]
{
if (self.count == 0)
ai_stand();
};
// old "stand" - called when standing only
void() alt_zombie_stand1 =[ $stand1, alt_zombie_stand2 ] {self.health = 60; ai_stand();};
void() alt_zombie_stand2 =[ $stand2, zombie_stand3 ] {ai_stand();};
void() zombie_stand3 =[ $stand3, zombie_stand4 ] {ai_stand();};
void() zombie_stand4 =[ $stand4, zombie_stand5 ] {ai_stand();};
void() zombie_stand5 =[ $stand5, zombie_stand6 ] {ai_stand();};
void() zombie_stand6 =[ $stand6, zombie_stand7 ] {ai_stand();};
void() zombie_stand7 =[ $stand7, zombie_stand8 ] {ai_stand();};
void() zombie_stand8 =[ $stand8, zombie_stand9 ] {ai_stand();};
void() zombie_stand9 =[ $stand9, zombie_stand10 ] {ai_stand();};
void() zombie_stand10 =[ $stand10, zombie_stand11 ] {ai_stand();};
void() zombie_stand11 =[ $stand11, zombie_stand12 ] {ai_stand();};
void() zombie_stand12 =[ $stand12, zombie_stand13 ] {ai_stand();};
void() zombie_stand13 =[ $stand13, zombie_stand14 ] {ai_stand();};
void() zombie_stand14 =[ $stand14, zombie_stand15 ] {ai_stand();};
void() zombie_stand15 =[ $stand15, alt_zombie_stand1 ] {ai_stand();};
void() zombie_cruc1 = [ $cruc_1, zombie_cruc2 ] {
if (random() < 0.1)
sound (self, CHAN_VOICE, "zombie/idle_w2.wav", 1, ATTN_STATIC);};
void() zombie_cruc2 = [ $cruc_2, zombie_cruc3 ] {self.nextthink = time + 0.1 + random()*0.1;};
void() zombie_cruc3 = [ $cruc_3, zombie_cruc4 ] {self.nextthink = time + 0.1 + random()*0.1;};
void() zombie_cruc4 = [ $cruc_4, zombie_cruc5 ] {self.nextthink = time + 0.1 + random()*0.1;};
void() zombie_cruc5 = [ $cruc_5, zombie_cruc6 ] {self.nextthink = time + 0.1 + random()*0.1;};
void() zombie_cruc6 = [ $cruc_6, zombie_cruc1 ] {self.nextthink = time + 0.1 + random()*0.1;};
void() zombie_walk1 =[ $walk1, zombie_walk2 ] {
self.solid = SOLID_BBOX;
self.health = 60; //so he doesn't fall
ai_walk(0);};
void() zombie_walk2 =[ $walk2, zombie_walk3 ] {ai_walk(2);};
void() zombie_walk3 =[ $walk3, zombie_walk4 ] {ai_walk(3);};
void() zombie_walk4 =[ $walk4, zombie_walk5 ] {ai_walk(2);};
void() zombie_walk5 =[ $walk5, zombie_walk6 ] {ai_walk(1);};
void() zombie_walk6 =[ $walk6, zombie_walk7 ] {ai_walk(0);};
void() zombie_walk7 =[ $walk7, zombie_walk8 ] {ai_walk(0);};
void() zombie_walk8 =[ $walk8, zombie_walk9 ] {ai_walk(0);};
void() zombie_walk9 =[ $walk9, zombie_walk10 ] {ai_walk(0);};
void() zombie_walk10 =[ $walk10, zombie_walk11 ] {ai_walk(0);};
void() zombie_walk11 =[ $walk11, zombie_walk12 ] {ai_walk(2);};
void() zombie_walk12 =[ $walk12, zombie_walk13 ] {ai_walk(2);};
void() zombie_walk13 =[ $walk13, zombie_walk14 ] {ai_walk(1);};
void() zombie_walk14 =[ $walk14, zombie_walk15 ] {ai_walk(0);};
void() zombie_walk15 =[ $walk15, zombie_walk16 ] {ai_walk(0);};
void() zombie_walk16 =[ $walk16, zombie_walk17 ] {ai_walk(0);};
void() zombie_walk17 =[ $walk17, zombie_walk18 ] {ai_walk(0);};
void() zombie_walk18 =[ $walk18, zombie_walk19 ] {ai_walk(0);};
void() zombie_walk19 =[ $walk19, zombie_walk1 ] {
ai_walk(0);
if (random() < 0.2)
sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);};
void() zombie_run1 =[ $run1, zombie_run2 ] {
if (self.spawnflags & SPAWN_SLEEPING)
{ // sloppy hack, but it fixes the illusionary zombie bug
setmodel (self, "progs/zombie.mdl");
setsize (self, '-16 -16 -24', '16 16 40');
}
ai_run(1);
self.inpain = 0;};
void() zombie_run2 =[ $run2, zombie_run3 ] {ai_run(1);};
void() zombie_run3 =[ $run3, zombie_run4 ] {ai_run(0);};
void() zombie_run4 =[ $run4, zombie_run5 ] {ai_run(1);};
void() zombie_run5 =[ $run5, zombie_run6 ] {ai_run(2);};
void() zombie_run6 =[ $run6, zombie_run7 ] {ai_run(3);};
void() zombie_run7 =[ $run7, zombie_run8 ] {ai_run(4);};
void() zombie_run8 =[ $run8, zombie_run9 ] {ai_run(4);};
void() zombie_run9 =[ $run9, zombie_run10 ] {ai_run(2);};
void() zombie_run10 =[ $run10, zombie_run11 ] {ai_run(0);};
void() zombie_run11 =[ $run11, zombie_run12 ] {ai_run(0);};
void() zombie_run12 =[ $run12, zombie_run13 ] {ai_run(0);};
void() zombie_run13 =[ $run13, zombie_run14 ] {ai_run(2);};
void() zombie_run14 =[ $run14, zombie_run15 ] {ai_run(4);};
void() zombie_run15 =[ $run15, zombie_run16 ] {ai_run(6);};
void() zombie_run16 =[ $run16, zombie_run17 ] {ai_run(7);};
void() zombie_run17 =[ $run17, zombie_run18 ] {ai_run(3);};
void() zombie_run18 =[ $run18, zombie_run1 ] {
ai_run(8);
if (random() < 0.2)
sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);
if (random() > 0.8)
sound (self, CHAN_VOICE, "zombie/z_idle1.wav", 1, ATTN_IDLE);
};
/*
=============================================================================
ATTACKS
=============================================================================
*/
// void() ZombieGrenadeTouch =
// {
// 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;
// };
/*
================
ZombieFireGrenade
================
*/
void(vector st) ZombieFireGrenade =
{
local entity missile;
local vector org;
sound (self, CHAN_WEAPON, "zombie/z_shot1.wav", 1, ATTN_NORM);
missile = spawn ();
missile.owner = self;
missile.movetype = MOVETYPE_BOUNCE;
missile.solid = SOLID_BBOX;
// calc org
org = self.origin + st_x * v_forward + st_y * v_right + (st_z - 24) * v_up;
// set missile speed
makevectors (self.angles);
missile.velocity = normalize(self.enemy.origin - org);
missile.velocity = missile.velocity * 600;
missile.velocity_z = 200;
missile.avelocity = '3000 1000 2000';
missile.touch = ZombieGrenadeTouch;
// set missile duration
missile.nextthink = time + 2.5;
missile.think = SUB_Remove;
setmodel (missile, "progs/zom_gib.mdl");
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, org);
};
void() zombie_atta1 =[ $atta1, zombie_atta2 ] {ai_face();};
void() zombie_atta2 =[ $atta2, zombie_atta3 ] {ai_face();};
void() zombie_atta3 =[ $atta3, zombie_atta4 ] {ai_face();};
void() zombie_atta4 =[ $atta4, zombie_atta5 ] {ai_face();};
void() zombie_atta5 =[ $atta5, zombie_atta6 ] {ai_face();};
void() zombie_atta6 =[ $atta6, zombie_atta7 ] {ai_face();};
void() zombie_atta7 =[ $atta7, zombie_atta8 ] {ai_face();};
void() zombie_atta8 =[ $atta8, zombie_atta9 ] {ai_face();};
void() zombie_atta9 =[ $atta9, zombie_atta10 ] {ai_face();};
void() zombie_atta10 =[ $atta10, zombie_atta11 ] {ai_face();};
void() zombie_atta11 =[ $atta11, zombie_atta12 ] {ai_face();};
void() zombie_atta12 =[ $atta12, zombie_atta13 ] {ai_face();};
void() zombie_atta13 =[ $atta13, zombie_run1 ] {ai_face();ZombieFireGrenade('-10 -22 30');};
void() zombie_attb1 =[ $attb1, zombie_attb2 ] {ai_face();};
void() zombie_attb2 =[ $attb2, zombie_attb3 ] {ai_face();};
void() zombie_attb3 =[ $attb3, zombie_attb4 ] {ai_face();};
void() zombie_attb4 =[ $attb4, zombie_attb5 ] {ai_face();};
void() zombie_attb5 =[ $attb5, zombie_attb6 ] {ai_face();};
void() zombie_attb6 =[ $attb6, zombie_attb7 ] {ai_face();};
void() zombie_attb7 =[ $attb7, zombie_attb8 ] {ai_face();};
void() zombie_attb8 =[ $attb8, zombie_attb9 ] {ai_face();};
void() zombie_attb9 =[ $attb9, zombie_attb10 ] {ai_face();};
void() zombie_attb10 =[ $attb10, zombie_attb11 ] {ai_face();};
void() zombie_attb11 =[ $attb11, zombie_attb12 ] {ai_face();};
void() zombie_attb12 =[ $attb12, zombie_attb13 ] {ai_face();};
void() zombie_attb13 =[ $attb13, zombie_attb14 ] {ai_face();};
void() zombie_attb14 =[ $attb13, zombie_run1 ] {ai_face();ZombieFireGrenade('-10 -24 29');};
void() zombie_attc1 =[ $attc1, zombie_attc2 ] {ai_face();};
void() zombie_attc2 =[ $attc2, zombie_attc3 ] {ai_face();};
void() zombie_attc3 =[ $attc3, zombie_attc4 ] {ai_face();};
void() zombie_attc4 =[ $attc4, zombie_attc5 ] {ai_face();};
void() zombie_attc5 =[ $attc5, zombie_attc6 ] {ai_face();};
void() zombie_attc6 =[ $attc6, zombie_attc7 ] {ai_face();};
void() zombie_attc7 =[ $attc7, zombie_attc8 ] {ai_face();};
void() zombie_attc8 =[ $attc8, zombie_attc9 ] {ai_face();};
void() zombie_attc9 =[ $attc9, zombie_attc10 ] {ai_face();};
void() zombie_attc10 =[ $attc10, zombie_attc11 ] {ai_face();};
void() zombie_attc11 =[ $attc11, zombie_attc12 ] {ai_face();};
void() zombie_attc12 =[ $attc12, zombie_run1 ] {ai_face();ZombieFireGrenade('-12 -19 29');};
void() zombie_missile =
{
local float r;
r = random();
if (r < 0.3)
zombie_atta1 ();
else if (r < 0.6)
zombie_attb1 ();
else
zombie_attc1 ();
};
/*
=============================================================================
PAIN
=============================================================================
*/
void() zombie_paina1 =[ $paina1, zombie_paina2 ] {sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);};
void() zombie_paina2 =[ $paina2, zombie_paina3 ] {ai_painforward(3);};
void() zombie_paina3 =[ $paina3, zombie_paina4 ] {ai_painforward(1);};
void() zombie_paina4 =[ $paina4, zombie_paina5 ] {ai_pain(1);};
void() zombie_paina5 =[ $paina5, zombie_paina6 ] {ai_pain(3);};
void() zombie_paina6 =[ $paina6, zombie_paina7 ] {ai_pain(1);};
void() zombie_paina7 =[ $paina7, zombie_paina8 ] {};
void() zombie_paina8 =[ $paina8, zombie_paina9 ] {};
void() zombie_paina9 =[ $paina9, zombie_paina10 ] {};
void() zombie_paina10 =[ $paina10, zombie_paina11 ] {};
void() zombie_paina11 =[ $paina11, zombie_paina12 ] {};
void() zombie_paina12 =[ $paina12, zombie_run1 ] {};
void() zombie_painb1 =[ $painb1, zombie_painb2 ] {sound (self, CHAN_VOICE, "zombie/z_pain1.wav", 1, ATTN_NORM);};
void() zombie_painb2 =[ $painb2, zombie_painb3 ] {ai_pain(2);};
void() zombie_painb3 =[ $painb3, zombie_painb4 ] {ai_pain(8);};
void() zombie_painb4 =[ $painb4, zombie_painb5 ] {ai_pain(6);};
void() zombie_painb5 =[ $painb5, zombie_painb6 ] {ai_pain(2);};
void() zombie_painb6 =[ $painb6, zombie_painb7 ] {};
void() zombie_painb7 =[ $painb7, zombie_painb8 ] {};
void() zombie_painb8 =[ $painb8, zombie_painb9 ] {};
void() zombie_painb9 =[ $painb9, zombie_painb10 ] {sound (self, CHAN_BODY, "zombie/z_fall.wav", 1, ATTN_NORM);};
void() zombie_painb10 =[ $painb10, zombie_painb11 ] {};
void() zombie_painb11 =[ $painb11, zombie_painb12 ] {};
void() zombie_painb12 =[ $painb12, zombie_painb13 ] {};
void() zombie_painb13 =[ $painb13, zombie_painb14 ] {};
void() zombie_painb14 =[ $painb14, zombie_painb15 ] {};
void() zombie_painb15 =[ $painb15, zombie_painb16 ] {};
void() zombie_painb16 =[ $painb16, zombie_painb17 ] {};
void() zombie_painb17 =[ $painb17, zombie_painb18 ] {};
void() zombie_painb18 =[ $painb18, zombie_painb19 ] {};
void() zombie_painb19 =[ $painb19, zombie_painb20 ] {};
void() zombie_painb20 =[ $painb20, zombie_painb21 ] {};
void() zombie_painb21 =[ $painb21, zombie_painb22 ] {};
void() zombie_painb22 =[ $painb22, zombie_painb23 ] {};
void() zombie_painb23 =[ $painb23, zombie_painb24 ] {};
void() zombie_painb24 =[ $painb24, zombie_painb25 ] {};
void() zombie_painb25 =[ $painb25, zombie_painb26 ] {ai_painforward(1);};
void() zombie_painb26 =[ $painb26, zombie_painb27 ] {};
void() zombie_painb27 =[ $painb27, zombie_painb28 ] {};
void() zombie_painb28 =[ $painb28, zombie_run1 ] {};
void() zombie_painc1 =[ $painc1, zombie_painc2 ] {sound (self, CHAN_VOICE, "zombie/z_pain1.wav", 1, ATTN_NORM);};
void() zombie_painc2 =[ $painc2, zombie_painc3 ] {};
void() zombie_painc3 =[ $painc3, zombie_painc4 ] {ai_pain(3);};
void() zombie_painc4 =[ $painc4, zombie_painc5 ] {ai_pain(1);};
void() zombie_painc5 =[ $painc5, zombie_painc6 ] {};
void() zombie_painc6 =[ $painc6, zombie_painc7 ] {};
void() zombie_painc7 =[ $painc7, zombie_painc8 ] {};
void() zombie_painc8 =[ $painc8, zombie_painc9 ] {};
void() zombie_painc9 =[ $painc9, zombie_painc10 ] {};
void() zombie_painc10 =[ $painc10, zombie_painc11 ] {};
void() zombie_painc11 =[ $painc11, zombie_painc12 ] {ai_painforward(1);};
void() zombie_painc12 =[ $painc12, zombie_painc13 ] {ai_painforward(1);};
void() zombie_painc13 =[ $painc13, zombie_painc14 ] {};
void() zombie_painc14 =[ $painc14, zombie_painc15 ] {};
void() zombie_painc15 =[ $painc15, zombie_painc16 ] {};
void() zombie_painc16 =[ $painc16, zombie_painc17 ] {};
void() zombie_painc17 =[ $painc17, zombie_painc18 ] {};
void() zombie_painc18 =[ $painc18, zombie_run1 ] {};
void() zombie_paind1 =[ $paind1, zombie_paind2 ] {sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);};
void() zombie_paind2 =[ $paind2, zombie_paind3 ] {};
void() zombie_paind3 =[ $paind3, zombie_paind4 ] {};
void() zombie_paind4 =[ $paind4, zombie_paind5 ] {};
void() zombie_paind5 =[ $paind5, zombie_paind6 ] {};
void() zombie_paind6 =[ $paind6, zombie_paind7 ] {};
void() zombie_paind7 =[ $paind7, zombie_paind8 ] {};
void() zombie_paind8 =[ $paind8, zombie_paind9 ] {};
void() zombie_paind9 =[ $paind9, zombie_paind10 ] {ai_pain(1);};
void() zombie_paind10 =[ $paind10, zombie_paind11 ] {};
void() zombie_paind11 =[ $paind11, zombie_paind12 ] {};
void() zombie_paind12 =[ $paind12, zombie_paind13 ] {};
void() zombie_paind13 =[ $paind13, zombie_run1 ] {};
void() zombie_paine1 =[ $paine1, zombie_paine2 ] {
if (self.axhitme == 2) // Chainsaw will gib zombie
{
T_Damage(self, world, world, 80);
return;
}
sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);
self.health = 60;
};
void() zombie_paine2 =[ $paine2, zombie_paine3 ] {ai_pain(8);};
void() zombie_paine3 =[ $paine3, zombie_paine4 ] {ai_pain(5);};
void() zombie_paine4 =[ $paine4, zombie_paine5 ] {ai_pain(3);};
void() zombie_paine5 =[ $paine5, zombie_paine6 ] {ai_pain(1);};
void() zombie_paine6 =[ $paine6, zombie_paine7 ] {ai_pain(2);};
void() zombie_paine7 =[ $paine7, zombie_paine8 ] {ai_pain(1);};
void() zombie_paine8 =[ $paine8, zombie_paine9 ] {ai_pain(1);};
void() zombie_paine9 =[ $paine9, zombie_paine10 ] {ai_pain(2);};
void() zombie_paine10 =[ $paine10, zombie_paine11 ] {
sound (self, CHAN_BODY, "zombie/z_fall.wav", 1, ATTN_NORM);
self.solid = SOLID_NOT;
};
void() zombie_paine11 =[ $paine11, zombie_paine12 ] {self.nextthink = self.nextthink + 5;self.health = 60;};
void() zombie_paine12 =[ $paine12, zombie_paine13 ]{
// see if ok to stand up
self.health = 60;
sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);
self.solid = SOLID_SLIDEBOX;
if (!walkmove (0, 0))
{
self.think = zombie_paine11;
self.solid = SOLID_NOT;
return;
}
};
void() zombie_paine13 =[ $paine13, zombie_paine14 ] {};
void() zombie_paine14 =[ $paine14, zombie_paine15 ] {};
void() zombie_paine15 =[ $paine15, zombie_paine16 ] {};
void() zombie_paine16 =[ $paine16, zombie_paine17 ] {};
void() zombie_paine17 =[ $paine17, zombie_paine18 ] {};
void() zombie_paine18 =[ $paine18, zombie_paine19 ] {};
void() zombie_paine19 =[ $paine19, zombie_paine20 ] {};
void() zombie_paine20 =[ $paine20, zombie_paine21 ] {};
void() zombie_paine21 =[ $paine21, zombie_paine22 ] {};
void() zombie_paine22 =[ $paine22, zombie_paine23 ] {};
void() zombie_paine23 =[ $paine23, zombie_paine24 ] {};
void() zombie_paine24 =[ $paine24, zombie_paine25 ] {};
void() zombie_paine25 =[ $paine25, zombie_paine26 ] {ai_painforward(5);};
void() zombie_paine26 =[ $paine26, zombie_paine27 ] {ai_painforward(3);};
void() zombie_paine27 =[ $paine27, zombie_paine28 ] {ai_painforward(1);};
void() zombie_paine28 =[ $paine28, zombie_paine29 ] {ai_pain(1);};
void() zombie_paine29 =[ $paine29, zombie_paine30 ] {};
void() zombie_paine30 =[ $paine30, zombie_run1 ] {};
void() zombie_die =
{
sound (self, CHAN_VOICE, "zombie/z_gib.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_zombie.mdl", self.health/*, self.dest*/); //commented out dest -- dumptruck_ds
ThrowGib ("progs/gib1.mdl", self.health/*, self.dest*/);
ThrowGib ("progs/gib2.mdl", self.health/*, self.dest*/);
ThrowGib ("progs/gib3.mdl", self.health/*, self.dest*/);
};
/*
=================
zombie_pain
Zombies can only be killed (gibbed) by doing 60 hit points of damage
in a single frame (rockets, grenades, quad shotgun, quad nailgun).
A hit of 25 points or more (super shotgun, quad nailgun) will allways put it
down to the ground.
A hit of from 10 to 40 points in one frame will cause it to go down if it
has been twice in two seconds, otherwise it goes into one of the four
fast pain frames.
A hit of less than 10 points of damage (winged by a shotgun) will be ignored.
FIXME: don't use pain_finished because of nightmare hack
=================
*/
void(entity attacker, float take) zombie_pain =
{
local float r;
self.health = 60; // allways reset health
if (take < 9)
return; // totally ignore
if (self.inpain == 2)
return; // down on ground, so don't reset any counters
// go down immediately if a big enough hit
if ((take >= 25) || (self.axhitme == 2))
{
self.inpain = 2;
zombie_paine1 ();
return;
}
if (self.inpain)
{
// if hit again in next gre seconds while not in pain frames, definately drop
self.pain_finished = time + 3;
return; // currently going through an animation, don't change
}
if (self.pain_finished > time)
{
// hit again, so drop down
self.inpain = 2;
zombie_paine1 ();
return;
}
// gp into one of the fast pain animations
self.inpain = 1;
r = random();
if (r < 0.25)
zombie_paina1 ();
else if (r < 0.5)
zombie_painb1 ();
else if (r < 0.75)
zombie_painc1 ();
else
zombie_paind1 ();
};
void() zombie_decide = // stand up if orig. lying down, else just start running
{
if (self.health==61)
zombie_paine12();
else
zombie_run1();
self.th_run = zombie_run1;
};
void() zombie_use = // wake up a sleeping zombie!
{
self.count = 0;
//attacker = other;
monster_use();
};
void() zombie_start = // determine if zombie is to be lying down, or standing
{
self.count = 1; //dumptruck_ds -- Don't start zombie_stand1 yet!
self.use = zombie_use; //dumptruck_ds -- makes self.count = 0 so zombie_stand1 is called
if (self.spawnflags & SPAWN_SLEEPING)
zombie_stand1 ();
else
alt_zombie_stand1 ();
self.th_stand = alt_zombie_stand1;
if (self.spawnflags & SPAWN_SLEEPING && !self.targetname)
objerror ("SPAWN_SLEEPING entity requires a targetname"); //duh! -- dumptruck_ds duh for mispelling this objecterror
return;
};
// void() zombie_start2 = //unused in progs_dump -- dumptruck_ds
// {
// local vector org;
// local entity teldeath;
//
// if (self.style)
// {
// makevectors (self.angles);
// org = self.origin + 16 * v_forward;
// spawn_tfog (org);
// teldeath = spawn();
// teldeath.origin = org;
// teldeath.owner = self;
// // teldeath.think = sf64_teledeath; -- not used in progs_dump -- dumptruck_ds
// teldeath.nextthink = time + 0.1;
// }
//
// self.solid = SOLID_SLIDEBOX;
// self.movetype = MOVETYPE_STEP;
//
// setmodel (self, "progs/zombie.mdl");
//
// setsize (self, '-16 -16 -24', '16 16 40');
// self.health = 61;
//
// walkmonster_start();
// };
//============================================================================
/*QUAKED monster_zombie (1 0 0) (-16 -16 -24) (16 16 32) Crucified ambush
If crucified, stick the bounding box 12 pixels back into a wall to look right.
*/
void() monster_zombie =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (deathmatch /*&& (!(self.spawnflags & SPAWN_DEAD_CRUCIFIED))*/)
{
remove(self);
return;
}
precache_model ("progs/zombie.mdl");
precache_model ("progs/h_zombie.mdl");
precache_model ("progs/zom_gib.mdl");
precache_sound ("zombie/z_idle.wav");
precache_sound ("zombie/z_idle1.wav");
precache_sound ("zombie/z_shot1.wav");
precache_sound ("zombie/z_gib.wav");
precache_sound ("zombie/z_pain.wav");
precache_sound ("zombie/z_pain1.wav");
precache_sound ("zombie/z_fall.wav");
precache_sound ("zombie/z_miss.wav");
precache_sound ("zombie/z_hit.wav");
precache_sound ("zombie/idle_w2.wav");
self.th_stand = zombie_start;
self.th_walk = zombie_walk1;
self.th_run = zombie_decide;
self.th_pain = zombie_pain;
self.th_die = zombie_die;
self.th_missile = zombie_missile;
// if (self.spawnflags & TRIGGER_SPAWN) -- not used in progs_dump -- dumptruck_ds
// {
// self.use = zombie_start2;
// total_monsters = total_monsters + 1;
// return;
// }
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/zombie.mdl");
setsize (self, '-16 -16 -24', '16 16 40');
self.health = 61;
if (self.spawnflags & SPAWN_CRUCIFIED)
{
self.movetype = MOVETYPE_NONE;
zombie_cruc1 ();
}
else if (self.spawnflags & SPAWN_DEAD_CRUCIFIED)
{
self.movetype = MOVETYPE_NONE;
zombie_dead_cruc1 ();
}
// else if (self.spawnflags & SPAWN_DEAD) //-- not used in progs_dump -- dumptruck_ds
// {
// self.origin_z = self.origin_z + 1; // raise off floor a bit
// droptofloor();
//
// if (!walkmove(0,0))
// {
// dprint ("walkmonster in wall at: ");
// dprint (vtos(self.origin));
// dprint ("\n");
// }
// self.takedamage = DAMAGE_NO;
// self.solid = SOLID_NOT;
// self.use = zombie_use;
// self.frame = $paine11;
// }
else
walkmonster_start();
};