initial commit
This commit is contained in:
commit
7b9ee7e8c1
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
config.cfg
|
||||
errors.txt
|
||||
progs.dat
|
28
fixsrc.rb
Normal file
28
fixsrc.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
FNAME = ARGV.shift
|
||||
|
||||
def pipe_in_out io, s
|
||||
io << s
|
||||
io.close_write
|
||||
io.read
|
||||
end
|
||||
|
||||
style_args = %w(
|
||||
astyle
|
||||
--style=java
|
||||
--indent=tab=8
|
||||
--add-braces
|
||||
--pad-oper
|
||||
--pad-comma
|
||||
--unpad-paren
|
||||
--delete-empty-lines
|
||||
--indent-col1-comments
|
||||
)
|
||||
|
||||
s = File.read FNAME
|
||||
s = IO.popen 'expand', mode: "r+" do |io| pipe_in_out io, s end
|
||||
s = IO.popen style_args, mode: "r+" do |io| pipe_in_out io, s end
|
||||
s = s.gsub /\b(\w+) \(/, '\1('
|
||||
s = s.gsub /\(\s*(.*)\s*\)/, '(\1)'
|
||||
s = IO.popen 'unexpand', mode: "r+" do |io| pipe_in_out io, s end
|
||||
30.times do s = s.gsub(/ /, ' ') end
|
||||
puts s
|
87
gnu.txt
Normal file
87
gnu.txt
Normal file
|
@ -0,0 +1,87 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
Preamble
|
||||
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
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
|
35
progs.src
Normal file
35
progs.src
Normal file
|
@ -0,0 +1,35 @@
|
|||
progs.dat
|
||||
|
||||
source/defs.qc
|
||||
source/subs.qc
|
||||
source/fight.qc
|
||||
source/ai.qc
|
||||
source/combat.qc
|
||||
source/items.qc
|
||||
source/weapons.qc
|
||||
source/world.qc
|
||||
source/client.qc
|
||||
source/player.qc
|
||||
source/monsters.qc
|
||||
source/doors.qc
|
||||
source/buttons.qc
|
||||
source/triggers.qc
|
||||
source/plats.qc
|
||||
source/misc.qc
|
||||
|
||||
source/ogre.qc
|
||||
source/demon.qc
|
||||
source/shambler.qc
|
||||
source/knight.qc
|
||||
source/soldier.qc
|
||||
source/wizard.qc
|
||||
source/dog.qc
|
||||
source/zombie.qc
|
||||
source/boss.qc
|
||||
|
||||
source/tarbaby.qc
|
||||
source/hknight.qc
|
||||
source/fish.qc
|
||||
source/shalrath.qc
|
||||
source/enforcer.qc
|
||||
source/oldone.qc
|
734
source/ai.qc
Normal file
734
source/ai.qc
Normal file
|
@ -0,0 +1,734 @@
|
|||
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
|
||||
//
|
||||
float current_yaw;
|
||||
|
||||
//
|
||||
// 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 = {
|
||||
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_vomit") {
|
||||
sound(self, CHAN_VOICE, "vomitus/v_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();
|
||||
};
|
||||
|
||||
/*
|
||||
===========
|
||||
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;
|
||||
}
|
||||
} 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 = {
|
||||
local vector mtemp;
|
||||
|
||||
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;
|
||||
}
|
||||
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 = {
|
||||
local vector delta;
|
||||
local float axis;
|
||||
local float direct, ang_rint, ang_floor, ang_ceil;
|
||||
|
||||
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...
|
||||
};
|
||||
|
80
source/amtest.qc
Normal file
80
source/amtest.qc
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>
|
||||
~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~*/
|
||||
|
||||
void() test_teleport_touch;
|
||||
void() tele_done;
|
||||
|
||||
/*QUAKED test_teleport(0 .5 .8) ?
|
||||
Teleporter testing
|
||||
*/
|
||||
void() test_teleport = {
|
||||
precache_model("sprites/s_aball.spr");
|
||||
setsize(self, self.mins, self.maxs);
|
||||
self.touch = test_teleport_touch;
|
||||
self.solid = 1;
|
||||
|
||||
if(!self.target) {
|
||||
objerror("no target\n");
|
||||
}
|
||||
};
|
||||
|
||||
void() test_teleport_touch = {
|
||||
local entity oldself;
|
||||
other.movetype = MOVETYPE_TOSS;
|
||||
// other.solid = SOLID_NOT;
|
||||
other.dest = '256 -128 -128';
|
||||
oldself = self;
|
||||
self = other;
|
||||
// SUB_CalcMove(self.dest, 200, tele_done);
|
||||
self.velocity = '1000 0 0 ';
|
||||
self = oldself;
|
||||
};
|
||||
|
||||
void() tele_done = {
|
||||
self.movetype = MOVETYPE_WALK;
|
||||
self.solid = SOLID_SLIDEBOX;
|
||||
};
|
||||
|
||||
/*~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>
|
||||
~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~*/
|
||||
|
||||
void() test_goaway;
|
||||
void() test_spawn;
|
||||
|
||||
/*QUAKED test_fodder(0 .5 .8) ?
|
||||
beating guy
|
||||
*/
|
||||
void() test_fodder = {
|
||||
self.nextthink = time + 3;
|
||||
self.think = test_spawn;
|
||||
};
|
||||
|
||||
void() test_spawn = {
|
||||
local entity body;
|
||||
makevectors(self.angles);
|
||||
|
||||
body = spawn();
|
||||
setmodel(body, "progs/soldier.mdl");
|
||||
setorigin(body, self.origin);
|
||||
body.classname = "player";
|
||||
body.health = 1000;
|
||||
body.frags = 0;
|
||||
body.takedamage = DAMAGE_AIM;
|
||||
body.solid = SOLID_SLIDEBOX;
|
||||
body.movetype = MOVETYPE_WALK;
|
||||
body.show_hostile = 0;
|
||||
body.weapon = 1;
|
||||
body.velocity = v_forward * 200;
|
||||
|
||||
body.nextthink = time + 5;
|
||||
body.think = test_goaway;
|
||||
|
||||
self.nextthink = time + 3;
|
||||
self.think = test_spawn;
|
||||
|
||||
};
|
||||
|
||||
void() test_goaway = {
|
||||
remove(self);
|
||||
};
|
||||
|
372
source/boss.qc
Normal file
372
source/boss.qc
Normal file
|
@ -0,0 +1,372 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
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(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 = {
|
||||
self.use = lightning_use;
|
||||
};
|
||||
|
||||
|
134
source/buttons.qc
Normal file
134
source/buttons.qc
Normal file
|
@ -0,0 +1,134 @@
|
|||
// 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 = {
|
||||
local float gtemp, ftemp;
|
||||
|
||||
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);
|
||||
};
|
||||
|
1316
source/client.qc
Normal file
1316
source/client.qc
Normal file
File diff suppressed because it is too large
Load Diff
280
source/combat.qc
Normal file
280
source/combat.qc
Normal file
|
@ -0,0 +1,280 @@
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
693
source/defs.qc
Normal file
693
source/defs.qc
Normal file
|
@ -0,0 +1,693 @@
|
|||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
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 clie |