Added gradle

Refactoring
This commit is contained in:
s1lentq 2016-07-26 07:22:47 +07:00
parent 1f6124b374
commit eaf6f1ae41
478 changed files with 29804 additions and 114035 deletions

9
.gitignore vendored
View File

@ -1,3 +1,5 @@
**/build
**/.gradle
.idea
*.iml
**/msvc/Debug*
@ -9,5 +11,10 @@
**/msvc/*.aps
**/msvc/*.pch
**/msvc/*.txt
**/msvc/start*.bat
**/msvc/ipch
**/*.log
**/PublishPath*.txt
**/*.log
publish
**/appversion.h

674
LICENSE Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. 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
them 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 prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. 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.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey 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;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If 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 convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU 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 that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
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.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
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.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
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
state 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 3 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, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
This program 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, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU 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. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

Binary file not shown.

Binary file not shown.

54
build.gradle Normal file
View File

@ -0,0 +1,54 @@
import versioning.GitVersioner
import versioning.MetamodVersionInfo
import org.joda.time.DateTime
apply from: 'shared.gradle'
group = 'metamod'
apply plugin: 'idea'
idea {
project {
languageLevel = 'JDK_1_7'
}
}
def gitInfo = GitVersioner.versionForDir(project.rootDir)
MetamodVersionInfo versionInfo
if (gitInfo && gitInfo.tag && gitInfo.tag[0] == 'v') {
def m = gitInfo.tag =~ /^v(\d+)\.(\d+)(\.(\d+))?$/
if (!m.find()) {
throw new RuntimeException("Invalid git version tag name ${gitInfo.tag}")
}
versionInfo = new MetamodVersionInfo(
majorVersion: m.group(1) as int,
minorVersion: m.group(2) as int,
maintenanceVersion: m.group(4) ? (m.group(4) as int) : null,
countCommit: gitInfo.countCommit,
lastCommitDate: gitInfo.lastCommitDate,
commitID: gitInfo.commitID,
authorCommit: gitInfo.authorCommit,
urlCommits: gitInfo.urlCommits
)
} else {
versionInfo = new MetamodVersionInfo(
majorVersion: project.majorVersion as int,
minorVersion: project.minorVersion as int,
specialVersion: gitInfo ? project.specialVersion : "SNAPSHOT",
countCommit: gitInfo ? gitInfo.countCommit : 0,
lastCommitDate: gitInfo ? gitInfo.lastCommitDate : new DateTime(),
commitID: gitInfo ? gitInfo.commitID : "",
authorCommit: gitInfo ? gitInfo.authorCommit : "",
urlCommits: gitInfo ? gitInfo.urlCommits : ""
)
}
project.ext.metamodVersionInfo = versionInfo
project.version = versionInfo.asVersion()
apply from: 'publish.gradle'
task wrapper(type: Wrapper) {
gradleVersion = '2.4'
}

23
buildSrc/build.gradle Normal file
View File

@ -0,0 +1,23 @@
apply plugin: 'groovy'
repositories {
//mavenLocal()
mavenCentral()
maven {
url 'http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/'
}
maven {
url 'http://nexus.rehlds.org/nexus/content/repositories/rehlds-snapshots/'
}
}
dependencies {
compile gradleApi()
compile localGroovy()
compile 'commons-io:commons-io:2.4'
compile 'commons-lang:commons-lang:2.6'
compile 'joda-time:joda-time:2.7'
compile 'org.doomedsociety.gradlecpp:gradle-cpp-plugin:1.2'
compile 'org.eclipse.jgit:org.eclipse.jgit:3.7.0.201502260915-r'
compile 'org.apache.velocity:velocity:1.7'
}

View File

@ -0,0 +1,38 @@
package gradlecpp
import org.apache.velocity.Template
import org.apache.velocity.VelocityContext
import org.apache.velocity.app.Velocity
import org.joda.time.format.DateTimeFormat
class VelocityUtils {
static {
Properties p = new Properties();
p.setProperty("resource.loader", "class");
p.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
p.setProperty("class.resource.loader.path", "");
p.setProperty("input.encoding", "UTF-8");
p.setProperty("output.encoding", "UTF-8");
Velocity.init(p);
}
static String renderTemplate(File tplFile, Map<String, ? extends Object> ctx) {
Template tpl = Velocity.getTemplate(tplFile.absolutePath)
if (!tpl) {
throw new RuntimeException("Failed to load velocity template ${tplFile.absolutePath}: not found")
}
def velocityContext = new VelocityContext(ctx)
velocityContext.put("_DateTimeFormat", DateTimeFormat)
def sw = new StringWriter()
tpl.merge(velocityContext, sw)
return sw.toString()
}
}

View File

@ -0,0 +1,16 @@
package versioning
import groovy.transform.CompileStatic
import groovy.transform.TypeChecked
import org.joda.time.DateTime
@CompileStatic @TypeChecked
class GitInfo {
DateTime lastCommitDate
String branch
String tag
Integer countCommit
String commitID
String authorCommit
String urlCommits
}

View File

@ -0,0 +1,129 @@
package versioning
import groovy.transform.CompileStatic
import groovy.transform.TypeChecked
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.lib.ObjectId
import org.eclipse.jgit.lib.Repository
import org.eclipse.jgit.lib.StoredConfig
import org.eclipse.jgit.revwalk.RevCommit
import org.eclipse.jgit.revwalk.RevWalk
import org.eclipse.jgit.storage.file.FileRepositoryBuilder
import org.joda.time.DateTime
import org.joda.time.DateTimeZone
@CompileStatic @TypeChecked
class GitVersioner {
static GitInfo versionForDir(String dir) {
versionForDir(new File(dir))
}
static int getCountCommit(Repository repo) {
Iterable<RevCommit> commits = Git.wrap(repo).log().call()
int count = 0;
commits.each {
count++;
}
return count;
}
// return last commit excluding merge commit
static RevCommit parseCommitLast(Repository repo) {
Iterable<RevCommit> commits = Git.wrap(repo).log().call()
for (RevCommit b : commits) {
if (b.getParents().length > 1) { // it's merge commit ignore it
continue;
}
return b;
}
return null;
}
static String prepareUrlToCommits(String url) {
if (url == null) {
// default remote url
return "https://bitbucket.org/rehlds/metamod/commits/";
}
StringBuilder sb = new StringBuilder();
String childPath;
int pos = url.indexOf('@');
if (pos != -1) {
childPath = url.substring(pos + 1, url.lastIndexOf('.git')).replace(':', '/');
sb.append('https://');
} else {
pos = url.lastIndexOf('.git');
childPath = (pos == -1) ? url : url.substring(0, pos);
}
// support for different links to history of commits
if (url.indexOf('bitbucket.org') != -1) {
sb.append(childPath).append('/commits/');
} else {
sb.append(childPath).append('/commit/');
}
return sb.toString();
}
static GitInfo versionForDir(File dir) {
FileRepositoryBuilder builder = new FileRepositoryBuilder()
Repository repo = builder.setWorkTree(dir)
.findGitDir()
.build()
ObjectId head = repo.resolve('HEAD')
if (!head) {
return null
}
final StoredConfig cfg = repo.getConfig();
def commit = new RevWalk(repo).parseCommit(head)
def commitLast = parseCommitLast(repo)
int commitCount = getCountCommit(repo)
def branch = repo.getBranch()
def commitDate = new DateTime(1000L * commit.commitTime, DateTimeZone.UTC)
String url = null;
String remote_name = cfg.getString("branch", branch, "remote");
if (remote_name == null) {
for (String remotes : cfg.getSubsections("remote")) {
if (url != null) {
println 'Found a second remote: (' + remotes + '), url: (' + cfg.getString("remote", remotes, "url") + ')'
continue;
}
url = cfg.getString("remote", remotes, "url");
}
} else {
url = cfg.getString("remote", remote_name, "url");
}
println 'Debug: Start';
println ' cfg: (' + cfg + ')';
println ' branch: (' + branch + ')';
println ' remote_name: (' + remote_name + ')';
println ' url: (' + url + ')';
println 'Debug: End';
String urlCommits = prepareUrlToCommits(url);
if (!commit) {
throw new RuntimeException("Can't find last commit.")
}
String tag = repo.tags.find { kv -> kv.value.objectId == commit.id }?.key
String headCommitId = commit.getId().abbreviate(7).name();
String authorCommit = commitLast.getAuthorIdent().getName();
return new GitInfo(
lastCommitDate: commitDate,
branch: branch,
tag: tag,
countCommit: commitCount,
commitID: headCommitId,
authorCommit: authorCommit,
urlCommits: urlCommits
)
}
}

View File

@ -0,0 +1,42 @@
package versioning
import groovy.transform.CompileStatic
import groovy.transform.ToString
import groovy.transform.TypeChecked
import org.joda.time.DateTime
@CompileStatic @TypeChecked
@ToString(includeNames = true)
class MetamodVersionInfo {
int majorVersion
int minorVersion
Integer maintenanceVersion
String specialVersion
Integer countCommit
DateTime lastCommitDate
String commitID
String authorCommit
String urlCommits
String format(String versionSeparator, String suffixSeparator, boolean includeSuffix) {
StringBuilder sb = new StringBuilder()
sb.append(majorVersion).append(versionSeparator).append(minorVersion)
if (maintenanceVersion != null) {
sb.append(versionSeparator).append(maintenanceVersion)
}
if (specialVersion && includeSuffix) {
sb.append(suffixSeparator).append(specialVersion)
}
return sb.toString()
}
String asVersion() {
StringBuilder sb = new StringBuilder()
sb.append(majorVersion).append('.' + minorVersion).append('.' + countCommit);
return sb;
}
String asMavenVersion() {
format('.', '-', true)
}
}

3
gradle.properties Normal file
View File

@ -0,0 +1,3 @@
majorVersion=0
minorVersion=1
specialVersion=

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Sat Jun 06 16:31:05 BRT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip

164
gradlew vendored Normal file
View File

@ -0,0 +1,164 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
gradlew.bat vendored Normal file
View File

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

184
metamod/build.gradle Normal file
View File

@ -0,0 +1,184 @@
import org.doomedsociety.gradlecpp.GradleCppUtils
import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin
import org.doomedsociety.gradlecpp.toolchain.icc.Icc
import org.doomedsociety.gradlecpp.cfg.ToolchainConfig
import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig
import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig
import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils
import org.gradle.language.cpp.CppSourceSet
import org.gradle.language.rc.tasks.WindowsResourceCompile
import org.gradle.nativeplatform.NativeBinarySpec
import versioning.MetamodVersionInfo
import gradlecpp.VelocityUtils
apply plugin: 'cpp'
apply plugin: 'windows-resources'
apply plugin: IccCompilerPlugin
List<Task> getRcCompileTasks(NativeBinarySpec binary) {
def linkTask = GradleCppUtils.getLinkTask(binary)
def res = linkTask.taskDependencies.getDependencies(linkTask).findAll { Task t -> t instanceof WindowsResourceCompile }
return res as List
}
void postEvaluate(NativeBinarySpec b) {
if (GradleCppUtils.windows) {
getRcCompileTasks(b).each { Task t ->
t.dependsOn project.generateAppVersion
}
} else {
// attach generateAppVersion task to all 'compile source' tasks
GradleCppUtils.getCompileTasks(b).each { Task t ->
t.dependsOn project.generateAppVersion
}
}
}
void setupToolchain(NativeBinarySpec b)
{
ToolchainConfig cfg = rootProject.createToolchainConfig(b)
cfg.projectInclude(project, '', '/src', '/include/common', '/include/dlls', '/include/engine', '/include/game_shared', '/include/pm_shared', '/include/public')
cfg.singleDefines '__METAMOD_BUILD__', '__BUILD_FAST_METAMOD__';
if (cfg instanceof MsvcToolchainConfig) {
cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig(
enabled: true,
pchHeader: 'precompiled.h',
pchSourceSet: 'metamod_pch'
)
cfg.compilerOptions.args '/Ob2', '/Oi', '/GF', '/GR-', '/GS-'
cfg.singleDefines('_CRT_SECURE_NO_WARNINGS')
} else if (cfg instanceof GccToolchainConfig) {
cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions(
enabled: true,
pchSourceSet: 'metamod_pch'
)
cfg.compilerOptions.languageStandard = 'c++0x'
cfg.defines([
'_stricmp': 'strcasecmp',
'_strnicmp': 'strncasecmp',
'_vsnprintf': 'vsnprintf',
'_snprintf': 'snprintf'
])
cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-msse2', '-fomit-frame-pointer', '-inline-forceinline', '-fvisibility=default', '-fvisibility-inlines-hidden', '-fno-rtti', '-g0', '-s'
}
ToolchainConfigUtils.apply(project, cfg, b)
GradleCppUtils.onTasksCreated(project, 'postEvaluate', {
postEvaluate(b)
})
}
model {
buildTypes {
debug
release
}
platforms {
x86 {
architecture "x86"
}
}
toolChains {
visualCpp(VisualCpp) {
}
icc(Icc) {
}
}
components {
metamod(NativeLibrarySpec) {
targetPlatform 'x86'
baseName GradleCppUtils.windows ? 'metamod_mm' : 'metamod_mm_i386'
sources {
metamod_pch(CppSourceSet) {
source {
srcDirs "src"
include "precompiled.cpp"
}
exportedHeaders {
srcDirs "include"
}
}
metamod_src(CppSourceSet) {
source {
srcDir "src"
srcDir "version"
include "**/*.cpp"
exclude "precompiled.cpp"
}
exportedHeaders {
srcDirs "include"
}
}
rc {
source {
srcDir "msvc"
include "metamod.rc"
}
exportedHeaders {
srcDirs "msvc"
}
}
}
binaries.all {
NativeBinarySpec b -> project.setupToolchain(b)
}
}
}
}
afterEvaluate {
project.binaries.all {
NativeBinarySpec binary ->
Tool linker = binary.linker
if (GradleCppUtils.windows) {
linker.args "/DEF:${projectDir}\\msvc\\metamod.def"
}
}
}
task buildRelease {
dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib ->
blib.buildable && blib.buildType.name == 'release'
}
}
tasks.clean.doLast {
project.file('version/appversion.h').delete()
}
task generateAppVersion {
MetamodVersionInfo verInfo = (MetamodVersionInfo)rootProject.metamodVersionInfo
def tplFile = project.file('version/appversion.vm')
def renderedFile = project.file('version/appversion.h')
inputs.file tplFile
inputs.file project.file('gradle.properties')
outputs.file renderedFile
inputs.property('version', verInfo.asMavenVersion())
inputs.property('lastCommitDate', verInfo.lastCommitDate.toString())
doLast {
def templateCtx = [
verInfo: verInfo
]
def content = VelocityUtils.renderTemplate(tplFile, templateCtx)
renderedFile.delete()
renderedFile.write(content, 'utf-8')
println 'The current Metamod version is ' + verInfo.asVersion().toString() + ', maven version is ' + verInfo.asMavenVersion().toString() + ', commit id: ' + verInfo.commitID.toString() + ', commit author: ' + verInfo.authorCommit.toString() + ', url: (' + verInfo.urlCommits.toString() + ')';
}
}

View File

@ -0,0 +1,15 @@
#pragma once
#include "maintypes.h"
#include "interface.h"
class IGameServerData : public IBaseInterface {
public:
virtual ~IGameServerData() { };
virtual void WriteDataRequest(const void *buffer, int bufferSize) = 0;
virtual int ReadDataResponse(void *data, int len) = 0;
};
#define GAMESERVERDATA_INTERFACE_VERSION "GameServerData001"

View File

