Valve progs boots now.

More restructuring.
This commit is contained in:
Marco Cawthorne 2019-01-21 03:00:14 +01:00
parent 23272fda23
commit 63efe2b147
68 changed files with 2576 additions and 1778 deletions

View file

@ -1,284 +1,665 @@
===============================================================================
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are 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.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
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 make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
TERMS AND CONDITIONS
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
0. Definitions.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
"This License" refers to version 3 of the GNU Affero General Public License.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
"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.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
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) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
A "covered work" means either the unmodified Program or a work based
on the Program.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
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.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
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.
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
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.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
1. Source Code.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
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.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
A "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.
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
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.
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
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.
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
The Corresponding Source for a work in source code form is that
same work.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
2. Basic Permissions.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
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.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
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.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
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.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
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
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
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.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
13. Remote Network Interaction; Use with the GNU General Public License.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this 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 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 work with which it is combined will remain governed by version
3 of the GNU General Public License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
14. Revised Versions of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero 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 Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero 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.
NO WARRANTY
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.
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
15. Disclaimer of Warranty.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
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 Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
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 AGPL, see
<https://www.gnu.org/licenses/>.
===============================================================================

View file

@ -13,6 +13,12 @@
../events.h
../entities.h
cstrike/defs.h
defs.h
vgui.h
hud_voice.c
sound.c
text.c
../shared/cstrike/weaponak47.c
../shared/cstrike/weaponaug.c
@ -46,15 +52,19 @@ cstrike/defs.h
../shared/cstrike/radio.c
../shared/cstrike/equipment.c
../shared/cstrike/animations.c
../shared/effects.c
../shared/pmove.c
../gs-entbase/client.src
../shared/effects.c
../shared/spraylogo.cpp
cstrike/overview.c
cstrike/player.c
player.c
predict.c
events.c
cstrike/view.c
view.c
cstrike/vguiobjects.c
cstrike/vguispectator.c
cstrike/vguiscoreboard.c
@ -63,17 +73,19 @@ cstrike/vguibuymenu.c
cstrike/vguiteamselect.c
cstrike/vguiradio.c
cstrike/vgui.c
cstrike/damage.c
damage.c
cstrike/nightvision.c
cstrike/hudcrosshair.c
cstrike/hudscope.c
cstrike/hudweaponselect.c
cstrike/hudorbituaries.c
cstrike/hud.c
cstrike/sound.c
cstrike/draw.c
cstrike/entities.c
cstrike/event.c
cstrike/init.c
entities.c
entry.c
#endlist

View file

@ -1,44 +0,0 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
var float g_flDamageAlpha;
var vector g_vecDamageLocation;
void Damage_Draw(void)
{
if ( g_flDamageAlpha > 0.0f ) {
vector vecMiddle = [ vVideoResolution[0] / 2, vVideoResolution[1] / 2 ];
makevectors( getproperty( VF_CL_VIEWANGLES ) );
vector location = normalize( g_vecDamageLocation - getproperty( VF_ORIGIN ) );
float fForward = dotproduct( location, v_forward );
float fRight = dotproduct( location, v_right );
if ( fForward > 0.25 ) {
drawpic( vecMiddle + [-64,-70 - 32], "sprites/640_pain.spr_0.tga", [128,48], [1,1,1], fabs( fForward ) * g_flDamageAlpha, DRAWFLAG_ADDITIVE );
} else if ( fForward < -0.25 ) {
drawpic( vecMiddle + [-64,70], "sprites/640_pain.spr_2.tga", [128,48], [1,1,1], fabs( fForward ) * g_flDamageAlpha, DRAWFLAG_ADDITIVE );
}
if ( fRight > 0.25 ) {
drawpic( vecMiddle + [70,-64], "sprites/640_pain.spr_1.tga", [48,128], [1,1,1], fabs( fRight ) * g_flDamageAlpha, DRAWFLAG_ADDITIVE );
} else if ( fRight < -0.25 ) {
drawpic( vecMiddle + [-70 - 32,-64], "sprites/640_pain.spr_3.tga", [48,128], [1,1,1], fabs( fRight ) * g_flDamageAlpha, DRAWFLAG_ADDITIVE );
}
g_flDamageAlpha -= frametime;
}
}
float CSQC_Parse_Damage(float save, float take, vector org)
{
if (org) {
g_vecDamageLocation = org;
g_flDamageAlpha = 1.0f;
}
sound(self, CHAN_VOICE, "player/pl_pain2.wav", 1, ATTN_NORM);
return TRUE;
}

View file

@ -6,50 +6,13 @@
*
****/
// flags for 2d drawing
#define DRAWFLAG_NORMAL 0
#define DRAWFLAG_ADDITIVE 1
#define DRAWFLAG_MODULATE 2
#define DRAWFLAG_2XMODULATE 3
// Undocumented printcall types
#define PRINT_LOW 0
#define PRINT_MEDIUM 1
#define PRINT_HIGH 2
#define PRINT_CHAT 3
var float FONT_16;
var float FONT_CON;
// Clientside cvars
var vector autocvar_con_color = '255 150 0'; // autocvar of "con_color"
var vector autocvar_vgui_color = '255 170 0'; // autocvar of "vgui_color"
var vector autocvar_cross_color = '0 255 0'; // autocvar of "cross_color"
var float autocvar_cl_bob = 0;
var float autocvar_v_bob = 0.01;
var float autocvar_v_bobcycle = 0.8;
var float autocvar_v_bobup = 0.5;
var int autocvar_v_bobclassic = FALSE;
var int autocvar_v_lefthanded = FALSE;
var vector autocvar_v_gunofs = [0,0,0];
var int autocvar_cl_thirdperson = FALSE;
var int autocvar_cl_radar = 1;
var int autocvar_cl_smoothstairs = TRUE;
var string autocvar_cl_logofile = "lambda";
var vector autocvar_cl_logocolor = '255 0 0';
var int autocvar_cl_radar = 1;
// Particle stuff
var float PARTICLE_SPARK;
var float PARTICLE_PIECES_BLACK;
var float PARTICLE_SMOKE_GREY;
var float PARTICLE_SMOKE_BROWN;
var float PARTICLE_SMOKEGRENADE;
var float PARTICLE_BLOOD;
var float DECAL_SHOT;
var float DECAL_GLASS;
var float SHADER_CULLED;
.float flUpAngle;
@ -64,6 +27,39 @@ string sShellModel [ 4 ] = {
"models/shotgunshell.mdl"
};
var string autocvar_skins_dir = "";
string sViewModels[ CS_WEAPON_COUNT - 1 ] = {
"v_knife.mdl",
"v_usp.mdl",
"v_glock18.mdl",
"v_deagle.mdl",
"v_p228.mdl",
"v_elite.mdl",
"v_fiveseven.mdl",
"v_m3.mdl",
"v_xm1014.mdl",
"v_mp5.mdl",
"v_p90.mdl",
"v_ump45.mdl",
"v_mac10.mdl",
"v_tmp.mdl",
"v_ak47.mdl",
"v_sg552.mdl",
"v_m4a1.mdl",
"v_aug.mdl",
"v_scout.mdl",
"v_awp.mdl",
"v_g3sg1.mdl",
"v_sg550.mdl",
"v_m249.mdl",
"v_c4.mdl",
"v_flashbang.mdl",
"v_hegrenade.mdl",
"v_smokegrenade.mdl"
};
struct
{
//Viewmodel stuff
@ -116,25 +112,6 @@ struct
float fHUDWeaponSelected;
} seats[4], *pSeat;
float fInputSendNext;
vector vVideoMins; //
vector vVideoResolution; // Updated every frame
// Input globals, feel free to use them since they are updated upon input
float fInputKeyCode;
float fInputKeyASCII;
float fInputKeyDown;
var int iInputAttack2;
var int iInputReload;
var int iInputUse;
var int iInputDuck;
// Input globals for the mouse
float fMouseClick;
vector vMousePos;
// Sound Stuff
//.string sSoundSample;
//.float fVolume;
@ -143,10 +120,6 @@ void View_AddPunchAngle( vector vAdd );
void View_PlayAnimation( int iSequence );
string HUD_GetChatColorHEX( float fTeam );
// This actually belongs in Builtins.h since its an undocumented global
.float maxframe;
float clframetime;
// For the player entity
.entity eGunModel;
float fWeaponEventPlayer;
@ -157,12 +130,3 @@ float fWeaponEventPlayer;
void Animation_ShootWeapon( entity ePlayer );
void Animation_ReloadWeapon( entity ePlayer );
void CSQC_DrawText( vector vPos, string sString, vector vSize, vector vColor, float fAlpha, float fFlags, float fFont ) {
drawfont = fFont;
drawstring( vPos, sString, vSize, vColor, fAlpha, fFlags );
}
#if defined(CSQC)
int(float playernum, string keyname, optional void *outptr, int size) getplayerkeyblob = #0;
#endif

View file