@ -0,0 +1,703 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
/*
** The copyright to the contents herein is the property of Valve Corporation.
** The contents may be used and/or copied only with the written permission of
** Valve, or in accordance with the terms and conditions stipulated in
** the agreement/contract under which the contents have been supplied.
**
*******************************************************************************
**
** Contents:
**
** Common types used in the Steam DLL interface.
**
** This file is distributed to Steam application developers.
**
**
**
*******************************************************************************/
#ifndef INCLUDED_STEAM_COMMON_STEAMCOMMON_H
#define INCLUDED_STEAM_COMMON_STEAMCOMMON_H
#if defined(_MSC_VER) && (_MSC_VER > 1000)
#pragma once
#endif
#ifdef __cplusplus
extern "C"
{
#endif
/* Applications should not define STEAM_EXPORTS. */
#if defined ( _WIN32 )
#ifdef STEAM_EXPORTS
#define STEAM_API __declspec(dllexport)
#else
#define STEAM_API __declspec(dllimport)
#endif
#define STEAM_CALL __cdecl
#else
#define STEAM_API /* */
#define STEAM_CALL /* */
#endif
typedef void (STEAM_CALL *KeyValueIteratorCallback_t )(const char *Key, const char *Val, void *pvParam);
/******************************************************************************
**
** Exported macros and constants
**
******************************************************************************/
/* DEPRECATED -- these are ignored now, all API access is granted on SteamStartup */
#define STEAM_USING_FILESYSTEM (0x00000001)
#define STEAM_USING_LOGGING (0x00000002)
#define STEAM_USING_USERID (0x00000004)
#define STEAM_USING_ACCOUNT (0x00000008)
#define STEAM_USING_ALL (0x0000000f)
/* END DEPRECATED */
#define STEAM_MAX_PATH (255)
#define STEAM_QUESTION_MAXLEN (255)
#define STEAM_SALT_SIZE (8)
#define STEAM_PROGRESS_PERCENT_SCALE (0x00001000)
/* These are maximum significant string lengths, excluding nul-terminator. */
#define STEAM_CARD_NUMBER_SIZE (17)
#define STEAM_CARD_HOLDERNAME_SIZE (100)
#define STEAM_CARD_EXPYEAR_SIZE (4)
#define STEAM_CARD_EXPMONTH_SIZE (2)
#define STEAM_CARD_CVV2_SIZE (5)
#define STEAM_BILLING_ADDRESS1_SIZE (128)
#define STEAM_BILLING_ADDRESS2_SIZE (128)
#define STEAM_BILLING_CITY_SIZE (50)
#define STEAM_BILLING_ZIP_SIZE (16)
#define STEAM_BILLING_STATE_SIZE (32)
#define STEAM_BILLING_COUNTRY_SIZE (32)
#define STEAM_BILLING_PHONE_SIZE (20)
#define STEAM_BILLING_EMAIL_ADDRESS_SIZE (100)
#define STEAM_TYPE_OF_PROOF_OF_PURCHASE_SIZE (20)
#define STEAM_PROOF_OF_PURCHASE_TOKEN_SIZE (200)
#define STEAM_EXTERNAL_ACCOUNTNAME_SIZE (100)
#define STEAM_EXTERNAL_ACCOUNTPASSWORD_SIZE (80)
#define STEAM_BILLING_CONFIRMATION_CODE_SIZE (22)
#define STEAM_BILLING_CARD_APPROVAL_CODE_SIZE (100)
#define STEAM_BILLING_TRANS_DATE_SIZE (9) // mm/dd/yy
#define STEAM_BILLING_TRANS_TIME_SIZE (9) // hh:mm:ss
/******************************************************************************
**
** Scalar type and enumerated type definitions.
**
******************************************************************************/
typedef unsigned int SteamHandle_t;
typedef void * SteamUserIDTicketValidationHandle_t;
typedef unsigned int SteamCallHandle_t;
#if defined(_MSC_VER)
typedef unsigned __int64 SteamUnsigned64_t;
#else
typedef unsigned long long SteamUnsigned64_t;
#endif
typedef enum
{
eSteamSeekMethodSet = 0,
eSteamSeekMethodCur = 1,
eSteamSeekMethodEnd = 2
} ESteamSeekMethod;
typedef enum
{
eSteamBufferMethodFBF = 0,
eSteamBufferMethodNBF = 1
} ESteamBufferMethod;
typedef enum
{
eSteamErrorNone = 0,
eSteamErrorUnknown = 1,
eSteamErrorLibraryNotInitialized = 2,
eSteamErrorLibraryAlreadyInitialized = 3,
eSteamErrorConfig = 4,
eSteamErrorContentServerConnect = 5,
eSteamErrorBadHandle = 6,
eSteamErrorHandlesExhausted = 7,
eSteamErrorBadArg = 8,
eSteamErrorNotFound = 9,
eSteamErrorRead = 10,
eSteamErrorEOF = 11,
eSteamErrorSeek = 12,
eSteamErrorCannotWriteNonUserConfigFile = 13,
eSteamErrorCacheOpen = 14,
eSteamErrorCacheRead = 15,
eSteamErrorCacheCorrupted = 16,
eSteamErrorCacheWrite = 17,
eSteamErrorCacheSession = 18,
eSteamErrorCacheInternal = 19,
eSteamErrorCacheBadApp = 20,
eSteamErrorCacheVersion = 21,
eSteamErrorCacheBadFingerPrint = 22,
eSteamErrorNotFinishedProcessing = 23,
eSteamErrorNothingToDo = 24,
eSteamErrorCorruptEncryptedUserIDTicket = 25,
eSteamErrorSocketLibraryNotInitialized = 26,
eSteamErrorFailedToConnectToUserIDTicketValidationServer = 27,
eSteamErrorBadProtocolVersion = 28,
eSteamErrorReplayedUserIDTicketFromClient = 29,
eSteamErrorReceiveResultBufferTooSmall = 30,
eSteamErrorSendFailed = 31,
eSteamErrorReceiveFailed = 32,
eSteamErrorReplayedReplyFromUserIDTicketValidationServer = 33,
eSteamErrorBadSignatureFromUserIDTicketValidationServer = 34,
eSteamErrorValidationStalledSoAborted = 35,
eSteamErrorInvalidUserIDTicket = 36,
eSteamErrorClientLoginRateTooHigh = 37,
eSteamErrorClientWasNeverValidated = 38,
eSteamErrorInternalSendBufferTooSmall = 39,
eSteamErrorInternalReceiveBufferTooSmall = 40,
eSteamErrorUserTicketExpired = 41,
eSteamErrorCDKeyAlreadyInUseOnAnotherClient = 42,
eSteamErrorNotLoggedIn = 101,
eSteamErrorAlreadyExists = 102,
eSteamErrorAlreadySubscribed = 103,
eSteamErrorNotSubscribed = 104,
eSteamErrorAccessDenied = 105,
eSteamErrorFailedToCreateCacheFile = 106,
eSteamErrorCallStalledSoAborted = 107,
eSteamErrorEngineNotRunning = 108,
eSteamErrorEngineConnectionLost = 109,
eSteamErrorLoginFailed = 110,
eSteamErrorAccountPending = 111,
eSteamErrorCacheWasMissingRetry = 112,
eSteamErrorLocalTimeIncorrect = 113,
eSteamErrorCacheNeedsDecryption = 114,
eSteamErrorAccountDisabled = 115,
eSteamErrorCacheNeedsRepair = 116,
eSteamErrorRebootRequired = 117,
eSteamErrorNetwork = 200,
eSteamErrorOffline = 201
} ESteamError;
typedef enum
{
eNoDetailedErrorAvailable,
eStandardCerrno,
eWin32LastError,
eWinSockLastError,
eDetailedPlatformErrorCount
} EDetailedPlatformErrorType;
typedef enum /* Filter elements returned by SteamFind{First,Next} */
{
eSteamFindLocalOnly, /* limit search to local filesystem */
eSteamFindRemoteOnly, /* limit search to remote repository */
eSteamFindAll /* do not limit search (duplicates allowed) */
} ESteamFindFilter;
/******************************************************************************
**
** Exported structure and complex type definitions.
**
******************************************************************************/
typedef struct
{
ESteamError eSteamError;
EDetailedPlatformErrorType eDetailedErrorType;
int nDetailedErrorCode;
char szDesc[STEAM_MAX_PATH];
} TSteamError;
typedef struct
{
int bIsDir; /* If non-zero, element is a directory; if zero, element is a file */
unsigned int uSizeOrCount; /* If element is a file, this contains size of file in bytes */
int bIsLocal; /* If non-zero, reported item is a standalone element on local filesystem */
char cszName[STEAM_MAX_PATH]; /* Base element name (no path) */
long lLastAccessTime; /* Seconds since 1/1/1970 (like time_t) when element was last accessed */
long lLastModificationTime; /* Seconds since 1/1/1970 (like time_t) when element was last modified */
long lCreationTime; /* Seconds since 1/1/1970 (like time_t) when element was created */
} TSteamElemInfo;
typedef struct
{
unsigned int uNumSubscriptions;
unsigned int uMaxNameChars;
unsigned int uMaxApps;
} TSteamSubscriptionStats;
typedef struct
{
unsigned int uNumApps;
unsigned int uMaxNameChars;
unsigned int uMaxInstallDirNameChars;
unsigned int uMaxVersionLabelChars;
unsigned int uMaxLaunchOptions;
unsigned int uMaxLaunchOptionDescChars;
unsigned int uMaxLaunchOptionCmdLineChars;
unsigned int uMaxNumIcons;
unsigned int uMaxIconSize;
unsigned int uMaxDependencies;
} TSteamAppStats;
typedef struct
{
char *szLabel;
unsigned int uMaxLabelChars;
unsigned int uVersionId;
int bIsNotAvailable;
} TSteamAppVersion;
typedef struct
{
char *szDesc;
unsigned int uMaxDescChars;
char *szCmdLine;
unsigned int uMaxCmdLineChars;
unsigned int uIndex;
unsigned int uIconIndex;
int bNoDesktopShortcut;
int bNoStartMenuShortcut;
int bIsLongRunningUnattended;
} TSteamAppLaunchOption;
typedef struct
{
char *szName;
unsigned int uMaxNameChars;
char *szLatestVersionLabel;
unsigned int uMaxLatestVersionLabelChars;
char *szCurrentVersionLabel;
unsigned int uMaxCurrentVersionLabelChars;
char *szInstallDirName;
unsigned int uMaxInstallDirNameChars;
unsigned int uId;
unsigned int uLatestVersionId;
unsigned int uCurrentVersionId;
unsigned int uMinCacheFileSizeMB;
unsigned int uMaxCacheFileSizeMB;
unsigned int uNumLaunchOptions;
unsigned int uNumIcons;
unsigned int uNumVersions;
unsigned int uNumDependencies;
} TSteamApp;
typedef enum
{
eNoCost = 0,
eBillOnceOnly = 1,
eBillMonthly = 2,
eProofOfPrepurchaseOnly = 3,
eGuestPass = 4,
eHardwarePromo = 5,
eNumBillingTypes,
} EBillingType;
typedef struct
{
char *szName;
unsigned int uMaxNameChars;
unsigned int *puAppIds;
unsigned int uMaxAppIds;
unsigned int uId;
unsigned int uNumApps;
EBillingType eBillingType;
unsigned int uCostInCents;
unsigned int uNumDiscounts;
int bIsPreorder;
int bRequiresShippingAddress;
unsigned int uDomesticShippingCostInCents;
unsigned int uInternationalShippingCostInCents;
bool bIsCyberCafeSubscription;
unsigned int uGameCode;
char szGameCodeDesc[STEAM_MAX_PATH];
bool bIsDisabled;
bool bRequiresCD;
unsigned int uTerritoryCode;
bool bIsSteam3Subscription;
} TSteamSubscription;
typedef struct
{
char szName[STEAM_MAX_PATH];
unsigned int uDiscountInCents;
unsigned int uNumQualifiers;
} TSteamSubscriptionDiscount;
typedef struct
{
char szName[STEAM_MAX_PATH];
unsigned int uRequiredSubscription;
int bIsDisqualifier;
} TSteamDiscountQualifier;
typedef struct TSteamProgress
{
int bValid; /* non-zero if call provides progress info */
unsigned int uPercentDone; /* 0 to 100 * STEAM_PROGRESS_PERCENT_SCALE if bValid */
char szProgress[STEAM_MAX_PATH]; /* additional progress info */
} TSteamProgress;
typedef enum
{
eSteamNotifyTicketsWillExpire,
eSteamNotifyAccountInfoChanged,
eSteamNotifyContentDescriptionChanged,
eSteamNotifyPleaseShutdown,
eSteamNotifyNewContentServer,
eSteamNotifySubscriptionStatusChanged,
eSteamNotifyContentServerConnectionLost,
eSteamNotifyCacheLoadingCompleted,
eSteamNotifyCacheNeedsDecryption,
eSteamNotifyCacheNeedsRepair
} ESteamNotificationCallbackEvent;
typedef void(*SteamNotificationCallback_t)(ESteamNotificationCallbackEvent eEvent, unsigned int nData);
typedef char SteamPersonalQuestion_t[ STEAM_QUESTION_MAXLEN + 1 ];
typedef struct
{
unsigned char uchSalt[STEAM_SALT_SIZE];
} SteamSalt_t;
typedef enum
{
eVisa = 1,
eMaster = 2,
eAmericanExpress = 3,
eDiscover = 4,
eDinnersClub = 5,
eJCB = 6
} ESteamPaymentCardType;
typedef struct
{
ESteamPaymentCardType eCardType;
char szCardNumber[ STEAM_CARD_NUMBER_SIZE +1 ];
char szCardHolderName[ STEAM_CARD_HOLDERNAME_SIZE + 1];
char szCardExpYear[ STEAM_CARD_EXPYEAR_SIZE + 1 ];
char szCardExpMonth[ STEAM_CARD_EXPMONTH_SIZE+ 1 ];
char szCardCVV2[ STEAM_CARD_CVV2_SIZE + 1 ];
char szBillingAddress1[ STEAM_BILLING_ADDRESS1_SIZE + 1 ];
char szBillingAddress2[ STEAM_BILLING_ADDRESS2_SIZE + 1 ];
char szBillingCity[ STEAM_BILLING_CITY_SIZE + 1 ];
char szBillingZip[ STEAM_BILLING_ZIP_SIZE + 1 ];
char szBillingState[ STEAM_BILLING_STATE_SIZE + 1 ];
char szBillingCountry[ STEAM_BILLING_COUNTRY_SIZE + 1 ];
char szBillingPhone[ STEAM_BILLING_PHONE_SIZE + 1 ];
char szBillingEmailAddress[ STEAM_BILLING_EMAIL_ADDRESS_SIZE + 1 ];
unsigned int uExpectedCostInCents;
unsigned int uExpectedTaxInCents;
/* If the TSteamSubscription says that shipping info is required, */
/* then the following fields must be filled out. */
/* If szShippingName is empty, then assumes so are the rest. */
char szShippingName[ STEAM_CARD_HOLDERNAME_SIZE + 1];
char szShippingAddress1[ STEAM_BILLING_ADDRESS1_SIZE + 1 ];
char szShippingAddress2[ STEAM_BILLING_ADDRESS2_SIZE + 1 ];
char szShippingCity[ STEAM_BILLING_CITY_SIZE + 1 ];
char szShippingZip[ STEAM_BILLING_ZIP_SIZE + 1 ];
char szShippingState[ STEAM_BILLING_STATE_SIZE + 1 ];
char szShippingCountry[ STEAM_BILLING_COUNTRY_SIZE + 1 ];
char szShippingPhone[ STEAM_BILLING_PHONE_SIZE + 1 ];
unsigned int uExpectedShippingCostInCents;
} TSteamPaymentCardInfo;
typedef struct
{
char szTypeOfProofOfPurchase[ STEAM_TYPE_OF_PROOF_OF_PURCHASE_SIZE + 1 ];
/* A ProofOfPurchase token is not necessarily a nul-terminated string; it may be binary data
(perhaps encrypted). Hence we need a length and an array of bytes. */
unsigned int uLengthOfBinaryProofOfPurchaseToken;
char cBinaryProofOfPurchaseToken[ STEAM_PROOF_OF_PURCHASE_TOKEN_SIZE + 1 ];
} TSteamPrepurchaseInfo;
typedef struct
{
char szAccountName[ STEAM_EXTERNAL_ACCOUNTNAME_SIZE + 1 ];
char szPassword[ STEAM_EXTERNAL_ACCOUNTPASSWORD_SIZE + 1 ];
} TSteamExternalBillingInfo;
typedef enum
{
ePaymentCardInfo = 1,
ePrepurchasedInfo = 2,
eAccountBillingInfo = 3,
eExternalBillingInfo = 4, /* indirect billing via ISP etc (not supported yet) */
ePaymentCardReceipt = 5,
ePrepurchaseReceipt = 6,
eEmptyReceipt = 7
} ESteamSubscriptionBillingInfoType;
typedef struct
{
ESteamSubscriptionBillingInfoType eBillingInfoType;
union {
TSteamPaymentCardInfo PaymentCardInfo;
TSteamPrepurchaseInfo PrepurchaseInfo;
TSteamExternalBillingInfo ExternalBillingInfo;
char bUseAccountBillingInfo;
};
} TSteamSubscriptionBillingInfo;
typedef enum
{
/* Subscribed */
eSteamSubscriptionOK = 0, /* Subscribed */
eSteamSubscriptionPending = 1, /* Awaiting transaction completion */
eSteamSubscriptionPreorder = 2, /* Is currently a pre-order */
eSteamSubscriptionPrepurchaseTransferred = 3, /* hop to this account */
/* Unusbscribed */
eSteamSubscriptionPrepurchaseInvalid = 4, /* Invalid cd-key */
eSteamSubscriptionPrepurchaseRejected = 5, /* hopped out / banned / etc */
eSteamSubscriptionPrepurchaseRevoked = 6, /* hop away from this account */
eSteamSubscriptionPaymentCardDeclined = 7, /* CC txn declined */
eSteamSubscriptionCancelledByUser = 8, /* Cancelled by client */
eSteamSubscriptionCancelledByVendor = 9, /* Cancelled by us */
eSteamSubscriptionPaymentCardUseLimit = 10, /* Card used too many times, potential fraud */
eSteamSubscriptionPaymentCardAlert = 11, /* Got a "pick up card" or the like from bank */
eSteamSubscriptionFailed = 12, /* Other Error in subscription data or transaction failed/lost */
eSteamSubscriptionPaymentCardAVSFailure = 13, /* Card failed Address Verification check */
eSteamSubscriptionPaymentCardInsufficientFunds = 14, /* Card failed due to insufficient funds */
eSteamSubscriptionRestrictedCountry = 15 /* The subscription is not available in the user's country */
} ESteamSubscriptionStatus;
typedef struct
{
ESteamPaymentCardType eCardType;
char szCardLastFourDigits[ 4 + 1 ];
char szCardHolderName[ STEAM_CARD_HOLDERNAME_SIZE + 1];
char szBillingAddress1[ STEAM_BILLING_ADDRESS1_SIZE + 1 ];
char szBillingAddress2[ STEAM_BILLING_ADDRESS2_SIZE + 1 ];
char szBillingCity[ STEAM_BILLING_CITY_SIZE + 1 ];
char szBillingZip[ STEAM_BILLING_ZIP_SIZE + 1 ];
char szBillingState[ STEAM_BILLING_STATE_SIZE + 1 ];
char szBillingCountry[ STEAM_BILLING_COUNTRY_SIZE + 1 ];
// The following are only available after the subscription leaves "pending" status
char szCardApprovalCode[ STEAM_BILLING_CARD_APPROVAL_CODE_SIZE + 1];
char szTransDate[ STEAM_BILLING_TRANS_DATE_SIZE + 1]; /* mm/dd/yy */
char szTransTime[ STEAM_BILLING_TRANS_TIME_SIZE + 1]; /* hh:mm:ss */
unsigned int uPriceWithoutTax;
unsigned int uTaxAmount;
unsigned int uShippingCost;
} TSteamPaymentCardReceiptInfo;
typedef struct
{
char szTypeOfProofOfPurchase[ STEAM_TYPE_OF_PROOF_OF_PURCHASE_SIZE + 1 ];
} TSteamPrepurchaseReceiptInfo;
typedef struct
{
ESteamSubscriptionStatus eStatus;
ESteamSubscriptionStatus ePreviousStatus;
ESteamSubscriptionBillingInfoType eReceiptInfoType;
char szConfirmationCode[ STEAM_BILLING_CONFIRMATION_CODE_SIZE + 1];
union {
TSteamPaymentCardReceiptInfo PaymentCardReceiptInfo;
TSteamPrepurchaseReceiptInfo PrepurchaseReceiptInfo;
};
} TSteamSubscriptionReceipt;
typedef enum
{
ePhysicalBytesReceivedThisSession = 1,
eAppReadyToLaunchStatus = 2,
eAppPreloadStatus = 3,
eAppEntireDepot = 4,
eCacheBytesPresent = 5
} ESteamAppUpdateStatsQueryType;
typedef struct
{
SteamUnsigned64_t uBytesTotal;
SteamUnsigned64_t uBytesPresent;
} TSteamUpdateStats;
typedef enum
{
eSteamUserAdministrator = 0x00000001, /* May subscribe, unsubscribe, etc */
eSteamUserDeveloper = 0x00000002, /* Steam or App developer */
eSteamUserCyberCafe = 0x00000004 /* CyberCafe, school, etc -- UI should ask for password */
/* before allowing logout, unsubscribe, etc */
} ESteamUserTypeFlags;
typedef enum
{
eSteamAccountStatusDefault = 0x00000000,
eSteamAccountStatusEmailVerified = 0x00000001,
/* Note: Mask value 0x2 is reserved for future use. (Some, but not all, public accounts already have this set.) */
eSteamAccountDisabled = 0x00000004
} ESteamAccountStatusBitFields ;
typedef enum
{
eSteamBootstrapperError = -1,
eSteamBootstrapperDontCheckForUpdate = 0,
eSteamBootstrapperCheckForUpdateAndRerun = 7
} ESteamBootStrapperClientAppResult;
typedef enum
{
eSteamOnline = 0,
eSteamOffline = 1,
eSteamNoAuthMode = 2,
eSteamBillingOffline = 3
} eSteamOfflineStatus;
typedef struct
{
int eOfflineNow;
int eOfflineNextSession;
} TSteamOfflineStatus;
typedef struct
{
unsigned int uAppId;
int bIsSystemDefined;
char szMountPath[STEAM_MAX_PATH];
} TSteamAppDependencyInfo;
typedef enum
{
eSteamOpenFileRegular = 0x0,
eSteamOpenFileIgnoreLocal = 0x1,
eSteamOpenFileChecksumReads = 0x2
} ESteamOpenFileFlags;
typedef enum
{
eSteamValveCDKeyValidationServer = 0,
eSteamHalfLifeMasterServer = 1,
eSteamFriendsServer = 2,
eSteamCSERServer = 3,
eSteamHalfLife2MasterServer = 4,
eSteamRDKFMasterServer = 5,
eMaxServerTypes = 6
} ESteamServerType;
/******************************************************************************
**
** More exported constants
**
******************************************************************************/
#ifdef __cplusplus
const SteamHandle_t STEAM_INVALID_HANDLE = 0;
const SteamCallHandle_t STEAM_INVALID_CALL_HANDLE = 0;
const SteamUserIDTicketValidationHandle_t STEAM_INACTIVE_USERIDTICKET_VALIDATION_HANDLE = 0;
const unsigned int STEAM_USE_LATEST_VERSION = 0xFFFFFFFF;
#else
#define STEAM_INVALID_HANDLE ((SteamHandle_t)(0))
#define STEAM_INVALID_CALL_HANDLE ((SteamCallHandle_t)(0))
#define STEAM_INACTIVE_USERIDTICKET_VALIDATION_HANDLE ((SteamUserIDTicketValidationHandle_t)(0))
#define STEAM_USE_LATEST_VERSION (0xFFFFFFFFu);
#endif
/******************************************************************************
** Each Steam instance (licensed Steam Service Provider) has a unique SteamInstanceID_t.
**
** Each Steam instance as its own DB of users.
** Each user in the DB has a unique SteamLocalUserID_t (a serial number, with possible
** rare gaps in the sequence).
**
******************************************************************************/
typedef unsigned short SteamInstanceID_t; // MUST be 16 bits
#if defined ( _WIN32 )
typedef unsigned __int64 SteamLocalUserID_t; // MUST be 64 bits
#else
typedef unsigned long long SteamLocalUserID_t; // MUST be 64 bits
#endif
/******************************************************************************
**
** Applications need to be able to authenticate Steam users from ANY instance.
** So a SteamIDTicket contains SteamGlobalUserID, which is a unique combination of
** instance and user id.
**
** SteamLocalUserID is an unsigned 64-bit integer.
** For platforms without 64-bit int support, we provide access via a union that splits it into
** high and low unsigned 32-bit ints. Such platforms will only need to compare LocalUserIDs
** for equivalence anyway - not perform arithmetic with them.
**
********************************************************************************/
typedef struct
{
unsigned int Low32bits;
unsigned int High32bits;
} TSteamSplitLocalUserID;
typedef struct
{
SteamInstanceID_t m_SteamInstanceID;
union
{
SteamLocalUserID_t As64bits;
TSteamSplitLocalUserID Split;
} m_SteamLocalUserID;
} TSteamGlobalUserID;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -15,9 +15,7 @@
#if !defined ( BEAMDEFH )
#define BEAMDEFH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
#define FBEAM_STARTENTITY 0x00000001

View File

@ -16,9 +16,7 @@
#if !defined( CL_ENTITYH )
#define CL_ENTITYH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef struct efrag_s

View File

@ -0,0 +1,340 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
// com_model.h
#pragma once
#define STUDIO_RENDER 1
#define STUDIO_EVENTS 2
//#define MAX_MODEL_NAME 64
//#define MAX_MAP_HULLS 4
//#define MIPLEVELS 4
//#define NUM_AMBIENTS 4 // automatic ambient sounds
//#define MAXLIGHTMAPS 4
#define PLANE_ANYZ 5
#define ALIAS_Z_CLIP_PLANE 5
// flags in finalvert_t.flags
#define ALIAS_LEFT_CLIP 0x0001
#define ALIAS_TOP_CLIP 0x0002
#define ALIAS_RIGHT_CLIP 0x0004
#define ALIAS_BOTTOM_CLIP 0x0008
#define ALIAS_Z_CLIP 0x0010
#define ALIAS_ONSEAM 0x0020
#define ALIAS_XY_CLIP_MASK 0x000F
#define ZISCALE ((float)0x8000)
#define CACHE_SIZE 32 // used to align key data structures
//typedef enum
//{
// mod_brush,
// mod_sprite,
// mod_alias,
// mod_studio
//} modtype_t;
// must match definition in modelgen.h
//#ifndef SYNCTYPE_T
//#define SYNCTYPE_T
//
//typedef enum
//{
// ST_SYNC=0,
// ST_RAND
//} synctype_t;
//
//#endif
//typedef struct
//{
// float mins[3], maxs[3];
// float origin[3];
// int headnode[MAX_MAP_HULLS];
// int visleafs; // not including the solid leaf 0
// int firstface, numfaces;
//} dmodel_t;
// plane_t structure
//typedef struct mplane_s
//{
// vec3_t normal; // surface normal
// float dist; // closest appoach to origin
// byte type; // for texture axis selection and fast side tests
// byte signbits; // signx + signy<<1 + signz<<1
// byte pad[2];
//} mplane_t;
//typedef struct
//{
// vec3_t position;
//} mvertex_t;
//typedef struct
//{
// unsigned short v[2];
// unsigned int cachededgeoffset;
//} medge_t;
//typedef struct texture_s
//{
// char name[16];
// unsigned width, height;
// int anim_total; // total tenths in sequence ( 0 = no)
// int anim_min, anim_max; // time for this frame min <=time< max
// struct texture_s *anim_next; // in the animation sequence
// struct texture_s *alternate_anims; // bmodels in frame 1 use these
// unsigned offsets[MIPLEVELS]; // four mip maps stored
// unsigned paloffset;
//} texture_t;
//typedef struct
//{
// float vecs[2][4]; // [s/t] unit vectors in world space.
// // [i][3] is the s/t offset relative to the origin.
// // s or t = dot(3Dpoint,vecs[i])+vecs[i][3]
// float mipadjust; // ?? mipmap limits for very small surfaces
// texture_t *texture;
// int flags; // sky or slime, no lightmap or 256 subdivision
//} mtexinfo_t;
//typedef struct mnode_s
//{
// // common with leaf
// int contents; // 0, to differentiate from leafs
// int visframe; // node needs to be traversed if current
//
// short minmaxs[6]; // for bounding box culling
//
// struct mnode_s *parent;
//
// // node specific
// mplane_t *plane;
// struct mnode_s *children[2];
//
// unsigned short firstsurface;
// unsigned short numsurfaces;
//} mnode_t;
//typedef struct msurface_s msurface_t;
//typedef struct decal_s decal_t;
// JAY: Compress this as much as possible
//struct decal_s
//{
// decal_t *pnext; // linked list for each surface
// msurface_t *psurface; // Surface id for persistence / unlinking
// short dx; // Offsets into surface texture (in texture coordinates, so we don't need floats)
// short dy;
// short texture; // Decal texture
// byte scale; // Pixel scale
// byte flags; // Decal flags
//
// short entityIndex; // Entity this is attached to
//};
//typedef struct mleaf_s
//{
// // common with node
// int contents; // wil be a negative contents number
// int visframe; // node needs to be traversed if current
//
// short minmaxs[6]; // for bounding box culling
//
// struct mnode_s *parent;
//
// // leaf specific
// byte *compressed_vis;
// struct efrag_s *efrags;
//
// msurface_t **firstmarksurface;
// int nummarksurfaces;
// int key; // BSP sequence number for leaf's contents
// byte ambient_sound_level[NUM_AMBIENTS];
//} mleaf_t;
//struct msurface_s
//{
// int visframe; // should be drawn when node is crossed
//
// int dlightframe; // last frame the surface was checked by an animated light
// int dlightbits; // dynamically generated. Indicates if the surface illumination
// // is modified by an animated light.
//
// mplane_t *plane; // pointer to shared plane
// int flags; // see SURF_ #defines
//
// int firstedge; // look up in model->surfedges[], negative numbers
// int numedges; // are backwards edges
//
// // surface generation data
// struct surfcache_s *cachespots[MIPLEVELS];
//
// short texturemins[2]; // smallest s/t position on the surface.
// short extents[2]; // ?? s/t texture size, 1..256 for all non-sky surfaces
//
// mtexinfo_t *texinfo;
//
// // lighting info
// byte styles[MAXLIGHTMAPS]; // index into d_lightstylevalue[] for animated lights
// // no one surface can be effected by more than 4
// // animated lights.
// color24 *samples;
//
// decal_t *pdecals;
//};
//typedef struct
//{
// int planenum;
// short children[2]; // negative numbers are contents
//} dclipnode_t;
//typedef struct hull_s
//{
// dclipnode_t *clipnodes;
// mplane_t *planes;
// int firstclipnode;
// int lastclipnode;
// vec3_t clip_mins;
// vec3_t clip_maxs;
//} hull_t;
typedef struct cache_user_s
{
void *data;
} cache_user_t;
//typedef struct model_s
//{
// char name[ MAX_MODEL_NAME ];
// qboolean needload; // bmodels and sprites don't cache normally
//
// modtype_t type;
// int numframes;
// synctype_t synctype;
//
// int flags;
//
// //
// // volume occupied by the model
// //
// vec3_t mins, maxs;
// float radius;
//
// //
// // brush model
// //
// int firstmodelsurface, nummodelsurfaces;
//
// int numsubmodels;
// dmodel_t *submodels;
//
// int numplanes;
// mplane_t *planes;
//
// int numleafs; // number of visible leafs, not counting 0
// struct mleaf_s *leafs;
//
// int numvertexes;
// mvertex_t *vertexes;
//
// int numedges;
// medge_t *edges;
//
// int numnodes;
// mnode_t *nodes;
//
// int numtexinfo;
// mtexinfo_t *texinfo;
//
// int numsurfaces;
// msurface_t *surfaces;
//
// int numsurfedges;
// int *surfedges;
//
// int numclipnodes;
// dclipnode_t *clipnodes;
//
// int nummarksurfaces;
// msurface_t **marksurfaces;
//
// hull_t hulls[MAX_MAP_HULLS];
//
// int numtextures;
// texture_t **textures;
//
// byte *visdata;
//
// color24 *lightdata;
//
// char *entities;
//
// //
// // additional model data
// //
// cache_user_t cache; // only access through Mod_Extradata
//
//} model_t;
//typedef vec_t vec4_t[4];
typedef struct alight_s
{
int ambientlight; // clip at 128
int shadelight; // clip at 192 - ambientlight
vec3_t color;
float *plightvec;
} alight_t;
typedef struct auxvert_s
{
float fv[3]; // viewspace x, y
} auxvert_t;
#include "custom.h"
//#define MAX_SCOREBOARDNAME 32
// Defined in client.h differently
//typedef struct player_info_s
//{
// // User id on server
// int userid;
//
// // User info string
// char userinfo[ MAX_INFO_STRING ];
//
// // Name
// char name[ MAX_SCOREBOARDNAME ];
//
// // Spectator or not, unused
// int spectator;
//
// int ping;
// int packet_loss;
//
// // skin information
// char model[MAX_QPATH];
// int topcolor;
// int bottomcolor;
//
// // last frame rendered
// int renderframe;
//
// // Gait frame estimation
// int gaitsequence;
// float gaitframe;
// float gaityaw;
// vec3_t prevgaitorigin;
//
// customization_t customdata;
//} player_info_t;

View File

@ -15,15 +15,13 @@
#if !defined( CON_NPRINTH )
#define CON_NPRINTH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct con_nprint_s
{
int index; // Row #
@ -31,8 +29,8 @@ typedef struct con_nprint_s
float color[ 3 ]; // RGB colors ( 0.0 -> 1.0 scale )
} con_nprint_t;
void Con_NPrintf( int idx, char *fmt, ... );
void Con_NXPrintf( struct con_nprint_s *info, char *fmt, ... );
void Con_NPrintf( int idx, const char *fmt, ... );
void Con_NXPrintf( struct con_nprint_s *info, const char *fmt, ... );
#ifdef __cplusplus
}
#endif

View File

@ -12,26 +12,43 @@
* without written permission from Valve LLC.
*
****/
#ifndef CONST_H
#define CONST_H
#ifdef _WIN32
#pragma once
#endif
// Max # of clients allowed in a server.
#define MAX_CLIENTS 32
// How many bits to use to encode an edict.
#define MAX_EDICT_BITS 11 // # of bits needed to represent max edicts
// Max # of edicts in a level (2048)
#define MAX_EDICTS (1<<MAX_EDICT_BITS)
// How many data slots to use when in multiplayer (must be power of 2)
#define MULTIPLAYER_BACKUP 64
// Same for single player
#define SINGLEPLAYER_BACKUP 8
//
// Constants shared by the engine and dlls
// This header file included by engine files and DLL files.
// Most came from server.h
// edict->flags
#define FL_FLY (1<<0) // Changes the SV_Movestep() behavior to not need to be on ground
#define FL_SWIM (1<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
#define FL_CONVEYOR (1<<2)
#define FL_CLIENT (1<<3)
#define FL_INWATER (1<<4)
#define FL_MONSTER (1<<5)
#define FL_GODMODE (1<<6)
#define FL_NOTARGET (1<<7)
#define FL_SKIPLOCALHOST (1<<8) // Don't send entity to local host, it's predicting this entity itself
#define FL_ONGROUND (1<<9) // At rest / on the ground
#define FL_PARTIALGROUND (1<<10) // not all corners are valid
#define FL_WATERJUMP (1<<11) // player jumping out of water
#define FL_FLY (1<<0) // Changes the SV_Movestep() behavior to not need to be on ground
#define FL_SWIM (1<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
#define FL_CONVEYOR (1<<2)
#define FL_CLIENT (1<<3)
#define FL_INWATER (1<<4)
#define FL_MONSTER (1<<5)
#define FL_GODMODE (1<<6)
#define FL_NOTARGET (1<<7)
#define FL_SKIPLOCALHOST (1<<8) // Don't send entity to local host, it's predicting this entity itself
#define FL_ONGROUND (1<<9) // At rest / on the ground
#define FL_PARTIALGROUND (1<<10) // not all corners are valid
#define FL_WATERJUMP (1<<11) // player jumping out of water
#define FL_FROZEN (1<<12) // Player is frozen for 3rd person camera
#define FL_FAKECLIENT (1<<13) // JAC: fake client, simulated server side; don't send network messages to them
#define FL_DUCKING (1<<14) // Player flag -- Player is fully crouched
@ -40,7 +57,7 @@
// UNDONE: Do we need these?
#define FL_IMMUNE_WATER (1<<17)
#define FL_IMMUNE_SLIME (1<<18)
#define FL_IMMUNE_SLIME (1<<18)
#define FL_IMMUNE_LAVA (1<<19)
#define FL_PROXY (1<<20) // This is a spectator proxy
@ -49,62 +66,69 @@
#define FL_MONSTERCLIP (1<<23) // Only collide in with monsters who have FL_MONSTERCLIP set
#define FL_ONTRAIN (1<<24) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
#define FL_WORLDBRUSH (1<<25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)
#define FL_SPECTATOR (1<<26) // This client is a spectator, don't run touch functions, etc.
#define FL_SPECTATOR (1<<26) // This client is a spectator, don't run touch functions, etc.
#define FL_CUSTOMENTITY (1<<29) // This is a custom entity
#define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
#define FL_DORMANT (1<<31) // Entity is dormant, no updates to client
// SV_EmitSound2 flags
#define SND_EMIT2_NOPAS (1<<0) // never to do check PAS
#define SND_EMIT2_INVOKER (1<<1) // do not send to the client invoker
// Engine edict->spawnflags
#define SF_NOTINDEATHMATCH 0x0800 // Do not spawn when deathmatch and loading entities from a file
// Goes into globalvars_t.trace_flags
#define FTRACE_SIMPLEBOX (1<<0) // Traceline with a simple box
// walkmove modes
#define WALKMOVE_NORMAL 0 // normal walkmove
#define WALKMOVE_WORLDONLY 1 // doesn't hit ANY entities, no matter what the solid type
#define WALKMOVE_CHECKONLY 2 // move, but don't touch triggers
#define WALKMOVE_NORMAL 0 // normal walkmove
#define WALKMOVE_WORLDONLY 1 // doesn't hit ANY entities, no matter what the solid type
#define WALKMOVE_CHECKONLY 2 // move, but don't touch triggers
// edict->movetype values
#define MOVETYPE_NONE 0 // never moves
//#define MOVETYPE_ANGLENOCLIP 1
//#define MOVETYPE_ANGLECLIP 2
#define MOVETYPE_WALK 3 // Player only - moving on the ground
#define MOVETYPE_STEP 4 // gravity, special edge handling -- monsters use this
#define MOVETYPE_FLY 5 // No gravity, but still collides with stuff
#define MOVETYPE_TOSS 6 // gravity/collisions
#define MOVETYPE_PUSH 7 // no clip to world, push and crush
#define MOVETYPE_NOCLIP 8 // No gravity, no collisions, still do velocity/avelocity
#define MOVETYPE_FLYMISSILE 9 // extra size to monsters
#define MOVETYPE_BOUNCE 10 // Just like Toss, but reflect velocity when contacting surfaces
#define MOVETYPE_NONE 0 // never moves
//#define MOVETYPE_ANGLENOCLIP 1
//#define MOVETYPE_ANGLECLIP 2
#define MOVETYPE_WALK 3 // Player only - moving on the ground
#define MOVETYPE_STEP 4 // gravity, special edge handling -- monsters use this
#define MOVETYPE_FLY 5 // No gravity, but still collides with stuff
#define MOVETYPE_TOSS 6 // gravity/collisions
#define MOVETYPE_PUSH 7 // no clip to world, push and crush
#define MOVETYPE_NOCLIP 8 // No gravity, no collisions, still do velocity/avelocity
#define MOVETYPE_FLYMISSILE 9 // extra size to monsters
#define MOVETYPE_BOUNCE 10 // Just like Toss, but reflect velocity when contacting surfaces
#define MOVETYPE_BOUNCEMISSILE 11 // bounce w/o gravity
#define MOVETYPE_FOLLOW 12 // track movement of aiment
#define MOVETYPE_PUSHSTEP 13 // BSP model that needs physics/world collisions (uses nearest hull for world collision)
#define MOVETYPE_PUSHSTEP 13 // BSP model that needs physics/world collisions (uses nearest hull for world collision)
// edict->solid values
// NOTE: Some movetypes will cause collisions independent of SOLID_NOT/SOLID_TRIGGER when the entity moves
// SOLID only effects OTHER entities colliding with this one when they move - UGH!
#define SOLID_NOT 0 // no interaction with other objects
#define SOLID_TRIGGER 1 // touch on edge, but not blocking
#define SOLID_BBOX 2 // touch on edge, block
#define SOLID_SLIDEBOX 3 // touch on edge, but not an onground
#define SOLID_BSP 4 // bsp clip, touch on edge, block
#define SOLID_NOT 0 // no interaction with other objects
#define SOLID_TRIGGER 1 // touch on edge, but not blocking
#define SOLID_BBOX 2 // touch on edge, block
#define SOLID_SLIDEBOX 3 // touch on edge, but not an onground
#define SOLID_BSP 4 // bsp clip, touch on edge, block
// edict->deadflag values
#define DEAD_NO 0 // alive
#define DEAD_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground
#define DEAD_DEAD 2 // dead. lying still.
#define DEAD_NO 0 // alive
#define DEAD_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground
#define DEAD_DEAD 2 // dead. lying still.
#define DEAD_RESPAWNABLE 3
#define DEAD_DISCARDBODY 4
#define DAMAGE_NO 0
#define DAMAGE_YES 1
#define DAMAGE_AIM 2
#define DAMAGE_NO 0
#define DAMAGE_YES 1
#define DAMAGE_AIM 2
// entity effects
#define EF_BRIGHTFIELD 1 // swirling cloud of particles
#define EF_MUZZLEFLASH 2 // single frame ELIGHT on entity attachment 0
#define EF_BRIGHTLIGHT 4 // DLIGHT centered at entity origin
#define EF_DIMLIGHT 8 // player flashlight
#define EF_BRIGHTFIELD 1 // swirling cloud of particles
#define EF_MUZZLEFLASH 2 // single frame ELIGHT on entity attachment 0
#define EF_BRIGHTLIGHT 4 // DLIGHT centered at entity origin
#define EF_DIMLIGHT 8 // player flashlight
#define EF_INVLIGHT 16 // get lighting from ceiling
#define EF_NOINTERP 32 // don't interpolate the next frame
#define EF_LIGHT 64 // rocket flare glow sprite
@ -120,7 +144,7 @@
//
// temp entity events
//
#define TE_BEAMPOINTS 0 // beam effect between two points
#define TE_BEAMPOINTS 0 // beam effect between two points
// coord coord coord (start position)
// coord coord coord (end position)
// short (sprite index)
@ -133,7 +157,7 @@
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMENTPOINT 1 // beam effect between point and entity
#define TE_BEAMENTPOINT 1 // beam effect between point and entity
// short (start entity)
// coord coord coord (end position)
// short (sprite index)
@ -146,10 +170,10 @@
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_GUNSHOT 2 // particle effect plus ricochet sound
#define TE_GUNSHOT 2 // particle effect plus ricochet sound
// coord coord coord (position)
#define TE_EXPLOSION 3 // additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps
#define TE_EXPLOSION 3 // additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps
// coord coord coord (position)
// short (sprite index)
// byte (scale in 0.1's)
@ -164,20 +188,20 @@
#define TE_EXPLFLAG_NOPARTICLES 8 // do not draw particles
#define TE_TAREXPLOSION 4 // Quake1 "tarbaby" explosion with sound
#define TE_TAREXPLOSION 4 // Quake1 "tarbaby" explosion with sound
// coord coord coord (position)
#define TE_SMOKE 5 // alphablend sprite, move vertically 30 pps
#define TE_SMOKE 5 // alphablend sprite, move vertically 30 pps
// coord coord coord (position)
// short (sprite index)
// byte (scale in 0.1's)
// byte (framerate)
#define TE_TRACER 6 // tracer effect from point to point
#define TE_TRACER 6 // tracer effect from point to point
// coord, coord, coord (start)
// coord, coord, coord (end)
#define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters
#define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters
// coord, coord, coord (start)
// coord, coord, coord (end)
// byte (life in 0.1's)
@ -185,7 +209,7 @@
// byte (amplitude in 0.01's)
// short (sprite model index)
#define TE_BEAMENTS 8
#define TE_BEAMENTS 8
// short (start entity)
// short (end entity)
// short (sprite index)
@ -198,13 +222,13 @@
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_SPARKS 9 // 8 random tracers with gravity, ricochet sprite
#define TE_SPARKS 9 // 8 random tracers with gravity, ricochet sprite
// coord coord coord (position)
#define TE_LAVASPLASH 10 // Quake1 lava splash
#define TE_LAVASPLASH 10 // Quake1 lava splash
// coord coord coord (position)
#define TE_TELEPORT 11 // Quake1 teleport splash
#define TE_TELEPORT 11 // Quake1 teleport splash
// coord coord coord (position)
#define TE_EXPLOSION2 12 // Quake1 colormaped (base palette) particle explosion with sound
@ -371,13 +395,13 @@
// short (sprite index)
// short (flags)
#define TE_BLOODSTREAM 101 // particle spray
#define TE_BLOODSTREAM 101 // particle spray
// coord coord coord (start position)
// coord coord coord (spray vector)
// byte (color)
// byte (speed)
#define TE_SHOWLINE 102 // line of particles every 5 units, dies in 30 seconds
#define TE_SHOWLINE 102 // line of particles every 5 units, dies in 30 seconds
// coord coord coord (start position)
// coord coord coord (end position)
@ -567,45 +591,45 @@
#define MSG_BROADCAST 0 // unreliable to all
#define MSG_ONE 1 // reliable to one (msg_entity)
#define MSG_ALL 2 // reliable to all
#define MSG_INIT 3 // write to the init string
#define MSG_BROADCAST 0 // unreliable to all
#define MSG_ONE 1 // reliable to one (msg_entity)
#define MSG_ALL 2 // reliable to all
#define MSG_INIT 3 // write to the init string
#define MSG_PVS 4 // Ents in PVS of org
#define MSG_PAS 5 // Ents in PAS of org
#define MSG_PVS_R 6 // Reliable to PVS
#define MSG_PAS_R 7 // Reliable to PAS
#define MSG_ONE_UNRELIABLE 8 // Send to one client, but don't put in reliable stream, put in unreliable datagram ( could be dropped )
#define MSG_SPEC 9 // Sends to all spectator proxies
#define MSG_SPEC 9 // Sends to all spectator proxies
// contents of a spot in the world
#define CONTENTS_EMPTY -1
#define CONTENTS_SOLID -2
#define CONTENTS_WATER -3
#define CONTENTS_SLIME -4
#define CONTENTS_LAVA -5
#define CONTENTS_SKY -6
#define CONTENTS_EMPTY -1
#define CONTENTS_SOLID -2
#define CONTENTS_WATER -3
#define CONTENTS_SLIME -4
#define CONTENTS_LAVA -5
#define CONTENTS_SKY -6
/* These additional contents constants are defined in bspfile.h
#define CONTENTS_ORIGIN -7 // removed at csg time
#define CONTENTS_CLIP -8 // changed to contents_solid
#define CONTENTS_CURRENT_0 -9
#define CONTENTS_CURRENT_90 -10
#define CONTENTS_CURRENT_180 -11
#define CONTENTS_CURRENT_270 -12
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_DOWN -14
#define CONTENTS_ORIGIN -7 // removed at csg time
#define CONTENTS_CLIP -8 // changed to contents_solid
#define CONTENTS_CURRENT_0 -9
#define CONTENTS_CURRENT_90 -10
#define CONTENTS_CURRENT_180 -11
#define CONTENTS_CURRENT_270 -12
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_DOWN -14
#define CONTENTS_TRANSLUCENT -15
*/
#define CONTENTS_LADDER -16
#define CONTENTS_LADDER -16
#define CONTENT_FLYFIELD -17
#define CONTENT_GRAVITY_FLYFIELD -18
#define CONTENT_FOG -19
#define CONTENT_FLYFIELD -17
#define CONTENT_GRAVITY_FLYFIELD -18
#define CONTENT_FOG -19
#define CONTENT_EMPTY -1
#define CONTENT_SOLID -2
#define CONTENT_WATER -3
#define CONTENT_WATER -3
#define CONTENT_SLIME -4
#define CONTENT_LAVA -5
#define CONTENT_SKY -6
@ -613,9 +637,9 @@
// channels
#define CHAN_AUTO 0
#define CHAN_WEAPON 1
#define CHAN_VOICE 2
#define CHAN_VOICE 2
#define CHAN_ITEM 3
#define CHAN_BODY 4
#define CHAN_BODY 4
#define CHAN_STREAM 5 // allocate stream channel from the static or dynamic area
#define CHAN_STATIC 6 // allocate channel from the static area
#define CHAN_NETWORKVOICE_BASE 7 // voice data coming across the network
@ -624,12 +648,12 @@
// attenuation values
#define ATTN_NONE 0
#define ATTN_NORM (float)0.8
#define ATTN_NORM (float)0.8
#define ATTN_IDLE (float)2
#define ATTN_STATIC (float)1.25
#define ATTN_STATIC (float)1.25
// pitch values
#define PITCH_NORM 100 // non-pitch shifted
#define PITCH_NORM 100 // non-pitch shifted
#define PITCH_LOW 95 // other values are possible - 0-255, where 255 is very high
#define PITCH_HIGH 120
@ -637,10 +661,10 @@
#define VOL_NORM 1.0
// plats
#define PLAT_LOW_TRIGGER 1
#define PLAT_LOW_TRIGGER 1
// Trains
#define SF_TRAIN_WAIT_RETRIGGER 1
#define SF_TRAIN_WAIT_RETRIGGER 1
#define SF_TRAIN_START_ON 4 // Train is initially moving
#define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains
@ -665,12 +689,12 @@
// Colliding temp entity sounds
#define BOUNCE_GLASS BREAK_GLASS
#define BOUNCE_METAL BREAK_METAL
#define BOUNCE_METAL BREAK_METAL
#define BOUNCE_FLESH BREAK_FLESH
#define BOUNCE_WOOD BREAK_WOOD
#define BOUNCE_SHRAP 0x10
#define BOUNCE_SHELL 0x20
#define BOUNCE_CONCRETE BREAK_CONCRETE
#define BOUNCE_CONCRETE BREAK_CONCRETE
#define BOUNCE_SHOTSHELL 0x80
// Temp entity bounce sound types
@ -712,7 +736,7 @@ enum
kRenderFxExplode, // Scale up really big!
kRenderFxGlowShell, // Glowing Shell
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
kRenderFxLightMultiplier, //CTM !!!CZERO added to tell the studiorender that the value in iuser2 is a lightmultiplier
kRenderFxLightMultiplier, //CTM !!!CZERO added to tell the studiorender that the value in iuser2 is a lightmultiplier
};
@ -769,15 +793,14 @@ typedef struct
typedef struct
{
qboolean allsolid; // if true, plane is not valid
qboolean startsolid; // if true, the initial point was in a solid area
qboolean allsolid; // if true, plane is not valid
qboolean startsolid; // if true, the initial point was in a solid area
qboolean inopen, inwater;
float fraction; // time completed, 1.0 = didn't hit anything
vec3_t endpos; // final position
plane_t plane; // surface normal at impact
edict_t *ent; // entity the surface is on
int hitgroup; // 0 == generic, non zero is specific body part
float fraction; // time completed, 1.0 = didn't hit anything
vec3_t endpos; // final position
plane_t plane; // surface normal at impact
edict_t * ent; // entity the surface is on
int hitgroup; // 0 == generic, non zero is specific body part
} trace_t;
#endif
#endif // CONST_H

View File

@ -0,0 +1,55 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
/* crc.h */
#pragma once
#include "quakedef.h"
// MD5 Hash
typedef struct
{
unsigned int buf[4];
unsigned int bits[2];
unsigned char in[64];
} MD5Context_t;
typedef unsigned int CRC32_t;
#ifdef __cplusplus
extern "C"
{
#endif
void CRC32_Init(CRC32_t *pulCRC);
CRC32_t CRC32_Final(CRC32_t pulCRC);
void CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch);
void CRC32_ProcessBuffer(CRC32_t *pulCRC, void *pBuffer, int nBuffer);
BOOL CRC_File(CRC32_t *crcvalue, char *pszFileName);
#ifdef __cplusplus
}
#endif
byte COM_BlockSequenceCRCByte(byte *base, int length, int sequence);
int CRC_MapFile(CRC32_t *crcvalue, char *pszFileName);
void MD5Init(MD5Context_t *ctx);
void MD5Update(MD5Context_t *ctx, const unsigned char *buf, unsigned int len);
void MD5Final(unsigned char digest[16], MD5Context_t *ctx);
void MD5Transform(unsigned int buf[4], const unsigned int in[16]);
BOOL MD5_Hash_File(unsigned char digest[16], char *pszFileName, BOOL bUsefopen, BOOL bSeed, unsigned int seed[4]);
char *MD5_Print(unsigned char hash[16]);

View File

@ -0,0 +1,39 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef CVARDEF_H
#define CVARDEF_H
#define FCVAR_ARCHIVE (1<<0) // set to cause it to be saved to vars.rc
#define FCVAR_USERINFO (1<<1) // changes the client's info string
#define FCVAR_SERVER (1<<2) // notifies players when changed
#define FCVAR_EXTDLL (1<<3) // defined by external DLL
#define FCVAR_CLIENTDLL (1<<4) // defined by the client dll
#define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value
#define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server.
#define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
#define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log
#define FCVAR_NOEXTRAWHITEPACE (1<<9) // strip trailing/leading white space from this cvar
typedef struct cvar_s
{
const char *name;
char *string;
int flags;
float value;
struct cvar_s *next;
} cvar_t;
#endif // CVARDEF_H

View File

@ -15,9 +15,7 @@
#if !defined ( DEMO_APIH )
#define DEMO_APIH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef struct demo_api_s

View File

@ -15,9 +15,7 @@
#if !defined ( DLIGHTH )
#define DLIGHTH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef struct dlight_s

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -17,7 +17,7 @@
#define DLL_NORMAL 0 // User hit Esc or something.
#define DLL_QUIT 4 // Quit now
#define DLL_RESTART 6 // Switch to launcher for linux, does a quit but returns 1
#define DLL_RESTART 5 // Switch to launcher for linux, does a quit but returns 1
// DLL Substate info ( not relevant )
#define ENG_NORMAL (1<<0)

View File

@ -12,14 +12,16 @@
* without written permission from Valve LLC.
*
****/
#if !defined( ENTITY_STATEH )
#define ENTITY_STATEH
#ifndef ENTITY_STATE_H
#define ENTITY_STATE_H
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
#include "const.h"
// For entityType below
#define ENTITY_NORMAL (1<<0)
#define ENTITY_BEAM (1<<1)
@ -33,11 +35,11 @@ struct entity_state_s
// Fields which are filled in by routines outside of delta compression
int entityType;
// Index into cl_entities array for this entity.
int number;
int number;
float msg_time;
// Message number last time the player/entity state was updated.
int messagenum;
int messagenum;
// Fields which can be transitted and reconstructed over the network stream
vec3_t origin;
@ -69,7 +71,7 @@ struct entity_state_s
vec3_t velocity;
// Send bbox down to client for use during prediction.
vec3_t mins;
vec3_t mins;
vec3_t maxs;
int aiment;
@ -77,37 +79,37 @@ struct entity_state_s
int owner;
// Friction, for prediction.
float friction;
float friction;
// Gravity multiplier
float gravity;
float gravity;
// PLAYER SPECIFIC
int team;
int playerclass;
int health;
qboolean spectator;
int weaponmodel;
qboolean spectator;
int weaponmodel;
int gaitsequence;
// If standing on conveyor, e.g.
vec3_t basevelocity;
vec3_t basevelocity;
// Use the crouched hull, or the regular player hull.
int usehull;
int usehull;
// Latched buttons last time state updated.
int oldbuttons;
int oldbuttons;
// -1 = in air, else pmove entity number
int onground;
int onground;
int iStepLeft;
// How fast we are falling
float flFallVelocity;
float flFallVelocity;
float fov;
int weaponanim;
// Parametric movement overrides
vec3_t startpos;
vec3_t endpos;
float impacttime;
float starttime;
vec3_t startpos;
vec3_t endpos;
float impacttime;
float starttime;
// For mods
int iuser1;
@ -187,9 +189,9 @@ typedef struct clientdata_s
typedef struct local_state_s
{
entity_state_t playerstate;
clientdata_t client;
weapon_data_t weapondata[ 32 ];
entity_state_t playerstate;
clientdata_t client;
weapon_data_t weapondata[ 64 ];
} local_state_t;
#endif // !ENTITY_STATEH
#endif // ENTITY_STATE_H

View File

@ -17,11 +17,11 @@
#define ENUMS_H
typedef enum netsrc_s
{
NS_CLIENT,
NS_SERVER,
NS_MULTICAST // xxxMO
} netsrc_t;
{
NS_CLIENT,
NS_SERVER,
NS_MULTICAST // xxxMO
} netsrc_t;
#endif

View File

@ -15,9 +15,7 @@
#if !defined ( EVENT_APIH )
#define EVENT_APIH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
#define EVENT_API_VERSION 1

View File

@ -15,9 +15,7 @@
#if !defined( EVENT_ARGSH )
#define EVENT_ARGSH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
// Event was invoked with stated origin

View File

@ -15,9 +15,7 @@
#if !defined( EVENT_FLAGSH )
#define EVENT_FLAGSH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
// Skip local host for event send.

View File

@ -15,9 +15,7 @@
#ifndef IN_BUTTONS_H
#define IN_BUTTONS_H
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
#define IN_ATTACK (1 << 0)

View File

@ -8,9 +8,7 @@
#ifndef IVOICETWEAK_H
#define IVOICETWEAK_H
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
// These provide access to the voice controls.
@ -28,12 +26,12 @@ typedef struct IVoiceTweak_s
// without sending to the server.
int (*StartVoiceTweakMode)(); // Returns 0 on error.
void (*EndVoiceTweakMode)();
// Get/set control values.
void (*SetControlFloat)(VoiceTweakControl iControl, float value);
float (*GetControlFloat)(VoiceTweakControl iControl);
int (*GetSpeakingVolume)();
int (*GetSpeakingVolume)();
} IVoiceTweak;

View File

@ -0,0 +1,44 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#ifndef KBUTTON_H
#define KBUTTON_H
#ifdef _WIN32
#pragma once
#endif
/* <31b2a> ../common/kbutton.h:7 */
typedef struct kbutton_s
{
int down[2];
int state;
} kbutton_t;
#endif // KBUTTON_H

View File

@ -0,0 +1,127 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#ifdef PLAY_GAMEDLL
// probably gamedll compiled with flag /fpmath:fasted,
// so we need to use type double, otherwise will be the test failed
typedef double float_precision;
#else
typedef float float_precision;
#endif // PLAY_GAMEDLL
typedef float vec_t;
typedef vec_t vec3_t[3];
typedef vec_t vec4_t[4];
typedef int fixed16_t;
typedef union DLONG_u
{
int i[2];
double d;
float f;
} DLONG;
#define M_PI 3.14159265358979323846
#ifdef __cplusplus
#ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif
#ifdef clamp
#undef clamp
#endif
template <typename T>
const T& min(const T& a, const T& b) { return (a < b) ? a : b; }
template <typename T>
const T& max(const T& a, const T& b) { return (a > b) ? a : b; }
template <typename T>
const T& clamp(const T& a, const T& min, const T& max) { return (a > max) ? max : (a < min) ? min : a; }
#else // __cplusplus
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#define clamp(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val)))
#endif // __cplusplus
// bitwise operators templates
template<class T, class type=typename std::underlying_type<T>::type>
inline T operator~ (T a) { return (T)~(type)a; }
template<class T, class type=typename std::underlying_type<T>::type>
inline T operator| (T a, T b) { return (T)((type)a | (type)b); }
template<class T, class type=typename std::underlying_type<T>::type>
inline T operator& (T a, T b) { return (T)((type)a & (type)b); }
template<class T, class type=typename std::underlying_type<T>::type>
inline T operator^ (T a, T b) { return (T)((type)a ^ (type)b); }
template<class T, class type=typename std::underlying_type<T>::type>
inline T& operator|= (T& a, T b) { return (T&)((type&)a |= (type)b); }
template<class T, class type=typename std::underlying_type<T>::type>
inline T& operator&= (T& a, T b) { return (T&)((type&)a &= (type)b); }
template<class T, class type=typename std::underlying_type<T>::type>
inline T& operator^= (T& a, T b) { return (T&)((type&)a ^= (type)b); }
inline double M_sqrt(int value) {
return sqrt(value);
}
inline float M_sqrt(float value) {
return _mm_cvtss_f32(_mm_sqrt_ss(_mm_load_ss(&value)));
}
inline double M_sqrt(double value) {
double ret;
auto v = _mm_load_sd(&value);
_mm_store_sd(&ret, _mm_sqrt_sd(v, v));
return ret;
}
#define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}
#define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}
#define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}
#define VectorClear(a) {(a)[0]=0.0;(a)[1]=0.0;(a)[2]=0.0;}

View File

@ -8,9 +8,7 @@
#if !defined( NET_APIH )
#define NET_APIH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
#if !defined ( NETADRH )

View File

@ -16,9 +16,7 @@
#ifndef NETADR_H
#define NETADR_H
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef enum

View File