@ -52,7 +52,7 @@ Just prints whatever is in the chat buffer and removes lines after some time.
=================
*/
void CSQC_DrawChat(void) {
vector vChatPos = vVideoMins + [16, vVideoResolution_y - 128];
vector vChatPos = video_mins + [16, video_res_y - 128];
// Remove messages after a fChatTime has passed
if (fChatTime < time) {
@ -73,7 +73,7 @@ void CSQC_DrawChat(void) {
sDraw = sprintf("%s\n%s\n", sDraw, sMSGBuffer[i]);
}
drawtextfield(vChatPos, [vVideoResolution_x - 32, CHAT_LINES * 12], 1, sDraw);
drawtextfield(vChatPos, [video_res_x - 32, CHAT_LINES * 12], 1, sDraw);
#endif
}
}
@ -107,10 +107,10 @@ void CSQC_DrawCenterprint(void) {
}
}
vCenterPrintPos_y = vVideoMins_y + (vVideoResolution_y / 2) - (fCenterPrintLines - 4) - 69;
vCenterPrintPos_y = video_mins_y + (video_res_y / 2) - (fCenterPrintLines - 4) - 69;
for (int i = 0; i < (fCenterPrintLines); i++) {
vCenterPrintPos_x = vVideoMins_x + (vVideoResolution_x / 2) - (stringwidth(sCenterPrintBuffer[i], TRUE, '12 12') / 2);
vCenterPrintPos_x = video_mins_x + (video_res_x / 2) - (stringwidth(sCenterPrintBuffer[i], TRUE, '12 12') / 2);
drawstring(vCenterPrintPos, sCenterPrintBuffer[i], '12 12', '1 1 1', fCenterPrintAlpha, 0);
vCenterPrintPos_y += 8;
}
@ -138,31 +138,6 @@ float CSQC_Parse_CenterPrint(string sMessage) {
return TRUE;
}
void CSQC_CalcViewport(int s, float fWinWidth, float fWinHeight) {
//FIXME: this is awkward. renderscene internally rounds to pixels.
//on the other hand, drawpic uses linear filtering and multisample and stuff.
//this means that there can be a pixel or so difference between scene and 2d.
//as a general rule, you won't notice unless there's some big drawfills.
switch (numclientseats) {
case 3:
if (!s) {
case 2:
vVideoResolution = [fWinWidth, fWinHeight * 0.5];
vVideoMins = [0, (s & 1) * vVideoResolution_y];
break;
}
s++;
case 4:
vVideoResolution = [fWinWidth, fWinHeight] * 0.5;
vVideoMins = [(s&1) * vVideoResolution_x, (s / 2i) * vVideoResolution_y];
break;
default:
vVideoResolution = [fWinWidth, fWinHeight];
vVideoMins = [0, 0];
break;
}
}
/*
=================
CSQC_UpdateView

View file

@ -30,97 +30,6 @@ void CSQC_ambient_generic( string sSample, float fVolume, float fAttenuation, fl
//}
}
/*
=================
CSQC_Ent_Update
Called whenever an entity is sent manually via .SendFlags and so on
=================
*/
void CSQC_Ent_Update( float flIsNew ) {
float fEntType = readbyte();
if( fEntType == ENT_PLAYER ) {
if ( flIsNew == TRUE ) {
self.classname = "player";
self.solid = SOLID_SLIDEBOX;
self.predraw = Player_PreDraw;
self.drawmask = MASK_ENGINE;
self.customphysics = Empty;
setsize( self, VEC_HULL_MIN, VEC_HULL_MAX );
}
self.modelindex = readshort();
self.origin_x = readcoord();
self.origin_y = readcoord();
self.origin_z = readcoord();
self.flUpAngle = readcoord() / 90;
self.angles_y = readcoord();
self.angles_z = readcoord();
self.velocity_x = readcoord();
self.velocity_y = readcoord();
self.velocity_z = readcoord();
self.flags = readfloat();
self.pmove_flags = readfloat();
self.weapon = readbyte();
self.health = readbyte();
self.movetype = readfloat();
self.view_ofs[2] = readfloat();
setorigin( self, self.origin );
if (self.health < self.oldhealth) {
Animation_PlayerTopTemp( ANIM_GUT_FLINCH, 0.1f );
}
self.oldhealth = self.health;
} else if ( fEntType == ENT_AMBIENTSOUND ) {
self.origin_x = readcoord();
self.origin_y = readcoord();
self.origin_z = readcoord();
setorigin( self, self.origin );
CSQC_ambient_generic( readstring(), readfloat(), readbyte(), readbyte(), readbyte() );
} else if ( fEntType == ENT_SPRITE ) {
Sprite_Animated();
} else if ( fEntType == ENT_SPRAY ) {
Spraylogo_Parse();
} else if ( fEntType == ENT_DECAL ) {
string decalname = "";
string decalshader = "";
self.origin_x = readcoord();
self.origin_y = readcoord();
self.origin_z = readcoord();
self.angles_x = readcoord();
self.angles_y = readcoord();
self.angles_z = readcoord();
self.color_x = 1.0f - ( readbyte() / 255 );
self.color_y = 1.0f - ( readbyte() / 255 );
self.color_z = 1.0f - ( readbyte() / 255 );
self.classname = readstring();
self.size = drawgetimagesize(self.classname);
if (serverkeyfloat("*bspversion") == 30) {
decalname = sprintf("decal_%s", self.classname);
decalshader = sprintf("{\npolygonOffset\n{\nclampmap %s\nblendFunc filter\n}\n}", self.classname);
shaderforname(decalname, decalshader);
self.classname = decalname;
}
makevectors( self.angles );
float surf = getsurfacenearpoint(world, self.origin);
vector s_dir = getsurfacepointattribute(world, surf, 0, SPA_S_AXIS);
vector t_dir = getsurfacepointattribute(world, surf, 0, SPA_T_AXIS);
self.mins = v_up / self.size[0];
self.maxs = t_dir / self.size[1];
self.predraw = Effect_Decal;
self.drawmask = MASK_ENGINE;
}
}
/*
=================
CSQC_Ent_Remove

View file

@ -119,12 +119,9 @@ CSQC_ConsoleCommand
Can interject cmds and create new ones
=================
*/
float CSQC_ConsoleCommand(string sCMD) {
int s = (float)getproperty(VF_ACTIVESEAT); //the engine will hide the p1 etc commands... which is fun...
pSeat = &seats[s];
tokenize(sCMD);
float Game_ConsoleCommand(void)
{
/* This has already been tokenized */
switch (argv(0)) {
case "lastinv":
HUD_DrawWeaponSelect_Last();
@ -168,33 +165,6 @@ float CSQC_ConsoleCommand(string sCMD) {
case "overview_test":
pSeat.iOverview = 1 - pSeat.iOverview;
break;
case "vox_test":
Sound_PlayVOX(sCMD);
break;
case "+attack2":
iInputAttack2 = TRUE;
break;
case "-attack2":
iInputAttack2 = FALSE;
break;
case "+reload":
iInputReload = TRUE;
break;
case "-reload":
iInputReload = FALSE;
break;
case "+use":
iInputUse = TRUE;
break;
case "-use":
iInputUse = FALSE;
break;
case "+duck":
iInputDuck = TRUE;
break;
case "-duck":
iInputDuck = FALSE;
break;
case "buy":
if(getstatf(STAT_BUYZONE) == TRUE) {
pSeat->fVGUI_Display = VGUI_BM_MAIN;
@ -396,17 +366,13 @@ float CSQC_ConsoleCommand(string sCMD) {
/*
=================
CSQC_Parse_Event
Game_Parse_Event
Whenever we call a SVC_CGAMEPACKET on the SSQC, this is being run
=================
*/
void CSQC_Parse_Event(void) {
int s = (float)getproperty(VF_ACTIVESEAT); //always 0, unless it was sent with a MULTICAST_ONE or MULTICAST_ONE_R to p2+
pSeat = &seats[s];
float fHeader = readbyte();
void Game_Parse_Event(float fHeader) {
int s;
if (fHeader == EV_WEAPON_DRAW) {
fWeaponEventPlayer = readbyte();
for (s = 0; s < numclientseats; s++) //lame loop
@ -443,69 +409,12 @@ void CSQC_Parse_Event(void) {
break;
}
Weapon_Reload(getstatf(STAT_ACTIVEWEAPON));
} else if (fHeader == EV_MODELGIB) {
vector vPos;
vPos_x = readcoord();
vPos_y = readcoord();
vPos_z = readcoord();
vector vSize;
vSize_x = readcoord();
vSize_y = readcoord();
vSize_z = readcoord();
float fStyle = readbyte();
Effect_BreakModel(vPos, vSize, '0 0 0', fStyle);
} else if (fHeader == EV_CAMERATRIGGER) {
pSeat->vCameraPos.x = readcoord();
pSeat->vCameraPos.y = readcoord();
pSeat->vCameraPos.z = readcoord();
pSeat->vCameraAngle.x = readcoord();
pSeat->vCameraAngle.y = readcoord();
pSeat->vCameraAngle.z = readcoord();
pSeat->fCameraTime = time + readfloat();
} else if (fHeader == EV_RADIOMSG) {
Radio_PlayMessage(readbyte());
} else if (fHeader == EV_RADIOMSG2) {
Radio_PlayPlayerMessage(readbyte(), readbyte());
} else if (fHeader == EV_ORBITUARY) {
HUD_AddOrbituaries(readbyte(), readbyte(), readbyte(), readbyte(), readbyte(), readbyte());
} else if (fHeader == EV_IMPACT) {
int iType;
vector vOrigin, vNormal;
iType = (int)readbyte();
vOrigin_x = readcoord();
vOrigin_y = readcoord();
vOrigin_z = readcoord();
vNormal_x = readcoord();
vNormal_y = readcoord();
vNormal_z = readcoord();
Effect_Impact(iType, vOrigin, vNormal);
} else if (fHeader == EV_EXPLOSION) {
vector vExploPos;
vExploPos_x = readcoord();
vExploPos_y = readcoord();
vExploPos_z = readcoord();
Effect_CreateExplosion(vExploPos);
} else if (fHeader == EV_SPARK) {
vector vSparkPos, vSparkAngle;
vSparkPos_x = readcoord();
vSparkPos_y = readcoord();
vSparkPos_z = readcoord();
vSparkAngle_x = readcoord();
vSparkAngle_y = readcoord();
vSparkAngle_z = readcoord();
Effect_CreateSpark(vSparkPos, vSparkAngle);
} else if (fHeader == EV_SMOKE) {
vector vSmokePos;
@ -531,121 +440,5 @@ void CSQC_Parse_Event(void) {
CSQC_Parse_Print(sprintf("%s%s^xF80: %s", HUD_GetChatColorHEXTeam(fTeam2), getplayerkeyvalue(fSender2, "name"), sMessage2), PRINT_CHAT);
} else if (fHeader == EV_CHAT_VOX) {
Sound_PlayVOX(readstring());
} else if (fHeader == EV_FADE) {
Fade_Parse();
} else if (fHeader == EV_SPRITE) {
Sprite_ParseEvent();
} else if (fHeader == EV_TEXT) {
GameText_Parse();
} else if (fHeader == EV_MESSAGE) {
GameMessage_Parse();
}
}
/*
=================
CSQC_InputEvent
Updates all our input related globals for use in other functions
=================
*/
float CSQC_InputEvent(float fEventType, float fKey, float fCharacter, float fDeviceID) {
switch(fEventType) {
case IE_KEYDOWN:
if (fKey == K_MOUSE1) {
fMouseClick = 1;
} else {
fInputKeyDown = 1;
}
fInputKeyCode = fKey;
fInputKeyASCII = fCharacter;
break;
case IE_KEYUP:
if (fKey == K_MOUSE1) {
fMouseClick = 0;
} else {
fInputKeyDown = 0;
}
fInputKeyCode = 0;
fInputKeyASCII = 0;
break;
case IE_MOUSEABS:
vMousePos_x = fKey;
vMousePos_y = fCharacter;
break;
case IE_MOUSEDELTA:
vMousePos_x += fKey;
vMousePos_y += fCharacter;
if (vMousePos_x < 0) {
vMousePos_x = 0;
} else if (vMousePos_x > vVideoResolution_x) {
vMousePos_x = vVideoResolution_x;
}
if (vMousePos_y < 0) {
vMousePos_y = 0;
} else if (vMousePos_y > vVideoResolution_y) {
vMousePos_y = vVideoResolution_y;
}
break;
default:
return TRUE;
}
return FALSE;
}
/*
=================
CSQC_Input_Frame
Hijacks and controls what input globals are being sent to the server
=================
*/
void CSQC_Input_Frame(void) {
int s = (float)getproperty(VF_ACTIVESEAT);
pSeat = &seats[s];
// If we are inside a VGUI, don't let the client do stuff outside
if ((pSeat->fVGUI_Display != VGUI_NONE)) {
fInputSendNext = time + 0.2;
} else if ((pSeat->fHUDWeaponSelected) && (input_buttons & INPUT_BUTTON0)) {
HUD_DrawWeaponSelect_Trigger();
input_buttons = 0;
fInputSendNext = time + 0.2;
}
if (fInputSendNext > time) {
input_impulse = 0;
input_buttons = 0;
return;
}
if (input_impulse == 101) {
print("This aint Half-Life.\n");
input_impulse = 0;
}
if (input_impulse == 201) {
sendevent("Spraylogo", "");
}
if (iInputAttack2 == TRUE) {
input_buttons |= INPUT_BUTTON3;
}
if (iInputReload == TRUE) {
input_buttons |= INPUT_BUTTON4;
}
if (iInputUse == TRUE) {
input_buttons |= INPUT_BUTTON5;
}
if (iInputDuck == TRUE) {
input_buttons |= INPUT_BUTTON8;
}
input_angles += pSeat->vPunchAngle;
}

View file

@ -48,6 +48,31 @@ vector vHUDCalPos[15] = {
[0.1875, 0.375] // FLASH
};
void HUD_Init(void)
{
precache_model(HUD_NUMFILE);
precache_model("sprites/top_left.spr");
precache_model("sprites/top.spr");
precache_model("sprites/top_right.spr");
precache_model("sprites/left.spr");
precache_model("sprites/right.spr");
precache_model("sprites/bottom_left.spr");
precache_model("sprites/bottom.spr");
precache_model("sprites/bottom_right.spr");
precache_model("sprites/sniper_scope.spr");
precache_model("sprites/radar640.spr");
precache_model("sprites/640hud1.spr");
precache_model("sprites/640hud16.spr");
precache_model("sprites/640hud2.spr");
precache_model("sprites/640hud10.spr");
precache_model("sprites/640hud12.spr");
precache_model("sprites/640hud14.spr");
precache_model("sprites/640hud3.spr");
precache_model("sprites/640hud5.spr");
precache_model("sprites/640_pain.spr");
precache_model("sprites/crosshairs.spr");
}
/*
=================
HUD_DrawRedNumber
@ -72,7 +97,7 @@ void HUD_DrawNums(float fNumber, vector vPos, float fAlpha, vector vColor) {
while (iNumber > 0) {
HUD_DrawNumber((float)iNumber % 10, vPos, fAlpha, vColor);
iNumber = iNumber / 10;
vPos[0] -= 24;
vPos[0] -= 20;
}
} else {
HUD_DrawNumber(0, vPos, fAlpha, vColor);
@ -99,7 +124,7 @@ void HUD_DrawHealth(void) {
fHealthAlpha = HUD_ALPHA;
}
vector vHealthPos = vVideoMins + [16, vVideoResolution[1] - 42];
vector vHealthPos = video_mins + [16, video_res[1] - 42];
if (getstatf(STAT_HEALTH) > 25) {
drawsubpic(vHealthPos, [24, 24], HUD_NUMFILE_LAYER, [NUMSIZE_X * 2, NUMSIZE_Y], [NUMSIZE_X, NUMSIZE_X], vHUDColor, HUD_ALPHA, DRAWFLAG_ADDITIVE);
HUD_DrawNums(getstatf(STAT_HEALTH), vHealthPos + [72, 0], HUD_ALPHA, vHUDColor);
@ -130,7 +155,7 @@ void HUD_DrawArmor(void) {
fArmorAlpha = HUD_ALPHA;
}
vector vArmorPos = vVideoMins + [128, vVideoResolution[1] - 42];
vector vArmorPos = video_mins + [128, video_res[1] - 42];
if (getstatf(STAT_EQUIPMENT) & EQUIPMENT_HELMET) {
drawsubpic(vArmorPos, [24,24], HUD_NUMFILE_LAYER, [0, 0.4862745098], [NUMSIZE_X, NUMSIZE_X], vHUDColor, fArmorAlpha, DRAWFLAG_ADDITIVE);
@ -152,7 +177,7 @@ Draw icons such as hostage, bomb and buyzones
void HUD_DrawIcons(void) {
vector iconpos;
iconpos = vVideoMins + [16, (vVideoResolution[1] / 2) - 24];
iconpos = video_mins + [16, (video_res[1] / 2) - 24];
// Defusal Kit Icon (64, 148)
if (getstatf(STAT_EQUIPMENT) & EQUIPMENT_DEFUSALKIT) {
@ -208,7 +233,7 @@ void HUD_DrawTimer(void) {
static int iOldUnits;
static float fTimerAlpha;
int iMinutes, iSeconds, iTens, iUnits;
vector vTimePos = vVideoMins+[(vVideoResolution[0] / 2) - 62, vVideoResolution[1] - 42];
vector vTimePos = video_mins+[(video_res[0] / 2) - 62, video_res[1] - 42];
if (getstatf(STAT_GAMETIME) == -1) {
return;
@ -257,7 +282,7 @@ void HUD_DrawTimer(void) {
}
HUD_DrawNumber(iMinutes, vTimePos + [48,0], fTimerAlpha, vHUDColor);
HUD_DrawNumber(iTens, vTimePos + [75,0], fTimerAlpha, vHUDColor);
HUD_DrawNumber(iUnits, vTimePos + [99,0], fTimerAlpha, vHUDColor);
HUD_DrawNumber(iUnits, vTimePos + [95,0], fTimerAlpha, vHUDColor);
drawsubpic(vTimePos + [70,6], [3,3], HUD_NUMFILE_LAYER, [0.9375, 0], [0.01171875, 0.01171875], vHUDColor, fTimerAlpha, DRAWFLAG_ADDITIVE);
drawsubpic(vTimePos + [70,16], [3,3], HUD_NUMFILE_LAYER, [0.9375, 0], [0.01171875, 0.01171875], vHUDColor, fTimerAlpha, DRAWFLAG_ADDITIVE);
@ -304,7 +329,7 @@ void HUD_DrawMoney(void) {
fMoneyDifference = fOldMoneyValue - getstatf(STAT_MONEY);
}
vector vMoneyPos = vVideoMins+[vVideoResolution[0] - 160, vVideoResolution[1] - 72];
vector vMoneyPos = video_mins+[video_res[0] - 160, video_res[1] - 72];
// If the alpha/color effect is active, draw the money twice in their varying alphas/colors
if (fMoneyAlphaEffect > 0) {
@ -368,20 +393,20 @@ void HUD_DrawAmmo(void) {
}
if (wptTable[getstatf(STAT_ACTIVEWEAPON)].iCaliber < 11) {
vAmmoMagPos = vVideoMins+[vVideoResolution[0] - 142, vVideoResolution[1] - 42];
vAmmoMagPos = video_mins+[video_res[0] - 142, video_res[1] - 42];
HUD_DrawNums(getstatf(STAT_CURRENT_MAG), vAmmoMagPos, fAmmoAlpha, vHUDColor);
drawsubpic(vVideoMins+[vVideoResolution[0] - 118, vVideoResolution[1] - 42], '3 25', HUD_NUMFILE_LAYER, [0.9375, 0], [0.01171875, 0.09765625], vHUDColor, fAmmoAlpha, DRAWFLAG_ADDITIVE);
drawsubpic(video_mins+[video_res[0] - 118, video_res[1] - 42], '3 25', HUD_NUMFILE_LAYER, [0.9375, 0], [0.01171875, 0.09765625], vHUDColor, fAmmoAlpha, DRAWFLAG_ADDITIVE);
vAmmoCalPos = vVideoMins+[vVideoResolution[0] - 64, vVideoResolution[1] - 42];
vAmmoCalPos = video_mins+[video_res[0] - 64, video_res[1] - 42];
HUD_DrawNums(getstatf(STAT_CURRENT_CALIBER), vAmmoCalPos, fAmmoAlpha, vHUDColor);
} else {
vAmmoMagPos = vVideoMins+[vVideoResolution[0] - 64, vVideoResolution[1] - 42];
vAmmoMagPos = video_mins+[video_res[0] - 64, video_res[1] - 42];
HUD_DrawNums(getstatf(STAT_CURRENT_MAG), vAmmoMagPos, fAmmoAlpha, vHUDColor);
}
// Caliber icon
drawsubpic(vVideoMins+vVideoResolution - [42,42], [24,24], HUD_NUMFILE_LAYER, vHUDCalPos[wptTable[getstatf(STAT_ACTIVEWEAPON)].iCaliber], [NUMSIZE_X, NUMSIZE_X], vHUDColor, fAmmoAlpha, DRAWFLAG_ADDITIVE);
drawsubpic(video_mins+video_res - [42,42], [24,24], HUD_NUMFILE_LAYER, vHUDCalPos[wptTable[getstatf(STAT_ACTIVEWEAPON)].iCaliber], [NUMSIZE_X, NUMSIZE_X], vHUDColor, fAmmoAlpha, DRAWFLAG_ADDITIVE);
fOldMag = getstatf(STAT_CURRENT_MAG);
fOldCal = getstatf(STAT_CURRENT_CALIBER);
}
@ -391,9 +416,9 @@ void HUD_DrawProgressBar(void) {
vector vMainPos;
if (getstatf(STAT_PROGRESS) > 0) {
vMainPos = vVideoMins;
vMainPos[0] += (vVideoResolution[0] / 2) - (vSize[0] / 2);
vMainPos[1] += (vVideoResolution[1] / 2) - (vSize[1] / 2);
vMainPos = video_mins;
vMainPos[0] += (video_res[0] / 2) - (vSize[0] / 2);
vMainPos[1] += (video_res[1] / 2) - (vSize[1] / 2);
// Draw the background
vector vBar = vSize;
@ -411,7 +436,7 @@ void HUD_DrawProgressBar(void) {
void HUD_DrawRadar(void) {
if (autocvar_cl_radar == 1) {
drawpic(vVideoMins, "sprites/radar640.spr_0.tga", [128,128], [1,1,1], 0.25, DRAWFLAG_ADDITIVE);
drawpic(video_mins, "sprites/radar640.spr_0.tga", [128,128], [1,1,1], 0.25, DRAWFLAG_ADDITIVE);
} else if (autocvar_cl_radar == 2) {
static int iLastMode = 0;
static vector vMapSize;
@ -423,32 +448,32 @@ void HUD_DrawRadar(void) {
if (pSeat.iMapExpand == 1) {
if (pSeat.fMapLerp < 1.0f) {
vMapSize[0] = rint(Math_Lerp(128, vVideoResolution[0] - 32, pSeat.fMapLerp));
vMapSize[1] = rint(Math_Lerp(128, vVideoResolution[1] - 32, pSeat.fMapLerp));
fZoom = Math_Lerp((ovMap.fCameraHeight * (128 / (vVideoResolution[1] - 32))), ovMap.fCameraHeight - 32, pSeat.fMapLerp);
vMapSize[0] = rint(Math_Lerp(128, video_res[0] - 32, pSeat.fMapLerp));
vMapSize[1] = rint(Math_Lerp(128, video_res[1] - 32, pSeat.fMapLerp));
fZoom = Math_Lerp((ovMap.fCameraHeight * (128 / (video_res[1] - 32))), ovMap.fCameraHeight - 32, pSeat.fMapLerp);
pSeat.fMapLerp += frametime * 2;
} else {
pSeat.fMapLerp = 1.0f;
fZoom = ovMap.fCameraHeight;
vMapSize = vVideoResolution + [-32,-32];
vMapSize = video_res + [-32,-32];
}
} else {
if (pSeat.fMapLerp > 0.0f) {
vMapSize[0] = rint(Math_Lerp(128, vVideoResolution[0] - 32, pSeat.fMapLerp));
vMapSize[1] = rint(Math_Lerp(128, vVideoResolution[1] - 32, pSeat.fMapLerp));
fZoom = Math_Lerp((ovMap.fCameraHeight * (128 / (vVideoResolution[1] - 32))), ovMap.fCameraHeight - 32, pSeat.fMapLerp);
vMapSize[0] = rint(Math_Lerp(128, video_res[0] - 32, pSeat.fMapLerp));
vMapSize[1] = rint(Math_Lerp(128, video_res[1] - 32, pSeat.fMapLerp));
fZoom = Math_Lerp((ovMap.fCameraHeight * (128 / (video_res[1] - 32))), ovMap.fCameraHeight - 32, pSeat.fMapLerp);
pSeat.fMapLerp -= frametime * 2;
} else {
pSeat.fMapLerp = 0.0f;
fZoom = (ovMap.fCameraHeight * (128 / (vVideoResolution[1] - 32)));
fZoom = (ovMap.fCameraHeight * (128 / (video_res[1] - 32)));
vMapSize = [128,128];
}
}
clearscene();
drawfill(vVideoMins + [15,15], vMapSize + [2,2], vHUDColor, 1.0f, DRAWFLAG_ADDITIVE);
drawfill(vVideoMins + [16,16], vMapSize, [0,0,0], 1.0f, 0);
setproperty(VF_MIN, vVideoMins + [16,16]);
drawfill(video_mins + [15,15], vMapSize + [2,2], vHUDColor, 1.0f, DRAWFLAG_ADDITIVE);
drawfill(video_mins + [16,16], vMapSize, [0,0,0], 1.0f, 0);
setproperty(VF_MIN, video_mins + [16,16]);
setproperty(VF_SIZE, vMapSize);
Overview_DrawLayer();
@ -472,7 +497,7 @@ void HUD_DrawFlash(void) {
}
}
drawfill(vVideoMins, vVideoResolution, [1,1,1], pSeat->fFlashAlpha, 0/*pSeat->fFlashTime*/);
drawfill(video_mins, video_res, [1,1,1], pSeat->fFlashAlpha, 0/*pSeat->fFlashTime*/);
}
/*
@ -508,30 +533,3 @@ void HUD_Draw(void) {
HUD_DrawProgressBar();
HUD_DrawWeaponSelect();
}
/*
=================
HUD_DrawVoice
Draws a little notification for anyone using voice chat
=================
*/
void HUD_DrawVoice(void) {
vector vVoicePos = vVideoMins + [vVideoResolution[0] - 160, vVideoResolution[1] - 136];
for (int i = -1; i > -32; i--) {
if (getplayerkeyfloat(i, INFOKEY_P_VOIPSPEAKING) == 1) {
drawfill(vVoicePos, [144,24], VGUI_WINDOW_BGCOLOR, VGUI_WINDOW_BGALPHA);
drawfill(vVoicePos, [144, 1], vVGUIColor, VGUI_WINDOW_FGALPHA);
drawfill([vVoicePos[0], vVoicePos[1] + 23], [144, 1], vVGUIColor, VGUI_WINDOW_FGALPHA);
drawfill(vVoicePos, [1, 24], vVGUIColor, VGUI_WINDOW_FGALPHA);
drawfill([vVoicePos[0] + 143, vVoicePos[1]], [1, 24], vVGUIColor, VGUI_WINDOW_FGALPHA);
CSQC_DrawText([vVoicePos[0] + 28, vVoicePos[1] + 8], getplayerkeyvalue(i, "name"), [12,12], vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_NORMAL, FONT_CON);
drawpic(vVoicePos + [2,0], "gfx/vgui/icntlk_sv.tga", [24,24], vVGUIColor, 1, DRAWFLAG_NORMAL);
vVoicePos[1] -= 32;
}
}
}

View file

@ -59,19 +59,19 @@ void HUD_DrawCrosshair(void) {
// Line positions
vector vVer1, vVer2, vHor1, vHor2;
vVer1 = vVer2 = vHor1 = vHor2 = vVideoMins;
vVer1 = vVer2 = vHor1 = vHor2 = video_mins;
// Vertical Lines
vVer1[0] += (vVideoResolution[0] / 2);
vVer1[1] += (vVideoResolution[1] / 2) - (iCrosshairDistance + iLineLength);
vVer2[0] += (vVideoResolution[0] / 2);
vVer2[1] += (vVideoResolution[1] / 2) + iCrosshairDistance + 1;
vVer1[0] += (video_res[0] / 2);
vVer1[1] += (video_res[1] / 2) - (iCrosshairDistance + iLineLength);
vVer2[0] += (video_res[0] / 2);
vVer2[1] += (video_res[1] / 2) + iCrosshairDistance + 1;
// Horizontal Lines
vHor1[0] += (vVideoResolution[0] / 2) - (iCrosshairDistance + iLineLength);
vHor1[1] += (vVideoResolution[1] / 2);
vHor2[0] += (vVideoResolution[0] / 2) + iCrosshairDistance + 1;
vHor2[1] += (vVideoResolution[1] / 2);
vHor1[0] += (video_res[0] / 2) - (iCrosshairDistance + iLineLength);
vHor1[1] += (video_res[1] / 2);
vHor2[0] += (video_res[0] / 2) + iCrosshairDistance + 1;
vHor2[1] += (video_res[1] / 2);
drawfill(vVer1, [1, iLineLength], vCrossColor, 1, DRAWFLAG_ADDITIVE);
drawfill(vVer2, [1, iLineLength], vCrossColor, 1, DRAWFLAG_ADDITIVE);
@ -92,6 +92,6 @@ void HUD_DrawSimpleCrosshair(void)
static vector cross_pos;
// Draw the scope in the middle, seperately from the border
cross_pos = (vVideoResolution / 2) + [-12,-12];
cross_pos = (video_res / 2) + [-12,-12];
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [0.1875,0], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
}

View file

@ -72,7 +72,7 @@ This actually displays the contents of orbBuffer
=================
*/
void HUD_DrawOrbituaries( void ) {
vector vOrbPos = vVideoMins + [ vVideoResolution_x - 200, 56 ];
vector vOrbPos = video_mins + [ video_res_x - 200, 56 ];
drawfont = FONT_CON;
if ( fOrbituaryTime < time && iOrbituaryScroll >= 0 ) {
// We are cheap, just clear the attacker and we're good.
@ -87,7 +87,7 @@ void HUD_DrawOrbituaries( void ) {
}
// Calculate the position based on the saved offsets
vOrbPos_x = vVideoMins_x + vVideoResolution_x - ( orbBuffer[ i ].fOffset1 + orbBuffer[ i ].fOffset2 + orbBuffer[ i ].fOffset3 ) - 16;
vOrbPos_x = video_mins_x + video_res_x - ( orbBuffer[ i ].fOffset1 + orbBuffer[ i ].fOffset2 + orbBuffer[ i ].fOffset3 ) - 16;
// Draw the attacker's name, shadow first
drawstring( vOrbPos, orbBuffer[ i ].sAttacker, '12 12', orbBuffer[ i ].vColor1, VGUI_WINDOW_FGALPHA, 0 );

View file

@ -32,12 +32,12 @@ void HUD_DrawScope( void ) {
static vector vScopePos;
// Draw the scope in the middle, seperately from the border
vScopePos = ( vVideoResolution / 2 ) + '-128 -128';
vScopePos = ( video_res / 2 ) + '-128 -128';
drawpic( vScopePos, "sprites/sniper_scope.spr_0.tga", '256 256', '1 1 1', 1.0f, DRAWFLAG_NORMAL );
// Border scale to fit the screen
fSBScale = vVideoResolution_y / 480;
fSBOffset = ( vVideoResolution_x / 2 ) - ( ( 640 * fSBScale ) / 2 );
fSBScale = video_res_y / 480;
fSBOffset = ( video_res_x / 2 ) - ( ( 640 * fSBScale ) / 2 );
// Type 1 Border... more coming soon?
HUD_DrawScope_Pic( '0 0', '192 112', "sprites/top_left.spr_0.tga" );
@ -51,7 +51,7 @@ void HUD_DrawScope( void ) {
// Rect borders left and right
if ( fSBOffset > 0 ) {
drawfill( '0 0', [ fSBOffset, vVideoResolution_y ], '0 0 0', 1.0f );
drawfill( [ ( 640 * fSBScale ) + fSBOffset, 0 ], [ fSBOffset, vVideoResolution_y ], '0 0 0', 1.0f );
drawfill( '0 0', [ fSBOffset, video_res_y ], '0 0 0', 1.0f );
drawfill( [ ( 640 * fSBScale ) + fSBOffset, 0 ], [ fSBOffset, video_res_y ], '0 0 0', 1.0f );
}
}

View file

@ -312,10 +312,10 @@ void HUD_DrawWeaponSelect(void)
return;
}
vector vSelectPos = vVideoMins + [160,12];
vector vSelectPos = video_mins + [160,12];
for (int i = 0; i < 5; i++) {
vSelectPos[1] = vVideoMins[1] + 12;
vSelectPos[1] = video_mins[1] + 12;
HUD_DrawWeaponSelect_Num(vSelectPos, i);
// Again, grenades are treated seperately

View file

@ -8,60 +8,21 @@
/*
=================
CSQC_Init
Client_Init
Comparable to worldspawn in SSQC in that it's mostly used for precaches
=================
*/
void CSQC_Init(float apilevel, string enginename, float engineversion) {
pSeat = &seats[0];
precache_model(HUD_NUMFILE);
precache_model("sprites/top_left.spr");
precache_model("sprites/top.spr");
precache_model("sprites/top_right.spr");
precache_model("sprites/left.spr");
precache_model("sprites/right.spr");
precache_model("sprites/bottom_left.spr");
precache_model("sprites/bottom.spr");
precache_model("sprites/bottom_right.spr");
precache_model("sprites/sniper_scope.spr");
void Client_Init(float apilevel, string enginename, float engineversion)
{
precache_model("sprites/fexplo.spr");
precache_model("sprites/muzzleflash1.spr");
precache_model("sprites/radar640.spr");
precache_model("sprites/640hud1.spr");
precache_model("sprites/640hud16.spr");
precache_model("sprites/640hud2.spr");
precache_model("sprites/640hud10.spr");
precache_model("sprites/640hud12.spr");
precache_model("sprites/640hud14.spr");
precache_model("sprites/640hud3.spr");
precache_model("sprites/640hud5.spr");
precache_model("sprites/640_pain.spr");
precache_model("sprites/crosshairs.spr");
precache_sound("common/wpn_hudon.wav");
precache_sound("common/wpn_hudoff.wav");
precache_sound("common/wpn_moveselect.wav");
precache_sound("common/wpn_select.wav");
precache_sound("debris/bustglass1.wav");
precache_sound("debris/bustglass2.wav");
precache_sound("debris/bustglass3.wav");
precache_sound("debris/bustcrate1.wav");
precache_sound("debris/bustcrate2.wav");
precache_sound("debris/bustcrate3.wav");
precache_sound("debris/bustmetal1.wav");
precache_sound("debris/bustmetal2.wav");
precache_sound("debris/bustflesh1.wav");
precache_sound("debris/bustflesh2.wav");
precache_sound("debris/bustconcrete1.wav");
precache_sound("debris/bustconcrete2.wav");
precache_sound("debris/bustceiling.wav");
precache_sound("player/pl_pain2.wav");
Sound_InitVOX();
precache_model("sprites/iplayerred.spr");
precache_model("sprites/iplayerblue.spr");
@ -72,57 +33,20 @@ void CSQC_Init(float apilevel, string enginename, float engineversion) {
precache_model("models/rshell.mdl");
precache_model("models/rshell_big.mdl");
precache_model("models/shotgunshell.mdl");
precache_pic("gfx/vgui/icntlk_sv");
precache_pic("gfx/vgui/icntlk_pl");
precache_pic( sprintf( "overviews/%s.bmp", mapname ) );
PARTICLE_SPARK = particleeffectnum("part_spark");
PARTICLE_PIECES_BLACK = particleeffectnum("part_pieces_black");
PARTICLE_SMOKE_GREY = particleeffectnum("part_smoke_grey");
PARTICLE_SMOKE_BROWN = particleeffectnum("part_smoke_brown");
PARTICLE_BLOOD = particleeffectnum("part_blood");
DECAL_SHOT = particleeffectnum("decal_shot");
DECAL_GLASS = particleeffectnum("decal_glass");
PARTICLE_SMOKEGRENADE = particleeffectnum("smokegren");
FONT_16 = loadfont("16", "fonts/default", "16", -1);
FONT_CON = loadfont("font", "", "12", -1);
SHADER_CULLED = shaderforname("mirror_cull");
Radio_InitSounds();
CSQC_ConsoleCommand_Init();
CSQC_VGUI_Init();
Overview_Init();
Fade_Init();
pSeat.iOverview = FALSE;
}
void CSQC_RendererRestarted( string sDescr ) {
void CSQC_RendererRestarted(string sDescr)
{
Overview_Init();
}
/*
=================
CSQC_WorldLoaded
Whenever the world is fully initialized...
=================
*/
void CSQC_WorldLoaded( void ) {
}
/*
=================
CSQC_Shutdown
Incase you need to free something
=================
*/
void CSQC_Shutdown( void ) {
}

View file

@ -152,7 +152,7 @@ void Overview_Draw( void ) {
return;
}
drawfill( vVideoMins, vVideoResolution, '0 0 0', 1.0f, 0 );
drawfill( video_mins, video_res, '0 0 0', 1.0f, 0 );
Overview_DrawLayer();

View file

@ -6,9 +6,6 @@
*
****/
void Player_PreUpdate(void);
void Player_ResetPrediction(void);
.float pmove_frame;
.vector netorigin;
@ -46,201 +43,3 @@ string sPModels[CS_WEAPON_COUNT - 1] = {
"models/p_hegrenade.mdl",
"models/p_smokegrenade.mdl"
};
//.float bonecontrol1; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol2; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol3; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol4; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol5; //Halflife model format bone controller. This typically affects the mouth.
//.float subblendfrac; //Weird animation value specific to halflife models. On player models, this typically affects the spine's pitch.
//.float basesubblendfrac; // legs part.
.float subblend2frac; // Up/Down
void Player_Gun_Offset(void)
{
vector v1, v2;
self.eGunModel.angles = self.angles; // Set it to something consistent
gettaginfo(self, self.fWeaponBoneID); // Updates the v_ globals for the player hand bone angle
v1 = vectoangles(v_right, v_up); // Create angles from the v_ matrix
gettaginfo(self.eGunModel, self.eGunModel.fWeaponBoneID); // Updates the v_ globals for the weapon hand bone angle
v2 = vectoangles(v_right, v_up);
self.eGunModel.angles = self.angles + (v1 - v2); // The difference is applied
// Fix the origin
setorigin(self.eGunModel, self.origin); // Set it to something consistent
vector vOffset = gettaginfo(self.eGunModel, self.eGunModel.fWeaponBoneID) - gettaginfo(self, self.fWeaponBoneID);
setorigin(self.eGunModel, self.origin - vOffset);
}
void Player_Draw (void)
{
if (!self.eGunModel) {
self.eGunModel = spawn();
self.eGunModel.classname = "pmodel";
self.eGunModel.owner = self;
}
self.subblend2frac = self.flUpAngle;
// Only bother updating the model if the weapon has changed
if (self.fWeaponLast != self.weapon) {
if (self.weapon) {
setmodel(self.eGunModel, sPModels[self.weapon - 1]);
} else {
setmodel(self.eGunModel, "");
}
self.fWeaponLast = self.weapon;
// Update the bone index of the current p_ model so we can calculate the offset
// Get the weapon bone ID for the current player model
self.fWeaponBoneID = gettagindex(self, "Bip01 R Hand");
self.eGunModel.fWeaponBoneID = gettagindex(self.eGunModel, "Bip01 R Hand");
}
Animation_PlayerUpdate();
/*makevectors([0, self.angles[1], 0]);
float fDirection = dotproduct(self.velocity, v_forward);
if (fDirection != 0)
print(sprintf("fDirection: %d\n", fDirection));
if (fDirection < 0) {
self.baseframe1time -= clframetime;
self.baseframe2time -= clframetime;
self.frame2time -= clframetime;
self.frame1time -= clframetime;
} else {*/
self.baseframe1time += clframetime;
self.baseframe2time += clframetime;
self.frame2time += clframetime;
self.frame1time += clframetime;
/*}*/
self.bonecontrol5 = getplayerkeyfloat(self.entnum - 1, "voiploudness");
makevectors([0, self.angles[1], 0]);
float fCorrect = dotproduct(self.velocity, v_right);
float a, s;
if (self.velocity[0] == 0 && self.velocity[1] == 0) {
a = 0;
s = 0;
} else {
a = self.angles[1] - vectoyaw(self.velocity);
s = vlen(self.velocity);
if (s < 100) {
a *= s/100;
}
}
s /= 400;
/* Clamp */
if (a < -180) {
a += 360;
}
if (a > 180) {
a -= 360;
}
if (a > 120) {
a = 120;
}
if (a < -120) {
a = -120;
}
/* Turn torso */
self.subblendfrac = (a)/-120;
/* Correct the legs */
self.angles[1] -= a;
}
/*
=================
Player_PreDraw
=================
*/
void Player_DrawVoice(void)
{
if (getplayerkeyfloat(self.entnum - 1, INFOKEY_P_VOIPSPEAKING)) {
vector vpos = self.origin + [0,0,48];
makevectors(view_angles);
R_BeginPolygon("gfx/vgui/icntlk_pl");
R_PolygonVertex(vpos + v_right*16 - v_up*16, '1 1', [1,1,1], 1);
R_PolygonVertex(vpos - v_right*16 - v_up*16, '0 1', [1,1,1], 1);
R_PolygonVertex(vpos - v_right*16 + v_up*16, '0 0', [1,1,1], 1);
R_PolygonVertex(vpos + v_right*16 + v_up*16, '1 0', [1,1,1], 1);
R_EndPolygon();
}
}
/*
=================
Player_PreDraw
Runs as part of the addentities builtin.
Responsible for player appearance/interpolation.
=================
*/
float Player_PreDraw(void)
{
/* Run animations regardless of rendering the player */
Player_Draw();
Player_Gun_Offset();
if (autocvar_cl_thirdperson == TRUE || self.entnum != player_localentnum) {
Player_DrawVoice();
addentity(self);
addentity(self.eGunModel);
} else {
removeentity(self);
removeentity(self.eGunModel);
}
return PREDRAW_NEXT;
}
/*
=================
Player_Preupdate
We're part way through parsing new player data.
Propagate our pmove state to whatever the current frame before its stomped on (so any non-networked state updates locally).
=================
*/
void Player_PreUpdate(void)
{
self.netorigin = self.origin;
self.netvelocity = self.velocity;
self.netflags = self.flags;
self.netpmove_flags = self.pmove_flags;
//we want to predict an exact copy of the data in the new packet
/*for (; self.pmove_frame <= servercommandframe; self.pmove_frame++) {
float flSuccess = getinputstate(self.pmove_frame);*/
for ( int i = servercommandframe + 1; i <= clientcommandframe; i++ ) {
float flSuccess = getinputstate( i );
if (flSuccess == FALSE) {
continue;
}
if (i==clientcommandframe){
CSQC_Input_Frame();
}
// Partial frames are the worst
if (input_timelength == 0) {
break;
}
QPhysics_Run(self);
}
}
void Player_ResetPrediction(void)
{
self.origin = self.netorigin;
self.velocity = self.netvelocity;
self.flags = self.netflags;
self.pmove_flags = self.netpmove_flags;
setorigin( self, self.origin );
//self.pmove_frame = servercommandframe + 1;
}

View file

@ -6,8 +6,6 @@
*
****/
#include "vgui.h"
// Menus with their window titles and draw functions
vguiwindow_t vguiMenus[11] = {
{ _("VGUI_TITLE_MOTD"), VGUI_MessageOfTheDay },
@ -45,9 +43,9 @@ float CSQC_VGUI_Draw( void ) {
}
// Align the window to the center
vVGUIWindowPos = vVideoMins;
vVGUIWindowPos_x += ( vVideoResolution_x / 2 ) - 320;
vVGUIWindowPos_y += ( vVideoResolution_y / 2 ) - 240;
vVGUIWindowPos = video_mins;
vVGUIWindowPos_x += ( video_res_x / 2 ) - 320;
vVGUIWindowPos_y += ( video_res_y / 2 ) - 240;
VGUI_Window( vguiMenus[ pSeat->fVGUI_Display - 1 ].sTitle, vVGUIWindowPos, '640 480 0' );
iVGUIKey = 48;

View file

@ -6,8 +6,6 @@
*
****/
#include "vgui.h"
vguiweaponobject_t vguiWeaponTable[CS_WEAPON_COUNT] = {
{ _("WEAPON_NONE"), "" },
{ _("WEAPON_KNIFE"), "" },

View file

@ -6,8 +6,6 @@
*
****/
#include "vgui.h"
/*
====================
VGUI_MessageOfTheDay

View file

@ -6,8 +6,6 @@
*
****/
#include "vgui.h"
/*
====================
HUD_GetChatColor
@ -71,18 +69,18 @@ float VGUI_CheckMouse( vector vPos, vector vReg ) {
vSMins = vPos;
vSMaxs = vPos;
vSMins_x = vPos_x;
vSMaxs_y = vPos_y - 1;
vSMins[0] = vPos[0];
vSMaxs[1] = vPos[1] - 1;
vSMaxs_x = vPos_x + vReg_x;
vSMaxs_y = vPos_y + vReg_y;
vSMaxs[0] = vPos[0] + vReg[0];
vSMaxs[1] = vPos[1] + vReg[1];
if ( vMousePos_x >= vSMins_x && vMousePos_x <= vSMaxs_x ) {
if (vMousePos_y >= vSMins_y && vMousePos_y <= vSMaxs_y ) {
if ( mouse_pos[0] >= vSMins[0] && mouse_pos[0] <= vSMaxs[0] ) {
if (mouse_pos[1] >= vSMins[1] && mouse_pos[1] <= vSMaxs[1] ) {
return 1;
}
}
return 0;
}
@ -99,14 +97,14 @@ void VGUI_Window( string sTitle, vector vPosition, vector vSize ) {
drawfill( vPosition, vSize, VGUI_WINDOW_BGCOLOR, VGUI_WINDOW_BGALPHA );
// Sides
drawfill( vPosition, [vSize_x, 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition_x, vPosition_y + vSize_y - 1], [vSize_x, 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( vPosition, [1, vSize_y], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition_x + vSize_x - 1, vPosition_y], [1, vSize_y], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( vPosition, [vSize[0], 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition[0], vPosition[1] + vSize[1] - 1], [vSize[0], 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( vPosition, [1, vSize[1]], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition[0] + vSize[0] - 1, vPosition[1]], [1, vSize[1]], vVGUIColor, VGUI_WINDOW_FGALPHA );
// Draw the window title
CSQC_DrawText( vPosition + '16 16', sTitle, '12 12', vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE, FONT_CON );
drawfill( vPosition + '0 48', [vSize_x, 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( vPosition + '0 48', [vSize[0], 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
}
@ -122,14 +120,14 @@ void VGUI_WindowSmall( string sTitle, vector vPosition, vector vSize ) {
drawfill( vPosition, vSize, VGUI_WINDOW_BGCOLOR, VGUI_WINDOW_BGALPHA );
// Sides
drawfill( vPosition, [vSize_x, 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition_x, vPosition_y + vSize_y - 1], [vSize_x, 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( vPosition, [1, vSize_y], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition_x + vSize_x - 1, vPosition_y], [1, vSize_y], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( vPosition, [vSize[0], 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition[0], vPosition[1] + vSize[1] - 1], [vSize[0], 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( vPosition, [1, vSize[1]], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition[0] + vSize[0] - 1, vPosition[1]], [1, vSize[1]], vVGUIColor, VGUI_WINDOW_FGALPHA );
// Draw the window title
CSQC_DrawText( vPosition + '8 8', sTitle, '12 12', vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE, FONT_CON );
drawfill( vPosition + '0 24', [vSize_x, 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( vPosition + '0 24', [vSize[0], 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
}
/*
@ -146,14 +144,14 @@ float VGUI_Button( string sLabel, void() vFunction, vector vPosition, vector vSi
iVGUIKey++;
}
drawfill( vPosition, [vSize_x, 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition_x, vPosition_y + vSize_y - 1], [vSize_x, 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( vPosition, [1, vSize_y], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition_x + vSize_x - 1, vPosition_y], [1, vSize_y], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( vPosition, [vSize[0], 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition[0], vPosition[1] + vSize[1] - 1], [vSize[0], 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( vPosition, [1, vSize[1]], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition[0] + vSize[0] - 1, vPosition[1]], [1, vSize[1]], vVGUIColor, VGUI_WINDOW_FGALPHA );
// Draw the button label
vLabelPos_x = vPosition_x + 16;
vLabelPos_y = vPosition_y + ( ( vSize_y / 2 ) - 4 );
vLabelPos[0] = vPosition[0] + 16;
vLabelPos[1] = vPosition[1] + ( ( vSize[1] / 2 ) - 4 );
if ( ( iVGUIKey == fInputKeyCode ) ) {
vFunction();
@ -187,14 +185,14 @@ Looks like a button, doesn't function though. Meant for dead buttons
void VGUI_FakeButton( string sLabel, vector vPosition, vector vSize ) {
vector vLabelPos;
drawfill( vPosition, [vSize_x, 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition_x, vPosition_y + vSize_y - 1], [vSize_x, 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( vPosition, [1, vSize_y], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition_x + vSize_x - 1, vPosition_y], [1, vSize_y], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( vPosition, [vSize[0], 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition[0], vPosition[1] + vSize[1] - 1], [vSize[0], 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( vPosition, [1, vSize[1]], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition[0] + vSize[0] - 1, vPosition[1]], [1, vSize[1]], vVGUIColor, VGUI_WINDOW_FGALPHA );
// Draw the button label
vLabelPos_x = vPosition_x + 16;
vLabelPos_y = vPosition_y + ( ( vSize_y / 2 ) - 4 );
vLabelPos[0] = vPosition[0] + 16;
vLabelPos[1] = vPosition[1] + ( ( vSize[1] / 2 ) - 4 );
CSQC_DrawText( vLabelPos, sLabel, '12 12', vVGUIColor * 0.5, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE, FONT_CON );
}
@ -218,6 +216,6 @@ Right-aligned version of above
====================
*/
void VGUI_RightText( vector vPos, string sText, vector vSize, vector vColor, float fFont ) {
vPos_x -= stringwidth( sText, FALSE, vSize );
vPos[0] -= stringwidth( sText, FALSE, vSize );
CSQC_DrawText( vPos, sText, vSize, vColor, 1, 0, fFont );
}

View file

@ -6,8 +6,6 @@
*
****/
#include "vgui.h"
// Radio Commands
#define VGUIRADIO_COMMANDS 6
float fRadioCommands[ VGUIRADIO_COMMANDS ] = {
@ -73,7 +71,7 @@ void VGUI_Radio_Draw( void ) {
if ( pSeat->fVGUI_Display == VGUI_RADIO1 ) {
vSize_x = 312;
vSize_y = ( 10 * VGUIRADIO_COMMANDS ) + 64;
vPos = vVideoMins + [ 16, vVideoResolution_y - 148 - vSize_y ];
vPos = video_mins + [ 16, video_res_y - 148 - vSize_y ];
VGUI_WindowSmall( _("RADIO_TITLE1"), vPos, vSize );
@ -86,7 +84,7 @@ void VGUI_Radio_Draw( void ) {
} else if ( pSeat->fVGUI_Display == VGUI_RADIO2 ) {
vSize_x = 312;
vSize_y = ( 10 * VGUIRADIO_GROUPCOMMANDS ) + 64;
vPos = vVideoMins + [ 16, vVideoResolution_y - 148 - vSize_y ];
vPos = video_mins + [ 16, video_res_y - 148 - vSize_y ];
VGUI_WindowSmall( _("RADIO_TITLE2"), vPos, vSize );
@ -99,7 +97,7 @@ void VGUI_Radio_Draw( void ) {
} else {
vSize_x = 312;
vSize_y = ( 10 * VGUIRADIO_RESPONSES ) + 64;
vPos = vVideoMins + [ 16, vVideoResolution_y - 148 - vSize_y ];
vPos = video_mins + [ 16, video_res_y - 148 - vSize_y ];
VGUI_WindowSmall( _("RADIO_TITLE3"), vPos, vSize );

View file

@ -6,8 +6,6 @@
*
****/
#include "vgui.h"
string sScoreTeams[4] = {
_("SCORE_TITLE_SPECTATOR"),
_("SCORE_TITLE_T"),
@ -103,10 +101,10 @@ void VGUI_Scores_Show( void ) {
vector vSize;
vSize_x = 540;
vSize_y = vVideoResolution_y - 112;
vSize_y = video_res_y - 112;
vMainPos = vVideoMins;
vMainPos_x += ( vVideoResolution_x / 2 ) - (vSize_x / 2);
vMainPos = video_mins;
vMainPos_x += ( video_res_x / 2 ) - (vSize_x / 2);
vMainPos_y += 56;
// Draw the background

View file

@ -6,8 +6,6 @@
*
****/
#include "vgui.h"
/*
====================
VGUI_DrawSpectatorHUD
@ -17,8 +15,8 @@ void VGUI_DrawSpectatorHUD( void ) {
vHUDColor = autocvar_con_color * ( 1 / 255 );
// Draw the borders
drawfill( vVideoMins, [ vVideoResolution_x, 40 ], '0 0 0', 1 );
drawfill( vVideoMins + [ 0, vVideoResolution_y - 40], [ vVideoResolution_x, 40 ], '0 0 0', 1 );
drawfill( video_mins, [ video_res_x, 40 ], '0 0 0', 1 );
drawfill( video_mins + [ 0, video_res_y - 40], [ video_res_x, 40 ], '0 0 0', 1 );
// Draw the timer
int iMinutes, iSeconds, iTens, iUnits;
@ -28,17 +26,17 @@ void VGUI_DrawSpectatorHUD( void ) {
iUnits = iSeconds - 10 * iTens;
drawpic( vVideoMins + [ vVideoResolution_x - 70, 20 ], "gfx/vgui/640_timer", '14 14', '1 1 1', 1 );
VGUI_RightText( vVideoMins + [ vVideoResolution_x - 16, 23 ], sprintf( "%i:%i%i", iMinutes, iTens, iUnits ), '12 12', '0.56 0.56 0.21', FONT_CON );
drawpic( video_mins + [ video_res_x - 70, 20 ], "gfx/vgui/640_timer", '14 14', '1 1 1', 1 );
VGUI_RightText( video_mins + [ video_res_x - 16, 23 ], sprintf( "%i:%i%i", iMinutes, iTens, iUnits ), '12 12', '0.56 0.56 0.21', FONT_CON );
// Draw the money
CSQC_DrawText( vVideoMins + [ vVideoResolution_x - 67, 6 ], "$", '12 12', '0.56 0.56 0.21', 1, 0, FONT_CON );
VGUI_RightText( vVideoMins + [ vVideoResolution_x - 16, 6 ], sprintf( "%d", getstatf( STAT_MONEY ) ), '12 12', '0.56 0.56 0.21', FONT_CON );
CSQC_DrawText( video_mins + [ video_res_x - 67, 6 ], "$", '12 12', '0.56 0.56 0.21', 1, 0, FONT_CON );
VGUI_RightText( video_mins + [ video_res_x - 16, 6 ], sprintf( "%d", getstatf( STAT_MONEY ) ), '12 12', '0.56 0.56 0.21', FONT_CON );
// Seperator
drawfill( vVideoMins + [ vVideoResolution_x - 85, 6 ], [ 2, 28 ], '0.56 0.56 0.21', 1 );
drawfill( video_mins + [ video_res_x - 85, 6 ], [ 2, 28 ], '0.56 0.56 0.21', 1 );
// Team Stats
VGUI_RightText( vVideoMins + [ vVideoResolution_x - 96, 6 ], sprintf( _("VGUI_SPEC_TCOUNTER"), getstatf( STAT_WON_T ) ), '12 12', '0.56 0.56 0.21', FONT_CON );
VGUI_RightText( vVideoMins + [ vVideoResolution_x - 96, 23 ], sprintf( _("VGUI_SPEC_CTCOUNTER"), getstatf( STAT_WON_CT ) ), '12 12', '0.56 0.56 0.21', FONT_CON );
VGUI_RightText( video_mins + [ video_res_x - 96, 6 ], sprintf( _("VGUI_SPEC_TCOUNTER"), getstatf( STAT_WON_T ) ), '12 12', '0.56 0.56 0.21', FONT_CON );
VGUI_RightText( video_mins + [ video_res_x - 96, 23 ], sprintf( _("VGUI_SPEC_CTCOUNTER"), getstatf( STAT_WON_CT ) ), '12 12', '0.56 0.56 0.21', FONT_CON );
}

View file

@ -6,8 +6,6 @@
*
****/
#include "vgui.h"
string sClassInfo[64] = {
_("VGUI_T1_TITLE"), "gfx/vgui/640_terror",
_("VGUI_T1_TXT1"),

301
Source/client/cstrike/view.c Executable file → Normal file
View file

@ -6,201 +6,10 @@
*
****/
var string autocvar_skins_dir = "";
string sViewModels[ CS_WEAPON_COUNT - 1 ] = {
"v_knife.mdl",
"v_usp.mdl",
"v_glock18.mdl",
"v_deagle.mdl",
"v_p228.mdl",
"v_elite.mdl",
"v_fiveseven.mdl",
"v_m3.mdl",
"v_xm1014.mdl",
"v_mp5.mdl",
"v_p90.mdl",
"v_ump45.mdl",
"v_mac10.mdl",
"v_tmp.mdl",
"v_ak47.mdl",
"v_sg552.mdl",
"v_m4a1.mdl",
"v_aug.mdl",
"v_scout.mdl",
"v_awp.mdl",
"v_g3sg1.mdl",
"v_sg550.mdl",
"v_m249.mdl",
"v_c4.mdl",
"v_flashbang.mdl",
"v_hegrenade.mdl",
"v_smokegrenade.mdl"
};
void View_Init(void)
void View_UpdateWeapon(entity vm, entity mflash)
{
string wm;
for ( int i = 0; i < ( CS_WEAPON_COUNT - 1 ); i++ ) {
wm = sprintf("models/%s", sViewModels[i]);
precache_model(wm);
}
}
/*
====================
View_CalcBob
====================
*/
void View_CalcBob( void ) {
float fCycle;
vector vVelocity;
if ( self.flags & FL_ONGROUND == -1 ) {
return;
}
pSeat->fBobTime += clframetime;
fCycle = pSeat->fBobTime - (int)( pSeat->fBobTime / autocvar_v_bobcycle ) * autocvar_v_bobcycle;
fCycle /= autocvar_v_bobcycle;
if ( fCycle < autocvar_v_bobup ) {
fCycle = MATH_PI * fCycle / autocvar_v_bobup;
} else {
fCycle = MATH_PI + MATH_PI * ( fCycle - autocvar_v_bobup )/( 1.0 - autocvar_v_bobup );
}
vVelocity = pSeat->vPlayerVelocity;
vVelocity_z = 0;
float fBob = sqrt( vVelocity_x * vVelocity_x + vVelocity_y * vVelocity_y ) * autocvar_v_bob;
fBob = fBob * 0.3 + fBob * 0.7 * sin( fCycle );
pSeat->fBob = bound( -7, fBob, 4 );
}
/*
====================
View_DropPunchAngle
Quickly lerp to the original viewposition
====================
*/
void View_DropPunchAngle( void ) {
float fLerp;
fLerp = 1.0f - ( clframetime * 4 );
pSeat->vPunchAngle *= fLerp;
}
/*
====================
View_AddPunchAngle
Gives the angle a bit of an offset/punch/kick
====================
*/
void View_AddPunchAngle( vector vAdd ) {
pSeat->vPunchAngle += vAdd;
}
/*
====================
View_ShellEject
Spawns a shell tempentity. Looking fancy
====================
*/
void View_ShellEject( void ) {
static void View_ShellEject_Death( void ) {
remove( self );
}
vector vOrigin = pSeat->vPlayerOrigin;
vector vEndPos = gettaginfo( pSeat->eViewModel, pSeat->fEjectBone );
makevectors( view_angles );
vOrigin += ( v_forward * vEndPos_x ) + ( v_right * -vEndPos_y ) + ( v_up * vEndPos_z ) + [ 0, 0, getstatf( STAT_VIEWHEIGHT ) ];
entity eShell = spawn();
setorigin( eShell, vOrigin );
setmodel( eShell, sShellModel[ wptTable[ getstati( STAT_ACTIVEWEAPON ) ].iShellType ] );
eShell.movetype = MOVETYPE_BOUNCE;
eShell.drawmask = MASK_ENGINE;
eShell.angles = [ view_angles_x, view_angles_y, 0 ];
eShell.velocity = pSeat->vPlayerVelocity + ( v_up * random( 70, 120 ) ) + ( v_right * -random( 50, 70 ) );
eShell.avelocity = [0,45,900];
eShell.think = View_ShellEject_Death;
eShell.nextthink = time + 2.5f;
}
/*
====================
View_ProcessEvent
Called by the engine whenever a model
tries to play an event.
====================
*/
void View_ProcessEvent( float fTimeStamp, int iCode, string sData ) {
if ( iCode == 5004 ) {
localsound( sData, CHAN_AUTO, 1.0 );
} else if ( iCode == 5001 ) {
pSeat->eMuzzleflash.alpha = 1.0f;
pSeat->eMuzzleflash.scale = 0.5;
pSeat->eMuzzleflash.skin = pSeat->fNumBones;
setmodel( pSeat->eMuzzleflash, sprintf( "sprites/muzzleflash%s.spr", substring( sData, 1, 1 ) ) );
View_ShellEject();
} else if( iCode == 5011 ) {
pSeat->eMuzzleflash.alpha = 1.0f;
pSeat->eMuzzleflash.scale = 0.5;
pSeat->eMuzzleflash.skin = pSeat->fNumBones + 1;
setmodel( pSeat->eMuzzleflash, sprintf( "sprites/muzzleflash%s.spr", substring( sData, 1, 1 ) ) );
View_ShellEject();
} else if ( iCode == 5021 ) {
pSeat->eMuzzleflash.alpha = 1.0f;
pSeat->eMuzzleflash.scale = 0.5;
pSeat->eMuzzleflash.skin = pSeat->fNumBones + 2;
setmodel( pSeat->eMuzzleflash, sprintf( "sprites/muzzleflash%s.spr", substring( sData, 1, 1 ) ) );
View_ShellEject();
} else if ( iCode == 5031 ) {
pSeat->eMuzzleflash.alpha = 1.0f;
pSeat->eMuzzleflash.scale = 0.5;
pSeat->eMuzzleflash.skin = pSeat->fNumBones + 3;
setmodel( pSeat->eMuzzleflash, sprintf( "sprites/muzzleflash%s.spr", substring( sData, 1, 1 ) ) );
View_ShellEject();
}
}
/*
====================
View_DrawViewModel
Really convoluted function that makes the gun,
muzzleflash, dynamic lights and so on appear
====================
*/
void View_DrawViewModel( void ) {
if( !pSeat->eViewModel ) {
pSeat->eViewModel = spawn();
pSeat->eViewModel.classname = "view model";
pSeat->eViewModel.renderflags = RF_VIEWMODEL | RF_DEPTHHACK;
pSeat->eMuzzleflash = spawn();
pSeat->eMuzzleflash.classname = "view muzzleflash";
pSeat->eMuzzleflash.renderflags = RF_VIEWMODEL | RF_ADDITIVE;
}
entity eViewModel = pSeat->eViewModel;
entity eMuzzleflash = pSeat->eMuzzleflash;
if ( getstatf( STAT_HEALTH ) <= 0 ) {
return;
}
// Don't update when paused
if ( serverkey( "pausestate" ) == "0" ) {
View_CalcBob();
int aw = getstati( STAT_ACTIVEWEAPON );
if( aw < CS_WEAPON_COUNT ) {
int aw = getstati( STAT_ACTIVEWEAPON );
if( aw < CS_WEAPON_COUNT ) {
if ( pSeat->fLastWeapon != aw ) {
pSeat->fLastWeapon = aw;
if ( aw >= 1 ) {
@ -210,111 +19,19 @@ void View_DrawViewModel( void ) {
} else {
wm = sprintf("models/%s", sViewModels[ aw - 1 ]);
}
setmodel( eViewModel, wm );
setmodel( vm, wm );
if (getstati_punf(STAT_TEAM) == TEAM_CT) {
setcustomskin(eViewModel, "", "geomset 0 2\n");
setcustomskin(vm, "", "geomset 0 2\n");
} else {
setcustomskin(eViewModel, "", "geomset 0 1\n");
setcustomskin(vm, "", "geomset 0 1\n");
}
skel_delete( eMuzzleflash.skeletonindex );
eMuzzleflash.skeletonindex = skel_create( eViewModel.modelindex );
pSeat->fNumBones = skel_get_numbones( eMuzzleflash.skeletonindex ) + 1;
skel_delete( mflash.skeletonindex );
mflash.skeletonindex = skel_create( vm.modelindex );
pSeat->fNumBones = skel_get_numbones( mflash.skeletonindex ) + 1;
pSeat->fEjectBone = pSeat->fNumBones + 1;
}
}
}
float fBaseTime = eViewModel.frame1time;
eViewModel.frame1time += clframetime;
eViewModel.frame2time += clframetime;
processmodelevents( eViewModel.modelindex, eViewModel.frame, fBaseTime, eViewModel.frame1time, View_ProcessEvent );
}
makevectors( '0 0 0');
eViewModel.origin = '0 0 -1' + ( v_forward * ( pSeat->fBob * 0.4 ) )
+ ( v_forward * autocvar_v_gunofs[0] )
+ ( v_right * autocvar_v_gunofs[1] )
+ ( v_up * autocvar_v_gunofs[2] );
// Left-handed weapons
if ( autocvar_v_lefthanded ) {
v_right *= -1;
eViewModel.renderflags |= RF_USEAXIS;
eViewModel.forceshader = SHADER_CULLED;
} else {
if ( eViewModel.forceshader ) {
eViewModel.forceshader = 0;
eViewModel.renderflags -= RF_USEAXIS;
}
}
// Give the gun a tilt effect like in old HL/CS versions
if ( autocvar_v_bobclassic == 1 ) {
eViewModel.angles_z = -pSeat->fBob;
}
// Only bother when zoomed out
if ( getstatf( STAT_VIEWZOOM ) == 1.0f ) {
// Update muzzleflash position and draw it
if ( eMuzzleflash.alpha > 0.0f ) {
makevectors(getproperty(VF_ANGLES));
eMuzzleflash.origin = gettaginfo( eViewModel, eMuzzleflash.skin );
dynamiclight_add( pSeat->vPlayerOrigin + (v_forward * 32), 400 * eMuzzleflash.alpha, '1 0.45 0');
addentity( eMuzzleflash );
}
addentity( eViewModel );
}
}
void View_PostDraw(void)
{
entity eMuzzleflash = pSeat->eMuzzleflash;
// Take away alpha once it has drawn fully at least once
if ( eMuzzleflash.alpha > 0.0f ) {
eMuzzleflash.alpha -= ( clframetime * 16 );
}
}
void View_Stairsmooth(void)
{
vector currentpos = pSeat->vPlayerOrigin;
vector endpos = currentpos;
static vector oldpos;
/* Have we gone up since last frame? */
if ( ( pSeat->fPlayerFlags & FL_ONGROUND ) && ( endpos[2] - oldpos[2] > 0 ) ) {
endpos[2] = oldpos[2] += (frametime * 150);
if ( endpos[2] > currentpos[2] ) {
endpos[2] = currentpos[2];
}
if ( currentpos[2] - endpos[2] > 18 ) {
endpos[2] = currentpos[2] - 18;
}
}
// Teleport hack
if ( fabs( currentpos[2] - oldpos[2] ) > 64 ) {
endpos[2] = currentpos[2];
}
//setproperty(VF_ORIGIN, endpos);
pSeat->vPlayerOrigin = endpos;
oldpos = endpos;
}
/*
====================
View_PlayAnimation
Resets the timeline and plays a new sequence
onto the view model
====================
*/
void View_PlayAnimation( int iSequence ) {
pSeat->eViewModel.frame = (float)iSequence;
pSeat->eViewModel.frame1time = 0.0f;
}

54
Source/client/damage.c Normal file
View file

@ -0,0 +1,54 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
var float g_flDamageAlpha;
var vector g_vecDamageLocation;
void Damage_Draw(void)
{
float fForward;
float fRight;
vector vecMiddle;
if (g_flDamageAlpha <= 0.0) {
return;
}
vecMiddle = (video_res / 2);
makevectors(getproperty(VF_CL_VIEWANGLES));
vector location = normalize(g_vecDamageLocation - getproperty(VF_ORIGIN));
fForward = dotproduct(location, v_forward);
fRight = dotproduct(location, v_right);
if (fForward > 0.25) {
drawpic(vecMiddle + [-64,-70 - 32], "sprites/640_pain.spr_0.tga",
[128,48], [1,1,1], fabs(fForward) * g_flDamageAlpha, DRAWFLAG_ADDITIVE);
} else if (fForward < -0.25) {
drawpic(vecMiddle + [-64,70], "sprites/640_pain.spr_2.tga",
[128,48], [1,1,1], fabs(fForward) * g_flDamageAlpha, DRAWFLAG_ADDITIVE);
}
if (fRight > 0.25) {
drawpic(vecMiddle + [70,-64], "sprites/640_pain.spr_1.tga",
[48,128], [1,1,1], fabs(fRight) * g_flDamageAlpha, DRAWFLAG_ADDITIVE);
} else if (fRight < -0.25) {
drawpic(vecMiddle + [-70 - 32,-64], "sprites/640_pain.spr_3.tga",
[48,128], [1,1,1], fabs(fRight) * g_flDamageAlpha, DRAWFLAG_ADDITIVE);
}
g_flDamageAlpha -= frametime;
}
float CSQC_Parse_Damage(float save, float take, vector org)
{
if (org) {
g_vecDamageLocation = org;
g_flDamageAlpha = 1.0f;
}
sound(self, CHAN_VOICE, "player/pl_pain2.wav", 1, ATTN_NORM);
return TRUE;
}

76
Source/client/defs.h Normal file
View file

@ -0,0 +1,76 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
// flags for 2d drawing
#define DRAWFLAG_NORMAL 0
#define DRAWFLAG_ADDITIVE 1
#define DRAWFLAG_MODULATE 2
#define DRAWFLAG_2XMODULATE 3
// Undocumented printcall types
#define PRINT_LOW 0
#define PRINT_MEDIUM 1
#define PRINT_HIGH 2
#define PRINT_CHAT 3
var float FONT_16;
var float FONT_20;
var float FONT_CON;
/* Clientside CVARS */
var vector autocvar_con_color = '255 150 0'; // autocvar of "con_color"
var vector autocvar_vgui_color = '255 170 0'; // autocvar of "vgui_color"
var float autocvar_cl_bob = 0;
var float autocvar_v_bob = 0.01;
var float autocvar_v_bobcycle = 0.8;
var float autocvar_v_bobup = 0.5;
var int autocvar_v_bobclassic = FALSE;
var vector autocvar_v_gunofs = [0,0,0];
var int autocvar_cl_thirdperson = FALSE;
var int autocvar_cl_smoothstairs = TRUE;
var int autocvar_v_lefthanded = FALSE;
var string autocvar_cl_logofile = "lambda";
var vector autocvar_cl_logocolor = '255 0 0';
// Particle stuff
var float PARTICLE_SPARK;
var float PARTICLE_PIECES_BLACK;
var float PARTICLE_SMOKE_GREY;
var float PARTICLE_SMOKE_BROWN;
var float PARTICLE_BLOOD;
var float DECAL_SHOT;
var float DECAL_GLASS;
var float SHADER_CULLED;
float fInputSendNext;
vector video_mins;
vector video_res;
// Input globals, feel free to use them since they are updated upon input
float fInputKeyCode;
float fInputKeyASCII;
float fInputKeyDown;
var int iInputAttack2;
var int iInputReload;
var int iInputUse;
var int iInputDuck;
// Input globals for the mouse
float fMouseClick;
vector mouse_pos;
// This actually belongs in builtins.h since its an undocumented global
float clframetime;
int(float playernum, string keyname, optional void *outptr, int size) getplayerkeyblob = #0;

90
Source/client/entities.c Normal file
View file

@ -0,0 +1,90 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
/*
=================
CSQC_Ent_Update
Called whenever an entity is sent manually via .SendFlags and so on
=================
*/
void CSQC_Ent_Update(float flIsNew)
{
float fEntType = readbyte();
if ( fEntType == ENT_PLAYER ) {
player pl = (player)self;
if ( flIsNew == TRUE ) {
spawnfunc_player();
pl.classname = "player";
pl.solid = SOLID_SLIDEBOX;
pl.drawmask = MASK_ENGINE;
pl.customphysics = Empty;
setsize( pl, VEC_HULL_MIN, VEC_HULL_MAX );
}
pl.modelindex = readshort();
pl.origin[0] = readcoord();
pl.origin[1] = readcoord();
pl.origin[2] = readcoord();
pl.pitch = readcoord() / 90;
pl.angles[1] = readcoord();
pl.angles[2] = readcoord();
pl.velocity[0] = readcoord();
pl.velocity[1] = readcoord();
pl.velocity[2] = readcoord();
pl.flags = readfloat();
pl.pmove_flags = readfloat();
pl.weapon = readbyte();
pl.health = readbyte();
pl.movetype = readfloat();
pl.view_ofs[2] = readfloat();
pl.viewzoom = readfloat();
setorigin( pl, pl.origin );
} else if ( fEntType == ENT_SPRITE ) {
Sprite_Animated();
} else if ( fEntType == ENT_SPRAY ) {
Spraylogo_Parse();
} else if ( fEntType == ENT_DECAL ) {
string decalname = "";
string decalshader = "";
self.origin[0] = readcoord();
self.origin[1] = readcoord();
self.origin[2] = readcoord();
self.angles[0] = readcoord();
self.angles[1] = readcoord();
self.angles[2] = readcoord();
self.color[0] = 1.0f - ( readbyte() / 255 );
self.color[1] = 1.0f - ( readbyte() / 255 );
self.color[2] = 1.0f - ( readbyte() / 255 );
self.classname = readstring();
self.size = drawgetimagesize(self.classname);
if (serverkeyfloat("*bspversion") == 30) {
decalname = sprintf("decal_%s", self.classname);
decalshader = sprintf("{\npolygonOffset\n{\nclampmap %s\nblendFunc filter\n}\n}", self.classname);
shaderforname(decalname, decalshader);
self.classname = decalname;
}
makevectors( self.angles );
float surf = getsurfacenearpoint(world, self.origin);
vector s_dir = getsurfacepointattribute(world, surf, 0, SPA_S_AXIS);
vector t_dir = getsurfacepointattribute(world, surf, 0, SPA_T_AXIS);
self.mins = v_up / self.size[0];
self.maxs = t_dir / self.size[1];
self.predraw = Effect_Decal;
self.drawmask = MASK_ENGINE;
}
}

View file

@ -6,8 +6,61 @@
*
****/
void CSQC_Init(float apilevel, string enginename, float engineversion)
{
pSeat = &seats[0];
/* Fonts */
FONT_16 = loadfont("16", "fonts/default", "16", -1);
FONT_CON = loadfont("font", "", "12", -1);
FONT_20 = loadfont("cr", "creditsfont?fmt=h", "20", -1);
drawfont = FONT_CON;
/* Materials */
SHADER_CULLED = shaderforname("mirror_cull");
/* Particles */
PARTICLE_SPARK = particleeffectnum("part_spark");
PARTICLE_PIECES_BLACK = particleeffectnum("part_pieces_black");
PARTICLE_SMOKE_GREY = particleeffectnum("part_smoke_grey");
PARTICLE_SMOKE_BROWN = particleeffectnum("part_smoke_brown");
PARTICLE_BLOOD = particleeffectnum("part_blood");
DECAL_SHOT = particleeffectnum("decal_shot");
DECAL_GLASS = particleeffectnum("decal_glass");
/* 2D Pics */
precache_pic("gfx/vgui/icntlk_sv");
precache_pic("gfx/vgui/icntlk_pl");
/* GS-Entbase */
Fade_Init();
/* VOX */
Sound_InitVOX();
/* Effects */
precache_sound("debris/bustglass1.wav");
precache_sound("debris/bustglass2.wav");
precache_sound("debris/bustglass3.wav");
precache_sound("debris/bustcrate1.wav");
precache_sound("debris/bustcrate2.wav");
precache_sound("debris/bustcrate3.wav");
precache_sound("debris/bustmetal1.wav");
precache_sound("debris/bustmetal2.wav");
precache_sound("debris/bustflesh1.wav");
precache_sound("debris/bustflesh2.wav");
precache_sound("debris/bustconcrete1.wav");
precache_sound("debris/bustconcrete2.wav");
precache_sound("debris/bustceiling.wav");
/* Game specific inits */
HUD_Init();
Client_Init(apilevel, enginename, engineversion);
}
void CSQC_UpdateView(float w, float h, float focus)
{
player pl;
float needcursor;
int s;
@ -15,8 +68,8 @@ void CSQC_UpdateView(float w, float h, float focus)
return;
}
vVideoResolution_x = w;
vVideoResolution_y = h;
video_res[0] = w;
video_res[1] = h;
clearscene();
setproperty(VF_DRAWENGINESBAR, 0);
@ -26,7 +79,7 @@ void CSQC_UpdateView(float w, float h, float focus)
if (numclientseats > seats.length) {
numclientseats = seats.length;
}
for (s = seats.length; s-- > numclientseats;) {
pSeat = &seats[s];
pSeat->fVGUI_Display = VGUI_MOTD;
@ -36,17 +89,17 @@ void CSQC_UpdateView(float w, float h, float focus)
for (s = numclientseats; s-- > 0;) {
pSeat = &seats[s];
CSQC_CalcViewport(s, w, h);
View_CalcViewport(s, w, h);
setproperty(VF_ACTIVESEAT, (float)s);
pSeat->ePlayer = self = findfloat(world, entnum, player_localentnum);
if (self) {
Player_PreUpdate();
}
pSeat->vPlayerOrigin = self.origin;
pSeat->vPlayerVelocity = self.velocity;
pSeat->fPlayerFlags = self.flags;
pl = (player)self;
Predict_PreFrame((player)self);
pSeat->vPlayerOrigin = pl.origin;
pSeat->vPlayerVelocity = pl.velocity;
pSeat->fPlayerFlags = pl.flags;
// Render 3D Game Loop
#ifdef CSTRIKE
@ -54,14 +107,14 @@ void CSQC_UpdateView(float w, float h, float focus)
#endif
// Don't hide the player entity
if (autocvar_cl_thirdperson == TRUE && getstatf(STAT_HEALTH)) {
if (autocvar_cl_thirdperson == TRUE && pl.health) {
setproperty(VF_VIEWENTITY, (float)0);
} else {
setproperty(VF_VIEWENTITY, (float)player_localentnum);
}
setproperty(VF_AFOV, cvar("fov") * (getstatf(STAT_VIEWZOOM)));
setsensitivityscaler((getstatf(STAT_VIEWZOOM)));
setproperty(VF_AFOV, cvar("fov") * pl.viewzoom);
setsensitivityscaler(pl.viewzoom);
View_Stairsmooth();
@ -70,7 +123,7 @@ void CSQC_UpdateView(float w, float h, float focus)
setproperty(VF_ORIGIN, pSeat->vCameraPos);
setproperty(VF_CL_VIEWANGLES, pSeat->vCameraAngle);
} else {
if (getstatf(STAT_HEALTH)) {
if (pl.health) {
if (autocvar_cl_thirdperson == TRUE ) {
makevectors(view_angles);
vector vStart = [pSeat->vPlayerOrigin[0], pSeat->vPlayerOrigin[1], pSeat->vPlayerOrigin[2] + 16] + (v_right * 4);
@ -78,7 +131,7 @@ void CSQC_UpdateView(float w, float h, float focus)
traceline(vStart, vEnd, FALSE, self);
setproperty(VF_ORIGIN, trace_endpos + (v_forward * 5));
} else {
setproperty(VF_ORIGIN, pSeat->vPlayerOrigin + self.view_ofs);
setproperty(VF_ORIGIN, pSeat->vPlayerOrigin + pl.view_ofs);
}
} else {
setproperty(VF_ORIGIN, pSeat->vPlayerOrigin);
@ -87,33 +140,35 @@ void CSQC_UpdateView(float w, float h, float focus)
}
addentities(MASK_ENGINE);
setproperty(VF_MIN, vVideoMins);
setproperty(VF_SIZE, vVideoResolution);
setproperty(VF_MIN, video_mins);
setproperty(VF_SIZE, video_res);
setproperty(VF_ANGLES, view_angles + pSeat->vPunchAngle);
setproperty(VF_DRAWWORLD, 1);
renderscene();
View_DropPunchAngle();
Fade_Update((int)vVideoMins[0],(int)vVideoMins[1], (int)w, (int)h);
Fade_Update((int)video_mins[0],(int)video_mins[1], (int)w, (int)h);
#ifdef CSTRIKE
Cstrike_PostDraw((int)vVideoMins[0],(int)vVideoMins[1], (int)w, (int)h);
Cstrike_PostDraw((int)video_mins[0],(int)video_mins[1], (int)w, (int)h);
#endif
View_PostDraw();
if(focus == TRUE) {
GameText_Draw();
// The spectator sees things... differently
if (getplayerkeyvalue(player_localnum, "*spec") != "0") {
VGUI_DrawSpectatorHUD();
///VGUI_DrawSpectatorHUD();
} else {
HUD_Draw();
}
HUD_DrawOrbituaries();
HUD_DrawVoice();
CSQC_DrawChat();
///HUD_DrawOrbituaries();
Voice_DrawHUD();
///CSQC_DrawChat();
#ifdef CSTRIKE
// Don't even try to draw centerprints and VGUI menus when scores are shown
if (pSeat->iShowScores == TRUE || getstatf(STAT_GAMESTATE) == GAME_OVER) {
VGUI_Scores_Show();
@ -121,11 +176,10 @@ void CSQC_UpdateView(float w, float h, float focus)
CSQC_DrawCenterprint();
needcursor |= CSQC_VGUI_Draw();
}
#endif
}
if (self) {
Player_ResetPrediction();
}
Predict_PostFrame((player)self);
}
pSeat = (void*)0x70000000i;
@ -137,4 +191,278 @@ void CSQC_UpdateView(float w, float h, float focus)
}
Sound_ProcessWordQue();
CSQC_DrawText([16,16], "THIS IS A TEST.\n", [20,20], [1,1,1], 1.0f,
0, FONT_20);
}
/*
=================
CSQC_InputEvent
Updates all our input related globals for use in other functions
=================
*/
float CSQC_InputEvent(float fEventType, float fKey, float fCharacter,
float fDeviceID)
{
switch(fEventType) {
case IE_KEYDOWN:
if (fKey == K_MOUSE1) {
fMouseClick = 1;
} else {
fInputKeyDown = 1;
}
fInputKeyCode = fKey;
fInputKeyASCII = fCharacter;
break;
case IE_KEYUP:
if (fKey == K_MOUSE1) {
fMouseClick = 0;
} else {
fInputKeyDown = 0;
}
fInputKeyCode = 0;
fInputKeyASCII = 0;
break;
case IE_MOUSEABS:
mouse_pos[0] = fKey;
mouse_pos[1] = fCharacter;
break;
case IE_MOUSEDELTA:
mouse_pos[0] += fKey;
mouse_pos[1] += fCharacter;
if (mouse_pos[0] < 0) {
mouse_pos[0] = 0;
} else if (mouse_pos[0] > video_res[0]) {
mouse_pos[0] = video_res[0];
}
if (mouse_pos[1] < 0) {
mouse_pos[1] = 0;
} else if (mouse_pos[1] > video_res[1]) {
mouse_pos[1] = video_res[1];
}
break;
default:
return TRUE;
}
return FALSE;
}
/*
=================
CSQC_Input_Frame
Hijacks and controls what input globals are being sent to the server
=================
*/
void CSQC_Input_Frame(void)
{
int s = (float)getproperty(VF_ACTIVESEAT);
pSeat = &seats[s];
#ifdef CSTRIKE
// If we are inside a VGUI, don't let the client do stuff outside
if ((pSeat->fVGUI_Display != VGUI_NONE)) {
fInputSendNext = time + 0.2;
} else if ((pSeat->fHUDWeaponSelected) && (input_buttons & INPUT_BUTTON0)) {
HUD_DrawWeaponSelect_Trigger();
input_buttons = 0;
fInputSendNext = time + 0.2;
}
#endif
if (fInputSendNext > time) {
input_impulse = 0;
input_buttons = 0;
return;
}
if (input_impulse == 101) {
print("This aint Half-Life.\n");
input_impulse = 0;
}
if (input_impulse == 201) {
sendevent("Spraylogo", "");
}
if (iInputAttack2 == TRUE) {
input_buttons |= INPUT_BUTTON3;
}
if (iInputReload == TRUE) {
input_buttons |= INPUT_BUTTON4;
}
if (iInputUse == TRUE) {
input_buttons |= INPUT_BUTTON5;
}
if (iInputDuck == TRUE) {
input_buttons |= INPUT_BUTTON8;
}
input_angles += pSeat->vPunchAngle;
}
/*
=================
CSQC_Parse_Event
Whenever we call a SVC_CGAMEPACKET on the SSQC, this is being run
=================
*/
void CSQC_Parse_Event(void) {
/* always 0, unless it was sent with a MULTICAST_ONE or MULTICAST_ONE_R to p2+ */
int s = (float)getproperty(VF_ACTIVESEAT);
pSeat = &seats[s];
float fHeader = readbyte();
switch (fHeader) {
case EV_FADE:
Fade_Parse();
break;
case EV_SPRITE:
Sprite_ParseEvent();
break;
case EV_TEXT:
GameText_Parse();
break;
case EV_MESSAGE:
GameMessage_Parse();
break;
case EV_SPARK:
vector vSparkPos, vSparkAngle;
vSparkPos_x = readcoord();
vSparkPos_y = readcoord();
vSparkPos_z = readcoord();
vSparkAngle_x = readcoord();
vSparkAngle_y = readcoord();
vSparkAngle_z = readcoord();
Effect_CreateSpark(vSparkPos, vSparkAngle);
break;
case EV_EXPLOSION:
vector vExploPos;
vExploPos_x = readcoord();
vExploPos_y = readcoord();
vExploPos_z = readcoord();
Effect_CreateExplosion(vExploPos);
break;
case EV_MODELGIB:
vector vPos;
vPos_x = readcoord();
vPos_y = readcoord();
vPos_z = readcoord();
vector vSize;
vSize_x = readcoord();
vSize_y = readcoord();
vSize_z = readcoord();
float fStyle = readbyte();
Effect_BreakModel(vPos, vSize, '0 0 0', fStyle);
break;
case EV_CAMERATRIGGER:
pSeat->vCameraPos.x = readcoord();
pSeat->vCameraPos.y = readcoord();
pSeat->vCameraPos.z = readcoord();
pSeat->vCameraAngle.x = readcoord();
pSeat->vCameraAngle.y = readcoord();
pSeat->vCameraAngle.z = readcoord();
pSeat->fCameraTime = time + readfloat();
break;
case EV_IMPACT:
int iType;
vector vOrigin, vNormal;
iType = (int)readbyte();
vOrigin_x = readcoord();
vOrigin_y = readcoord();
vOrigin_z = readcoord();
vNormal_x = readcoord();
vNormal_y = readcoord();
vNormal_z = readcoord();
Effect_Impact(iType, vOrigin, vNormal);
break;
default:
Game_Parse_Event(fHeader);
}
}
float CSQC_ConsoleCommand(string sCMD)
{
/* the engine will hide the p1 etc commands... which is fun... */
int s = (float)getproperty(VF_ACTIVESEAT);
pSeat = &seats[s];
tokenize(sCMD);
switch (argv(0)) {
case "vox_test":
Sound_PlayVOX(sCMD);
break;
case "+attack2":
iInputAttack2 = TRUE;
break;
case "-attack2":
iInputAttack2 = FALSE;
break;
case "+reload":
iInputReload = TRUE;
break;
case "-reload":
iInputReload = FALSE;
break;
case "+use":
iInputUse = TRUE;
break;
case "-use":
iInputUse = FALSE;
break;
case "+duck":
iInputDuck = TRUE;
break;
case "-duck":
iInputDuck = FALSE;
break;
default:
return Game_ConsoleCommand();
}
return TRUE;
}
/*
=================
CSQC_WorldLoaded
Whenever the world is fully initialized...
=================
*/
void CSQC_WorldLoaded(void)
{
}
/*
=================
CSQC_Shutdown
Incase you need to free something
=================
*/
void CSQC_Shutdown(void)
{
}

76
Source/client/events.c Normal file
View file

@ -0,0 +1,76 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
/*
====================
View_ShellEject
Spawns a shell tempentity. Looking fancy
====================
*/
void Event_EjectShell( void ) {
static void Event_EjectShell_Death( void ) {
remove( self );
}
vector vOrigin = pSeat->vPlayerOrigin;
vector vEndPos = gettaginfo( pSeat->eViewModel, pSeat->fEjectBone );
makevectors( view_angles );
vOrigin += ( v_forward * vEndPos_x ) + ( v_right * -vEndPos_y ) + ( v_up * vEndPos_z ) + [ 0, 0, getstatf( STAT_VIEWHEIGHT ) ];
entity eShell = spawn();
setorigin( eShell, vOrigin );
#ifdef CSTRIKE
setmodel( eShell, sShellModel[ wptTable[ getstati( STAT_ACTIVEWEAPON ) ].iShellType ] );
#endif
eShell.movetype = MOVETYPE_BOUNCE;
eShell.drawmask = MASK_ENGINE;
eShell.angles = [ view_angles_x, view_angles_y, 0 ];
eShell.velocity = pSeat->vPlayerVelocity + ( v_up * random( 70, 120 ) ) + ( v_right * -random( 50, 70 ) );
eShell.avelocity = [0,45,900];
eShell.think = Event_EjectShell_Death;
eShell.nextthink = time + 2.5f;
}
/*
====================
Event_ProcessModel
Called by the engine whenever a model
tries to play an event.
====================
*/
void Event_ProcessModel( float fTimeStamp, int iCode, string sData ) {
if ( iCode == 5004 ) {
localsound( sData, CHAN_AUTO, 1.0 );
} else if ( iCode == 5001 ) {
pSeat->eMuzzleflash.alpha = 1.0f;
pSeat->eMuzzleflash.scale = 0.5;
pSeat->eMuzzleflash.skin = pSeat->fNumBones;
setmodel( pSeat->eMuzzleflash, sprintf( "sprites/muzzleflash%s.spr", substring( sData, 1, 1 ) ) );
Event_EjectShell();
} else if( iCode == 5011 ) {
pSeat->eMuzzleflash.alpha = 1.0f;
pSeat->eMuzzleflash.scale = 0.5;
pSeat->eMuzzleflash.skin = pSeat->fNumBones + 1;
setmodel( pSeat->eMuzzleflash, sprintf( "sprites/muzzleflash%s.spr", substring( sData, 1, 1 ) ) );
Event_EjectShell();
} else if ( iCode == 5021 ) {
pSeat->eMuzzleflash.alpha = 1.0f;
pSeat->eMuzzleflash.scale = 0.5;
pSeat->eMuzzleflash.skin = pSeat->fNumBones + 2;
setmodel( pSeat->eMuzzleflash, sprintf( "sprites/muzzleflash%s.spr", substring( sData, 1, 1 ) ) );
Event_EjectShell();
} else if ( iCode == 5031 ) {
pSeat->eMuzzleflash.alpha = 1.0f;
pSeat->eMuzzleflash.scale = 0.5;
pSeat->eMuzzleflash.skin = pSeat->fNumBones + 3;
setmodel( pSeat->eMuzzleflash, sprintf( "sprites/muzzleflash%s.spr", substring( sData, 1, 1 ) ) );
Event_EjectShell();
}
}

53
Source/client/hud_voice.c Normal file
View file

@ -0,0 +1,53 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
/*
=================
HUD_DrawVoice
Draws a little notification for anyone using voice chat
=================
*/
void Voice_DrawHUD(void) {
vector pos = video_mins + [video_res[0] - 160, video_res[1] - 136];
/*for (int i = -1; i > -32; i--) {
if (getplayerkeyfloat(i, INFOKEY_P_VOIPSPEAKING) == 1) {
drawfill(pos, [144,24], VGUI_WINDOW_BGCOLOR, VGUI_WINDOW_BGALPHA);
drawfill(pos, [144, 1], vVGUIColor, VGUI_WINDOW_FGALPHA);
drawfill([pos[0], pos[1] + 23], [144, 1], vVGUIColor, VGUI_WINDOW_FGALPHA);
drawfill(pos, [1, 24], vVGUIColor, VGUI_WINDOW_FGALPHA);
drawfill([pos[0] + 143, pos[1]], [1, 24], vVGUIColor, VGUI_WINDOW_FGALPHA);
CSQC_DrawText([pos[0] + 28, pos[1] + 8], getplayerkeyvalue(i, "name"), [12,12], vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_NORMAL, FONT_CON);
drawpic(pos + [2,0], "gfx/vgui/icntlk_sv.tga", [24,24], vVGUIColor, 1, DRAWFLAG_NORMAL);
pos[1] -= 32;
}
}*/
}
/*
=================
Player_PreDraw
=================
*/
void Voice_Draw3D(entity t)
{
if (getplayerkeyfloat(t.entnum - 1, INFOKEY_P_VOIPSPEAKING)) {
vector vpos = t.origin + [0,0,48];
makevectors(view_angles);
R_BeginPolygon("gfx/vgui/icntlk_pl");
R_PolygonVertex(vpos + v_right*16 - v_up*16, '1 1', [1,1,1], 1);
R_PolygonVertex(vpos - v_right*16 - v_up*16, '0 1', [1,1,1], 1);
R_PolygonVertex(vpos - v_right*16 + v_up*16, '0 0', [1,1,1], 1);
R_PolygonVertex(vpos + v_right*16 + v_up*16, '1 0', [1,1,1], 1);
R_EndPolygon();
}
}

157
Source/client/player.c Normal file
View file

@ -0,0 +1,157 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
class player
{
entity p_model;
int p_hand_bone;
int p_model_bone;
vector netorigin;
vector netvelocity;
float netflags;
float weapon;
float lastweapon;
float health;
float armor;
float pitch;
float viewzoom;
vector view_ofs;
virtual void() gun_offset;
virtual void() draw;
virtual float() predraw;
};
//.float bonecontrol1; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol2; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol3; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol4; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol5; //Halflife model format bone controller. This typically affects the mouth.
//.float subblendfrac; //Weird animation value specific to halflife models. On player models, this typically affects the spine's pitch.
//.float basesubblendfrac; // legs part.
.float subblend2frac; // Up/Down
void player::gun_offset(void)
{
vector v1, v2;
this.p_model.angles = this.angles; // Set it to something consistent
gettaginfo(this, this.p_hand_bone); // Updates the v_ globals for the player hand bone angle
v1 = vectoangles(v_right, v_up); // Create angles from the v_ matrix
gettaginfo(this.p_model, this.p_model_bone); // Updates the v_ globals for the weapon hand bone angle
v2 = vectoangles(v_right, v_up);
this.p_model.angles = this.angles + (v1 - v2); // The difference is applied
// Fix the origin
setorigin(this.p_model, this.origin); // Set it to something consistent
vector ofs = gettaginfo(this.p_model, this.p_model_bone) - gettaginfo(this, this.p_hand_bone);
setorigin(this.p_model, this.origin - ofs);
}
void player::draw(void)
{
if (!this.p_model) {
this.p_model = spawn();
this.p_model.classname = "pmodel";
this.p_model.owner = this;
}
this.subblend2frac = this.pitch;
// Only bother updating the model if the weapon has changed
if (this.lastweapon != this.weapon) {
if (this.weapon) {
// FIXME: setmodel(this.p_model, sPModels[this.weapon - 1]);
} else {
setmodel(this.p_model, "");
}
this.lastweapon = this.weapon;
// Update the bone index of the current p_ model so we can calculate the offset
// Get the weapon bone ID for the current player model
this.p_hand_bone = gettagindex(this, "Bip01 R Hand");
this.p_model_bone = gettagindex(this.p_model, "Bip01 R Hand");
}
//Animation_PlayerUpdate();
/*makevectors([0, this.angles[1], 0]);
float fDirection = dotproduct(this.velocity, v_forward);
if (fDirection != 0)
print(sprintf("fDirection: %d\n", fDirection));
if (fDirection < 0) {
this.baseframe1time -= clframetime;
this.baseframe2time -= clframetime;
this.frame2time -= clframetime;
this.frame1time -= clframetime;
} else {*/
this.baseframe1time += clframetime;
this.baseframe2time += clframetime;
this.frame2time += clframetime;
this.frame1time += clframetime;
/*}*/
this.bonecontrol5 = getplayerkeyfloat(this.entnum - 1, "voiploudness");
makevectors([0, this.angles[1], 0]);
float fCorrect = dotproduct(this.velocity, v_right);
float a, s;
if (this.velocity[0] == 0 && this.velocity[1] == 0) {
a = 0;
s = 0;
} else {
a = this.angles[1] - vectoyaw(this.velocity);
s = vlen(this.velocity);
if (s < 100) {
a *= s/100;
}
}
s /= 400;
/* Clamp */
if (a < -180) {
a += 360;
}
if (a > 180) {
a -= 360;
}
if (a > 120) {
a = 120;
}
if (a < -120) {
a = -120;
}
/* Turn torso */
this.subblendfrac = (a)/-120;
/* Correct the legs */
this.angles[1] -= a;
}
float player::predraw(void)
{
/* Run animations regardless of rendering the player */
draw();
gun_offset();
if (autocvar_cl_thirdperson == TRUE || this.entnum != player_localentnum) {
Voice_Draw3D(this);
addentity(this);
addentity(this.p_model);
} else {
removeentity(this);
removeentity(this.p_model);
}
return PREDRAW_NEXT;
}

63
Source/client/predict.c Normal file
View file

@ -0,0 +1,63 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
/*
=================
Predict_PreFrame
We're part way through parsing new player data.
Propagate our pmove state to whatever the current frame before its stomped on
(so any non-networked state updates locally).
=================
*/
void Predict_PreFrame(player pl)
{
pl.netorigin = pl.origin;
pl.netvelocity = pl.velocity;
pl.netflags = pl.flags;
//self.netpmove_flags = self.pmove_flags;
//we want to predict an exact copy of the data in the new packet
/*for (; self.pmove_frame <= servercommandframe; self.pmove_frame++) {
float flSuccess = getinputstate(self.pmove_frame);*/
for ( int i = servercommandframe + 1; i <= clientcommandframe; i++ ) {
float flSuccess = getinputstate( i );
if (flSuccess == FALSE) {
continue;
}
if (i==clientcommandframe){
CSQC_Input_Frame();
}
// Partial frames are the worst
if (input_timelength == 0) {
break;
}
QPhysics_Run(pl);
}
}
/*
=================
Predict_PostFrame
We're part way through parsing new player data.
Propagate our pmove state to whatever the current frame before its stomped on
(so any non-networked state updates locally).
=================
*/
void Predict_PostFrame(player pl)
{
pl.origin = pl.netorigin;
pl.velocity = pl.netvelocity;
pl.flags = pl.netflags;
//self.pmove_flags = self.netpmove_flags;
setorigin(pl, pl.origin);
//self.pmove_frame = servercommandframe + 1;
}

14
Source/client/text.c Normal file
View file

@ -0,0 +1,14 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
void CSQC_DrawText(vector pos, string txt, vector sz, vector col, float a,
float fl, float fnt)
{
drawfont = fnt;
drawstring(pos, txt, sz, col, a, fl);
}

12
Source/client/util.c Normal file
View file

@ -0,0 +1,12 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
void Empty(void)
{
}

View file

@ -2,78 +2,42 @@
#pragma progs_dat "../../valve/csprogs.dat"
#define CSQC
#define CSTRIKE
#define VALVE
#includelist
../builtins.h
../defs.h
../shared/cstrike/defs.h
../math.h
../materials.h
../events.h
../entities.h
cstrike/defs.h
valve/defs.h
defs.h
vgui.h
../shared/cstrike/weaponak47.c
../shared/cstrike/weaponaug.c
../shared/cstrike/weaponawp.c
../shared/cstrike/weaponc4bomb.c
../shared/cstrike/weapondeagle.c
../shared/cstrike/weaponelites.c
../shared/cstrike/weaponfiveseven.c
../shared/cstrike/weaponflashbang.c
../shared/cstrike/weapong3sg1.c
../shared/cstrike/weaponglock18.c
../shared/cstrike/weaponhegrenade.c
../shared/cstrike/weaponknife.c
../shared/cstrike/weaponm3.c
../shared/cstrike/weaponm4a1.c
../shared/cstrike/weaponmac10.c
../shared/cstrike/weaponmp5.c
../shared/cstrike/weaponp228.c
../shared/cstrike/weaponp90.c
../shared/cstrike/weaponpara.c
../shared/cstrike/weaponscout.c
../shared/cstrike/weaponsg550.c
../shared/cstrike/weaponsg552.c
../shared/cstrike/weaponsmokegrenade.c
../shared/cstrike/weapontmp.c
../shared/cstrike/weaponump45.c
../shared/cstrike/weaponusp45.c
../shared/cstrike/weaponxm1014.c
../shared/cstrike/basegun.c
../shared/cstrike/weapons.c
../shared/cstrike/radio.c
../shared/cstrike/equipment.c
../shared/cstrike/animations.c
../shared/effects.c
util.c
valve/init.c
../gs-entbase/client.src
../shared/pmove.c
../gs-entbase/client.src
sound.c
text.c
hud_voice.c
player.c
predict.c
../shared/effects.c
../shared/spraylogo.cpp
cstrike/overview.c
cstrike/player.c
cstrike/view.c
cstrike/vguiobjects.c
cstrike/vguispectator.c
cstrike/vguiscoreboard.c
cstrike/vguimotd.c
cstrike/vguibuymenu.c
cstrike/vguiteamselect.c
cstrike/vguiradio.c
cstrike/vgui.c
cstrike/damage.c
cstrike/nightvision.c
cstrike/hudcrosshair.c
cstrike/hudscope.c
cstrike/hudweaponselect.c
cstrike/hudorbituaries.c
cstrike/hud.c
cstrike/sound.c
cstrike/draw.c
cstrike/entities.c
cstrike/event.c
cstrike/init.c
entities.c
valve/cmds.c
valve/game_event.c
events.c
valve/view.c
view.c
damage.c
valve/hud.c
entry.c
#endlist

View file

@ -0,0 +1,16 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
float Game_ConsoleCommand(void)
{
switch(argv(0)) {
default:
return FALSE;
}
return TRUE;
}

View file

@ -0,0 +1,59 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
struct
{
//Viewmodel stuff
entity eViewModel;
entity eMuzzleflash;
float fNumBones;
float fEjectBone;
vector vPunchAngle;
float fLastWeapon;
float fBobTime;
float fBob;
//Player fields
entity ePlayer;
vector vPlayerOrigin;
vector vPlayerOriginOld;
vector vPlayerVelocity;
float fPlayerFlags;
// Camera Fields
//entity ePlayerEnt;
vector vCameraPos;
vector vCameraAngle;
float fCameraTime;
// Flashbang'd
float fFlashTime;
float fFlashAlpha;
//UI fields
float fVGUI_Display; // The VGUI menu currently being drawn
int iShowScores; // This is seperated from the other VGUI stuff so we can check scores while buying and whatnot
// Testing
int iOverview;
int iMapExpand;
float fMapLerp;
//crosshair
int iOldShotMultiplier;
float fCrosshairDistance;
float fDecreaseShotTime;
int iShotMultiplier;
//buy menu
// We can only carry one item per slot, so this is hacking around the last one
int iHUDGrenades;
int iHUDGrenadesSelected;
float fHUDWeaponSelectTime;
float fHUDWeaponSelected;
} seats[4], *pSeat;

View file

@ -0,0 +1,12 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
void Game_Parse_Event(float fHeader)
{
}

View file

@ -1,4 +1,186 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
/* Use first frame for drawing (needs precache) */
#define HUD_NUMS "sprites/640hud7.spr_0.tga"
#define NUMSIZE_X 24/256
#define NUMSIZE_Y 24/128
#define HUD_ALPHA 0.5
vector g_hud_color;
float spr_hudnum[10] = {
0 / 256,
24 / 256,
(24*2) / 256,
(24*3) / 256,
(24*4) / 256,
(24*5) / 256,
(24*6) / 256,
(24*7) / 256,
(24*8) / 256,
(24*9) / 256
};
float spr_health[4] = {
80 / 256, // pos x
24 / 128, // pos u
32 / 256, // size x
32 / 128 // size y
};
float spr_suit1[4] = {
10 / 256, // pos x
24 / 128, // pos u
30 / 256, // size x
40 / 128 // size y
};
float spr_suit2[4] = {
50 / 256, // pos x
24 / 128, // pos u
30 / 256, // size x
40 / 128 // size y
};
float spr_flash1[4] = {
160 / 256, // pos x
24 / 128, // pos u
32 / 256, // size x
32 / 128 // size y
};
float spr_flash2[4] = {
112 / 256, // pos x
24 / 128, // pos u
48 / 256, // size x
32 / 128 // size y
};
void HUD_Init(void)
{
precache_model("sprites/640hud7.spr");
}
/*
=================
HUD_DrawNumber
Draws a normal number
=================
*/
void HUD_DrawNumber(int iNumber, vector vPos, float fAlpha, vector vColor) {
drawsubpic(vPos, [24,24], HUD_NUMS, [spr_hudnum[iNumber], 0],
[NUMSIZE_X, NUMSIZE_Y], vColor, fAlpha, DRAWFLAG_ADDITIVE);
}
/*
=================
HUD_DrawNums
Draws numerals quickly for health, armor etc.
=================
*/
void HUD_DrawNums(float fNumber, vector vPos, float fAlpha, vector vColor) {
int iNumber = fNumber;
if (iNumber > 0) {
while (iNumber > 0) {
HUD_DrawNumber((float)iNumber % 10, vPos, fAlpha, vColor);
iNumber = iNumber / 10;
vPos[0] -= 20;
}
} else {
HUD_DrawNumber(0, vPos, fAlpha, vColor);
}
}
/*
=================
HUD_DrawHealth
Draw the current amount of health
=================
*/
void HUD_DrawHealth(void) {
player pl = (player)self;
static float fOldHealth;
static float fHealthAlpha;
if (pl.health != fOldHealth) {
fHealthAlpha = 1.0;
}
if (fHealthAlpha >= HUD_ALPHA) {
fHealthAlpha -= frametime * 0.5;
} else {
fHealthAlpha = HUD_ALPHA;
}
vector pos = video_mins + [16, video_res[1] - 42];
if (pl.health > 25) {
drawsubpic(pos + [0,-4], [32,32], HUD_NUMS, [spr_health[0], spr_health[1]],
[spr_health[2], spr_health[3]], g_hud_color, HUD_ALPHA, DRAWFLAG_ADDITIVE);
HUD_DrawNums(pl.health, pos + [72, 0], HUD_ALPHA, g_hud_color);
} else {
drawsubpic(pos + [0,-4], [32,32], HUD_NUMS, [spr_health[0], spr_health[1]],
[spr_health[2], spr_health[3]], [1,0,0], HUD_ALPHA, DRAWFLAG_ADDITIVE);
HUD_DrawNums(pl.health, pos + [72, 0], HUD_ALPHA, [1,0,0]);
}
fOldHealth = pl.health;
}
/*
=================
HUD_DrawArmor
Draw the current amount of armor
=================
*/
void HUD_DrawArmor(void)
{
vector pos;
static float oldarmor;
static float armoralpha;
player pl = (player)self;
pos = video_mins + [128, video_res[1] - 42];
if (pl.armor != oldarmor) {
armoralpha = 1.0;
}
if (armoralpha >= HUD_ALPHA) {
armoralpha -= frametime * 0.5;
} else {
armoralpha = HUD_ALPHA;
}
drawsubpic(pos + [0,-9], [30,40], HUD_NUMS, [spr_suit2[0], spr_suit2[1]],
[spr_suit2[2], spr_suit2[3]], g_hud_color, armoralpha, DRAWFLAG_ADDITIVE);
HUD_DrawNums(pl.armor, pos + [72, 0], armoralpha, g_hud_color);
oldarmor = pl.armor;
}
void HUD_DrawFlashlight(void)
{
vector pos;
pos = video_mins + [video_res[0] - 48, 16];
drawsubpic(pos, [32,32], HUD_NUMS, [spr_flash1[0], spr_flash1[1]],
[spr_flash1[2], spr_flash1[3]], g_hud_color, HUD_ALPHA, DRAWFLAG_ADDITIVE);
}
void HUD_Draw(void)
{
g_hud_color = autocvar_con_color * (1 / 255);
HUD_DrawHealth();
HUD_DrawArmor();
HUD_DrawFlashlight();
Damage_Draw();
}

View file

@ -0,0 +1,19 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
/*
=================
Client_Init
Comparable to worldspawn in SSQC in that it's mostly used for precaches
=================
*/
void Client_Init(float apilevel, string enginename, float engineversion)
{
}

View file

@ -0,0 +1,36 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
void View_UpdateWeapon(entity vm, entity mflash)
{
/*if( aw < CS_WEAPON_COUNT ) {
if ( pSeat->fLastWeapon != aw ) {
pSeat->fLastWeapon = aw;
if ( aw >= 1 ) {
string wm;
if (autocvar_skins_dir != "") {
wm = sprintf("skins/%s/%s", autocvar_skins_dir, sViewModels[ aw - 1 ]);
} else {
wm = sprintf("models/%s", sViewModels[ aw - 1 ]);
}
setmodel( eViewModel, wm );
if (getstati_punf(STAT_TEAM) == TEAM_CT) {
setcustomskin(eViewModel, "", "geomset 0 2\n");
} else {
setcustomskin(eViewModel, "", "geomset 0 1\n");
}
skel_delete( eMuzzleflash.skeletonindex );
eMuzzleflash.skeletonindex = skel_create( eViewModel.modelindex );
pSeat->fNumBones = skel_get_numbones( eMuzzleflash.skeletonindex ) + 1;
pSeat->fEjectBone = pSeat->fNumBones + 1;
}
}
}*/
}

225
Source/client/view.c Executable file
View file

@ -0,0 +1,225 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
void View_Init(void)
{
#ifdef CSTRIKE
string wm;
for ( int i = 0; i < ( CS_WEAPON_COUNT - 1 ); i++ ) {
wm = sprintf("models/%s", sViewModels[i]);
precache_model(wm);
}
#endif
}
void View_CalcViewport(int s, float fWinWidth, float fWinHeight) {
//FIXME: this is awkward. renderscene internally rounds to pixels.
//on the other hand, drawpic uses linear filtering and multisample and stuff.
//this means that there can be a pixel or so difference between scene and 2d.
//as a general rule, you won't notice unless there's some big drawfills.
switch (numclientseats) {
case 3:
if (!s) {
case 2:
video_res = [fWinWidth, fWinHeight * 0.5];
video_mins = [0, (s & 1) * video_res[1]];
break;
}
s++;
case 4:
video_res = [fWinWidth, fWinHeight] * 0.5;
video_mins = [(s&1) * video_res[0], (s / 2i) * video_res[1]];
break;
default:
video_res = [fWinWidth, fWinHeight];
video_mins = [0, 0];
break;
}
}
/*
====================
View_CalcBob
====================
*/
void View_CalcBob( void )
{
float cycle;
vector vel;
if ( self.flags & FL_ONGROUND == -1 ) {
return;
}
pSeat->fBobTime += clframetime;
cycle = pSeat->fBobTime - (int)( pSeat->fBobTime / autocvar_v_bobcycle ) * autocvar_v_bobcycle;
cycle /= autocvar_v_bobcycle;
if ( cycle < autocvar_v_bobup ) {
cycle = MATH_PI * cycle / autocvar_v_bobup;
} else {
cycle = MATH_PI + MATH_PI * ( cycle - autocvar_v_bobup )/( 1.0 - autocvar_v_bobup );
}
vel = pSeat->vPlayerVelocity;
vel_z = 0;
float fBob = sqrt( vel_x * vel_x + vel_y * vel_y ) * autocvar_v_bob;
fBob = fBob * 0.3 + fBob * 0.7 * sin( cycle );
pSeat->fBob = bound( -7, fBob, 4 );
}
/*
====================
View_DropPunchAngle
Quickly lerp to the original viewposition
====================
*/
void View_DropPunchAngle( void ) {
float lerp;
lerp = 1.0f - ( clframetime * 4 );
pSeat->vPunchAngle *= lerp;
}
/*
====================
View_AddPunchAngle
Gives the angle a bit of an offset/punch/kick
====================
*/
void View_AddPunchAngle( vector add )
{
pSeat->vPunchAngle += add;
}
/*
====================
View_DrawViewModel
Really convoluted function that makes the gun,
muzzleflash, dynamic lights and so on appear
====================
*/
void View_DrawViewModel( void )
{
if( !pSeat->eViewModel ) {
pSeat->eViewModel = spawn();
pSeat->eViewModel.classname = "vm";
pSeat->eViewModel.renderflags = RF_VIEWMODEL | RF_DEPTHHACK;
pSeat->eMuzzleflash = spawn();
pSeat->eMuzzleflash.classname = "mflash";
pSeat->eMuzzleflash.renderflags = RF_VIEWMODEL | RF_ADDITIVE;
}
entity eViewModel = pSeat->eViewModel;
entity eMuzzleflash = pSeat->eMuzzleflash;
if ( getstatf( STAT_HEALTH ) <= 0 ) {
return;
}
// Don't update when paused
if ( serverkey( "pausestate" ) == "0" ) {
View_CalcBob();
View_UpdateWeapon(eViewModel, eMuzzleflash);
float fBaseTime = eViewModel.frame1time;
eViewModel.frame1time += clframetime;
eViewModel.frame2time += clframetime;
processmodelevents( eViewModel.modelindex, eViewModel.frame, fBaseTime, eViewModel.frame1time, Event_ProcessModel );
}
makevectors( '0 0 0');
eViewModel.origin = '0 0 -1' + ( v_forward * ( pSeat->fBob * 0.4 ) )
+ ( v_forward * autocvar_v_gunofs[0] )
+ ( v_right * autocvar_v_gunofs[1] )
+ ( v_up * autocvar_v_gunofs[2] );
// Left-handed weapons
if ( autocvar_v_lefthanded ) {
v_right *= -1;
eViewModel.renderflags |= RF_USEAXIS;
eViewModel.forceshader = SHADER_CULLED;
} else {
if ( eViewModel.forceshader ) {
eViewModel.forceshader = 0;
eViewModel.renderflags -= RF_USEAXIS;
}
}
// Give the gun a tilt effect like in old HL/CS versions
if ( autocvar_v_bobclassic == 1 ) {
eViewModel.angles_z = -pSeat->fBob;
}
// Only bother when zoomed out
if ( getstatf( STAT_VIEWZOOM ) == 1.0f ) {
// Update muzzleflash position and draw it
if ( eMuzzleflash.alpha > 0.0f ) {
makevectors(getproperty(VF_ANGLES));
eMuzzleflash.origin = gettaginfo( eViewModel, eMuzzleflash.skin );
dynamiclight_add( pSeat->vPlayerOrigin + (v_forward * 32), 400 * eMuzzleflash.alpha, '1 0.45 0');
addentity( eMuzzleflash );
}
addentity( eViewModel );
}
}
void View_PostDraw(void)
{
entity eMuzzleflash = pSeat->eMuzzleflash;
// Take away alpha once it has drawn fully at least once
if ( eMuzzleflash.alpha > 0.0f ) {
eMuzzleflash.alpha -= ( clframetime * 16 );
}
}
void View_Stairsmooth(void)
{
vector currentpos = pSeat->vPlayerOrigin;
vector endpos = currentpos;
static vector oldpos;
/* Have we gone up since last frame? */
if ( ( pSeat->fPlayerFlags & FL_ONGROUND ) && ( endpos[2] - oldpos[2] > 0 ) ) {
endpos[2] = oldpos[2] += (frametime * 150);
if ( endpos[2] > currentpos[2] ) {
endpos[2] = currentpos[2];
}
if ( currentpos[2] - endpos[2] > 18 ) {
endpos[2] = currentpos[2] - 18;
}
}
// Teleport hack
if ( fabs( currentpos[2] - oldpos[2] ) > 64 ) {
endpos[2] = currentpos[2];
}
//setproperty(VF_ORIGIN, endpos);
pSeat->vPlayerOrigin = endpos;
oldpos = endpos;
}
/*
====================
View_PlayAnimation
Resets the timeline and plays a new sequence
onto the view model
====================
*/
void View_PlayAnimation( int iSequence )
{
pSeat->eViewModel.frame = (float)iSequence;
pSeat->eViewModel.frame1time = 0.0f;
}

View file

@ -1,3 +1,10 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
const vector VEC_HULL_MIN = '-16 -16 -36';
const vector VEC_HULL_MAX = '16 16 36';

View file

@ -1,3 +1,10 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
enum {
ENT_PLAYER = 1,

View file

@ -6,62 +6,69 @@
*
****/
.float framerate;
void Sprite_AnimateThink(void)
class sprite
{
if( self.frame >= self.maxframe ) {
if (self.health == 1) {
remove(self);
float framerate;
int loops;
int maxframe;
virtual void() think;
};
void sprite::think(void)
{
if (frame >= maxframe) {
if (loops == 1) {
remove(this);
} else {
self.frame = 0;
frame = 0;
}
} else {
self.frame += 1;
frame += 1;
}
self.nextthink = time + ( 1 / self.framerate );
nextthink = time + (1 / framerate);
}
void Sprite_Animated(void)
{
self.origin_x = readcoord();
self.origin_y = readcoord();
self.origin_z = readcoord();
self.modelindex = readfloat();
self.framerate = readfloat();
self.scale = readfloat();
self.alpha = readfloat();
self.effects = readfloat();
self.colormod[0] = readfloat();
self.colormod[1] = readfloat();
self.colormod[2] = readfloat();
self.think = Sprite_AnimateThink;
self.drawmask = MASK_ENGINE;
self.nextthink = time + ( 1 / self.framerate );
self.maxframe = modelframecount( self.modelindex );
self.health = 0; /* repeats */
setorigin(self, self.origin);
spawnfunc_sprite();
sprite me = (sprite)self;
me.origin_x = readcoord();
me.origin_y = readcoord();
me.origin_z = readcoord();
me.modelindex = readfloat();
me.framerate = readfloat();
me.scale = readfloat();
me.alpha = readfloat();
me.effects = readfloat();
me.colormod[0] = readfloat();
me.colormod[1] = readfloat();
me.colormod[2] = readfloat();
me.drawmask = MASK_ENGINE;
me.nextthink = time + ( 1 / me.framerate );
me.maxframe = modelframecount( me.modelindex );
me.loops = 0; /* repeats */
setorigin(me, me.origin);
}
void Sprite_ParseEvent(void)
{
entity sprite = spawn();
sprite.origin[0] = readcoord();
sprite.origin[1] = readcoord();
sprite.origin[2] = readcoord();
sprite.modelindex = readfloat();
sprite.framerate = readfloat();
sprite.scale = readfloat();
sprite.alpha = readfloat();
sprite.effects = readfloat();
sprite.colormod[0] = readfloat();
sprite.colormod[1] = readfloat();
sprite.colormod[2] = readfloat();
sprite.think = Sprite_AnimateThink;
sprite.drawmask = MASK_ENGINE;
sprite.nextthink = time + ( 1 / self.framerate );
sprite.maxframe = modelframecount( self.modelindex );
sprite.health = 1; /* does not repeat */
setorigin(sprite, self.origin);
sprite spr = spawn(sprite);
spr.origin[0] = readcoord();
spr.origin[1] = readcoord();
spr.origin[2] = readcoord();
spr.modelindex = readfloat();
spr.framerate = readfloat();
spr.scale = readfloat();
spr.alpha = readfloat();
spr.effects = readfloat();
spr.colormod[0] = readfloat();
spr.colormod[1] = readfloat();
spr.colormod[2] = readfloat();
spr.drawmask = MASK_ENGINE;
spr.nextthink = time + ( 1 / spr.framerate );
spr.maxframe = modelframecount( spr.modelindex );
spr.loops = 1; /* does not repeat */
setorigin(spr, spr.origin);
}

View file

@ -41,9 +41,9 @@ void GameText_Draw(void)
strwidth = stringwidth(g_textchannels[i].m_strMessage, TRUE, [12,12]);
if (g_textchannels[i].m_flPosX == -1) {
rpos[0] = (vVideoResolution[0] / 2) - (strwidth/2);
rpos[0] = (video_res[0] / 2) - (strwidth/2);
} else {
rpos[0] = vVideoResolution[0] * g_textchannels[i].m_flPosX;
rpos[0] = video_res[0] * g_textchannels[i].m_flPosX;
if (g_textchannels[i].m_flPosX >= 0.5) {
rpos[0] -= strwidth;
@ -51,9 +51,9 @@ void GameText_Draw(void)
}
if (g_textchannels[i].m_flPosY == -1) {
rpos[1] = (vVideoResolution[1] / 2) - 6;
rpos[1] = (video_res[1] / 2) - 6;
} else {
rpos[1] = ((vVideoResolution[1] - 12) * g_textchannels[i].m_flPosY);
rpos[1] = ((video_res[1] - 12) * g_textchannels[i].m_flPosY);
}
if (g_textchannels[i].m_flTime < g_textchannels[i].m_flFadeIn) {

View file

@ -84,8 +84,9 @@ void CBaseTrigger :: InitPointTrigger ( void )
void CBaseTrigger :: InitBrushTrigger ( void )
{
precache_model( model );
setmodel( this, model );
movetype = MOVETYPE_NONE;
solid = SOLID_TRIGGER;
setmodel( this, model );
#ifdef GS_DEVELOPER
alpha = 0.5f;
effects = EF_ADDITIVE;
@ -93,7 +94,6 @@ void CBaseTrigger :: InitBrushTrigger ( void )
modelindex = 0;
model = "";
#endif
solid = SOLID_TRIGGER;
}
void CBaseTrigger :: CBaseTrigger ( void )

View file

@ -6,7 +6,7 @@
*
****/
#define GS_DEVELOPER
//#define GS_DEVELOPER
.float gflags;
@ -33,7 +33,7 @@ string Util_FixModel(string mdl)
// Kill the first /
newpath = substring(newpath, 1, strlen(newpath)-1);
#if 0
#if 1
return newpath;
#else
return mdl;

View file

@ -1,25 +1,35 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
// Submodel materials
enum {
MATERIAL_GLASS = 0,
MATERIAL_WOOD,
MATERIAL_METAL,
MATERIAL_FLESH,
MATERIAL_CINDER,
MATERIAL_TILE,
MATERIAL_COMPUTER,
MATERIAL_GLASS_UNBREAKABLE,
MATERIAL_ROCK,
MATERIAL_NONE
enum
{
MATERIAL_GLASS,
MATERIAL_WOOD,
MATERIAL_METAL,
MATERIAL_FLESH,
MATERIAL_CINDER,
MATERIAL_TILE,
MATERIAL_COMPUTER,
MATERIAL_GLASS_UNBREAKABLE,
MATERIAL_ROCK,
MATERIAL_NONE
};
// Impact types
enum {
IMPACT_MELEE = 0,
IMPACT_EXPLOSION,
IMPACT_DEFAULT,
IMPACT_GLASS,
IMPACT_WOOD,
IMPACT_METAL,
enum
{
IMPACT_MELEE,
IMPACT_EXPLOSION,
IMPACT_DEFAULT,
IMPACT_GLASS,
IMPACT_WOOD,
IMPACT_METAL,
IMPACT_FLESH,
IMPACT_ROCK,
IMPACT_ROCK
};

View file

@ -13,7 +13,7 @@ SpectatorThink
Run every frame on every spectator
=================
*/
void Cstrike_SpectatorThink( void ) {
void Game_SpectatorThink( void ) {
self.SendFlags = 1;
}
@ -24,7 +24,7 @@ ClientKill
Suicide command 'kill' executes this function.
=================
*/
void Cstrike_ClientKill( void ) {
void Game_ClientKill( void ) {
Damage_Apply( self, self, self.health, self.origin, TRUE );
}
@ -35,7 +35,7 @@ ClientConnect
Run whenever a new client joins
=================
*/
void Cstrike_ClientConnect( void ) {}
void Game_ClientConnect( void ) {}
/*
=================
@ -44,7 +44,7 @@ SpectatorConnect
Called when a spectator joins the game
=================
*/
void Cstrike_SpectatorConnect( void ) {
void Game_SpectatorConnect( void ) {
//Spawn_MakeSpectator();
//Spawn_ObserverCam();
ClientConnect();
@ -58,7 +58,7 @@ SpectatorDisconnect
Called when a spectator leaves the game
=================
*/
void Cstrike_SpectatorDisconnect( void ) {
void Game_SpectatorDisconnect( void ) {
Spray_RemoveAll( self );
}
@ -69,7 +69,7 @@ ClientDisconnect
Run whenever a client quits
=================
*/
void Cstrike_ClientDisconnect( void ) {
void Game_ClientDisconnect( void ) {
// We were part of the session
self.health = 0;
Rules_CountPlayers();
@ -77,7 +77,7 @@ void Cstrike_ClientDisconnect( void ) {
Spray_RemoveAll( self );
}
void Cstrike_DecodeChangeParms(void)
void Game_DecodeChangeParms(void)
{
g_landmarkpos[0] = parm1;
g_landmarkpos[1] = parm2;
@ -86,7 +86,7 @@ void Cstrike_DecodeChangeParms(void)
self.angles[1] = parm5;
self.angles[2] = parm6;
}
void Cstrike_SetChangeParms(void)
void Game_SetChangeParms(void)
{
parm1 = g_landmarkpos[0];
parm2 = g_landmarkpos[1];
@ -103,13 +103,13 @@ PutClientInServer
Puts a client into the world.
=================
*/
void Cstrike_PutClientInServer( void ) {
void Game_PutClientInServer(void)
{
if ( cvar( "sv_playerslots" ) == 1 ) {
entity spot;
self.SendEntity = Player_SendEntity;
Cstrike_DecodeChangeParms();
Game_DecodeChangeParms();
if (startspot) {
self.origin = Landmark_GetSpot();
@ -171,7 +171,7 @@ SV_RunClientCommand
Funtion that can interrupt client commands before physics are run
=================
*/
void Cstrike_RunClientCommand( void ) {
void Game_RunClientCommand( void ) {
/*if (clienttype(self) == CLIENTTYPE_BOT) {
((CBot)self).RunAI();
}*/
@ -194,7 +194,7 @@ void Cstrike_RunClientCommand( void ) {
Input_Handle();
}
void Cstrike_SetNewParms(void)
void Game_SetNewParms(void)
{
}
@ -206,7 +206,8 @@ Client_SendEvent
Send a game event
=================
*/
void Client_SendEvent( entity eClient, float fEVType ) {
void Client_SendEvent( entity eClient, float fEVType )
{
Weapon_UpdateCurrents();
WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET );

View file

@ -28,7 +28,7 @@ Intercepts 'cmd' calls. We use it to intercept
chat messages and handle distribution ourselves.
=================
*/
void Cstrike_ParseClientCommand( string sCommand ) {
void Game_ParseClientCommand( string sCommand ) {
tokenize( sCommand );
if ( argv( 1 ) == "timeleft" ) {
@ -70,7 +70,7 @@ void Cstrike_ParseClientCommand( string sCommand ) {
clientcommand( self, sCommand );
}
float Cstrike_ConsoleCmd( string sCommand ) {
float Game_ConsoleCmd( string sCommand ) {
/*CBot bot;
if ( !self ) {
for ( other = world; ( other = find( other, classname, "player" ) ); ) {
@ -194,7 +194,7 @@ StartFrame
Runs every frame... by worldspawn?
=================
*/
void Cstrike_StartFrame( void ) {
void Game_StartFrame( void ) {
// We've got hostages, but no rescue zones, create some
if ( !iRescueZones && iHostagesMax > 0 ) {
Game_CreateRescueZones();
@ -235,7 +235,7 @@ It's the map entity, literally
=================
*/
void Cstrike_worldspawn(void)
void Game_Worldspawn(void)
{
string sTemp;
int iMOTDLines = 0;
@ -543,5 +543,4 @@ void Cstrike_worldspawn(void)
iBombRadius = 1024;
localcmd(sprintf("serverinfo slots %d\n", cvar("sv_playerslots")));
localcmd("teamplay 1\n");
PMove_Init();
}

View file

@ -41,6 +41,7 @@ float Player_SendEntity( entity ePEnt, float fChanged ) {
WriteByte( MSG_ENTITY, self.health );
WriteFloat( MSG_ENTITY, self.movetype );
WriteFloat( MSG_ENTITY, self.view_ofs[2] );
WriteFloat( MSG_ENTITY, self.viewzoom );
return TRUE;
}
@ -195,7 +196,7 @@ PlayerPreThink
Run before physics
=================
*/
void Cstrike_PlayerPreThink( void ) {
void Game_PlayerPreThink( void ) {
BaseGun_ShotMultiplierUpdate();
}
@ -206,7 +207,7 @@ PlayerPreThink
Run after physics
=================
*/
void Cstrike_PlayerPostThink( void ) {
void Game_PlayerPostThink( void ) {
Animation_PlayerUpdate();
Footsteps_Update();

View file

@ -12,154 +12,70 @@ void main(void)
void StartFrame(void)
{
#ifdef CSTRIKE
Cstrike_StartFrame();
#endif
#ifdef VALVE
Valve_StartFrame();
#endif
Game_StartFrame();
}
void ClientConnect(void)
{
#ifdef CSTRIKE
Cstrike_ClientConnect();
#endif
#ifdef VALVE
Valve_ClientConnect();
#endif
Game_ClientConnect();
}
void ClientDisconnect(void)
{
#ifdef CSTRIKE
Cstrike_ClientDisconnect();
#endif
#ifdef VALVE
Valve_ClientDisconnect();
#endif
Game_ClientDisconnect();
}
void ClientKill(void)
{
#ifdef CSTRIKE
Cstrike_ClientKill();
#endif
#ifdef VALVE
Valve_ClientKill();
#endif
Game_ClientKill();
}
void SpectatorThink(void)
{
#ifdef CSTRIKE
Cstrike_SpectatorThink();
#endif
#ifdef VALVE
Valve_SpectatorThink();
#endif
Game_SpectatorThink();
}
void SpectatorConnect(void)
{
#ifdef CSTRIKE
Cstrike_SpectatorConnect();
#endif
#ifdef VALVE
Valve_SpectatorConnect();
#endif
Game_SpectatorConnect();
}
void SpectatorDisconnect(void)
{
#ifdef CSTRIKE
Cstrike_SpectatorDisconnect();
#endif
#ifdef VALVE
Valve_SpectatorDisconnect();
#endif
Game_SpectatorDisconnect();
}
void PutClientInServer(void)
{
#ifdef CSTRIKE
Cstrike_PutClientInServer();
#endif
#ifdef VALVE
Valve_PutClientInServer();
#endif
Game_PutClientInServer();
}
void PlayerPreThink(void)
{
#ifdef CSTRIKE
Cstrike_PlayerPreThink();
#endif
#ifdef VALVE
Valve_PlayerPreThink();
#endif
Game_PlayerPreThink();
}
void PlayerPostThink(void)
{
#ifdef CSTRIKE
Cstrike_PlayerPostThink();
#endif
#ifdef VALVE
Valve_PlayerPostThink();
#endif
Game_PlayerPostThink();
}
void SetNewParms(void)
{
#ifdef CSTRIKE
Cstrike_SetNewParms();
#endif
#ifdef VALVE
Valve_SetNewParms();
#endif
Game_SetNewParms();
}
void SetChangeParms(void)
{
#ifdef CSTRIKE
Cstrike_SetChangeParms();
#endif
#ifdef VALVE
Valve_SetChangeParms();
#endif
Game_SetChangeParms();
}
void SV_RunClientCommand( void )
{
#ifdef CSTRIKE
Cstrike_RunClientCommand();
#endif
#ifdef VALVE
Valve_RunClientCommand();
#endif
Game_RunClientCommand();
}
void SV_ParseClientCommand(string cmd)
{
#ifdef CSTRIKE
Cstrike_ParseClientCommand(cmd);
#endif
#ifdef VALVE
Valve_ParseClientCommand(cmd);
#endif
Game_ParseClientCommand(cmd);
}
void worldspawn(void)
@ -170,11 +86,11 @@ void worldspawn(void)
return;
}
g_initialized = TRUE;
// Let's load materials.txt because someone thought this was the best idea
filestream fileMaterial = fopen( "sound/materials.txt", FILE_READ );
hashMaterials = hash_createtab( 512, HASH_ADD );
if ( fileMaterial >= 0 ) {
while ( ( sTemp = fgets( fileMaterial ) ) ) {
// Tokenize and just parse this stuff in
@ -187,10 +103,11 @@ void worldspawn(void)
error( "Failed to load sound/materials.txt!\n" );
}
PMove_Init();
precache_sound( "weapons/explode3.wav" );
precache_sound( "weapons/explode4.wav" );
precache_sound( "weapons/explode5.wav" );
precache_sound( "debris/glass1.wav" );
precache_sound( "debris/glass2.wav" );
precache_sound( "debris/glass3.wav" );
@ -209,47 +126,47 @@ void worldspawn(void)
precache_sound( "debris/concrete1.wav" );
precache_sound( "debris/concrete2.wav" );
precache_sound( "debris/concrete3.wav" );
precache_sound( "player/pl_metal1.wav" );
precache_sound( "player/pl_metal2.wav" );
precache_sound( "player/pl_metal3.wav" );
precache_sound( "player/pl_metal4.wav" );
precache_sound( "player/pl_duct1.wav" );
precache_sound( "player/pl_duct2.wav" );
precache_sound( "player/pl_duct3.wav" );
precache_sound( "player/pl_duct4.wav" );
precache_sound( "player/pl_dirt1.wav" );
precache_sound( "player/pl_dirt2.wav" );
precache_sound( "player/pl_dirt3.wav" );
precache_sound( "player/pl_dirt4.wav" );
precache_sound( "player/pl_slosh1.wav" );
precache_sound( "player/pl_slosh2.wav" );
precache_sound( "player/pl_slosh3.wav" );
precache_sound( "player/pl_slosh4.wav" );
precache_sound( "player/pl_tile1.wav" );
precache_sound( "player/pl_tile2.wav" );
precache_sound( "player/pl_tile3.wav" );
precache_sound( "player/pl_tile4.wav" );
precache_sound( "player/pl_grate1.wav" );
precache_sound( "player/pl_grate2.wav" );
precache_sound( "player/pl_grate3.wav" );
precache_sound( "player/pl_grate4.wav" );
precache_sound( "player/pl_snow1.wav" );
precache_sound( "player/pl_snow2.wav" );
precache_sound( "player/pl_snow3.wav" );
precache_sound( "player/pl_snow4.wav" );
precache_sound( "player/pl_step1.wav" );
precache_sound( "player/pl_step2.wav" );
precache_sound( "player/pl_step3.wav" );
precache_sound( "player/pl_step4.wav" );
precache_sound( "items/9mmclip1.wav" );
precache_sound( "items/gunpickup2.wav" );
precache_sound( "common/wpn_select.wav" );
@ -268,10 +185,12 @@ void worldspawn(void)
lightstyle( 9, "aaaaaaaazzzzzzzz" );
lightstyle( 10, "mmamammmmammamamaaamammma" );
lightstyle( 11, "abcdefghijklmnopqrrqponmlkjihgfedcba" );
#ifdef CSTRIKE
Cstrike_worldspawn();
#elif VALVE
Valve_worldspawn();
#endif
Game_Worldspawn();
}
float ConsoleCmd(string cmd)
{
return Game_ConsoleCmd(cmd);
}

View file

@ -6,11 +6,3 @@
*
****/
float ConsoleCmd(string cmd)
{
#ifdef CSTRIKE
return Cstrike_ConsoleCmd(cmd);
#else
return Valve_ConsoleCmd(cmd);
#endif
}

View file

@ -31,6 +31,7 @@ server.c
damage.c
vox.c
valve/spawn.c
footsteps.c
entry.c
#endlist

View file

@ -6,50 +6,67 @@
*
****/
void Valve_ClientConnect(void)
void Game_ClientConnect(void)
{
bprint(sprintf("%s connected\n", self.classname));
bprint(sprintf("%s connected\n", self.netname));
}
void Valve_ClientDisconnect(void)
void Game_ClientDisconnect(void)
{
bprint(sprintf("%s disconnected\n", self.classname));
bprint(sprintf("%s disconnected\n", self.netname));
}
void Valve_ClientKill(void)
void Game_ClientKill(void)
{
}
void Valve_PlayerPreThink(void)
void Game_PlayerPreThink(void)
{
}
void Valve_PlayerPostThink(void)
void Game_PlayerPostThink(void)
{
self.SendFlags = 1;
}
void Valve_SetChangeParms(void)
{
}
void Valve_RunClientCommand(void)
void Game_RunClientCommand(void)
{
Footsteps_Update();
QPhysics_Run(self);
}
void Valve_PutClientInServer(void)
void Game_DecodeChangeParms(void)
{
g_landmarkpos[0] = parm1;
g_landmarkpos[1] = parm2;
g_landmarkpos[2] = parm3;
self.angles[0] = parm4;
self.angles[1] = parm5;
self.angles[2] = parm6;
}
void Game_SetChangeParms(void)
{
parm1 = g_landmarkpos[0];
parm2 = g_landmarkpos[1];
parm3 = g_landmarkpos[2];
parm4 = self.angles[0];
parm5 = self.angles[1];
parm6 = self.angles[2];
}
void Game_PutClientInServer(void)
{
if ( cvar( "sv_playerslots" ) == 1 ) {
entity spot;
self.SendEntity = Player_SendEntity;
//Valve_DecodeChangeParms();
Game_DecodeChangeParms();
if (startspot) {
self.origin = Landmark_GetSpot();
setorigin(self, Landmark_GetSpot());
self.fixangle = TRUE;
} else {
spot = find( world, classname, "info_player_start" );
self.origin = spot.origin;
//self.origin = spot.origin;
setorigin(self, spot.origin);
self.angles = spot.angles;
self.fixangle = TRUE;
}
@ -57,7 +74,7 @@ void Valve_PutClientInServer(void)
self.classname = "player";
self.health = self.max_health = 100;
forceinfokey( self, "*dead", "0" );
//forceinfokey( self, "*dead", "0" );
self.takedamage = DAMAGE_YES;
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_WALK;
@ -71,12 +88,12 @@ void Valve_PutClientInServer(void)
forceinfokey( self, "*spec", "0" );
}
void Valve_ParseClientCommand(string cmd)
{
}
void Valve_SetNewParms(void)
void Game_ParseClientCommand(string cmd)
{
clientcommand(self, cmd);
}
void Game_SetNewParms(void)
{
}

View file

@ -4,27 +4,29 @@
Player_SendEntity
=================
*/
float Player_SendEntity( entity ePEnt, float fChanged ) {
if ( self.health <= 0 && ePEnt != self ) {
float Player_SendEntity(entity ePEnt, float fChanged)
{
if (self.health <= 0 && ePEnt != self) {
return FALSE;
}
WriteByte( MSG_ENTITY, ENT_PLAYER );
WriteShort( MSG_ENTITY, self.modelindex );
WriteCoord( MSG_ENTITY, self.origin_x );
WriteCoord( MSG_ENTITY, self.origin_y );
WriteCoord( MSG_ENTITY, self.origin_z );
WriteCoord( MSG_ENTITY, self.v_angle_x );
WriteCoord( MSG_ENTITY, self.angles_y );
WriteCoord( MSG_ENTITY, self.angles_z );
WriteCoord( MSG_ENTITY, self.velocity_x );
WriteCoord( MSG_ENTITY, self.velocity_y );
WriteCoord( MSG_ENTITY, self.velocity_z );
WriteFloat( MSG_ENTITY, self.flags );
WriteFloat( MSG_ENTITY, self.pmove_flags );
WriteByte( MSG_ENTITY, self.weapon );
WriteByte( MSG_ENTITY, self.health );
WriteFloat( MSG_ENTITY, self.movetype );
WriteFloat( MSG_ENTITY, self.view_ofs[2] );
WriteByte(MSG_ENTITY, ENT_PLAYER);
WriteShort(MSG_ENTITY, self.modelindex);
WriteCoord(MSG_ENTITY, self.origin[0]);
WriteCoord(MSG_ENTITY, self.origin[1]);
WriteCoord(MSG_ENTITY, self.origin[2]);
WriteCoord(MSG_ENTITY, self.v_angle[0]);
WriteCoord(MSG_ENTITY, self.angles[1]);
WriteCoord(MSG_ENTITY, self.angles[2]);
WriteCoord(MSG_ENTITY, self.velocity[0]);
WriteCoord(MSG_ENTITY, self.velocity[1]);
WriteCoord(MSG_ENTITY, self.velocity[2]);
WriteFloat(MSG_ENTITY, self.flags);
WriteFloat(MSG_ENTITY, self.pmove_flags);
WriteByte(MSG_ENTITY, self.weapon);
WriteByte(MSG_ENTITY, self.health);
WriteFloat(MSG_ENTITY, self.movetype);
WriteFloat(MSG_ENTITY, self.view_ofs[2]);
WriteFloat(MSG_ENTITY, self.viewzoom);
return TRUE;
}

View file

@ -6,12 +6,17 @@
*
****/
void Valve_StartFrame(void)
void Game_StartFrame(void)
{
}
float Valve_ConsoleCmd(string cmd)
float Game_ConsoleCmd(string cmd)
{
return FALSE;
}
void Game_Worldspawn(void)
{
}

View file

@ -0,0 +1,17 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
void info_player_start(void)
{
}
void info_player_deathmatch(void)
{
}

View file

@ -6,15 +6,15 @@
*
****/
void Valve_SpectatorThink(void)
void Game_SpectatorThink(void)
{
}
void Valve_SpectatorConnect(void)
void Game_SpectatorConnect(void)
{
}
void Valve_SpectatorDisconnect(void)
void Game_SpectatorDisconnect(void)
{
}

View file

@ -17,22 +17,12 @@ void Effect_CreateExplosion( vector vPos ) {
msg_entity = self;
multicast( vPos, MULTICAST_PVS );
#else
static void Effect_CreateExplosion_Animate( void ) {
if ( self.frame >= self.maxframe ) {
remove( self );
} else {
self.frame += 1;
}
self.nextthink = time + 0.05f;
}
entity eExplosion = spawn();
sprite eExplosion = spawn(sprite);
setorigin( eExplosion, vPos );
setmodel( eExplosion, "sprites/fexplo.spr" );
sound( eExplosion, CHAN_WEAPON, sprintf( "weapons/explode%d.wav", floor( random() * 3 ) + 3 ), 1, ATTN_NORM );
eExplosion.think = Effect_CreateExplosion_Animate;
//eExplosion.think = Effect_CreateExplosion_Animate;
eExplosion.nextthink = time + 0.05f;
eExplosion.effects = EF_ADDITIVE;
eExplosion.drawmask = MASK_ENGINE;
@ -109,31 +99,6 @@ void Effect_CreateSmoke( vector vPos ) {
}
#endif
#ifdef CSQC
.float framerate;
void Effect_AnimatedSprite( vector vPos, float fIndex, float fFPS, float fScale, float fAlpha, float fEffects ) {
static void Effect_AnimatedSprite_Animate( void ) {
if( self.frame >= self.maxframe ) {
self.frame = 0;
} else {
self.frame += 1;
}
self.nextthink = time + ( 1 / self.framerate );
}
self.modelindex = fIndex;
setorigin( self, vPos );
self.scale = fScale;
self.alpha = fAlpha;
self.effects = fEffects;
self.framerate = fFPS;
self.think = Effect_AnimatedSprite_Animate;
self.drawmask = MASK_ENGINE;
self.nextthink = time + ( 1 / self.framerate );
self.maxframe = modelframecount( self.modelindex );
}
#endif
void Effect_Impact( int iType, vector vPos, vector vNormal ) {
#ifdef SSQC
WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET );

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.