@ -16,18 +16,6 @@
// parsemsg.cpp
//
//--------------------------------------------------------------------------------------------------------------
#if defined(_MSC_VER) && _MSC_VER >= 1400
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#pragma warning(disable: 4996) // deprecated functions
#endif
#include "parsemsg.h"
#include <port.h>
@ -148,8 +136,7 @@ float READ_FLOAT( void )
char* READ_STRING( void )
{
static char string[2048];
size_t l;
int c;
int l,c;
string[0] = 0;

View File

@ -15,9 +15,7 @@
#if !defined( PARTICLEDEFH )
#define PARTICLEDEFH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef enum {

View File

@ -15,9 +15,7 @@
#if !defined( PMTRACEH )
#define PMTRACEH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef struct

View File

@ -0,0 +1,119 @@
// port.h: portability helper
//
//////////////////////////////////////////////////////////////////////
#pragma once
#include "archtypes.h" // DAL
#ifdef _WIN32
// Insert your headers here
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define WIN32_EXTRA_LEAN
#include "winsani_in.h"
#include <windows.h>
#include "winsani_out.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#else // _WIN32
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h> // exit()
#include <string.h> // strncpy()
#include <ctype.h> // tolower()
#include <limits.h>
#include <sys/time.h>
#include <errno.h>
#include <sys/ioctl.h>
typedef unsigned char BYTE;
typedef int32 LONG;
//typedef uint32 ULONG;
#ifndef ARCHTYPES_H
typedef uint32 ULONG;
#endif
typedef void *HANDLE;
#ifndef HMODULE
typedef void *HMODULE;
#endif
typedef char * LPSTR;
#define __cdecl
#ifdef __linux__
typedef struct POINT_s
{
int x;
int y;
} POINT;
typedef void *HINSTANCE;
typedef void *HWND;
typedef void *HDC;
typedef void *HGLRC;
typedef struct RECT_s
{
int left;
int right;
int top;
int bottom;
} RECT;
#endif
#ifdef __cplusplus
//#undef FALSE
//#undef TRUE
#ifdef OSX
//#else
//const bool FALSE = false;
//const bool TRUE = true;
#endif
#endif
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
#ifdef __cplusplus
inline int ioctlsocket( int d, int cmd, uint32 *argp ) { return ioctl( d, cmd, argp ); }
inline int closesocket( int fd ) { return close( fd ); }
inline char * GetCurrentDirectory( size_t size, char * buf ) { return getcwd( buf, size ); }
inline int WSAGetLastError() { return errno; }
inline void DebugBreak( void ) { exit( 1 ); }
#endif
extern char g_szEXEName[ 4096 ];
#define _snprintf snprintf
#if defined(OSX)
#define SO_ARCH_SUFFIX ".dylib"
#else
#if defined ( __x86_64__ )
#define SO_ARCH_SUFFIX "_amd64.so"
#else
#define SO_ARCH_SUFFIX ".so"
#endif
#endif
#endif

View File

@ -15,15 +15,13 @@
#if !defined( QFONTH )
#define QFONTH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
// Font stuff
#define NUM_GLYPHS 256
//#include "basetypes.h"
// does not exist: // #include "basetypes.h"
typedef struct
{
@ -37,7 +35,7 @@ typedef struct qfont_s
int rowcount;
int rowheight;
charinfo fontinfo[ NUM_GLYPHS ];
byte data[4];
unsigned char data[4];
} qfont_t;
#endif // qfont.h

View File

@ -0,0 +1,39 @@
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ==========
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef QLIMITS_H
#define QLIMITS_H
#if defined( _WIN32 )
#pragma once
#endif
// DATA STRUCTURE INFO
#define MAX_NUM_ARGVS 50
// SYSTEM INFO
#define MAX_QPATH 64 // max length of a game pathname
#define MAX_OSPATH 260 // max length of a filesystem pathname
#define ON_EPSILON 0.1 // point on plane side epsilon
#define MAX_LIGHTSTYLE_INDEX_BITS 6
#define MAX_LIGHTSTYLES (1<<MAX_LIGHTSTYLE_INDEX_BITS)
// Resource counts;
#define MAX_MODEL_INDEX_BITS 9 // sent as a short
#define MAX_MODELS (1<<MAX_MODEL_INDEX_BITS)
#define MAX_SOUND_INDEX_BITS 9
#define MAX_SOUNDS (1<<MAX_SOUND_INDEX_BITS)
#define MAX_GENERIC_INDEX_BITS 9
#define MAX_GENERIC (1<<MAX_GENERIC_INDEX_BITS)
#define MAX_DECAL_INDEX_BITS 9
#define MAX_BASE_DECALS (1<<MAX_DECAL_INDEX_BITS)
#endif // QLIMITS_H

View File

@ -0,0 +1,44 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
/* <19039> ../common/quakedef.h:29 */
typedef int BOOL; /* size: 4 */
// user message
#define MAX_USER_MSG_DATA 192
/* <627f> ../common/quakedef.h:137 */
//moved to com_model.h
//typedef struct cache_user_s
//{
// void *data;
//} cache_user_t;
/* <4313b> ../common/quakedef.h:162 */
typedef int (*pfnUserMsgHook)(const char *, int, void *);

View File

@ -15,9 +15,7 @@
#if !defined ( R_EFXH )
#define R_EFXH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
// particle_t
@ -118,7 +116,7 @@ typedef struct efx_api_s efx_api_t;
struct efx_api_s
{
particle_t *( *R_AllocParticle ) ( void ( *callback ) ( struct particle_s *particle, float frametime ) );
particle_t *( *R_AllocParticle ) ( void ( *callback ) ( struct particle_s *particle, float frametime ) );
void ( *R_BlobExplosion ) ( float * org );
void ( *R_Blood ) ( float * org, float * dir, int pcolor, int speed );
void ( *R_BloodSprite ) ( float * org, int colorindex, int modelIndex, int modelIndex2, float size );

View File

@ -8,9 +8,7 @@
#if !defined( R_STUDIOINT_H )
#define R_STUDIOINT_H
#if defined( _WIN32 )
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
#define STUDIO_INTERFACE_VERSION 1
@ -137,17 +135,17 @@ extern r_studio_interface_t *pStudioAPI;
typedef struct sv_blending_interface_s
{
int version;
int version;
void ( *SV_StudioSetupBones ) ( struct model_s *pModel,
float frame,
int sequence,
const vec3_t angles,
const vec3_t origin,
const byte *pcontroller,
const byte *pblending,
int iBone,
const edict_t *pEdict );
void ( *SV_StudioSetupBones )( struct model_s *pModel,
float frame,
int sequence,
const vec3_t angles,
const vec3_t origin,
const byte *pcontroller,
const byte *pblending,
int iBone,
const edict_t *pEdict );
} sv_blending_interface_t;
#endif // R_STUDIOINT_H

View File

@ -8,9 +8,7 @@
#if !defined( SCREENFADEH )
#define SCREENFADEH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef struct screenfade_s

View File

@ -15,9 +15,7 @@
#if !defined( STUDIO_EVENTH )
#define STUDIO_EVENTH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef struct mstudioevent_s

View File

@ -15,9 +15,7 @@
#if !defined( TRIANGLEAPIH )
#define TRIANGLEAPIH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef enum

View File

@ -15,9 +15,7 @@
#ifndef USERCMD_H
#define USERCMD_H
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef struct usercmd_s

View File

@ -0,0 +1,35 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
/* <430ee> ../common/vmodes.h:40 */
typedef struct rect_s
{
int left, right, top, bottom;
} wrect_t;

View File

@ -12,12 +12,11 @@
* without written permission from Valve LLC.
*
****/
#if !defined ( WEAPONINFOH )
#define WEAPONINFOH
#ifndef WEAPONINFO_H
#define WEAPONINFO_H
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
// Info about weapons player might have in his/her possession
@ -51,4 +50,4 @@ typedef struct weapon_data_s
float fuser4;
} weapon_data_t;
#endif
#endif // WEAPONINFO_H

View File

@ -0,0 +1,7 @@
#if _MSC_VER >= 1500 // MSVC++ 9.0 (Visual Studio 2008)
#pragma push_macro("ARRAYSIZE")
#ifdef ARRAYSIZE
#undef ARRAYSIZE
#endif
#define HSPRITE WINDOWS_HSPRITE
#endif

View File

@ -0,0 +1,4 @@
#if _MSC_VER >= 1500 // MSVC++ 9.0 (Visual Studio 2008)
#undef HSPRITE
#pragma pop_macro("ARRAYSIZE")
#endif

View File

@ -0,0 +1,145 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
typedef enum Activity_s
{
ACT_INVALID = -1,
ACT_RESET = 0, // Set m_Activity to this invalid value to force a reset to m_IdealActivity
ACT_IDLE,
ACT_GUARD,
ACT_WALK,
ACT_RUN,
ACT_FLY,
ACT_SWIM,
ACT_HOP,
ACT_LEAP,
ACT_FALL,
ACT_LAND,
ACT_STRAFE_LEFT,
ACT_STRAFE_RIGHT,
ACT_ROLL_LEFT,
ACT_ROLL_RIGHT,
ACT_TURN_LEFT,
ACT_TURN_RIGHT,
ACT_CROUCH,
ACT_CROUCHIDLE,
ACT_STAND,
ACT_USE,
ACT_SIGNAL1,
ACT_SIGNAL2,
ACT_SIGNAL3,
ACT_TWITCH,
ACT_COWER,
ACT_SMALL_FLINCH,
ACT_BIG_FLINCH,
ACT_RANGE_ATTACK1,
ACT_RANGE_ATTACK2,
ACT_MELEE_ATTACK1,
ACT_MELEE_ATTACK2,
ACT_RELOAD,
ACT_ARM,
ACT_DISARM,
ACT_EAT,
ACT_DIESIMPLE,
ACT_DIEBACKWARD,
ACT_DIEFORWARD,
ACT_DIEVIOLENT,
ACT_BARNACLE_HIT,
ACT_BARNACLE_PULL,
ACT_BARNACLE_CHOMP,
ACT_BARNACLE_CHEW,
ACT_SLEEP,
ACT_INSPECT_FLOOR,
ACT_INSPECT_WALL,
ACT_IDLE_ANGRY,
ACT_WALK_HURT,
ACT_RUN_HURT,
ACT_HOVER,
ACT_GLIDE,
ACT_FLY_LEFT,
ACT_FLY_RIGHT,
ACT_DETECT_SCENT,
ACT_SNIFF,
ACT_BITE,
ACT_THREAT_DISPLAY,
ACT_FEAR_DISPLAY,
ACT_EXCITED,
ACT_SPECIAL_ATTACK1,
ACT_SPECIAL_ATTACK2,
ACT_COMBAT_IDLE,
ACT_WALK_SCARED,
ACT_RUN_SCARED,
ACT_VICTORY_DANCE,
ACT_DIE_HEADSHOT,
ACT_DIE_CHESTSHOT,
ACT_DIE_GUTSHOT,
ACT_DIE_BACKSHOT,
ACT_FLINCH_HEAD,
ACT_FLINCH_CHEST,
ACT_FLINCH_STOMACH,
ACT_FLINCH_LEFTARM,
ACT_FLINCH_RIGHTARM,
ACT_FLINCH_LEFTLEG,
ACT_FLINCH_RIGHTLEG,
ACT_FLINCH,
ACT_LARGE_FLINCH,
ACT_HOLDBOMB,
ACT_IDLE_FIDGET,
ACT_IDLE_SCARED,
ACT_IDLE_SCARED_FIDGET,
ACT_FOLLOW_IDLE,
ACT_FOLLOW_IDLE_FIDGET,
ACT_FOLLOW_IDLE_SCARED,
ACT_FOLLOW_IDLE_SCARED_FIDGET,
ACT_CROUCH_IDLE,
ACT_CROUCH_IDLE_FIDGET,
ACT_CROUCH_IDLE_SCARED,
ACT_CROUCH_IDLE_SCARED_FIDGET,
ACT_CROUCH_WALK,
ACT_CROUCH_WALK_SCARED,
ACT_CROUCH_DIE,
ACT_WALK_BACK,
ACT_IDLE_SNEAKY,
ACT_IDLE_SNEAKY_FIDGET,
ACT_WALK_SNEAKY,
ACT_WAVE,
ACT_YES,
ACT_NO,
} Activity;
typedef struct
{
int type;
char *name;
} activity_map_t;
extern activity_map_t activity_map[];

View File

@ -0,0 +1,111 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#define _A(a)\
{ a, #a }
activity_map_t activity_map[] =
{
_A(ACT_IDLE),
_A(ACT_GUARD),
_A(ACT_WALK),
_A(ACT_RUN),
_A(ACT_FLY),
_A(ACT_SWIM),
_A(ACT_HOP),
_A(ACT_LEAP),
_A(ACT_FALL),
_A(ACT_LAND),
_A(ACT_STRAFE_LEFT),
_A(ACT_STRAFE_RIGHT),
_A(ACT_ROLL_LEFT),
_A(ACT_ROLL_RIGHT),
_A(ACT_TURN_LEFT),
_A(ACT_TURN_RIGHT),
_A(ACT_CROUCH),
_A(ACT_CROUCHIDLE),
_A(ACT_STAND),
_A(ACT_USE),
_A(ACT_SIGNAL1),
_A(ACT_SIGNAL2),
_A(ACT_SIGNAL3),
_A(ACT_TWITCH),
_A(ACT_COWER),
_A(ACT_SMALL_FLINCH),
_A(ACT_BIG_FLINCH),
_A(ACT_RANGE_ATTACK1),
_A(ACT_RANGE_ATTACK2),
_A(ACT_MELEE_ATTACK1),
_A(ACT_MELEE_ATTACK2),
_A(ACT_RELOAD),
_A(ACT_ARM),
_A(ACT_DISARM),
_A(ACT_EAT),
_A(ACT_DIESIMPLE),
_A(ACT_DIEBACKWARD),
_A(ACT_DIEFORWARD),
_A(ACT_DIEVIOLENT),
_A(ACT_BARNACLE_HIT),
_A(ACT_BARNACLE_PULL),
_A(ACT_BARNACLE_CHOMP),
_A(ACT_BARNACLE_CHEW),
_A(ACT_SLEEP),
_A(ACT_INSPECT_FLOOR),
_A(ACT_INSPECT_WALL),
_A(ACT_IDLE_ANGRY),
_A(ACT_WALK_HURT),
_A(ACT_RUN_HURT),
_A(ACT_HOVER),
_A(ACT_GLIDE),
_A(ACT_FLY_LEFT),
_A(ACT_FLY_RIGHT),
_A(ACT_DETECT_SCENT),
_A(ACT_SNIFF),
_A(ACT_BITE),
_A(ACT_THREAT_DISPLAY),
_A(ACT_FEAR_DISPLAY),
_A(ACT_EXCITED),
_A(ACT_SPECIAL_ATTACK1),
_A(ACT_SPECIAL_ATTACK2),
_A(ACT_COMBAT_IDLE),
_A(ACT_WALK_SCARED),
_A(ACT_RUN_SCARED),
_A(ACT_VICTORY_DANCE),
_A(ACT_DIE_HEADSHOT),
_A(ACT_DIE_CHESTSHOT),
_A(ACT_DIE_GUTSHOT),
_A(ACT_DIE_BACKSHOT),
_A(ACT_FLINCH_HEAD),
_A(ACT_FLINCH_CHEST),
_A(ACT_FLINCH_STOMACH),
_A(ACT_FLINCH_LEFTARM),
_A(ACT_FLINCH_RIGHTARM),
_A(ACT_FLINCH_LEFTLEG),
_A(ACT_FLINCH_RIGHTLEG),
0, NULL
};

View File

@ -0,0 +1,42 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
class CAirtank: public CGrenade {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0;
virtual int BloodColor() = 0;
int GetState() const { return m_state; }
private:
int m_state;
};

View File

@ -0,0 +1,98 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
class C9MMAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class CBuckShotAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class C556NatoAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class C556NatoBoxAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class C762NatoAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class C45ACPAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class C50AEAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class C338MagnumAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class C57MMAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class C357SIGAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};

View File

@ -0,0 +1,105 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#include "activity.h"
class EHANDLE;
enum MONSTERSTATE
{
MONSTERSTATE_NONE = 0,
MONSTERSTATE_IDLE,
MONSTERSTATE_COMBAT,
MONSTERSTATE_ALERT,
MONSTERSTATE_HUNT,
MONSTERSTATE_PRONE,
MONSTERSTATE_SCRIPT,
MONSTERSTATE_PLAYDEAD,
MONSTERSTATE_DEAD
};
class CBaseToggle;
class CBaseMonster: public CBaseToggle {
public:
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual BOOL TakeHealth(float flHealth, int bitsDamageType) = 0;
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0;
virtual int BloodColor() = 0;
virtual BOOL IsAlive() = 0;
virtual float ChangeYaw(int speed) = 0;
virtual BOOL HasHumanGibs() = 0;
virtual BOOL HasAlienGibs() = 0;
virtual void FadeMonster() = 0;
virtual void GibMonster() = 0;
virtual Activity GetDeathActivity() = 0;
virtual void BecomeDead() = 0;
virtual BOOL ShouldFadeOnDeath() = 0;
virtual int IRelationship(CBaseEntity *pTarget) = 0;
virtual void PainSound() = 0;
virtual void ResetMaxSpeed() = 0;
virtual void ReportAIState() = 0;
virtual void MonsterInitDead() = 0;
virtual void Look(int iDistance) = 0;
virtual CBaseEntity *BestVisibleEnemy() = 0;
virtual BOOL FInViewCone(CBaseEntity *pEntity) = 0;
virtual BOOL FInViewCone(const Vector *pOrigin) = 0;
public:
void SetConditions(int iConditions) { m_afConditions |= iConditions; }
void ClearConditions(int iConditions) { m_afConditions &= ~iConditions; }
BOOL HasConditions(int iConditions) { return (m_afConditions & iConditions) ? TRUE : FALSE; }
BOOL HasAllConditions(int iConditions) { return ((m_afConditions & iConditions) == iConditions) ? TRUE : FALSE; }
void Remember(int iMemory) { m_afMemory |= iMemory; }
void Forget(int iMemory) { m_afMemory &= ~iMemory; }
BOOL HasMemory(int iMemory) { return (m_afMemory & iMemory) ? TRUE : FALSE; }
BOOL HasAllMemories(int iMemory) { return ((m_afMemory & iMemory) == iMemory) ? TRUE : FALSE; }
void StopAnimation() { pev->framerate = 0.0f; }
public:
Activity m_Activity; // what the monster is doing (animation)
Activity m_IdealActivity; // monster should switch to this activity
int m_LastHitGroup; // the last body region that took damage
int m_bitsDamageType; // what types of damage has monster (player) taken
byte m_rgbTimeBasedDamage[8];
MONSTERSTATE m_MonsterState; // monster's current state
MONSTERSTATE m_IdealMonsterState; // monster should change to this state
int m_afConditions;
int m_afMemory;
float m_flNextAttack; // cannot attack again until this time
EHANDLE m_hEnemy; // the entity that the monster is fighting.
EHANDLE m_hTargetEnt; // the entity that the monster is trying to reach
float m_flFieldOfView; // width of monster's field of view ( dot product )
int m_bloodColor; // color of blood particless
Vector m_HackedGunPos; // HACK until we can query end of gun
Vector m_vecEnemyLKP; // last known position of enemy. (enemy's origin)
};

View File

@ -0,0 +1,131 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#define SF_PENDULUM_SWING 2 // spawnflag that makes a pendulum a rope swing.
#define SF_BRUSH_ACCDCC 16 // brush should accelerate and decelerate when toggled
#define SF_BRUSH_HURT 32 // rotating brush that inflicts pain based on rotation speed
#define SF_ROTATING_NOT_SOLID 64 // some special rotating objects are not solid.
#define SF_WALL_START_OFF 0x0001
#define SF_CONVEYOR_VISUAL 0x0001
#define SF_CONVEYOR_NOTSOLID 0x0002
#define SF_WORLD_DARK 0x0001 // Fade from black at startup
#define SF_WORLD_TITLE 0x0002 // Display game title at startup
#define SF_WORLD_FORCETEAM 0x0004 // Force teams
#define FANPITCHMIN 30
#define FANPITCHMAX 100
// This is just a solid wall if not inhibited
class CFuncWall: public CBaseEntity {
public:
virtual void Spawn() = 0;
// Bmodels don't go across transitions
virtual int ObjectCaps() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};
class CFuncWallToggle: public CFuncWall {
public:
virtual void Spawn() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};
class CFuncConveyor: public CFuncWall {
public:
virtual void Spawn() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};
// A simple entity that looks solid but lets you walk through it.
class CFuncIllusionary: public CBaseToggle {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int ObjectCaps() = 0;
};
// Monster only clip brush
//
// This brush will be solid for any entity who has the FL_MONSTERCLIP flag set
// in pev->flags
//
// otherwise it will be invisible and not solid. This can be used to keep
// specific monsters out of certain areas
class CFuncMonsterClip: public CFuncWall {
public:
virtual void Spawn() = 0;
// Clear out func_wall's use function
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};
class CFuncRotating: public CBaseEntity {
public:
// basic functions
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void Blocked(CBaseEntity *pOther) = 0;
public:
float m_flFanFriction;
float m_flAttenuation;
float m_flVolume;
float m_pitch;
int m_sounds;
};
class CPendulum: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void Touch(CBaseEntity *pOther) = 0;
virtual void Blocked(CBaseEntity *pOther) = 0;
public:
float m_accel; // Acceleration
float m_distance;
float m_time;
float m_damp;
float m_maxSpeed;
float m_dampSpeed;
Vector m_center;
Vector m_start;
};

View File

@ -0,0 +1,641 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#include "bot/cs_gamestate.h"
#include "bot/cs_bot_manager.h"
#include "bot/cs_bot_chatter.h"
#define PRIMARY_WEAPON_BUY_COUNT 13
#define SECONDARY_WEAPON_BUY_COUNT 3
#define FLAG_PROGRESS_DRAW 0x0 // draw status bar progress
#define FLAG_PROGRESS_START 0x1 // init status bar progress
#define FLAG_PROGRESS_HIDE 0x2 // hide status bar progress
#define HI_X 0x01
#define LO_X 0x02
#define HI_Y 0x04
#define LO_Y 0x08
#define HI_Z 0x10
#define LO_Z 0x20
extern int _navAreaCount;
extern int _currentIndex;
extern struct BuyInfo primaryWeaponBuyInfoCT[PRIMARY_WEAPON_BUY_COUNT];
extern struct BuyInfo secondaryWeaponBuyInfoCT[SECONDARY_WEAPON_BUY_COUNT];
extern struct BuyInfo primaryWeaponBuyInfoT[PRIMARY_WEAPON_BUY_COUNT];
extern struct BuyInfo secondaryWeaponBuyInfoT[SECONDARY_WEAPON_BUY_COUNT];
class CCSBot;
class BotChatterInterface;
class BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const = 0;
};
class IdleState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual const char *GetName() const { return "Idle"; }
};
class HuntState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "Hunt"; }
public:
CNavArea *m_huntArea;
};
class AttackState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "Attack"; }
public:
enum DodgeStateType
{
STEADY_ON,
SLIDE_LEFT,
SLIDE_RIGHT,
JUMP,
NUM_ATTACK_STATES
} m_dodgeState;
float m_nextDodgeStateTimestamp;
CountdownTimer m_repathTimer;
float m_scopeTimestamp;
bool m_haveSeenEnemy;
bool m_isEnemyHidden;
float m_reacquireTimestamp;
float m_shieldToggleTimestamp;
bool m_shieldForceOpen;
float m_pinnedDownTimestamp;
bool m_crouchAndHold;
bool m_didAmbushCheck;
bool m_dodge;
bool m_firstDodge;
bool m_isCoward;
CountdownTimer m_retreatTimer;
};
class InvestigateNoiseState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "InvestigateNoise"; }
private:
void AttendCurrentNoise(CCSBot *me);
Vector m_checkNoisePosition;
};
class BuyState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "Buy"; }
public:
bool m_isInitialDelay;
int m_prefRetries;
int m_prefIndex;
int m_retries;
bool m_doneBuying;
bool m_buyDefuseKit;
bool m_buyGrenade;
bool m_buyShield;
bool m_buyPistol;
};
class MoveToState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "MoveTo"; }
void SetGoalPosition(const Vector &pos) { m_goalPosition = pos; }
void SetRouteType(RouteType route) { m_routeType = route; }
private:
Vector m_goalPosition;
RouteType m_routeType;
bool m_radioedPlan;
bool m_askedForCover;
};
class FetchBombState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual const char *GetName() const { return "FetchBomb"; }
};
class PlantBombState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "PlantBomb"; }
};
class DefuseBombState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "DefuseBomb"; }
};
class HideState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "Hide"; }
public:
void SetHidingSpot(const Vector &pos) { m_hidingSpot = pos; }
const Vector &GetHidingSpot() const { return m_hidingSpot; }
void SetSearchArea(CNavArea *area) { m_searchFromArea = area; }
void SetSearchRange(float range) { m_range = range; }
void SetDuration(float time) { m_duration = time; }
void SetHoldPosition(bool hold) { m_isHoldingPosition = hold; }
bool IsAtSpot() const { return m_isAtSpot; }
public:
CNavArea *m_searchFromArea;
float m_range;
Vector m_hidingSpot;
bool m_isAtSpot;
float m_duration;
bool m_isHoldingPosition;
float m_holdPositionTime;
bool m_heardEnemy;
float m_firstHeardEnemyTime;
int m_retry;
Vector m_leaderAnchorPos;
};
class EscapeFromBombState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "EscapeFromBomb"; }
};
class FollowState: public BotState
{
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "Follow"; }
void SetLeader(CBaseEntity *leader) { m_leader = leader; }
public:
EHANDLE m_leader;
Vector m_lastLeaderPos;
bool m_isStopped;
float m_stoppedTimestamp;
enum LeaderMotionStateType
{
INVALID,
STOPPED,
WALKING,
RUNNING
} m_leaderMotionState;
IntervalTimer m_leaderMotionStateTime;
bool m_isSneaking;
float m_lastSawLeaderTime;
CountdownTimer m_repathInterval;
IntervalTimer m_walkTime;
bool m_isAtWalkSpeed;
float m_waitTime;
CountdownTimer m_idleTimer;
};
class UseEntityState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "UseEntity"; }
void SetEntity(CBaseEntity *entity) { m_entity = entity; }
private:
EHANDLE m_entity;
};
// The Counter-strike Bot
class CCSBot: public CBot {
public:
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; // invoked when injured by something (EXTEND) - returns the amount of damage inflicted
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0; // invoked when killed (EXTEND)
virtual void RoundRespawn() = 0;
virtual void Blind(float duration, float holdTime, float fadeTime, int alpha = 255) = 0; // player blinded by a flashbang
virtual void OnTouchingWeapon(CWeaponBox *box) = 0; // invoked when in contact with a CWeaponBox
virtual bool Initialize(const BotProfile *profile) = 0; // (EXTEND) prepare bot for action
virtual void SpawnBot() = 0; // (EXTEND) spawn the bot into the game
virtual void Upkeep() = 0; // lightweight maintenance, invoked frequently
virtual void Update() = 0; // heavyweight algorithms, invoked less often
virtual void Walk() = 0;
virtual bool Jump(bool mustJump = false) = 0; // returns true if jump was started
virtual void OnEvent(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL) = 0; // invoked when event occurs in the game (some events have NULL entity)
#define CHECK_FOV true
virtual bool IsVisible(const Vector *pos, bool testFOV = false) const = 0; // return true if we can see the point
virtual bool IsVisible(CBasePlayer *player, bool testFOV = false, unsigned char *visParts = NULL) const = 0; // return true if we can see any part of the player
virtual bool IsEnemyPartVisible(VisiblePartType part) const = 0; // if enemy is visible, return the part we see for our current enemy
public:
const Vector &GetEyePosition() const
{
m_eyePos = pev->origin + pev->view_ofs;
return m_eyePos;
}
public:
friend class CCSBotManager;
// TODO: Get rid of these
friend class AttackState;
friend class BuyState;
char m_name[64]; // copied from STRING(pev->netname) for debugging
// behavior properties
float m_combatRange; // desired distance between us and them during gunplay
mutable bool m_isRogue; // if true, the bot is a "rogue" and listens to no-one
mutable CountdownTimer m_rogueTimer;
enum MoraleType
{
TERRIBLE = -3,
BAD = -2,
NEGATIVE = -1,
NEUTRAL = 0,
POSITIVE = 1,
GOOD = 2,
EXCELLENT = 3,
};
MoraleType m_morale; // our current morale, based on our win/loss history
bool m_diedLastRound; // true if we died last round
float m_safeTime; // duration at the beginning of the round where we feel "safe"
bool m_wasSafe; // true if we were in the safe time last update
NavRelativeDirType m_blindMoveDir; // which way to move when we're blind
bool m_blindFire; // if true, fire weapon while blinded
// TODO: implement through CountdownTimer
float m_surpriseDelay; // when we were surprised
float m_surpriseTimestamp;
bool m_isFollowing; // true if we are following someone
EHANDLE m_leader; // the ID of who we are following
float m_followTimestamp; // when we started following
float m_allowAutoFollowTime; // time when we can auto follow
CountdownTimer m_hurryTimer; // if valid, bot is in a hurry
// instances of each possible behavior state, to avoid dynamic memory allocation during runtime
IdleState m_idleState;
HuntState m_huntState;
AttackState m_attackState;
InvestigateNoiseState m_investigateNoiseState;
BuyState m_buyState;
MoveToState m_moveToState;
FetchBombState m_fetchBombState;
PlantBombState m_plantBombState;
DefuseBombState m_defuseBombState;
HideState m_hideState;
EscapeFromBombState m_escapeFromBombState;
FollowState m_followState;
UseEntityState m_useEntityState;
// TODO: Allow multiple simultaneous state machines (look around, etc)
BotState *m_state; // current behavior state
float m_stateTimestamp; // time state was entered
bool m_isAttacking; // if true, special Attack state is overriding the state machine
// high-level tasks
enum TaskType
{
SEEK_AND_DESTROY,
PLANT_BOMB,
FIND_TICKING_BOMB,
DEFUSE_BOMB,
GUARD_TICKING_BOMB,
GUARD_BOMB_DEFUSER,
GUARD_LOOSE_BOMB,
GUARD_BOMB_ZONE,
ESCAPE_FROM_BOMB,
HOLD_POSITION,
FOLLOW,
VIP_ESCAPE,
GUARD_VIP_ESCAPE_ZONE,
COLLECT_HOSTAGES,
RESCUE_HOSTAGES,
GUARD_HOSTAGES,
GUARD_HOSTAGE_RESCUE_ZONE,
MOVE_TO_LAST_KNOWN_ENEMY_POSITION,
MOVE_TO_SNIPER_SPOT,
SNIPING,
NUM_TASKS
};
TaskType m_task; // our current task
EHANDLE m_taskEntity; // an entity used for our task
// navigation
Vector m_goalPosition;
EHANDLE m_goalEntity;
CNavArea *m_currentArea; // the nav area we are standing on
CNavArea *m_lastKnownArea; // the last area we were in
EHANDLE m_avoid; // higher priority player we need to make way for
float m_avoidTimestamp;
bool m_isJumpCrouching;
bool m_isJumpCrouched;
float m_jumpCrouchTimestamp;
// path navigation data
enum { _MAX_PATH_LENGTH = 256 };
struct ConnectInfo
{
CNavArea *area; // the area along the path
NavTraverseType how; // how to enter this area from the previous one
Vector pos; // our movement goal position at this point in the path
const CNavLadder *ladder; // if "how" refers to a ladder, this is it
}
m_path[_MAX_PATH_LENGTH];
int m_pathLength;
int m_pathIndex;
float m_areaEnteredTimestamp;
CountdownTimer m_repathTimer; // must have elapsed before bot can pathfind again
mutable CountdownTimer m_avoidFriendTimer; // used to throttle how often we check for friends in our path
mutable bool m_isFriendInTheWay; // true if a friend is blocking our path
CountdownTimer m_politeTimer; // we'll wait for friend to move until this runs out
bool m_isWaitingBehindFriend; // true if we are waiting for a friend to move
enum LadderNavState
{
APPROACH_ASCENDING_LADDER, // prepare to scale a ladder
APPROACH_DESCENDING_LADDER, // prepare to go down ladder
FACE_ASCENDING_LADDER,
FACE_DESCENDING_LADDER,
MOUNT_ASCENDING_LADDER, // move toward ladder until "on" it
MOUNT_DESCENDING_LADDER, // move toward ladder until "on" it
ASCEND_LADDER, // go up the ladder
DESCEND_LADDER, // go down the ladder
DISMOUNT_ASCENDING_LADDER, // get off of the ladder
DISMOUNT_DESCENDING_LADDER, // get off of the ladder
MOVE_TO_DESTINATION, // dismount ladder and move to destination area
}
m_pathLadderState;
bool m_pathLadderFaceIn; // if true, face towards ladder, otherwise face away
const CNavLadder *m_pathLadder; // the ladder we need to use to reach the next area
NavRelativeDirType m_pathLadderDismountDir; // which way to dismount
float m_pathLadderDismountTimestamp; // time when dismount started
float m_pathLadderEnd; // if ascending, z of top, if descending z of bottom
float m_pathLadderTimestamp; // time when we started using ladder - for timeout check
CountdownTimer m_mustRunTimer; // if nonzero, bot cannot walk
// game scenario mechanisms
CSGameState m_gameState;
// hostages mechanism
byte m_hostageEscortCount;
float m_hostageEscortCountTimestamp;
bool m_isWaitingForHostage;
CountdownTimer m_inhibitWaitingForHostageTimer;
CountdownTimer m_waitForHostageTimer;
// listening mechanism
Vector m_noisePosition; // position we last heard non-friendly noise
float m_noiseTimestamp; // when we heard it (can get zeroed)
CNavArea *m_noiseArea; // the nav area containing the noise
float m_noiseCheckTimestamp;
PriorityType m_noisePriority; // priority of currently heard noise
bool m_isNoiseTravelRangeChecked;
// "looking around" mechanism
float m_lookAroundStateTimestamp; // time of next state change
float m_lookAheadAngle; // our desired forward look angle
float m_forwardAngle; // our current forward facing direction
float m_inhibitLookAroundTimestamp; // time when we can look around again
enum LookAtSpotState
{
NOT_LOOKING_AT_SPOT, // not currently looking at a point in space
LOOK_TOWARDS_SPOT, // in the process of aiming at m_lookAtSpot
LOOK_AT_SPOT, // looking at m_lookAtSpot
NUM_LOOK_AT_SPOT_STATES
}
m_lookAtSpotState;
Vector m_lookAtSpot; // the spot we're currently looking at
PriorityType m_lookAtSpotPriority;
float m_lookAtSpotDuration; // how long we need to look at the spot
float m_lookAtSpotTimestamp; // when we actually began looking at the spot
float m_lookAtSpotAngleTolerance; // how exactly we must look at the spot
bool m_lookAtSpotClearIfClose; // if true, the look at spot is cleared if it gets close to us
const char *m_lookAtDesc; // for debugging
float m_peripheralTimestamp;
enum { MAX_APPROACH_POINTS = 16 };
Vector m_approachPoint[MAX_APPROACH_POINTS];
unsigned char m_approachPointCount;
Vector m_approachPointViewPosition; // the position used when computing current approachPoint set
bool m_isWaitingToTossGrenade; // lining up throw
CountdownTimer m_tossGrenadeTimer; // timeout timer for grenade tossing
SpotEncounter *m_spotEncounter; // the spots we will encounter as we move thru our current area
float m_spotCheckTimestamp; // when to check next encounter spot
// TODO: Add timestamp for each possible client to hiding spots
enum { MAX_CHECKED_SPOTS = 64 };
struct HidingSpotCheckInfo
{
HidingSpot *spot;
float timestamp;
}
m_checkedHidingSpot[MAX_CHECKED_SPOTS];
int m_checkedHidingSpotCount;
// view angle mechanism
float m_lookPitch; // our desired look pitch angle
float m_lookPitchVel;
float m_lookYaw; // our desired look yaw angle
float m_lookYawVel;
// aim angle mechanism
mutable Vector m_eyePos;
Vector m_aimOffset; // current error added to victim's position to get actual aim spot
Vector m_aimOffsetGoal; // desired aim offset
float m_aimOffsetTimestamp; // time of next offset adjustment
float m_aimSpreadTimestamp; // time used to determine max spread as it begins to tighten up
Vector m_aimSpot; // the spot we are currently aiming to fire at
// attack state data
// behavior modifiers
enum DispositionType
{
ENGAGE_AND_INVESTIGATE, // engage enemies on sight and investigate enemy noises
OPPORTUNITY_FIRE, // engage enemies on sight, but only look towards enemy noises, dont investigate
SELF_DEFENSE, // only engage if fired on, or very close to enemy
IGNORE_ENEMIES, // ignore all enemies - useful for ducking around corners, running away, etc
NUM_DISPOSITIONS
};
DispositionType m_disposition; // how we will react to enemies
CountdownTimer m_ignoreEnemiesTimer; // how long will we ignore enemies
mutable EHANDLE m_enemy; // our current enemy
bool m_isEnemyVisible; // result of last visibility test on enemy
unsigned char m_visibleEnemyParts; // which parts of the visible enemy do we see
Vector m_lastEnemyPosition; // last place we saw the enemy
float m_lastSawEnemyTimestamp;
float m_firstSawEnemyTimestamp;
float m_currentEnemyAcquireTimestamp;
float m_enemyDeathTimestamp; // if m_enemy is dead, this is when he died
bool m_isLastEnemyDead; // true if we killed or saw our last enemy die
int m_nearbyEnemyCount; // max number of enemies we've seen recently
unsigned int m_enemyPlace; // the location where we saw most of our enemies
struct WatchInfo
{
float timestamp;
bool isEnemy;
}
m_watchInfo[MAX_CLIENTS];
mutable EHANDLE m_bomber; // points to bomber if we can see him
int m_nearbyFriendCount; // number of nearby teammates
mutable EHANDLE m_closestVisibleFriend; // the closest friend we can see
mutable EHANDLE m_closestVisibleHumanFriend; // the closest human friend we can see
CBasePlayer *m_attacker; // last enemy that hurt us (may not be same as m_enemy)
float m_attackedTimestamp; // when we were hurt by the m_attacker
int m_lastVictimID; // the entindex of the last victim we killed, or zero
bool m_isAimingAtEnemy; // if true, we are trying to aim at our enemy
bool m_isRapidFiring; // if true, RunUpkeep() will toggle our primary attack as fast as it can
IntervalTimer m_equipTimer; // how long have we had our current weapon equipped
float m_fireWeaponTimestamp;
// reaction time system
enum { MAX_ENEMY_QUEUE = 20 };
struct ReactionState
{
// NOTE: player position & orientation is not currently stored separately
EHANDLE player;
bool isReloading;
bool isProtectedByShield;
}
m_enemyQueue[MAX_ENEMY_QUEUE]; // round-robin queue for simulating reaction times
byte m_enemyQueueIndex;
byte m_enemyQueueCount;
byte m_enemyQueueAttendIndex; // index of the timeframe we are "conscious" of
// stuck detection
bool m_isStuck;
float m_stuckTimestamp; // time when we got stuck
Vector m_stuckSpot; // the location where we became stuck
NavRelativeDirType m_wiggleDirection;
float m_wiggleTimestamp;
float m_stuckJumpTimestamp; // time for next jump when stuck
enum { MAX_VEL_SAMPLES = 5 };
float m_avgVel[MAX_VEL_SAMPLES];
int m_avgVelIndex;
int m_avgVelCount;
Vector m_lastOrigin;
// chatter mechanism
GameEventType m_lastRadioCommand; // last radio command we recieved
float m_lastRadioRecievedTimestamp; // time we recieved a radio message
float m_lastRadioSentTimestamp; // time when we send a radio message
EHANDLE m_radioSubject; // who issued the radio message
Vector m_radioPosition; // position referred to in radio message
float m_voiceFeedbackStartTimestamp;
float m_voiceFeedbackEndTimestamp; // new-style "voice" chatter gets voice feedback
BotChatterInterface m_chatter;
// learn map mechanism
const CNavNode *m_navNodeList;
CNavNode *m_currentNode;
NavDirType m_generationDir;
NavAreaList::iterator m_analyzeIter;
enum ProcessType
{
PROCESS_NORMAL,
PROCESS_LEARN,
PROCESS_ANALYZE_ALPHA,
PROCESS_ANALYZE_BETA,
PROCESS_SAVE,
}
m_processMode;
CountdownTimer m_mumbleTimer;
CountdownTimer m_booTimer;
CountdownTimer m_relocateTimer;
};

View File

@ -0,0 +1,337 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#define UNDEFINED_COUNT 0xFFFF
#define MAX_PLACES_PER_MAP 64
#define UNDEFINED_SUBJECT (-1)
#define COUNT_MANY 4 // equal to or greater than this is "many"
class CCSBot;
class BotChatterInterface;
typedef unsigned int PlaceCriteria;
typedef unsigned int CountCriteria;
// A meme is a unit information that bots use to
// transmit information to each other via the radio
class BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const = 0; // cause the given bot to act on this meme
};
class BotAllHostagesGoneMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
};
class BotHostageBeingTakenMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
};
class BotHelpMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
public:
Place m_place;
};
class BotBombsiteStatusMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
public:
enum StatusType { CLEAR, PLANTED };
int m_zoneIndex; // the bombsite
StatusType m_status; // whether it is cleared or the bomb is there (planted)
};
class BotBombStatusMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
public:
CSGameState::BombState m_state;
Vector m_pos;
};
class BotFollowMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
};
class BotDefendHereMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
public:
Vector m_pos;
};
class BotWhereBombMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
};
class BotRequestReportMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
};
enum BotStatementType
{
REPORT_VISIBLE_ENEMIES,
REPORT_ENEMY_ACTION,
REPORT_MY_CURRENT_TASK,
REPORT_MY_INTENTION,
REPORT_CRITICAL_EVENT,
REPORT_REQUEST_HELP,
REPORT_REQUEST_INFORMATION,
REPORT_ROUND_END,
REPORT_MY_PLAN,
REPORT_INFORMATION,
REPORT_EMOTE,
REPORT_ACKNOWLEDGE, // affirmative or negative
REPORT_ENEMIES_REMAINING,
REPORT_FRIENDLY_FIRE,
REPORT_KILLED_FRIEND,
//REPORT_ENEMY_LOST
NUM_BOT_STATEMENT_TYPES,
};
// BotSpeakables are the smallest unit of bot chatter.
// They represent a specific wav file of a phrase, and the criteria for which it is useful
class BotSpeakable {
public:
char *m_phrase;
float m_duration;
PlaceCriteria m_place;
CountCriteria m_count;
};
typedef std::vector<BotSpeakable *> BotSpeakableVector;
typedef std::vector<BotSpeakableVector *> BotVoiceBankVector;
// The BotPhrase class is a collection of Speakables associated with a name, ID, and criteria
class BotPhrase {
public:
const char *GetName() const { return m_name; }
Place GetID() const { return m_id; }
GameEventType GetRadioEquivalent() const { return m_radioEvent; }
bool IsImportant() const { return m_isImportant; } // return true if this phrase is part of an important statement
bool IsPlace() const { return m_isPlace; }
public:
friend class BotPhraseManager;
char *m_name;
Place m_id;
bool m_isPlace; // true if this is a Place phrase
GameEventType m_radioEvent;
bool m_isImportant; // mission-critical statement
mutable BotVoiceBankVector m_voiceBank; // array of voice banks (arrays of speakables)
std::vector<int> m_count; // number of speakables
mutable std::vector< int > m_index; // index of next speakable to return
int m_numVoiceBanks; // number of voice banks that have been initialized
mutable PlaceCriteria m_placeCriteria;
mutable CountCriteria m_countCriteria;
};
typedef std::list<BotPhrase *> BotPhraseList;
// The BotPhraseManager is a singleton that provides an interface to all BotPhrase collections
class BotPhraseManager {
public:
const BotPhraseList *GetPlaceList() const { return &m_placeList; }
// return time last statement of given type was emitted by a teammate for the given place
float GetPlaceStatementInterval(Place place) const;
// set time of last statement of given type was emitted by a teammate for the given place
void ResetPlaceStatementInterval(Place place) const;
public:
int FindPlaceIndex(Place where) const;
// master list of all phrase collections
BotPhraseList m_list;
// master list of all Place phrases
BotPhraseList m_placeList;
struct PlaceTimeInfo
{
Place placeID;
IntervalTimer timer;
};
mutable PlaceTimeInfo m_placeStatementHistory[MAX_PLACES_PER_MAP];
mutable int m_placeCount;
};
inline int BotPhraseManager::FindPlaceIndex(Place where) const
{
for (int i = 0; i < m_placeCount; ++i)
{
if (m_placeStatementHistory[i].placeID == where)
return i;
}
if (m_placeCount < MAX_PLACES_PER_MAP)
{
m_placeStatementHistory[++m_placeCount].placeID = where;
m_placeStatementHistory[++m_placeCount].timer.Invalidate();
return m_placeCount - 1;
}
return -1;
}
inline float BotPhraseManager::GetPlaceStatementInterval(Place place) const
{
int index = FindPlaceIndex(place);
if (index < 0)
return 999999.9f;
if (index >= m_placeCount)
return 999999.9f;
return m_placeStatementHistory[index].timer.GetElapsedTime();
}
inline void BotPhraseManager::ResetPlaceStatementInterval(Place place) const
{
int index = FindPlaceIndex(place);
if (index < 0)
return;
if (index >= m_placeCount)
return;
m_placeStatementHistory[index].timer.Reset();
}
// Statements are meaningful collections of phrases
class BotStatement {
public:
BotChatterInterface *GetChatter() const { return m_chatter; }
BotStatementType GetType() const { return m_type; } // return the type of statement this is
bool HasSubject() const { return (m_subject != UNDEFINED_SUBJECT); }
void SetSubject(int playerID) { m_subject = playerID; } // who this statement is about
int GetSubject() const { return m_subject; } // who this statement is about
void SetPlace(Place where) { m_place = where; } // explicitly set place
void SetStartTime(float timestamp) { m_startTime = timestamp; } // define the earliest time this statement can be spoken
float GetStartTime() const { return m_startTime; }
bool IsSpeaking() const { return m_isSpeaking; } // return true if this statement is currently being spoken
float GetTimestamp() const { return m_timestamp; } // get time statement was created (but not necessarily started talking)
public:
friend class BotChatterInterface;
BotChatterInterface *m_chatter; // the chatter system this statement is part of
BotStatement *m_next, *m_prev; // linked list hooks
BotStatementType m_type; // what kind of statement this is
int m_subject; // who this subject is about
Place m_place; // explicit place - note some phrases have implicit places as well
BotMeme *m_meme; // a statement can only have a single meme for now
float m_timestamp; // time when message was created
float m_startTime; // the earliest time this statement can be spoken
float m_expireTime; // time when this statement is no longer valid
float m_speakTimestamp; // time when message began being spoken
bool m_isSpeaking; // true if this statement is current being spoken
float m_nextTime; // time for next phrase to begin
enum { MAX_BOT_PHRASES = 4 };
enum ContextType
{
CURRENT_ENEMY_COUNT,
REMAINING_ENEMY_COUNT,
SHORT_DELAY,
LONG_DELAY,
ACCUMULATE_ENEMIES_DELAY,
};
struct
{
bool isPhrase;
union
{
const BotPhrase *phrase;
ContextType context;
};
}
m_statement[MAX_BOT_PHRASES];
enum { MAX_BOT_CONDITIONS = 4 };
enum ConditionType
{
IS_IN_COMBAT,
RADIO_SILENCE,
ENEMIES_REMAINING,
NUM_CONDITIONS,
};
ConditionType m_condition[MAX_BOT_CONDITIONS]; // conditions that must be true for the statement to be said
int m_conditionCount;
int m_index; // m_index refers to the phrase currently being spoken, or -1 if we havent started yet
int m_count;
};
// This class defines the interface to the bot radio chatter system
class BotChatterInterface {
public:
CCSBot *GetOwner() const { return m_me; }
int GetPitch() const { return m_pitch; }
bool SeesAtLeastOneEnemy() const { return m_seeAtLeastOneEnemy; }
public:
BotStatement *m_statementList; // list of all active/pending messages for this bot
void ReportEnemies(); // track nearby enemy count and generate enemy activity statements
bool ShouldSpeak() const; // return true if we speaking makes sense now
CCSBot *m_me; // the bot this chatter is for
bool m_seeAtLeastOneEnemy;
float m_timeWhenSawFirstEnemy;
bool m_reportedEnemies;
bool m_requestedBombLocation; // true if we already asked where the bomb has been planted
int m_pitch;
IntervalTimer m_needBackupInterval;
IntervalTimer m_spottedBomberInterval;
IntervalTimer m_scaredInterval;
IntervalTimer m_planInterval;
CountdownTimer m_spottedLooseBombTimer;
CountdownTimer m_heardNoiseTimer;
CountdownTimer m_escortingHostageTimer;
};
extern BotPhraseManager *TheBotPhrases;

View File

@ -0,0 +1,145 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
extern CBotManager *TheBots;
// The manager for Counter-Strike specific bots
class CCSBotManager: public CBotManager {
public:
virtual void ClientDisconnect(CBasePlayer *pPlayer) = 0;
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0;
virtual void ServerActivate() = 0;
virtual void ServerDeactivate() = 0;
virtual void ServerCommand(const char *pcmd) = 0;
virtual void AddServerCommand(const char *cmd) = 0;
virtual void AddServerCommands() = 0;
virtual void RestartRound() = 0; // (EXTEND) invoked when a new round begins
virtual void StartFrame() = 0; // (EXTEND) called each frame
virtual void OnEvent(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL) = 0;
virtual unsigned int GetPlayerPriority(CBasePlayer *player) const = 0; // return priority of player (0 = max pri)
virtual bool IsImportantPlayer(CBasePlayer *player) const = 0; // return true if player is important to scenario (VIP, bomb carrier, etc)
public:
// the supported game scenarios
enum GameScenarioType
{
SCENARIO_DEATHMATCH,
SCENARIO_DEFUSE_BOMB,
SCENARIO_RESCUE_HOSTAGES,
SCENARIO_ESCORT_VIP
};
GameScenarioType GetScenario() const { return m_gameScenario; }
// "zones"
// depending on the game mode, these are bomb zones, rescue zones, etc.
enum { MAX_ZONES = 4 }; // max # of zones in a map
enum { MAX_ZONE_NAV_AREAS = 16 }; // max # of nav areas in a zone
struct Zone
{
CBaseEntity *m_entity; // the map entity
CNavArea *m_area[MAX_ZONE_NAV_AREAS]; // nav areas that overlap this zone
int m_areaCount;
Vector m_center;
bool m_isLegacy; // if true, use pev->origin and 256 unit radius as zone
int m_index;
Extent m_extent;
};
const Zone *GetZone(int i) const { return &m_zone[i]; }
int GetZoneCount() const { return m_zoneCount; }
// pick a zone at random and return it
const Zone *GetRandomZone() const
{
if (!m_zoneCount)
return NULL;
return &m_zone[RANDOM_LONG(0, m_zoneCount - 1)];
}
bool IsBombPlanted() const { return m_isBombPlanted; } // returns true if bomb has been planted
float GetBombPlantTimestamp() const { return m_bombPlantTimestamp; } // return time bomb was planted
bool IsTimeToPlantBomb() const { return (gpGlobals->time >= m_earliestBombPlantTimestamp); } // return true if it's ok to try to plant bomb
CBasePlayer *GetBombDefuser() const { return m_bombDefuser; } // return the player currently defusing the bomb, or NULL
CBaseEntity *GetLooseBomb() { return m_looseBomb; } // return the bomb if it is loose on the ground
CNavArea *GetLooseBombArea() const { return m_looseBombArea; } // return area that bomb is in/near
float GetLastSeenEnemyTimestamp() const { return m_lastSeenEnemyTimestamp; } // return the last time anyone has seen an enemy
void SetLastSeenEnemyTimestamp() { m_lastSeenEnemyTimestamp = gpGlobals->time; }
float GetRoundStartTime() const { return m_roundStartTimestamp; }
float GetElapsedRoundTime() const { return gpGlobals->time - m_roundStartTimestamp; } // return the elapsed time since the current round began
bool IsDefenseRushing() const { return m_isDefenseRushing; } // returns true if defense team has "decided" to rush this round
bool IsRoundOver() const { return m_isRoundOver; } // return true if the round has ended
unsigned int GetNavPlace() const { return m_navPlace; }
void SetNavPlace(unsigned int place) { m_navPlace = place; }
public:
GameScenarioType m_gameScenario; // what kind of game are we playing
Zone m_zone[MAX_ZONES];
int m_zoneCount;
bool m_isBombPlanted; // true if bomb has been planted
float m_bombPlantTimestamp; // time bomb was planted
float m_earliestBombPlantTimestamp; // don't allow planting until after this time has elapsed
CBasePlayer *m_bombDefuser; // the player currently defusing a bomb
EHANDLE m_looseBomb; // will be non-NULL if bomb is loose on the ground
CNavArea *m_looseBombArea; // area that bomb is is/near
bool m_isRoundOver; // true if the round has ended
float m_radioMsgTimestamp[24][2];
float m_lastSeenEnemyTimestamp;
float m_roundStartTimestamp; // the time when the current round began
bool m_isDefenseRushing; // whether defensive team is rushing this round or not
unsigned int m_navPlace;
CountdownTimer m_respawnTimer;
bool m_isRespawnStarted;
bool m_canRespawn;
bool m_bServerActive;
};
inline int OtherTeam(int team)
{
return (team == TERRORIST) ? CT : TERRORIST;
}
inline CCSBotManager *TheCSBots()
{
return reinterpret_cast<CCSBotManager *>(TheBots);
}

View File

@ -0,0 +1,90 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
class CCSBot;
// This class represents the game state as known by a particular bot
class CSGameState {
public:
// bomb defuse scenario
enum BombState
{
MOVING, // being carried by a Terrorist
LOOSE, // loose on the ground somewhere
PLANTED, // planted and ticking
DEFUSED, // the bomb has been defused
EXPLODED, // the bomb has exploded
};
bool IsBombMoving() const { return (m_bombState == MOVING); }
bool IsBombLoose() const { return (m_bombState == LOOSE); }
bool IsBombPlanted() const { return (m_bombState == PLANTED); }
bool IsBombDefused() const { return (m_bombState == DEFUSED); }
bool IsBombExploded() const { return (m_bombState == EXPLODED); }
public:
CCSBot *m_owner; // who owns this gamestate
bool m_isRoundOver; // true if round is over, but no yet reset
// bomb defuse scenario
BombState GetBombState() { return m_bombState; }
BombState m_bombState; // what we think the bomb is doing
IntervalTimer m_lastSawBomber;
Vector m_bomberPos;
IntervalTimer m_lastSawLooseBomb;
Vector m_looseBombPos;
bool m_isBombsiteClear[4]; // corresponds to zone indices in CCSBotManager
int m_bombsiteSearchOrder[4]; // randomized order of bombsites to search
int m_bombsiteCount;
int m_bombsiteSearchIndex; // the next step in the search
int m_plantedBombsite; // zone index of the bombsite where the planted bomb is
bool m_isPlantedBombPosKnown; // if true, we know the exact location of the bomb
Vector m_plantedBombPos;
// hostage rescue scenario
struct HostageInfo
{
CHostage *hostage;
Vector knownPos;
bool isValid;
bool isAlive;
bool isFree; // not being escorted by a CT
}
m_hostage[MAX_HOSTAGES];
int m_hostageCount; // number of hostages left in map
CountdownTimer m_validateInterval;
bool m_allHostagesRescued; // if true, so every hostages been is rescued
bool m_haveSomeHostagesBeenTaken; // true if a hostage has been moved by a CT (and we've seen it)
};

View File

@ -0,0 +1,104 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#define SF_BUTTON_DONTMOVE 1
#define SF_ROTBUTTON_NOTSOLID 1
#define SF_BUTTON_TOGGLE 32 // button stays pushed until reactivated
#define SF_BUTTON_SPARK_IF_OFF 64 // button sparks in OFF state
#define SF_BUTTON_TOUCH_ONLY 256 // button only fires as a result of USE key.
#define SF_GLOBAL_SET 1 // Set global state to initial state on spawn
#define SF_MULTI_INIT 1
// Make this button behave like a door (HACKHACK)
// This will disable use and make the button solid
// rotating buttons were made SOLID_NOT by default since their were some
// collision problems with them...
#define SF_MOMENTARY_DOOR 0x0001
#define SF_SPARK_TOOGLE 32
#define SF_SPARK_IF_OFF 64
#define SF_BTARGET_USE 0x0001
#define SF_BTARGET_ON 0x0002
class CEnvGlobal: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
string_t m_globalstate;
int m_triggermode;
int m_initialstate;
};
class CRotButton: public CBaseButton {
public:
virtual void Spawn() = 0;
};
class CMomentaryRotButton: public CBaseToggle {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
int m_lastUsed;
int m_direction;
float m_returnSpeed;
Vector m_start;
Vector m_end;
int m_sounds;
};
class CEnvSpark: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
public:
float m_flDelay;
};
class CButtonTarget: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual int ObjectCaps() = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};

View File

@ -0,0 +1,375 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#include "util.h"
#include "monsterevent.h"
class CSave;
class CRestore;
class CBasePlayer;
class CBaseEntity;
class CBaseMonster;
class CBasePlayerItem;
class CSquadMonster;
class CCSEntity;
class CBaseEntity {
public:
// Constructor. Set engine to use C/C++ callback functions
// pointers to engine data
entvars_t *pev; // Don't need to save/restore this pointer, the engine resets it
// path corners
CBaseEntity *m_pGoalEnt; // path corner we are heading towards
CBaseEntity *m_pLink; // used for temporary link-list operations.
// initialization functions
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void Restart() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void Activate() = 0;
// Setup the object->object collision box (pev->mins / pev->maxs is the object->world collision box)
virtual void SetObjectCollisionBox() = 0;
// Classify - returns the type of group (i.e, "houndeye", or "human military" so that monsters with different classnames
// still realize that they are teammates. (overridden for monsters that form groups)
virtual int Classify() = 0;
virtual void DeathNotice(entvars_t *pevChild) = 0;
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual BOOL TakeHealth(float flHealth, int bitsDamageType) = 0;
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0;
virtual int BloodColor() = 0;
virtual void TraceBleed(float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
virtual BOOL IsTriggered(CBaseEntity *pActivator) = 0;
virtual CBaseMonster *MyMonsterPointer() = 0;
virtual CSquadMonster *MySquadMonsterPointer() = 0;
virtual int GetToggleState() = 0;
virtual void AddPoints(int score, BOOL bAllowNegativeScore) = 0;
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) = 0;
virtual BOOL AddPlayerItem(CBasePlayerItem *pItem) = 0;
virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem) = 0;
virtual int GiveAmmo(int iAmount, char *szName, int iMax) = 0;
virtual float GetDelay() = 0;
virtual int IsMoving() = 0;
virtual void OverrideReset() = 0;
virtual int DamageDecal(int bitsDamageType) = 0;
// This is ONLY used by the node graph to test movement through a door
virtual void SetToggleState(int state) = 0;
virtual void StartSneaking() = 0;
virtual void StopSneaking() = 0;
virtual BOOL OnControls(entvars_t *onpev) = 0;
virtual BOOL IsSneaking() = 0;
virtual BOOL IsAlive() = 0;
virtual BOOL IsBSPModel() = 0;
virtual BOOL ReflectGauss() = 0;
virtual BOOL HasTarget(string_t targetname) = 0;
virtual BOOL IsInWorld() = 0;
virtual BOOL IsPlayer() = 0;
virtual BOOL IsNetClient() = 0;
virtual const char *TeamID() = 0;
virtual CBaseEntity *GetNextTarget() = 0;
// fundamental callbacks
void (CBaseEntity::*m_pfnThink)();
void (CBaseEntity::*m_pfnTouch)(CBaseEntity *pOther);
void (CBaseEntity::*m_pfnUse)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
void (CBaseEntity::*m_pfnBlocked)(CBaseEntity *pOther);
virtual void Think() = 0;
virtual void Touch(CBaseEntity *pOther) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType = USE_OFF, float value = 0.0f) = 0;
virtual void Blocked(CBaseEntity *pOther) = 0;
virtual CBaseEntity *Respawn() = 0;
virtual void UpdateOwner() = 0;
virtual BOOL FBecomeProne() = 0;
virtual Vector Center() = 0; // center point of entity
virtual Vector EyePosition() = 0; // position of eyes
virtual Vector EarPosition() = 0; // position of ears
virtual Vector BodyTarget(const Vector &posSrc) = 0; // position to shoot at
virtual int Illumination() = 0;
virtual BOOL FVisible(CBaseEntity *pEntity) = 0;
virtual BOOL FVisible(const Vector &vecOrigin) = 0;
public:
static CBaseEntity *Instance(edict_t *pent) { return (CBaseEntity *)GET_PRIVATE(pent ? pent : ENT(0)); }
static CBaseEntity *Instance(entvars_t *pev) { return Instance(ENT(pev)); }
static CBaseEntity *Instance(int offset) { return Instance(ENT(offset)); }
edict_t *edict() { return ENT(pev); }
EOFFSET eoffset() { return OFFSET(pev); }
int entindex() { return ENTINDEX(edict()); }
public:
CCSEntity *m_pEntity; // NOTE: it was replaced on member "int *current_ammo" because it is useless.
// We use this variables to store each ammo count.
float currentammo;
int maxammo_buckshot;
int ammo_buckshot;
int maxammo_9mm;
int ammo_9mm;
int maxammo_556nato;
int ammo_556nato;
int maxammo_556natobox;
int ammo_556natobox;
int maxammo_762nato;
int ammo_762nato;
int maxammo_45acp;
int ammo_45acp;
int maxammo_50ae;
int ammo_50ae;
int maxammo_338mag;
int ammo_338mag;
int maxammo_57mm;
int ammo_57mm;
int maxammo_357sig;
int ammo_357sig;
// Special stuff for grenades and knife.
float m_flStartThrow;
float m_flReleaseThrow;
int m_iSwing;
// client has left the game
bool has_disconnected;
};
class CPointEntity: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual int ObjectCaps() = 0;
};
// generic Delay entity
class CBaseDelay: public CBaseEntity {
public:
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
public:
float m_flDelay;
int m_iszKillTarget;
};
class CBaseAnimating: public CBaseDelay {
public:
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void HandleAnimEvent(MonsterEvent_t *pEvent) = 0;
public:
// animation needs
float m_flFrameRate; // computed FPS for current sequence
float m_flGroundSpeed; // computed linear movement rate for current sequence
float m_flLastEventCheck; // last time the event list was checked
BOOL m_fSequenceFinished; // flag set when StudioAdvanceFrame moves across a frame boundry
BOOL m_fSequenceLoops; // true if the sequence loops
};
// EHANDLE. Safe way to point to CBaseEntities who may die between frames
class EHANDLE {
public:
edict_t *Get();
edict_t *Set(edict_t *pent);
operator int();
operator CBaseEntity*();
operator CBasePlayer*();
CBaseEntity *operator=(CBaseEntity *pEntity);
CBaseEntity *operator->();
private:
edict_t *m_pent;
int m_serialnumber;
};
// generic Toggle entity.
class CBaseToggle: public CBaseAnimating {
public:
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int GetToggleState() = 0;
virtual float GetDelay() = 0;
public:
TOGGLE_STATE m_toggle_state;
float m_flActivateFinished; // like attack_finished, but for doors
float m_flMoveDistance; // how far a door should slide or rotate
float m_flWait;
float m_flLip;
float m_flTWidth; // for plats
float m_flTLength; // for plats
Vector m_vecPosition1;
Vector m_vecPosition2;
Vector m_vecAngle1;
Vector m_vecAngle2;
int m_cTriggersLeft; // trigger_counter only, # of activations remaining
float m_flHeight;
EHANDLE m_hActivator;
void (CBaseToggle::*m_pfnCallWhenMoveDone)();
Vector m_vecFinalDest;
Vector m_vecFinalAngle;
int m_bitsDamageInflict; // DMG_ damage type that the door or tigger does
string_t m_sMaster; // If this button has a master switch, this is the targetname.
// A master switch must be of the multisource type. If all
// of the switches in the multisource have been triggered, then
// the button will be allowed to operate. Otherwise, it will be
// deactivated.
};
#include "basemonster.h"
#include "weapons.h"
#include "player.h"
// Generic Button
class CBaseButton: public CBaseToggle {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0; // Buttons that don't take damage can be IMPULSE used
public:
BOOL m_fStayPushed; // button stays pushed in until touched again?
BOOL m_fRotating; // a rotating button? default is a sliding button.
string_t m_strChangeTarget; // if this field is not null, this is an index into the engine string array.
// when this button is touched, it's target entity's TARGET field will be set
// to the button's ChangeTarget. This allows you to make a func_train switch paths, etc.
locksound_t m_ls; // door lock sounds
byte m_bLockedSound; // ordinals from entity selection
byte m_bLockedSentence;
byte m_bUnlockedSound;
byte m_bUnlockedSentence;
int m_sounds;
};
// MultiSouce
#define MAX_MULTI_TARGETS 16 // maximum number of targets a single multi_manager entity may be assigned.
#define MS_MAX_TARGETS 32
class CMultiSource: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual BOOL IsTriggered(CBaseEntity *pActivator) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
EHANDLE m_rgEntities[MS_MAX_TARGETS];
int m_rgTriggered[MS_MAX_TARGETS];
int m_iTotal;
string_t m_globalstate;
};
// This spawns first when each level begins.
class CWorld: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
};
// Inlines
inline edict_t *EHANDLE::Get()
{
if (!m_pent || m_pent->serialnumber != m_serialnumber)
return NULL;
return m_pent;
}
inline edict_t *EHANDLE::Set(edict_t *pent)
{
m_pent = pent;
if (pent)
m_serialnumber = pent->serialnumber;
return pent;
}
inline EHANDLE::operator int()
{
return Get() != NULL;
}
inline EHANDLE::operator CBaseEntity *()
{
return (CBaseEntity *)GET_PRIVATE(Get());
}
inline EHANDLE::operator CBasePlayer *()
{
return static_cast<CBasePlayer *>(GET_PRIVATE(Get()));
}
inline CBaseEntity *EHANDLE::operator=(CBaseEntity *pEntity)
{
if (pEntity != NULL)
{
m_pent = ENT(pEntity->pev);
if (m_pent)
m_serialnumber = m_pent->serialnumber;
}
else
{
m_pent = NULL;
m_serialnumber = 0;
}
return pEntity;
}
inline CBaseEntity *EHANDLE::operator->()
{
return (CBaseEntity *)GET_PRIVATE(Get());
}

View File

@ -0,0 +1,126 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#define MAX_WEAPON_SLOTS 5 // hud item selection slots
#define MAX_ITEM_TYPES 6 // hud item selection slots
#define MAX_ITEMS 4 // hard coded item types
#define DEFAULT_FOV 90 // the default field of view
#define HIDEHUD_WEAPONS (1<<0)
#define HIDEHUD_FLASHLIGHT (1<<1)
#define HIDEHUD_ALL (1<<2)
#define HIDEHUD_HEALTH (1<<3)
#define HIDEHUD_TIMER (1<<4)
#define HIDEHUD_MONEY (1<<5)
#define HIDEHUD_CROSSHAIR (1<<6)
#define STATUSICON_HIDE 0
#define STATUSICON_SHOW 1
#define STATUSICON_FLASH 2
#define HUD_PRINTNOTIFY 1
#define HUD_PRINTCONSOLE 2
#define HUD_PRINTTALK 3
#define HUD_PRINTCENTER 4
#define HUD_PRINTRADIO 5
#define STATUS_NIGHTVISION_ON 1
#define STATUS_NIGHTVISION_OFF 0
#define ITEM_STATUS_NIGHTVISION (1<<0)
#define ITEM_STATUS_DEFUSER (1<<1)
#define SCORE_STATUS_DEAD (1<<0)
#define SCORE_STATUS_BOMB (1<<1)
#define SCORE_STATUS_VIP (1<<2)
#define SIGNAL_BUY (1<<0)
#define SIGNAL_BOMB (1<<1)
#define SIGNAL_RESCUE (1<<2)
#define SIGNAL_ESCAPE (1<<3)
#define SIGNAL_VIPSAFETY (1<<4)
#define DATA_IUSER3_CANSHOOT (1<<0)
#define DATA_IUSER3_FREEZETIMEOVER (1<<1)
#define DATA_IUSER3_INBOMBZONE (1<<2)
#define DATA_IUSER3_HOLDINGSHIELD (1<<3)
#define MENU_KEY_1 (1<<0)
#define MENU_KEY_2 (1<<1)
#define MENU_KEY_3 (1<<2)
#define MENU_KEY_4 (1<<3)
#define MENU_KEY_5 (1<<4)
#define MENU_KEY_6 (1<<5)
#define MENU_KEY_7 (1<<6)
#define MENU_KEY_8 (1<<7)
#define MENU_KEY_9 (1<<8)
#define MENU_KEY_0 (1<<9)
#define MAX_AMMO_TYPES 32 // ???
#define MAX_AMMO_SLOTS 32 // not really slots
#define HUD_PRINTNOTIFY 1
#define HUD_PRINTCONSOLE 2
#define HUD_PRINTTALK 3
#define HUD_PRINTCENTER 4
#define WEAPON_SUIT 31
#define WEAPON_ALLWEAPONS (~(1 << WEAPON_SUIT))
// custom enum
enum VGUIMenu
{
VGUI_Menu_Team = 2,
VGUI_Menu_MapBriefing = 4,
VGUI_Menu_Class_T = 26,
VGUI_Menu_Class_CT,
VGUI_Menu_Buy,
VGUI_Menu_Buy_Pistol,
VGUI_Menu_Buy_ShotGun,
VGUI_Menu_Buy_Rifle,
VGUI_Menu_Buy_SubMachineGun,
VGUI_Menu_Buy_MachineGun,
VGUI_Menu_Buy_Item,
};
// custom enum
enum VGUIMenuSlot
{
VGUI_MenuSlot_Buy_Pistol = 1,
VGUI_MenuSlot_Buy_ShotGun,
VGUI_MenuSlot_Buy_SubMachineGun,
VGUI_MenuSlot_Buy_Rifle,
VGUI_MenuSlot_Buy_MachineGun,
VGUI_MenuSlot_Buy_PrimAmmo,
VGUI_MenuSlot_Buy_SecAmmo,
VGUI_MenuSlot_Buy_Item,
};

View File

@ -0,0 +1,97 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
// custom enum
enum ChooseTeamMenuSlot
{
MENU_SLOT_TEAM_UNDEFINED = -1,
MENU_SLOT_TEAM_TERRORIST = 1,
MENU_SLOT_TEAM_CT,
MENU_SLOT_TEAM_VIP,
MENU_SLOT_TEAM_RANDOM = 5,
MENU_SLOT_TEAM_SPECT
};
// custom enum
enum BuyItemMenuSlot
{
MENU_SLOT_ITEM_VEST = 1,
MENU_SLOT_ITEM_VESTHELM,
MENU_SLOT_ITEM_FLASHGREN,
MENU_SLOT_ITEM_HEGREN,
MENU_SLOT_ITEM_SMOKEGREN,
MENU_SLOT_ITEM_NVG,
MENU_SLOT_ITEM_DEFUSEKIT,
MENU_SLOT_ITEM_SHIELD,
};
#define CS_NUM_SKIN 4
#define CZ_NUM_SKIN 5
#define FIELD_ORIGIN0 0
#define FIELD_ORIGIN1 1
#define FIELD_ORIGIN2 2
#define FIELD_ANGLES0 3
#define FIELD_ANGLES1 4
#define FIELD_ANGLES2 5
#define CUSTOMFIELD_ORIGIN0 0
#define CUSTOMFIELD_ORIGIN1 1
#define CUSTOMFIELD_ORIGIN2 2
#define CUSTOMFIELD_ANGLES0 3
#define CUSTOMFIELD_ANGLES1 4
#define CUSTOMFIELD_ANGLES2 5
#define CUSTOMFIELD_SKIN 6
#define CUSTOMFIELD_SEQUENCE 7
#define CUSTOMFIELD_ANIMTIME 8
typedef struct
{
float m_fTimeEnteredPVS;
} ENTITYPVSSTATUS;
struct PLAYERPVSSTATUS
{
ENTITYPVSSTATUS m_Status[1380];
int headnode;
int num_leafs;
short int leafnums[ MAX_ENT_LEAFS ];
};
struct entity_field_alias_t
{
char name[32];
int field;
};

View File

@ -0,0 +1,50 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#include "../game_shared/GameEvent.h"
#include "../game_shared/bot/bot_util.h"
#include "../game_shared/bot/simple_state_machine.h"
#include "../game_shared/steam_util.h"
#include "../game_shared/perf_counter.h"
#include "../game_shared/bot/bot_manager.h"
#include "../game_shared/bot/bot_constants.h"
#include "../game_shared/bot/bot.h"
#include "../game_shared/shared_util.h"
#include "../game_shared/bot/bot_profile.h"
#include "../game_shared/bot/improv.h"
#include "../game_shared/bot/nav.h"
#include "../game_shared/bot/nav_node.h"
#include "../game_shared/bot/nav_area.h"
#include "../game_shared/bot/nav_path.h"
#include "../dlls/hostage/hostage.h"
#include "../dlls/hostage/hostage_localnav.h"
#include "../dlls/bot/cs_bot.h"

View File

@ -0,0 +1,83 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
enum decal_e
{
DECAL_GUNSHOT1 = 0,
DECAL_GUNSHOT2,
DECAL_GUNSHOT3,
DECAL_GUNSHOT4,
DECAL_GUNSHOT5,
DECAL_LAMBDA1,
DECAL_LAMBDA2,
DECAL_LAMBDA3,
DECAL_LAMBDA4,
DECAL_LAMBDA5,
DECAL_LAMBDA6,
DECAL_SCORCH1,
DECAL_SCORCH2,
DECAL_BLOOD1,
DECAL_BLOOD2,
DECAL_BLOOD3,
DECAL_BLOOD4,
DECAL_BLOOD5,
DECAL_BLOOD6,
DECAL_YBLOOD1,
DECAL_YBLOOD2,
DECAL_YBLOOD3,
DECAL_YBLOOD4,
DECAL_YBLOOD5,
DECAL_YBLOOD6,
DECAL_GLASSBREAK1,
DECAL_GLASSBREAK2,
DECAL_GLASSBREAK3,
DECAL_BIGSHOT1,
DECAL_BIGSHOT2,
DECAL_BIGSHOT3,
DECAL_BIGSHOT4,
DECAL_BIGSHOT5,
DECAL_SPIT1,
DECAL_SPIT2,
DECAL_BPROOF1, // Bulletproof glass decal
DECAL_GARGSTOMP1, // Gargantua stomp crack
DECAL_SMALLSCORCH1, // Small scorch mark
DECAL_SMALLSCORCH2, // Small scorch mark
DECAL_SMALLSCORCH3, // Small scorch mark
DECAL_MOMMABIRTH, // Big momma birth splatter
DECAL_MOMMASPLAT,
};
typedef struct
{
char *name;
int index;
} DLL_DECALLIST;
extern DLL_DECALLIST gDecals[42];

View File

@ -0,0 +1,92 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#define DOOR_SENTENCEWAIT 6
#define DOOR_SOUNDWAIT 3
#define BUTTON_SOUNDWAIT 0.5
#define SF_DOOR_ROTATE_Y 0
#define SF_DOOR_START_OPEN 1
#define SF_DOOR_ROTATE_BACKWARDS 2
#define SF_DOOR_PASSABLE 8
#define SF_DOOR_ONEWAY 16
#define SF_DOOR_NO_AUTO_RETURN 32
#define SF_DOOR_ROTATE_Z 64
#define SF_DOOR_ROTATE_X 128
#define SF_DOOR_USE_ONLY 256 // door must be opened by player's use button.
#define SF_DOOR_NOMONSTERS 512 // Monster can't open
#define SF_DOOR_SILENT 0x80000000
class CBaseDoor: public CBaseToggle {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void Restart() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void SetToggleState(int state) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
virtual void Blocked(CBaseEntity *pOther) = 0;
public:
byte m_bHealthValue; // some doors are medi-kit doors, they give players health
byte m_bMoveSnd; // sound a door makes while moving
byte m_bStopSnd; // sound a door makes when it stops
locksound_t m_ls; // door lock sounds
byte m_bLockedSound; // ordinals from entity selection
byte m_bLockedSentence;
byte m_bUnlockedSound;
byte m_bUnlockedSentence;
float m_lastBlockedTimestamp;
};
class CRotDoor: public CBaseDoor {
public:
virtual void Spawn() = 0;
virtual void Restart() = 0;
virtual void SetToggleState(int state) = 0;
};
class CMomentaryDoor: public CBaseToggle {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
byte m_bMoveSnd; // sound a door makes while moving
};

View File

@ -0,0 +1,407 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#define SF_BEAM_STARTON 0x0001
#define SF_BEAM_TOGGLE 0x0002
#define SF_BEAM_RANDOM 0x0004
#define SF_BEAM_RING 0x0008
#define SF_BEAM_SPARKSTART 0x0010
#define SF_BEAM_SPARKEND 0x0020
#define SF_BEAM_DECALS 0x0040
#define SF_BEAM_SHADEIN 0x0080
#define SF_BEAM_SHADEOUT 0x0100
#define SF_BEAM_TEMPORARY 0x8000
#define SF_GIBSHOOTER_REPEATABLE 1
#define SF_FUNNEL_REVERSE 1
#define SF_BUBBLES_STARTOFF 0x0001
#define SF_BLOOD_RANDOM 0x0001
#define SF_BLOOD_STREAM 0x0002
#define SF_BLOOD_PLAYER 0x0004
#define SF_BLOOD_DECAL 0x0008
#define SF_SHAKE_EVERYONE 0x0001
#define SF_SHAKE_DISRUPT 0x0002
#define SF_SHAKE_INAIR 0x0004
#define SF_FADE_IN 0x0001
#define SF_FADE_MODULATE 0x0002
#define SF_FADE_ONLYONE 0x0004
#define SF_SPRITE_STARTON 0x0001
#define SF_SPRITE_ONCE 0x0002
#define SF_SPRITE_TEMPORARY 0x8000
#define SF_MESSAGE_ONCE 0x0001 // Fade in, not out
#define SF_MESSAGE_ALL 0x0002 // Send to all clients
class CSprite: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void Restart() = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
void SetAttachment(edict_t *pEntity, int attachment)
{
if (pEntity != NULL)
{
pev->skin = ENTINDEX(pEntity);
pev->body = attachment;
pev->aiment = pEntity;
pev->movetype = MOVETYPE_FOLLOW;
}
}
float Frames() const { return m_maxFrame; }
void SetTransparency(int rendermode, int r, int g, int b, int a, int fx)
{
pev->rendermode = rendermode;
pev->rendercolor.x = r;
pev->rendercolor.y = g;
pev->rendercolor.z = b;
pev->renderamt = a;
pev->renderfx = fx;
}
void SetTexture(int spriteIndex) { pev->modelindex = spriteIndex; }
void SetScale(float scale) { pev->scale = scale; }
void SetColor(int r, int g, int b) { pev->rendercolor.x = r; pev->rendercolor.y = g; pev->rendercolor.z = b; }
void SetBrightness(int brightness) { pev->renderamt = brightness; }
void AnimateAndDie(float framerate)
{
SetThink(&CSprite::AnimateUntilDead);
pev->framerate = framerate;
pev->dmgtime = gpGlobals->time + (m_maxFrame / framerate);
pev->nextthink = gpGlobals->time;
}
private:
float m_lastTime;
float m_maxFrame;
};
class CBeam: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual int ObjectCaps() = 0;
virtual Vector Center() = 0;
public:
void SetType(int type) { pev->rendermode = (pev->rendermode & 0xF0) | (type & 0x0F); }
void SetFlags(int flags) { pev->rendermode = (pev->rendermode & 0x0F) | (flags & 0xF0); }
void SetStartPos(const Vector &pos) { pev->origin = pos; }
void SetEndPos(const Vector &pos) { pev->angles = pos; }
void SetStartEntity(int entityIndex);
void SetEndEntity(int entityIndex);
void SetStartAttachment(int attachment) { pev->sequence = (pev->sequence & 0x0FFF) | ((attachment & 0xF) << 12); }
void SetEndAttachment(int attachment) { pev->skin = (pev->skin & 0x0FFF) | ((attachment & 0xF) << 12); }
void SetTexture(int spriteIndex) { pev->modelindex = spriteIndex; }
void SetWidth(int width) { pev->scale = width; }
void SetNoise(int amplitude) { pev->body = amplitude; }
void SetColor(int r, int g, int b) { pev->rendercolor.x = r; pev->rendercolor.y = g; pev->rendercolor.z = b; }
void SetBrightness(int brightness) { pev->renderamt = brightness; }
void SetFrame(float frame) { pev->frame = frame; }
void SetScrollRate(int speed) { pev->animtime = speed; }
int GetType() const { return pev->rendermode & 0x0F; }
int GetFlags() const { return pev->rendermode & 0xF0; }
int GetStartEntity() const { return pev->sequence & 0xFFF; }
int GetEndEntity() const { return pev->skin & 0xFFF; }
const Vector &GetStartPos();
const Vector &GetEndPos();
int GetTexture() const { return pev->modelindex; }
int GetWidth() const { return pev->scale; }
int GetNoise() const { return pev->body; }
int GetBrightness() const { return pev->renderamt; }
int GetFrame() const { return pev->frame; }
int GetScrollRate() const { return pev->animtime; }
void LiveForTime(float time)
{
SetThink(&CBeam::SUB_Remove);
pev->nextthink = gpGlobals->time + time;
}
void BeamDamageInstant(TraceResult *ptr, float damage)
{
pev->dmg = damage;
pev->dmgtime = gpGlobals->time - 1;
BeamDamage(ptr);
}
};
class CLaser: public CBeam {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
CSprite *m_pSprite;
int m_iszSpriteName;
Vector m_firePosition;
};
class CBubbling: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
int m_density;
int m_frequency;
int m_bubbleModel;
int m_state;
};
class CLightning: public CBeam {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void Activate() = 0;
public:
inline BOOL ServerSide() const
{
if (!m_life && !(pev->spawnflags & SF_BEAM_RING))
return TRUE;
return FALSE;
}
public:
int m_active;
int m_iszStartEntity;
int m_iszEndEntity;
float m_life;
int m_boltWidth;
int m_noiseAmplitude;
int m_brightness;
int m_speed;
float m_restrike;
int m_spriteTexture;
int m_iszSpriteName;
int m_frameStart;
float m_radius;
};
class CGlow: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void Think() = 0;
public:
float m_lastTime;
float m_maxFrame;
};
class CBombGlow: public CSprite {
public:
virtual void Spawn() = 0;
virtual void Think() = 0;
public:
float m_lastTime;
float m_tmBeepPeriod;
bool m_bSetModel;
};
class CGibShooter: public CBaseDelay {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
virtual CGib *CreateGib() = 0;
public:
int m_iGibs;
int m_iGibCapacity;
int m_iGibMaterial;
int m_iGibModelIndex;
float m_flGibVelocity;
float m_flVariance;
float m_flGibLife;
};
class CEnvShooter: public CGibShooter {
public:
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual CGib *CreateGib() = 0;
};
#define MAX_BEAM 24
class CTestEffect: public CBaseDelay {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
int m_iLoop;
int m_iBeam;
CBeam *m_pBeam[MAX_BEAM];
float m_flBeamTime[MAX_BEAM];
float m_flStartTime;
};
class CBlood: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
int Color() const { return pev->impulse; }
float BloodAmount() const { return pev->dmg; }
void SetColor(int color) { pev->impulse = color; }
void SetBloodAmount(float amount) { pev->dmg = amount; }
};
class CShake: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
float Amplitude() const { return pev->scale; }
float Frequency() const { return pev->dmg_save; }
float Duration() const { return pev->dmg_take; }
float Radius() const { return pev->dmg; }
void SetAmplitude(float amplitude) { pev->scale = amplitude; }
void SetFrequency(float frequency) { pev->dmg_save = frequency; }
void SetDuration(float duration) { pev->dmg_take = duration; }
void SetRadius(float radius) { pev->dmg = radius; }
};
class CFade: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
float Duration() const { return pev->dmg_take; }
float HoldTime() const { return pev->dmg_save; }
void SetDuration(float duration) { pev->dmg_take = duration; }
void SetHoldTime(float hold) { pev->dmg_save = hold; }
};
class CMessage: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};
class CEnvFunnel: public CBaseDelay {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
int m_iSprite;
};
class CEnvBeverage: public CBaseDelay {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};
class CItemSoda: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
};
// Inlines
inline void CBeam::SetStartEntity(int entityIndex)
{
pev->sequence = (entityIndex & 0x0FFF) | ((pev->sequence & 0xF000) << 12);
pev->owner = INDEXENT(entityIndex);
}
inline void CBeam::SetEndEntity(int entityIndex)
{
pev->skin = (entityIndex & 0x0FFF) | ((pev->skin & 0xF000) << 12);
pev->aiment = INDEXENT(entityIndex);
}
inline const Vector &CBeam::GetStartPos()
{
if (GetType() == BEAM_ENTS)
{
edict_t *pent = INDEXENT(GetStartEntity());
return pent->v.origin;
}
return pev->origin;
}
inline const Vector &CBeam::GetEndPos()
{
int type = GetType();
if (type == BEAM_POINTS || type == BEAM_HOSE)
{
return pev->angles;
}
edict_t *pent = INDEXENT(GetEndEntity());
if (pent != NULL)
{
return pent->v.origin;
}
return pev->angles;
}

View File

@ -0,0 +1,178 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#include "event_flags.h"
// Must be provided by user of this code
extern enginefuncs_t g_engfuncs;
// The actual engine callbacks
#define GETPLAYERUSERID (*g_engfuncs.pfnGetPlayerUserId)
#define PRECACHE_MODEL (*g_engfuncs.pfnPrecacheModel)
#define PRECACHE_SOUND (*g_engfuncs.pfnPrecacheSound)
#define PRECACHE_GENERIC (*g_engfuncs.pfnPrecacheGeneric)
#define SET_MODEL (*g_engfuncs.pfnSetModel)
#define MODEL_INDEX (*g_engfuncs.pfnModelIndex)
#define MODEL_FRAMES (*g_engfuncs.pfnModelFrames)
#define SET_SIZE (*g_engfuncs.pfnSetSize)
#define CHANGE_LEVEL (*g_engfuncs.pfnChangeLevel)
#define GET_SPAWN_PARMS (*g_engfuncs.pfnGetSpawnParms)
#define SAVE_SPAWN_PARMS (*g_engfuncs.pfnSaveSpawnParms)
#define VEC_TO_YAW (*g_engfuncs.pfnVecToYaw)
#define VEC_TO_ANGLES (*g_engfuncs.pfnVecToAngles)
#define MOVE_TO_ORIGIN (*g_engfuncs.pfnMoveToOrigin)
#define oldCHANGE_YAW (*g_engfuncs.pfnChangeYaw)
#define CHANGE_PITCH (*g_engfuncs.pfnChangePitch)
#define MAKE_VECTORS (*g_engfuncs.pfnMakeVectors)
#define CREATE_ENTITY (*g_engfuncs.pfnCreateEntity)
#define REMOVE_ENTITY (*g_engfuncs.pfnRemoveEntity)
#define CREATE_NAMED_ENTITY (*g_engfuncs.pfnCreateNamedEntity)
#define MAKE_STATIC (*g_engfuncs.pfnMakeStatic)
#define ENT_IS_ON_FLOOR (*g_engfuncs.pfnEntIsOnFloor)
#define DROP_TO_FLOOR (*g_engfuncs.pfnDropToFloor)
#define WALK_MOVE (*g_engfuncs.pfnWalkMove)
#define SET_ORIGIN (*g_engfuncs.pfnSetOrigin)
#define EMIT_SOUND_DYN2 (*g_engfuncs.pfnEmitSound)
#define BUILD_SOUND_MSG (*g_engfuncs.pfnBuildSoundMsg)
#define TRACE_LINE (*g_engfuncs.pfnTraceLine)
#define TRACE_TOSS (*g_engfuncs.pfnTraceToss)
#define TRACE_MONSTER_HULL (*g_engfuncs.pfnTraceMonsterHull)
#define TRACE_HULL (*g_engfuncs.pfnTraceHull)
#define TRACE_MODEL (*g_engfuncs.pfnTraceModel)
#define GET_AIM_VECTOR (*g_engfuncs.pfnGetAimVector)
#define SERVER_COMMAND (*g_engfuncs.pfnServerCommand)
#define SERVER_EXECUTE (*g_engfuncs.pfnServerExecute)
#define CLIENT_COMMAND (*g_engfuncs.pfnClientCommand)
#define PARTICLE_EFFECT (*g_engfuncs.pfnParticleEffect)
#define LIGHT_STYLE (*g_engfuncs.pfnLightStyle)
#define DECAL_INDEX (*g_engfuncs.pfnDecalIndex)
#define POINT_CONTENTS (*g_engfuncs.pfnPointContents)
#define CRC32_INIT (*g_engfuncs.pfnCRC32_Init)
#define CRC32_PROCESS_BUFFER (*g_engfuncs.pfnCRC32_ProcessBuffer)
#define CRC32_PROCESS_BYTE (*g_engfuncs.pfnCRC32_ProcessByte)
#define CRC32_FINAL (*g_engfuncs.pfnCRC32_Final)
#define RANDOM_LONG (*g_engfuncs.pfnRandomLong)
#define RANDOM_FLOAT (*g_engfuncs.pfnRandomFloat)
#define ADD_SERVER_COMMAND (*g_engfuncs.pfnAddServerCommand)
#define SET_CLIENT_LISTENING (*g_engfuncs.pfnVoice_SetClientListening)
#define GETPLAYERAUTHID (*g_engfuncs.pfnGetPlayerAuthId)
#define GET_FILE_SIZE (*g_engfuncs.pfnGetFileSize)
#define GET_APPROX_WAVE_PLAY_LEN (*g_engfuncs.pfnGetApproxWavePlayLen)
#define IS_CAREER_MATCH (*g_engfuncs.pfnIsCareerMatch)
#define GET_LOCALIZED_STRING_LENGTH (*g_engfuncs.pfnGetLocalizedStringLength)
#define REGISTER_TUTOR_MESSAGE_SHOWN (*g_engfuncs.pfnRegisterTutorMessageShown)
#define GET_TIMES_TUTOR_MESSAGE_SHOWN (*g_engfuncs.pfnGetTimesTutorMessageShown)
#define ENG_CHECK_PARM (*g_engfuncs.pfnEngCheckParm)
inline void MESSAGE_BEGIN(int msg_dest, int msg_type, const float *pOrigin = NULL, edict_t *ed = NULL) { (*g_engfuncs.pfnMessageBegin)(msg_dest, msg_type, pOrigin, ed); }
inline void *GET_PRIVATE(edict_t *pent)
{
if (pent)
return pent->pvPrivateData;
return NULL;
}
#define MESSAGE_END (*g_engfuncs.pfnMessageEnd)
#define WRITE_BYTE (*g_engfuncs.pfnWriteByte)
#define WRITE_CHAR (*g_engfuncs.pfnWriteChar)
#define WRITE_SHORT (*g_engfuncs.pfnWriteShort)
#define WRITE_LONG (*g_engfuncs.pfnWriteLong)
#define WRITE_ANGLE (*g_engfuncs.pfnWriteAngle)
#define WRITE_COORD (*g_engfuncs.pfnWriteCoord)
#define WRITE_STRING (*g_engfuncs.pfnWriteString)
#define WRITE_ENTITY (*g_engfuncs.pfnWriteEntity)
#define CVAR_REGISTER (*g_engfuncs.pfnCVarRegister)
#define CVAR_GET_FLOAT (*g_engfuncs.pfnCVarGetFloat)
#define CVAR_GET_STRING (*g_engfuncs.pfnCVarGetString)
#define CVAR_SET_FLOAT (*g_engfuncs.pfnCVarSetFloat)
#define CVAR_SET_STRING (*g_engfuncs.pfnCVarSetString)
#define CVAR_GET_POINTER (*g_engfuncs.pfnCVarGetPointer)
#define ALERT (*g_engfuncs.pfnAlertMessage)
#define ENGINE_FPRINTF (*g_engfuncs.pfnEngineFprintf)
#define ALLOC_PRIVATE (*g_engfuncs.pfnPvAllocEntPrivateData)
#define FREE_PRIVATE (*g_engfuncs.pfnFreeEntPrivateData)
//#define STRING (*g_engfuncs.pfnSzFromIndex)
#define ALLOC_STRING (*g_engfuncs.pfnAllocString)
#define FIND_ENTITY_BY_STRING (*g_engfuncs.pfnFindEntityByString)
#define GETENTITYILLUM (*g_engfuncs.pfnGetEntityIllum)
#define FIND_ENTITY_IN_SPHERE (*g_engfuncs.pfnFindEntityInSphere)
#define FIND_CLIENT_IN_PVS (*g_engfuncs.pfnFindClientInPVS)
#define FIND_ENTITY_IN_PVS (*g_engfuncs.pfnEntitiesInPVS)
#define EMIT_AMBIENT_SOUND (*g_engfuncs.pfnEmitAmbientSound)
#define GET_MODEL_PTR (*g_engfuncs.pfnGetModelPtr)
#define REG_USER_MSG (*g_engfuncs.pfnRegUserMsg)
#define GET_BONE_POSITION (*g_engfuncs.pfnGetBonePosition)
#define FUNCTION_FROM_NAME (*g_engfuncs.pfnFunctionFromName)
#define NAME_FOR_FUNCTION (*g_engfuncs.pfnNameForFunction)
#define TRACE_TEXTURE (*g_engfuncs.pfnTraceTexture)
#define CLIENT_PRINTF (*g_engfuncs.pfnClientPrintf)
#define SERVER_PRINT (*g_engfuncs.pfnServerPrint)
#define CMD_ARGS (*g_engfuncs.pfnCmd_Args)
#define CMD_ARGC (*g_engfuncs.pfnCmd_Argc)
#define CMD_ARGV (*g_engfuncs.pfnCmd_Argv)
#define GET_ATTACHMENT (*g_engfuncs.pfnGetAttachment)
#define SET_VIEW (*g_engfuncs.pfnSetView)
#define SET_CROSSHAIRANGLE (*g_engfuncs.pfnCrosshairAngle)
#define LOAD_FILE_FOR_ME (*g_engfuncs.pfnLoadFileForMe)
#define FREE_FILE (*g_engfuncs.pfnFreeFile)
#define END_SECTION (*g_engfuncs.pfnEndSection)
#define COMPARE_FILE_TIME (*g_engfuncs.pfnCompareFileTime)
#define GET_GAME_DIR (*g_engfuncs.pfnGetGameDir)
#define SET_CLIENT_MAXSPEED (*g_engfuncs.pfnSetClientMaxspeed)
#define CREATE_FAKE_CLIENT (*g_engfuncs.pfnCreateFakeClient)
#define PLAYER_RUN_MOVE (*g_engfuncs.pfnRunPlayerMove)
#define NUMBER_OF_ENTITIES (*g_engfuncs.pfnNumberOfEntities)
#define GET_INFO_BUFFER (*g_engfuncs.pfnGetInfoKeyBuffer)
#define GET_KEY_VALUE (*g_engfuncs.pfnInfoKeyValue)
#define SET_KEY_VALUE (*g_engfuncs.pfnSetKeyValue)
#define SET_CLIENT_KEY_VALUE (*g_engfuncs.pfnSetClientKeyValue)
#define IS_MAP_VALID (*g_engfuncs.pfnIsMapValid)
#define STATIC_DECAL (*g_engfuncs.pfnStaticDecal)
#define IS_DEDICATED_SERVER (*g_engfuncs.pfnIsDedicatedServer)
#define PRECACHE_EVENT (*g_engfuncs.pfnPrecacheEvent)
#define PLAYBACK_EVENT_FULL (*g_engfuncs.pfnPlaybackEvent)
#define ENGINE_SET_PVS (*g_engfuncs.pfnSetFatPVS)
#define ENGINE_SET_PAS (*g_engfuncs.pfnSetFatPAS)
#define ENGINE_CHECK_VISIBILITY (*g_engfuncs.pfnCheckVisibility)
#define DELTA_SET (*g_engfuncs.pfnDeltaSetField)
#define DELTA_UNSET (*g_engfuncs.pfnDeltaUnsetField)
#define DELTA_ADDENCODER (*g_engfuncs.pfnDeltaAddEncoder)
#define ENGINE_CURRENT_PLAYER (*g_engfuncs.pfnGetCurrentPlayer)
#define ENGINE_CANSKIP (*g_engfuncs.pfnCanSkipPlayer)
#define DELTA_FINDFIELD (*g_engfuncs.pfnDeltaFindField)
#define DELTA_SETBYINDEX (*g_engfuncs.pfnDeltaSetFieldByIndex)
#define DELTA_UNSETBYINDEX (*g_engfuncs.pfnDeltaUnsetFieldByIndex)
#define REMOVE_KEY_VALUE (*g_engfuncs.pfnInfo_RemoveKey)
#define SET_PHYSICS_KEY_VALUE (*g_engfuncs.pfnSetPhysicsKeyValue)
#define ENGINE_GETPHYSINFO (*g_engfuncs.pfnGetPhysicsInfoString)
#define ENGINE_SETGROUPMASK (*g_engfuncs.pfnSetGroupMask)
#define ENGINE_INSTANCE_BASELINE (*g_engfuncs.pfnCreateInstancedBaseline)
#define ENGINE_FORCE_UNMODIFIED (*g_engfuncs.pfnForceUnmodified)
#define PLAYER_CNX_STATS (*g_engfuncs.pfnGetPlayerStats)

View File

@ -0,0 +1,55 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#define SF_ENVEXPLOSION_NODAMAGE (1<<0) // when set, ENV_EXPLOSION will not actually inflict damage
#define SF_ENVEXPLOSION_REPEATABLE (1<<1) // can this entity be refired?
#define SF_ENVEXPLOSION_NOFIREBALL (1<<2) // don't draw the fireball
#define SF_ENVEXPLOSION_NOSMOKE (1<<3) // don't draw the smoke
#define SF_ENVEXPLOSION_NODECAL (1<<4) // don't make a scorch mark
#define SF_ENVEXPLOSION_NOSPARKS (1<<5) // don't make a scorch mark
class CShower: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual int ObjectCaps() = 0;
virtual void Think() = 0;
virtual void Touch(CBaseEntity *pOther) = 0;
};
class CEnvExplosion: public CBaseMonster {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
int m_iMagnitude;
int m_spriteScale;
};

View File

@ -0,0 +1,102 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#include "regamedll_const.h"
#ifdef _WIN32
// Attributes to specify an "exported" function, visible from outside the
// DLL.
#undef DLLEXPORT
#define DLLEXPORT __declspec(dllexport)
// WINAPI should be provided in the windows compiler headers.
// It's usually defined to something like "__stdcall".
#else
#undef DLLEXPORT
#define DLLEXPORT __attribute__((visibility("default")))
#define WINAPI /* */
#endif // _WIN32
// Simplified macro for declaring/defining exported DLL functions. They
// need to be 'extern "C"' so that the C++ compiler enforces parameter
// type-matching, rather than considering routines with mis-matched
// arguments/types to be overloaded functions...
//
// AFAIK, this is os-independent, but it's included here in osdep.h where
// DLLEXPORT is defined, for convenience.
#define C_DLLEXPORT extern "C" DLLEXPORT
enum hash_types_e { CLASSNAME };
// Things that toggle (buttons/triggers/doors) need this
enum TOGGLE_STATE { TS_AT_TOP, TS_AT_BOTTOM, TS_GOING_UP, TS_GOING_DOWN };
typedef struct hash_item_s
{
entvars_t *pev;
struct hash_item_s *next;
struct hash_item_s *lastHash;
int pevIndex;
} hash_item_t;
typedef struct locksounds
{
string_t sLockedSound;
string_t sLockedSentence;
string_t sUnlockedSound;
string_t sUnlockedSentence;
int iLockedSentence;
int iUnlockedSentence;
float flwaitSound;
float flwaitSentence;
byte bEOFLocked;
byte bEOFUnlocked;
} locksound_t;
typedef struct hudtextparms_s
{
float x;
float y;
int effect;
byte r1,g1,b1,a1;
byte r2,g2,b2,a2;
float fadeinTime;
float fadeoutTime;
float holdTime;
float fxTime;
int channel;
} hudtextparms_t;
enum USE_TYPE { USE_OFF, USE_ON, USE_SET, USE_TOGGLE };
enum TRAIN_CODE { TRAIN_SAFE, TRAIN_BLOCKING, TRAIN_FOLLOWING };
enum IGNORE_MONSTERS { ignore_monsters = 1, dont_ignore_monsters = 0, missile = 2 };
enum IGNORE_GLASS { ignore_glass = 1, dont_ignore_glass = 0 };
enum { point_hull = 0, human_hull = 1, large_hull = 2, head_hull = 3 };

View File

@ -0,0 +1,82 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#pragma warning(disable:4244) // int or float down-conversion
#pragma warning(disable:4305) // int or float data truncation
#pragma warning(disable:4201) // nameless struct/union
#pragma warning(disable:4514) // unreferenced inline function removed
#pragma warning(disable:4100) // unreferenced formal parameter
#include "archtypes.h"
#include "maintypes.h"
#include "regamedll_common.h"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#define NOWINRES
#define NOSERVICE
#define NOMCX
#define NOIME
#include "winsani_in.h"
#include "windows.h"
#include "winsani_out.h"
#undef PlaySound
#else
#include <limits.h>
#include <stdarg.h>
#include <string.h>
#endif // _WIN32
// Misc C-runtime library headers
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
// Header file containing definition of globalvars_t and entvars_t
typedef int EOFFSET; // More explicit than "int"
typedef unsigned int func_t;
typedef unsigned int string_t; // from engine's pr_comp.h;
typedef float vec_t; // needed before including progdefs.h
// Vector class
#include "vector.h"
//#include "vector.h"
// Defining it as a (bogus) struct helps enforce type-checking
#define vec3_t Vector
// Shared engine/DLL constants
#include "const.h"
#include "edict.h"
// Shared header describing protocol between engine and DLLs
#include "eiface.h"
// Shared header between the client DLL and the game DLLs
#include "cdll_dll.h"
#include "extdef.h"

View File

@ -0,0 +1,119 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
// this many shards spawned when breakable objects break;
#define NUM_SHARDS 6
// func breakable
#define SF_BREAK_TRIGGER_ONLY 1 // may only be broken by trigger
#define SF_BREAK_TOUCH 2 // can be 'crashed through' by running player (plate glass)
#define SF_BREAK_PRESSURE 4 // can be broken by a player standing on it
#define SF_BREAK_CROWBAR 256 // instant break if hit with crowbar
// func_pushable (it's also func_breakable, so don't collide with those flags)
#define SF_PUSH_BREAKABLE 128
typedef enum
{
expRandom = 0,
expDirected,
} Explosions;
typedef enum
{
matGlass = 0,
matWood,
matMetal,
matFlesh,
matCinderBlock,
matCeilingTile,
matComputer,
matUnbreakableGlass,
matRocks,
matNone,
matLastMaterial,
} Materials;
class CBreakable: public CBaseDelay {
public:
// basic functions
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void Restart() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
// To spark when hit
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
// breakables use an overridden takedamage
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual int DamageDecal(int bitsDamageType) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
BOOL Explodable() const { return ExplosionMagnitude() > 0; }
int ExplosionMagnitude() const { return pev->impulse; }
void ExplosionSetMagnitude(int magnitude) { pev->impulse = magnitude; }
public:
Materials m_Material;
Explosions m_Explosion;
int m_idShard;
float m_angle;
int m_iszGibModel;
int m_iszSpawnObject;
float m_flHealth;
};
class CPushable: public CBreakable {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual void Touch(CBaseEntity *pOther) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
float MaxSpeed() const { return m_maxSpeed; }
public:
int m_lastSound;
float m_maxSpeed;
float m_soundTime;
};

View File

@ -0,0 +1,159 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#define SF_TANK_ACTIVE 0x0001
#define SF_TANK_PLAYER 0x0002
#define SF_TANK_HUMANS 0x0004
#define SF_TANK_ALIENS 0x0008
#define SF_TANK_LINEOFSIGHT 0x0010
#define SF_TANK_CANCONTROL 0x0020
#define SF_TANK_SOUNDON 0x8000
enum TANKBULLET
{
TANK_BULLET_NONE = 0, // Custom damage
TANK_BULLET_9MM, // env_laser (duration is 0.5 rate of fire)
TANK_BULLET_MP5, // rockets
TANK_BULLET_12MM, // explosion?
};
class CFuncTank: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
// Bmodels don't go across transitions
virtual int ObjectCaps() = 0;
virtual BOOL OnControls(entvars_t *pevTest) = 0;
virtual void Think() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
virtual void Fire(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) = 0;
virtual Vector UpdateTargetPosition(CBaseEntity *pTarget) = 0;
public:
BOOL IsActive() const { return (pev->spawnflags & SF_TANK_ACTIVE) == SF_TANK_ACTIVE; }
void TankActivate()
{
pev->spawnflags |= SF_TANK_ACTIVE;
pev->nextthink = pev->ltime + 0.1f;
m_fireLast = 0.0f;
}
void TankDeactivate()
{
pev->spawnflags &= ~SF_TANK_ACTIVE;
m_fireLast = 0.0f;
StopRotSound();
}
BOOL CanFire() const { return (gpGlobals->time - m_lastSightTime) < m_persist; }
Vector BarrelPosition()
{
Vector forward, right, up;
UTIL_MakeVectorsPrivate(pev->angles, forward, right, up);
return pev->origin + (forward * m_barrelPos.x) + (right * m_barrelPos.y) + (up * m_barrelPos.z);
}
protected:
CBasePlayer *m_pController;
float m_flNextAttack;
Vector m_vecControllerUsePos;
float m_yawCenter; // "Center" yaw
float m_yawRate; // Max turn rate to track targets
float m_yawRange; // Range of turning motion (one-sided: 30 is +/- 30 degress from center)
// Zero is full rotation
float m_yawTolerance; // Tolerance angle
float m_pitchCenter; // "Center" pitch
float m_pitchRate; // Max turn rate on pitch
float m_pitchRange; // Range of pitch motion as above
float m_pitchTolerance; // Tolerance angle
float m_fireLast; // Last time I fired
float m_fireRate; // How many rounds/second
float m_lastSightTime; // Last time I saw target
float m_persist; // Persistence of firing (how long do I shoot when I can't see)
float m_minRange; // Minimum range to aim/track
float m_maxRange; // Max range to aim/track
Vector m_barrelPos; // Length of the freakin barrel
float m_spriteScale; // Scale of any sprites we shoot
int m_iszSpriteSmoke;
int m_iszSpriteFlash;
TANKBULLET m_bulletType; // Bullet type
int m_iBulletDamage; // 0 means use Bullet type's default damage
Vector m_sightOrigin; // Last sight of target
int m_spread; // firing spread
int m_iszMaster; // Master entity (game_team_master or multisource)
};
class CFuncTankGun: public CFuncTank {
public:
virtual void Fire(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) = 0;
};
class CFuncTankLaser: public CFuncTank {
public:
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void Activate() = 0;
virtual void Think() = 0;
virtual void Fire(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) = 0;
private:
CLaser *m_pLaser;
float m_laserTime;
};
class CFuncTankRocket: public CFuncTank {
public:
virtual void Precache() = 0;
virtual void Fire(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) = 0;
};
class CFuncTankMortar: public CFuncTank {
public:
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual void Fire(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) = 0;
};
class CFuncTankControls: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void Think() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
CFuncTank *m_pTank;
};

View File

@ -0,0 +1,678 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#include "voice_gamemgr.h"
#define MAX_RULE_BUFFER 1024
#define MAX_VOTE_MAPS 100
#define MAX_VIP_QUEUES 5
#define MAX_BOMB_RADIUS 2048
#define MAP_VIP_SAFETYZONE_UNINITIALIZED 0 // uninitialized
#define MAP_HAVE_VIP_SAFETYZONE_YES 1 // has VIP safety zone
#define MAP_HAVE_VIP_SAFETYZONE_NO 2 // does not have VIP safetyzone
#define MAP_HAS_CAMERAS_INIT 2 // initial
#define MAP_HAS_CAMERAS_YES 1 // on map have of camera's
#define ITEM_RESPAWN_TIME 30
#define WEAPON_RESPAWN_TIME 20
#define AMMO_RESPAWN_TIME 20
// longest the intermission can last, in seconds
#define MAX_INTERMISSION_TIME 120
// when we are within this close to running out of entities, items
// marked with the ITEM_FLAG_LIMITINWORLD will delay their respawn
#define ENTITY_INTOLERANCE 100
#define MAX_MOTD_CHUNK 60
#define MAX_MOTD_LENGTH 1536 // (MAX_MOTD_CHUNK * 4)
// custom enum
#define WINNER_NONE 0
#define WINNER_DRAW 1
enum
{
WINSTATUS_CTS = 1,
WINSTATUS_TERRORISTS,
WINSTATUS_DRAW,
};
// custom enum
// used for EndRoundMessage() logged messages
enum ScenarioEventEndRound
{
ROUND_NONE,
ROUND_TARGET_BOMB,
ROUND_VIP_ESCAPED,
ROUND_VIP_ASSASSINATED,
ROUND_TERRORISTS_ESCAPED,
ROUND_CTS_PREVENT_ESCAPE,
ROUND_ESCAPING_TERRORISTS_NEUTRALIZED,
ROUND_BOMB_DEFUSED,
ROUND_CTS_WIN,
ROUND_TERRORISTS_WIN,
ROUND_END_DRAW,
ROUND_ALL_HOSTAGES_RESCUED,
ROUND_TARGET_SAVED,
ROUND_HOSTAGE_NOT_RESCUED,
ROUND_TERRORISTS_NOT_ESCAPED,
ROUND_VIP_NOT_ESCAPED,
ROUND_GAME_COMMENCE,
};
enum RewardRules
{
RR_CTS_WIN,
RR_TERRORISTS_WIN,
RR_TARGET_BOMB,
RR_VIP_ESCAPED,
RR_VIP_ASSASSINATED,
RR_TERRORISTS_ESCAPED,
RR_CTS_PREVENT_ESCAPE,
RR_ESCAPING_TERRORISTS_NEUTRALIZED,
RR_BOMB_DEFUSED,
RR_BOMB_PLANTED,
RR_BOMB_EXPLODED,
RR_ALL_HOSTAGES_RESCUED,
RR_TARGET_BOMB_SAVED,
RR_HOSTAGE_NOT_RESCUED,
RR_VIP_NOT_ESCAPED,
RR_LOSER_BONUS_DEFAULT,
RR_LOSER_BONUS_MIN,
RR_LOSER_BONUS_MAX,
RR_LOSER_BONUS_ADD,
RR_RESCUED_HOSTAGE,
RR_TOOK_HOSTAGE_ACC,
RR_TOOK_HOSTAGE,
RR_END
};
// custom enum
enum RewardAccount
{
REWARD_TARGET_BOMB = 3500,
REWARD_VIP_ESCAPED = 3500,
REWARD_VIP_ASSASSINATED = 3250,
REWARD_TERRORISTS_ESCAPED = 3150,
REWARD_CTS_PREVENT_ESCAPE = 3500,
REWARD_ESCAPING_TERRORISTS_NEUTRALIZED = 3250,
REWARD_BOMB_DEFUSED = 3250,
REWARD_BOMB_PLANTED = 800,
REWARD_BOMB_EXPLODED = 3250,
REWARD_CTS_WIN = 3000,
REWARD_TERRORISTS_WIN = 3000,
REWARD_ALL_HOSTAGES_RESCUED = 2500,
// the end round was by the expiration time
REWARD_TARGET_BOMB_SAVED = 3250,
REWARD_HOSTAGE_NOT_RESCUED = 3250,
REWARD_VIP_NOT_ESCAPED = 3250,
// loser bonus
REWARD_LOSER_BONUS_DEFAULT = 1400,
REWARD_LOSER_BONUS_MIN = 1500,
REWARD_LOSER_BONUS_MAX = 3000,
REWARD_LOSER_BONUS_ADD = 500,
REWARD_RESCUED_HOSTAGE = 750,
REWARD_KILLED_ENEMY = 300,
REWARD_KILLED_VIP = 2500,
REWARD_VIP_HAVE_SELF_RESCUED = 2500,
REWARD_TAKEN_HOSTAGE = 1000
};
// custom enum
enum PaybackForBadThing
{
PAYBACK_FOR_KILLED_TEAMMATES = -3300,
};
// custom enum
enum InfoMapBuyParam
{
BUYING_EVERYONE = 0,
BUYING_ONLY_CTS,
BUYING_ONLY_TERRORISTS,
BUYING_NO_ONE,
};
// weapon respawning return codes
enum
{
GR_NONE = 0,
GR_WEAPON_RESPAWN_YES,
GR_WEAPON_RESPAWN_NO,
GR_AMMO_RESPAWN_YES,
GR_AMMO_RESPAWN_NO,
GR_ITEM_RESPAWN_YES,
GR_ITEM_RESPAWN_NO,
GR_PLR_DROP_GUN_ALL,
GR_PLR_DROP_GUN_ACTIVE,
GR_PLR_DROP_GUN_NO,
GR_PLR_DROP_AMMO_ALL,
GR_PLR_DROP_AMMO_ACTIVE,
GR_PLR_DROP_AMMO_NO,
};
// custom enum
enum
{
SCENARIO_BLOCK_TIME_EXPRIRED = (1 << 0),
SCENARIO_BLOCK_NEED_PLAYERS = (1 << 1),
SCENARIO_BLOCK_VIP_ESCAPRE = (1 << 2),
SCENARIO_BLOCK_PRISON_ESCAPRE = (1 << 3),
SCENARIO_BLOCK_BOMB = (1 << 4),
SCENARIO_BLOCK_TEAM_EXTERMINATION = (1 << 5),
SCENARIO_BLOCK_HOSTAGE_RESCUE = (1 << 6),
};
// Player relationship return codes
enum
{
GR_NOTTEAMMATE = 0,
GR_TEAMMATE,
GR_ENEMY,
GR_ALLY,
GR_NEUTRAL,
};
class CItem;
class CGameRules {
protected:
virtual ~CGameRules() {};
public:
virtual void RefreshSkillData() = 0; // fill skill data struct with proper values
virtual void Think() = 0; // runs every server frame, should handle any timer tasks, periodic events, etc.
virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0; // Can this item spawn (eg monsters don't spawn in deathmatch).
virtual BOOL FAllowFlashlight() = 0; // Are players allowed to switch on their flashlight?
virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0; // should the player switch to this weapon?
virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) = 0; // I can't use this weapon anymore, get me the next best one.
// Functions to verify the single/multiplayer status of a game
virtual BOOL IsMultiplayer() = 0; // is this a multiplayer game? (either coop or deathmatch)
virtual BOOL IsDeathmatch() = 0; // is this a deathmatch game?
virtual BOOL IsTeamplay() = 0; // is this deathmatch game being played with team rules?
virtual BOOL IsCoOp() = 0; // is this a coop game?
virtual const char *GetGameDescription() = 0; // this is the game name that gets seen in the server browser
// Client connection/disconnection
virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason) = 0; // a client just connected to the server (player hasn't spawned yet)
virtual void InitHUD(CBasePlayer *pl) = 0; // the client dll is ready for updating
virtual void ClientDisconnected(edict_t *pClient) = 0; // a client just disconnected from the server
virtual void UpdateGameMode(CBasePlayer *pPlayer) = 0; // the client needs to be informed of the current game mode
// Client damage rules
virtual float FlPlayerFallDamage(CBasePlayer *pPlayer) = 0;
virtual BOOL FPlayerCanTakeDamage(CBasePlayer *pPlayer, CBaseEntity *pAttacker) = 0; // can this player take damage from this attacker?
virtual BOOL ShouldAutoAim(CBasePlayer *pPlayer, edict_t *target) = 0;
// Client spawn/respawn control
virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0; // called by CBasePlayer::Spawn just before releasing player into the game
virtual void PlayerThink(CBasePlayer *pPlayer) = 0; // called by CBasePlayer::PreThink every frame, before physics are run and after keys are accepted
virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0; // is this player allowed to respawn now?
virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer) = 0; // When in the future will this player be able to spawn?
virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer) = 0; // Place this player on their spawnspot and face them the proper direction.
virtual BOOL AllowAutoTargetCrosshair() = 0;
virtual BOOL ClientCommand_DeadOrAlive(CBasePlayer *pPlayer, const char *pcmd) = 0;
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0; // handles the user commands; returns TRUE if command handled properly
virtual void ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer) = 0; // the player has changed userinfo; can change it now
// Client kills/scoring
virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0; // how many points do I award whoever kills this player?
virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0; // Called each time a player dies
virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor) = 0; // Call this from within a GameRules class to report an obituary.
// Weapon retrieval
virtual BOOL CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem) = 0; // The player is touching an CBasePlayerItem, do I give it to him?
virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0; // Called each time a player picks up a weapon from the ground
// Weapon spawn/respawn control
virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon) = 0; // should this weapon respawn?
virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon) = 0; // when may this weapon respawn?
virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon) = 0; // can i respawn now, and if not, when should i try again?
virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) = 0; // where in the world should this weapon respawn?
// Item retrieval
virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) = 0; // is this player allowed to take this item?
virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) = 0; // call each time a player picks up an item (battery, healthkit, longjump)
// Item spawn/respawn control
virtual int ItemShouldRespawn(CItem *pItem) = 0; // Should this item respawn?
virtual float FlItemRespawnTime(CItem *pItem) = 0; // when may this item respawn?
virtual Vector VecItemRespawnSpot(CItem *pItem) = 0; // where in the world should this item respawn?
// Ammo retrieval
virtual BOOL CanHaveAmmo(CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry) = 0; // can this player take more of this ammo?
virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) = 0; // called each time a player picks up some ammo in the world
// Ammo spawn/respawn control
virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0; // should this ammo item respawn?
virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) = 0; // when should this ammo item respawn?
virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) = 0; // where in the world should this ammo item respawn?
// Healthcharger respawn control
virtual float FlHealthChargerRechargeTime() = 0; // how long until a depleted HealthCharger recharges itself?
virtual float FlHEVChargerRechargeTime() = 0; // how long until a depleted HealthCharger recharges itself?
// What happens to a dead player's weapons
virtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0; // what do I do with a player's weapons when he's killed?
// What happens to a dead player's ammo
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0; // Do I drop ammo when the player dies? How much?
// Teamplay stuff
virtual const char *GetTeamID(CBaseEntity *pEntity) = 0; // what team is this entity on?
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0; // What is the player's relationship with this entity?
virtual int GetTeamIndex(const char *pTeamName) = 0;
virtual const char *GetIndexedTeamName(int teamIndex) = 0;
virtual BOOL IsValidTeam(const char *pTeamName) = 0;
virtual void ChangePlayerTeam(CBasePlayer *pPlayer, const char *pTeamName, BOOL bKill, BOOL bGib) = 0;
virtual const char *SetDefaultPlayerTeam(CBasePlayer *pPlayer) = 0;
// Sounds
virtual BOOL PlayTextureSounds() = 0;
// Monsters
virtual BOOL FAllowMonsters() = 0; // are monsters allowed
// Immediately end a multiplayer game
virtual void EndMultiplayerGame() = 0;
// Stuff that is shared between client and server.
virtual BOOL IsFreezePeriod() = 0;
virtual void ServerDeactivate() = 0;
virtual void CheckMapConditions() = 0;
public:
BOOL m_bFreezePeriod;
BOOL m_bBombDropped;
// custom
char *m_GameDesc;
};
// CHalfLifeRules - rules for the single player Half-Life game.
class CHalfLifeRules: public CGameRules {
protected:
virtual ~CHalfLifeRules() {};
public:
virtual void Think() = 0;
virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0;
virtual BOOL FAllowFlashlight() = 0;
virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) = 0;
// Functions to verify the single/multiplayer status of a game
virtual BOOL IsMultiplayer() = 0;
virtual BOOL IsDeathmatch() = 0;
virtual BOOL IsCoOp() = 0;
// Client connection/disconnection
virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]) = 0;
virtual void InitHUD(CBasePlayer *pl) = 0; // the client dll is ready for updating
virtual void ClientDisconnected(edict_t *pClient) = 0;
// Client damage rules
virtual float FlPlayerFallDamage(CBasePlayer *pPlayer) = 0;
// Client spawn/respawn control
virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0;
virtual void PlayerThink(CBasePlayer *pPlayer) = 0;
virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0;
virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer) = 0;
virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer) = 0;
virtual BOOL AllowAutoTargetCrosshair() = 0;
// Client kills/scoring
virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0;
virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;
virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;
// Weapon retrieval
virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
// Weapon spawn/respawn control
virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon) = 0;
virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon) = 0;
virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon) = 0;
virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) = 0;
// Item retrieval
virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
// Item spawn/respawn control
virtual int ItemShouldRespawn(CItem *pItem) = 0;
virtual float FlItemRespawnTime(CItem *pItem) = 0;
virtual Vector VecItemRespawnSpot(CItem *pItem) = 0;
// Ammo retrieval
virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) = 0;
// Ammo spawn/respawn control
virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0;
virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) = 0;
virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) = 0;
// Healthcharger respawn control
virtual float FlHealthChargerRechargeTime() = 0;
// What happens to a dead player's weapons
virtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0;
// What happens to a dead player's ammo
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0;
// Teamplay stuff
virtual const char *GetTeamID(CBaseEntity *pEntity) = 0;
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0;
// Monsters
virtual BOOL FAllowMonsters() = 0;
};
// CHalfLifeMultiplay - rules for the basic half life multiplayer competition
class CHalfLifeMultiplay: public CGameRules {
protected:
virtual ~CHalfLifeMultiplay() {};
public:
virtual void RefreshSkillData() = 0;
virtual void Think() = 0;
virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0;
virtual BOOL FAllowFlashlight() = 0;
virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) = 0;
virtual BOOL IsMultiplayer() = 0;
virtual BOOL IsDeathmatch() = 0;
virtual BOOL IsCoOp() = 0;
// Client connection/disconnection
// If ClientConnected returns FALSE, the connection is rejected and the user is provided the reason specified in szRejectReason
// Only the client's name and remote address are provided to the dll for verification.
virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]) = 0;
virtual void InitHUD(CBasePlayer *pl) = 0;
virtual void ClientDisconnected(edict_t *pClient) = 0;
virtual void UpdateGameMode(CBasePlayer *pPlayer) = 0;
// Client damage rules
virtual float FlPlayerFallDamage(CBasePlayer *pPlayer) = 0;
virtual BOOL FPlayerCanTakeDamage(CBasePlayer *pPlayer, CBaseEntity *pAttacker) = 0;
// Client spawn/respawn control
virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0;
virtual void PlayerThink(CBasePlayer *pPlayer) = 0;
virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0;
virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer) = 0;
virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer) = 0;
virtual BOOL AllowAutoTargetCrosshair() = 0;
virtual BOOL ClientCommand_DeadOrAlive(CBasePlayer *pPlayer, const char *pcmd) = 0;
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0;
virtual void ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer) = 0;
// Client kills/scoring
virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0;
virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;
virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0;
// Weapon retrieval
virtual BOOL CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0;
// Weapon spawn/respawn control
virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon) = 0;
virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon) = 0;
virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon) = 0;
virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) = 0;
// Item retrieval
virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) = 0;
// Item spawn/respawn control
virtual int ItemShouldRespawn(CItem *pItem) = 0;
virtual float FlItemRespawnTime(CItem *pItem) = 0;
virtual Vector VecItemRespawnSpot(CItem *pItem) = 0;
// Ammo retrieval
virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) = 0;
// Ammo spawn/respawn control
virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0;
virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) = 0;
virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) = 0;
// Healthcharger respawn control
virtual float FlHealthChargerRechargeTime() = 0;
virtual float FlHEVChargerRechargeTime() = 0;
// What happens to a dead player's weapons
virtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0;
// What happens to a dead player's ammo
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0;
// Teamplay stuff
virtual const char *GetTeamID(CBaseEntity *pEntity) = 0;
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0;
virtual BOOL PlayTextureSounds() = 0;
// Monsters
virtual BOOL FAllowMonsters() = 0;
// Immediately end a multiplayer game
virtual void EndMultiplayerGame() = 0;
virtual void ServerDeactivate() = 0;
virtual void CheckMapConditions() = 0;
// Recreate all the map entities from the map data (preserving their indices),
// then remove everything else except the players.
// Also get rid of all world decals.
virtual void CleanUpMap() = 0;
virtual void RestartRound() = 0;
// check if the scenario has been won/lost
virtual void CheckWinConditions() = 0;
virtual void RemoveGuns() = 0;
virtual void GiveC4() = 0;
virtual void ChangeLevel() = 0;
virtual void GoToIntermission() = 0;
// Setup counts for m_iNumTerrorist, m_iNumCT, m_iNumSpawnableTerrorist, m_iNumSpawnableCT, etc.
virtual void InitializePlayerCounts(int &NumAliveTerrorist, int &NumAliveCT, int &NumDeadTerrorist, int &NumDeadCT) = 0;
virtual void BalanceTeams() = 0;
virtual void SwapAllPlayers() = 0;
virtual void UpdateTeamScores() = 0;
virtual void EndRoundMessage(const char *sentence, int event) = 0;
virtual void SetAccountRules(RewardRules rules, int amount) = 0;
virtual RewardAccount GetAccountRules(RewardRules rules) const = 0;
// BOMB MAP FUNCTIONS
virtual BOOL IsThereABomber() = 0;
virtual BOOL IsThereABomb() = 0;
virtual TeamName SelectDefaultTeam() = 0;
virtual bool HasRoundTimeExpired() = 0;
virtual bool IsBombPlanted() = 0;
public:
bool ShouldSkipShowMenu() const { return m_bSkipShowMenu; }
void MarkShowMenuSkipped() { m_bSkipShowMenu = false; }
bool ShouldSkipSpawn() const { return m_bSkipSpawn; }
void MarkSpawnSkipped() { m_bSkipSpawn = false; }
float TimeRemaining() { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundCount; }
bool IsMatchStarted() { return (m_fTeamCount != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); }
inline void TerminateRound(float tmDelay, int iWinStatus)
{
m_iRoundWinStatus = iWinStatus;
m_fTeamCount = gpGlobals->time + tmDelay;
m_bRoundTerminating = true;
}
public:
CVoiceGameMgr m_VoiceGameMgr;
float m_fTeamCount; // m_flRestartRoundTime, the global time when the round is supposed to end, if this is not 0
float m_flCheckWinConditions;
float m_fRoundCount;
int m_iRoundTime; // (From mp_roundtime) - How many seconds long this round is.
int m_iRoundTimeSecs;
int m_iIntroRoundTime; // (From mp_freezetime) - How many seconds long the intro round (when players are frozen) is.
float m_fIntroRoundCount; // The global time when the intro round ends and the real one starts
// wrote the original "m_flRoundTime" comment for this variable).
int m_iAccountTerrorist;
int m_iAccountCT;
int m_iNumTerrorist; // The number of terrorists on the team (this is generated at the end of a round)
int m_iNumCT; // The number of CTs on the team (this is generated at the end of a round)
int m_iNumSpawnableTerrorist;
int m_iNumSpawnableCT;
int m_iSpawnPointCount_Terrorist; // Number of Terrorist spawn points
int m_iSpawnPointCount_CT; // Number of CT spawn points
int m_iHostagesRescued;
int m_iHostagesTouched;
int m_iRoundWinStatus; // 1 == CT's won last round, 2 == Terrorists did, 3 == Draw, no winner
short m_iNumCTWins;
short m_iNumTerroristWins;
bool m_bTargetBombed; // whether or not the bomb has been bombed
bool m_bBombDefused; // whether or not the bomb has been defused
bool m_bMapHasBombTarget;
bool m_bMapHasBombZone;
bool m_bMapHasBuyZone;
bool m_bMapHasRescueZone;
bool m_bMapHasEscapeZone;
int m_iMapHasVIPSafetyZone; // 0 = uninitialized; 1 = has VIP safety zone; 2 = DOES not have VIP safetyzone
int m_bMapHasCameras;
int m_iC4Timer;
int m_iC4Guy; // The current Terrorist who has the C4.
int m_iLoserBonus; // the amount of money the losing team gets. This scales up as they lose more rounds in a row
int m_iNumConsecutiveCTLoses; // the number of rounds the CTs have lost in a row.
int m_iNumConsecutiveTerroristLoses; // the number of rounds the Terrorists have lost in a row.
float m_fMaxIdlePeriod; // For the idle kick functionality. This is tha max amount of time that the player has to be idle before being kicked
int m_iLimitTeams;
bool m_bLevelInitialized;
bool m_bRoundTerminating;
bool m_bCompleteReset; // Set to TRUE to have the scores reset next time round restarts
float m_flRequiredEscapeRatio;
int m_iNumEscapers;
int m_iHaveEscaped;
bool m_bCTCantBuy;
bool m_bTCantBuy; // Who can and can't buy.
float m_flBombRadius;
int m_iConsecutiveVIP;
int m_iTotalGunCount;
int m_iTotalGrenadeCount;
int m_iTotalArmourCount;
int m_iUnBalancedRounds; // keeps track of the # of consecutive rounds that have gone by where one team outnumbers the other team by more than 2
int m_iNumEscapeRounds; // keeps track of the # of consecutive rounds of escape played.. Teams will be swapped after 8 rounds
int m_iMapVotes[MAX_VOTE_MAPS];
int m_iLastPick;
int m_iMaxMapTime;
int m_iMaxRounds;
int m_iTotalRoundsPlayed;
int m_iMaxRoundsWon;
int m_iStoredSpectValue;
float m_flForceCameraValue;
float m_flForceChaseCamValue;
float m_flFadeToBlackValue;
CBasePlayer *m_pVIP;
CBasePlayer *m_pVIPQueue[MAX_VIP_QUEUES];
float m_flIntermissionEndTime;
float m_flIntermissionStartTime;
BOOL m_iEndIntermissionButtonHit;
float m_tmNextPeriodicThink;
bool m_bFirstConnected;
bool m_bInCareerGame;
float m_fCareerRoundMenuTime;
int m_iCareerMatchWins;
int m_iRoundWinDifference;
float m_fCareerMatchMenuTime;
bool m_bSkipSpawn;
// custom
bool m_bSkipShowMenu;
bool m_bNeededPlayers;
float m_flEscapeRatio;
};
typedef struct mapcycle_item_s
{
struct mapcycle_item_s *next;
char mapname[32];
int minplayers;
int maxplayers;
char rulebuffer[MAX_RULE_BUFFER];
} mapcycle_item_t;
typedef struct mapcycle_s
{
struct mapcycle_item_s *items;
struct mapcycle_item_s *next_item;
} mapcycle_t;
class CCStrikeGameMgrHelper: public IVoiceGameMgrHelper {
public:
virtual bool CanPlayerHearPlayer(CBasePlayer *pListener, CBasePlayer *pSender) = 0;
};
extern CGameRules *g_pGameRules;
inline CHalfLifeMultiplay *CSGameRules()
{
return reinterpret_cast<CHalfLifeMultiplay *>(g_pGameRules);
}

View File

@ -0,0 +1,45 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
class CRecharge: public CBaseToggle {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
float m_flNextCharge;
int m_iReactivate;
int m_iJuice;
int m_iOn;
float m_flSoundTime;
};

View File

@ -0,0 +1,104 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
class CCycler: public CBaseMonster {
public:
virtual void Spawn() = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
// Don't treat as a live target
virtual BOOL IsAlive() = 0;
virtual void Think() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
int m_animate;
};
// we should get rid of all the other cyclers and replace them with this.
class CGenericCycler: public CCycler {
public:
virtual void Spawn() = 0;
};
// Probe droid imported for tech demo compatibility
class CCyclerProbe: public CCycler {
public:
virtual void Spawn() = 0;
};
class CCyclerSprite: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual void Restart() = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual void Think() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
inline int ShouldAnimate() { return (m_animate && m_maxFrame > 1.0f); }
public:
int m_animate;
float m_lastTime;
float m_maxFrame;
int m_renderfx;
int m_rendermode;
float m_renderamt;
vec3_t m_rendercolor;
};
class CWeaponCycler: public CBasePlayerWeapon {
public:
virtual void Spawn() = 0;
virtual int GetItemInfo(ItemInfo *p) = 0;
virtual BOOL Deploy() = 0;
virtual void Holster(int skiplocal = 0) = 0;
virtual int iItemSlot() = 0;
virtual void PrimaryAttack() = 0;
virtual void SecondaryAttack() = 0;
public:
int m_iszModel;
int m_iModel;
};
// Flaming Wreakage
class CWreckage: public CBaseMonster {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void Think() = 0;
public:
int m_flStartTime;
};

View File

@ -0,0 +1,52 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
class CHealthKit: public CItem {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL MyTouch(CBasePlayer *pPlayer) = 0;
};
class CWallHealth: public CBaseToggle {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
float m_flNextCharge;
int m_iReactivate;
int m_iJuice;
int m_iOn;
float m_flSoundTime;
};

View File

@ -0,0 +1,81 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#include "utlvector.h"
#define DHF_ROUND_STARTED (1<<1)
#define DHF_HOSTAGE_SEEN_FAR (1<<2)
#define DHF_HOSTAGE_SEEN_NEAR (1<<3)
#define DHF_HOSTAGE_USED (1<<4)
#define DHF_HOSTAGE_INJURED (1<<5)
#define DHF_HOSTAGE_KILLED (1<<6)
#define DHF_FRIEND_SEEN (1<<7)
#define DHF_ENEMY_SEEN (1<<8)
#define DHF_FRIEND_INJURED (1<<9)
#define DHF_FRIEND_KILLED (1<<10)
#define DHF_ENEMY_KILLED (1<<11)
#define DHF_BOMB_RETRIEVED (1<<12)
#define DHF_AMMO_EXHAUSTED (1<<15)
#define DHF_IN_TARGET_ZONE (1<<16)
#define DHF_IN_RESCUE_ZONE (1<<17)
#define DHF_IN_ESCAPE_ZONE (1<<18)
#define DHF_IN_VIPSAFETY_ZONE (1<<19)
#define DHF_NIGHTVISION (1<<20)
#define DHF_HOSTAGE_CTMOVE (1<<21)
#define DHF_SPEC_DUCK (1<<22)
#define DHM_ROUND_CLEAR (DHF_ROUND_STARTED | DHF_HOSTAGE_KILLED | DHF_FRIEND_KILLED | DHF_BOMB_RETRIEVED)
#define DHM_CONNECT_CLEAR (DHF_HOSTAGE_SEEN_FAR | DHF_HOSTAGE_SEEN_NEAR | DHF_HOSTAGE_USED | DHF_HOSTAGE_INJURED | DHF_FRIEND_SEEN | DHF_ENEMY_SEEN | DHF_FRIEND_INJURED | DHF_ENEMY_KILLED | DHF_AMMO_EXHAUSTED | DHF_IN_TARGET_ZONE | DHF_IN_RESCUE_ZONE | DHF_IN_ESCAPE_ZONE | DHF_IN_VIPSAFETY_ZONE | DHF_HOSTAGE_CTMOVE | DHF_SPEC_DUCK)
class CHintMessage {
public:
CHintMessage(const char *hintString, bool isHint, CUtlVector<const char *> *args, float duration);
~CHintMessage();
public:
float GetDuration() const { return m_duration; }
void Send(CBaseEntity *client);
private:
const char *m_hintString;
bool m_isHint;
CUtlVector<char *> m_args;
float m_duration;
};
class CHintMessageQueue {
public:
void Reset();
void Update(CBaseEntity *client);
bool AddMessage(const char *message, float duration, bool isHint, CUtlVector<const char *> *args);
bool IsEmpty() const { return m_messages.Count() == 0; }
private:
float m_tmMessageEnd;
CUtlVector<CHintMessage *> m_messages;
};

View File

@ -0,0 +1,110 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
template<typename t_ret, typename ...t_args>
class IHookChain {
protected:
virtual ~IHookChain() {}
public:
virtual t_ret callNext(t_args... args) = 0;
virtual t_ret callOriginal(t_args... args) = 0;
};
template<typename t_ret, typename t_class, typename ...t_args>
class IHookChainClass {
protected:
virtual ~IHookChainClass() {}
public:
virtual t_ret callNext(t_class *, t_args... args) = 0;
virtual t_ret callOriginal(t_class *, t_args... args) = 0;
};
template<typename ...t_args>
class IVoidHookChain
{
protected:
virtual ~IVoidHookChain() {}
public:
virtual void callNext(t_args... args) = 0;
virtual void callOriginal(t_args... args) = 0;
};
template<typename t_class, typename ...t_args>
class IVoidHookChainClass
{
protected:
virtual ~IVoidHookChainClass() {}
public:
virtual void callNext(t_class *, t_args... args) = 0;
virtual void callOriginal(t_class *, t_args... args) = 0;
};
// Hook chain registry(for hooks [un]registration)
template<typename t_ret, typename ...t_args>
class IHookChainRegistry {
public:
typedef t_ret(*hookfunc_t)(IHookChain<t_ret, t_args...>*, t_args...);
virtual void registerHook(hookfunc_t hook) = 0;
virtual void unregisterHook(hookfunc_t hook) = 0;
};
// Hook chain registry(for hooks [un]registration)
template<typename t_ret, typename t_class, typename ...t_args>
class IHookChainRegistryClass {
public:
typedef t_ret(*hookfunc_t)(IHookChainClass<t_ret, t_class, t_args...>*, t_class *, t_args...);
virtual void registerHook(hookfunc_t hook) = 0;
virtual void unregisterHook(hookfunc_t hook) = 0;
};
// Hook chain registry(for hooks [un]registration)
template<typename ...t_args>
class IVoidHookChainRegistry {
public:
typedef void(*hookfunc_t)(IVoidHookChain<t_args...>*, t_args...);
virtual void registerHook(hookfunc_t hook) = 0;
virtual void unregisterHook(hookfunc_t hook) = 0;
};
// Hook chain registry(for hooks [un]registration)
template<typename t_class, typename ...t_args>
class IVoidHookChainRegistryClass {
public:
typedef void(*hookfunc_t)(IVoidHookChainClass<t_class, t_args...>*, t_class *, t_args...);
virtual void registerHook(hookfunc_t hook) = 0;
virtual void unregisterHook(hookfunc_t hook) = 0;
};

View File

@ -0,0 +1,232 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
// Improved the hostages from CZero
#include "hostage/hostage_improv.h"
#define MAX_NODES 100
#define MAX_HOSTAGES 12
#define MAX_HOSTAGES_NAV 20
#define HOSTAGE_STEPSIZE 26.0f
#define HOSTAGE_STEPSIZE_DEFAULT 18.0f
#define VEC_HOSTAGE_VIEW Vector(0, 0, 12)
#define VEC_HOSTAGE_HULL_MIN Vector(-10, -10, 0)
#define VEC_HOSTAGE_HULL_MAX Vector(10, 10, 62)
#define VEC_HOSTAGE_CROUCH Vector(10, 10, 30)
#define RESCUE_HOSTAGES_RADIUS 256.0f // rescue zones from legacy info_*
class CHostage;
class CLocalNav;
class CHostageImprov;
class CHostageManager;
enum HostageChatterType
{
HOSTAGE_CHATTER_START_FOLLOW = 0,
HOSTAGE_CHATTER_STOP_FOLLOW,
HOSTAGE_CHATTER_INTIMIDATED,
HOSTAGE_CHATTER_PAIN,
HOSTAGE_CHATTER_SCARED_OF_GUNFIRE,
HOSTAGE_CHATTER_SCARED_OF_MURDER,
HOSTAGE_CHATTER_LOOK_OUT,
HOSTAGE_CHATTER_PLEASE_RESCUE_ME,
HOSTAGE_CHATTER_SEE_RESCUE_ZONE,
HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE,
HOSTAGE_CHATTER_CTS_WIN ,
HOSTAGE_CHATTER_TERRORISTS_WIN,
HOSTAGE_CHATTER_RESCUED,
HOSTAGE_CHATTER_WARN_NEARBY,
HOSTAGE_CHATTER_WARN_SPOTTED,
HOSTAGE_CHATTER_CALL_TO_RESCUER,
HOSTAGE_CHATTER_RETREAT,
HOSTAGE_CHATTER_COUGH,
HOSTAGE_CHATTER_BLINDED,
HOSTAGE_CHATTER_SAW_HE_GRENADE,
HOSTAGE_CHATTER_DEATH_CRY,
NUM_HOSTAGE_CHATTER_TYPES,
};
extern CHostageManager *g_pHostages;
extern int g_iHostageNumber;
// A Counter-Strike Hostage Simple
class CHostage: public CBaseMonster {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual int ObjectCaps() = 0; // make hostage "useable"
virtual int Classify() = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual int BloodColor() = 0;
virtual void Touch(CBaseEntity *pOther) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
int GetActivity() { return m_Activity; }
// queries
bool IsFollowingSomeone() { return IsFollowing(); }
CBaseEntity *GetLeader() // return our leader, or NULL
{
if (m_improv != NULL)
{
return m_improv->GetFollowLeader();
}
return m_hTargetEnt;
}
bool IsFollowing(const CBaseEntity *entity = NULL)
{
if (m_improv != NULL)
{
return m_improv->IsFollowing();
}
if (entity == NULL && m_hTargetEnt == NULL || (entity != NULL && m_hTargetEnt != entity))
return false;
if (m_State != FOLLOW)
return false;
return true;
}
bool IsValid() { return (pev->takedamage == DAMAGE_YES); }
bool IsDead() { return (pev->deadflag == DEAD_DEAD); }
bool IsAtHome() { return (pev->origin - m_vStart).IsLengthGreaterThan(20) != true; }
const Vector *GetHomePosition() { return &m_vStart; }
public:
int m_Activity;
BOOL m_bTouched;
BOOL m_bRescueMe;
float m_flFlinchTime;
float m_flNextChange;
float m_flMarkPosition;
int m_iModel;
int m_iSkin;
float m_flNextRadarTime;
enum state { FOLLOW, STAND, DUCK, SCARED, IDLE, FOLLOWPATH }
m_State;
Vector m_vStart;
Vector m_vStartAngles;
Vector m_vPathToFollow[20];
int m_iWaypoint;
CBasePlayer *m_target;
CLocalNav *m_LocalNav;
int nTargetNode;
Vector vecNodes[MAX_NODES];
EHANDLE m_hStoppedTargetEnt;
float m_flNextFullThink;
float m_flPathCheckInterval;
float m_flLastPathCheck;
int m_nPathNodes;
BOOL m_fHasPath;
float m_flPathAcquired;
Vector m_vOldPos;
int m_iHostageIndex;
BOOL m_bStuck;
float m_flStuckTime;
CHostageImprov *m_improv;
enum ModelType { REGULAR_GUY, OLD_GUY, BLACK_GUY, GOOFY_GUY }
m_whichModel;
};
class SimpleChatter {
public:
struct SoundFile
{
char *filename;
float duration;
};
struct ChatterSet
{
SoundFile file[32];
int count;
int index;
bool needsShuffle;
};
private:
ChatterSet m_chatter[21];
};
class CHostageManager {
public:
SimpleChatter *GetChatter()
{
return &m_chatter;
}
// Iterate over all active hostages in the game, invoking functor on each.
// If functor returns false, stop iteration and return false.
template<typename Functor>
inline bool ForEachHostage(Functor &func) const
{
for (int i = 0; i < m_hostageCount; i++)
{
CHostage *hostage = m_hostage[i];
if (hostage == NULL || hostage->pev->deadflag == DEAD_DEAD)
continue;
if (func(hostage) == false)
return false;
}
return true;
}
inline CHostage *GetClosestHostage(const Vector &pos, float *resultRange = NULL)
{
float range;
float closeRange = 1e8f;
CHostage *close = NULL;
for (int i = 0; i < m_hostageCount; i++)
{
range = (m_hostage[i]->pev->origin - pos).Length();
if (range < closeRange)
{
closeRange = range;
close = m_hostage[i];
}
}
if (resultRange)
*resultRange = closeRange;
return close;
}
private:
CHostage *m_hostage[MAX_HOSTAGES];
int m_hostageCount;
SimpleChatter m_chatter;
};

View File

@ -0,0 +1,331 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#include "hostage/hostage.h"
#include "hostage/hostage_states.h"
class CHostage;
enum HostageChatterType;
// A Counter-Strike Hostage improved
class CHostageImprov: public CImprov {
public:
// invoked when an improv reaches its MoveTo goal
virtual void OnMoveToSuccess(const Vector &goal) = 0;
// invoked when an improv fails to reach a MoveTo goal
virtual void OnMoveToFailure(const Vector &goal, MoveToFailureType reason) = 0;
virtual void OnInjury(float amount) = 0;
virtual bool IsAlive() const = 0;
virtual void MoveTo(const Vector &goal) = 0;
virtual void LookAt(const Vector &target) = 0;
virtual void ClearLookAt() = 0;
virtual void FaceTo(const Vector &goal) = 0;
virtual void ClearFaceTo() = 0;
virtual bool IsAtMoveGoal(float error = 20.0f) const = 0;
virtual bool HasLookAt() const = 0;
virtual bool HasFaceTo() const = 0;
virtual bool IsAtFaceGoal() const = 0;
virtual bool IsFriendInTheWay(const Vector &goalPos) const = 0;
virtual bool IsFriendInTheWay(CBaseEntity *myFriend, const Vector &goalPos) const = 0;
virtual void MoveForward() = 0;
virtual void MoveBackward() = 0;
virtual void StrafeLeft() = 0;
virtual void StrafeRight() = 0;
#define HOSTAGE_MUST_JUMP true
virtual bool Jump() = 0;
virtual void Crouch() = 0;
virtual void StandUp() = 0;
virtual void TrackPath(const Vector &pathGoal, float deltaT) = 0; // move along path by following "pathGoal"
virtual void StartLadder(const CNavLadder *ladder, NavTraverseType how, const Vector *approachPos, const Vector *departPos) = 0;
virtual bool TraverseLadder(const CNavLadder *ladder, NavTraverseType how, const Vector *approachPos, const Vector *departPos, float deltaT) = 0;
virtual bool GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal = NULL) = 0;
virtual void Run() = 0;
virtual void Walk() = 0;
virtual void Stop() = 0;
virtual float GetMoveAngle() const = 0;
virtual float GetFaceAngle() const = 0;
virtual const Vector &GetFeet() const = 0;
virtual const Vector &GetCentroid() const = 0;
virtual const Vector &GetEyes() const = 0;
virtual bool IsRunning() const = 0;
virtual bool IsWalking() const = 0;
virtual bool IsStopped() const = 0;
virtual bool IsCrouching() const = 0;
virtual bool IsJumping() const = 0;
virtual bool IsUsingLadder() const = 0;
virtual bool IsOnGround() const = 0;
virtual bool IsMoving() const = 0;
virtual bool CanRun() const = 0;
virtual bool CanCrouch() const = 0;
virtual bool CanJump() const = 0;
virtual bool IsVisible(const Vector &pos, bool testFOV = false) const = 0; // return true if hostage can see position
virtual bool IsPlayerLookingAtMe(CBasePlayer *other, float cosTolerance = 0.95f) const = 0;
virtual CBasePlayer *IsAnyPlayerLookingAtMe(int team = 0, float cosTolerance = 0.95f) const = 0;
virtual CBasePlayer *GetClosestPlayerByTravelDistance(int team = 0, float *range = NULL) const = 0;
virtual CNavArea *GetLastKnownArea() const = 0;
virtual void OnUpdate(float deltaT) = 0;
virtual void OnUpkeep(float deltaT) = 0;
virtual void OnReset() = 0;
virtual void OnGameEvent(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL) = 0;
virtual void OnTouch(CBaseEntity *other) = 0; // in contact with "other"
public:
enum MoveType { Stopped, Walking, Running };
enum ScareType { NERVOUS, SCARED, TERRIFIED };
const Vector &GetKnownGoodPosition() const { return m_knownGoodPos; }
void ApplyForce(Vector force) { m_vel.x += force.x; m_vel.y += force.y; } // apply a force to the hostage
const Vector GetActualVelocity() const { return m_actualVel; }
void SetMoveLimit(MoveType limit) { m_moveLimit = limit; }
MoveType GetMoveLimit() const { return m_moveLimit; }
CNavPath *GetPath() { return &m_path; }
// hostage states
// stand idle
void Idle() { m_behavior.SetState(&m_idleState); }
bool IsIdle() const { return m_behavior.IsState(&m_idleState); }
// begin following "leader"
void Follow(CBasePlayer *leader) { m_followState.SetLeader(leader); m_behavior.SetState(&m_followState); }
bool IsFollowing(const CBaseEntity *leader = NULL) const { return m_behavior.IsState(&m_followState); }
// Escape
void Escape() { m_behavior.SetState(&m_escapeState); }
bool IsEscaping() const { return m_behavior.IsState(&m_escapeState); }
// Retreat
void Retreat() { m_behavior.SetState(&m_retreatState); }
bool IsRetreating() const { return m_behavior.IsState(&m_retreatState); }
CBaseEntity *GetFollowLeader() const { return m_followState.GetLeader(); }
ScareType GetScareIntensity() const { return m_scareIntensity; }
bool IsIgnoringTerrorists() const { return m_ignoreTerroristTimer.IsElapsed(); }
float GetAggression() const { return m_aggression; }
bool IsTalking() const { return m_talkingTimer.IsElapsed(); }
CHostage *GetEntity() const { return m_hostage; }
void SetMoveAngle(float angle) { m_moveAngle = angle; }
public:
CountdownTimer m_coughTimer;
CountdownTimer m_grenadeTimer;
private:
CHostage *m_hostage;
CNavArea *m_lastKnownArea; // last area we were in
mutable Vector m_centroid;
mutable Vector m_eye;
HostageStateMachine m_behavior;
HostageIdleState m_idleState;
HostageEscapeState m_escapeState;
HostageRetreatState m_retreatState;
HostageFollowState m_followState;
HostageAnimateState m_animateState;
bool m_didFidget;
float m_aggression;
IntervalTimer m_lastSawCT;
IntervalTimer m_lastSawT;
CountdownTimer m_checkNearbyTerroristTimer;
bool m_isTerroristNearby;
CountdownTimer m_nearbyTerroristTimer;
CountdownTimer m_scaredTimer;
ScareType m_scareIntensity;
CountdownTimer m_ignoreTerroristTimer;
CountdownTimer m_blinkTimer;
char m_blinkCounter;
IntervalTimer m_lastInjuryTimer;
IntervalTimer m_lastNoiseTimer;
mutable CountdownTimer m_avoidFriendTimer;
mutable bool m_isFriendInTheWay;
CountdownTimer m_chatterTimer;
bool m_isDelayedChatterPending;
CountdownTimer m_delayedChatterTimer;
HostageChatterType m_delayedChatterType;
bool m_delayedChatterMustSpeak;
CountdownTimer m_talkingTimer;
unsigned int m_moveFlags;
Vector2D m_vel;
Vector m_actualVel;
Vector m_moveGoal;
Vector m_knownGoodPos;
bool m_hasKnownGoodPos;
Vector m_priorKnownGoodPos;
bool m_hasPriorKnownGoodPos;
CountdownTimer m_priorKnownGoodPosTimer;
IntervalTimer m_collisionTimer;
Vector m_viewGoal;
bool m_isLookingAt;
Vector m_faceGoal;
bool m_isFacingTo;
CNavPath m_path; // current path to follow
CNavPathFollower m_follower;
Vector m_lastPosition;
MoveType m_moveType;
MoveType m_moveLimit;
bool m_isCrouching; // true if hostage is crouching
CountdownTimer m_minCrouchTimer;
float m_moveAngle;
NavRelativeDirType m_wiggleDirection;
CountdownTimer m_wiggleTimer; // for wiggling
CountdownTimer m_wiggleJumpTimer;
CountdownTimer m_inhibitObstacleAvoidance;
CountdownTimer m_jumpTimer; // if zero, we can jump
bool m_hasJumped;
bool m_hasJumpedIntoAir;
Vector m_jumpTarget;
CountdownTimer m_clearPathTimer;
bool m_traversingLadder;
EHANDLE m_visiblePlayer[MAX_CLIENTS];
int m_visiblePlayerCount;
CountdownTimer m_visionTimer;
};
class CheckWayFunctor {
public:
CheckWayFunctor(const CHostageImprov *me, const Vector &goalPos)
{
m_me = me;
m_goalPos = goalPos;
m_blocker = NULL;
}
bool operator()(CHostage *them)
{
if (((CBaseMonster *)them)->IsAlive() && m_me->IsFriendInTheWay((CBaseEntity *)them, m_goalPos))
{
m_blocker = them;
return false;
}
return true;
}
const CHostageImprov *m_me;
Vector m_goalPos;
CHostage *m_blocker;
};
// Functor used with NavAreaBuildPath() for building Hostage paths.
// Once we hook up crouching and ladders, this can be removed and ShortestPathCost() can be used instead.
class HostagePathCost {
public:
float operator()(CNavArea *area, CNavArea *fromArea, const CNavLadder *ladder)
{
if (fromArea == NULL)
{
// first area in path, no cost
return 0.0f;
}
else
{
// compute distance travelled along path so far
float dist;
if (ladder != NULL)
{
const float ladderCost = 10.0f;
return ladder->m_length * ladderCost + fromArea->GetCostSoFar();
}
else
{
dist = (*area->GetCenter() - *fromArea->GetCenter()).Length();
}
float cost = dist + fromArea->GetCostSoFar();
// if this is a "crouch" area, add penalty
if (area->GetAttributes() & NAV_CROUCH)
{
const float crouchPenalty = 10.0f;
cost += crouchPenalty * dist;
}
// if this is a "jump" area, add penalty
if (area->GetAttributes() & NAV_JUMP)
{
const float jumpPenalty = 10.0f;
cost += jumpPenalty * dist;
}
return cost;
}
}
};
class KeepPersonalSpace {
public:
KeepPersonalSpace(CHostageImprov *improv)
{
m_improv = improv;
m_velDir = improv->GetActualVelocity();
m_speed = m_velDir.NormalizeInPlace();
}
bool operator()(CBaseEntity *entity)
{
const float space = 1.0f;
Vector to;
float range;
if (entity == reinterpret_cast<CBaseEntity *>(m_improv->GetEntity()))
return true;
if (entity->IsPlayer() && !entity->IsAlive())
return true;
to = entity->pev->origin - m_improv->GetCentroid();
range = to.NormalizeInPlace();
CBasePlayer *player = static_cast<CBasePlayer *>(entity);
const float spring = 50.0f;
const float damper = 1.0f;
if (range >= spring)
return true;
const float cosTolerance = 0.8f;
if (entity->IsPlayer() && player->m_iTeam == CT && !m_improv->IsFollowing() && m_improv->IsPlayerLookingAtMe(player, cosTolerance))
return true;
const float minSpace = (spring - range);
float ds = -minSpace;
m_improv->ApplyForce(to * ds);
const float force = 0.1f;
m_improv->ApplyForce(m_speed * -force * m_velDir);
return true;
}
private:
CHostageImprov *m_improv;
Vector m_velDir;
float m_speed;
};

View File

@ -0,0 +1,58 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#define NODE_INVALID_EMPTY -1
#define PATH_TRAVERSABLE_EMPTY 0
#define PATH_TRAVERSABLE_SLOPE 1
#define PATH_TRAVERSABLE_STEP 2
#define PATH_TRAVERSABLE_STEPJUMPABLE 3
typedef int node_index_t;
typedef struct localnode_s
{
Vector vecLoc;
int offsetX;
int offsetY;
byte bDepth;
BOOL fSearched;
node_index_t nindexParent;
} localnode_t;
class CLocalNav {
private:
CHostage *m_pOwner;
edict_t *m_pTargetEnt;
BOOL m_fTargetEntHit;
localnode_t *m_nodeArr;
node_index_t m_nindexAvailableNode;
Vector m_vecStartingLoc;
};

Some files were not shown because too many files have changed in this diff Show More