2
0
mirror of https://github.com/rehlds/metamod-r.git synced 2024-12-27 07:05:34 +03:00

add project

This commit is contained in:
Adidasman 2016-07-04 12:07:29 +06:00
commit 72cd86b431
243 changed files with 42488 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
#temporary files
*~

35
ABOUT.txt Normal file
View File

@ -0,0 +1,35 @@
Metamod
=-=-=-=
a Half-Life utility mod
meta /me't*/ or /may't*/ or (Commonwealth) /mee't*/ adj.,pref.
[from analytic philosophy] One level of description up.
The purpose of MetaMod is to function "one level up" from the normal
Half-Life game mod DLL. Sitting between the mod game DLL and the Half-Life
engine/binary, it intercepts the function calls between the two, with the
option of passing them along untouched, as well as passing them on to as
any number of _additional mod-like DLLs_.
Thus, you can actually have multiple "mod-like" DLLs in operation at one
time. I say "mod-like" because these additional DLLs (we'll call them
"plugins") are not intended to provide a full "game"; that functionality
is still provided by the "game dll". However, these plugins can _add to_
or _modify the functionality provided by the game dll, or by the engine
itself - for instance, adding new server commands, or new client commands,
or even disabling commands built into the game dll. Although the plugin
isn't intended to provide full HL-game functionality, since it's receiving
the same information given to the game DLL, it has the opportunity to do
_anything_ the game DLL can do (given enough coding effort of course).
This is very similar to the way Alfred Reynolds' AdminMod
(www.adminmod.org) works, as it also sits between the engine and game dll,
catching routines, and passing them on. thus modifying functionality.
However, rather than providing just the additional server features builtin
to AdminMod DLL, MetaMod allows you to add features from multiple,
separate DLLs. Under that framework, AdminMod can be a plugin itself, and
be run alongside numerous other plugins. And, as of version 2.50 of
AdminMod, AM has now transitioned to running as a Metamod plugin.
--------------------------------------------------------------------------

4
Config.mak Normal file
View File

@ -0,0 +1,4 @@
PROJNAME = metamod
#SUBDIRS := $(shell find */Makefile | sed "s/.Makefile//")
SUBDIRS = metamod stub_plugin trace_plugin wdmisc_plugin

340
GPL.txt Normal file
View File

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

31
Makefile Normal file
View File

@ -0,0 +1,31 @@
# vi: set ts=4 sw=4 :
# vim: set tw=75 :
# MetaMod toplevel makefile
# Copyright (c) 2001-2003 Will Day <willday@hpgx.net>
#
# some sections as demonstated in GNU's make.info documentation
include Config.mak
ifeq "$(USER)" "willday"
include priv/top.mak
endif
.DEFAULT:
for i in $(SUBDIRS); do \
$(MAKE) -C $$i $@ || exit; \
done
.PHONY: subdirs dlls $(SUBDIRS)
subdirs: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@
clean cleanall:
for i in $(SUBDIRS); do \
$(MAKE) -C $$i cleanall || exit; \
done
-rm dlls/* dlls/debug/*

7
README.txt Normal file
View File

@ -0,0 +1,7 @@
Metamod Half-Life utility mod
See the files under "doc/txt" or "doc/html" for more information.
Will Day
willday@metamod.org
http://www.metamod.org/

992
doc/Changelog Normal file
View File

@ -0,0 +1,992 @@
# vim: set tw=75 ft=none :
Current version: 1.20p35
For newer changes, see Metamod-P git repository commit log at:
http://metamod-p.git.sourceforge.net/git/gitweb.cgi?p=metamod-p/metamod-p;a=summary
---
2012/08/08 1.19p34
- Revert changes in 1.19p33 and start over with 1.19p32 code base
- Fix compiling with latest userspace headers and gcc-4.6
- Disabled building x86-64 binaries as Valve has dropped x86-64
linux server support.
2012/07/27 1.19p33
- Accumulated fixes and changes over time
- Fixes compiling with latest userspace headers and gcc-4.6
- (introduced bugs, crashes, do not use)
2007/08/12 1.19p32
[Patch: Metamod-P v32 by Jussi Kivilinna]
- Changed GCC optimization flags based on performance monitoring results,
replaced '-O3 -funroll-all-loops' with '-O2'.
- Made 'Fix for engine_api varargs log calls with very long log string'
default on in sources so that MSVC compile is 1:1 with GCC compile.
- Made 'optimizations on META_DEBUG' always on in sources so that MSVC
compile is 1:1 with GCC compile.
- Fixed compiling META_PERFMON build with MSVC.
- Fixed compiling with MSVC fixed by Nikolay "The Storm" Baklicharov.
- [linux] Remake of dynamic linkent code. Parse dlsym function trampoline
instead of parsing ELF structures.
- [linux] Dropped AMD64 support since Valve doesn't support their AMD64 build
anymore and I don't have access to AMD64 machine to port new dynamic
linkent code. Sorry!
2007/04/05 1.19p31
[Patch: Metamod-P v31 by Jussi Kivilinna]
- Enabled 'regparam' for internal functions. Means that function arguments are
passed through registers instead of stack, which increases performance.
- Merged in changes from Metamod 1.19 that I didn't initially notice:
- Fixed a bug where plugins could not catch NewDLL calls for GameDLLs that
do not provide NewDLL information.
2007/04/04 1.19p30
[Patch: Metamod-P v30 by Jussi Kivilinna]
- Fixed safevoid_vsnprintf() on win32.
2007/04/02 1.19p29
[Patch: Metamod-P v29 by Jussi Kivilinna]
- crash fix that didn't work
2006/03/04 1.19p28
[Patch: Metamod-P v28 by Jussi Kivilinna]
- Removed use of __VA_ARGS__ (should be easy to port to msvc now).
- Reduced size of extra engineapi function slots from 128 to 16.
- Clean up code, removed use of likely()/unlikely() macros in places where
they don't give extra performance.
- Added MakeRequestID() API
- Added api for using hook tables from plugins (thanks to BAILOPAN)
- Re-enabled fix for engine_api varargs log calls with very long log string.
2005/08/24 1.18p26
[Patch: Metamod-P v26 by Jussi Kivilinna]
- Fixed newapi functions not active on mods that don't use newapi.
- [win32] New is_gamedll() code.
- [linux] Fix for buggy DT_HASH in library walker function.
- Following features were removed to improve stability. These changes were
not present in metamod.org version:
- Removed fix for engine_api varargs log calls with very long log
string.
- Removed optimized version of GET_USER_MSG_ID() for metamod-bots.
2005/08/24 1.18p25
[Patch: Metamod-P v25 by Jussi Kivilinna]
- Added mutil::IsQueryingClientCvar().
- Added support for new HLSDK-API functions:
- enginefuncs_t::pfnQueryClientCvarValue()
- NEW_DLL_FUNCTIONS::pfnCvarValue()
- Fixed reloading and unloading of plugins that haven't been loaded
correctly.
- Fixed loading of plugins that needed changelevel to activate.
- Linux x86 and Windows binaries are now compiled for i586 since there is not
performance difference compared to i686.
- Fixes to improve stability on win32. (thanks to Blackhawk)
- Changed to use mingw-gcc 3.4.2rc
- Changed optimization flags, replaced '-O3 -ffast-math' with '-O2'.
- Minor performance tweaks.
- Changed to use mingw-gcc 3.4.2rc, mingw-gcc 3.4.4rc emited extra code
to zero stack memory which lowered performance.
- Changed API hooks to give structure offset to main API hook function
instead of pointer, which increases performance on linux-i586.
- Raised META_INTERFACE_VERSION to "5:12".
- Fixed metamod_version cvar to show "1.18p25" instead of "1.18.0p25".
- [linux] Improved dynamic linkent code.
- [linux] Static linked with libgcc.
2005/07/27 1.18p24
[Patch: Metamod-P v24 by Jussi Kivilinna]
- Updated to match latest metamod.org version.
- Removed mm-p-extensions-API, since loading/unloading plugins functions
are included in Metamod 1.18 in mutil-API.
2005/04/22 1.17.4p23
[Patch: Metamod-P v23 by Jussi Kivilinna]
- Fixed broken RegMsgList caused by optimization for mm-bots.
- Fixed optimization for mm-bots.
- [linux] Removed ESF-Mod fix.
- [linux] Minor performance tweaks and reduced filesize for linux.
2005/04/08 1.17.4p22
[Patch: Metamod-P v22 by Jussi Kivilinna]
- Optimized GET_USER_MSG_ID() function for metamod-bots.
- Minor performance tweaks.
- [linux] Looks for gamedll for Earth Special Forces Mod from 'linuxdlls'
directory after checking 'dlls'.
2005/03/25 1.17.4p21
[Patch: Metamod-P v21 by Jussi Kivilinna]
- Fixed 'meta reload' not working on plugins that have failed loading.
- Fixed bug with handling of metamod-plugin-bots, which might have caused
problems depending on order of loaded plugins. See 'call_count' in
'api_hook.cpp' for details.
- Minor performace tweaks.
- Changed all non-fatal error messages to warning messages.
2005/03/05 1.17.4p20
[Patch: Metamod-P v20 by Jussi Kivilinna]
- Fixed bug with metamod.dll not having working relocation:
- Makefile doesn't use 'dllwrap' for linking windows dlls anymore.
- Minor performance tweaks.
- Updated mini-hlsdk to 'official 2.3+patches' version.
- Fixes to improve stability:
- Added fix for broken 'vsnprintf' for win32 and some glibc versions.
- Fixed wrong api-hook function for 'ClientConnect' in 'api_info.cpp'.
- Fixed wrong integer type for CRC32_t in 'hlsdk/common/crc.h'.
- Removed 'metamod_compat-i386.so' from linux binary release.
2005/02/27 1.17.4p19
[Patch: Metamod-P v19 by Jussi Kivilinna]
- Performance tweaks mainly for AMD64 (minor for i386).
- Linux-i386 (metamod_i386.so) binary linked against glibc-2.1.3 for better
compatibility. Compiled using gcc-3.3.4-glibc-2.1.3 crosscompiler available
at: http://forums.unitedadmins.com/index.php?showtopic=44048
- Binaries not linked against libstdc++ anymore for better compatibility
(see: new_baseclass.h).
2005/02/25 1.17.4p18
[Patch: Metamod-P v18 by Jussi Kivilinna]
- Fixed AMD64 support.
2005/02/19 1.17.4p17
[Patch: Metamod-P v17 by Jussi Kivilinna]
- Renamed 'Metamod All-Mod-Support' to 'Metamod-P'.
- Fixes to improve stability.
- Minor performance tweaks.
- Merged updates from Metamod 1.17.4,
http://www.sourceforge.net/projects/metamod/
- Added Mod recognition for Brain Bread 1.2, Snow-War 2.0 and
Gangsta Wars 2.7.
2005/02/13 1.17.3p16
[Patch: All-Mod-Support v16 by Jussi Kivilinna]
- Fixes to improve stability.
- Minor performance tweaks.
2005/01/10 1.17.3p15
[Patch: All-Mod-Support v15 by Jussi Kivilinna]
- New optimization which reduces binary size more than 50%.
- Changed '-march=i586' to '-march=i686'. This means this binary
doesn't work on Pentium/K6 processors. You need PPro/Athlon
or newer.
- Removed 'Active API Hooks' optimization.
- Removed 'memory write detection' code.
2004/11/27 1.17.3p14
[Patch: All-Mod-Support v14 by Jussi Kivilinna]
- Remake of new callback API.
2004/11/27 1.17.3p13
[Patch: All-Mod-Support v13 by Jussi Kivilinna]
- New callback API for plugins to load/unload other plugins. See
'mm_pextensions.h'.
- Fixed a minor memory leak when reloading plugins.
- Minor fixes on 'memory write detection'.
- Minor performance tweaks.
- Moved p13 code from osdep.cpp/h to osdep_p.cpp/h
2004/11/17 1.17.3p12
[Patch: All-Mod-Support v12 by Jussi Kivilinna]
- Fixed crashing with 'memory write detection' (part of 'Active API Hooks').
- Improved 'memory write detection' code.
2004/11/16 1.17.3p11
[Patch: All-Mod-Support v11 by Jussi Kivilinna]
- Added new 'Active API Hooks' optimization, speeding up handling HLSDK-API
functions that are not hooked by any plugins.
- Added new command 'meta active' to list active hooks.
- [linux] 'metamod_i386.so' is compiled with gcc-3.3.4 now. If that version
doesn't work for you, use 'metamod_compat-i386.so'.
- [linux] gcc-2.95 compiled binary is now 'metamod_compat-i386.so'.
- Merged updates from Metamod 1.17.3,
http://www.sourceforge.net/projects/metamod/
- Added Mod recognition for Zombie Panic Beta 0.91c, Out Break 1.0,
Operations 1942 v2.0, The Trenches 1.0-Beta, The Ship V0052.
- When reloading plugins honour their load time settings. Does no longer
attempt to reload plugins when the loading after the unloading would
fail due to a load time conflict.
- Fixed only loading one plugin when multiple plugins with the same
prefix were used, e.g. mm_pluginA.dll and mm_pluginB.dll.
- Fixed a minor memory leak when unloading plugins.
- Fixed potential bug initializing plugin incorrectly after unloading
and loading plugins.
2004/08/31 1.17.2p10
[Patch: All-Mod-Support v10 by Jussi Kivilinna]
- Merged updates from Metamod 1.17.2,
http://www.sourceforge.net/projects/metamod/
- Fixed a memory leak the size of the gamedll when extracting a missing
gamedll from the cache file on Windows Steam servers.
Found by Wei Mingzhi.
- Made game directory lookup case-insensitive.
- Added MOD recognition for The Terrorist Revenge 0.2.1, Pirates,
Vikings and Knights Beta 2.1, CSV15 (Counter-Strike 1.5 for Steam),
Adrenaline Gamer 6.5 and up.
- Changed MOD recognition for Adrenaline Gamer 3.x. The 3.x version of
the MOD is now being deprecated and support will be removed from a
future version of Metamod. It can currently still be used by renaming
the game directory from "ag" to "ag3" or by explicitly specifying the
gamedll.
- Improved parsing of plugins.ini file to not report errors on empty
lines and commented out lines that start with whitespace.
- Added "lin32" and "lin64" keywords in addition to "linux" keyword for
plugins.ini file to support using the same file for the same game on
both 32bit and 64bit servers. The "lin32" and "lin64" keywords
override the "linux" keyword when used on the same plugin. Do not
use "linux" when using "lin32" and/or "lin64" keywords for the same
plugin.
2004/07/28 1.17.1p9
[Patch: All-Mod-Support v9 by Jussi Kivilinna]
- [linux] Amd64-support.
- [linux] New version of osdep.cpp:is_gamedll().
- Reads ELF directly and doesn't use external libraries.
- Binary isn't linked with BFD library anymore, reduces filesize to
less than 500kb.
- More optimizations on META_DEBUG macro.
- No more 'fast' compiles, META_DEBUG is optimized enough now.
- Added '+localinfo mm_clientmeta <yes/no>' setting for disabling 'meta'
client-command.
- Added 'clientmeta' config.ini setting.
2004/07/04 1.17.1p8
[Patch: All-Mod-Support v8 by Jussi Kivilinna]
- Fixed memory leak in linux version of osdep.cpp:is_gamedll().
- Fixes to improve stability.
- Optimizations on META_DEBUG macro.
2004/06/06 1.17.1p7
[Patch: All-Mod-Support v7 by Jussi Kivilinna]
- Official support for All-Mod-Support versions at http://koti.mbnet.fi/axh/
- Merged updates from Metamod 1.17.1,
http://www.sourceforge.net/projects/metamod/
- Added MOD recognition for Hostile Intent 1.1.
- Added MOD recognition for Natural Selection Beta 3.0.
- Added MOD recognition for CS13.
- Added MOD recognition Rocket Crowbar 2.
- Added MOD recognition Counter-Strike:Condition Zero.
- On Windows Steam servers extract the gamedll file from the cache file
if it is missing in the dlls directory.
- Added Patch-messages.
- Added '+localinfo mm_autodetect <yes/no>' setting for disabling
autodetection of gamedll.
- Added 'autodetect' config.ini setting.
- Small tweaks and optimizations at various different places.
2004/05/21 1.17p6
[Patch: All-Mod-Support v6 by Jussi Kivilinna]
- Tweaks and optimizations on osdep.cpp:is_gamedll().
- [linux] Added architecture check for i386 and x86-64 to is_gamedll().
2004/04/27 1.17p5
[Patch: All-Mod-Support v5 by Jussi Kivilinna]
2004/04/26 1.17p4
[Patch: All-Mod-Support v4 by Jussi Kivilinna]
- Amd64-test versions
2004/04/25 1.17p3
[Patch: All-Mod-Support v3 by Jussi Kivilinna]
- Automatically searchs for gameDll for new mods that are not included in
internal mod-list.
- [linux] Cleaned up osdep_linkent_linux.cpp, might work with x86-64 build
now (not tested).
2004/04/24 1.17p2
[Patch: All-Mod-Support v2 by Jussi Kivilinna]
- Extra functions slots are now passed all the way to the gameDll now too.
- [linux] New method for dlsym hooking, no need for metamod_linkent_tool.so anymore.
- Made mm_* functions in dllapi.cpp and engine_api.cpp static.
- Made mutil_* functions in mutil.cpp static.
2004/04/22 1.17p1
[Patch: All-Mod-Support v1 by Jussi Kivilinna]
- Removed dependences on game.dll structures (CBasePlayer).
- Replaced UTIL_ShowMessage with META_UTIL_ShowMessage.
- [win32] Replaced entity linking with PE dll-export-table combining.
- [linux] Replaced entity linking with dlsym hooking.
- Removed entities from linkgame.cpp
- Added 128 extra function slots on enginefuncs_t structure for future engine updates.
2003/11/15 1.17
- Added support for recently added routines in the HL Engine:
SequenceGet()
SequencePickSentence()
GetFileSize()
GetApproxWavePlayLen()
IsCareerMatch()
GetLocalizedStringLength()
RegisterTutorMessageShown()
GetTimesTutorMessageShown()
ProcessTutorMessageDecayBuffer()
ConstructTutorMessageDecayBuffer()
ResetTutorMessageDecayData()
- Removed mod recognition and entities for Master-Sword v1.3, at the
request of the Mod's authors.
- Added mod recognition and entities for HL-Rally vBeta 1.0, Kanonball
v1.01, Over Ground vBeta 1.0, Project Timeless vBeta 1.0, Underworld
Bloodline v2.0.
- Additional entities for The Battle Grounds v1.2.1, Firearms v2.8.
- Additional entities "env_rain" and "env_snow" used on some CS maps.
- Added "metamod_version" cvar that can be queried from game browser
clients.
- Added "meta" client command similar to the console command, providing at
this time only "list" and "version" subcommands.
- Introduced basic config file to provide more reliable and more
flexible options passing, in addition to the current +localinfo method.
- Default filename: addons/metamod/config.ini
- Options include:
debuglevel <number>
gamedll <path>
plugins_file <path>
exec_cfg <path>
- Added option "+localinfo mm_configfile <path>" to override default
config.ini pathname.
- Added "meta config" console command to display result of config
file and localinfo options.
- Added "meta require <plugin>" console command, to exit the server if the
specified plugin is not found loaded and running. Intended for use in
server.cfg or metaexec.cfg. Suggested by Florian Zschocke.
- If a specified override gamedll pathname is invalid, Metamod will now
exit with an appropriate error, rather than falling back to the
auto-detected gamedll. This should provide more useful feedback in such
situations.
- Added GINFO_REALDLL_FULLPATH for mutil GetGameInfo, to return the
(supposed) "real" dllpathname, ie in case gamedll is overridden. Needed
specifically for plugin "SinglePlayer".
- Raised META_INTERFACE_VERSION to 5:10, for GINFO_REALDLL_FULLPATH.
- Now recognizes "/dev/null" as valid for path options (pluginsfile,
execcfg, configini, etc), for when an empty file _is_ desired.
- Fixed loading of plugins.ini to detect duplicate plugins (by full
pathname).
- Added doc/config.ini with comments to document the file.
- Renamed doc/metamod.ini to doc/plugins.ini, and added comments.
- Internal changes:
- Added conf_meta.cpp, conf_meta.h for config file handling.
- Created full_gamedir_path() to centralize code for testing absolute
path, prepending gamedir if necessary, calling realpath, and
normalizing pathnames.
- Most paths are now stored and operated on as fullpathnames, rather
than gamedir-relative pathnames.
- Now using fopen() rather than LOAD_FILE_FOR_ME when reading text
files, in particular due to fullpathnames.
- Errorcheck for absolute paths as mm_execcfg filename, since
servercommand("exec") won't accept absolute pathanmes.
- Added debug messages to valid_gamedir_file(), for checking why it
failed to use a specified (config.ini, localinfo) path.
- Simplified logic in cmd_doplug() to not require re-mapping pcmd to cmd
string.
- Fixed Makefile to always recompile meta_api.cpp for changes in
info_name.h.
- Split lookup_game() into setup_gamedll and lookup_game, to better
organize for storing gamedll->real_pathname.
- Source and documentation files based on the list of supported
game/mods are split into their own files (games.h,
supportedmods.html), so they can be generated from a local database
rather than maintained manually.
- Makefile now using gcc-2.95 explicitly, to avoid using gcc3 at this
time.
2003/08/02 1.16.2
- Mod recognition and entities for The Point of No Return v.Beta 4.0.
- Even more entities for The Specialists v.Beta 2.0.
2003/07/30 1.16.1
- Mod recognition and entities for Master-Sword v1.3, The Wastes RC 1.2,
and Monkeystrike v1.2.
- Additional entities for Natural Selection v2.0, The Specialists v.Beta
2.0, Earth's Special Forces v.Beta 1.1, The Battlegrounds v1.2, and
International Online Soccer v2.0.
2003/05/08 1.16
- Added support for Server_GetBlendingInterface() in order to allow client
and server to properly coordinate custom player model blending. This
should fix the issue with mismatched hitboxes observed with CS and DOD.
- Mod recognition and entities for International Online Soccer v1.0 and
Morbid Inclination v1.0.
- Added studioapi.{cpp,h} to provide Server_GetBlendingInterface.
2003/05/03 1.15.3
- More additional entities for Day of Defeat v1.0.
2003/05/02 1.15.2
- Mod recognition and entities for Rival Species vBeta 1.0, Public Enemy
vBeta 1.0, and Bumper Cars vAlpha.
- Additional entities for Day of Defeat v1.0, Sven Coop v2.1, WormsHL
vBeta 3.0, and Natural Selection v1.1.
2003/04/09 1.15.1
- Additional entities for Firearms v2.7 and Desert Crisis v1.5.
- Fixed mod recognition for Adrenalinegamer v4.x and later.
2003/02/12 1.15
- Additional entities for VampireSlayer Chapter V.
- Fixed entity name "TS_PowerUp" for The Specialists 1.5; should fix
precache error for "models/powerup.mdl".
- Added DLFNAME implementation for win32, provided by Jussi Kivilinna.
Thus, "meta info <plugin>" will now list registered commands and
registered cvars under win32, rather than just under linux.
- Now dynamically allocating lists of registered commands and registered
cvars, rather than a fixed limit of 1024 (and before that, 512). Based
on code provided by Jussi Kivilinna.
- Console listing of regcmds/regfuncs now also shows currently allocated
list sizes.
- Replaced valid_file() using LOAD_FILE_FOR_ME with valid_gamedir_file()
using stat(). Thus, it should no longer find unintended files under the
"valve" subdirectory.
- Normalize filenames under win32 to use slashes (/) and lowercase chars,
to get rid of mixed-slashes (ie "half-life\cstrike/dlls") and to
simplify pathname comparisons.
- Also, canonicalize filenames under both win32/linux to remove ".." and
redundant "/" path components, to provide more reliable pathname
comparisions.
- If meta_CVarRegister fails to find a corresponding plugin for a cvar, it
now logs only a Debug message rather than an Error message, as a cvar_t
that's malloc'd by a plugin can't be traced back. Problem reported by
Olo.
- In plugin trace, added "classname" to DispatchSpawn output.
- Added is_absolute_path() to centralize the logic, and to be more
OS-precise.
- Split meta_init_gamedll() from meta_load_gamedll() so that the correct
and normalized Gamedir is available earlier in the code.
- #define NAME_MAX and PATH_MAX to the correct win32 constants, rather
than using (inaccurate) internal values.
- Renamed internal classes RegFunc to RegCmd, to provide more easily
associated names.
- Lots of internal file organization changes:
- Removed superfluous symlinks in docs dir.
- Renamed toplevel doc files to *.txt.
- Added Config.mak to toplevel dir, to provide project name and subdirs,
so that toplevel Makefile can be used for multiple projects.
- Added copyrights to Makefiles.
- Added blurbs to engine notes for FunctionFromName and NameForFunction,
based on investigation of singleplayer support.
- In source Makefile, added support for compiling linux-only or
win32-only projects.
- In source Makefile, fixed vdate.o to properly compile for each link.
- Removed tmp files in msvc dir (.ncb, .plg).
- Added copyright/GPL blurb to *.rc files.
- In stub/meta_api.cpp, comment out unused variables rather than doing
"if(var)" to satisfy gcc -Wunused.
- Reduced vers_meta.h to just the version and other common info, and
create info_name.h for module-specific name, desc, etc, so that I'll
only have to edit 1 file when increasing version/date for all the DLLs
distributed with Metamod.
- Made res_meta.rc common among Metamod and the plugins, rather than
having a separate res_plugin.rc.
- In source Makefile, added "--include-dir" args to windres, so it can
find the now common vers_meta.h.
- Source Makefile now copies targets into ../dlls, rather than doing
that only for comprehensive "dlls" targets.
- Added "-fno-exceptions -fno-rtti" to possibly reduce code size,
suggested by Jussi Kivilinna.
- For plugins, renamed ie "mm_wdmisc" to "wdmisc_mm" where it was missed
earlier.
- For plugins, better organized common code, to make it more adaptable
to other plugin projects (ie, singlep). Ie, plugin_query,
plugin_attach, plugin_detach; moved plugin welcome banner to
meta_api.cpp; etc.
- Added tools/stlfilter to help hide -Weffc++ warnings from g++ STL
headers (although not using STL at this time..)
2003/01/24 1.14.1
- Properly recognize win32 full pathname from GetGameDir.
- Added "#include <direct.h>" for getcwd() under MSVC.
- Trace plugin: Changed AlertMessage formatting, ie from
"atype=at_console/1" to "atype=at_console(1)".
- Stub plugin: fixed to compile under MSVC again.
2003/01/23 1.14
- Fixed to handle new behavior of engine routine GET_GAME_DIR under HL
1.1.1.1 (CS 1.6) beta, where the routine no longer returns the
fullpathname of the game directory, but now returns only the string
passed to hlds as the argument to "-game" (pointed out by Alfred
Reynolds).
- Added meta-util function GET_GAME_INFO to return various string-based
information about the gamedll (name, description, gamedir fullpathname,
dll fullpathname, dll filename).
- Raised META_INTERFACE_VERSION from 5:8 to 5:9.
- Added FAQ.
- Some docs touchups.
2003/01/18 1.13.4
- Additional entities for betas of Counter-Strike 1.6 and TFC from HL
1.1.1.1.
- Added missing #include "osdep.h" to several files, to make sure things
like win32 vsnprintf are defined.
- In stub plugin, added engine_api.cpp, to provide example framework for
hooking engine routines.
- In trace plugin, changed logtag to all caps.
2003/01/12 1.13.3
- Additional entities and updated mod recognition for Earth's Special
Forces Beta 1.
- Mod recognition for Retro Firearms 2.5.
- Increased max allowed plugin functions and max allowed plugin cvars from
512 to 1024.
- Fixed UTIL_VarArgs and UTIL_LogPrintf (copied from SDK) to use proper
bounds-checking (to help prevent buffer overflows).
- Updated Copyright to include "2001-2003".
2002/11/26 1.13.2
- Mod recognition and entities for Azure Sheep v1.0, BuzzyBots v2.3,
Outlawsmod v.Beta 1.5, The Specialists v.Beta 1.0, and StargateTC v.Beta
2.2.
- Additional entities for The Battle Grounds v.Demo 1.0, Firearms v.2.6.5,
Global Warfare v.Beta 2.0, and Tour of Duty v1.1 Beta.
- Updated mod recognition for Rocket Crowbar v1.9.
- Compiled against HLSDK 2.3.
- Corrected missing "const" in vdate.h (noted by Ravenous BugBlatter
Beast).
2002/10/06 1.13.1
- Mod recognition and entities for Digital Paintball v1.0, Dragon Mod Z
v1.7, Holy Wars v.beta2, and OeL Half-Life v4.0.
- Additional entities for Adrenalinegamer Mod v6.0 and Natural Selection
v1.0.
- Corrected a cast in os_safe_call (from Olafur Osvaldsson).
2002/08/24 1.13
- New config file names and locations, per the Addon Development Standard
rev 1.00. Default config files are now:
- $gamedir/addons/metamod/plugins.ini
- $gamedir/addons/metamod/exec.cfg
- File "metagame.ini" no longer supported.
- Additional entities for WormsHL beta 2.1.
- Mod recognition (no entities) for Retro Counter-Strike 2.5.
- Added release_notes.html.
- Added function "valid_file" in support_meta.h.
2002/07/11 1.12.4
- Additional entities for Day of Defeat beta 3.0 and Tour of Duty 0.9.0.
- Mod recognition and entities for Natural Selection 1.0.
- Added "$pg" string for /usr/bin/ident.
2002/07/01 1.12.3
- Mod recognition and entities for Valve's Ricochet mod.
- Additional entities for Tour of Duty 0.8.0.
- Moved common code from LINK_ENTITY_TO_GAME to a function, rather than
duplicating the code in ~2000 expanded macros. Based on code from Jussi
Kivilinna <kijuhe00@students.oamk.fi>.
2002/06/04 1.12.2
- Even more entities for Firearms rc2.6.
2002/05/29 1.12.1
- Mod recognition and entities for Desert Crisis 1.1, Tour of Duty 0.6.7,
and Train Hunters beta 1.0.
- Additional entities for GoldenEye 1.9C and Firearms rc2.6.
- Fixed meta-util function GET_PLUGIN_PATH to return the full path as
intended, rather than a partial path.
- Updated Copyright to include "2001-2002".
- Fixed Makefile to not update .tags or .htags by default.
2002/04/22 1.12.0
- Updated for HL 1109, which adds one Engine routine:
const char *GetPlayerAuthId(edict_t *e);
- Mod recognition and entities for The Battle Grounds 0.6, Gangwars Beta
1.0, and WormsHL Beta 2.0
- Additional entities for Day of Defeat beta 2.0 and Oz 2.5.
- Changed error message "user message registered again" to a debug message
(level 3).
- Fixed compile problem under MSVC with strcasecmp.
- Added meta-util function GET_PLUGIN_PATH, so a plugin can know from
whence it was loaded.
- In trace plugin, added more trace info for EngineFprintf, ServerPrint,
IsMapValid, GetPlayerUserId, GetPlayerWONId, GetPlayerAuthId,
CVarGetFloat, CVarGetString, AllocString, Time, IsDedicatedServer,
GetCurrentPlayer, GetPlayerStats.
2002/02/08 1.11.2
- Hopefully complete list of entities for Day of Defeat beta 2.0.
- Don't complain for NULL routines in gamedll's NEW_DLL_FUNCTIONS. Should
solve "Couldn't find api call: dod.dll:ShouldCollide" errors with DoD
b2.
- Changed default for newapi ShouldCollide() from 0 to 1, per Mugsy@DoD's
observations.
2002/02/03 1.11.1
- Mod recognition and entities for Snow-War 1.0, and Earth`s Special
Forces version Alpha 2.0.
- Additional entities for Oz 2.4.1, Svencoop 2.0, and partial entities for
Day of Defeat beta 2.0.
- Added check for duplicate UserMsg registration (should help resolve
recent "reached max msgs 256" errors).
- Dropped leading zeroes in version number.
- Tweaked "interface version" log message to help reduce confusion.
- Compiled with updated version of mingw; should help reduce dll filesizes
found in the previous release.
- Some additional debugging in gamedll entity linking.
2001/12/17 1.11.00
- Mod recognition and entities for Weapon Wars v0.3.
- Additional entities for version 1.2 of Global Warfare.
- Linux binary linked against glibc-2.1.2 for better compatibility.
- 'meta game' now lists user messages registered by gamedll.
- Added meta-util functions GET_USER_MSG_ID and GET_USER_MSG_NAME, so
plugins that need to know RegUserMsg name/id mappings (like bots) don't
need to be loaded at server startup.
- Raised META_INTERFACE_VERSION from 5:6 to 5:7.
- Fixed NUM_FOR_EDICT error in pfnCenterSay (from Fritz Elfert).
- Re-fixed set_new_handler for MSVC (from Fritz Elfert).
- Fixed meta_AddServerCommand; was registering plugin's command string
rather than local string, causing segfault on plugin unload.
- Changed trace plugin to use GET_USER_MSG_NAME instead of local list.
- Added 'const' to 'char *' arguments in DLOPEN and DLSYM macros.
- Commented out names of unused function paramenters, to satisfy "gcc
-Wunused" without generating MSVC errors.
- Added '#pragma warning(disable: 4390)' to disable "empty controlled
statement" warnings in MSVC.
- Updated MSDN url references.
2001/09/19 1.10.00
- Updated for HL SDK 2.2, which adds two Engine routines:
qboolean Voice_GetClientListening)(int iReceiver, int iSender);
qboolean Voice_SetClientListening)(int iReceiver, int iSender, qboolean bListen);
- Mod recognition and entities for "Scientist Hunt" v1.2 and Existence
Beta 1.3.
2001/08/01 1.09.00
- Mod recognition and entities for 'Wanted!' v1.5.
- Mod recognition for Adrenalinegamer v3.2 and v4.1 (no special entities).
- Additional entities for version 2.3 of Oz Deathmatch.
- Additional entities for version 1.0 of Wizard Wars.
- Additional meta-utility function CALL_GAME_ENTITY. Raised
META_INTERFACE_VERSION from 5:5 to 5:6.
- Added proper GPL notices.
2001/07/06 1.08.02
- Added mod recognition and entities for Gunman Chronicles.
- Added list of supported mods to docs.
- Updated MSVC project/workspace files to match recent source changes.
- Fixed problem with set_new_handler compiling under MSVC.
2001/06/30 1.08.01
- Updated for Day of Defeat v1.3. The name of its win32 dll changed (was
mp.dll; now dod.dll). No new entities.
- Added mod recognition and entities for Rocket Crowbar.
- Fixed problem with windows internal DLL version (don't use leading
zeros as compiler will assume it's octal notation).
2001/06/16 1.08.00
- Allow specifying/overriding various things on the command line, via
"+localinfo". Fields are:
- mm_gamedll
a bot or other dll, instead of the gamedll based on the gamedir.
Note this is now the preferred method; the "metagame.ini" file is
deprecated, but still recognized for backwards compatibility.
- mm_pluginsfile
a file with the list of mm plugins, instead of "metamod.ini".
- mm_execcfg
a cfg file for mm plugin cvar settings, instead of "metaexec.cfg".
- mm_debug
an initial debug level.
- Examples:
./hlds_run -game cstrike +localinfo mm_gamedll dlls/pod_bot.so
./hlds_run -game cstrike +localinfo mm_pluginsfile mylist.ini
./hlds_run -game cstrike +localinfo mm_execcfg mysettings.cfg
./hlds_run -game cstrike +localinfo mm_debug 7
- Don't try exec'ing metaexec.cfg unless it exists.
- Added additional entity for Action Half-Life Beta 4, from list forwarded
from the dev team.
- Added a couple additional entities for Global Warfare, from list
provided by the dev team.
- Moved a couple entities from the "common" list back to the "valve" list,
for better organization.
- Changed logmsg "Plugin '%s' interface version didn't match" from
"Warning:" to "Note:" to reduce confusion.
- Added an optional plugin meta-api routine Meta_Init, to be called prior
to GiveFnptrsToDll, to let the dll know that it's going to be
queried/loaded as a metamod plugin, to allow for DLL's that can be used
as both a metamod plugin _and_ a standalone DLL. Raised
META_INTERFACE_VERSION from 5:4 to 5:5.
- Removed segfault handler under linux, when calling plugin console
command functions, as (a) it masked legitimate segfaults in plugin
commands and produced confusing output ("plugin has been unloaded", when
really it segfaultd), and (b) wasn't necessary since the situation
should be covered by other tests.
- Replaced combo SDK macros with inline funcs, and added ones for
accessing serverinfo and localinfo infokey buffers.
- Unfinished code for event triggers is in the source, but is disabled
(since it's not finished yet).
2001/06/10 1.07.03
- improper compile was reporting wrong version number
2001/06/07 1.07.02
- added mod recognition and best-guess list of entities for Deathmatch
Classic v1 and Global Warfare Beta 1.0.
- updated entity list with best-guess additions and corrected win32 dll
name for Wasteland Beta 2.
- added additional entities for Frontline Force 1.2a, from list forwarded
from the dev team.
2001/05/25 1.07.01
- added complete (hopefully) list of additional entities for Front Line
Force 1.2a/1.3.
- added best-guess list of entities for Day of Defeat b1.1.
- added best-guess list of entities for Science & Industry 0.97 (later
confirmed by SI lead programmer).
- added better guess list of entites for Action Half-Life b4.
- shrunk entity lists for Jailbreak and Judgement to include only
mod-specific entities (rather than common Valve entities which are in a
separate list).
- in THREAD_CREATE inline, replaced "(DWORD (*)(void*)) func" with
"(LPTHREAD_START_ROUTINE) func" to properly compile under MSVC.
- added engine_notes.html with a list of all the engine routines, and some
comments.
- added utils/getents.sh script to pull entity lists from .so files.
2001/05/08 1.07.00
- fixed "%s" server-crashing bug. "You should never pass strings with
unknown contents as the format string." Metamod was passing a
preformatted non-constant (thus unknown contents) string as the format
string (and only argument) when handling printf-style varargs engine
functions (in particular, AlertMessage). Ie, don't do:
printf(buf);
Instead do:
printf("%s", buf);
- added some entities for Action Half-Life Beta4, which should help
address crashing on startup, especially with Last Man Standing random
weapons. Note that I don't have an official, complete list of entities
for the mod, so there may still be some instances of crashing.
- added debugging messages for printf-style varargs engine routines, since
we can't rely on trace_mm for this (as the messages are re-written by
metamod before being passed to trace).
- better info in trace plugin's log messages for AlertMessage and
CreateNamedEntity.
- altered debug levels AlertMessage API routines in api_info.cpp
2001/05/04 1.06.10
- fixed a couple of entities for HL Paintball.
- added links.html to docs, a set of links/URLs and books that I found
helpful for the project.
- added to META_INTERFACE_VERSION comments to include associated metmaod
version for each change.
- additional data checking in various MPluginList routines.
- added 'const' to various function arguments to more properly reflect
function purpose.
- changed various function macros to inlines, to provide more obvious type
checking, and easier debugging.
- adjusted private/public members of various classes, to try and make them
more proper.
- added new_handler code, for upcoming code additions.
- added MPluginList::find(plid_t id), for upcoming code additions.
- added thread primitives to osdep, for upcoming code additions.
2001/04/29 1.06.02
- added entities and mod recognition for VampireSlayer and Open-Source
Jailbreak.
- updated mod recognition for current names of Action Half-Life's DLL/SO
files.
- added some entities for FLF 1.2a, listed on Botman's news page.
- added some docs for Installation and Compiling.
- added build type info (optimized, debugging, etc) to the SpecialBuild
tag in the version info for the win32 DLL.
- disabled SDK's "DBG_" functions, for MSVC win32 debug compiles.
2001/04/22 1.06.01
- added some entities for FLF 1.2.
- better info in trace plugin's log messages for
DispatchObjectCollsionBox, SetModel, FindEntityByString, SetOrigin,
EntOffsetOfPEntity, PEntityOfEntIndex.
- fixed missing initialization for "len" in wdmisc.
- added <a name> links to sections in html docs.
- for non-critical interface version mismatch, changed from a META_ERROR
to just META_LOG, since it's not, strictly speaking, an error.
2001/04/17 1.06.00
- added support for "metaexec.cfg", a commands file to be exec'd after
loading the plugins, for plugin commands and cvars, since autoexec.cfg
is parsed too early (before plugins loaded) and server.cfg is parsed too
late (after ServerActivate).
- better info in trace plugin's log messages for MessageBegin,
WriteString, AlertMessage, RegUserMsg
- to provide more manageable trace log output, throttled trace plugin to 1
logmsg per second, by default (of course, this can cause log messages to
be lost). Added cvar "trace_unlimit" (0/1) to enable unlimited logging,
as it did previously.
- added centersay meta-utility functions (CENTER_SAY, CENTER_SAY_PARMS,
CENTER_SAY_VARARGS). Raised META_INTERFACE_VERSION from 5:3 to 5:4.
- fixed crash when trying to load typical game DLLs (like standalone-bots)
as metamod plugins.
- fixed segfault on failed plugin attach; was dlclosing plugin
prematurely.
- in wdmisc, added a proof-of-concept for catching certain game events by
doing string matching on all the log messages produced by the game.
Ugly, to be sure, but interesting nonetheless.
- added more entities for HL Paintball, and fixed the linux so name.
- added "-Wno-unused" to CFLAGS when compiling sdk_util.o, to alleviate
the complaints from #including all the extra SDK header files and class
definitions.
- removed GetEntityAPI routine from trace plugin, as it's unnecessary as a
metamod plugin if already providing GetEntityAPI2.
- in trace, moved gMetaFunctionTable declaration to plugin.cpp, so that
meta_api.cpp can be a standard (plugin-independent) sourcefile used in
any plugin.
- updated the docs to include recent new features, as well as some better
discussion of coding details.
2001/04/06 1.05.00
- created utility callback functions, for use by plugins, to reduce code
duplication and help simplify some things. Currently, these consist of
only some convenient logging functions (LOG_CONSOLE, LOG_MESSAGE,
LOG_ERROR, LOG_DEVELOPER).
- added "mutil_funcs_t" to Meta_Query, to pass the meta utility function
table. Increased META_INTERFACE_VERSION from 5:2 to 5:3.
- made sure all exported DLL routines (ie routines that are accessed via
dlsym) are both declared _and defined_ as 'extern "C"', so that the C++
compiler enforces parameter type-matching, rather than considering
routines with mis-matched arguments/types to be overloaded functions...
Note that it's not sufficient to just be declared "C"; it has to defined
this way as well, to make sure the C++ compiler matches it with the
declaration. Otherwise, again, it'll consider it an overloaded
function, and allow it happily without complaint, and cause the
subsequent dlsym to fail.
- created and deployed C_DLLEXPORT macro for declaring/defining functions
'extern "C" DLLEXPORT'.
- added plugin 'wdmisc' as a basic example, and for my miscellaneous
commands/cvars.
- renamed "mm_stub" and "mm_trace" to "stub_mm" and "trace_mm" to make
plugin name more apparent, and to be more consistent with adminmod_MM.
- had to move plugin_info_t to its own header file, to avoid circular
#include's between meta_api.h and mutil.h.
- in dllapi.cpp and engineapi.cpp, pulled RETURN_API out of META_HANDLE
macro, to make it easier to add code to middle of API routines.
- renamed util_meta.h to support_meta.h, to avoid confusion with mutil.h
- some code cleanup (better 80-column linebreaks).
2001/04/03 1.02.00
- added support for Half-Life Paintball
- added "*_mm" and "*_MM" to the list of suffixes to look for when loading
plugins at console.
- log errors when plugin tries to use MRES_SUPERCEDE in a _Post function
(supercede is only relevant in a non-Post function; use OVERRIDE in a
Post function).
- mm_trace: added info to trace log for FindEntityInSphere
- added osdep macro for strcasecmp, for compiling under windows
- fixed a debug log message for GetEngineFunctions_Post
- fixed a couple internal references to engine globals (gpGLobals)
- renamed local SDK API routines to "mm_*" for easier debug breakpoints
- altered debug levels for a couple API routines in api_info.cpp
2001/04/01 1.01.00
- replaced use of FStrEQ in most places with !strcasecmp, so that case
doesn't matter for things like console commands ("META LOAD" will now
work in addition to "meta load") and paths (like "-game CSTRIKE"; and
win32 filepaths are case-insignificant anyway). Interestingly, the HL
engine ignores case for console commands ("ADMIN_COMMAND" works), but
cvars are only recognized with matching case ("ADMIN_DEBUG" does not
work). Confusing.
- added "by " when printing author info, to make it a bit clearer
- added a bit more operation info to metamod.html
2001/03/30 1.00.00
- released as v1.0, for inclusion with release of Adminmod v2.50.
- added $(VERSFILE) to Makefile and Config.mak, to better insure correct
rebuild on version number changes
- added "i486", "i586", and "i686" to "i386" in the list of prefixes to
look for when loading plugins at console.
- added "MDLL*" and "MNEW" macros in meta_api.h, to be more convenient for
plugins to call GameDLL functions.
- added missing "extern gamedll_funcs_t *gpGamedllFuncs" to meta_api.h
- added handling of gpGamedllFuncs in stub, for example purposes.
- fixed problems with running bots under metagame.ini:
- moved instantiation of Plugins object to before meta_load_gamedll, so
that if gamedll calls engine functions during GiveFnptrsToDll (like
hpb_bot does), META_ENGINE_HANDLE won't crash from a null Plugins object
pointer.
- in GET_FUNC_TABLE_FROM_GAME, memset gamedll.funcs.struct_field, and then
free/null it if the gamedll's GetFuncs call fails, to handle the
situation where the gamedll provides GetNewDLLFunctions(), but doesn't
have anything to return (like hpb_bot does, when the real gamedll
doesn't provide GetNewDLLFunctions).
- add handling of gpGamedllFuncs to mm_stub's Meta_Attach().
2001/03/27 1.0-rc5
- fixed problem with crashing when a plugin failed to load (improper
dereference of null 'info' structure; incomplete fix from rc2).
- added a plugin status "badfile", for plugin files that appear to be
invalid metamod plugins; this is to differentiate from "failed", which
is a valid-looking plugin file (queried) but encountered a failure
attaching/unloading/etc.
- changed "-march=i686" optimization to "-march=i586", and moved this to
only the optimized binaries, and not the debugging binaries. As it
turns out, i686 doesn't work on things like AMD K6-III cpus (I know, go
figure :).
- duplicated functionality of adminmod's "admin.ini", except with a file
named "metagame.ini". This will allow (at least partial) use with game
DLLs that metamod doesn't support yet - "partial" because, although the
game DLL will load, it may not work if it uses entities that metamod
doesn't know about yet. It will also allow use of standalone "bot"
DLLs, which sit between metamod and the gamedll (much like metamod sits
between the engine and the gamedll).
- added console command "meta game" to show information about the loaded
game DLL (to help troubleshoot issues with "metagame.ini").
2001/03/25 1.0-rc4
- split linkfunc.cpp into linkent.h, linkgame.cpp, linkplug.cpp
- split entity lists for mods into separate files, one for each mod; these
are used to build linkgame.cpp
- metamod/mm_trace version info should indicate debugging/optimized compile
- added entity support for Judgement DM
- added "-fno-rtti" to mm_trace gcc cflags, to address problem of
unresolved CSaveRestoreBuffer symbols using older versions of gcc
- lowered debug levels in GetEntityAPI, GetNewDLLFunctions, etc to enable
"+developer" messages (6 -> 3).
- removed "-Werror" from Makefile's default cflags; should only be used
on devl system with edited SDK
2001/03/18 1.0-rc3
- central Makefile can now build optimzed as well as debugging targets;
default to compile is debugging; default in 'dlls' dir is optimized
- toplevel Makefile builds release tgz/zip files. TGZ file includes only
linux .so objects, and text files in unix-LF format. ZIP file includes
only win32 .dll objects, and text files in dos-CRLF format, and actual
files rather than symlinks.
- added mod recognition for "judgedm" mod; still need entities list
- added 4 entities for Firearms 2.5
2001/03/07 1.0-rc2
- fixed missing WINAPI in mm_trace GiveFnptrsToDll
- added HTML version of docs
- description field in metamod.ini is now optional:
- uses "name" from plugin info for desc by default
- desc field in metamod.ini will override this
- "meta list" shows just desc, rather than desc and name
- altered debug levels for a couple API routines in api_info.cpp
- added missing "load" cmd in "meta" usage help
- added to "meta load" usage help
- added macros RETURN_META(result) and RETURN_META_VALUE(result, value) to
simplify plugin coding
- added parameter "gamedll_funcs" to meta_attach(), to give each plugin a
copy of the gamedll's API function tables
- raised META_INTERFACE_VERSION to "5:2"
- now load gamedll before plugins (rather than the reverse) so that
it'll have the gamedll func tables to hand to the plugins
- changed trace plugin console commands:
trace_version -> trace version
trace <routine> -> trace set <routine>
untrace <routine> -> trace unset <routine>
showtrace -> trace show
- added "trace list <api>" to list all available routines for tracing
- fixed broken trace cvars
- for "meta {load,unload,etc}" console cmd, added matching against plugin
logtag, as well as for "mm_<prefix>" in plugin file
- handle null 'info' after failed plugin load (ie in "meta info" etc)
- fixed "usage: meta list" errors on some meta commands; was calling
cmd_meta_pluginlist() instead of Plugins->show()
- fixed: unload/attach delayed plugins at changelevel
- now doesn't export newapi if gamedll doesn't provide it
- now doesn't call plugins getnewapi if gamedll doesn't provide it
- fixed incorrect apitable references in MPlugin::show()
2001/02/08 1.0-rc1
- fixed unistd.h under MSVC
- fixed S_ISREG under MSVC
- fixed strncasecmp under MSVC
- fixed void svr_meta() returning value
- fixed missing WINAPI in mm_stub GiveFnptrsToDll
- remade MSVC project for metamod
- created MSVC project for mm_stub
- added an example "metamod.ini" to ./docs

6
doc/README.txt Normal file
View File

@ -0,0 +1,6 @@
Please see the files in the "html" or "txt" directory for documentation.
Example files in the current directory:
plugins.ini
config.ini

37
doc/TODO Normal file
View File

@ -0,0 +1,37 @@
# vi: set ts=4 sw=4 :
# vim: set tw=75 :
- event notification and log-parsing interface for plugins
- interaction between plugins
- rename trace functions to "tr_*" for easier debug breakpoints
- add meta console command to debug indiv functions, like mm_trace can
- catch register cmds/cvars from gameDLL and list then in "meta game"
- in win32, doesn't report parsed plugin line properly; says only:
[META] ini: Read plugin config for:
- use scanf for file parsing ?
- "meta cancel" command
- more documentation info
- don't refresh_ini on "quit"
- test more bot support for metagame.ini
- track "messages" for plugins and provide READ_* functions (usermsg.cpp)
- provide other "engine" functions to plugins
- is_connected
- is_ingame
x fix stat()-related code for linux only
x remake MSVC project
x use resources
x doublecheck DLLEXPORT and stuff
x txt files in "dos" format?
x separate zip/tgz files
x compat support for "admin.ini"
x support dir-specific "metamod.ini" files, similar to servercfgfile
x more documentation info: engineapi_info.txt
x html view of source
x handle RegUserMsg and allow lists of registered messages to be queried
by bot plugins or other plugins that want to catch these things, and to
allow these plugins to be loaded during a map (since after mapstart, the
plugin can't catch RegUserMsg calls, since they've all already been made).
x find some way to generally allow plugins to use LINK_ENTITY_TO_CLASS,
without requiring explicit support in metamod

90
doc/config.ini Normal file
View File

@ -0,0 +1,90 @@
// vim: set ft=c :
//
// Format is as follows:
// <optionname> <value>
//
// Fields are whitespace delimited (tabs/spaces).
//
// Comments are either c++ style ("//") or unix shell style ("#"), and
// can appear ONLY at the beginning of a line.
//
// The following provide a list of recognized options, their defaults, and
// examples of usage.
//
// debuglevel <number>
// gamedll <path>
// plugins_file <path>
// exec_cfg <file>
// autodetect <yes/no>
// debuglevel <number>
// where <number> is an integer, 0 and up.
// Sets the initial debugging level for metamod (same as cvar "meta_debug").
// Default is normally 0. If hlds is run with "-dev", default is 3.
// Overridden by: +localinfo mm_debug <number>
// Examples:
//
// debuglevel 0
// debuglevel 42
// gamedll <path>
// where <path> is an absolute path, or a path relative to the gamedir.
// Overrides the auto-detected gamedll, in particular for bots.
// Default is empty, with gamedll being auto-recognized based on the
// gamedir.
// Overridden by: +localinfo mm_gamedll <path>
// Examples:
//
// gamedll dlls/hl.dll
// gamedll ../podbot/podbot.dll
// gamedll /home/bots/dlls/mybot.dll
// plugins_file <path>
// where <path> is an absolute path, or a path relative to the gamedir.
// Overrides the default filename containing the MM plugins to load.
// Default is "addons/metamod/plugins.ini".
// Overridden by: +localinfo mm_pluginsfile <path>
// Examples:
//
// plugins_file cfg/clanmode.ini
// plugins_file ../private.ini
// plugins_file /home/half-life/testing.ini
// exec_cfg <file>
// where <file> is a path relative to the gamedir. Note! This CANNOT be
// an absolute path, as hlds will not "exec" absolute pathnames.
// Overrides the default filename containing hlds commands to run just
// after loading Metamod.
// Default is "addons/metamod/exec.cfg".
// Overridden by: +localinfo mm_execcfg <path>
// Examples:
//
// exec_cfg configs/debugging.cfg
// exec_cfg ../clan/match.cfg
// autodetect <yes/no>
// Setting to disable or enable autodetection of gamedll.
// Extra feature for Metamod+All-Mod-Support Patch.
// Default is "yes".
// Overridden by: +localinfo mm_autodetect <yes/no>
// Examples:
//
// autodetect yes
// autodetect no
// clientmeta <yes/no>
// Setting to disable or enable Metamod's client commands ('meta list' and
// 'meta version')
// Extra setting for Metamod+All-Mod-Support Patch.
// Default is "yes".
// Overridden by: +localinfo mm_clientmeta <yes/no>
// Examples:
//
// clientmeta yes
// clientmeta no

65
doc/html/Index.html Normal file
View File

@ -0,0 +1,65 @@
<!-- vi: set ts=4 sw=4 : -->
<!-- vim: set tw=75 : -->
<HTML>
<head>
<title>Metamod</title>
</head>
<body>
<h1>Metamod
</h1>
<p>Metamod is a plugin/DLL manager that sits between the Half-Life Engine and
an HL Game mod, allowing the dynamic loading/unloading of mod-like DLL
plugins to add functionality to the HL server or game mod.
<p>
<hr>
<p>
See <a href="http://metamod.org/">metamod.org</a> for news, downloads,
and plugin links.
<p>
<hr>
<table cellspacing=20 width="100%">
<tr valign=top>
<td>
<h2>Metamod Docs</h2>
<ul>
<li><a href="about.html">About metamod</a>
<li><a href="faq.html">FAQ</a>
<li><a href="metamod.html">Using metamod</a>
<li><a href="release_notes.html">Release Notes</a>
<li><a href="gamesupport.html">Game/Mod support</a>
<li><a href="trace.html">Trace Plugin</a>
<li><a href="wdmisc.html">WDMisc Plugin</a>
<li><a href="coding.html">Coding for metamod</a>
</ul>
</td>
<td>
<h2>Other HLDS info</h2>
<ul>
<li><a href="dllapi_notes.html">SDK DLLAPI Notes</a>
<li><a href="newapi_notes.html">SDK NEWAPI Notes</a>
<li><a href="engine_notes.html">SDK Engine Notes</a>
<p>
<li><a href="links.html">Related links &amp; books</a>
<li><a href="maillist.html">Mailing lists</a>
</ul>
</td>
</tr>
</table>
<p>
<hr>
<address>&lt;willday@metamod.org&gt;</address>
</body>
</HTML>
</HTML>

35
doc/html/a.html Normal file
View File

@ -0,0 +1,35 @@
<!-- vi: set ts=4 sw=4 : -->
<!-- vim: set tw=75 : -->
<HTML>
<head>
<title>Metamod Supported Games</title>
</head>
<body>
<a name=supported>
<h1>Supported Games
</h1>
</a>
Metamod includes support for the following mods, with version and last
update if known.
<p>
To get support added for a new Mod, or for an updated version of a Mod, see
<a href="gamesupport.html">Adding game support</a>.
<p>
<table border=5 rules=all cellpadding=5>
<tr> <th>Name</th> <th>Version</th> <th>Last update</th> <th>Ent list</th> <th>Comments</th></tr>
<tr><td>ALL MODS SUPPORTED BY <br>
&nbsp;&nbsp;&nbsp;&nbsp;All-Mod-Support PATCH<br>
&nbsp;&nbsp;&nbsp;&nbsp;By Jussi Kivilinna<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://koti.mbnet.fi/axh/">http://koti.mbnet.fi/axh/</a>
</td><td></td><td></td><td>NONE</td></tr>
</table>
</body>
</HTML>

52
doc/html/about.html Normal file
View File

@ -0,0 +1,52 @@
<!-- vi: set ts=4 sw=4 : -->
<!-- vim: set tw=75 : -->
<HTML>
<head>
<title>About Metamod</title>
</head>
<body>
<h1>Metamod
</h1>
<h2>a Half-Life utility mod</h2>
<pre>
<b>meta</b> /me't*/ <i>or</i> /may't*/ <i>or</i> <i>(Commonwealth)</i> /mee't*/ <i>adj.,pref.</i>
<i>[from analytic philosophy]</i> <b>One level of description up.</b>
</pre>
<p> The purpose of MetaMod is to function "one level up" from the normal
Half-Life game mod DLL. Sitting between the mod game DLL and the Half-Life
engine/binary, it intercepts the function calls between the two, with the
option of passing them along untouched, as well as passing them on to as
any number of <b><i>additional mod-like DLLs</i></b>.
<p> Thus, you can actually have multiple "mod-like" DLLs in operation at
one time. I say "mod-like" because these additional DLLs (we'll call them
"plugins") are not intended to provide a full "game"; that functionality is
still provided by the "game dll". However, these plugins can <b><i>add
to</i></b> or <b><i>modify</i></b> the functionality provided by the game
dll, or by the engine itself - for instance, adding new server commands, or
new client commands, or even disabling commands built into the game dll.
Although the plugin isn't intended to provide full HL-game functionality,
since it's receiving the same information given to the game DLL, it has the
opportunity to do <b><i>anything</i></b> the game DLL can do (given enough
coding effort of course).
<p> This is very similar to the way Alfred Reynolds'
<a href="http://www.adminmod.org">AdminMod</a> works, as it also sits
between the engine and game dll, catching routines, and passing them on.
thus modifying functionality. However, rather than providing just the
additional server features builtin to AdminMod DLL, MetaMod allows you to
add features from multiple, separate DLLs. Under that framework, AdminMod
can be a plugin itself, and be run alongside numerous other plugins. And,
as of version 2.50 of AdminMod, AM has now transitioned to running as a
Metamod plugin.
<p>
<hr>
</body>
</html>

396
doc/html/coding.html Normal file
View File

@ -0,0 +1,396 @@
<!-- vi: set ts=4 sw=4 : -->
<!-- vim: set tw=75 : -->
<HTML>
<head>
<title>Coding for Metamod</title>
</head>
<body>
<h1>Coding for Metamod
</h1>
<p><br>
<a name=compiling>
<h2>Compiling
</h2></a>
You'll need the Half-Life SDK, of course. In particular you'll need HL SDK
version 2.3. You can find the original SDK 2.3 at the <a href="http://www.valve-erc.com/">Valve Editing Resource Center (VERC)</a>,
and a modified version of SDK 2.3 at <a href="http://metamod.org/files/sdk/">metmod.org/files/sdk</a>.
<p><br>
<a name=operation>
<h2>Operation
</h2></a>
The basic operation is, for each api call:
<ul>
<li> iterate through list of plugins
<li> for each plugin, if it provides this api call, then call the function
in the plugin
<li> call the "real" function (in the game dll, or from the engine)
<li> for each plugin, check for a "post" version of the function, and call
if present
</ul>
Also, for any api call, each plugin has the opportunity to replace the
real routine, in two ways:
<ul>
<li> prevent the real routine from being called (<a
href=#MRES_SUPERCEDE><tt><b>SUPERCEDE</b></tt></a>).
<li> allow the real routine to be called, but change the value that's
returned (<a href=#MRES_OVERRIDE><tt><b>OVERRIDE</b></tt></a>)
</ul>
Thus after each plugin is called, its <tt><b>META_RESULT</b></tt> flag is
checked, and action taken appropriately. Note that supercede/override only
affects the _real_ routine; other plugins will still be called.
In addition to the <tt><b>SUPERCEDE</b></tt> and
<tt><b>OVERRIDE</b></tt> flags, there are two additional flags a plugin can
return:
<ul>
<li> <a href=#MRES_HANDLED><tt><b>HANDLED</b></tt></a> ("I did something here")
<li> <a href=#MRES_IGNORED><tt><b>IGNORED</b></tt></a> ("I didn't really do anything")
</ul>
These aren't used by Metamod itself, but could be used by plugins to
get an idea if a previous plugin did anything.
<p> Note that each routine <b><i>needs</i></b> to set its
<tt><b>META_RESULT</b></tt> value before returning. Plugin routines that
do not set a value will be reported as errors in the logs.
<p><br>
<a name=requirements>
<h2>Plugin coding requirements
</h2></a>
Plugins <i><b>must</b></i> provide the following standard HLSDK exported function:
<p><pre>
void GiveFnptrsToDll(enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals);
</pre><p>
<i><b>As well as</b></i> the following new functions:
<p><pre>
void Meta_Init(void); <i>(optional)</i>
int Meta_Query(char *interfaceVersion, plugin_info_t **pinfo, mutil_funcs_t *pMetaUtilFuncs);
int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs);
int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
</pre><p>
Also, it must provide <i><b>at least</b></i> one function returning a standard HL
function table, from either the following standard HLSDK functions:
<p><pre>
int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion );
int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
int GetNewDLLFunctions( NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion );
</pre><p>
or from the following new functions:
<p><pre>
int GetEntityAPI_Post(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion);
int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion ;
int GetNewDLLFunctions_Post(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion);
int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion);
int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion);
</pre><p>
Thus, it needs to have (at least):
<p><pre>
GiveFnptrsToDll
Meta_Query
Meta_Attach
Meta_Detach
<tt><i>&lt;one or more Get function&gt;</i></tt>
</pre><p>
See the <tt>"<b>stub_plugin</b>"</tt> for an example of <b><i>bare
minimum</i></b> code. See <tt>"<b>trace_plugin</b>"</tt> for an example of
more complete functionality.
<p>Also, if the plugin needs to use <tt><b>LINK_ENTITY_TO_CLASS</b></tt>,
support for the particular entity(ies) has to be added explicitly to
Metamod (<tt>linkfunc.cpp</tt>), just as it does for entities in game DLLs.
<p><br>
<a name=operation>
<h2>Operation Details
</h2></a>
<p>These are the valid <tt>META_RESULT</tt> values a plugin routine can
specify:
<ul>
<a name=MRES_IGNORED><p><li></a>
<tt><b>MRES_IGNORED</b></tt>
<br> The plugin did nothing. This could be used to tell a subsequent
plugin that the some situation hasn't been handled yet. This would be
recognized only by other plugins; Metamod itself doesn't do anything
special for this situation. Unless otherwise specified by a later
plugin, execution of routine in the gameDLL will take place. This is
valid in both normal and post routines.
<a name=MRES_HANDLED><p><li></a>
<tt><b>MRES_HANDLED</b></tt>
<br> The plugin handled the situation, or did something with the
information. Again, this could be used to tell a subsequent plugin
that some situation has already been taken care of, and is not
recognized specially by Metamod. Unless otherwise specified by a later
plugin, execution of routine in the gameDLL will take place. This is
valid in both normal and post routines.
<a name=MRES_OVERRIDE><p><li></a>
<tt><b>MRES_OVERRIDE</b></tt>
<br> The plugin is providing a return value for the routine, which
should be used in place of the return value from the gameDLL's routine
(the plugin "overrides" the gameDLL's return value).
Unless otherwise specified by a later plugin, the gameDLL routine will
still be called. Note this only makes sense for non-void routines.
This is valid in both normal and post routines.
<a name=MRES_SUPERCEDE><p><li></a>
<tt><b>MRES_SUPERCEDE</b></tt>
<br> The plugin has performed sufficient actions for the routine, and
the gameDLL's routine should <i><b>not</b></i> be called (the plugin
"supercedes" the gameDLL's routine, more or less replacing it
entirely). Any return value for the routine should be specified as
well by the plugin. Note this is only valid for normal routines, as
post routines cannot prevent calling the gameDLL's routine (as it has
already happened!). Also note, this doesn't prevent subsequent plugins
from being called for this routine; it supercedes <b><i>only</i></b>
the gameDLL.
</ul>
As the plugins are called, a running status is kept of the "highest" meta
status so far, in the order (lowest to highets) shown above. After calling
all the "normal" routines, the status is checked to see if the gameDLL's
routine should be called - ie, it will not be called if one (or more) of
the plugin's has specified <tt><b>META_SUPERCEDE</b></tt>. The gameDLL's
routine is then called, or skipped, as appropriate. Then, all the "post"
routines are called in the same manner (except
<tt><b>META_SUPERCEDE</b></tt> is no longer a valid meta result).
<p>Last, if any plugins specified <tt><b>META_OVERRIDE</b></tt> or
<tt><b>META_SUPERCEDE</b></tt>, the return value given by the
<b><i>last</i></b> such plugin is returned as the routine's return code to
the engine (assuming a non-void routine). Thus, the order of the plugins
as specified in the <tt>metamod.ini</tt> <b><i>does</i></b> have a possible
effect.
<p><br>
<a name=macros>
<h2>Available Macros
</h2></a>
The <a href="http://metamod.org/dl/metamod/meta_api.h"><tt>meta_api.h</tt></a>
header that describes the Metamod API functions, types, and structures also
includes several macros that can be of help when coding a plugin.
<ul>
<a name=SET_META_RESULT><p><li></a>
<tt><b>SET_META_RESULT(result)</b></tt>
<br> Sets the <tt>META_RESULT</tt> for the plugin.
<a name=RETURN_META><p><li></a>
<tt><b>RETURN_META(result)</b></tt>
<br> Sets the <tt>META_RESULT</tt> for the plugin, and then calls
<tt>return</tt>. This assumes a <tt>void</tt> function.
<a name=RETURN_META_VALUE><p><li></a>
<tt><b>RETURN_META_VALUE(result, value)</b></tt>
<br> Sets the <tt>META_RESULT</tt> for the plugin, and then returns the
given <tt>value</tt>. This assumes a non-<tt>void</tt> function, and
it doesn't matter the particular type of the return value.
<a name=META_RESULT_STATUS><p><li></a>
<tt><b>META_RESULT_STATUS</b></tt>
<br> Gives the current status of <tt>META_RESULT</tt> for this routine
from plugins so far. It will return the "highest" result so far, in
the order of lesser to greater: <tt>IGNORED</tt>, <tt>HANDLED</tt>,
<tt>OVERRIDE</tt>, <tt>SUPERCEDE</tt> (see also above <a
href=#operation><i>Operation Details</i></a>)
<a name=META_RESULT_PREVIOUS><p><li></a>
<tt><b>META_RESULT_PREVIOUS</b></tt>
<br> Gives the <tt>META_RESULT</tt> of the previous plugin.
<a name=META_RESULT_ORIG_RET><p><li></a>
<tt><b>META_RESULT_ORIG_RET(type)</b></tt>
<br> Gives the "original" return value for the routine, ie the return
value of the routine from gameDLL. The type for the routine's return
value must be specified in the macro; this is used as a cast for
assignment. Note this is only valid in a "post" routine.
<a name=META_RESULT_OVERRIDE_RET><p><li></a>
<tt><b>META_RESULT_OVERRIDE_RET(type)</b></tt>
<br> Gives the return value from any previous plugin that specified
<tt><b>META_OVERRIDE</b></tt> or <tt><b>META_SUPERCEDE</b></tt>. The
type for the routine's return value must be specified in the macro;
this is used as a cast for assignment. This should only be used after
checking the META_RESULT to see if there's actually an override value
available.
<a name=MDLL_><p><li></a>
<tt><b>MDLL_<i>*</i>(<i>args</i>)</b></tt>
<br> Calls a given DLLAPI routine in the gameDLL. For instance,
<tt><b>MDLL_GameDLLInit(args)</b></tt>, <tt><b>MDLL_Spawn(args)</b></tt>,
etc.
<a name=MNEW_><p><li></a>
<tt><b>MNEW_<i>*</i>(<i>args</i>)</b></tt>
<br> Calls a given NEWAPI routine in the gameDLL. For instance,
<tt><b>MNEW_GameShutdown(args)</b></tt>, etc.
</ul>
<p><br>
<a name=utility>
<h2>Utility Callback Functions
</h2></a>
In version 1.05, Metamod began providing a set of utility functions to
plugins to centralize functionality, reduce code reuse, and to provide some
convenience in plugin coding. Presently, only a few functions are
provided. More are added as I find the time, and identify some advantage
to having them (either for my own plugins, or by others' request for their
plugins).
<p> Note the <tt><b>PLID</b></tt> keyword passed to each function. This is
basically a "plugin id" to indicate to Metamod which plugin is calling the
function (else it's difficult to tell), and is a macro that should be
specified verbatim with each call. (Currently, the macro is merely the
plugin_info struct pointer returned by the plugin via <tt>Meta_Query</tt>;
in the future this could change to some other identifier.)
<ul>
<a name=LOG_CONSOLE><p><li></a>
<tt> void <b>LOG_CONSOLE(PLID, <i>char *fmt, ...</i>)</b></tt>
<br> Print a message line on the console. Message is specified as a
<tt>printf</tt> style format string and arguments. A trailing newline
is provided by the routine and should not be specified in the string
(unless you want two newlines).
<a name=LOG_MESSAGE><p><li></a>
<tt> void <b>LOG_MESSAGE(PLID, <i>char *fmt, ...</i>)</b></tt>
<br> Print a message line in the server logs. Message is specified as a
<tt>printf</tt> style format string and arguments. A trailing newline
is provided by the routine and should not be specified in the string.
Log message is prefixed by the <tt>logtag</tt> string in the plugin's
"info" struct, surrounded by brackets. For instance:
<p><tt>L 04/17/2001 - 18:00:35: [TraceAPI] Tracing Engine routine 'RegUserMsg'</tt>
<a name=LOG_ERROR><p><li></a>
<tt> void <b>LOG_ERROR(PLID, <i>char *fmt, ...</i>)</b></tt>
<br> As in <tt>LOG_MESSAGE</tt> above, only marked as well with the
string "ERROR:". For example:
<p><tt>L 04/17/2001 - 18:03:13: [TraceAPI] ERROR: malloc failed</tt>
<a name=LOG_DEVELOPER><p><li></a>
<tt> void <b>LOG_DEVELOPER(PLID, <i>char *fmt, ...</i>)</b></tt>
<br> As in <tt>LOG_MESSAGE</tt> above, only message will be logged only
if cvar <tt>developer</tt> is set to 1; message is marked as well with
the string "dev:". For example:
<p><tt>L 04/17/2001 - 18:03:13: [TraceAPI] dev: called: GiveFnptrsToDll</tt>
<a name=CENTER_SAY><p><li></a>
<tt> void <b>CENTER_SAY(PLID, <i>char *fmt, ...</i>)</b></tt>
<br> Prints a message on the center of all players' screens. This is
like the "centersay" of AdminMod, with pretty_say enabled, with the
same defaults (green, and a 10 second fade-in). A message is logged as
well, ie: <i>[added in 1.06]</i>
<p><tt>L 04/17/2001 - 15:44:52: [WDMISC] (centersay) random set up us the bomb!</tt>
<a name=CENTER_SAY_PARMS><p><li></a>
<tt> void <b>CENTER_SAY_PARMS(PLID, <i>hudtextparms_t tparms, char *fmt, ...</i>)</b></tt>
<br> As in <tt>CENTER_SAY</tt> above, but allows specifying all the
parameters. (see SDK <tt>dlls/util.h</tt> for the struct
<tt>hudtextparms_t</tt>). <i>[added in 1.06]</i>
<a name=CENTER_SAY_VARARGS><p><li></a>
<tt> void <b>CENTER_SAY_VARARGS(PLID, <i>hudtextparms_t tparms, char *fmt, va_list ap</i>)</b></tt>
<br> As in <tt>CENTER_SAY_PARMS</tt> above, only the message is passed
as a <tt>vsnprintf</tt> style varargs format string and args list.
This is included merely because both the previous CENTER_SAY functions
actually call this, and it was convenient to include it as well.
<i>[added in 1.06]</i>
<a name=CALL_GAME_ENTITY><p><li></a>
<tt> qboolean <b>CALL_GAME_ENTITY(PLID, <i>char *entStr, entvars_t *pev</i>)</b></tt>
<br>Calls an entity function in the gameDLL. For instance, a bot usually
needs to call the <tt><b>player</b></tt> entity function.
<i>[added in 1.09]</i>
<a name=GET_USER_MSG_ID><p><li></a>
<tt> int <b>GET_USER_MSG_ID(PLID, <i>const char *name, int *size</i>)</b></tt>
<br>Returns the id number corresponding to the given message name, of
those messages registered by the gamedll with <a
href="engine_notes.html#RegUserMsg">RegUserMsg</a>, optionally
returning the registered size of the message as well. This is to
allow things like bots to access the name/id mapping without having to
catch RegUserMsg themselves, and thus have to be loaded at startup.
<i>[added in 1.11]</i>
<a name=GET_USER_MSG_NAME><p><li></a>
<tt> const char * <b>GET_USER_MSG_NAME(PLID, <i>int msgid, int *size</i>)</b></tt>
<br>Returns the name corresponding to the given msgid number, of those
messages registered by the gamedll with <a
href="engine_notes.html#RegUserMsg">RegUserMsg</a>, optionally
returning the registered size of the message as well. It will return
guess-names for any builtin Engine messages that it knows about
(<tt>SVC_TEMPENTITY</tt>, etc). The returned string is presumed to be
a compile-time constant string, stored in the text segment of the
gamedll.
<i>[added in 1.11]</i>
<a name=GET_PLUGIN_PATH><p><li></a>
<tt> const char * <b>GET_PLUGIN_PATH(PLID)</b></tt>
<br>Returns the full pathname of the loaded dll/so file for the calling
plugin. The returned string is a pointer to a static buffer, and should be
copied by the caller to local storage.
<i>[added in 1.12]</i>
<a name=GET_GAME_INFO><p><li></a>
<tt> const char * <b>GET_GAME_INFO(PLID, <i>ginfo_t type</i>)</b></tt>
<br>Returns various string-based information about the running
game/MOD/gamedll. The given <i>type</i> can be one of:
<ul>
<li><tt><b>GINFO_NAME</b></tt> - short name of game, from "-game" argument to hlds (ie "cstrike")
<li><tt><b>GINFO_DESC</b></tt> - long name of game, from autodetection (ie "Counter-Strike")
<li><tt><b>GINFO_GAMEDIR</b></tt> - game directory, full pathname (ie "/usr/local/half-life/cstrike")
<li><tt><b>GINFO_DLL_FULLPATH</b></tt> - full pathname of the game dll (ie "/usr/local/half-life/cstrike/dlls/cs_i386.so")
<li><tt><b>GINFO_DLL_FILENAME</b></tt> - bare filename of the gamedll (ie "cs_i386.so")
</ul>
The returned string is a pointer to a static buffer, and should be
copied by the caller to local storage.
<i>[added in 1.14]</i>
</ul>
<p><br>
<a name=loading>
<h2>Plugin Loading
</h2></a>
<i>(this is some rough notes I intend to fill in in the future)</i><p>
Plugins are loaded when the engine calls <tt><b>GiveFnptrsToDll()</b></tt>.
The config file is parsed, and for each valid plugin (uncommented, platform
relevant), the operation is:
<ul>
<li> dlopen() the file, store the handle
<li> dlsym() and call:
<pre>
Meta_Init (if present)
GiveFnptrsToDll
Meta_Query
Meta_Attach
</pre>
<li> if present, call function pointers, and store resulting function table:
<pre>
GetEntityAPI
GetEntityAPI2
GetNewDLLFunctions
GetEntityAPI_Post
GetEntityAPI2_Post
GetNewDLLFunctions_Post
GetEngineFunctions
GetEngineFunctions_Post
</pre>
</ul>
<p>
<hr>
</body>
</HTML>

569
doc/html/dllapi_notes.html Normal file
View File

@ -0,0 +1,569 @@
<!-- vi: set ts=4 sw=4 : -->
<!-- vim: set tw=75 : -->
<HTML>
<head>
<title>HLSDK DLLAPI Notes</title>
</head>
<body>
<h1>HLSDK DLLAPI Notes
</h1>
<hr>
<ul>
<li><a href=#GameDLLInit>GameDLLInit</a>
<li><a href=#DispatchSpawn>DispatchSpawn</a>
<li><a href=#DispatchThink>DispatchThink</a>
<li><a href=#DispatchUse>DispatchUse</a>
<li><a href=#DispatchTouch>DispatchTouch</a>
<li><a href=#DispatchBlocked>DispatchBlocked</a>
<li><a href=#DispatchKeyValue>DispatchKeyValue</a>
<li><a href=#DispatchSave>DispatchSave</a>
<li><a href=#DispatchRestore>DispatchRestore</a>
<li><a href=#DispatchObjectCollsionBox>DispatchObjectCollsionBox</a>
<li><a href=#SaveWriteFields>SaveWriteFields</a>
<li><a href=#SaveReadFields>SaveReadFields</a>
<li><a href=#SaveGlobalState>SaveGlobalState</a>
<li><a href=#RestoreGlobalState>RestoreGlobalState</a>
<li><a href=#ResetGlobalState>ResetGlobalState</a>
<li><a href=#ClientConnect>ClientConnect</a>
<li><a href=#ClientDisconnect>ClientDisconnect</a>
<li><a href=#ClientKill>ClientKill</a>
<li><a href=#ClientPutInServer>ClientPutInServer</a>
<li><a href=#ClientCommand>ClientCommand</a>
<li><a href=#ClientUserInfoChanged>ClientUserInfoChanged</a>
<li><a href=#ServerActivate>ServerActivate</a>
<li><a href=#ServerDeactivate>ServerDeactivate</a>
<li><a href=#PlayerPreThink>PlayerPreThink</a>
<li><a href=#PlayerPostThink>PlayerPostThink</a>
<li><a href=#StartFrame>StartFrame</a>
<li><a href=#ParmsNewLevel>ParmsNewLevel</a>
<li><a href=#ParmsChangeLevel>ParmsChangeLevel</a>
<li><a href=#GetGameDescription>GetGameDescription</a>
<li><a href=#PlayerCustomization>PlayerCustomization</a>
<li><a href=#SpectatorConnect>SpectatorConnect</a>
<li><a href=#SpectatorDisconnect>SpectatorDisconnect</a>
<li><a href=#SpectatorThink>SpectatorThink</a>
<li><a href=#Sys_Error>Sys_Error</a>
<li><a href=#PM_Move>PM_Move</a>
<li><a href=#PM_Init>PM_Init</a>
<li><a href=#PM_FindTextureType>PM_FindTextureType</a>
<li><a href=#SetupVisibility>SetupVisibility</a>
<li><a href=#UpdateClientData>UpdateClientData</a>
<li><a href=#AddToFullPack>AddToFullPack</a>
<li><a href=#CreateBaseline>CreateBaseline</a>
<li><a href=#RegisterEncoders>RegisterEncoders</a>
<li><a href=#GetWeaponData>GetWeaponData</a>
<li><a href=#CmdStart>CmdStart</a>
<li><a href=#CmdEnd>CmdEnd</a>
<li><a href=#ConnectionlessPacket>ConnectionlessPacket</a>
<li><a href=#GetHullBounds>GetHullBounds</a>
<li><a href=#CreateInstancedBaselines>CreateInstancedBaselines</a>
<li><a href=#InconsistentFile>InconsistentFile</a>
<li><a href=#AllowLagCompensation>AllowLagCompensation</a>
</ul>
<hr><h3><tt><a name="GameDLLInit">GameDLLInit</a></tt></h3>
<i>from dlls/game.cpp:</i><br>
<dd><tt>void GameDLLInit(void);</tt><p>
<blockquote><tt>
Register your console variables here.<br>
This gets called one time when the game is initialied.<br>
Initialize the game (one-time call after loading of game .dll)<br>
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Called just after hlds reports "Dll loaded for mod Half-Life".
</blockquote>
<hr><h3><tt><a name="DispatchSpawn">DispatchSpawn</a></tt></h3>
<i>from dlls/cbase.cpp</I>
<dd><tt>int DispatchSpawn(edict_t *pent);</tt><p>
<p><i>comments:</i><br>
<blockquote>
0==Success, -1==Failure ?
</blockquote>
<hr><h3><tt><a name="DispatchThink">DispatchThink</a></tt></h3>
<i>from dlls/cbase.cpp</i><br>
<dd><tt>void DispatchThink(edict_t *pent);</tt><p>
<hr><h3><tt><a name="DispatchUse">DispatchUse</a></tt></h3>
<i>from dlls/cbase.cpp</i><br>
<dd><tt>void DispatchUse(edict_t *pentUsed, edict_t *pentOther);</tt><p>
<hr><h3><tt><a name="DispatchTouch">DispatchTouch</a></tt></h3>
<i>from dlls/cbase.cpp</i><br>
<dd><tt>void DispatchTouch(edict_t *pentTouched, edict_t *pentOther);</tt><p>
<hr><h3><tt><a name="DispatchBlocked">DispatchBlocked</a></tt></h3>
<i>from dlls/cbase.cpp</i><br>
<dd><tt>void DispatchBlocked(edict_t *pentBlocked, edict_t *pentOther);</tt><p>
<hr><h3><tt><a name="DispatchKeyValue">DispatchKeyValue</a></tt></h3>
<i>from dlls/cbase.cpp</i><br>
<dd><tt>void DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd);</tt><p>
<hr><h3><tt><a name="DispatchSave">DispatchSave</a></tt></h3>
<i>from dlls/cbase.cpp</i><br>
<dd><tt>void DispatchSave(edict_t *pent, SAVERESTOREDATA *pSaveData);</tt><p>
<hr><h3><tt><a name="DispatchRestore">DispatchRestore</a></tt></h3>
<i>from dlls/cbase.cpp</i><br>
<dd><tt>int DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity);</tt><p>
<p><i>comments:</i><br>
<blockquote>
0==Success, -1==Failure ?
</blockquote>
<hr><h3><tt><a name="DispatchObjectCollsionBox">DispatchObjectCollsionBox</a></tt></h3>
<i>from dlls/cbase.cpp</i><br>
<dd><tt>void DispatchObjectCollsionBox(edict_t *pent);</tt><p>
<hr><h3><tt><a name="SaveWriteFields">SaveWriteFields</a></tt></h3>
<i>from dlls/cbase.cpp</i><br>
<dd><tt>void SaveWriteFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount);</tt><p>
<hr><h3><tt><a name="SaveReadFields">SaveReadFields</a></tt></h3>
<i>from dlls/cbase.cpp</i><br>
<dd><tt>void SaveReadFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount);</tt><p>
<hr><h3><tt><a name="SaveGlobalState">SaveGlobalState</a></tt></h3>
<i>from dlls/world.cpp</i><br>
<dd><tt>void SaveGlobalState(SAVERESTOREDATA *pSaveData);</tt><p>
<hr><h3><tt><a name="RestoreGlobalState">RestoreGlobalState</a></tt></h3>
<i>from dlls/world.cpp</i><br>
<dd><tt>void RestoreGlobalState(SAVERESTOREDATA *pSaveData);</tt><p>
<hr><h3><tt><a name="ResetGlobalState">ResetGlobalState</a></tt></h3>
<i>from dlls/world.cpp</i><br>
<dd><tt>void ResetGlobalState(void);</tt><p>
<hr><h3><tt><a name="ClientConnect">ClientConnect</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]);</tt><p>
<blockquote><tt>
Called when a player connects to a server.
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Called on initial connect, just after hlds reports "connected", ie:
<pre> <tt>"John&lt;1&gt;&lt;WON:9856723&gt;" connected, address "127.0.0.1:27005"</tt></pre>
This is before the user begins downloading, or anything else.
</blockquote>
<hr><h3><tt><a name="ClientDisconnect">ClientDisconnect</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void ClientDisconnect(edict_t *pEntity);</tt><p>
<blockquote><tt>
Called when a player disconnects from a server.<br>
GLOBALS ASSUMED SET: g_fGameOver
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
This is not the opposite of <tt><b>ClientConnect</b></tt>, despite the similar name.
It appears to only be called if the client was <tt><b>PutInServer</b></tt> first. If
the client disconnects before being <tt><b>PutInServer</b></tt>, no API routine is
called. This would be more appropriately named <tt><i><b>ClientRemoveFromServer</i></b></tt>.
</blockquote>
<hr><h3><tt><a name="ClientKill">ClientKill</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void ClientKill(edict_t *pEntity);</tt><p>
<blockquote><tt>
Player entered the suicide command.<br>
GLOBALS ASSUMED SET: g_ulModelIndexPlayer
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
When the client typed "kill" in the console?
</blockquote>
<hr><h3><tt><a name="ClientPutInServer">ClientPutInServer</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void ClientPutInServer(edict_t *pEntity);</tt><p>
<blockquote><tt>
Called each time a player is spawned.
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Called after the client has uploaded/download all necessary resources,
just after hlds reports "entered the game", ie:
<pre> "John&lt;1&gt;" has entered the game</pre>
</blockquote>
<hr><h3><tt><a name="ClientCommand">ClientCommand</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void ClientCommand(edict_t *pEntity);</tt><p>
<blockquote><tt>
Called each time a player uses a "cmd" command.
Use CMD_ARGS, CMD_ARGV, and CMD_ARGC to get pointers to the character
string command.
</tt></blockquote>
<hr><h3><tt><a name="ClientUserInfoChanged">ClientUserInfoChanged</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void ClientUserInfoChanged(edict_t *pEntity, char *infobuffer);</tt><p>
<blockquote><tt>
Called after the player changes userinfo - gives dll a chance to modify
it before it gets sent into the rest of the engine.
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Called when user issues <tt>"<b>setinfo</b>"</tt> from the console. Also appears to be
called whenever the user returns to the game from the ESC menu.
</blockquote>
<hr><h3><tt><a name="ServerActivate">ServerActivate</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);</tt><p>
<blockquote><tt>
Every call to ServerActivate should be matched by a call to
ServerDeactivate.
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
Apparently called when the server has loaded the map, but before it
precaches from the <tt><b>.res</b></tt> file.
</blockquote>
<hr><h3><tt><a name="ServerDeactivate">ServerDeactivate</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void ServerDeactivate(void);</tt><p>
<blockquote><tt>
Peform any shutdown operations here.<br>
It's possible that the engine will call this function more times than
is necessary. Therefore, only run it one time for each call to
ServerActivate.<br>
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Called upon <tt>"<b>quit</b>"</tt> or <tt>"<b>changelevel</b>"</tt> .
</blockquote>
<hr><h3><tt><a name="PlayerPreThink">PlayerPreThink</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void PlayerPreThink(edict_t *pEntity);</tt><p>
<blockquote><tt>
Called every frame before physics are run.
</tt></blockquote>
<hr><h3><tt><a name="PlayerPostThink">PlayerPostThink</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void PlayerPostThink(edict_t *pEntity);</tt><p>
<blockquote><tt>
Called every frame after physics are run.
</tt></blockquote>
<hr><h3><tt><a name="StartFrame">StartFrame</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void StartFrame(void);</tt><p>
<blockquote><tt>
GLOBALS ASSUMED SET: g_ulFrameCount
</tt></blockquote>
<hr><h3><tt><a name="ParmsNewLevel">ParmsNewLevel</a></tt></h3>
<i>from dlls/client.cpp</i><br>
<dd><tt>void ParmsNewLevel(void);</tt><p>
<hr><h3><tt><a name="ParmsChangeLevel">ParmsChangeLevel</a></tt></h3>
<i>from dlls/client.cpp</i><br>
<dd><tt>void ParmsChangeLevel(void);</tt><p>
<hr><h3><tt><a name="GetGameDescription">GetGameDescription</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>const char *GetGameDescription(void);</tt><p>
<blockquote><tt>
Returns string describing current .dll game.<br>
Returns the descriptive name of this .dll. E.g., Half-Life, or Team
Fortress 2.<br>
This function might be called before the world has spawned, and the game
rules initialized.<br>
</tt></blockquote>
<hr><h3><tt><a name="PlayerCustomization">PlayerCustomization</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void PlayerCustomization(edict_t *pEntity, customization_t *pCust);</tt><p>
<blockquote><tt>
Notifies .dll of new customization for player.<br>
A new player customization has been registered on the server.
UNDONE: This only sets the # of frames of the spray can logo animation
right now.<br>
</tt></blockquote>
<hr><h3><tt><a name="SpectatorConnect">SpectatorConnect</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void SpectatorConnect(edict_t *pEntity);</tt><p>
<blockquote><tt>
Called when spectator joins server.<br>
A spectator has joined the game.<br>
</tt></blockquote>
<hr><h3><tt><a name="SpectatorDisconnect">SpectatorDisconnect</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void SpectatorDisconnect(edict_t *pEntity);</tt><p>
<blockquote><tt>
Called when spectator leaves the server.<br>
A spectator has left the game.<br>
</tt></blockquote>
<hr><h3><tt><a name="SpectatorThink">SpectatorThink</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void SpectatorThink(edict_t *pEntity);</tt><p>
<blockquote><tt>
Called when spectator sends a command packet (usercmd_t).<br>
A spectator has sent a usercmd.<br>
</tt></blockquote>
<hr><h3><tt><a name="Sys_Error">Sys_Error</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void Sys_Error(const char *error_string);</tt><p>
<blockquote><tt>
Called when engine has encountered an error.<br>
Notify game .dll that engine is going to shut down.<br>
Engine is going to shut down, allows setting a breakpoint in game dll
to catch that occasion.<br>
Add code ( e.g., _asm { int 3 }; here to cause a breakpoint for
debugging your game .dlls.<br>
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="PM_Move">PM_Move</a></tt></h3>
<i>from pm_shared/pm_shared.c:</i><br>
<dd><tt>void PM_Move(struct playermove_s *ppmove, int server);</tt><p>
<blockquote><tt>
This modume implements the shared player physics code between
any particular game and the engine. The same PM_Move routine is built
into the game .dll and the client .dll and is invoked by each side as
appropriate. There should be no distinction, internally, between server
and client. This will ensure that prediction behaves appropriately.
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="PM_Init">PM_Init</a></tt></h3>
<i>from pm_shared/pm_shared.c:</i>
<dd><tt>void PM_Init(struct playermove_s *ppmove);</tt><p>
<blockquote><tt>
Server version of player movement initialization.
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="PM_FindTextureType">PM_FindTextureType</a></tt></h3>
<i>from pm_shared/pm_shared.c</i><br>
<dd><tt>char PM_FindTextureType(char *name);</tt><p>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="SetupVisibility">SetupVisibility</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void SetupVisibility(edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas);</tt><p>
<i>from dlls/client.cpp:</i>
<blockquote><tt>
Set up PVS and PAS for networking for this client.
<p>
A client can have a separate "view entity" indicating
that his/her view should depend on the origin of that view entity. If
that's the case, then pViewEntity will be non-NULL and will be used.
Otherwise, the current entity's origin is used. Either is offset by the
view_ofs to get the eye position.
<p>
From the eye position, we set up the PAS and PVS to use for filtering
network messages to the client. At this point, we could override the
actual PAS or PVS values, or use a different origin.
<p>
NOTE: Do not cache the values of pas and pvs, as they depend on
reusable memory in the engine, they are only good for this one frame
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="UpdateClientData">UpdateClientData</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void UpdateClientData (const struct edict_s *ent, int sendweapons, struct clientdata_s *cd);</tt><p>
<blockquote><tt>
Set up data sent only to specific client.<br>
Data sent to current client only.<br>
Engine sets argument 'cd' to 0 before calling.<br>
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="AddToFullPack">AddToFullPack</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>int AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet);</tt><p>
<blockquote><tt>
Return 1 if the entity state has been filled in for the ent and the
entity will be propagated to the client, 0 otherwise.
<p>
State is the server maintained copy of the state info that is
transmitted to the client. A MOD could alter values copied into state
to send the "host" a different look for a particular entity update,
etc.
<p>
Arguments 'e' and 'ent' are the entity that is being added to the
update, if 1 is returneds. Host is the player's edict of the player
whom we are sending the update to. Player is 1 if the ent/e is a
player and 0 otherwise. Argument 'pSet' is either the PAS or PVS that
we previous set up. We can use it to ask the engine to filter the
entity against the PAS or PVS.
<p>
We could also use the pas/ pvs that we set in SetupVisibility, if we
wanted to. Caching the value is valid in that case, but still only for
the current frame.
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="CreateBaseline">CreateBaseline</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void CreateBaseline(int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs);</tt><p>
<blockquote><tt>
Tweak entity baseline for network encoding, allows setup of player
baselines, too.<br>
Creates baselines used for network encoding, especially for player data
since players are not spawned until connect time.<br>
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="RegisterEncoders">RegisterEncoders</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void RegisterEncoders(void);</tt><p>
<blockquote><tt>
Callbacks for network encoding.<br>
Allows game .dll to override network encoding of certain types of
entities and tweak values, etc.<br>
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="GetWeaponData">GetWeaponData</a></tt></h3>
<i>from dlls/client.cpp</i><br>
<dd><tt>int GetWeaponData(struct edict_s *player, struct weapon_data_s *info);</tt><p>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="CmdStart">CmdStart</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void CmdStart(const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed);</tt><p>
<blockquote><tt>
We're about to run this usercmd for the specified player. We can set
up groupinfo and masking here, etc. This is the time to examine the
usercmd for anything extra. This call happens even if think does not.
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="CmdEnd">CmdEnd</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void CmdEnd (const edict_t *player);</tt><p>
<blockquote><tt>
Each cmdstart is exactly matched with a cmd end, clean up any
group trace flags, etc. here.
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="ConnectionlessPacket">ConnectionlessPacket</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>int ConnectionlessPacket(const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size);</tt>
<blockquote><tt>
Return 1 if the packet is valid. Set response_buffer_size if you want
to send a response packet. Incoming, it holds the max size of the
response_buffer, so you must zero it out if you choose not to respond.
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="GetHullBounds">GetHullBounds</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>int GetHullBounds(int hullnumber, float *mins, float *maxs);</tt><p>
<blockquote><tt>
Engine calls this to enumerate player collision hulls,
for prediction. Return 0 if the hullnumber doesn't exist.
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="CreateInstancedBaselines">CreateInstancedBaselines</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>void CreateInstancedBaselines (void);</tt><p>
<blockquote><tt>
Tweak entity baseline for network encoding, allows setup of player baselines, too.<br>
Create pseudo-baselines for items that aren't placed in the map at
spawn time, but which are likely to be created during play (e.g.,
grenades, ammo packs, projectiles, corpses, etc.).<br>
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="InconsistentFile">InconsistentFile</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>int InconsistentFile(const edict_t *player, const char *filename, char *disconnect_message);</tt>
<blockquote><tt>
One of the ENGINE_FORCE_UNMODIFIED files failed the consistency check
for the specified player Return 0 to allow the client to continue, 1 to
force immediate disconnection (with an optional disconnect message of
up to 256 characters).
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="AllowLagCompensation">AllowLagCompensation</a></tt></h3>
<i>from dlls/client.cpp:</i><br>
<dd><tt>int AllowLagCompensation(void);</tt><p>
<blockquote><tt>
The game .dll should return 1 if lag compensation should be allowed
(could also just set the sv_unlag cvar. Most games right now should
return 0, until client-side weapon prediction code is written and
tested for them (note you can predict weapons, but not do lag
compensation, too, if you want.
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<p>
<hr>
</body>
</HTML>

1705
doc/html/engine_notes.html Normal file

File diff suppressed because it is too large Load Diff

158
doc/html/faq.html Normal file
View File

@ -0,0 +1,158 @@
<!-- vi: set ts=4 sw=4 : -->
<!-- vim: set tw=75 : -->
<HTML>
<head>
<title>Metamod FAQ</title>
</head>
<body>
<h1>Metamod FAQ
</h1>
<p><a name=modsupport>
<b> Please add support for <i>(some)</i> mod.</b>
</a><p> <blockquote>
Please see <a href="gamesupport.html#requirements">game support
requirements</a> in the documentation.
</blockquote>
<p><a name=bots>
<b> How do I use bots with Metamod?</b>
</a><p> <blockquote>
If the bot is <i>not</i> a Metamod plugin, then you will need to tell
Metamod to use your bot as the gamedll, by specifying it on the hlds
command line with the "+localinfo mm_gamedll" option. See the
<a href="metamod.html#localinfo">Metamod docs</a>. See also the
<a href="http://www.adminmod.org/help/online/Configuration/How_to_Use_Bots_with_MetaMod_AM_2.50_and_up.htm">AdminMod docs</a>.
</blockquote>
<p><a name=corrupt>
<b> The download links give corrupt files.</b>
</a><p> <blockquote>
I think what you're observing is that your web client is quietly
uncompressing the file, but not updating the name of the downloaded file to
reflect this. In particular, some web clients will silently decompress
(gunzip) files _without_ removing the ".gz" from the filename, so you'll
end up with a file "metamod_i386.so.gz" which is _really_
"metamod_i386.so", and so trying to gunzip it will produce an error ("not
in gzip format"). Try running "file" on the resulting file to see what the
OS thinks it is. Or, where you don't have "file" (ie windows), just look
at the file size - it should be pretty indicative of whether the file is
still compressed or not.
</blockquote>
<p><a name=install>
<b> How do I install Metamod?</b>
</a><p> <blockquote>
This is covered briefly in the <a href="metamod.html#installation">Metamod
docs</a>. Typically, though, Metamod is installed as part of some major
plugin, like <a href="http://www.adminmod.org/">AdminMod</a>. There is
also some discussion of installing Metamod by hand in the <a href="http://www.adminmod.org/help/online/Installing/Manual_Installation_-_Walk-Through.htm">AdminMod docs</a>. If you already have Metamod installed and merely want
to update it, this requires only replacing the .so/.dll with the latest
version from the <a href="http://metamod.org/">webpage</a>.
</blockquote>
<p><a name=adminmod>
<b> I'm having trouble with AdminMod.</b>
</a><p> <blockquote>
You'll need to ask your AdminMod questions on the <a href="http://www.ozforums.com/forumdisplay.php?forumid=143">AdminMod forums</a>.
</blockquote>
<p><a name=hlcoding>
<b> How do I do <i>(something)</i> in a Metamod plugin?</b>
</a><p> <blockquote>
Generally speaking, a Metamod plugin works very much like an Half-Life Game
Mod, since all it's doing is making the same calls to the same SDK that the
Game Mod does. So, the question typically isn't "how do I do this in
Metamod?" but instead "how do I do this in an Half-Life Mod?", and is best
asked in a HL SDK Programming forum/mailinglist (see <a href="links.html">related links</a>
and especially <a href="http://planethalflife.com/botman/MOD_FAQ.shtml">Botman's MOD FAQ</a>).
Once you figure out how it would normally be done in a Game Mod, figuring
out how to do it in Metamod is relatively straightforward.
<p>
However, if you have questions on how to convert a piece of code from HLmod
to Metamod plugin, then I can provide some pointers, or you can ask on the
<a href="http://groups.yahoo.com/group/metamod/">Metamod mailing list</a>.
And of course, if you have questions about things in the code specific to
Metamod (ie things mentioned in the <a href="coding.html">Metamod Coding
docs</a>) feel free to ask me or on the mailing list.
</blockquote>
<p><a name=examples>
<b> Is there a tutorial or example of how to write a Metamod plugin?</b>
</a><p> <blockquote>
The sourcecode includes a couple of plugins that can be used as examples.
The "stub" plugin is the bare basics of what a plugin needs. The "trace"
plugin provides an example of hooking _every_ SDK function. The "wdmisc"
plugin provides a couple of basic useful features. You can also look at
several of the other plugins out there for more examples.
<p>
Note that the example plugins in the Metamod sourcecode show how to use
Metamod to interface with Half-Life code, but they mostly assume you
already know how to write Half-Life code. If you need examples or info on
how to write Half-Life code itself, you'll need to go look through the HL
SDK programming websites (see <a href="links.html">related links</a>
and <a href="http://planethalflife.com/botman/MOD_FAQ.shtml">Botman's MOD FAQ</a>).
</blockquote>
<p><a name=pluginlink>
<b> I have (or know of) a Metamod plugin not listed on the webpage.</b>
</a><p> <blockquote>
Send me the information about the plugin (name, author, description, URL),
and I'd be happy to provide a link from the webpage.
</blockquote>
<p><a name=msvc>
<b> I'm having trouble compiling under MSVC.</b>
</a><p> <blockquote>
Please note that I do not use MSVC, so I can't help a lot with using that
compiler. I do all my development under linux, using gcc for linux
binaries and <a href="http://www.mingw.org/">mingw32</a> for windows
binaries. The sourcecode does include an MSVC project file for Metamod, as
well as a project file for the stub plugin, both mostly as examples. They
<i>should</i> work, and indeed did work the last time I dug up MSVC to test
them. That said, there are a few folks on the <a href="http://groups.yahoo.com/group/metamod/">Metamod mailing list</a> that
do use MSVC, so you might find some assistance there.
</blockquote>
<p><a name=gpl>
<b> If I create a Metamod plugin, does it have to be open source?</b>
</a><p> <blockquote>
Generally speaking, yes. The way the GPL is interpreted, plugins of a GPL
program need to be also GPL. See also the FAQ entry on the GNU site about
<a href="http://www.gnu.org/licenses/gpl-faq.html#GPLAndPlugins">plugins of a GPL program</a>.
</blockquote>
<p><a name=otherengines>
<b> How about a port of Metamod to other engines like Q3, Unreal, etc?</b>
</a><p> <blockquote>
I haven't looked into it myself, but several folks on the AdminMod team
(from which Metamod was derived) had looked at porting to other games like
Q3 and UT, and determined that those engines either didn't provide the
necessary API hooks, or that they already provided a suitable method for
extending functionality. So, I wouldn't expect to see a version of Metamod
for those. Perhaps for some other future engines, although I believe most
modern engines are now providing their own method for extensions or
plugins, so that a third-party solution like Metamod wouldn't be necessary.
<p>
If Half-Life 2 ever sees the light of day, I expect I'd look seriously at
porting to that - unless, of course, Valve ends up providing their
<b>own</b> plugin framework themselves. :)
</blockquote>
<p>
<hr>
</body>
</HTML>

17
doc/html/gamesupport.html Normal file
View File

@ -0,0 +1,17 @@
<!-- vi: set ts=4 sw=4 : -->
<!-- vim: set tw=75 : -->
<HTML>
<head>
<title>Metamod Adding Game/Mod Support</title>
</head>
<body>
<h1>Adding Game/Mod Support
</h1>
<b>Metamod-P already supports your Mod.</b>
<hr>
</body>
</HTML>

114
doc/html/links.html Normal file
View File

@ -0,0 +1,114 @@
<!-- vi: set ts=4 sw=4 : -->
<!-- vim: set tw=75 : -->
<HTML>
<head>
<title>Metamod Related Links</title>
</head>
<body>
<h2>Related links
</h2></a>
Here's a list of links, other sites, and information I found useful when
working on Metamod:
<ul>
<li><a href="http://www.ozforums.com/forumdisplay.php?forumid=114">AdminMod's DLL Forum</a>
<li><a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/halflifeadmin/">AdminMod CVS at Sourceforge</a>
<p>
<!-- <li><a href="http://hlsdk.valve-erc.com/">Half-Life SDK Resource Site</a>, Valve's official site -->
<li><a href="http://collective.valve-erc.com/">Valve Editing Resource Center</a>, Valve's official site
<li><a href="http://planethalflife.com/botman/">Botman's Bots</a>
<li><a href="http://hlpp.valveworld.com/">Half-Life Programming Planet</a>
<li><a href="http://planethalflife.com/hlsdk2">Shadowman's Half-Life SDK2 Site</a>
<li><a href="http://www.planethalflife.com/botman/balfourroad/index.shtml">Half-Life Coding Pages</a>
<li><a href="http://planethalflife.com/fixxxer/">Fixxxer's HL Coding page</a>
<li><a href="http://www.karljones.com/halflife/coding.asp">The Handy Vandal's HL Coding Links</a>
<p>
<li><a href="http://www.chatbear.com/cgi-bin/board.pl?boardid=942">Half-Life SDK Forums</a>, at the VERC
<li><a href="http://www.chatbear.com/cgi-bin/board.pl?action=boardlisting&boardid=590">Half-Life SDK Forums</a>, at Valve's former SDK site
<li><a href="http://www.topica.com/lists/hlcoders">HL Coders mailing list</a>, at topica.com
<li><a href="http://dynamic.gamespy.com/~botman/yabb/YaBB.pl">Botman's forums</a>
<!-- <li><a href="http://dynamic.gamespy.com/~wavelength/ubb/forumdisplay.cgi?action=topics&forum=Coding&number=3">Wavelength Half-Life Coding Forum</a> -->
<li><a href="http://www.thewavelength.net/forums/index.php?act=SF&f=13">Wavelength Half-Life Coding Forum</a>
<li><a href="http://pub21.ezboard.com/fshadowmanshalflifeforumsdk2">SDK2 Forum</a>, at ezboard.com
<li><a href="http://dynamic.gamespy.com/~hlprogramming/ultimatebb/forumdisplay.cgi?action=topics&forum=Coding&number=1">HL Programming Forum</a>, at gamespy.com
<li><a href="http://network54.com/Hide/Forum/goto?forumid=21807">Fixxxer's HL Coding forum</a>
<li><a href="http://forums.gamedesign.net/forums/wwwthreads.pl?action=list&Board=halflife_coding">HL Programming Forum</a>, at gamedesign.net
<p>
<li><a href="http://www.eskimo.com/~scs/C-faq/top.html">C FAQ</a>
<li><a href="http://www.parashift.com/cpp-faq-lite/">C++ FAQ Lite</a>
<li><a href="http://www.calpoly.edu/~jfischer/c++faq/index.html">C++ FAQ Index</a>
<li><a href="http://snurse-l.org/acllc-c++/faq">alt.comp.lang.learn.c-c++ FAQ</a>
<li><a href="http://dragon.klte.hu/~kollarl/C++/cplusplu.html">C++ Annotations</a>, guide for C programmers to using C++
<li><a href="http://www.mozilla.org/hacking/portable-cpp.html">C++ Portability Guide</a>
<li><a href="http://www.sgi.com/tech/stl/">Standard Template Library Programmer's Guide</a>, at SGI
<li><a href="http://reality.sgi.com/austern_mti/std-c++/faq.html">comp.std.c++ FAQ</a>
<li><a href="http://www.landfield.com/faqs/g++-FAQ/plain/">GNU g++ FAQ</a>
<li><a href="http://gcc.gnu.org/onlinedocs/libstdc++/faq/">GNU libstdc++ FAQ</a>
<li><a href="http://www.apl.jhu.edu/~paulmac/c++-references.html">C++ References</a>, books and other links
<li><a href="http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html">Thinking in C++</a>, free electronic book
<p>
<li><a href="http://www.serpentine.com/~bos/threads-faq/">comp.programming.threads FAQ</a>
<li><a href="http://www.lambdacs.com/cpt/FAQ.html">comp.programming.threads FAQ #2</a>
<li><a href="http://www.cs.wustl.edu/~schmidt/win32-cv-1.html">Implementing POSIX Condition Variables in Win32</a>
<p>
<li><a href="http://msdn.microsoft.com/">Microsoft Developer Network</a>, online win32 API docs
<li><a href="http://www.iseran.com/Win32/FAQ/">Win32 Programming FAQ</a>
<li><a href="http://www.mingw.org/">Minimal Gnu for Windows (mingw)</a>, gcc for win32
<li><a href="http://www.geocities.com/Tokyo/Towers/6162/win32/dll/make.html">Creating DLLs w/mingw</a>
<li><a href="http://www.devolution.com/~slouken/SDL/Xmingw32/">Mingw binaries</a>
<li><a href="http://members.telering.at/jessich/mingw/index.html">Mingw binaries (newer)</a>
</ul>
<h2>Books</h2>
And here are books I picked up that I found useful as well:
<ul>
<li><a href="http://vig.prenhall.com/catalog/academic/product/1,4096,0133262243,00.html">C: A Reference Manual</a>, by Samuel Harbison &amp; <a href="http://www.sls.lcs.mit.edu/~hurley/guysteele.html">Guy Steele</a> (at <a href="http://www.bookpool.com/.x//sm/0133262243">Bookpool</a>, at <a href="http://www.amazon.com/exec/obidos/ASIN/0133262243">Amazon</a>)
<li><a href="http://cseng.aw.com/book/0,3828,0201845199,00.html">C Programming FAQs</a>, by <a href="http://www.eskimo.com/~scs/">Steve Summit</a> (at <a href="http://www.bookpool.com/.x//sm/0201845199">Bookpool</a>, at <a href="http://www.amazon.com/exec/obidos/ASIN/0201845199">Amazon</a>)
<p>
<li><a href="http://www.oreilly.com/catalog/core/">C++: The Core Language</a>, by Gregory Satir &amp; Doug Brown (at <a href="http://www.bookpool.com/.x//sm/156592116X">Bookpool</a>, at <a href="http://www.amazon.com/exec/obidos/ASIN/156592116X">Amazon</a>)
<li><a href="http://cseng.aw.com/book/0,3828,0201700735,00.html">C++ Programming Language Special Edition</a>, by <a href="http://www.research.att.com/~bs/">Bjarne Stroustrup</a> (at <a href="http://www.bookpool.com/.x//sm/0201700735">Bookpool</a>, at <a href="http://www.amazon.com/exec/obidos/ASIN/0201700735">Amazon</a>)
<li><a href="http://cseng.aw.com/book/0,3828,0201379260,00.html">The C++ Standard Library: A Tutorial and Reference</a>, by <a href="http://www.josuttis.de/indexe.html">Nicolai Josuttis</a> (at <a href="http://www.bookpool.com/.x//sm/0201379260">Bookpool</a>, at <a href="http://www.amazon.com/exec/obidos/ASIN/0201379260">Amazon</a>)
<li><a href="http://cseng.aw.com/book/0,3828,0201309831,00.html">C++ FAQs</a>, by <a href="http://www.parashift.com/">Marshall Cline</a>, Greg Lomow, &amp; Mike Girou (at <a href="http://www.bookpool.com/.x//sm/0201309831">Bookpool</a>, at <a href="http://www.amazon.com/exec/obidos/ASIN/0201309831">Amazon</a>)
<li><a href="http://cseng.aw.com/book/0,,0201924889,00.html">Effective C++</a>, by <a href="http://www.aristeia.com/">Scott Meyers</a> (at <a href="http://www.bookpool.com/.x//sm/0201924889">Bookpool</a>, at <a href="http://www.amazon.com/exec/obidos/ASIN/0201924889">Amazon</a>)
<li><a href="http://cseng.aw.com/book/0,,0201350882,00.html">Algorithms in C++, Parts 1-4</a>, by <a href="http://www.cs.princeton.edu/~rs/">Robert Sedgewick</a> (at <a href="http://www.bookpool.com/.x//sm/0201350882">Bookpool</a>, at <a href="http://www.amazon.com/exec/obidos/ASIN/0201350882">Amazon</a>)
<p>
<li><a href="http://cseng.aw.com/book/0,3828,0201563177,00.html">Advanced Programming in the UNIX Environment</a>, by <a href="http://www.kohala.com/">W. Richard Stevens</a> (at <a href="http://www.bookpool.com/.x//sm/0201563177">Bookpool</a>, at <a href="http://www.amazon.com/exec/obidos/ASIN/0201563177">Amazon</a>)
<li><a href="http://cseng.aw.com/book/0,3828,0201703106,00.html">Win32 System Programming</a>, by <a href="http://world.std.com/~jmhart/">Johnson Hart</a> (at <a href="http://www.bookpool.com/.x//sm/0201703106">Bookpool</a>, at <a href="http://www.amazon.com/exec/obidos/ASIN/0201703106">Amazon</a>)
<li><a href="http://www.oreilly.com/catalog/make2/">Managing Projects with Make</a>, by Andrew Oram &amp; <a href="http://www.oreilly.com/~stevet/">Steve Talbott</a> (at <a href="http://www.bookpool.com/.x//sm/0937175900">Bookpool</a>, at <a href="http://www.amazon.com/exec/obidos/ASIN/0937175900">Amazon</a>)
<p>
<li><a href="http://vig.prenhall.com/catalog/academic/product/1,4096,0131900676,00.html">Thread Time</a>, by Scott Norton &amp; Mark DiPasquale (at <a href="http://www.bookpool.com/.x//sm/0131900676">Bookpool</a>, at <a href="http://www.amazon.com/exec/obidos/ASIN/0131900676">Amazon</a>)
<li><a href="http://cseng.awl.com/book/0,3828,0201633922,00.html">Programming with POSIX Thrads</a>, by David Butenhof (at <a href="http://www.bookpool.com/.x//sm/0201633922">Bookpool</a>, at <a href="http://www.amazon.com/exec/obidos/ASIN/0201633922">Amazon</a>)
</ul>
<p>
<hr>
</body>
</HTML>

62
doc/html/maillist.html Normal file
View File

@ -0,0 +1,62 @@
<!-- vi: set ts=4 sw=4 : -->
<!-- vim: set tw=75 : -->
<HTML>
<head>
<title>Metamod Mailing lists</title>
</head>
<body>
<h1>Mailing lists
</h1>
I've created a couple of lists on YahooGroups (formerly egroups (formerly
onelist)):
<ul>
<li> <a href="http://groups.yahoo.com/group/metamod-announce/">metamod-announce</a> for announcements of new versions and plugins
<li> <a href="http://groups.yahoo.com/group/metamod/">metamod</a> for
questions, support, discussion, etc
</ul>
There are simple subscribe forms below.
<table cellspacing=0 cellpadding=2 border=0 bgcolor=#DDCCFF>
<tr>
<form method=GET action="http://groups.yahoo.com/subscribe/metamod-announce">
<td align=center>
<b>Subscribe to metamod-announce</b><br>
<input type=text name="user" value="enter email address" size=20><br>
<a href="http://groups.yahoo.com/group/metamod-announce/">groups.yahoo.com/metamod-announce</a>
</td>
<td>
<input type=image border=0 alt="Click here to join metamod-announce"
name="Click here to join metamod" src="http://groups.yahoo.com/img/ui/join.gif">
</td>
</form>
</tr>
</table>
<p>
<table cellspacing=0 cellpadding=2 border=0 bgcolor=#DDCCFF>
<tr>
<form method=GET action="http://groups.yahoo.com/subscribe/metamod">
<td align=center>
<b>Subscribe to metamod</b><br>
<input type=text name="user" value="enter email address" size=20><br>
<a href="http://groups.yahoo.com/group/metamod/">groups.yahoo.com/metamod</a>
</td>
<td>
<input type=image border=0 alt="Click here to join metamod"
name="Click here to join metamod" src="http://groups.yahoo.com/img/ui/join.gif">
</td>
</form>
</tr>
</table>
<p>
<hr>
</body>
</HTML>

696
doc/html/metamod.html Normal file
View File

@ -0,0 +1,696 @@
<!-- vi: set ts=4 sw=4 : -->
<!-- vim: set tw=75 : -->
<HTML>
<head>
<title>Using Metamod</title>
</head>
<body>
<h1>Using Metamod
</h1>
<a name=clientcommands>
<h2>Client Commands
</h2></a>
Similar to the <a href="#commands">server console interface</a>, clients
can also issue commands to Metamod, of the following form:
<ul>
<li> <b><tt>meta version</tt></b> - displays version information about the
Metamod instance currently running on the server, ie:
<p>
<tt>Metamod v1.21p37 2013/05/30 (5:13)
<br>by Will Day <willday@metamod.org>
<br>&nbsp;&nbsp;http://www.metamod.org/
<br>&nbsp;Patch: Metamod-P (mm-p) v37
<br>&nbsp;by Jussi Kivilinna
<br>&nbsp;&nbsp;&nbsp;http://koti.mbnet.fi/axh/
<br>compiled: Feb 18 2013, 11:53:27 EET (optimized)
</tt>
<p><li> <b><tt>meta list</tt></b> - displays information about the list of
currently running plugins, ie:
<p>
<tt>Currently running plugins:
<br>[ 1] Trace HLSDK API, v1.XX.93, 2003/02/17, by Will Day &lt;willday@metamod.org&gt;, see http://www.metamod.org/
<br>[ 2] Adminmod, v2.50.56 (MM), Jul 13 2003, by Alfred Reynolds &lt;alfred@valvesoftware.com&gt;, see http://www.adminmod.org/
<br>2 plugins
</tt>
</ul>
<a name=clientcvars>
<h2>Client Cvars
</h2></a>
Also available to client browser applications is a cvar
<b><tt>metamod_version</tt></b> that should report the version of Metamod
running on the server, ie:
<p>
<dd><tt>"metamod_version" is "1.21p37"</tt>
<a name=installation>
<h2>Installation
</h2></a>
<!--
If you have installed <a href="http://www.adminmod.org/">AdminMod</a> 2.50
or later, then the AM installer has already installed Metamod for you. If
you only want to upgrade your Metamod with a more recent version, simply
grab the <a href="http://metamod.org/dl/dlls/metamod.dll">metamod.dll</a> (win32) or <a
href="http://metamod.org/dl/dlls/metamod_i386.so">metamod_i386.so</a> (linux) file and
replace the file currently on your system.
<p>
-->
If you want to install Metamod by hand, here's what you have to do:
<ul>
<p><li> Install the Metamod library (.dll for win32, or .so for linux) to a
directory under your <b>game</b> directory. For instance, if you were
running Counter-Strike, under win32 you might want have:
<p><pre>
half-life/cstrike/addons/metamod/dlls/metamod.dll
</pre>
<p>If a directory you want doesn't exist, create it.
<p><li> Edit the "<tt>liblist.gam</tt>" file in your <b>game</b> directory,
replacing the game dll filename with the Metamod dll filename. For
instance with Counter-Strike, you would change:
<p><dl><tt>
<dd>gamedll "dlls/mp.dll"
<dd>gamedll_linux "dlls/cs.so"
</tt></dl>
to:
<dl><tt>
<dd>gamedll "addons/metamod/dlls/metamod.dll"
<dd>gamedll_linux "addons/metamod/dlls/metamod.so"
</tt></dl>
<p>Note that it's only really necessary to change the line corresponding
to your OS (win32 or linux); you can leave the other line unchanged, or you
can change it - it doesn't matter.
<p><li> To load plugins at game startup, you'll need to create a "<a
href="#plugins.ini">plugins.ini</a>" file containing a list of the plugins
you want to load.
</ul>
<p><br><a name=configuration>
<h2>Configuration
</h2></a>
Metamod has several ways to provide config options, partially because it
started with one method and then added other methods, but also because one
method can be more convenient than the other, varying with the situation.
<p>
Generally speaking, the two methods of providing configuration
information to Metamod are:
<ul>
<li> on the command line, via <a href="localinfo">+localinfo</a>
arguments to hlds.
<li> as the contents of some <b>file</b> that Metamod reads and parses.
</ul>
<p>
The confusing part can come when the <i>pathnames</i> to some of the config
files can be specified via command line options - or indeed, when the
pathnames to <i>some</i> config files can be specified in <i>other</i>
config files.
<p>
In any case, here are the various config options and config files Metamod
uses, (listed in order of priority), where "<tt><i>$gamedir</i></tt>"
indicates the game directory, ie "cstrike":
<ul>
<li> <tt>+<a href="#localinfo">localinfo</a> mm_configfile</tt>
<i>&lt;file&gt;</i>
<p>
<li> <tt>+<a href="#localinfo">localinfo</a> mm_pluginsfile</tt>
<i>&lt;file&gt;</i>
<li> <tt><a href="#config.ini">config.ini</a> option: plugins_file</tt>
<i>&lt;file&gt;</i>
<li> <tt><i>$gamedir</i>/addons/metamod/<a href="#plugins.ini">plugins.ini</a></tt>
<li> <tt><i>$gamedir</i>/metamod.ini</tt>
<p>
<li> <tt>$<a href="#localinfo">localinfo</a> mm_execcfg</tt>
<i>&lt;file&gt;</i>
<li> <tt><a href="#config.ini">config.ini</a> option: exec_cfg</tt>
<i>&lt;file&gt;</i>
<li> <tt><i>$gamedir</i>/addons/metamod/<a href="#exec.cfg">exec.cfg</a></tt>
<li> <tt><i>$gamedir</i>/metaexec.cfg</tt>
<p>
<li> <tt>$<a href="#localinfo">localinfo</a> mm_gamedll</tt>
<i>&lt;file&gt;</i>
<li> <tt><a href="#config.ini">config.ini</a> option: gamedll</tt>
<i>&lt;file&gt;</i>
<li> <tt><strike><i>$gamedir</i>/metagame.ini</strike></tt>
<i><b>-- No longer supported.</b></i>
</ul>
<p><br><a name=metamod.ini></a><a name=plugins.ini>
<h2>File: <tt>plugins.ini</tt>
</h2></a>
Default location: <b><i>$gamedir</i>/addons/metamod/plugins.ini</b>, ie
"cstrike/addons/metamod/plugins.ini".
<p>Plugins are described in a file "plugins.ini" and each line describes a
plugin to load:
<dl>
<dd> <i>&lt;platform&gt; &lt;filepath&gt; [&lt;description&gt;]</i>
</dl>
<p> Fields are whitespace delimited (tabs/spaces).
<ul>
<li><i>Platform</i> is a keyword, either <tt>"<b>linux</b>"</tt> or
<tt>"<b>win32</b>"</tt>.
<p><li><i>Filepath</i> is a path to the DLL/so file. Relative paths
are from the game dir; absolute paths are also valid. Paths should use
unix-style <b>forward</b> slashes (<b>/</b>) and not <b>backward</b>
slashes (<b>\</b>), even on windows platforms.
<p>Also, the filepath (once expanded to full path name) is expected to
be unique within the list of plugins. Thus, a plugin with a
fullpathname matching that of a previous plugin is considered a
duplicate, and is not loaded.
<p><li><i>Description</i> is an optional description of the plugin, used
in place of the plugin's internal name in log messages and console
output. Whitespace in the description <b><i>is</i></b> allowed;
quoting is unnecessary.
</ul>
Comments are recognized at <b><i>only</i></b> the beginning of a line, and
can be in either shell style ("<tt>#</tt>") or c++ style ("<tt>//</tt>").
<p> For instance, in <tt>"<b>cstrike/addons/metamod/plugins.ini</b>"</tt>
these are all valid lines:
<p><pre>
// linux dlls/mybot.so
# win32 dlls/mybot-old.dll Mybot old
win32 dlls/mybot.dll Mybot current
linux /tmp/stub_mm_i386.so
win32 /tmp/stub_mm_i386.dll
linux ../dlls/trace_mm_i386.so
win32 ../dlls/trace_mm_i386.dll
linux dlls/admin_MM_i386.so
win32 dlls/admin_MM_i386.dll
</pre>
<p> Note that order in the plugins.ini file <b><i>is</i></b> significant.
Plugins are loaded and accessed in the order specified, so ordering
<i>can</i> be important, depending on the plugin(s).
<p> The file is re-read at changelevel, as well as on demand (via
<tt>"<b>meta refresh</b>"</tt> console command; see below). When the file
is re-read, it will:
<ul>
<li> load any new plugins added to the file
<li> unload any plugins that have been deleted from the file. This is
only applicable to plugins loaded <b><i>from the inifile</i></b>. If the
plugin was loaded from the console, it will not be unloaded during a
refresh, whether it's in the inifile or not.
<li> reload any plugin whose file on disk has been updated since it was
loaded. Note this appears to be only useful under linux, as under Windows
you cannot rename or overwrite an open DLL, so it doesn't look a loaded
plugin could ever have a newer file on disk. Oh well.
</ul>
<p>The game dll is auto-detected, along the same lines AdminMod operated
(looking at the "gamedir"); see "mm_gamedll" below if you want to use a
"bot" DLL.
<p> You can override the name of this file by specifying it via the <a
href="#localinfo">+localinfo</a> field "<a
href="#mm_pluginsfile"><b>mm_pluginsfile</b></a>".
<p> For compatibility with previous versions, Metamod will also look for a
file "metamod.ini" under the gamedir, ie "<b>cstrike/metamod.ini</b>".
<p><br><a name=config.ini>
<h2>File: <tt>config.ini</tt>
</h2></a>
Default location: <b><i>$gamedir</i>/addons/metamod/config.ini</b>, ie
"cstrike/addons/metamod/config.ini".
<p>
This contains basic config information, at the moment duplicating most of
the <a href="#localinfo">+localinfo</a> variables, but allowing for more
flexible expansion of config options in the future. Also, it provides
somewhat more reliable options setting, since +localinfo munges some
argument values (in particular, pathnames with leading dots, ie
"../dlls/blah.dll").
<p>
Basic format is:
<dl>
<dd> <i>&lt;option&gt; &lt;value&gt;</i>
</dl>
<p> Fields are whitespace delimited (tabs/spaces). Comments are recognized
at <b><i>only</i></b> the beginning of a line, and can be in either shell
style ("<tt>#</tt>") or c++ style ("<tt>//</tt>").
The following is a list of currently recognized options, their defaults,
and examples of usage:
<ul>
<p><li> <tt><b>debuglevel</b> <i>&lt;number&gt;</i></tt>
<p> where &lt;number&gt; is an integer, 0 and up.
<br> Sets the initial debugging level for metamod (same as cvar
"meta_debug").
<br> Default is normally 0. If hlds is run with "-dev", default is 3.
<br> Overridden by: <a href="#localinfo">+localinfo</a> <a
href="#mm_debug">mm_debug</a> &lt;number&gt;
<br> Examples:
<br> <tt>debuglevel 0</tt>
<br> <tt>debuglevel 42</tt>
<p><li> <tt><b>gamedll</b> <i>&lt;path&gt;</i></tt>
<p> where &lt;path&gt; is an absolute path, or a path relative to
the gamedir.
<br> Overrides the auto-detected gamedll, in particular for bots.
<br> Default is empty, with gamedll being auto-recognized based on the
gamedir.
<br> Overridden by: <a href="#localinfo">+localinfo</a> <a
href="#mm_gamedll">mm_gamedll</a> &lt;number&gt;
<br> Examples:
<br> <tt>gamedll dlls/hl.dll</tt>
<br> <tt>gamedll ../podbot/podbot.dll</tt>
<br> <tt>gamedll /home/bots/dlls/mybot.dll</tt>
<p><li> <tt><b>plugins_file</b> <i>&lt;path&gt;</i></tt>
<p> where &lt;path&gt; is an absolute path, or a path relative to
the gamedir.
<br> Overrides the default filename containing the MM plugins to load.
<br> Default is "addons/metamod/<a href="#plugins.ini">plugins.ini</a>".
<br> Overridden by: <a href="#localinfo">+localinfo</a> <a
href="#mm_pluginsfile">mm_pluginsfile</a> &lt;number&gt;
<br> Examples:
<br> <tt>plugins_file cfg/clanmode.ini</tt>
<br> <tt>plugins_file ../private.ini</tt>
<br> <tt>plugins_file /home/half-life/testing.ini</tt>
<p><li> <tt><b>exec_cfg</b> <i>&lt;path&gt;</i></tt>
<p> where &lt;path&gt; is a path relative to the gamedir.
<b>NOTE!</b> This <i>cannot</i> be an absolute path, as hlds will
not "exec" absolute pathnames.
<br> Overrides the default filename containing hlds commands to run
just after loading Metamod.
<br> Default is "addons/metamod/<a href="#exec.cfg">exec.cfg</a>".
<br> Overridden by: <a href="#localinfo">+localinfo</a> <a
href="#mm_execcfg">mm_execcfg</a> &lt;number&gt;
<br> Examples:
<br> <tt>exec_cfg configs/debugging.cfg</tt>
<br> <tt>exec_cfg ../clan/match.cfg</tt>
<p><li> <tt><b>autodetect</b> <i>&lt;yes/no&gt;</i></tt>
<p> Setting to disable or enable autodetection of gamedll. Extra feature for Metamod+All-Mod-Support Patch.
<br> Default is "yes".
<br> Overridden by: <a href="#localinfo">+localinfo</a> <a
href="#mm_autodetect">mm_autodetect</a> &lt;yes/no&gt;
<p><li> <tt><b>clientmeta</b> <i>&lt;yes/no&gt;</i></tt>
<p> Setting to disable or enable Metamod's client commands, 'meta list' and 'meta version'. Extra setting for Metamod+All-Mod-Support Patch.
<br> Default is "yes".
<br> Overridden by: <a href="#localinfo">+localinfo</a> <a
href="#mm_clientmeta">mm_clientmeta</a> &lt;yes/no&gt;
</ul>
<p> You can override the name of this file by specifying it via the <a
href="#localinfo">+localinfo</a> field "<a
href="#mm_configfile"><b>mm_configfile</b></a>".
<p><br>
<a name=metaexec.cfg></a><a name=exec.cfg>
<h2>File: <tt>exec.cfg</tt>
</h2></a>
Default location: <b><i>$gamedir</i>/addons/metamod/exec.cfg</b>, ie
"cstrike/addons/metamod/exec.cfg".
<p.This is an optional file containing server commands or cvar settings, and
which is read by the server just after loading the initial plugins (from
plugins.ini).
<p>This is necessary for plugins that need to have settings specified prior
to early API routines like ServerActivate, since <tt>autoexec.cfg</tt> is
read too early and <tt>server.cfg</tt> is read to late. In particular, I
found this necessary for the Trace plugin, in order to trace routines like
<tt>RegUserMsg</tt> which are called during ServerActivate.
<p> You can override the name of this file by specifying it via the <a
href="#localinfo">+localinfo</a> field "<a
href="#mm_execcfg"><b>mm_execcfg</b></a>".
<p> For compatibility with previous versions, Metamod will also look for a
file "metaexec.cfg" under the gamedir, ie "<b>cstrike/metaexec.cfg</b>".
<p><br>
<a name=metagame.ini>
<h2><strike>file: <tt>metagame.ini</tt></strike>
</h2></a>
<b>NOTE! This file is no longer supported!</b> -- use instead the
<a href="#localinfo">+localinfo</a> field
"<a href="#mm_gamedll"><b>mm_gamedll</b></a>" or the <a
href="#config.ini">config.ini</a> option <b>gamedll</b>.
<p><br>
<a name=localinfo>
<h2>Commandline option: <tt>+localinfo</tt>
</h2></a>
Several of Metamod's configuration options can be specified by the
"+localinfo" facility on the hlds command line. This is similar to the
"setinfo" console command, where the syntax is:
<dl>
<dd><tt>+localinfo &lt;<i>field</i>&gt; &lt;<i>value</i>&gt;</tt>
</dl>
Current localinfo fields recognized by Metamod:
<ul>
<p><a name=mm_configfile><li><b>mm_configfile</b></a> Specifies the
file that lists config options, instead of using the file <a
href="#config.ini">config.ini</a>. The <tt>&lt;<i>value</i>&gt;</tt>
should be the pathname of the config file, either absolute path or
path relative to the gamedir.
<p><a name=mm_pluginsfile><li><b>mm_pluginsfile</b></a> Specifies a
file that lists the Metamod plugins to load, instead of using the file <a
href="#plugins.ini">plugins.ini</a>. The <tt>&lt;<i>value</i>&gt;</tt>
should be the pathname of the plugins file, either absolute path or
path relative to the gamedir.
<p><a name=mm_execcfg><li><b>mm_execcfg</b></a> Specifies a file
that contains cvar or other configs to be exec'd after loading the
plugins, instead of using the file <a href="#exec.cfg">exec.cfg</a>.
The <tt>&lt;<i>value</i>&gt;</tt> should be the pathname of the exec
file, either absolute path or path relative to the gamedir.
<p><a name=mm_autodetect><li><b>mm_autodetect</b></a> Specifies if 'autodetect of gamedll' should be enabled
or disabled. It's enabled by default. This is extra feature of
Metamod+All-Mod-Support Patch.
<p><a name=mm_clientmeta><li><b>mm_clientmeta</b></a> Specifies if Metamod's client commands should be enabled
or disabled. It's enabled by default. This is extra setting of
Metamod+All-Mod-Support Patch.
<p><a name=mm_gamedll><li><b>mm_gamedll</b></a> Specifies a game or Bot
DLL to be used instead of the normal gameDLL. The
<tt>&lt;<i>value</i>&gt;</tt> should be the pathname of the DLL,
either absolute path or path relative to the gamedir.
<p>This replaces using the <a href="#metagame.ini">metagame.ini</a>
file. With previous versions of AdminMod (2.10 and earlier), this same
functionality was provided by the file "admin.ini".
<p><a name=mm_debug><li><b>mm_debug</b></a> Specifies an initial
meta_debug value.
</ul>
<p>Note that each localinfo field can have only <b>one value</b>. If
specified more than once on the command line, only the <b>last</b> one will
be recognized. (In particular, trying to use mm_gamedll to load multiple
dll-style bots will <b>not</b> work. In a case like that, the multiple
dll's must be chained together).
<p>Some examples are:
<p><pre>
./hlds_run -game cstrike +localinfo mm_pluginsfile mylist.ini
./hlds_run -game cstrike +localinfo mm_execcfg mysettings.cfg
./hlds_run -game cstrike +localinfo mm_gamedll dlls/pod_bot.so
./hlds_run -game cstrike +localinfo mm_debug 7
</pre>
<p>Note, paths should use unix-style <b>forward</b> slashes (<b>/</b>) and
not <b>backward</b> slashes (<b>\</b>), even on windows platforms.
<p><br>
<a name=commands>
<h2>Commands
</h2></a>
<p>All console command functionality is provide by a single command "meta",
with multiple sub-commands:
<p><pre>
usage: meta &lt;command&gt; [&lt;arguments&gt;]
valid commands are:
version - display Metamod version info
list - list plugins currently loaded
cmds - list console cmds registered by plugins
cvars - list cvars registered by plugins
refresh - load/unload any new/deleted/updated plugins
config - show config info loaded from config.ini
load &lt;name&gt; - find and load a plugin with the given name
unload &lt;plugin&gt; - unload a loaded plugin
reload &lt;plugin&gt; - unload a plugin and load it again
info &lt;plugin&gt; - show all information about a plugin
pause &lt;plugin&gt; - pause a loaded, running plugin
unpause &lt;plugin&gt; - unpause a previously paused plugin
retry &lt;plugin&gt; - retry a plugin that previously failed its action
clear &lt;plugin&gt; - clear a failed plugin from the list
force_unload &lt;plugin&gt; - forcibly unload a loaded plugin
require &lt;plugin&gt; - exit server if plugin not loaded/running
</pre><p>
where <tt>&lt;plugin&gt;</tt> can be either the plugin index number, or a non-ambiguous prefix
string matching description or file.
<p>Also, a single cvar is available:
<pre>
meta_debug - set debugging level
</pre>
<p>For instance with:
<p><pre>
Currently loaded plugins:
description stat pend file vers src load unlod
[ 1] Trace HLSDK API RUN - mm_trace_i386.so v0.90 ini ANY Pause
[ 2] adminmod RUN - admin_MM.so v2.11 ini Start Start
[ 3] stub RUN - mm_stub_i386.so v0.90 ini ANY Pause
2 plugins, 2 running
</pre><p>
<p>You could then do any of the following to unload the API Trace plugin:
<pre>
meta unload 1
meta unload trace
meta unload mm_trace
</pre>
<br>
<a name=plugin-loading>
<h2>Plugin Loading/Unloading Process
</h2></a>
Through the process of loading and unloading, a plugin can be in one of
several different states ('stat' column in the 'meta list' output):
<ul>
<li><b><tt>BADFILE</tt></b> - The plugin file couldn't be found, or it
doesn't appear to be a valid Metamod plugin.
<li><b><tt>OPENED</tt></b> - The plugin file was found, and is a valid
Metamod plugin, and is ready to be loaded.
<li><b><tt>FAILED</tt></b> - The plugin file attempted to load or unload,
but couldn't complete for some reason.
<li><b><tt>RUNNING</tt></b> - The plugin file was loaded and is active
and running.
<li><b><tt>PAUSED</tt></b> - The plugin file was loaded, but has been
temporarily disabled.
</ul>
Also through the operation process, a plugin can have a pending "action" to
next take (indicated by the 'pend' column in the 'meta list' output), and
can be one of:
<ul>
<li><b><tt>LOAD</tt></b> - Open and look at the plugin file.
<li><b><tt>ATTACH</tt></b> - Attach the plugin to the running game; ie
activate it
<li><b><tt>UNLOAD</tt></b> - Remove the plugin from the running game and
close the file
<li><b><tt>RELOAD</tt></b> - Unload/close and re-open/load the plugin,
for instance when the plugin file has changed.
</ul>
<br>
<a name=example-output>
<h2>Example Output
</h2></a>
<p>Here's some other example output:
<p><pre>
meta info admin
name: adminmod
desc: Adminmod
status: running
action: none
filename: dlls/admin_MM.so
file: admin_MM.so
pathname: /home/willday/test/cstrike/dlls/admin_MM.so
index: 3
source: ini file
loadable: at server startup
unloadable: at server startup
version: 2.11
date: 2001/02/04
author: Alfred Reynolds &lt;alfred@mazuma.net.au&gt;
url: http://www.adminmod.org/
logtag: ADMIN
last loaded: Mon Feb 5 02:06:34 2001
DLLAPI functions:
GameDLLInit
DispatchThink
ClientConnect
ClientCommand
ClientUserInfoChanged
ServerActivate
6 functions (dllapi)
No DLLAPI-Post functions.
No NEWAPI functions.
No NEWAPI-Post functions.
No Engine functions.
No Engine-Post functions.
Registered commands:
admin_command
1 commands
Registered cvars: float value string value
users_file 0.000000 users.ini
maps_file 0.000000 mapvote.txt
default_access 1.000000 1
ips_file 0.000000 0
reserve_slots 1.000000 1
reserve_slots_msg 0.000000 0
admin_debug 1.000000 1
password_field 0.000000 admin_password
alarm_message 0.000000 0
alarm_time 0.000000 0
use_regex 1.000000 1
models_password_field 0.000000 0
models_file 0.000000 models.ini
models_kick_msg 0.000000 Invalid model
script_file 0.000000 cstrike/dlls/admin.amx
help_file 0.000000 admin_help.txt
vote_freq 360.000000 360
encrypt_password 1.000000 1
pretty_say 1.000000 1
admin_mod_version 2.110000 2.11
reserve_type 1.000000 1
map_ratio 60.000000 60
kick_ratio 75.000000 75
words_file 0.000000 0
password_timeout 1800.000000 1800
file_access_read 0.000000 0
file_access_write 0.000000 0
public_slots_free 20.000000 20.000000
allow_client_exec 0.000000 0
admin_balance_teams 0.000000 0
30 cvars
meta cmds
Registered plugin commands:
plugin command
[ 1] API trace trace_version
[ 2] API trace trace
[ 3] API trace untrace
[ 4] API trace showtrace
[ 5] Adminmod admin_command
5 commands, 5 available
meta cvars
Registered plugin cvars:
plugin cvar float value string value
[ 1] API trace trace_debug 3.000000 3.000000
[ 2] API trace trace_dllapi 8.000000 8
[ 3] API trace trace_newapi 0.000000 0
[ 4] API trace trace_engine 8.000000 8
[ 5] Adminmod users_file 0.000000 users.ini
[ 6] Adminmod maps_file 0.000000 mapvote.txt
[ 7] Adminmod default_access 1.000000 1
[ 8] Adminmod ips_file 0.000000 0
[ 9] Adminmod reserve_slots 1.000000 1
[ 10] Adminmod reserve_slots_msg 0.000000 0
[ 11] Adminmod admin_debug 1.000000 1
[ 12] Adminmod password_field 0.000000 admin_password
[ 13] Adminmod alarm_message 0.000000 0
[ 14] Adminmod alarm_time 0.000000 0
[ 15] Adminmod use_regex 1.000000 1
[ 16] Adminmod models_password_fiel 0.000000 0
[ 17] Adminmod models_file 0.000000 models.ini
[ 18] Adminmod models_kick_msg 0.000000 Invalid model
[ 19] Adminmod script_file 0.000000 cstrike/dlls/admin.amx
[ 20] Adminmod help_file 0.000000 admin_help.txt
[ 21] Adminmod vote_freq 360.000000 360
[ 22] Adminmod encrypt_password 1.000000 1
[ 23] Adminmod pretty_say 1.000000 1
[ 24] Adminmod admin_mod_version 2.110000 2.11
[ 25] Adminmod reserve_type 1.000000 1
[ 26] Adminmod map_ratio 60.000000 60
[ 27] Adminmod kick_ratio 75.000000 75
[ 28] Adminmod words_file 0.000000 0
[ 29] Adminmod password_timeout 1800.000000 1800
[ 30] Adminmod file_access_read 0.000000 0
[ 31] Adminmod file_access_write 0.000000 0
[ 32] Adminmod public_slots_free 20.000000 20.000000
[ 33] Adminmod allow_client_exec 0.000000 0
[ 34] Adminmod admin_balance_teams 0.000000 0
34 cvars, 34 available
meta unload stub
Unloaded plugin 'Stub plugin'
Currently loaded plugins:
description stat pend file vers src load unlod
[ 1] Trace HLSDK API RUN - mm_trace_i386.so v0.90 ini ANY Pause
[ 2] adminmod RUN - admin_MM.so v2.11 ini Start Start
2 plugins, 2 running
meta load stub
Loaded plugin 'stub' successfully
Currently loaded plugins:
description stat pend file vers src load unlod
[ 1] Trace HLSDK API RUN - mm_trace_i386.so v0.90 ini ANY Pause
[ 2] adminmod RUN - admin_MM.so v2.11 ini Start Start
[ 3] stub RUN - mm_stub_i386.so v0.90 cmd ANY Pause
3 plugins, 3 running
</pre>
<p>
<hr>
</body>
</HTML>

View File

@ -0,0 +1,62 @@
<!-- vi: set ts=4 sw=4 : -->
<!-- vim: set tw=75 : -->
<HTML>
<head>
<title>HLSDK NEWAPI Notes</title>
</head>
<body>
<h1>HLSDK NEWAPI Notes
</h1>
<hr>
<ul>
<li><a href=#OnFreeEntPrivateData>OnFreeEntPrivateData</a>
<li><a href=#GameShutdown>GameShutdown</a>
<li><a href=#ShouldCollide>ShouldCollide</a>
</ul>
<b>NOTE</b>: No examples of these found in SDK...
<p>
<hr><h3><tt><a name="OnFreeEntPrivateData">OnFreeEntPrivateData</a></tt></h3>
<dd><tt>void OnFreeEntPrivateData(edict_t pEnt);</tt><p>
<i>from engine/eiface.h:</i><br>
<blockquote><tt>
Called right before the object's memory is freed. Calls its destructor.
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
See also <a
href="http://list.valvesoftware.com/pipermail/hlcoders/2002-January/001397.html"
>Ken Birdwell on constructors</a>, from the HLCoders list.
<br>Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="GameShutdown">GameShutdown</a></tt></h3>
<dd><tt>void GameShutdown(void);</tt><p>
<p><i>comments:</i><br>
<blockquote>
Added in SDK 2.0.
</blockquote>
<hr><h3><tt><a name="ShouldCollide">ShouldCollide</a></tt></h3>
<dd><tt>int ShouldCollide(edict_t *pentTouched, edict_t *pentOther);</tt><p>
<i>from kenb@valvesoftware.com, via HLCoders:</i><br>
<blockquote><tt>
..a hook that can override if any two entities should collide
when they try to pass through each other.
</tt></blockquote>
<p><i>comments:</i><br>
<blockquote>
Mugsy from DoD indicates that the return value for normal operation is 1.
<br>Added in SDK 2.0.
</blockquote>
<p>
<hr>
</body>
</HTML>

127
doc/html/release_notes.html Normal file
View File

@ -0,0 +1,127 @@
<!-- vi: set ts=4 sw=4 : -->
<!-- vim: set tw=75 : -->
<HTML>
<head>
<title>Metamod Release Notes</title>
</head>
<body>
<h1>Release Notes
</h1>
<a name=major.1.17>
<h2>Major changes with Metamod 1.17
</h2></a>
<ul>
<p><li> New cvar "<b><tt>metamod_version</tt></b>" that can be queried from
client game browsers.
<p><li> New console commands available to clients (much like the existing
server console commands):
<p><ul>
<li> <b><tt>"meta version"</tt></b> prints out version information
(date, compile type, etc).
<li> <b><tt>"meta list"</tt></b> shows a list of the plugins running on
the server (name, author, version, etc).
</ul>
<p><li> New file <a
href="metamod.html#config.ini"><tt><b>config.ini</b></tt></a> to provide a
more reliable and flexible method of specifying configuration options.
At the moment, the recognized options mirror those from <a
href="metamod.html#localinfo">+localinfo</a>, ie:
<p>
<ul>
<li> <tt><b>debuglevel</b> <i>&lt;number&gt;</i></tt>
<li> <tt><b>gamedll</b> <i>&lt;path&gt;</i></tt>
<li> <tt><b>plugins_file</b> <i>&lt;path&gt;</i></tt>
<li> <tt><b>exec_cfg</b> <i>&lt;path&gt;</i></tt>
<li> <tt><b>autodetect</b> <i>&lt;yes/no&gt;</i></tt>
<li> <tt><b>clientmeta</b> <i>&lt;yes/no&gt;</i></tt>
</ul>
<p>Default path is "<tt>addons/metamod/config.ini</tt>" but can be
overridden with "<tt>+localinfo mm_configfile</tt>".
<p>Also, new console command <tt><b>"meta config"</b></tt> to display this
information.
<p><li> New console command <tt><b>"meta require"</b></tt> to force the
server to exit if the specified plugin isn't loaded/running. Intended for
use in server.cfg or metaexec.cfg, to keep the server from starting up if
desired plugins don't load. For example:
<p>
<ul>
<li> <tt>meta require adminmod</tt>
<li> <tt>meta require 1</tt>
</ul>
<p>The former requires that a plugin with the substring "adminmod" is found
loaded and running. The latter requires that the plugin in slot 1 is
loaded and running.
<p><li> If an override gamedll is specified and found to be invalid or
missing, Metamod will now exit with an appropriate error message, rather
than just falling back to the auto-detected gamedll. This should provide
more immediate and useful feedback, and help prevent some confusion.
</ul>
<p>
<hr>
<a name=compat.1.13>
<h2>Incompatible changes with Metamod 1.13
</h2></a>
<ul>
<li> Config file <tt><b>metagame.ini</b></tt> is no longer supported. This
file was deprecated in Metamod 1.08 (2001/06/16). Use instead the "<a
href="metamod.html#localinfo">+localinfo mm_gamedll</a>" option.
</ul>
<a name=major.1.13>
<h2>Major changes with Metamod 1.13
</h2></a>
<ul>
<li> New config file names and locations, per the <a
href="http://www.unitedadmins.com/info_addon_dev_standards.aspx">Addon
Development Standard</a> rev 1.00, developed on the <a
href="http://list.valvesoftware.com/mailman/listinfo/hlds_apps">hlds_apps</a>
list.
<p> Default config file locations are now:
<ul>
<li> $gamedir/addons/metamod/plugins.ini
<li> $gamedir/addons/metamod/exec.cfg
</ul>
<p> Previous config file locations are also supported for backwards
compability:
<ul>
<li> $gamedir/metamod.ini
<li> $gamedir/metaexec.cfg
</ul>
<p> Note that the pathnames in plugins.ini are unchanged, and are still
relative to the gamedir.
</ul>
<p>
<hr>
</body>
</HTML>

View File

@ -0,0 +1,35 @@
<!-- vi: set ts=4 sw=4 : -->
<!-- vim: set tw=75 : -->
<HTML>
<head>
<title>Metamod Supported Mods/Games</title>
</head>
<body>
<a name=supported>
<h1>Supported Mods/Games
</h1>
</a>
Metamod includes support for the following mods, with version and last
update if known.
<p>
To get support added for a new Mod, or for an updated version of a Mod, see
<a href="gamesupport.html">Adding game support</a>.
<p>
<table border=5 rules=all cellpadding=5>
<tr> <th>Name</th> <th>Version</th> <th>Last update</th> <th>Ent list</th> <th>Comments</th></tr>
<tr><td>ALL MODS SUPPORTED BY <br>
&nbsp;&nbsp;&nbsp;&nbsp;All-Mod-Support PATCH<br>
&nbsp;&nbsp;&nbsp;&nbsp;By Jussi Kivilinna<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://koti.mbnet.fi/axh/">http://koti.mbnet.fi/axh/</a>
</td><td></td><td></td><td>NONE</td></tr>
</table>
</body>
</HTML>

88
doc/html/trace.html Normal file
View File

@ -0,0 +1,88 @@
<!-- vi: set ts=4 sw=4 : -->
<!-- vim: set tw=75 : -->
<HTML>
<head>
<title>Metamod TraceAPI Plugin</title>
</head>
<body>
<h1>TraceAPI plugin
</h1>
<p> This was originally intended as a (more or less) complete example of a
Metamod plugin. It catches <b><i>every</i></b> call available to it (dll
routines both before and after the game, as well as engine functions both
before and after the engine).
<p> Because it catches every routine, I figured I'd give it the ability to
log when given routines are called, so it became an "api tracing" plugin.
:)
<p> This can actually be useful for tracking the operation of the HL
engine, as well as that of a particular HL game mod.
<p> It recognizes the following server cvars:
<p><pre>
// Tracing debug levels; higher values log increasingly frequent routines.
// Currently 0-50. See "api_info.cpp" for the debug levels of various
// functions.
// Trace level for dllapi routines.
trace_dllapi
// Trace level for "new" dllapi routines.
trace_newapi
// Trace level for engine functions.
trace_engine
// Enable unlimited trace logging. By default (as of v1.06), it only
// logs _one_ trace message per second, to keep from overwhelming the
// server. Set to "1" to enable unlimited logging. (Default "0")
trace_unlimit
// General debug level, independent of trace levels. Not currently used.
trace_debug
</pre>
<p> and the following server commands:
<p><pre>
// Enable tracing of a given routine, independent of "trace_*" level.
// See the list of routine names in "api_info.cpp". Case is insignificant.
trace set &lt;APIroutine&gt;
// Disable tracing of a given routine, iff previously enabled with "trace".
// Doesn't affect routines being logged via "trace_*" level.
trace unset &lt;APIroutine&gt;
// Show the routines being traced.
trace show
// List the various routines that can be traced.
trace list dllapi
trace list newapi
trace list engine
trace list all
// Prints out version/date/etc.
trace version
</pre>
<p> Note the information it logs on each routine invocation is, at the
moment, relatively minimal. I included information that seemed obvious
(args for a <tt>ClientCommand</tt>, etc), and I've added info for other
routines as I've come across a need. Most routines I still know too little
about to log any particular information (<tt>CreateBaseline</tt>, etc).
Feel free to add information that you're interested in to the log messages
in the routines; the examples should be pretty self-explanatory. I'd be
interested in knowing as well, for adding it to the distribution code.
<p>
<hr>
</body>
</HTML>

48
doc/html/wdmisc.html Normal file
View File

@ -0,0 +1,48 @@
<!-- vi: set ts=4 sw=4 : -->
<!-- vim: set tw=75 : -->
<HTML>
<head>
<title>Metamod WDMisc Plugin</title>
</head>
<body>
<h1>WDMisc plugin
</h1>
<p> This is a simple plugin that I use as a testbed for various features
and other things I need to try from a plugin.
<p> It currently provides two features:
<ul>
<p><li> a cvar "bounce" that, if set to 1, will exit the server at map
change. I use this when I need to shutdown or the server, and don't
want to kill it in the middle of a map, nor watch the server constantly
until the timelimit expires.
<p><li> it prints a centersay to all the players whenever someone in
Counter-Strike plants the bomb. This was done basically as a
proof-of-concept for catching certain game-events that aren't otherwise
triggered by the HL API. It works only by examining every log message
that the server generates, and checking to see if it includes the string
indicating the particular event in question (in this case
"Planted_The_Bomb").
<p>Although this works, it is really a rather <i><b>poor</b></i>
solution to the problem, as it assumes a <i><b>lot</b></i> of
string-compares, which <i>can</i> seriously degrade the performance of
the server. I did try to take as many short-cuts as reasonable in the
code, to decrease the amount of string-comparing going on, which makes
the code a bit less readable than doing just a "strstr" on the log line.
</ul>
Other features to be added/removed in the future...
<p>
<hr>
</body>
</HTML>

35
doc/plugins.ini Normal file
View File

@ -0,0 +1,35 @@
// vim: set ft=c :
//
// Format is as follows:
// <platform> <path> <description>
//
// Fields are whitespace delimited (tabs/spaces).
//
// - Platform must be either "linux" or "win32".
// - Path can be either an absolute pathname, or a pathname relative to the
// gamedir. Paths should use unix-style forward slashes (/) rather than
// windows-style backslashes (\), even on windows platforms. Also, the
// path (once expanded to full path name) is expected to be unique within
// the list of plugins. Thus, a plugin with a fullpathname matching that
// of a previous plugin is considered a duplicate, and is not loaded.
// - Description is optional, and replaces the plugin's internal name in
// console output and log messages.
//
// Comments are either c++ style ("//") or unix shell style ("#"), and
// can appear ONLY at the beginning of a line.
//
// Note that the plugins are loaded and accessed in the order specified, so
// ordering CAN be important, depending on the plugin(s).
//
// The following are examples of valid lines.
//
// linux dlls/mybot.so
# win32 dlls/mybot-old.dll Mybot old
win32 dlls/mybot.dll Mybot current
linux /tmp/stub_mm_i386.so
win32 /tmp/stub_mm_i386.dll
linux ../dlls/trace_mm_i386.so
win32 ../dlls/trace_mm_i386.dll
linux dlls/admin_MM_i386.so
win32 dlls/admin_MM_i386.dll

27
doc/txt/Index.txt Normal file
View File

@ -0,0 +1,27 @@
Metamod
=-=-=-=
Metamod is a plugin/DLL manager that sits between the Half-Life Engine and
an HL Game mod, allowing the dynamic loading/unloading of mod-like DLL
plugins to add functionality to the HL server or game mod.
--------------------------------------------------------------------------
See metamod.org (metamod.org/) for news, downloads, and plugin links.
--------------------------------------------------------------------------
Metamod Docs Other HLDS info
- About metamod * SDK DLLAPI Notes
- FAQ * SDK NEWAPI Notes
- Using metamod * SDK Engine Notes
- Release Notes
- Game/Mod support * Related links & books
- Trace Plugin * Mailing lists
- WDMisc Plugin
- Coding for metamod
--------------------------------------------------------------------------
<willday@metamod.org>

19
doc/txt/a.txt Normal file
View File

@ -0,0 +1,19 @@
Supported Games
=-=-=-=-=-=-=-=
Metamod includes support for the following mods, with version and last
update if known.
To get support added for a new Mod, or for an updated version of a Mod,
see Adding game support.
+-------------------------------------------------------------------------+
| Name | Version | Last | Ent | Comments |
| | | update | list | |
|---------------------------------+----------+--------+--------+----------|
| ALL MODS SUPPORTED BY | ALL | | NONE | |
| All-Mod-Support PATCH | | | | |
| By Jussi Kivilinna | | | | |
| http://koti.mbnet.fi/axh/ | | | | |
+---------------------------------+----------+--------+--------+----------+

35
doc/txt/about.txt Normal file
View File

@ -0,0 +1,35 @@
Metamod
=-=-=-=
a Half-Life utility mod
meta /me't*/ or /may't*/ or (Commonwealth) /mee't*/ adj.,pref.
[from analytic philosophy] One level of description up.
The purpose of MetaMod is to function "one level up" from the normal
Half-Life game mod DLL. Sitting between the mod game DLL and the Half-Life
engine/binary, it intercepts the function calls between the two, with the
option of passing them along untouched, as well as passing them on to as
any number of _additional mod-like DLLs_.
Thus, you can actually have multiple "mod-like" DLLs in operation at one
time. I say "mod-like" because these additional DLLs (we'll call them
"plugins") are not intended to provide a full "game"; that functionality
is still provided by the "game dll". However, these plugins can _add to_
or _modify the functionality provided by the game dll, or by the engine
itself - for instance, adding new server commands, or new client commands,
or even disabling commands built into the game dll. Although the plugin
isn't intended to provide full HL-game functionality, since it's receiving
the same information given to the game DLL, it has the opportunity to do
_anything_ the game DLL can do (given enough coding effort of course).
This is very similar to the way Alfred Reynolds' AdminMod
(www.adminmod.org) works, as it also sits between the engine and game dll,
catching routines, and passing them on. thus modifying functionality.
However, rather than providing just the additional server features builtin
to AdminMod DLL, MetaMod allows you to add features from multiple,
separate DLLs. Under that framework, AdminMod can be a plugin itself, and
be run alongside numerous other plugins. And, as of version 2.50 of
AdminMod, AM has now transitioned to running as a Metamod plugin.
--------------------------------------------------------------------------

340
doc/txt/coding.txt Normal file
View File

@ -0,0 +1,340 @@
Coding for Metamod
=-=-=-=-=-=-=-=-=-=
Compiling
=========
You'll need the Half-Life SDK, of course. In particular you'll need HL SDK
version 2.3. You can find the original SDK 2.3 at the Valve Editing
Resource Center (VERC) (www.valve-erc.com/), and a modified version of SDK
2.3 at metmod.org/files/sdk (metamod.org/files/sdk/).
Operation
=========
The basic operation is, for each api call:
- iterate through list of plugins
- for each plugin, if it provides this api call, then call the function
in the plugin
- call the "real" function (in the game dll, or from the engine)
- for each plugin, check for a "post" version of the function, and call
if present
Also, for any api call, each plugin has the opportunity to replace the
real routine, in two ways:
- prevent the real routine from being called (SUPERCEDE).
- allow the real routine to be called, but change the value that's
returned (OVERRIDE)
Thus after each plugin is called, its META_RESULT flag is checked, and
action taken appropriately. Note that supercede/override only affects the
_real_ routine; other plugins will still be called. In addition to the
SUPERCEDE and OVERRIDE flags, there are two additional flags a plugin can
return:
- HANDLED ("I did something here")
- IGNORED ("I didn't really do anything")
These aren't used by Metamod itself, but could be used by plugins to get
an idea if a previous plugin did anything.
Note that each routine _needs_ to set its META_RESULT value before
returning. Plugin routines that do not set a value will be reported as
errors in the logs.
Plugin coding requirements
==========================
Plugins MUST provide the following standard HLSDK exported function:
void GiveFnptrsToDll(enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals);
AS WELL AS the following new functions:
void Meta_Init(void); (optional)
int Meta_Query(char *interfaceVersion, plugin_info_t **pinfo, mutil_funcs_t *pMetaUtilFuncs);
int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs);
int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
Also, it must provide AT LEAST one function returning a standard HL
function table, from either the following standard HLSDK functions:
int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion );
int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
int GetNewDLLFunctions( NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion );
or from the following new functions:
int GetEntityAPI_Post(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion);
int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion ;
int GetNewDLLFunctions_Post(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion);
int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion);
int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion);
Thus, it needs to have (at least):
GiveFnptrsToDll
Meta_Query
Meta_Attach
Meta_Detach
<one or more Get function>
See the "stub_plugin" for an example of _bare minimum_ code. See "
trace_plugin" for an example of more complete functionality.
Also, if the plugin needs to use LINK_ENTITY_TO_CLASS, support for the
particular entity(ies) has to be added explicitly to Metamod
(linkfunc.cpp), just as it does for entities in game DLLs.
Operation Details
=================
These are the valid META_RESULT values a plugin routine can specify:
- MRES_IGNORED
The plugin did nothing. This could be used to tell a subsequent plugin
that the some situation hasn't been handled yet. This would be
recognized only by other plugins; Metamod itself doesn't do anything
special for this situation. Unless otherwise specified by a later
plugin, execution of routine in the gameDLL will take place. This is
valid in both normal and post routines.
- MRES_HANDLED
The plugin handled the situation, or did something with the
information. Again, this could be used to tell a subsequent plugin
that some situation has already been taken care of, and is not
recognized specially by Metamod. Unless otherwise specified by a later
plugin, execution of routine in the gameDLL will take place. This is
valid in both normal and post routines.
- MRES_OVERRIDE
The plugin is providing a return value for the routine, which should
be used in place of the return value from the gameDLL's routine (the
plugin "overrides" the gameDLL's return value). Unless otherwise
specified by a later plugin, the gameDLL routine will still be called.
Note this only makes sense for non-void routines. This is valid in
both normal and post routines.
- MRES_SUPERCEDE
The plugin has performed sufficient actions for the routine, and the
gameDLL's routine should NOT be called (the plugin "supercedes" the
gameDLL's routine, more or less replacing it entirely). Any return
value for the routine should be specified as well by the plugin. Note
this is only valid for normal routines, as post routines cannot
prevent calling the gameDLL's routine (as it has already happened!).
Also note, this doesn't prevent subsequent plugins from being called
for this routine; it supercedes _only_ the gameDLL.
As the plugins are called, a running status is kept of the "highest" meta
status so far, in the order (lowest to highets) shown above. After calling
all the "normal" routines, the status is checked to see if the gameDLL's
routine should be called - ie, it will not be called if one (or more) of
the plugin's has specified META_SUPERCEDE. The gameDLL's routine is then
called, or skipped, as appropriate. Then, all the "post" routines are
called in the same manner (except META_SUPERCEDE is no longer a valid meta
result).
Last, if any plugins specified META_OVERRIDE or META_SUPERCEDE, the return
value given by the _last_ such plugin is returned as the routine's return
code to the engine (assuming a non-void routine). Thus, the order of the
plugins as specified in the metamod.ini _does_ have a possible effect.
Available Macros
================
The meta_api.h header that describes the Metamod API functions, types, and
structures also includes several macros that can be of help when coding a
plugin.
- SET_META_RESULT(result)
Sets the META_RESULT for the plugin.
- RETURN_META(result)
Sets the META_RESULT for the plugin, and then calls return. This
assumes a void function.
- RETURN_META_VALUE(result, value)
Sets the META_RESULT for the plugin, and then returns the given value.
This assumes a non-void function, and it doesn't matter the particular
type of the return value.
- META_RESULT_STATUS
Gives the current status of META_RESULT for this routine from plugins
so far. It will return the "highest" result so far, in the order of
lesser to greater: IGNORED, HANDLED, OVERRIDE, SUPERCEDE (see also
above Operation Details)
- META_RESULT_PREVIOUS
Gives the META_RESULT of the previous plugin.
- META_RESULT_ORIG_RET(type)
Gives the "original" return value for the routine, ie the return value
of the routine from gameDLL. The type for the routine's return value
must be specified in the macro; this is used as a cast for assignment.
Note this is only valid in a "post" routine.
- META_RESULT_OVERRIDE_RET(type)
Gives the return value from any previous plugin that specified
META_OVERRIDE or META_SUPERCEDE. The type for the routine's return
value must be specified in the macro; this is used as a cast for
assignment. This should only be used after checking the META_RESULT to
see if there's actually an override value available.
- MDLL_*(args)
Calls a given DLLAPI routine in the gameDLL. For instance,
MDLL_GameDLLInit(args), MDLL_Spawn(args), etc.
- MNEW_*(args)
Calls a given NEWAPI routine in the gameDLL. For instance,
MNEW_GameShutdown(args), etc.
Utility Callback Functions
==========================
In version 1.05, Metamod began providing a set of utility functions to
plugins to centralize functionality, reduce code reuse, and to provide
some convenience in plugin coding. Presently, only a few functions are
provided. More are added as I find the time, and identify some advantage
to having them (either for my own plugins, or by others' request for their
plugins).
Note the PLID keyword passed to each function. This is basically a "plugin
id" to indicate to Metamod which plugin is calling the function (else it's
difficult to tell), and is a macro that should be specified verbatim with
each call. (Currently, the macro is merely the plugin_info struct pointer
returned by the plugin via Meta_Query; in the future this could change to
some other identifier.)
- void LOG_CONSOLE(PLID, char *fmt, ...)
Print a message line on the console. Message is specified as a printf
style format string and arguments. A trailing newline is provided by
the routine and should not be specified in the string (unless you want
two newlines).
- void LOG_MESSAGE(PLID, char *fmt, ...)
Print a message line in the server logs. Message is specified as a
printf style format string and arguments. A trailing newline is
provided by the routine and should not be specified in the string. Log
message is prefixed by the logtag string in the plugin's "info"
struct, surrounded by brackets. For instance:
L 04/17/2001 - 18:00:35: [TraceAPI] Tracing Engine routine
'RegUserMsg'
- void LOG_ERROR(PLID, char *fmt, ...)
As in LOG_MESSAGE above, only marked as well with the string "ERROR:".
For example:
L 04/17/2001 - 18:03:13: [TraceAPI] ERROR: malloc failed
- void LOG_DEVELOPER(PLID, char *fmt, ...)
As in LOG_MESSAGE above, only message will be logged only if cvar
developer is set to 1; message is marked as well with the string "dev:
". For example:
L 04/17/2001 - 18:03:13: [TraceAPI] dev: called: GiveFnptrsToDll
- void CENTER_SAY(PLID, char *fmt, ...)
Prints a message on the center of all players' screens. This is like
the "centersay" of AdminMod, with pretty_say enabled, with the same
defaults (green, and a 10 second fade-in). A message is logged as
well, ie: [added in 1.06]
L 04/17/2001 - 15:44:52: [WDMISC] (centersay) random set up us the
bomb!
- void CENTER_SAY_PARMS(PLID, hudtextparms_t tparms, char *fmt, ...)
As in CENTER_SAY above, but allows specifying all the parameters. (see
SDK dlls/util.h for the struct hudtextparms_t). [added in 1.06]
- void CENTER_SAY_VARARGS(PLID, hudtextparms_t tparms, char *fmt,
va_list ap)
As in CENTER_SAY_PARMS above, only the message is passed as a
vsnprintf style varargs format string and args list. This is included
merely because both the previous CENTER_SAY functions actually call
this, and it was convenient to include it as well. [added in 1.06]
- qboolean CALL_GAME_ENTITY(PLID, char *entStr, entvars_t *pev)
Calls an entity function in the gameDLL. For instance, a bot usually
needs to call the player entity function. [added in 1.09]
- int GET_USER_MSG_ID(PLID, const char *name, int *size)
Returns the id number corresponding to the given message name, of
those messages registered by the gamedll with RegUserMsg, optionally
returning the registered size of the message as well. This is to allow
things like bots to access the name/id mapping without having to catch
RegUserMsg themselves, and thus have to be loaded at startup. [added
in 1.11]
- const char * GET_USER_MSG_NAME(PLID, int msgid, int *size)
Returns the name corresponding to the given msgid number, of those
messages registered by the gamedll with RegUserMsg, optionally
returning the registered size of the message as well. It will return
guess-names for any builtin Engine messages that it knows about
(SVC_TEMPENTITY, etc). The returned string is presumed to be a
compile-time constant string, stored in the text segment of the
gamedll. [added in 1.11]
- const char * GET_PLUGIN_PATH(PLID)
Returns the full pathname of the loaded dll/so file for the calling
plugin. The returned string is a pointer to a static buffer, and
should be copied by the caller to local storage. [added in 1.12]
- const char * GET_GAME_INFO(PLID, ginfo_t type)
Returns various string-based information about the running game/MOD/
gamedll. The given type can be one of:
- GINFO_NAME - short name of game, from "-game" argument to hlds (ie
"cstrike")
- GINFO_DESC - long name of game, from autodetection (ie
"Counter-Strike")
- GINFO_GAMEDIR - game directory, full pathname (ie "/usr/local/
half-life/cstrike")
- GINFO_DLL_FULLPATH - full pathname of the game dll (ie "/usr/local
/half-life/cstrike/dlls/cs_i386.so")
- GINFO_DLL_FILENAME - bare filename of the gamedll (ie
"cs_i386.so")
The returned string is a pointer to a static buffer, and should be
copied by the caller to local storage. [added in 1.14]
Plugin Loading
==============
(this is some rough notes I intend to fill in in the future)
Plugins are loaded when the engine calls GiveFnptrsToDll(). The config
file is parsed, and for each valid plugin (uncommented, platform
relevant), the operation is:
- dlopen() the file, store the handle
- dlsym() and call:
Meta_Init (if present)
GiveFnptrsToDll
Meta_Query
Meta_Attach
- if present, call function pointers, and store resulting function
table:
GetEntityAPI
GetEntityAPI2
GetNewDLLFunctions
GetEntityAPI_Post
GetEntityAPI2_Post
GetNewDLLFunctions_Post
GetEngineFunctions
GetEngineFunctions_Post
--------------------------------------------------------------------------

702
doc/txt/dllapi_notes.txt Normal file
View File

@ -0,0 +1,702 @@
HLSDK DLLAPI Notes
=-=-=-=-=-=-=-=-=-=
--------------------------------------------------------------------------
- GameDLLInit
- DispatchSpawn
- DispatchThink
- DispatchUse
- DispatchTouch
- DispatchBlocked
- DispatchKeyValue
- DispatchSave
- DispatchRestore
- DispatchObjectCollsionBox
- SaveWriteFields
- SaveReadFields
- SaveGlobalState
- RestoreGlobalState
- ResetGlobalState
- ClientConnect
- ClientDisconnect
- ClientKill
- ClientPutInServer
- ClientCommand
- ClientUserInfoChanged
- ServerActivate
- ServerDeactivate
- PlayerPreThink
- PlayerPostThink
- StartFrame
- ParmsNewLevel
- ParmsChangeLevel
- GetGameDescription
- PlayerCustomization
- SpectatorConnect
- SpectatorDisconnect
- SpectatorThink
- Sys_Error
- PM_Move
- PM_Init
- PM_FindTextureType
- SetupVisibility
- UpdateClientData
- AddToFullPack
- CreateBaseline
- RegisterEncoders
- GetWeaponData
- CmdStart
- CmdEnd
- ConnectionlessPacket
- GetHullBounds
- CreateInstancedBaselines
- InconsistentFile
- AllowLagCompensation
--------------------------------------------------------------------------
GameDLLInit
from dlls/game.cpp:
void GameDLLInit(void);
Register your console variables here.
This gets called one time when the game is initialied.
Initialize the game (one-time call after loading of game .dll)
comments:
Called just after hlds reports "Dll loaded for mod Half-Life".
--------------------------------------------------------------------------
DispatchSpawn
from dlls/cbase.cpp
int DispatchSpawn(edict_t *pent);
comments:
Called when entity defined in mapfile is being created.
First entity has classname "worldcraft" and can be used to detect
map start.
0==Success, -1==Failure ?
--------------------------------------------------------------------------
DispatchThink
from dlls/cbase.cpp
void DispatchThink(edict_t *pent);
Called when pent->v.nextthink is first time less or equal as
server time.
--------------------------------------------------------------------------
DispatchUse
from dlls/cbase.cpp
void DispatchUse(edict_t *pentUsed, edict_t *pentOther);
Unused. Use is dispatched internally inside gamedll.
--------------------------------------------------------------------------
DispatchTouch
from dlls/cbase.cpp
void DispatchTouch(edict_t *pentTouched, edict_t *pentOther);
Called when other entity collides touched entity.
--------------------------------------------------------------------------
DispatchBlocked
from dlls/cbase.cpp
void DispatchBlocked(edict_t *pentBlocked, edict_t *pentOther);
Unknown.
--------------------------------------------------------------------------
DispatchKeyValue
from dlls/cbase.cpp
void DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd);
Client uses 'setinfo' command.
- pentKeyvalue Client edict
- pkvd Client key values
--------------------------------------------------------------------------
DispatchSave
from dlls/cbase.cpp
void DispatchSave(edict_t *pent, SAVERESTOREDATA *pSaveData);
Save game?
--------------------------------------------------------------------------
DispatchRestore
from dlls/cbase.cpp
int DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int
globalEntity);
comments:
Load game?
0==Success, -1==Failure ?
--------------------------------------------------------------------------
DispatchObjectCollsionBox
from dlls/cbase.cpp
void DispatchObjectCollsionBox(edict_t *pent);
--------------------------------------------------------------------------
SaveWriteFields
from dlls/cbase.cpp
void SaveWriteFields(SAVERESTOREDATA *pSaveData, const char *pname, void *
pBaseData, TYPEDESCRIPTION *pFields, int fieldCount);
--------------------------------------------------------------------------
SaveReadFields
from dlls/cbase.cpp
void SaveReadFields(SAVERESTOREDATA *pSaveData, const char *pname, void *
pBaseData, TYPEDESCRIPTION *pFields, int fieldCount);
--------------------------------------------------------------------------
SaveGlobalState
from dlls/world.cpp
void SaveGlobalState(SAVERESTOREDATA *pSaveData);
--------------------------------------------------------------------------
RestoreGlobalState
from dlls/world.cpp
void RestoreGlobalState(SAVERESTOREDATA *pSaveData);
--------------------------------------------------------------------------
ResetGlobalState
from dlls/world.cpp
void ResetGlobalState(void);
--------------------------------------------------------------------------
ClientConnect
from dlls/client.cpp:
BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *
pszAddress, char szRejectReason[128]);
Called when a player connects to a server.
comments:
Called on initial connect, just after hlds reports "connected", ie:
"John<1><WON:9856723>" connected, address "127.0.0.1:27005"
This is before the user begins downloading, or anything else.
--------------------------------------------------------------------------
ClientDisconnect
from dlls/client.cpp:
void ClientDisconnect(edict_t *pEntity);
Called when a player disconnects from a server.
GLOBALS ASSUMED SET: g_fGameOver
comments:
This is not the opposite of ClientConnect, despite the similar name.
It appears to only be called if the client was PutInServer first. If
the client disconnects before being PutInServer, no API routine is
called. This would be more appropriately named ClientRemoveFromServer_
.
--------------------------------------------------------------------------
ClientKill
from dlls/client.cpp:
void ClientKill(edict_t *pEntity);
Player entered the suicide command.
GLOBALS ASSUMED SET: g_ulModelIndexPlayer
comments:
When the client typed "kill" in the console?
--------------------------------------------------------------------------
ClientPutInServer
from dlls/client.cpp:
void ClientPutInServer(edict_t *pEntity);
Called each time a player is spawned.
comments:
Called after the client has uploaded/download all necessary resources,
just after hlds reports "entered the game", ie:
"John<1>" has entered the game
--------------------------------------------------------------------------
ClientCommand
from dlls/client.cpp:
void ClientCommand(edict_t *pEntity);
Called each time a player uses a "cmd" command. Use CMD_ARGS,
CMD_ARGV, and CMD_ARGC to get pointers to the character string
command.
--------------------------------------------------------------------------
ClientUserInfoChanged
from dlls/client.cpp:
void ClientUserInfoChanged(edict_t *pEntity, char *infobuffer);
Called after the player changes userinfo - gives dll a chance to
modify it before it gets sent into the rest of the engine.
comments:
Called when user issues "setinfo" from the console. Also appears to be
called whenever the user returns to the game from the ESC menu.
--------------------------------------------------------------------------
ServerActivate
from dlls/client.cpp:
void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
Every call to ServerActivate should be matched by a call to
ServerDeactivate.
comments:
Added in SDK 2.0. Apparently called when the server has loaded the
map, but before it precaches from the .res file.
--------------------------------------------------------------------------
ServerDeactivate
from dlls/client.cpp:
void ServerDeactivate(void);
Peform any shutdown operations here.
It's possible that the engine will call this function more times than
is necessary. Therefore, only run it one time for each call to
ServerActivate.
comments:
Called upon "quit" or "changelevel" .
--------------------------------------------------------------------------
PlayerPreThink
from dlls/client.cpp:
void PlayerPreThink(edict_t *pEntity);
Called every frame before physics are run.
--------------------------------------------------------------------------
PlayerPostThink
from dlls/client.cpp:
void PlayerPostThink(edict_t *pEntity);
Called every frame after physics are run.
--------------------------------------------------------------------------
StartFrame
from dlls/client.cpp:
void StartFrame(void);
GLOBALS ASSUMED SET: g_ulFrameCount
--------------------------------------------------------------------------
ParmsNewLevel
from dlls/client.cpp
void ParmsNewLevel(void);
--------------------------------------------------------------------------
ParmsChangeLevel
from dlls/client.cpp
void ParmsChangeLevel(void);
--------------------------------------------------------------------------
GetGameDescription
from dlls/client.cpp:
const char *GetGameDescription(void);
Returns string describing current .dll game.
Returns the descriptive name of this .dll. E.g., Half-Life, or Team
Fortress 2.
This function might be called before the world has spawned, and the
game rules initialized.
--------------------------------------------------------------------------
PlayerCustomization
from dlls/client.cpp:
void PlayerCustomization(edict_t *pEntity, customization_t *pCust);
Notifies .dll of new customization for player.
A new player customization has been registered on the server. UNDONE:
This only sets the # of frames of the spray can logo animation right
now.
--------------------------------------------------------------------------
SpectatorConnect
from dlls/client.cpp:
void SpectatorConnect(edict_t *pEntity);
Called when spectator joins server.
A spectator has joined the game.
--------------------------------------------------------------------------
SpectatorDisconnect
from dlls/client.cpp:
void SpectatorDisconnect(edict_t *pEntity);
Called when spectator leaves the server.
A spectator has left the game.
--------------------------------------------------------------------------
SpectatorThink
from dlls/client.cpp:
void SpectatorThink(edict_t *pEntity);
Called when spectator sends a command packet (usercmd_t).
A spectator has sent a usercmd.
--------------------------------------------------------------------------
Sys_Error
from dlls/client.cpp:
void Sys_Error(const char *error_string);
Called when engine has encountered an error.
Notify game .dll that engine is going to shut down.
Engine is going to shut down, allows setting a breakpoint in game dll
to catch that occasion.
Add code ( e.g., _asm { int 3 }; here to cause a breakpoint for
debugging your game .dlls.
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
PM_Move
from pm_shared/pm_shared.c:
void PM_Move(struct playermove_s *ppmove, int server);
This modume implements the shared player physics code between any
particular game and the engine. The same PM_Move routine is built into
the game .dll and the client .dll and is invoked by each side as
appropriate. There should be no distinction, internally, between
server and client. This will ensure that prediction behaves
appropriately.
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
PM_Init
from pm_shared/pm_shared.c:
void PM_Init(struct playermove_s *ppmove);
Server version of player movement initialization.
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
PM_FindTextureType
from pm_shared/pm_shared.c
char PM_FindTextureType(char *name);
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
SetupVisibility
from dlls/client.cpp:
void SetupVisibility(edict_t *pViewEntity, edict_t *pClient, unsigned char
**pvs, unsigned char **pas);
from dlls/client.cpp:
Set up PVS and PAS for networking for this client.
A client can have a separate "view entity" indicating that his/her
view should depend on the origin of that view entity. If that's the
case, then pViewEntity will be non-NULL and will be used. Otherwise,
the current entity's origin is used. Either is offset by the view_ofs
to get the eye position.
From the eye position, we set up the PAS and PVS to use for filtering
network messages to the client. At this point, we could override the
actual PAS or PVS values, or use a different origin.
NOTE: Do not cache the values of pas and pvs, as they depend on
reusable memory in the engine, they are only good for this one frame
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
UpdateClientData
from dlls/client.cpp:
void UpdateClientData (const struct edict_s *ent, int sendweapons, struct
clientdata_s *cd);
Set up data sent only to specific client.
Data sent to current client only.
Engine sets argument 'cd' to 0 before calling.
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
AddToFullPack
from dlls/client.cpp:
int AddToFullPack(struct entity_state_s *state, int e, edict_t *ent,
edict_t *host, int hostflags, int player, unsigned char *pSet);
Return 1 if the entity state has been filled in for the ent and the
entity will be propagated to the client, 0 otherwise.
State is the server maintained copy of the state info that is
transmitted to the client. A MOD could alter values copied into state
to send the "host" a different look for a particular entity update,
etc.
Arguments 'e' and 'ent' are the entity that is being added to the
update, if 1 is returneds. Host is the player's edict of the player
whom we are sending the update to. Player is 1 if the ent/e is a
player and 0 otherwise. Argument 'pSet' is either the PAS or PVS that
we previous set up. We can use it to ask the engine to filter the
entity against the PAS or PVS.
We could also use the pas/ pvs that we set in SetupVisibility, if we
wanted to. Caching the value is valid in that case, but still only for
the current frame.
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
CreateBaseline
from dlls/client.cpp:
void CreateBaseline(int player, int eindex, struct entity_state_s *
baseline, struct edict_s *entity, int playermodelindex, vec3_t
player_mins, vec3_t player_maxs);
Tweak entity baseline for network encoding, allows setup of player
baselines, too.
Creates baselines used for network encoding, especially for player
data since players are not spawned until connect time.
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
RegisterEncoders
from dlls/client.cpp:
void RegisterEncoders(void);
Callbacks for network encoding.
Allows game .dll to override network encoding of certain types of
entities and tweak values, etc.
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
GetWeaponData
from dlls/client.cpp
int GetWeaponData(struct edict_s *player, struct weapon_data_s *info);
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
CmdStart
from dlls/client.cpp:
void CmdStart(const edict_t *player, const struct usercmd_s *cmd, unsigned
int random_seed);
We're about to run this usercmd for the specified player. We can set
up groupinfo and masking here, etc. This is the time to examine the
usercmd for anything extra. This call happens even if think does not.
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
CmdEnd
from dlls/client.cpp:
void CmdEnd (const edict_t *player);
Each cmdstart is exactly matched with a cmd end, clean up any group
trace flags, etc. here.
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
ConnectionlessPacket
from dlls/client.cpp:
int ConnectionlessPacket(const struct netadr_s *net_from, const char *
args, char *response_buffer, int *response_buffer_size);
Return 1 if the packet is valid. Set response_buffer_size if you want
to send a response packet. Incoming, it holds the max size of the
response_buffer, so you must zero it out if you choose not to respond.
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
GetHullBounds
from dlls/client.cpp:
int GetHullBounds(int hullnumber, float *mins, float *maxs);
Engine calls this to enumerate player collision hulls, for prediction.
Return 0 if the hullnumber doesn't exist.
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
CreateInstancedBaselines
from dlls/client.cpp:
void CreateInstancedBaselines (void);
Tweak entity baseline for network encoding, allows setup of player
baselines, too.
Create pseudo-baselines for items that aren't placed in the map at
spawn time, but which are likely to be created during play (e.g.,
grenades, ammo packs, projectiles, corpses, etc.).
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
InconsistentFile
from dlls/client.cpp:
int InconsistentFile(const edict_t *player, const char *filename, char *
disconnect_message);
One of the ENGINE_FORCE_UNMODIFIED files failed the consistency check
for the specified player Return 0 to allow the client to continue, 1
to force immediate disconnection (with an optional disconnect message
of up to 256 characters).
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
AllowLagCompensation
from dlls/client.cpp:
int AllowLagCompensation(void);
The game .dll should return 1 if lag compensation should be allowed
(could also just set the sv_unlag cvar. Most games right now should
return 0, until client-side weapon prediction code is written and
tested for them (note you can predict weapons, but not do lag
compensation, too, if you want.
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------

2166
doc/txt/engine_notes.txt Normal file

File diff suppressed because it is too large Load Diff

120
doc/txt/faq.txt Normal file
View File

@ -0,0 +1,120 @@
Metamod FAQ
=-=-=-=-=-=
Please add support for (some) mod.
Please see game support requirements in the documentation.
How do I use bots with Metamod?
If the bot is not a Metamod plugin, then you will need to tell Metamod
to use your bot as the gamedll, by specifying it on the hlds command
line with the "+localinfo mm_gamedll" option. See the Metamod docs.
See also the AdminMod docs (www.adminmod.org/help/online/Configuration
/How_to_Use_Bots_with_MetaMod_AM_2.50_and_up.htm).
The download links give corrupt files.
I think what you're observing is that your web client is quietly
uncompressing the file, but not updating the name of the downloaded
file to reflect this. In particular, some web clients will silently
decompress (gunzip) files _without_ removing the ".gz" from the
filename, so you'll end up with a file "metamod_i386.so.gz" which is
_really_ "metamod_i386.so", and so trying to gunzip it will produce an
error ("not in gzip format"). Try running "file" on the resulting file
to see what the OS thinks it is. Or, where you don't have "file" (ie
windows), just look at the file size - it should be pretty indicative
of whether the file is still compressed or not.
How do I install Metamod?
This is covered briefly in the Metamod docs. Typically, though,
Metamod is installed as part of some major plugin, like AdminMod
(www.adminmod.org/). There is also some discussion of installing
Metamod by hand in the AdminMod docs (www.adminmod.org/help/online/
Installing/Manual_Installation_-_Walk-Through.htm). If you already
have Metamod installed and merely want to update it, this requires
only replacing the .so/.dll with the latest version from the webpage
(metamod.org/).
I'm having trouble with AdminMod.
You'll need to ask your AdminMod questions on the AdminMod forums
(www.ozforums.com/forumdisplay.php?forumid=143).
How do I do (something) in a Metamod plugin?
Generally speaking, a Metamod plugin works very much like an Half-Life
Game Mod, since all it's doing is making the same calls to the same
SDK that the Game Mod does. So, the question typically isn't "how do I
do this in Metamod?" but instead "how do I do this in an Half-Life
Mod?", and is best asked in a HL SDK Programming forum/mailinglist
(see related links and especially Botman's MOD FAQ (planethalflife.com
/botman/MOD_FAQ.shtml)). Once you figure out how it would normally be
done in a Game Mod, figuring out how to do it in Metamod is relatively
straightforward.
However, if you have questions on how to convert a piece of code from
HLmod to Metamod plugin, then I can provide some pointers, or you can
ask on the Metamod mailing list (groups.yahoo.com/group/metamod/). And
of course, if you have questions about things in the code specific to
Metamod (ie things mentioned in the Metamod Coding docs) feel free to
ask me or on the mailing list.
Is there a tutorial or example of how to write a Metamod plugin?
The sourcecode includes a couple of plugins that can be used as
examples. The "stub" plugin is the bare basics of what a plugin needs.
The "trace" plugin provides an example of hooking _every_ SDK
function. The "wdmisc" plugin provides a couple of basic useful
features. You can also look at several of the other plugins out there
for more examples.
Note that the example plugins in the Metamod sourcecode show how to
use Metamod to interface with Half-Life code, but they mostly assume
you already know how to write Half-Life code. If you need examples or
info on how to write Half-Life code itself, you'll need to go look
through the HL SDK programming websites (see related links and
Botman's MOD FAQ (planethalflife.com/botman/MOD_FAQ.shtml)).
I have (or know of) a Metamod plugin not listed on the webpage.
Send me the information about the plugin (name, author, description,
URL), and I'd be happy to provide a link from the webpage.
I'm having trouble compiling under MSVC.
Please note that I do not use MSVC, so I can't help a lot with using
that compiler. I do all my development under linux, using gcc for
linux binaries and mingw32 (www.mingw.org/) for windows binaries. The
sourcecode does include an MSVC project file for Metamod, as well as a
project file for the stub plugin, both mostly as examples. They should
work, and indeed did work the last time I dug up MSVC to test them.
That said, there are a few folks on the Metamod mailing list
(groups.yahoo.com/group/metamod/) that do use MSVC, so you might find
some assistance there.
If I create a Metamod plugin, does it have to be open source?
Generally speaking, yes. The way the GPL is interpreted, plugins of a
GPL program need to be also GPL. See also the FAQ entry on the GNU
site about plugins of a GPL program (www.gnu.org/licenses/gpl-faq.html
#GPLAndPlugins).
How about a port of Metamod to other engines like Q3, Unreal, etc?
I haven't looked into it myself, but several folks on the AdminMod
team (from which Metamod was derived) had looked at porting to other
games like Q3 and UT, and determined that those engines either didn't
provide the necessary API hooks, or that they already provided a
suitable method for extending functionality. So, I wouldn't expect to
see a version of Metamod for those. Perhaps for some other future
engines, although I believe most modern engines are now providing
their own method for extensions or plugins, so that a third-party
solution like Metamod wouldn't be necessary.
If Half-Life 2 ever sees the light of day, I expect I'd look seriously
at porting to that - unless, of course, Valve ends up providing their
own plugin framework themselves. :)
--------------------------------------------------------------------------

6
doc/txt/gamesupport.txt Normal file
View File

@ -0,0 +1,6 @@
Adding Game/Mod Support
=-=-=-=-=-=-=-=-=-=-=-=
Metamod-P already supports your Mod.
--------------------------------------------------------------------------

129
doc/txt/links.txt Normal file
View File

@ -0,0 +1,129 @@
Related links
=============
Here's a list of links, other sites, and information I found useful when
working on Metamod:
- AdminMod's DLL Forum (www.ozforums.com/forumdisplay.php?forumid=114)
- AdminMod CVS at Sourceforge (cvs.sourceforge.net/cgi-bin/viewcvs.cgi/
halflifeadmin/)
- Valve Editing Resource Center (collective.valve-erc.com/), Valve's
official site
- Botman's Bots (planethalflife.com/botman/)
- Half-Life Programming Planet (hlpp.valveworld.com/)
- Shadowman's Half-Life SDK2 Site (planethalflife.com/hlsdk2)
- Half-Life Coding Pages (www.planethalflife.com/botman/balfourroad/
index.shtml)
- Fixxxer's HL Coding page (planethalflife.com/fixxxer/)
- The Handy Vandal's HL Coding Links (www.karljones.com/halflife/
coding.asp)
- Half-Life SDK Forums (www.chatbear.com/cgi-bin/board.pl?boardid=942),
at the VERC
- Half-Life SDK Forums (www.chatbear.com/cgi-bin/board.pl?action=
boardlisting&boardid=590), at Valve's former SDK site
- HL Coders mailing list (www.topica.com/lists/hlcoders), at topica.com
- Botman's forums (dynamic.gamespy.com/~botman/yabb/YaBB.pl)
- Wavelength Half-Life Coding Forum (www.thewavelength.net/forums/
index.php?act=SF&f=13)
- SDK2 Forum (pub21.ezboard.com/fshadowmanshalflifeforumsdk2), at
ezboard.com
- HL Programming Forum (dynamic.gamespy.com/~hlprogramming/ultimatebb/
forumdisplay.cgi?action=topics&forum=Coding&number=1), at gamespy.com
- Fixxxer's HL Coding forum (network54.com/Hide/Forum/goto?forumid=
21807)
- HL Programming Forum (forums.gamedesign.net/forums/wwwthreads.pl?
action=list&Board=halflife_coding), at gamedesign.net
- C FAQ (www.eskimo.com/~scs/C-faq/top.html)
- C++ FAQ Lite (www.parashift.com/cpp-faq-lite/)
- C++ FAQ Index (www.calpoly.edu/~jfischer/c++faq/index.html)
- alt.comp.lang.learn.c-c++ FAQ (snurse-l.org/acllc-c++/faq)
- C++ Annotations (dragon.klte.hu/~kollarl/C++/cplusplu.html), guide for
C programmers to using C++
- C++ Portability Guide (www.mozilla.org/hacking/portable-cpp.html)
- Standard Template Library Programmer's Guide (www.sgi.com/tech/stl/),
at SGI
- comp.std.c++ FAQ (reality.sgi.com/austern_mti/std-c++/faq.html)
- GNU g++ FAQ (www.landfield.com/faqs/g++-FAQ/plain/)
- GNU libstdc++ FAQ (gcc.gnu.org/onlinedocs/libstdc++/faq/)
- C++ References (www.apl.jhu.edu/~paulmac/c++-references.html), books
and other links
- Thinking in C++ (www.mindview.net/Books/TICPP/ThinkingInCPP2e.html),
free electronic book
- comp.programming.threads FAQ (www.serpentine.com/~bos/threads-faq/)
- comp.programming.threads FAQ #2 (www.lambdacs.com/cpt/FAQ.html)
- Implementing POSIX Condition Variables in Win32 (www.cs.wustl.edu/
~schmidt/win32-cv-1.html)
- Microsoft Developer Network (msdn.microsoft.com/), online win32 API
docs
- Win32 Programming FAQ (www.iseran.com/Win32/FAQ/)
- Minimal Gnu for Windows (mingw) (www.mingw.org/), gcc for win32
- Creating DLLs w/mingw (www.geocities.com/Tokyo/Towers/6162/win32/dll/
make.html)
- Mingw binaries (www.devolution.com/~slouken/SDL/Xmingw32/)
- Mingw binaries (newer) (members.telering.at/jessich/mingw/index.html)
Books
And here are books I picked up that I found useful as well:
- C: A Reference Manual (vig.prenhall.com/catalog/academic/product/
1,4096,0133262243,00.html), by Samuel Harbison & Guy Steele
(www.sls.lcs.mit.edu/~hurley/guysteele.html) (at Bookpool
(www.bookpool.com/.x//sm/0133262243), at Amazon (www.amazon.com/exec/
obidos/ASIN/0133262243))
- C Programming FAQs (cseng.aw.com/book/0,3828,0201845199,00.html), by
Steve Summit (www.eskimo.com/~scs/) (at Bookpool (www.bookpool.com/.x/
/sm/0201845199), at Amazon (www.amazon.com/exec/obidos/ASIN/
0201845199))
- C++: The Core Language (www.oreilly.com/catalog/core/), by Gregory
Satir & Doug Brown (at Bookpool (www.bookpool.com/.x//sm/156592116X),
at Amazon (www.amazon.com/exec/obidos/ASIN/156592116X))
- C++ Programming Language Special Edition (cseng.aw.com/book/
0,3828,0201700735,00.html), by Bjarne Stroustrup (www.research.att.com
/~bs/) (at Bookpool (www.bookpool.com/.x//sm/0201700735), at Amazon
(www.amazon.com/exec/obidos/ASIN/0201700735))
- The C++ Standard Library: A Tutorial and Reference (cseng.aw.com/book/
0,3828,0201379260,00.html), by Nicolai Josuttis (www.josuttis.de/
indexe.html) (at Bookpool (www.bookpool.com/.x//sm/0201379260), at
Amazon (www.amazon.com/exec/obidos/ASIN/0201379260))
- C++ FAQs (cseng.aw.com/book/0,3828,0201309831,00.html), by Marshall
Cline (www.parashift.com/), Greg Lomow, & Mike Girou (at Bookpool
(www.bookpool.com/.x//sm/0201309831), at Amazon (www.amazon.com/exec/
obidos/ASIN/0201309831))
- Effective C++ (cseng.aw.com/book/0,,0201924889,00.html), by Scott
Meyers (www.aristeia.com/) (at Bookpool (www.bookpool.com/.x//sm/
0201924889), at Amazon (www.amazon.com/exec/obidos/ASIN/0201924889))
- Algorithms in C++, Parts 1-4 (cseng.aw.com/book/
0,,0201350882,00.html), by Robert Sedgewick (www.cs.princeton.edu/~rs
/) (at Bookpool (www.bookpool.com/.x//sm/0201350882), at Amazon
(www.amazon.com/exec/obidos/ASIN/0201350882))
- Advanced Programming in the UNIX Environment (cseng.aw.com/book/
0,3828,0201563177,00.html), by W. Richard Stevens (www.kohala.com/)
(at Bookpool (www.bookpool.com/.x//sm/0201563177), at Amazon
(www.amazon.com/exec/obidos/ASIN/0201563177))
- Win32 System Programming (cseng.aw.com/book/
0,3828,0201703106,00.html), by Johnson Hart (world.std.com/~jmhart/)
(at Bookpool (www.bookpool.com/.x//sm/0201703106), at Amazon
(www.amazon.com/exec/obidos/ASIN/0201703106))
- Managing Projects with Make (www.oreilly.com/catalog/make2/), by
Andrew Oram & Steve Talbott (www.oreilly.com/~stevet/) (at Bookpool
(www.bookpool.com/.x//sm/0937175900), at Amazon (www.amazon.com/exec/
obidos/ASIN/0937175900))
- Thread Time (vig.prenhall.com/catalog/academic/product/
1,4096,0131900676,00.html), by Scott Norton & Mark DiPasquale (at
Bookpool (www.bookpool.com/.x//sm/0131900676), at Amazon
(www.amazon.com/exec/obidos/ASIN/0131900676))
- Programming with POSIX Thrads (cseng.awl.com/book/
0,3828,0201633922,00.html), by David Butenhof (at Bookpool
(www.bookpool.com/.x//sm/0201633922), at Amazon (www.amazon.com/exec/
obidos/ASIN/0201633922))
--------------------------------------------------------------------------

25
doc/txt/maillist.txt Normal file
View File

@ -0,0 +1,25 @@
Mailing lists
=-=-=-=--=-=-=
I've created a couple of lists on YahooGroups (formerly egroups (formerly
onelist)):
- metamod-announce (groups.yahoo.com/group/metamod-announce/) for
announcements of new versions and plugins
- metamod (groups.yahoo.com/group/metamod/) for questions, support,
discussion, etc
There are simple subscribe forms below.
Subscribe to metamod-announce
[enter email address ]
groups.yahoo.com/metamod-announce Click here to join metamod-announce
(groups.yahoo.com/group/
metamod-announce/)
Subscribe to metamod
[enter email address ] Click here to join metamod
groups.yahoo.com/metamod (groups.yahoo.com/
group/metamod/)
--------------------------------------------------------------------------

568
doc/txt/metamod.txt Normal file
View File

@ -0,0 +1,568 @@
Using Metamod
=-=-=-=-=-=-=
Client Commands
===============
Similar to the server console interface, clients can also issue commands
to Metamod, of the following form:
- meta version - displays version information about the Metamod instance
currently running on the server, ie:
Metamod v1.21p37 2013/05/30 (5:13)
by Will Day
http://www.metamod.org/
Patch: Metamod-P (mm-p) v37
by Jussi Kivilinna
http://koti.mbnet.fi/axh/
compiled: Feb 18 2013, 11:53:27 EET (optimized)
- meta list - displays information about the list of currently running
plugins, ie:
Currently running plugins:
[ 1] Trace HLSDK API, v1.XX.93, 2003/02/17, by Will Day
<willday@metamod.org>, see http://www.metamod.org/
[ 2] Adminmod, v2.50.56 (MM), Jul 13 2003, by Alfred Reynolds
<alfred@valvesoftware.com>, see http://www.adminmod.org/
2 plugins
Client Cvars
============
Also available to client browser applications is a cvar metamod_version
that should report the version of Metamod running on the server, ie:
"metamod_version" is "1.21p37"
Installation
============
If you want to install Metamod by hand, here's what you have to do:
- Install the Metamod library (.dll for win32, or .so for linux) to a
directory under your game directory. For instance, if you were running
Counter-Strike, under win32 you might want have:
half-life/cstrike/addons/metamod/dlls/metamod.dll
If a directory you want doesn't exist, create it.
- Edit the "liblist.gam" file in your game directory, replacing the game
dll filename with the Metamod dll filename. For instance with
Counter-Strike, you would change:
gamedll "dlls/mp.dll"
gamedll_linux "dlls/cs.so"
to:
gamedll "addons/metamod/dlls/metamod.dll"
gamedll_linux "addons/metamod/dlls/metamod.so"
Note that it's only really necessary to change the line corresponding
to your OS (win32 or linux); you can leave the other line unchanged,
or you can change it - it doesn't matter.
- To load plugins at game startup, you'll need to create a "plugins.ini"
file containing a list of the plugins you want to load.
Configuration
=============
Metamod has several ways to provide config options, partially because it
started with one method and then added other methods, but also because one
method can be more convenient than the other, varying with the situation.
Generally speaking, the two methods of providing configuration information
to Metamod are:
- on the command line, via +localinfo arguments to hlds.
- as the contents of some file that Metamod reads and parses.
The confusing part can come when the pathnames to some of the config files
can be specified via command line options - or indeed, when the pathnames
to some config files can be specified in other config files.
In any case, here are the various config options and config files Metamod
uses, (listed in order of priority), where "$gamedir" indicates the game
directory, ie "cstrike":
- +localinfo mm_configfile <file>
- +localinfo mm_pluginsfile <file>
- config.ini option: plugins_file <file>
- $gamedir/addons/metamod/plugins.ini
- $gamedir/metamod.ini
- $localinfo mm_execcfg <file>
- config.ini option: exec_cfg <file>
- $gamedir/addons/metamod/exec.cfg
- $gamedir/metaexec.cfg
- $localinfo mm_gamedll <file>
- config.ini option: gamedll <file>
- [DEL]$gamedir/metagame.ini[DEL] -- NO LONGER SUPPORTED.
File: plugins.ini
=====
Default location: _$gamedir/addons/metamod/plugins.ini, ie "cstrike/addons
/metamod/plugins.ini".
Plugins are described in a file "plugins.ini" and each line describes a
plugin to load:
<platform> <filepath> [<description>]
Fields are whitespace delimited (tabs/spaces).
- Platform is a keyword, either "linux" or "win32".
- Filepath is a path to the DLL/so file. Relative paths are from the
game dir; absolute paths are also valid. Paths should use unix-style
forward slashes (/) and not backward slashes (\), even on windows
platforms.
Also, the filepath (once expanded to full path name) is expected to be
unique within the list of plugins. Thus, a plugin with a fullpathname
matching that of a previous plugin is considered a duplicate, and is
not loaded.
- Description is an optional description of the plugin, used in place of
the plugin's internal name in log messages and console output.
Whitespace in the description _is_ allowed; quoting is unnecessary.
Comments are recognized at _only_ the beginning of a line, and can be in
either shell style ("#") or c++ style ("//").
For instance, in "cstrike/addons/metamod/plugins.ini" these are all valid
lines:
// linux dlls/mybot.so
# win32 dlls/mybot-old.dll Mybot old
win32 dlls/mybot.dll Mybot current
linux /tmp/stub_mm_i386.so
win32 /tmp/stub_mm_i386.dll
linux ../dlls/trace_mm_i386.so
win32 ../dlls/trace_mm_i386.dll
linux dlls/admin_MM_i386.so
win32 dlls/admin_MM_i386.dll
Note that order in the plugins.ini file _is_ significant. Plugins are
loaded and accessed in the order specified, so ordering can be important,
depending on the plugin(s).
The file is re-read at changelevel, as well as on demand (via "meta
refresh" console command; see below). When the file is re-read, it will:
- load any new plugins added to the file
- unload any plugins that have been deleted from the file. This is only
applicable to plugins loaded _from the inifile_. If the plugin was
loaded from the console, it will not be unloaded during a refresh,
whether it's in the inifile or not.
- reload any plugin whose file on disk has been updated since it was
loaded. Note this appears to be only useful under linux, as under
Windows you cannot rename or overwrite an open DLL, so it doesn't look
a loaded plugin could ever have a newer file on disk. Oh well.
The game dll is auto-detected, along the same lines AdminMod operated
(looking at the "gamedir"); see "mm_gamedll" below if you want to use a
"bot" DLL.
You can override the name of this file by specifying it via the +localinfo
field "mm_pluginsfile".
For compatibility with previous versions, Metamod will also look for a
file "metamod.ini" under the gamedir, ie "cstrike/metamod.ini".
File: config.ini
=====
Default location: _$gamedir/addons/metamod/config.ini, ie "cstrike/addons/
metamod/config.ini".
This contains basic config information, at the moment duplicating most of
the +localinfo variables, but allowing for more flexible expansion of
config options in the future. Also, it provides somewhat more reliable
options setting, since +localinfo munges some argument values (in
particular, pathnames with leading dots, ie "../dlls/blah.dll").
Basic format is:
<option> <value>
Fields are whitespace delimited (tabs/spaces). Comments are recognized at
_only_ the beginning of a line, and can be in either shell style ("#") or
c++ style ("//"). The following is a list of currently recognized options,
their defaults, and examples of usage:
- debuglevel <number>
where <number> is an integer, 0 and up.
Sets the initial debugging level for metamod (same as cvar
"meta_debug").
Default is normally 0. If hlds is run with "-dev", default is 3.
Overridden by: +localinfo mm_debug <number>
Examples:
debuglevel 0
debuglevel 42
- gamedll <path>
where <path> is an absolute path, or a path relative to the gamedir.
Overrides the auto-detected gamedll, in particular for bots.
Default is empty, with gamedll being auto-recognized based on the
gamedir.
Overridden by: +localinfo mm_gamedll <number>
Examples:
gamedll dlls/hl.dll
gamedll ../podbot/podbot.dll
gamedll /home/bots/dlls/mybot.dll
- plugins_file <path>
where <path> is an absolute path, or a path relative to the gamedir.
Overrides the default filename containing the MM plugins to load.
Default is "addons/metamod/plugins.ini".
Overridden by: +localinfo mm_pluginsfile <number>
Examples:
plugins_file cfg/clanmode.ini
plugins_file ../private.ini
plugins_file /home/half-life/testing.ini
- exec_cfg <path>
where <path> is a path relative to the gamedir. NOTE! This cannot be
an absolute path, as hlds will not "exec" absolute pathnames.
Overrides the default filename containing hlds commands to run just
after loading Metamod.
Default is "addons/metamod/exec.cfg".
Overridden by: +localinfo mm_execcfg <number>
Examples:
exec_cfg configs/debugging.cfg
exec_cfg ../clan/match.cfg
- autodetect <yes/no>
Setting to disable or enable autodetection of gamedll.
Extra feature for Metamod+All-Mod-Support Patch.
Default is "yes".
Overridden by: +localinfo mm_autodetect <yes/no>
- clientmeta <yes/no>
Setting to disable or enable Metamod's client commands, 'meta list' and
'meta version'.
Extra setting for Metamod+All-Mod-Support Patch.
Default is "yes".
Overridden by: +localinfo mm_clientmeta <yes/no>
You can override the name of this file by specifying it via the +localinfo
field "mm_configfile".
File: exec.cfg
=====
Default location: _$gamedir/addons/metamod/exec.cfg, ie "cstrike/addons/
metamod/exec.cfg". This is necessary for plugins that need to have
settings specified prior to early API routines like ServerActivate, since
autoexec.cfg is read too early and server.cfg is read to late. In
particular, I found this necessary for the Trace plugin, in order to trace
routines like RegUserMsg which are called during ServerActivate.
You can override the name of this file by specifying it via the +localinfo
field "mm_execcfg".
For compatibility with previous versions, Metamod will also look for a
file "metaexec.cfg" under the gamedir, ie "cstrike/metaexec.cfg".
[DEL]file: metagame.ini[DEL]
=========
NOTE! This file is no longer supported! -- use instead the +localinfo
field "mm_gamedll" or the config.ini option gamedll.
Commandline option: +localinfo
===================
Several of Metamod's configuration options can be specified by the
"+localinfo" facility on the hlds command line. This is similar to the
"setinfo" console command, where the syntax is:
+localinfo <field> <value>
Current localinfo fields recognized by Metamod:
- mm_configfile Specifies the file that lists config options, instead of
using the file config.ini. The <value> should be the pathname of the
config file, either absolute path or path relative to the gamedir.
- mm_pluginsfile Specifies a file that lists the Metamod plugins to
load, instead of using the file plugins.ini. The <value> should be the
pathname of the plugins file, either absolute path or path relative to
the gamedir.
- mm_execcfg Specifies a file that contains cvar or other configs to be
exec'd after loading the plugins, instead of using the file exec.cfg.
The <value> should be the pathname of the exec file, either absolute
path or path relative to the gamedir.
- mm_autodetect Specifies if 'autodetect of gamedll' should be enabled
or disabled. It's enabled by default. This is extra feature of
Metamod+All-Mod-Support Patch.
- mm_clientmeta Specifies if Metamod's client commands should be enabled
or disabled. It's enabled by default. This is extra setting of
Metamod+All-Mod-Support Patch.
- mm_gamedll Specifies a game or Bot DLL to be used instead of the
normal gameDLL. The <value> should be the pathname of the DLL, either
absolute path or path relative to the gamedir.
This replaces using the metagame.ini file. With previous versions of
AdminMod (2.10 and earlier), this same functionality was provided by
the file "admin.ini".
- mm_debug Specifies an initial meta_debug value.
Note that each localinfo field can have only one value. If specified more
than once on the command line, only the last one will be recognized. (In
particular, trying to use mm_gamedll to load multiple dll-style bots will
not work. In a case like that, the multiple dll's must be chained
together).
Some examples are:
./hlds_run -game cstrike +localinfo mm_pluginsfile mylist.ini
./hlds_run -game cstrike +localinfo mm_execcfg mysettings.cfg
./hlds_run -game cstrike +localinfo mm_gamedll dlls/pod_bot.so
./hlds_run -game cstrike +localinfo mm_debug 7
Note, paths should use unix-style forward slashes (/) and not backward
slashes (\), even on windows platforms.
Commands
========
All console command functionality is provide by a single command "meta",
with multiple sub-commands:
usage: meta <command> [<arguments>]
valid commands are:
version - display Metamod version info
list - list plugins currently loaded
cmds - list console cmds registered by plugins
cvars - list cvars registered by plugins
refresh - load/unload any new/deleted/updated plugins
config - show config info loaded from config.ini
load <name> - find and load a plugin with the given name
unload <plugin> - unload a loaded plugin
reload <plugin> - unload a plugin and load it again
info <plugin> - show all information about a plugin
pause <plugin> - pause a loaded, running plugin
unpause <plugin> - unpause a previously paused plugin
retry <plugin> - retry a plugin that previously failed its action
clear <plugin> - clear a failed plugin from the list
force_unload <plugin> - forcibly unload a loaded plugin
require <plugin> - exit server if plugin not loaded/running
where <plugin> can be either the plugin index number, or a non-ambiguous
prefix string matching description or file.
Also, a single cvar is available:
meta_debug - set debugging level
For instance with:
Currently loaded plugins:
description stat pend file vers src load unlod
[ 1] Trace HLSDK API RUN - mm_trace_i386.so v0.90 ini ANY Pause
[ 2] adminmod RUN - admin_MM.so v2.11 ini Start Start
[ 3] stub RUN - mm_stub_i386.so v0.90 ini ANY Pause
2 plugins, 2 running
You could then do any of the following to unload the API Trace plugin:
meta unload 1
meta unload trace
meta unload mm_trace
Plugin Loading/Unloading Process
================================
Through the process of loading and unloading, a plugin can be in one of
several different states ('stat' column in the 'meta list' output):
- BADFILE - The plugin file couldn't be found, or it doesn't appear to
be a valid Metamod plugin.
- OPENED - The plugin file was found, and is a valid Metamod plugin, and
is ready to be loaded.
- FAILED - The plugin file attempted to load or unload, but couldn't
complete for some reason.
- RUNNING - The plugin file was loaded and is active and running.
- PAUSED - The plugin file was loaded, but has been temporarily
disabled.
Also through the operation process, a plugin can have a pending "action"
to next take (indicated by the 'pend' column in the 'meta list' output),
and can be one of:
- LOAD - Open and look at the plugin file.
- ATTACH - Attach the plugin to the running game; ie activate it
- UNLOAD - Remove the plugin from the running game and close the file
- RELOAD - Unload/close and re-open/load the plugin, for instance when
the plugin file has changed.
Example Output
==============
Here's some other example output:
meta info admin
name: adminmod
desc: Adminmod
status: running
action: none
filename: dlls/admin_MM.so
file: admin_MM.so
pathname: /home/willday/test/cstrike/dlls/admin_MM.so
index: 3
source: ini file
loadable: at server startup
unloadable: at server startup
version: 2.11
date: 2001/02/04
author: Alfred Reynolds <alfred@mazuma.net.au>
url: http://www.adminmod.org/
logtag: ADMIN
last loaded: Mon Feb 5 02:06:34 2001
DLLAPI functions:
GameDLLInit
DispatchThink
ClientConnect
ClientCommand
ClientUserInfoChanged
ServerActivate
6 functions (dllapi)
No DLLAPI-Post functions.
No NEWAPI functions.
No NEWAPI-Post functions.
No Engine functions.
No Engine-Post functions.
Registered commands:
admin_command
1 commands
Registered cvars: float value string value
users_file 0.000000 users.ini
maps_file 0.000000 mapvote.txt
default_access 1.000000 1
ips_file 0.000000 0
reserve_slots 1.000000 1
reserve_slots_msg 0.000000 0
admin_debug 1.000000 1
password_field 0.000000 admin_password
alarm_message 0.000000 0
alarm_time 0.000000 0
use_regex 1.000000 1
models_password_field 0.000000 0
models_file 0.000000 models.ini
models_kick_msg 0.000000 Invalid model
script_file 0.000000 cstrike/dlls/admin.amx
help_file 0.000000 admin_help.txt
vote_freq 360.000000 360
encrypt_password 1.000000 1
pretty_say 1.000000 1
admin_mod_version 2.110000 2.11
reserve_type 1.000000 1
map_ratio 60.000000 60
kick_ratio 75.000000 75
words_file 0.000000 0
password_timeout 1800.000000 1800
file_access_read 0.000000 0
file_access_write 0.000000 0
public_slots_free 20.000000 20.000000
allow_client_exec 0.000000 0
admin_balance_teams 0.000000 0
30 cvars
No child plugins.
meta cmds
Registered plugin commands:
plugin command
[ 1] API trace trace_version
[ 2] API trace trace
[ 3] API trace untrace
[ 4] API trace showtrace
[ 5] Adminmod admin_command
5 commands, 5 available
meta cvars
Registered plugin cvars:
plugin cvar float value string value
[ 1] API trace trace_debug 3.000000 3.000000
[ 2] API trace trace_dllapi 8.000000 8
[ 3] API trace trace_newapi 0.000000 0
[ 4] API trace trace_engine 8.000000 8
[ 5] Adminmod users_file 0.000000 users.ini
[ 6] Adminmod maps_file 0.000000 mapvote.txt
[ 7] Adminmod default_access 1.000000 1
[ 8] Adminmod ips_file 0.000000 0
[ 9] Adminmod reserve_slots 1.000000 1
[ 10] Adminmod reserve_slots_msg 0.000000 0
[ 11] Adminmod admin_debug 1.000000 1
[ 12] Adminmod password_field 0.000000 admin_password
[ 13] Adminmod alarm_message 0.000000 0
[ 14] Adminmod alarm_time 0.000000 0
[ 15] Adminmod use_regex 1.000000 1
[ 16] Adminmod models_password_fiel 0.000000 0
[ 17] Adminmod models_file 0.000000 models.ini
[ 18] Adminmod models_kick_msg 0.000000 Invalid model
[ 19] Adminmod script_file 0.000000 cstrike/dlls/admin.amx
[ 20] Adminmod help_file 0.000000 admin_help.txt
[ 21] Adminmod vote_freq 360.000000 360
[ 22] Adminmod encrypt_password 1.000000 1
[ 23] Adminmod pretty_say 1.000000 1
[ 24] Adminmod admin_mod_version 2.110000 2.11
[ 25] Adminmod reserve_type 1.000000 1
[ 26] Adminmod map_ratio 60.000000 60
[ 27] Adminmod kick_ratio 75.000000 75
[ 28] Adminmod words_file 0.000000 0
[ 29] Adminmod password_timeout 1800.000000 1800
[ 30] Adminmod file_access_read 0.000000 0
[ 31] Adminmod file_access_write 0.000000 0
[ 32] Adminmod public_slots_free 20.000000 20.000000
[ 33] Adminmod allow_client_exec 0.000000 0
[ 34] Adminmod admin_balance_teams 0.000000 0
34 cvars, 34 available
meta unload stub
Unloaded plugin 'Stub plugin'
Currently loaded plugins:
description stat pend file vers src load unlod
[ 1] Trace HLSDK API RUN - mm_trace_i386.so v0.90 ini ANY Pause
[ 2] adminmod RUN - admin_MM.so v2.11 ini Start Start
2 plugins, 2 running
meta load stub
Loaded plugin 'stub' successfully
Currently loaded plugins:
description stat pend file vers src load unlod
[ 1] Trace HLSDK API RUN - mm_trace_i386.so v0.90 ini ANY Pause
[ 2] adminmod RUN - admin_MM.so v2.11 ini Start Start
[ 3] stub RUN - mm_stub_i386.so v0.90 cmd ANY Pause
3 plugins, 3 running
--------------------------------------------------------------------------

55
doc/txt/newapi_notes.txt Normal file
View File

@ -0,0 +1,55 @@
HLSDK NEWAPI Notes
=-=-=-=-=-=-=-=-=-=
--------------------------------------------------------------------------
- OnFreeEntPrivateData
- GameShutdown
- ShouldCollide
NOTE: No examples of these found in SDK...
--------------------------------------------------------------------------
OnFreeEntPrivateData
void OnFreeEntPrivateData(edict_t pEnt);
from engine/eiface.h:
Called right before the object's memory is freed. Calls its
destructor.
comments:
See also Ken Birdwell on constructors, from the HLCoders list.
Added in SDK 2.0.
--------------------------------------------------------------------------
GameShutdown
void GameShutdown(void);
comments:
Added in SDK 2.0.
--------------------------------------------------------------------------
ShouldCollide
int ShouldCollide(edict_t *pentTouched, edict_t *pentOther);
from kenb@valvesoftware.com, via HLCoders:
..a hook that can override if any two entities should collide when
they try to pass through each other.
comments:
Mugsy from DoD indicates that the return value for normal operation is
1.
Added in SDK 2.0.
--------------------------------------------------------------------------

79
doc/txt/release_notes.txt Normal file
View File

@ -0,0 +1,79 @@
Release Notes
=-=-=-=-=-=-=
Major changes with Metamod 1.17
===============================
- New cvar "metamod_version" that can be queried from client game
browsers.
- New console commands available to clients (much like the existing
server console commands):
- "meta version" prints out version information (date, compile type,
etc).
- "meta list" shows a list of the plugins running on the server
(name, author, version, etc).
- New file config.ini to provide a more reliable and flexible method of
specifying configuration options. At the moment, the recognized
options mirror those from +localinfo, ie:
- debuglevel <number>
- gamedll <path>
- plugins_file <path>
- exec_cfg <path>
- autodetect <yes/no>
- clientmeta <yes/no>
Default path is "addons/metamod/config.ini" but can be overridden with
"+localinfo mm_configfile".
Also, new console command "meta config" to display this information.
- New console command "meta require" to force the server to exit if the
specified plugin isn't loaded/running. Intended for use in server.cfg
or metaexec.cfg, to keep the server from starting up if desired
plugins don't load. For example:
- meta require adminmod
- meta require 1
The former requires that a plugin with the substring "adminmod" is
found loaded and running. The latter requires that the plugin in slot
1 is loaded and running.
- If an override gamedll is specified and found to be invalid or
missing, Metamod will now exit with an appropriate error message,
rather than just falling back to the auto-detected gamedll. This
should provide more immediate and useful feedback, and help prevent
some confusion.
--------------------------------------------------------------------------
Incompatible changes with Metamod 1.13
======================================
- Config file metagame.ini is no longer supported. This file was
deprecated in Metamod 1.08 (2001/06/16). Use instead the "+localinfo
mm_gamedll" option.
Major changes with Metamod 1.13
===============================
- New config file names and locations, per the Addon Development
Standard rev 1.00, developed on the hlds_apps list.
Default config file locations are now:
- $gamedir/addons/metamod/plugins.ini
- $gamedir/addons/metamod/exec.cfg
Previous config file locations are also supported for backwards
compability:
- $gamedir/metamod.ini
- $gamedir/metaexec.cfg
Note that the pathnames in plugins.ini are unchanged, and are still
relative to the gamedir.
--------------------------------------------------------------------------

18
doc/txt/supportedmods.txt Normal file
View File

@ -0,0 +1,18 @@
Supported Mods/Games
=-=-=-=-=-=-=-=
Metamod includes support for the following mods, with version and last
update if known.
To get support added for a new Mod, or for an updated version of a Mod,
see Adding game support.
+------------------------------------------------------------------------+
| Name | Version | Last | Ent | Comments |
| | | update | list | |
|--------------------------------+----------+--------+--------+----------|
| ALL MODS SUPPORTED BY | ALL | | NONE | |
| All-Mod-Support PATCH | | | | |
| By Jussi Kivilinna | | | | |
| http://koti.mbnet.fi/axh/ | | | | |
+------------------------------------------------------------------------+

70
doc/txt/trace.txt Normal file
View File

@ -0,0 +1,70 @@
TraceAPI plugin
=-=-=-=-=-=-=-=
This was originally intended as a (more or less) complete example of a
Metamod plugin. It catches _every_ call available to it (dll routines both
before and after the game, as well as engine functions both before and
after the engine).
Because it catches every routine, I figured I'd give it the ability to log
when given routines are called, so it became an "api tracing" plugin. :)
This can actually be useful for tracking the operation of the HL engine,
as well as that of a particular HL game mod.
It recognizes the following server cvars:
// Tracing debug levels; higher values log increasingly frequent routines.
// Currently 0-50. See "api_info.cpp" for the debug levels of various
// functions.
// Trace level for dllapi routines.
trace_dllapi
// Trace level for "new" dllapi routines.
trace_newapi
// Trace level for engine functions.
trace_engine
// Enable unlimited trace logging. By default (as of v1.06), it only
// logs _one_ trace message per second, to keep from overwhelming the
// server. Set to "1" to enable unlimited logging. (Default "0")
trace_unlimit
// General debug level, independent of trace levels. Not currently used.
trace_debug
and the following server commands:
// Enable tracing of a given routine, independent of "trace_*" level.
// See the list of routine names in "api_info.cpp". Case is insignificant.
trace set <APIroutine>
// Disable tracing of a given routine, iff previously enabled with "trace".
// Doesn't affect routines being logged via "trace_*" level.
trace unset <APIroutine>
// Show the routines being traced.
trace show
// List the various routines that can be traced.
trace list dllapi
trace list newapi
trace list engine
trace list all
// Prints out version/date/etc.
trace version
Note the information it logs on each routine invocation is, at the moment,
relatively minimal. I included information that seemed obvious (args for a
ClientCommand, etc), and I've added info for other routines as I've come
across a need. Most routines I still know too little about to log any
particular information (CreateBaseline, etc). Feel free to add information
that you're interested in to the log messages in the routines; the
examples should be pretty self-explanatory. I'd be interested in knowing
as well, for adding it to the distribution code.
--------------------------------------------------------------------------

32
doc/txt/wdmisc.txt Normal file
View File

@ -0,0 +1,32 @@
WDMisc plugin
=-=-=-=-=-=-=
This is a simple plugin that I use as a testbed for various features and
other things I need to try from a plugin.
It currently provides two features:
- a cvar "bounce" that, if set to 1, will exit the server at map change.
I use this when I need to shutdown or the server, and don't want to
kill it in the middle of a map, nor watch the server constantly until
the timelimit expires.
- it prints a centersay to all the players whenever someone in
Counter-Strike plants the bomb. This was done basically as a
proof-of-concept for catching certain game-events that aren't
otherwise triggered by the HL API. It works only by examining every
log message that the server generates, and checking to see if it
includes the string indicating the particular event in question (in
this case "Planted_The_Bomb").
Although this works, it is really a rather POOR solution to the
problem, as it assumes a LOT of string-compares, which can seriously
degrade the performance of the server. I did try to take as many
short-cuts as reasonable in the code, to decrease the amount of
string-comparing going on, which makes the code a bit less readable
than doing just a "strstr" on the log line.
Other features to be added/removed in the future...
--------------------------------------------------------------------------

110
doc/txt/windows_notes.txt Normal file
View File

@ -0,0 +1,110 @@
# vi: set ts=4 sw=4 :
# vim: set tw=75 :
After writing and testing under linux, I then tried to move the code to
windows, and being unfamiliar with windows coding, I ran into several
issues I wasn't aware of, which I describe here for posterity:
- Apparently the GiveFnptrsToDll() routine has to be declared "WINAPI",
which is a macro for "__stdcall". Without this, the behavior I observed
was that the routine would be called, and would return seemingly okay,
but during the following call to GetNewDLLFunctions, the application
would crash.
This was especially confusing because, using SDK2.1 source for
reference, the use of EXPORT and DLLEXPORT macros seemed inconsistent.
Doing a simple grep for "define.*EXPORT" turns up these definitions:
cl_dll/cl_dll.h: #define EXPORT _declspec( dllexport )
cl_dll/hud_iface.h: #define EXPORT _declspec( dllexport )
dlls/cbase.h: #define EXPORT _declspec( dllexport )
cl_dll/in_defs.h: #define DLLEXPORT __declspec( dllexport )
engine/eiface.h: #define DLLEXPORT __stdcall
Between "EXPORT", "DLLEXPORT", and "dllexport", and then "_declspec" and
"__declspec", they all seemed the same to me. Of course, they aren't.
It seems "__declspec(dllexport)" (I'm still unsure about the single vs
double underscore) simply says that the routine should be visible
externally, outside the DLL. The "__stdcall" specifier, however,
changes the way the stack is cleaned up when the routine returns, and no
doubt having the routine itself using a different convention than the
caller (the engine) caused memory corruption and thus application
crashes. The specifier doesn't seem, to me, to be particularly relative
to DLL exporting per se, so I'd say the macro name was unfortunate and
confusing.
The other confusion was that GiveFnptrsToDll is apparently the _only_
function that needs to be declared __stdcall; declaring the other
external functions (GetEntityAPI, etc) produced MSVC errors and other
problems (as might be expected).
Also, it seems "__declspec" has to be placed _before_ the return type,
whereas "__stdcall" is placed _after_ the return type. Well, at least
in MSVC; mingw appears to be looser.
Further complicating this, the __stdcall generally causes the function
to be given an internal symbol with a trailing "@" and digits specifying
the number of bytes in the function arguments (in this case, "8"). At
least, this is true under the mingw GNU compiler; I couldn't tell if
MSVC was the same. In any case, by default then, the function is
exported as "GiveFnptrsToDll@8()", and the engine can't resolve the name
properly.
In mingw you can apparently alias this to the non-@ name via ".def"
files, but it looked like that if I have a .def file, I'd also have to
list all the entities in linkfunc.cpp (which would be a pain to
maintain). Under MSVC, this didn't appear to be a problem, as both the
SDK source and adminmod source use a ".def" file, but still export all
the other functions okay. I'm not sure why the difference; I may be
missing a mingw link parameter/option.
There are, however, mingw link options (--add-stdcall-alias, --kill-at)
to handle the problem (the first appears to do the job; I'm unsure about
the second), while still exporting all the other necessary functions.
Now, reading MSDN:
http://msdn.microsoft.com/library/devprods/vs6/visualc/vccore/_core_determine_which_exporting_method_to_use.htm
there's apparently an issue of an "export ordinal" and the order of the
list of exported functions, which is solved by using a .def file.
Perhaps this is why the SDK uses a .def file, in which case I may have
problems if I don't specify that GiveFnptrsToDll is the first function
(as the SDK .def file does). Although, perhaps this isn't even an issue
given that the DLL functions are called by name explicitly
(dlsym/GetFuncPointer), rather than being resolved to an library offset
at link time.
In any case, apparently using the conventions in the SDK, and including
the same headers in the same order produces the correct result, but it
wasn't at all clear to me, when looking at the source.
This one was hard for me to track down, and I also found this page to
be helpful:
http://www.geocities.com/Tokyo/Towers/6162/win32/dll/make.html
- Linux appears to be either (a) much more forgiving about improper
pointer references in memcpy, or (b) laying out its memory in a manner
that hides problems with that. In my case, I had:
DLL_FUNCTIONS *dllapi_table;
dllapi_table=malloc(...)
memcpy(pFunctionTable, &dllapi_table, sizeof(DLL_FUNCTIONS));
Since the argument is already a pointer, the extra "&" is improper, and
should instead be:
memcpy(pFunctionTable, dllapi_table, sizeof(DLL_FUNCTIONS));
Under linux, it didn't seem to be a problem, and program operation was
(as far as I could tell) correct. Under windows, though, I got program
crashes after calling the 4th or 5th entity in linkfunc.cpp. It
wasn't at all obvious what the problem was, and took quite a while to
track down.
- missing functions (strtok_r, snprintf)
- missing macros (PATH_MAX, NAME_MAX)
- dlerror, getlasterror
- LoadLibrary returning 0 on failure (vs dlclose returning 0 on success)
- limits.h under mingw

64
hlsdk/common/beamdef.h Normal file
View File

@ -0,0 +1,64 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined ( BEAMDEFH )
#define BEAMDEFH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
#define FBEAM_STARTENTITY 0x00000001
#define FBEAM_ENDENTITY 0x00000002
#define FBEAM_FADEIN 0x00000004
#define FBEAM_FADEOUT 0x00000008
#define FBEAM_SINENOISE 0x00000010
#define FBEAM_SOLID 0x00000020
#define FBEAM_SHADEIN 0x00000040
#define FBEAM_SHADEOUT 0x00000080
#define FBEAM_STARTVISIBLE 0x10000000 // Has this client actually seen this beam's start entity yet?
#define FBEAM_ENDVISIBLE 0x20000000 // Has this client actually seen this beam's end entity yet?
#define FBEAM_ISACTIVE 0x40000000
#define FBEAM_FOREVER 0x80000000
typedef struct beam_s BEAM;
struct beam_s
{
BEAM *next;
int type;
int flags;
vec3_t source;
vec3_t target;
vec3_t delta;
float t; // 0 .. 1 over lifetime of beam
float freq;
float die;
float width;
float amplitude;
float r, g, b;
float brightness;
float speed;
float frameRate;
float frame;
int segments;
int startEntity;
int endEntity;
int modelIndex;
int frameCount;
struct model_s *pFollowModel;
struct particle_s *particles;
};
#endif

117
hlsdk/common/cl_entity.h Normal file
View File

@ -0,0 +1,117 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
// cl_entity.h
#if !defined( CL_ENTITYH )
#define CL_ENTITYH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef struct efrag_s
{
struct mleaf_s *leaf;
struct efrag_s *leafnext;
struct cl_entity_s *entity;
struct efrag_s *entnext;
} efrag_t;
typedef struct
{
byte mouthopen; // 0 = mouth closed, 255 = mouth agape
byte sndcount; // counter for running average
int sndavg; // running average
} mouth_t;
typedef struct
{
float prevanimtime;
float sequencetime;
byte prevseqblending[2];
vec3_t prevorigin;
vec3_t prevangles;
int prevsequence;
float prevframe;
byte prevcontroller[4];
byte prevblending[2];
} latchedvars_t;
typedef struct
{
// Time stamp for this movement
float animtime;
vec3_t origin;
vec3_t angles;
} position_history_t;
typedef struct cl_entity_s cl_entity_t;
#define HISTORY_MAX 64 // Must be power of 2
#define HISTORY_MASK ( HISTORY_MAX - 1 )
#if !defined( ENTITY_STATEH )
#include "entity_state.h"
#endif
#if !defined( PROGS_H )
#include "progs.h"
#endif
struct cl_entity_s
{
int index; // Index into cl_entities ( should match actual slot, but not necessarily )
qboolean player; // True if this entity is a "player"
entity_state_t baseline; // The original state from which to delta during an uncompressed message
entity_state_t prevstate; // The state information from the penultimate message received from the server
entity_state_t curstate; // The state information from the last message received from server
int current_position; // Last received history update index
position_history_t ph[ HISTORY_MAX ]; // History of position and angle updates for this player
mouth_t mouth; // For synchronizing mouth movements.
latchedvars_t latched; // Variables used by studio model rendering routines
// Information based on interplocation, extrapolation, prediction, or just copied from last msg received.
//
float lastmove;
// Actual render position and angles
vec3_t origin;
vec3_t angles;
// Attachment points
vec3_t attachment[4];
// Other entity local information
int trivial_accept;
struct model_s *model; // cl.model_precache[ curstate.modelindes ]; all visible entities have a model
struct efrag_s *efrag; // linked list of efrags
struct mnode_s *topnode; // for bmodels, first world node that splits bmodel, or NULL if not split
float syncbase; // for client-side animations -- used by obsolete alias animation system, remove?
int visframe; // last frame this entity was found in an active leaf
colorVec cvFloorColor;
};
#endif // !CL_ENTITYH

353
hlsdk/common/com_model.h Normal file
View File

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

33
hlsdk/common/con_nprint.h Normal file
View File

@ -0,0 +1,33 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( CON_NPRINTH )
#define CON_NPRINTH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef struct con_nprint_s
{
int index; // Row #
float time_to_live; // # of seconds before it dissappears
float color[ 3 ]; // RGB colors ( 0.0 -> 1.0 scale )
} con_nprint_t;
void Con_NPrintf( int idx, char *fmt, ... );
void Con_NXPrintf( struct con_nprint_s *info, char *fmt, ... );
#endif

771
hlsdk/common/const.h Normal file
View File

@ -0,0 +1,771 @@
/***
*
* Copyright (c) 1999, 2000, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef CONST_H
#define CONST_H
//
// Constants shared by the engine and dlls
// This header file included by engine files and DLL files.
// Most came from server.h
// edict->flags
#define FL_FLY (1<<0) // Changes the SV_Movestep() behavior to not need to be on ground
#define FL_SWIM (1<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
#define FL_CONVEYOR (1<<2)
#define FL_CLIENT (1<<3)
#define FL_INWATER (1<<4)
#define FL_MONSTER (1<<5)
#define FL_GODMODE (1<<6)
#define FL_NOTARGET (1<<7)
#define FL_SKIPLOCALHOST (1<<8) // Don't send entity to local host, it's predicting this entity itself
#define FL_ONGROUND (1<<9) // At rest / on the ground
#define FL_PARTIALGROUND (1<<10) // not all corners are valid
#define FL_WATERJUMP (1<<11) // player jumping out of water
#define FL_FROZEN (1<<12) // Player is frozen for 3rd person camera
#define FL_FAKECLIENT (1<<13) // JAC: fake client, simulated server side; don't send network messages to them
#define FL_DUCKING (1<<14) // Player flag -- Player is fully crouched
#define FL_FLOAT (1<<15) // Apply floating force to this entity when in water
#define FL_GRAPHED (1<<16) // worldgraph has this ent listed as something that blocks a connection
// UNDONE: Do we need these?
#define FL_IMMUNE_WATER (1<<17)
#define FL_IMMUNE_SLIME (1<<18)
#define FL_IMMUNE_LAVA (1<<19)
#define FL_PROXY (1<<20) // This is a spectator proxy
#define FL_ALWAYSTHINK (1<<21) // Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path)
#define FL_BASEVELOCITY (1<<22) // Base velocity has been applied this frame (used to convert base velocity into momentum)
#define FL_MONSTERCLIP (1<<23) // Only collide in with monsters who have FL_MONSTERCLIP set
#define FL_ONTRAIN (1<<24) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
#define FL_WORLDBRUSH (1<<25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)
#define FL_SPECTATOR (1<<26) // This client is a spectator, don't run touch functions, etc.
#define FL_CUSTOMENTITY (1<<29) // This is a custom entity
#define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
#define FL_DORMANT (1<<31) // Entity is dormant, no updates to client
// Goes into globalvars_t.trace_flags
#define FTRACE_SIMPLEBOX (1<<0) // Traceline with a simple box
// walkmove modes
#define WALKMOVE_NORMAL 0 // normal walkmove
#define WALKMOVE_WORLDONLY 1 // doesn't hit ANY entities, no matter what the solid type
#define WALKMOVE_CHECKONLY 2 // move, but don't touch triggers
// edict->movetype values
#define MOVETYPE_NONE 0 // never moves
//#define MOVETYPE_ANGLENOCLIP 1
//#define MOVETYPE_ANGLECLIP 2
#define MOVETYPE_WALK 3 // Player only - moving on the ground
#define MOVETYPE_STEP 4 // gravity, special edge handling -- monsters use this
#define MOVETYPE_FLY 5 // No gravity, but still collides with stuff
#define MOVETYPE_TOSS 6 // gravity/collisions
#define MOVETYPE_PUSH 7 // no clip to world, push and crush
#define MOVETYPE_NOCLIP 8 // No gravity, no collisions, still do velocity/avelocity
#define MOVETYPE_FLYMISSILE 9 // extra size to monsters
#define MOVETYPE_BOUNCE 10 // Just like Toss, but reflect velocity when contacting surfaces
#define MOVETYPE_BOUNCEMISSILE 11 // bounce w/o gravity
#define MOVETYPE_FOLLOW 12 // track movement of aiment
#define MOVETYPE_PUSHSTEP 13 // BSP model that needs physics/world collisions (uses nearest hull for world collision)
// edict->solid values
// NOTE: Some movetypes will cause collisions independent of SOLID_NOT/SOLID_TRIGGER when the entity moves
// SOLID only effects OTHER entities colliding with this one when they move - UGH!
#define SOLID_NOT 0 // no interaction with other objects
#define SOLID_TRIGGER 1 // touch on edge, but not blocking
#define SOLID_BBOX 2 // touch on edge, block
#define SOLID_SLIDEBOX 3 // touch on edge, but not an onground
#define SOLID_BSP 4 // bsp clip, touch on edge, block
// edict->deadflag values
#define DEAD_NO 0 // alive
#define DEAD_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground
#define DEAD_DEAD 2 // dead. lying still.
#define DEAD_RESPAWNABLE 3
#define DEAD_DISCARDBODY 4
#define DAMAGE_NO 0
#define DAMAGE_YES 1
#define DAMAGE_AIM 2
// entity effects
#define EF_BRIGHTFIELD 1 // swirling cloud of particles
#define EF_MUZZLEFLASH 2 // single frame ELIGHT on entity attachment 0
#define EF_BRIGHTLIGHT 4 // DLIGHT centered at entity origin
#define EF_DIMLIGHT 8 // player flashlight
#define EF_INVLIGHT 16 // get lighting from ceiling
#define EF_NOINTERP 32 // don't interpolate the next frame
#define EF_LIGHT 64 // rocket flare glow sprite
#define EF_NODRAW 128 // don't draw entity
// entity flags
#define EFLAG_SLERP 1 // do studio interpolation of this entity
//
// temp entity events
//
#define TE_BEAMPOINTS 0 // beam effect between two points
// coord coord coord (start position)
// coord coord coord (end position)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMENTPOINT 1 // beam effect between point and entity
// short (start entity)
// coord coord coord (end position)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_GUNSHOT 2 // particle effect plus ricochet sound
// coord coord coord (position)
#define TE_EXPLOSION 3 // additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps
// coord coord coord (position)
// short (sprite index)
// byte (scale in 0.1's)
// byte (framerate)
// byte (flags)
//
// The Explosion effect has some flags to control performance/aesthetic features:
#define TE_EXPLFLAG_NONE 0 // all flags clear makes default Half-Life explosion
#define TE_EXPLFLAG_NOADDITIVE 1 // sprite will be drawn opaque (ensure that the sprite you send is a non-additive sprite)
#define TE_EXPLFLAG_NODLIGHTS 2 // do not render dynamic lights
#define TE_EXPLFLAG_NOSOUND 4 // do not play client explosion sound
#define TE_EXPLFLAG_NOPARTICLES 8 // do not draw particles
#define TE_TAREXPLOSION 4 // Quake1 "tarbaby" explosion with sound
// coord coord coord (position)
#define TE_SMOKE 5 // alphablend sprite, move vertically 30 pps
// coord coord coord (position)
// short (sprite index)
// byte (scale in 0.1's)
// byte (framerate)
#define TE_TRACER 6 // tracer effect from point to point
// coord, coord, coord (start)
// coord, coord, coord (end)
#define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters
// coord, coord, coord (start)
// coord, coord, coord (end)
// byte (life in 0.1's)
// byte (width in 0.1's)
// byte (amplitude in 0.01's)
// short (sprite model index)
#define TE_BEAMENTS 8
// short (start entity)
// short (end entity)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_SPARKS 9 // 8 random tracers with gravity, ricochet sprite
// coord coord coord (position)
#define TE_LAVASPLASH 10 // Quake1 lava splash
// coord coord coord (position)
#define TE_TELEPORT 11 // Quake1 teleport splash
// coord coord coord (position)
#define TE_EXPLOSION2 12 // Quake1 colormaped (base palette) particle explosion with sound
// coord coord coord (position)
// byte (starting color)
// byte (num colors)
#define TE_BSPDECAL 13 // Decal from the .BSP file
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// short (texture index of precached decal texture name)
// short (entity index)
// [optional - only included if previous short is non-zero (not the world)] short (index of model of above entity)
#define TE_IMPLOSION 14 // tracers moving toward a point
// coord, coord, coord (position)
// byte (radius)
// byte (count)
// byte (life in 0.1's)
#define TE_SPRITETRAIL 15 // line of moving glow sprites with gravity, fadeout, and collisions
// coord, coord, coord (start)
// coord, coord, coord (end)
// short (sprite index)
// byte (count)
// byte (life in 0.1's)
// byte (scale in 0.1's)
// byte (velocity along vector in 10's)
// byte (randomness of velocity in 10's)
#define TE_BEAM 16 // obsolete
#define TE_SPRITE 17 // additive sprite, plays 1 cycle
// coord, coord, coord (position)
// short (sprite index)
// byte (scale in 0.1's)
// byte (brightness)
#define TE_BEAMSPRITE 18 // A beam with a sprite at the end
// coord, coord, coord (start position)
// coord, coord, coord (end position)
// short (beam sprite index)
// short (end sprite index)
#define TE_BEAMTORUS 19 // screen aligned beam ring, expands to max radius over lifetime
// coord coord coord (center position)
// coord coord coord (axis and radius)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMDISK 20 // disk that expands to max radius over lifetime
// coord coord coord (center position)
// coord coord coord (axis and radius)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMCYLINDER 21 // cylinder that expands to max radius over lifetime
// coord coord coord (center position)
// coord coord coord (axis and radius)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMFOLLOW 22 // create a line of decaying beam segments until entity stops moving
// short (entity:attachment to follow)
// short (sprite index)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte,byte,byte (color)
// byte (brightness)
#define TE_GLOWSPRITE 23
// coord, coord, coord (pos) short (model index) byte (scale / 10)
#define TE_BEAMRING 24 // connect a beam ring to two entities
// short (start entity)
// short (end entity)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_STREAK_SPLASH 25 // oriented shower of tracers
// coord coord coord (start position)
// coord coord coord (direction vector)
// byte (color)
// short (count)
// short (base speed)
// short (ramdon velocity)
#define TE_BEAMHOSE 26 // obsolete
#define TE_DLIGHT 27 // dynamic light, effect world, minor entity effect
// coord, coord, coord (pos)
// byte (radius in 10's)
// byte byte byte (color)
// byte (brightness)
// byte (life in 10's)
// byte (decay rate in 10's)
#define TE_ELIGHT 28 // point entity light, no world effect
// short (entity:attachment to follow)
// coord coord coord (initial position)
// coord (radius)
// byte byte byte (color)
// byte (life in 0.1's)
// coord (decay rate)
#define TE_TEXTMESSAGE 29
// short 1.2.13 x (-1 = center)
// short 1.2.13 y (-1 = center)
// byte Effect 0 = fade in/fade out
// 1 is flickery credits
// 2 is write out (training room)
// 4 bytes r,g,b,a color1 (text color)
// 4 bytes r,g,b,a color2 (effect color)
// ushort 8.8 fadein time
// ushort 8.8 fadeout time
// ushort 8.8 hold time
// optional ushort 8.8 fxtime (time the highlight lags behing the leading text in effect 2)
// string text message (512 chars max sz string)
#define TE_LINE 30
// coord, coord, coord startpos
// coord, coord, coord endpos
// short life in 0.1 s
// 3 bytes r, g, b
#define TE_BOX 31
// coord, coord, coord boxmins
// coord, coord, coord boxmaxs
// short life in 0.1 s
// 3 bytes r, g, b
#define TE_KILLBEAM 99 // kill all beams attached to entity
// short (entity)
#define TE_LARGEFUNNEL 100
// coord coord coord (funnel position)
// short (sprite index)
// short (flags)
#define TE_BLOODSTREAM 101 // particle spray
// coord coord coord (start position)
// coord coord coord (spray vector)
// byte (color)
// byte (speed)
#define TE_SHOWLINE 102 // line of particles every 5 units, dies in 30 seconds
// coord coord coord (start position)
// coord coord coord (end position)
#define TE_BLOOD 103 // particle spray
// coord coord coord (start position)
// coord coord coord (spray vector)
// byte (color)
// byte (speed)
#define TE_DECAL 104 // Decal applied to a brush entity (not the world)
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// byte (texture index of precached decal texture name)
// short (entity index)
#define TE_FIZZ 105 // create alpha sprites inside of entity, float upwards
// short (entity)
// short (sprite index)
// byte (density)
#define TE_MODEL 106 // create a moving model that bounces and makes a sound when it hits
// coord, coord, coord (position)
// coord, coord, coord (velocity)
// angle (initial yaw)
// short (model index)
// byte (bounce sound type)
// byte (life in 0.1's)
#define TE_EXPLODEMODEL 107 // spherical shower of models, picks from set
// coord, coord, coord (origin)
// coord (velocity)
// short (model index)
// short (count)
// byte (life in 0.1's)
#define TE_BREAKMODEL 108 // box of models or sprites
// coord, coord, coord (position)
// coord, coord, coord (size)
// coord, coord, coord (velocity)
// byte (random velocity in 10's)
// short (sprite or model index)
// byte (count)
// byte (life in 0.1 secs)
// byte (flags)
#define TE_GUNSHOTDECAL 109 // decal and ricochet sound
// coord, coord, coord (position)
// short (entity index???)
// byte (decal???)
#define TE_SPRITE_SPRAY 110 // spay of alpha sprites
// coord, coord, coord (position)
// coord, coord, coord (velocity)
// short (sprite index)
// byte (count)
// byte (speed)
// byte (noise)
#define TE_ARMOR_RICOCHET 111 // quick spark sprite, client ricochet sound.
// coord, coord, coord (position)
// byte (scale in 0.1's)
#define TE_PLAYERDECAL 112 // ???
// byte (playerindex)
// coord, coord, coord (position)
// short (entity???)
// byte (decal number???)
// [optional] short (model index???)
#define TE_BUBBLES 113 // create alpha sprites inside of box, float upwards
// coord, coord, coord (min start position)
// coord, coord, coord (max start position)
// coord (float height)
// short (model index)
// byte (count)
// coord (speed)
#define TE_BUBBLETRAIL 114 // create alpha sprites along a line, float upwards
// coord, coord, coord (min start position)
// coord, coord, coord (max start position)
// coord (float height)
// short (model index)
// byte (count)
// coord (speed)
#define TE_BLOODSPRITE 115 // spray of opaque sprite1's that fall, single sprite2 for 1..2 secs (this is a high-priority tent)
// coord, coord, coord (position)
// short (sprite1 index)
// short (sprite2 index)
// byte (color)
// byte (scale)
#define TE_WORLDDECAL 116 // Decal applied to the world brush
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// byte (texture index of precached decal texture name)
#define TE_WORLDDECALHIGH 117 // Decal (with texture index > 256) applied to world brush
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// byte (texture index of precached decal texture name - 256)
#define TE_DECALHIGH 118 // Same as TE_DECAL, but the texture index was greater than 256
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// byte (texture index of precached decal texture name - 256)
// short (entity index)
#define TE_PROJECTILE 119 // Makes a projectile (like a nail) (this is a high-priority tent)
// coord, coord, coord (position)
// coord, coord, coord (velocity)
// short (modelindex)
// byte (life)
// byte (owner) projectile won't collide with owner (if owner == 0, projectile will hit any client).
#define TE_SPRAY 120 // Throws a shower of sprites or models
// coord, coord, coord (position)
// coord, coord, coord (direction)
// short (modelindex)
// byte (count)
// byte (speed)
// byte (noise)
// byte (rendermode)
#define TE_PLAYERSPRITES 121 // sprites emit from a player's bounding box (ONLY use for players!)
// byte (playernum)
// short (sprite modelindex)
// byte (count)
// byte (variance) (0 = no variance in size) (10 = 10% variance in size)
#define TE_PARTICLEBURST 122 // very similar to lavasplash.
// coord (origin)
// short (radius)
// byte (particle color)
// byte (duration * 10) (will be randomized a bit)
#define TE_FIREFIELD 123 // makes a field of fire.
// coord (origin)
// short (radius) (fire is made in a square around origin. -radius, -radius to radius, radius)
// short (modelindex)
// byte (count)
// byte (flags)
// byte (duration (in seconds) * 10) (will be randomized a bit)
//
// to keep network traffic low, this message has associated flags that fit into a byte:
#define TEFIRE_FLAG_ALLFLOAT 1 // all sprites will drift upwards as they animate
#define TEFIRE_FLAG_SOMEFLOAT 2 // some of the sprites will drift upwards. (50% chance)
#define TEFIRE_FLAG_LOOP 4 // if set, sprite plays at 15 fps, otherwise plays at whatever rate stretches the animation over the sprite's duration.
#define TEFIRE_FLAG_ALPHA 8 // if set, sprite is rendered alpha blended at 50% else, opaque
#define TEFIRE_FLAG_PLANAR 16 // if set, all fire sprites have same initial Z instead of randomly filling a cube.
#define TE_PLAYERATTACHMENT 124 // attaches a TENT to a player (this is a high-priority tent)
// byte (entity index of player)
// coord (vertical offset) ( attachment origin.z = player origin.z + vertical offset )
// short (model index)
// short (life * 10 );
#define TE_KILLPLAYERATTACHMENTS 125 // will expire all TENTS attached to a player.
// byte (entity index of player)
#define TE_MULTIGUNSHOT 126 // much more compact shotgun message
// This message is used to make a client approximate a 'spray' of gunfire.
// Any weapon that fires more than one bullet per frame and fires in a bit of a spread is
// a good candidate for MULTIGUNSHOT use. (shotguns)
//
// NOTE: This effect makes the client do traces for each bullet, these client traces ignore
// entities that have studio models.Traces are 4096 long.
//
// coord (origin)
// coord (origin)
// coord (origin)
// coord (direction)
// coord (direction)
// coord (direction)
// coord (x noise * 100)
// coord (y noise * 100)
// byte (count)
// byte (bullethole decal texture index)
#define TE_USERTRACER 127 // larger message than the standard tracer, but allows some customization.
// coord (origin)
// coord (origin)
// coord (origin)
// coord (velocity)
// coord (velocity)
// coord (velocity)
// byte ( life * 10 )
// byte ( color ) this is an index into an array of color vectors in the engine. (0 - )
// byte ( length * 10 )
#define MSG_BROADCAST 0 // unreliable to all
#define MSG_ONE 1 // reliable to one (msg_entity)
#define MSG_ALL 2 // reliable to all
#define MSG_INIT 3 // write to the init string
#define MSG_PVS 4 // Ents in PVS of org
#define MSG_PAS 5 // Ents in PAS of org
#define MSG_PVS_R 6 // Reliable to PVS
#define MSG_PAS_R 7 // Reliable to PAS
#define MSG_ONE_UNRELIABLE 8 // Send to one client, but don't put in reliable stream, put in unreliable datagram ( could be dropped )
#define MSG_SPEC 9 // Sends to all spectator proxies
// contents of a spot in the world
#define CONTENTS_EMPTY -1
#define CONTENTS_SOLID -2
#define CONTENTS_WATER -3
#define CONTENTS_SLIME -4
#define CONTENTS_LAVA -5
#define CONTENTS_SKY -6
/* These additional contents constants are defined in bspfile.h
#define CONTENTS_ORIGIN -7 // removed at csg time
#define CONTENTS_CLIP -8 // changed to contents_solid
#define CONTENTS_CURRENT_0 -9
#define CONTENTS_CURRENT_90 -10
#define CONTENTS_CURRENT_180 -11
#define CONTENTS_CURRENT_270 -12
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_DOWN -14
#define CONTENTS_TRANSLUCENT -15
*/
#define CONTENTS_LADDER -16
#define CONTENT_EMPTY -1
#define CONTENT_SOLID -2
#define CONTENT_WATER -3
#define CONTENT_SLIME -4
#define CONTENT_LAVA -5
#define CONTENT_SKY -6
// channels
#define CHAN_AUTO 0
#define CHAN_WEAPON 1
#define CHAN_VOICE 2
#define CHAN_ITEM 3
#define CHAN_BODY 4
#define CHAN_STREAM 5 // allocate stream channel from the static or dynamic area
#define CHAN_STATIC 6 // allocate channel from the static area
#define CHAN_NETWORKVOICE_BASE 7 // voice data coming across the network
#define CHAN_NETWORKVOICE_END 500 // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END).
// attenuation values
#define ATTN_NONE 0
#define ATTN_NORM (float)0.8
#define ATTN_IDLE (float)2
#define ATTN_STATIC (float)1.25
// pitch values
#define PITCH_NORM 100 // non-pitch shifted
#define PITCH_LOW 95 // other values are possible - 0-255, where 255 is very high
#define PITCH_HIGH 120
// volume values
#define VOL_NORM 1.0
// plats
#define PLAT_LOW_TRIGGER 1
// Trains
#define SF_TRAIN_WAIT_RETRIGGER 1
#define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains
// buttons
#ifndef IN_BUTTONS_H
#include "in_buttons.h"
#endif
// Break Model Defines
#define BREAK_TYPEMASK 0x4F
#define BREAK_GLASS 0x01
#define BREAK_METAL 0x02
#define BREAK_FLESH 0x04
#define BREAK_WOOD 0x08
#define BREAK_SMOKE 0x10
#define BREAK_TRANS 0x20
#define BREAK_CONCRETE 0x40
#define BREAK_2 0x80
// Colliding temp entity sounds
#define BOUNCE_GLASS BREAK_GLASS
#define BOUNCE_METAL BREAK_METAL
#define BOUNCE_FLESH BREAK_FLESH
#define BOUNCE_WOOD BREAK_WOOD
#define BOUNCE_SHRAP 0x10
#define BOUNCE_SHELL 0x20
#define BOUNCE_CONCRETE BREAK_CONCRETE
#define BOUNCE_SHOTSHELL 0x80
// Temp entity bounce sound types
#define TE_BOUNCE_NULL 0
#define TE_BOUNCE_SHELL 1
#define TE_BOUNCE_SHOTSHELL 2
// Rendering constants
enum
{
kRenderNormal, // src
kRenderTransColor, // c*a+dest*(1-a)
kRenderTransTexture, // src*a+dest*(1-a)
kRenderGlow, // src*a+dest -- No Z buffer checks
kRenderTransAlpha, // src*srca+dest*(1-srca)
kRenderTransAdd, // src*a+dest
};
enum
{
kRenderFxNone = 0,
kRenderFxPulseSlow,
kRenderFxPulseFast,
kRenderFxPulseSlowWide,
kRenderFxPulseFastWide,
kRenderFxFadeSlow,
kRenderFxFadeFast,
kRenderFxSolidSlow,
kRenderFxSolidFast,
kRenderFxStrobeSlow,
kRenderFxStrobeFast,
kRenderFxStrobeFaster,
kRenderFxFlickerSlow,
kRenderFxFlickerFast,
kRenderFxNoDissipation,
kRenderFxDistort, // Distort/scale/translate flicker
kRenderFxHologram, // kRenderFxDistort + distance fade
kRenderFxDeadPlayer, // kRenderAmt is the player index
kRenderFxExplode, // Scale up really big!
kRenderFxGlowShell, // Glowing Shell
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
};
typedef int func_t;
typedef int string_t;
typedef unsigned char byte;
typedef unsigned short word;
#define _DEF_BYTE_
#undef true
#undef false
#ifndef __cplusplus
typedef enum {false, true} qboolean;
#else
typedef int qboolean;
#endif
typedef struct
{
byte r, g, b;
} color24;
typedef struct
{
unsigned r, g, b, a;
} colorVec;
#ifdef _WIN32
#pragma pack(push,2)
#endif
typedef struct
{
unsigned short r, g, b, a;
} PackedColorVec;
#ifdef _WIN32
#pragma pack(pop)
#endif
typedef struct link_s
{
struct link_s *prev, *next;
} link_t;
typedef struct edict_s edict_t;
typedef struct
{
vec3_t normal;
float dist;
} plane_t;
typedef struct
{
qboolean allsolid; // if true, plane is not valid
qboolean startsolid; // if true, the initial point was in a solid area
qboolean inopen, inwater;
float fraction; // time completed, 1.0 = didn't hit anything
vec3_t endpos; // final position
plane_t plane; // surface normal at impact
edict_t *ent; // entity the surface is on
int hitgroup; // 0 == generic, non zero is specific body part
} trace_t;
#endif

54
hlsdk/common/crc.h Normal file
View File

@ -0,0 +1,54 @@
/***
*
* Copyright (c) 1999, 2000, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
/* crc.h */
#ifndef CRC_H
#define CRC_H
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
// MD5 Hash
typedef struct
{
unsigned int buf[4];
unsigned int bits[2];
unsigned char in[64];
} MD5Context_t;
typedef unsigned long CRC32_t;
void CRC32_Init(CRC32_t *pulCRC);
CRC32_t CRC32_Final(CRC32_t pulCRC);
void CRC32_ProcessBuffer(CRC32_t *pulCRC, void *p, int len);
void CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch);
int CRC_File(CRC32_t *crcvalue, char *pszFileName);
unsigned char COM_BlockSequenceCRCByte (unsigned char *base, int length, int sequence);
void MD5Init(MD5Context_t *context);
void MD5Update(MD5Context_t *context, unsigned char const *buf,
unsigned int len);
void MD5Final(unsigned char digest[16], MD5Context_t *context);
void Transform(unsigned int buf[4], unsigned int const in[16]);
int MD5_Hash_File(unsigned char digest[16], char *pszFileName, int bUsefopen, int bSeed, unsigned int seed[4]);
char *MD5_Print(unsigned char hash[16]);
int MD5_Hash_CachedFile(unsigned char digest[16], unsigned char *pCache, int nFileSize, int bSeed, unsigned int seed[4]);
int CRC_MapFile(CRC32_t *crcvalue, char *pszFileName);
#endif

36
hlsdk/common/cvardef.h Normal file
View File

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

33
hlsdk/common/demo_api.h Normal file
View File

@ -0,0 +1,33 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined ( DEMO_APIH )
#define DEMO_APIH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef struct demo_api_s
{
int ( *IsRecording ) ( void );
int ( *IsPlayingback ) ( void );
int ( *IsTimeDemo ) ( void );
void ( *WriteBuffer ) ( int size, unsigned char *buffer );
} demo_api_t;
extern demo_api_t demoapi;
#endif

View File

@ -0,0 +1,38 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
// director_cmds.h
// sub commands for svc_director
#define DRC_ACTIVE 0 // tells client that he's an spectator and will get director command
#define DRC_STATUS 1 // send status infos about proxy
#define DRC_CAMERA 2 // set the actual director camera position
#define DRC_EVENT 3 // informs the dircetor about ann important game event
#define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important)
#define DRC_FLAG_SIDE (1<<4)
#define DRC_FLAG_DRAMATIC (1<<5)
// commands of the director API function CallDirectorProc(...)
#define DRCAPI_NOP 0 // no operation
#define DRCAPI_ACTIVE 1 // de/acivates director mode in engine
#define DRCAPI_STATUS 2 // request proxy information
#define DRCAPI_SETCAM 3 // set camera n to given position and angle
#define DRCAPI_GETCAM 4 // request camera n position and angle
#define DRCAPI_DIRPLAY 5 // set director time and play with normal speed
#define DRCAPI_DIRFREEZE 6 // freeze directo at this time
#define DRCAPI_SETVIEWMODE 7 // overview or 4 cameras
#define DRCAPI_SETOVERVIEWPARAMS 8 // sets parameter for overview mode
#define DRCAPI_SETFOCUS 9 // set the camera which has the input focus
#define DRCAPI_GETTARGETS 10 // queries engine for player list
#define DRCAPI_SETVIEWPOINTS 11 // gives engine all waypoints

35
hlsdk/common/dlight.h Normal file
View File

@ -0,0 +1,35 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined ( DLIGHTH )
#define DLIGHTH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef struct dlight_s
{
vec3_t origin;
float radius;
color24 color;
float die; // stop lighting after this time
float decay; // drop this each second
float minlight; // don't add when contributing less
int key;
qboolean dark; // subtracts light instead of adding
} dlight_t;
#endif

23
hlsdk/common/dll_state.h Normal file
View File

@ -0,0 +1,23 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
//DLL State Flags
#define DLL_INACTIVE 0 // no dll
#define DLL_ACTIVE 1 // dll is running
#define DLL_PAUSED 2 // dll is paused
#define DLL_CLOSE 3 // closing down dll
#define DLL_TRANS 4 // Level Transition
// DLL Pause reasons
#define DLL_NORMAL 0 // User hit Esc or something.
#define DLL_QUIT 4 // Quit now
#define DLL_RESTART 6 // Switch to launcher for linux, does a quit but returns 1
// DLL Substate info ( not relevant )
#define ENG_NORMAL (1<<0)

View File

@ -0,0 +1,112 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
// engine/launcher interface
#if !defined( ENGINE_LAUNCHER_APIH )
#define ENGINE_LAUNCHER_APIH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
//typedef void ( *xcommand_t ) ( void );
#define RENDERTYPE_UNDEFINED 0
#define RENDERTYPE_SOFTWARE 1
#define RENDERTYPE_HARDWARE 2
#define ENGINE_LAUNCHER_API_VERSION 1
typedef struct engine_api_s
{
int version;
int rendertype;
int size;
// Functions
int ( *GetEngineState ) ( void );
void ( *Cbuf_AddText ) ( char *text ); // append cmd at end of buf
void ( *Cbuf_InsertText ) ( char *text ); // insert cmd at start of buf
void ( *Cmd_AddCommand ) ( char *cmd_name, void ( *funcname )( void ) );
int ( *Cmd_Argc ) ( void );
char *( *Cmd_Args ) ( void );
char *( *Cmd_Argv ) ( int arg );
void ( *Con_Printf ) ( char *, ... );
void ( *Con_SafePrintf ) ( char *, ... );
void ( *Cvar_Set ) ( char *var_name, char *value );
void ( *Cvar_SetValue ) ( char *var_name, float value );
int ( *Cvar_VariableInt ) ( char *var_name );
char *( *Cvar_VariableString ) ( char *var_name );
float ( *Cvar_VariableValue ) ( char *var_name );
void ( *ForceReloadProfile ) ( void );
int ( *GetGameInfo ) ( struct GameInfo_s *pGI, char *pszChannel );
void ( *GameSetBackground ) ( int bBack );
void ( *GameSetState ) ( int iState );
void ( *GameSetSubState ) ( int iState );
int ( *GetPauseState ) ( void );
int ( *Host_Frame ) ( float time, int iState, int *stateInfo );
void ( *Host_GetHostInfo ) ( float *fps, int *nActive, int *nSpectators, int *nMaxPlayers, char *pszMap );
void ( *Host_Shutdown ) ( void );
int ( *Game_Init ) ( char *lpCmdLine, unsigned char *pMem, int iSize, struct exefuncs_s *pef, void *, int );
void ( *IN_ActivateMouse ) ( void );
void ( *IN_ClearStates ) ( void );
void ( *IN_DeactivateMouse ) ( void );
void ( *IN_MouseEvent ) ( int mstate );
void ( *Keyboard_ReturnToGame ) ( void );
void ( *Key_ClearStates ) ( void );
void ( *Key_Event ) ( int key, int down );
int ( *LoadGame ) ( const char *pszSlot );
void ( *S_BlockSound ) ( void );
void ( *S_ClearBuffer ) ( void );
void ( *S_GetDSPointer ) ( struct IDirectSound **lpDS, struct IDirectSoundBuffer **lpDSBuf );
void *( *S_GetWAVPointer ) ( void );
void ( *S_UnblockSound ) ( void );
int ( *SaveGame ) ( const char *pszSlot, const char *pszComment );
void ( *SetAuth ) ( void *pobj );
void ( *SetMessagePumpDisableMode ) ( int bMode );
void ( *SetPauseState ) ( int bPause );
void ( *SetStartupMode ) ( int bMode );
void ( *SNDDMA_Shutdown ) ( void );
void ( *Snd_AcquireBuffer ) ( void );
void ( *Snd_ReleaseBuffer ) ( void );
void ( *StoreProfile ) ( void );
double ( *Sys_FloatTime ) ( void );
void ( *VID_UpdateWindowVars ) ( void *prc, int x, int y );
void ( *VID_UpdateVID ) ( struct viddef_s *pvid );
// VGUI interfaces
void ( *VGui_CallEngineSurfaceProc ) ( void* hwnd, unsigned int msg, unsigned int wparam, long lparam );
// notifications that the launcher is taking/giving focus to the engine
void ( *EngineTakingFocus ) ( void );
void ( *LauncherTakingFocus ) ( void );
#ifdef _WIN32
// Only filled in by rendertype RENDERTYPE_HARDWARE
void ( *GL_Init ) ( void );
int ( *GL_SetMode ) ( HWND hwndGame, HDC *pmaindc, HGLRC *pbaseRC, int fD3D, const char *p, const char *pszCmdLine );
void ( *GL_Shutdown ) ( HWND hwnd, HDC hdc, HGLRC hglrc );
void ( *QGL_D3DShared ) ( struct tagD3DGlobals *d3dGShared );
int ( WINAPI *glSwapBuffers ) ( HDC dc );
void ( *DirectorProc ) ( unsigned int cmd, void * params );
#else
// NOT USED IN LINUX!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
void ( *GL_Init ) ( void );
void ( *GL_SetMode ) ( void );
void ( *GL_Shutdown ) ( void );
void ( *QGL_D3DShared ) ( void );
void ( *glSwapBuffers ) ( void );
void ( *DirectorProc ) ( void );
// LINUX
#endif
} engine_api_t;
#endif // ENGINE_LAUNCHER_APIH

195
hlsdk/common/entity_state.h Normal file
View File

@ -0,0 +1,195 @@
/***
*
* Copyright (c) 1999, 2000, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( ENTITY_STATEH )
#define ENTITY_STATEH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
// For entityType below
#define ENTITY_NORMAL (1<<0)
#define ENTITY_BEAM (1<<1)
// Entity state is used for the baseline and for delta compression of a packet of
// entities that is sent to a client.
typedef struct entity_state_s entity_state_t;
struct entity_state_s
{
// Fields which are filled in by routines outside of delta compression
int entityType;
// Index into cl_entities array for this entity.
int number;
float msg_time;
// Message number last time the player/entity state was updated.
int messagenum;
// Fields which can be transitted and reconstructed over the network stream
vec3_t origin;
vec3_t angles;
int modelindex;
int sequence;
float frame;
int colormap;
short skin;
short solid;
int effects;
float scale;
byte eflags;
// Render information
int rendermode;
int renderamt;
color24 rendercolor;
int renderfx;
int movetype;
float animtime;
float framerate;
int body;
byte controller[4];
byte blending[4];
vec3_t velocity;
// Send bbox down to client for use during prediction.
vec3_t mins;
vec3_t maxs;
int aiment;
// If owned by a player, the index of that player ( for projectiles ).
int owner;
// Friction, for prediction.
float friction;
// Gravity multiplier
float gravity;
// PLAYER SPECIFIC
int team;
int playerclass;
int health;
qboolean spectator;
int weaponmodel;
int gaitsequence;
// If standing on conveyor, e.g.
vec3_t basevelocity;
// Use the crouched hull, or the regular player hull.
int usehull;
// Latched buttons last time state updated.
int oldbuttons;
// -1 = in air, else pmove entity number
int onground;
int iStepLeft;
// How fast we are falling
float flFallVelocity;
float fov;
int weaponanim;
// Parametric movement overrides
vec3_t startpos;
vec3_t endpos;
float impacttime;
float starttime;
// For mods
int iuser1;
int iuser2;
int iuser3;
int iuser4;
float fuser1;
float fuser2;
float fuser3;
float fuser4;
vec3_t vuser1;
vec3_t vuser2;
vec3_t vuser3;
vec3_t vuser4;
};
#include "pm_info.h"
typedef struct clientdata_s
{
vec3_t origin;
vec3_t velocity;
int viewmodel;
vec3_t punchangle;
int flags;
int waterlevel;
int watertype;
vec3_t view_ofs;
float health;
int bInDuck;
int weapons; // remove?
int flTimeStepSound;
int flDuckTime;
int flSwimTime;
int waterjumptime;
float maxspeed;
float fov;
int weaponanim;
int m_iId;
int ammo_shells;
int ammo_nails;
int ammo_cells;
int ammo_rockets;
float m_flNextAttack;
int tfstate;
int pushmsec;
int deadflag;
char physinfo[ MAX_PHYSINFO_STRING ];
// For mods
int iuser1;
int iuser2;
int iuser3;
int iuser4;
float fuser1;
float fuser2;
float fuser3;
float fuser4;
vec3_t vuser1;
vec3_t vuser2;
vec3_t vuser3;
vec3_t vuser4;
} clientdata_t;
#include "weaponinfo.h"
typedef struct local_state_s
{
entity_state_t playerstate;
clientdata_t client;
weapon_data_t weapondata[ 32 ];
} local_state_t;
#endif // !ENTITY_STATEH

View File

@ -0,0 +1,26 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
// entity_types.h
#if !defined( ENTITY_TYPESH )
#define ENTITY_TYPESH
#define ET_NORMAL 0
#define ET_PLAYER 1
#define ET_TEMPENTITY 2
#define ET_BEAM 3
// BMODEL or SPRITE that was split across BSP nodes
#define ET_FRAGMENTED 4
#endif // !ENTITY_TYPESH

53
hlsdk/common/event_api.h Normal file
View File

@ -0,0 +1,53 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined ( EVENT_APIH )
#define EVENT_APIH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
#define EVENT_API_VERSION 1
typedef struct event_api_s
{
int version;
void ( *EV_PlaySound ) ( int ent, float *origin, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch );
void ( *EV_StopSound ) ( int ent, int channel, const char *sample );
int ( *EV_FindModelIndex )( const char *pmodel );
int ( *EV_IsLocal ) ( int playernum );
int ( *EV_LocalPlayerDucking ) ( void );
void ( *EV_LocalPlayerViewheight ) ( float * );
void ( *EV_LocalPlayerBounds ) ( int hull, float *mins, float *maxs );
int ( *EV_IndexFromTrace) ( struct pmtrace_s *pTrace );
struct physent_s *( *EV_GetPhysent ) ( int idx );
void ( *EV_SetUpPlayerPrediction ) ( int dopred, int bIncludeLocalClient );
void ( *EV_PushPMStates ) ( void );
void ( *EV_PopPMStates ) ( void );
void ( *EV_SetSolidPlayers ) (int playernum);
void ( *EV_SetTraceHull ) ( int hull );
void ( *EV_PlayerTrace ) ( float *start, float *end, int traceFlags, int ignore_pe, struct pmtrace_s *tr );
void ( *EV_WeaponAnimation ) ( int sequence, int body );
unsigned short ( *EV_PrecacheEvent ) ( int type, const char* psz );
void ( *EV_PlaybackEvent ) ( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
const char *( *EV_TraceTexture ) ( int ground, float *vstart, float *vend );
void ( *EV_StopAllSounds ) ( int entnum, int entchannel );
void ( *EV_KillEvents ) ( int entnum, const char *eventname );
} event_api_t;
extern event_api_t eventapi;
#endif

52
hlsdk/common/event_args.h Normal file
View File

@ -0,0 +1,52 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( EVENT_ARGSH )
#define EVENT_ARGSH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
// Event was invoked with stated origin
#define FEVENT_ORIGIN ( 1<<0 )
// Event was invoked with stated angles
#define FEVENT_ANGLES ( 1<<1 )
typedef struct event_args_s
{
int flags;
// Transmitted
int entindex;
float origin[3];
float angles[3];
float velocity[3];
int ducking;
float fparam1;
float fparam2;
int iparam1;
int iparam2;
int bparam1;
int bparam2;
} event_args_t;
#endif

View File

@ -0,0 +1,49 @@
/***
*
* Copyright (c) 1999, 2000, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( EVENT_FLAGSH )
#define EVENT_FLAGSH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
// Skip local host for event send.
#define FEV_NOTHOST (1<<0)
// Send the event reliably. You must specify the origin and angles and use
// PLAYBACK_EVENT_FULL for this to work correctly on the server for anything
// that depends on the event origin/angles. I.e., the origin/angles are not
// taken from the invoking edict for reliable events.
#define FEV_RELIABLE (1<<1)
// Don't restrict to PAS/PVS, send this event to _everybody_ on the server ( useful for stopping CHAN_STATIC
// sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ).
#define FEV_GLOBAL (1<<2)
// If this client already has one of these events in its queue, just update the event instead of sending it as a duplicate
//
#define FEV_UPDATE (1<<3)
// Only send to entity specified as the invoker
#define FEV_HOSTONLY (1<<4)
// Only send if the event was created on the server.
#define FEV_SERVER (1<<5)
// Only issue event client side ( from shared code )
#define FEV_CLIENT (1<<6)
#endif

50
hlsdk/common/exefuncs.h Normal file
View File

@ -0,0 +1,50 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
// exefuncs.h
#ifndef EXEFUNCS_H
#define EXEFUNCS_H
// Engine hands this to DLLs for functionality callbacks
typedef struct exefuncs_s
{
int fMMX;
int iCPUMhz;
void (*unused1)(void);
void (*unused2)(void);
void (*unused3)(void);
void (*unused4)(void);
void (*VID_ForceLockState)(int lk);
int (*VID_ForceUnlockedAndReturnState)(void);
void (*unused5)(void);
void (*unused6)(void);
void (*unused7)(void);
void (*unused8)(void);
void (*unused9)(void);
void (*unused10)(void);
void (*unused11)(void);
void (*unused12)(void);
void (*unused13)(void);
void (*unused14)(void);
void (*unused15)(void);
void (*ErrorMessage)(int nLevel, const char *pszErrorMessage);
void (*unused16)(void);
void (*Sys_Printf)(char *fmt, ...);
void (*unused17)(void);
void (*unused18)(void);
void (*unused19)(void);
void (*unused20)(void);
void (*unused21)(void);
void (*unused22)(void);
void (*unused23)(void);
void (*unused24)(void);
void (*unused25)(void);
void (*unused26)(void);
void (*unused27)(void);
} exefuncs_t;
#endif

57
hlsdk/common/hltv.h Normal file
View File

@ -0,0 +1,57 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
// hltv.h
// all shared consts between server, clients and proxy
#ifndef HLTV_H
#define HLTV_H
#define TYPE_CLIENT 0 // client is a normal HL client (default)
#define TYPE_PROXY 1 // client is another proxy
#define TYPE_COMMENTATOR 3 // client is a commentator
#define TYPE_DEMO 4 // client is a demo file
// sub commands of svc_hltv:
#define HLTV_ACTIVE 0 // tells client that he's an spectator and will get director commands
#define HLTV_STATUS 1 // send status infos about proxy
#define HLTV_LISTEN 2 // tell client to listen to a multicast stream
// sub commands of svc_director:
#define DRC_CMD_NONE 0 // NULL director command
#define DRC_CMD_START 1 // start director mode
#define DRC_CMD_EVENT 2 // informs about director command
#define DRC_CMD_MODE 3 // switches camera modes
#define DRC_CMD_CAMERA 4 // sets camera registers
#define DRC_CMD_TIMESCALE 5 // sets time scale
#define DRC_CMD_MESSAGE 6 // send HUD centerprint
#define DRC_CMD_SOUND 7 // plays a particular sound
#define DRC_CMD_STATUS 8 // status info about broadcast
#define DRC_CMD_BANNER 9 // banner file name for HLTV gui
#define DRC_CMD_FADE 10 // send screen fade command
#define DRC_CMD_SHAKE 11 // send screen shake command
#define DRC_CMD_STUFFTEXT 12 // like the normal svc_stufftext but as director command
#define DRC_CMD_LAST 12
// HLTV_EVENT event flags
#define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important)
#define DRC_FLAG_SIDE (1<<4) //
#define DRC_FLAG_DRAMATIC (1<<5) // is a dramatic scene
#define DRC_FLAG_SLOWMOTION (1<<6) // would look good in SloMo
#define DRC_FLAG_FACEPLAYER (1<<7) // player is doning something (reload/defuse bomb etc)
#define DRC_FLAG_INTRO (1<<8) // is a introduction scene
#define DRC_FLAG_FINAL (1<<9) // is a final scene
#define DRC_FLAG_NO_RANDOM (1<<10) // don't randomize event data
#define MAX_DIRECTOR_CMD_PARAMETERS 4
#define MAX_DIRECTOR_CMD_STRING 128
#endif // HLTV_H

40
hlsdk/common/in_buttons.h Normal file
View File

@ -0,0 +1,40 @@
/***
*
* Copyright (c) 1999, 2000, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef IN_BUTTONS_H
#define IN_BUTTONS_H
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
#define IN_ATTACK (1 << 0)
#define IN_JUMP (1 << 1)
#define IN_DUCK (1 << 2)
#define IN_FORWARD (1 << 3)
#define IN_BACK (1 << 4)
#define IN_USE (1 << 5)
#define IN_CANCEL (1 << 6)
#define IN_LEFT (1 << 7)
#define IN_RIGHT (1 << 8)
#define IN_MOVELEFT (1 << 9)
#define IN_MOVERIGHT (1 << 10)
#define IN_ATTACK2 (1 << 11)
#define IN_RUN (1 << 12)
#define IN_RELOAD (1 << 13)
#define IN_ALT1 (1 << 14)
#define IN_SCORE (1 << 15) // Used by client.dll for when scoreboard is held down
#endif // IN_BUTTONS_H

129
hlsdk/common/interface.h Normal file
View File

@ -0,0 +1,129 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
// This header defines the interface convention used in the valve engine.
// To make an interface and expose it:
// 1. Derive from IBaseInterface.
// 2. The interface must be ALL pure virtuals, and have no data members.
// 3. Define a name for it.
// 4. In its implementation file, use EXPOSE_INTERFACE or EXPOSE_SINGLE_INTERFACE.
// Versioning
// There are two versioning cases that are handled by this:
// 1. You add functions to the end of an interface, so it is binary compatible with the previous interface. In this case,
// you need two EXPOSE_INTERFACEs: one to expose your class as the old interface and one to expose it as the new interface.
// 2. You update an interface so it's not compatible anymore (but you still want to be able to expose the old interface
// for legacy code). In this case, you need to make a new version name for your new interface, and make a wrapper interface and
// expose it for the old interface.
#ifndef INTERFACE_H
#define INTERFACE_H
#ifdef __cplusplus
// All interfaces derive from this.
class IBaseInterface
{
public:
virtual ~IBaseInterface() {}
};
#define CREATEINTERFACE_PROCNAME "CreateInterface"
typedef IBaseInterface* (*CreateInterfaceFn)(const char *pName, int *pReturnCode);
typedef IBaseInterface* (*InstantiateInterfaceFn)();
// Used internally to register classes.
class InterfaceReg
{
public:
InterfaceReg(InstantiateInterfaceFn fn, const char *pName);
public:
InstantiateInterfaceFn m_CreateFn;
const char *m_pName;
InterfaceReg *m_pNext; // For the global list.
static InterfaceReg *s_pInterfaceRegs;
};
// Use this to expose an interface that can have multiple instances.
// e.g.:
// EXPOSE_INTERFACE( CInterfaceImp, IInterface, "MyInterface001" )
// This will expose a class called CInterfaceImp that implements IInterface (a pure class)
// clients can receive a pointer to this class by calling CreateInterface( "MyInterface001" )
//
// In practice, the shared header file defines the interface (IInterface) and version name ("MyInterface001")
// so that each component can use these names/vtables to communicate
//
// A single class can support multiple interfaces through multiple inheritance
//
#define EXPOSE_INTERFACE_FN(functionName, interfaceName, versionName) \
static InterfaceReg __g_Create##className##_reg(functionName, versionName);
#define EXPOSE_INTERFACE(className, interfaceName, versionName) \
static IBaseInterface* __Create##className##_interface() {return (interfaceName *)new className;}\
static InterfaceReg __g_Create##className##_reg(__Create##className##_interface, versionName );
// Use this to expose a singleton interface with a global variable you've created.
#define EXPOSE_SINGLE_INTERFACE_GLOBALVAR(className, interfaceName, versionName, globalVarName) \
static IBaseInterface* __Create##className##interfaceName##_interface() {return (interfaceName *)&globalVarName;}\
static InterfaceReg __g_Create##className##interfaceName##_reg(__Create##className##interfaceName##_interface, versionName);
// Use this to expose a singleton interface. This creates the global variable for you automatically.
#define EXPOSE_SINGLE_INTERFACE(className, interfaceName, versionName) \
static className __g_##className##_singleton;\
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(className, interfaceName, versionName, __g_##className##_singleton)
#ifdef WIN32
#define EXPORT_FUNCTION __declspec(dllexport)
#else
#define EXPORT_FUNCTION
#endif
// This function is automatically exported and allows you to access any interfaces exposed with the above macros.
// if pReturnCode is set, it will return one of the following values
// extend this for other error conditions/code
enum
{
IFACE_OK = 0,
IFACE_FAILED
};
extern "C"
{
EXPORT_FUNCTION IBaseInterface* CreateInterface(const char *pName, int *pReturnCode);
};
// Handle to an interface (HInterfaceModule_t* is just there for type safety).
typedef struct HInterfaceModule_t* HINTERFACEMODULE;
// Use these to load and unload a module.
extern HINTERFACEMODULE Sys_LoadModule(const char *pModuleName);
extern void Sys_FreeModule(HINTERFACEMODULE hModule);
// Use these to get the factory function from either a loaded module or the current module.
extern CreateInterfaceFn Sys_GetFactory( HINTERFACEMODULE hModule );
extern CreateInterfaceFn Sys_GetFactoryThis( void );
#endif // __cplusplus
#endif

View File

@ -0,0 +1,37 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef IVOICETWEAK_H
#define IVOICETWEAK_H
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
// These provide access to the voice controls.
typedef enum
{
MicrophoneVolume=0, // values 0-1.
OtherSpeakerScale // values 0-1. Scales how loud other players are.
} VoiceTweakControl;
typedef struct IVoiceTweak_s
{
// These turn voice tweak mode on and off. While in voice tweak mode, the user's voice is echoed back
// without sending to the server.
int (*StartVoiceTweakMode)(); // Returns 0 on error.
void (*EndVoiceTweakMode)();
// Get/set control values.
void (*SetControlFloat)(VoiceTweakControl iControl, float value);
float (*GetControlFloat)(VoiceTweakControl iControl);
} IVoiceTweak;
#endif // IVOICETWEAK_H

156
hlsdk/common/mathlib.h Normal file
View File

@ -0,0 +1,156 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
// mathlib.h
typedef float vec_t;
typedef vec_t vec3_t[3];
typedef vec_t vec4_t[4]; // x,y,z,w
typedef vec_t vec5_t[5];
typedef short vec_s_t;
typedef vec_s_t vec3s_t[3];
typedef vec_s_t vec4s_t[4]; // x,y,z,w
typedef vec_s_t vec5s_t[5];
typedef int fixed4_t;
typedef int fixed8_t;
typedef int fixed16_t;
#ifndef M_PI
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif
struct mplane_s;
extern vec3_t vec3_origin;
extern int nanmask;
#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
#ifndef VECTOR_H
#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
#endif
#define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}
#define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}
#define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}
#define VectorClear(a) {(a)[0]=0.0;(a)[1]=0.0;(a)[2]=0.0;}
void VectorMA (const vec3_t veca, float scale, const vec3_t vecb, vec3_t vecc);
vec_t _DotProduct (vec3_t v1, vec3_t v2);
void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out);
void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out);
void _VectorCopy (vec3_t in, vec3_t out);
int VectorCompare (const vec3_t v1, const vec3_t v2);
float Length (const vec3_t v);
void CrossProduct (const vec3_t v1, const vec3_t v2, vec3_t cross);
float VectorNormalize (vec3_t v); // returns vector length
void VectorInverse (vec3_t v);
void VectorScale (const vec3_t in, vec_t scale, vec3_t out);
int Q_log2(int val);
void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]);
void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]);
// Here are some "manual" INLINE routines for doing floating point to integer conversions
extern short new_cw, old_cw;
typedef union DLONG {
int i[2];
double d;
float f;
} DLONG;
extern DLONG dlong;
#ifdef _WIN32
void __inline set_fpu_cw(void)
{
_asm
{ wait
fnstcw old_cw
wait
mov ax, word ptr old_cw
or ah, 0xc
mov word ptr new_cw,ax
fldcw new_cw
}
}
int __inline quick_ftol(float f)
{
_asm {
// Assumes that we are already in chop mode, and only need a 32-bit int
fld DWORD PTR f
fistp DWORD PTR dlong
}
return dlong.i[0];
}
void __inline restore_fpu_cw(void)
{
_asm fldcw old_cw
}
#else
#define set_fpu_cw() /* */
#define quick_ftol(f) ftol(f)
#define restore_fpu_cw() /* */
#endif
void FloorDivMod (double numer, double denom, int *quotient,
int *rem);
fixed16_t Invert24To16(fixed16_t val);
int GreatestCommonDivisor (int i1, int i2);
void AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);
void AngleVectorsTranspose (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);
#define AngleIVectors AngleVectorsTranspose
void AngleMatrix (const vec3_t angles, float (*matrix)[4] );
void AngleIMatrix (const vec3_t angles, float (*matrix)[4] );
void VectorTransform (const vec3_t in1, float in2[3][4], vec3_t out);
void NormalizeAngles( vec3_t angles );
void InterpolateAngles( vec3_t start, vec3_t end, vec3_t output, float frac );
float AngleBetweenVectors( const vec3_t v1, const vec3_t v2 );
void VectorMatrix( vec3_t forward, vec3_t right, vec3_t up);
void VectorAngles( const vec3_t forward, vec3_t angles );
int InvertMatrix( const float * m, float *out );
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane);
float anglemod(float a);
#define BOX_ON_PLANE_SIDE(emins, emaxs, p) \
(((p)->type < 3)? \
( \
((p)->dist <= (emins)[(p)->type])? \
1 \
: \
( \
((p)->dist >= (emaxs)[(p)->type])?\
2 \
: \
3 \
) \
) \
: \
BoxOnPlaneSide( (emins), (emaxs), (p)))

101
hlsdk/common/net_api.h Normal file
View File

@ -0,0 +1,101 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#if !defined( NET_APIH )
#define NET_APIH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
#if !defined ( NETADRH )
#include "netadr.h"
#endif
#define NETAPI_REQUEST_SERVERLIST ( 0 ) // Doesn't need a remote address
#define NETAPI_REQUEST_PING ( 1 )
#define NETAPI_REQUEST_RULES ( 2 )
#define NETAPI_REQUEST_PLAYERS ( 3 )
#define NETAPI_REQUEST_DETAILS ( 4 )
// Set this flag for things like broadcast requests, etc. where the engine should not
// kill the request hook after receiving the first response
#define FNETAPI_MULTIPLE_RESPONSE ( 1<<0 )
typedef void ( *net_api_response_func_t ) ( struct net_response_s *response );
#define NET_SUCCESS ( 0 )
#define NET_ERROR_TIMEOUT ( 1<<0 )
#define NET_ERROR_PROTO_UNSUPPORTED ( 1<<1 )
#define NET_ERROR_UNDEFINED ( 1<<2 )
typedef struct net_adrlist_s
{
struct net_adrlist_s *next;
netadr_t remote_address;
} net_adrlist_t;
typedef struct net_response_s
{
// NET_SUCCESS or an error code
int error;
// Context ID
int context;
// Type
int type;
// Server that is responding to the request
netadr_t remote_address;
// Response RTT ping time
double ping;
// Key/Value pair string ( separated by backlash \ characters )
// WARNING: You must copy this buffer in the callback function, because it is freed
// by the engine right after the call!!!!
// ALSO: For NETAPI_REQUEST_SERVERLIST requests, this will be a pointer to a linked list of net_adrlist_t's
void *response;
} net_response_t;
typedef struct net_status_s
{
// Connected to remote server? 1 == yes, 0 otherwise
int connected;
// Client's IP address
netadr_t local_address;
// Address of remote server
netadr_t remote_address;
// Packet Loss ( as a percentage )
int packet_loss;
// Latency, in seconds ( multiply by 1000.0 to get milliseconds )
double latency;
// Connection time, in seconds
double connection_time;
// Rate setting ( for incoming data )
double rate;
} net_status_t;
typedef struct net_api_s
{
// APIs
void ( *InitNetworking )( void );
void ( *Status ) ( struct net_status_s *status );
void ( *SendRequest) ( int context, int request, int flags, double timeout, struct netadr_s *remote_address, net_api_response_func_t response );
void ( *CancelRequest ) ( int context );
void ( *CancelAllRequests ) ( void );
char *( *AdrToString ) ( struct netadr_s *a );
int ( *CompareAdr ) ( struct netadr_s *a, struct netadr_s *b );
int ( *StringToAdr ) ( char *s, struct netadr_s *a );
const char *( *ValueForKey ) ( const char *s, const char *key );
void ( *RemoveKey ) ( char *s, const char *key );
void ( *SetValueForKey ) (char *s, const char *key, const char *value, int maxsize );
} net_api_t;
extern net_api_t netapi;
#endif // NET_APIH

42
hlsdk/common/netadr.h Normal file
View File

@ -0,0 +1,42 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
// netadr.h
#ifndef NETADR_H
#define NETADR_H
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef enum
{
NA_UNUSED,
NA_LOOPBACK,
NA_BROADCAST,
NA_IP,
NA_IPX,
NA_BROADCAST_IPX,
} netadrtype_t;
typedef struct netadr_s
{
netadrtype_t type;
unsigned char ip[4];
unsigned char ipx[10];
unsigned short port;
} netadr_t;
#endif // NETADR_H

15
hlsdk/common/nowin.h Normal file
View File

@ -0,0 +1,15 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef INC_NOWIN_H
#define INC_NOWIN_H
#ifndef _WIN32
#include <unistd.h>
#endif //!_WIN32
#endif //INC_NOWIN_H

View File

@ -0,0 +1,59 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( PARTICLEDEFH )
#define PARTICLEDEFH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef enum {
pt_static,
pt_grav,
pt_slowgrav,
pt_fire,
pt_explode,
pt_explode2,
pt_blob,
pt_blob2,
pt_vox_slowgrav,
pt_vox_grav,
pt_clientcustom // Must have callback function specified
} ptype_t;
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
typedef struct particle_s
{
// driver-usable fields
vec3_t org;
short color;
short packedColor;
// drivers never touch the following fields
struct particle_s *next;
vec3_t vel;
float ramp;
float die;
ptype_t type;
void (*deathfunc)( struct particle_s *particle );
// for pt_clientcusttom, we'll call this function each frame
void (*callback)( struct particle_s *particle, float frametime );
// For deathfunc, etc.
unsigned char context;
} particle_t;
#endif

45
hlsdk/common/pmtrace.h Normal file
View File

@ -0,0 +1,45 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( PMTRACEH )
#define PMTRACEH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef struct
{
vec3_t normal;
float dist;
} pmplane_t;
typedef struct pmtrace_s pmtrace_t;
struct pmtrace_s
{
qboolean allsolid; // if true, plane is not valid
qboolean startsolid; // if true, the initial point was in a solid area
qboolean inopen, inwater; // End point is in empty space or in water
float fraction; // time completed, 1.0 = didn't hit anything
vec3_t endpos; // final position
pmplane_t plane; // surface normal at impact
int ent; // entity at impact
vec3_t deltavelocity; // Change in player's velocity caused by impact.
// Only run on server.
int hitgroup;
};
#endif

42
hlsdk/common/qfont.h Normal file
View File

@ -0,0 +1,42 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( QFONTH )
#define QFONTH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
// Font stuff
#define NUM_GLYPHS 256
typedef struct
{
short startoffset;
short charwidth;
} charinfo;
typedef struct qfont_s
{
int width, height;
int rowcount;
int rowheight;
charinfo fontinfo[ NUM_GLYPHS ];
byte data[4];
} qfont_t;
#endif // qfont.h

199
hlsdk/common/r_efx.h Normal file
View File

@ -0,0 +1,199 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined ( R_EFXH )
#define R_EFXH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
// particle_t
#if !defined( PARTICLEDEFH )
#include "particledef.h"
#endif
// BEAM
#if !defined( BEAMDEFH )
#include "beamdef.h"
#endif
// dlight_t
#if !defined ( DLIGHTH )
#include "dlight.h"
#endif
// cl_entity_t
#if !defined( CL_ENTITYH )
#include "cl_entity.h"
#endif
/*
// FOR REFERENCE, These are the built-in tracer colors. Note, color 4 is the one
// that uses the tracerred/tracergreen/tracerblue and traceralpha cvar settings
color24 gTracerColors[] =
{
{ 255, 255, 255 }, // White
{ 255, 0, 0 }, // Red
{ 0, 255, 0 }, // Green
{ 0, 0, 255 }, // Blue
{ 0, 0, 0 }, // Tracer default, filled in from cvars, etc.
{ 255, 167, 17 }, // Yellow-orange sparks
{ 255, 130, 90 }, // Yellowish streaks (garg)
{ 55, 60, 144 }, // Blue egon streak
{ 255, 130, 90 }, // More Yellowish streaks (garg)
{ 255, 140, 90 }, // More Yellowish streaks (garg)
{ 200, 130, 90 }, // More red streaks (garg)
{ 255, 120, 70 }, // Darker red streaks (garg)
};
*/
// Temporary entity array
#define TENTPRIORITY_LOW 0
#define TENTPRIORITY_HIGH 1
// TEMPENTITY flags
#define FTENT_NONE 0x00000000
#define FTENT_SINEWAVE 0x00000001
#define FTENT_GRAVITY 0x00000002
#define FTENT_ROTATE 0x00000004
#define FTENT_SLOWGRAVITY 0x00000008
#define FTENT_SMOKETRAIL 0x00000010
#define FTENT_COLLIDEWORLD 0x00000020
#define FTENT_FLICKER 0x00000040
#define FTENT_FADEOUT 0x00000080
#define FTENT_SPRANIMATE 0x00000100
#define FTENT_HITSOUND 0x00000200
#define FTENT_SPIRAL 0x00000400
#define FTENT_SPRCYCLE 0x00000800
#define FTENT_COLLIDEALL 0x00001000 // will collide with world and slideboxes
#define FTENT_PERSIST 0x00002000 // tent is not removed when unable to draw
#define FTENT_COLLIDEKILL 0x00004000 // tent is removed upon collision with anything
#define FTENT_PLYRATTACHMENT 0x00008000 // tent is attached to a player (owner)
#define FTENT_SPRANIMATELOOP 0x00010000 // animating sprite doesn't die when last frame is displayed
#define FTENT_SPARKSHOWER 0x00020000
#define FTENT_NOMODEL 0x00040000 // Doesn't have a model, never try to draw ( it just triggers other things )
#define FTENT_CLIENTCUSTOM 0x00080000 // Must specify callback. Callback function is responsible for killing tempent and updating fields ( unless other flags specify how to do things )
typedef struct tempent_s TEMPENTITY;
typedef struct tempent_s
{
int flags;
float die;
float frameMax;
float x;
float y;
float z;
float fadeSpeed;
float bounceFactor;
int hitSound;
void ( *hitcallback ) ( struct tempent_s *ent, struct pmtrace_s *ptr );
void ( *callback ) ( struct tempent_s *ent, float frametime, float currenttime );
TEMPENTITY *next;
int priority;
short clientIndex; // if attached, this is the index of the client to stick to
// if COLLIDEALL, this is the index of the client to ignore
// TENTS with FTENT_PLYRATTACHMENT MUST set the clientindex!
vec3_t tentOffset; // if attached, client origin + tentOffset = tent origin.
cl_entity_t entity;
// baseline.origin - velocity
// baseline.renderamt - starting fadeout intensity
// baseline.angles - angle velocity
} TEMPENTITY;
typedef struct efx_api_s efx_api_t;
struct efx_api_s
{
particle_t *( *R_AllocParticle ) ( void ( *callback ) ( struct particle_s *particle, float frametime ) );
void ( *R_BlobExplosion ) ( float * org );
void ( *R_Blood ) ( float * org, float * dir, int pcolor, int speed );
void ( *R_BloodSprite ) ( float * org, int colorindex, int modelIndex, int modelIndex2, float size );
void ( *R_BloodStream ) ( float * org, float * dir, int pcolor, int speed );
void ( *R_BreakModel ) ( float *pos, float *size, float *dir, float random, float life, int count, int modelIndex, char flags );
void ( *R_Bubbles ) ( float * mins, float * maxs, float height, int modelIndex, int count, float speed );
void ( *R_BubbleTrail ) ( float * start, float * end, float height, int modelIndex, int count, float speed );
void ( *R_BulletImpactParticles ) ( float * pos );
void ( *R_EntityParticles ) ( struct cl_entity_s *ent );
void ( *R_Explosion ) ( float *pos, int model, float scale, float framerate, int flags );
void ( *R_FizzEffect ) ( struct cl_entity_s *pent, int modelIndex, int density );
void ( *R_FireField ) ( float * org, int radius, int modelIndex, int count, int flags, float life );
void ( *R_FlickerParticles ) ( float * org );
void ( *R_FunnelSprite ) ( float *org, int modelIndex, int reverse );
void ( *R_Implosion ) ( float * end, float radius, int count, float life );
void ( *R_LargeFunnel ) ( float * org, int reverse );
void ( *R_LavaSplash ) ( float * org );
void ( *R_MultiGunshot ) ( float * org, float * dir, float * noise, int count, int decalCount, int *decalIndices );
void ( *R_MuzzleFlash ) ( float *pos1, int type );
void ( *R_ParticleBox ) ( float *mins, float *maxs, unsigned char r, unsigned char g, unsigned char b, float life );
void ( *R_ParticleBurst ) ( float * pos, int size, int color, float life );
void ( *R_ParticleExplosion ) ( float * org );
void ( *R_ParticleExplosion2 ) ( float * org, int colorStart, int colorLength );
void ( *R_ParticleLine ) ( float * start, float *end, unsigned char r, unsigned char g, unsigned char b, float life );
void ( *R_PlayerSprites ) ( int client, int modelIndex, int count, int size );
void ( *R_Projectile ) ( float * origin, float * velocity, int modelIndex, int life, int owner, void (*hitcallback)( struct tempent_s *ent, struct pmtrace_s *ptr ) );
void ( *R_RicochetSound ) ( float * pos );
void ( *R_RicochetSprite ) ( float *pos, struct model_s *pmodel, float duration, float scale );
void ( *R_RocketFlare ) ( float *pos );
void ( *R_RocketTrail ) ( float * start, float * end, int type );
void ( *R_RunParticleEffect ) ( float * org, float * dir, int color, int count );
void ( *R_ShowLine ) ( float * start, float * end );
void ( *R_SparkEffect ) ( float *pos, int count, int velocityMin, int velocityMax );
void ( *R_SparkShower ) ( float *pos );
void ( *R_SparkStreaks ) ( float * pos, int count, int velocityMin, int velocityMax );
void ( *R_Spray ) ( float * pos, float * dir, int modelIndex, int count, int speed, int spread, int rendermode );
void ( *R_Sprite_Explode ) ( TEMPENTITY *pTemp, float scale, int flags );
void ( *R_Sprite_Smoke ) ( TEMPENTITY *pTemp, float scale );
void ( *R_Sprite_Spray ) ( float * pos, float * dir, int modelIndex, int count, int speed, int iRand );
void ( *R_Sprite_Trail ) ( int type, float * start, float * end, int modelIndex, int count, float life, float size, float amplitude, int renderamt, float speed );
void ( *R_Sprite_WallPuff ) ( TEMPENTITY *pTemp, float scale );
void ( *R_StreakSplash ) ( float * pos, float * dir, int color, int count, float speed, int velocityMin, int velocityMax );
void ( *R_TracerEffect ) ( float * start, float * end );
void ( *R_UserTracerParticle ) ( float * org, float * vel, float life, int colorIndex, float length, unsigned char deathcontext, void ( *deathfunc)( struct particle_s *particle ) );
particle_t *( *R_TracerParticles ) ( float * org, float * vel, float life );
void ( *R_TeleportSplash ) ( float * org );
void ( *R_TempSphereModel ) ( float *pos, float speed, float life, int count, int modelIndex );
TEMPENTITY *( *R_TempModel ) ( float *pos, float *dir, float *angles, float life, int modelIndex, int soundtype );
TEMPENTITY *( *R_DefaultSprite ) ( float *pos, int spriteIndex, float framerate );
TEMPENTITY *( *R_TempSprite ) ( float *pos, float *dir, float scale, int modelIndex, int rendermode, int renderfx, float a, float life, int flags );
int ( *Draw_DecalIndex ) ( int id );
int ( *Draw_DecalIndexFromName ) ( char *name );
void ( *R_DecalShoot ) ( int textureIndex, int entity, int modelIndex, float * position, int flags );
void ( *R_AttachTentToPlayer ) ( int client, int modelIndex, float zoffset, float life );
void ( *R_KillAttachedTents ) ( int client );
BEAM *( *R_BeamCirclePoints ) ( int type, float * start, float * end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
BEAM *( *R_BeamEntPoint ) ( int startEnt, float * end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
BEAM *( *R_BeamEnts ) ( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
BEAM *( *R_BeamFollow ) ( int startEnt, int modelIndex, float life, float width, float r, float g, float b, float brightness );
void ( *R_BeamKill ) ( int deadEntity );
BEAM *( *R_BeamLightning ) ( float * start, float * end, int modelIndex, float life, float width, float amplitude, float brightness, float speed );
BEAM *( *R_BeamPoints ) ( float * start, float * end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
BEAM *( *R_BeamRing ) ( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
dlight_t *( *CL_AllocDlight ) ( int key );
dlight_t *( *CL_AllocElight ) ( int key );
TEMPENTITY *( *CL_TempEntAlloc ) ( float * org, struct model_s *model );
TEMPENTITY *( *CL_TempEntAllocNoModel ) ( float * org );
TEMPENTITY *( *CL_TempEntAllocHigh ) ( float * org, struct model_s *model );
TEMPENTITY *( *CL_TentEntAllocCustom ) ( float *origin, struct model_s *model, int high, void ( *callback ) ( struct tempent_s *ent, float frametime, float currenttime ) );
void ( *R_GetPackedColor ) ( short *packed, short color );
short ( *R_LookupColor ) ( unsigned char r, unsigned char g, unsigned char b );
void ( *R_DecalRemoveAll ) ( int textureIndex ); //textureIndex points to the decal index in the array, not the actual texture index.
};
extern efx_api_t efx;
#endif

149
hlsdk/common/r_studioint.h Normal file
View File

@ -0,0 +1,149 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#if !defined( R_STUDIOINT_H )
#define R_STUDIOINT_H
#if defined( _WIN32 )
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
#define STUDIO_INTERFACE_VERSION 1
typedef struct engine_studio_api_s
{
// Allocate number*size bytes and zero it
void *( *Mem_Calloc ) ( int number, size_t size );
// Check to see if pointer is in the cache
void *( *Cache_Check ) ( struct cache_user_s *c );
// Load file into cache ( can be swapped out on demand )
void ( *LoadCacheFile ) ( char *path, struct cache_user_s *cu );
// Retrieve model pointer for the named model
struct model_s *( *Mod_ForName ) ( const char *name, int crash_if_missing );
// Retrieve pointer to studio model data block from a model
void *( *Mod_Extradata ) ( struct model_s *mod );
// Retrieve indexed model from client side model precache list
struct model_s *( *GetModelByIndex ) ( int index );
// Get entity that is set for rendering
struct cl_entity_s * ( *GetCurrentEntity ) ( void );
// Get referenced player_info_t
struct player_info_s *( *PlayerInfo ) ( int index );
// Get most recently received player state data from network system
struct entity_state_s *( *GetPlayerState ) ( int index );
// Get viewentity
struct cl_entity_s * ( *GetViewEntity ) ( void );
// Get current frame count, and last two timestampes on client
void ( *GetTimes ) ( int *framecount, double *current, double *old );
// Get a pointer to a cvar by name
struct cvar_s *( *GetCvar ) ( const char *name );
// Get current render origin and view vectors ( up, right and vpn )
void ( *GetViewInfo ) ( float *origin, float *upv, float *rightv, float *vpnv );
// Get sprite model used for applying chrome effect
struct model_s *( *GetChromeSprite ) ( void );
// Get model counters so we can incement instrumentation
void ( *GetModelCounters ) ( int **s, int **a );
// Get software scaling coefficients
void ( *GetAliasScale ) ( float *x, float *y );
// Get bone, light, alias, and rotation matrices
float ****( *StudioGetBoneTransform ) ( void );
float ****( *StudioGetLightTransform )( void );
float ***( *StudioGetAliasTransform ) ( void );
float ***( *StudioGetRotationMatrix ) ( void );
// Set up body part, and get submodel pointers
void ( *StudioSetupModel ) ( int bodypart, void **ppbodypart, void **ppsubmodel );
// Check if entity's bbox is in the view frustum
int ( *StudioCheckBBox ) ( void );
// Apply lighting effects to model
void ( *StudioDynamicLight ) ( struct cl_entity_s *ent, struct alight_s *plight );
void ( *StudioEntityLight ) ( struct alight_s *plight );
void ( *StudioSetupLighting ) ( struct alight_s *plighting );
// Draw mesh vertices
void ( *StudioDrawPoints ) ( void );
// Draw hulls around bones
void ( *StudioDrawHulls ) ( void );
// Draw bbox around studio models
void ( *StudioDrawAbsBBox ) ( void );
// Draws bones
void ( *StudioDrawBones ) ( void );
// Loads in appropriate texture for model
void ( *StudioSetupSkin ) ( void *ptexturehdr, int index );
// Sets up for remapped colors
void ( *StudioSetRemapColors ) ( int top, int bottom );
// Set's player model and returns model pointer
struct model_s *( *SetupPlayerModel ) ( int index );
// Fires any events embedded in animation
void ( *StudioClientEvents ) ( void );
// Retrieve/set forced render effects flags
int ( *GetForceFaceFlags ) ( void );
void ( *SetForceFaceFlags ) ( int flags );
// Tell engine the value of the studio model header
void ( *StudioSetHeader ) ( void *header );
// Tell engine which model_t * is being renderered
void ( *SetRenderModel ) ( struct model_s *model );
// Final state setup and restore for rendering
void ( *SetupRenderer ) ( int rendermode );
void ( *RestoreRenderer ) ( void );
// Set render origin for applying chrome effect
void ( *SetChromeOrigin ) ( void );
// True if using D3D/OpenGL
int ( *IsHardware ) ( void );
// Only called by hardware interface
void ( *GL_StudioDrawShadow ) ( void );
void ( *GL_SetRenderMode ) ( int mode );
} engine_studio_api_t;
typedef struct server_studio_api_s
{
// Allocate number*size bytes and zero it
void *( *Mem_Calloc ) ( int number, size_t size );
// Check to see if pointer is in the cache
void *( *Cache_Check ) ( struct cache_user_s *c );
// Load file into cache ( can be swapped out on demand )
void ( *LoadCacheFile ) ( char *path, struct cache_user_s *cu );
// Retrieve pointer to studio model data block from a model
void *( *Mod_Extradata ) ( struct model_s *mod );
} server_studio_api_t;
// client blending
typedef struct r_studio_interface_s
{
int version;
int ( *StudioDrawModel ) ( int flags );
int ( *StudioDrawPlayer ) ( int flags, struct entity_state_s *pplayer );
} r_studio_interface_t;
extern r_studio_interface_t *pStudioAPI;
// server blending
#define SV_BLENDING_INTERFACE_VERSION 1
typedef struct sv_blending_interface_s
{
int version;
void ( *SV_StudioSetupBones )( struct model_s *pModel,
float frame,
int sequence,
const vec3_t angles,
const vec3_t origin,
const byte *pcontroller,
const byte *pblending,
int iBone,
const edict_t *pEdict );
} sv_blending_interface_t;
#endif // R_STUDIOINT_H

75
hlsdk/common/ref_params.h Normal file
View File

@ -0,0 +1,75 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( REF_PARAMSH )
#define REF_PARAMSH
typedef struct ref_params_s
{
// Output
float vieworg[3];
float viewangles[3];
float forward[3];
float right[3];
float up[3];
// Client frametime;
float frametime;
// Client time
float time;
// Misc
int intermission;
int paused;
int spectator;
int onground;
int waterlevel;
float simvel[3];
float simorg[3];
float viewheight[3];
float idealpitch;
float cl_viewangles[3];
int health;
float crosshairangle[3];
float viewsize;
float punchangle[3];
int maxclients;
int viewentity;
int playernum;
int max_entities;
int demoplayback;
int hardware;
int smoothing;
// Last issued usercmd
struct usercmd_s *cmd;
// Movevars
struct movevars_s *movevars;
int viewport[4]; // the viewport coordinates x ,y , width, height
int nextView; // the renderer calls ClientDLL_CalcRefdef() and Renderview
// so long in cycles until this value is 0 (multiple views)
int onlyClientDraw; // if !=0 nothing is drawn by the engine except clientDraw functions
} ref_params_t;
#endif // !REF_PARAMSH

26
hlsdk/common/screenfade.h Normal file
View File

@ -0,0 +1,26 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#if !defined( SCREENFADEH )
#define SCREENFADEH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef struct screenfade_s
{
float fadeSpeed; // How fast to fade (tics / second) (+ fade in, - fade out)
float fadeEnd; // When the fading hits maximum
float fadeTotalEnd; // Total End Time of the fade (used for FFADE_OUT)
float fadeReset; // When to reset to not fading (for fadeout and hold)
byte fader, fadeg, fadeb, fadealpha; // Fade color
int fadeFlags; // Fading flags
} screenfade_t;
#endif // !SCREENFADEH

View File

@ -0,0 +1,31 @@
/***
*
* Copyright (c) 1999, 2000, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( STUDIO_EVENTH )
#define STUDIO_EVENTH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef struct mstudioevent_s
{
int frame;
int event;
int type;
char options[64];
} mstudioevent_t;
#endif // STUDIO_EVENTH

View File

@ -0,0 +1,61 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( TRIANGLEAPIH )
#define TRIANGLEAPIH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef enum
{
TRI_FRONT = 0,
TRI_NONE = 1,
} TRICULLSTYLE;
#define TRI_API_VERSION 1
#define TRI_TRIANGLES 0
#define TRI_TRIANGLE_FAN 1
#define TRI_QUADS 2
#define TRI_POLYGON 3
#define TRI_LINES 4
#define TRI_TRIANGLE_STRIP 5
#define TRI_QUAD_STRIP 6
typedef struct triangleapi_s
{
int version;
void ( *RenderMode )( int mode );
void ( *Begin )( int primitiveCode );
void ( *End ) ( void );
void ( *Color4f ) ( float r, float g, float b, float a );
void ( *Color4ub ) ( unsigned char r, unsigned char g, unsigned char b, unsigned char a );
void ( *TexCoord2f ) ( float u, float v );
void ( *Vertex3fv ) ( float *worldPnt );
void ( *Vertex3f ) ( float x, float y, float z );
void ( *Brightness ) ( float brightness );
void ( *CullFace ) ( TRICULLSTYLE style );
int ( *SpriteTexture ) ( struct model_s *pSpriteModel, int frame );
int ( *WorldToScreen ) ( float *world, float *screen ); // Returns 1 if it's z clipped
void ( *Fog ) ( float flFogColor[3], float flStart, float flEnd, int bOn ); //Works just like GL_FOG, flFogColor is r/g/b.
void ( *ScreenToWorld ) ( float *screen, float *world );
} triangleapi_t;
#endif // !TRIANGLEAPIH

43
hlsdk/common/usercmd.h Normal file
View File

@ -0,0 +1,43 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef USERCMD_H
#define USERCMD_H
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef struct usercmd_s
{
short lerp_msec; // Interpolation time on client
byte msec; // Duration in ms of command
vec3_t viewangles; // Command view angles.
// intended velocities
float forwardmove; // Forward velocity.
float sidemove; // Sideways velocity.
float upmove; // Upward velocity.
byte lightlevel; // Light level at spot where we are standing.
unsigned short buttons; // Attack buttons
byte impulse; // Impulse command issued.
byte weaponselect; // Current weapon id
// Experimental player impact stuff.
int impact_index;
vec3_t impact_position;
} usercmd_t;
#endif // USERCMD_H

54
hlsdk/common/weaponinfo.h Normal file
View File

@ -0,0 +1,54 @@
/***
*
* Copyright (c) 1999, 2000, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined ( WEAPONINFOH )
#define WEAPONINFOH
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
// Info about weapons player might have in his/her possession
typedef struct weapon_data_s
{
int m_iId;
int m_iClip;
float m_flNextPrimaryAttack;
float m_flNextSecondaryAttack;
float m_flTimeWeaponIdle;
int m_fInReload;
int m_fInSpecialReload;
float m_flNextReload;
float m_flPumpTime;
float m_fReloadTime;
float m_fAimedDamage;
float m_fNextAimBonus;
int m_fInZoom;
int m_iWeaponState;
int iuser1;
int iuser2;
int iuser3;
int iuser4;
float fuser1;
float fuser2;
float fuser3;
float fuser4;
} weapon_data_t;
#endif

46
hlsdk/dlls/cdll_dll.h Normal file
View File

@ -0,0 +1,46 @@
/***
*
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
//
// cdll_dll.h
// this file is included by both the game-dll and the client-dll,
#ifndef CDLL_DLL_H
#define CDLL_DLL_H
#define MAX_WEAPONS 32 // ???
#define MAX_WEAPON_SLOTS 5 // hud item selection slots
#define MAX_ITEM_TYPES 6 // hud item selection slots
#define MAX_ITEMS 5 // hard coded item types
#define HIDEHUD_WEAPONS ( 1<<0 )
#define HIDEHUD_FLASHLIGHT ( 1<<1 )
#define HIDEHUD_ALL ( 1<<2 )
#define HIDEHUD_HEALTH ( 1<<3 )
#define MAX_AMMO_TYPES 32 // ???
#define MAX_AMMO_SLOTS 32 // not really slots
#define HUD_PRINTNOTIFY 1
#define HUD_PRINTCONSOLE 2
#define HUD_PRINTTALK 3
#define HUD_PRINTCENTER 4
#define WEAPON_SUIT 31
#endif

163
hlsdk/dlls/enginecallback.h Normal file
View File

@ -0,0 +1,163 @@
/***
*
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef ENGINECALLBACK_H
#define ENGINECALLBACK_H
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
#include "event_flags.h"
// Must be provided by user of this code
extern enginefuncs_t g_engfuncs;
// The actual engine callbacks
#define GETPLAYERUSERID (*g_engfuncs.pfnGetPlayerUserId)
#define PRECACHE_MODEL (*g_engfuncs.pfnPrecacheModel)
#define PRECACHE_SOUND (*g_engfuncs.pfnPrecacheSound)
#define PRECACHE_GENERIC (*g_engfuncs.pfnPrecacheGeneric)
#define SET_MODEL (*g_engfuncs.pfnSetModel)
#define MODEL_INDEX (*g_engfuncs.pfnModelIndex)
#define MODEL_FRAMES (*g_engfuncs.pfnModelFrames)
#define SET_SIZE (*g_engfuncs.pfnSetSize)
#define CHANGE_LEVEL (*g_engfuncs.pfnChangeLevel)
#define GET_SPAWN_PARMS (*g_engfuncs.pfnGetSpawnParms)
#define SAVE_SPAWN_PARMS (*g_engfuncs.pfnSaveSpawnParms)
#define VEC_TO_YAW (*g_engfuncs.pfnVecToYaw)
#define VEC_TO_ANGLES (*g_engfuncs.pfnVecToAngles)
#define MOVE_TO_ORIGIN (*g_engfuncs.pfnMoveToOrigin)
#define oldCHANGE_YAW (*g_engfuncs.pfnChangeYaw)
#define CHANGE_PITCH (*g_engfuncs.pfnChangePitch)
#define MAKE_VECTORS (*g_engfuncs.pfnMakeVectors)
#define CREATE_ENTITY (*g_engfuncs.pfnCreateEntity)
#define REMOVE_ENTITY (*g_engfuncs.pfnRemoveEntity)
#define CREATE_NAMED_ENTITY (*g_engfuncs.pfnCreateNamedEntity)
#define MAKE_STATIC (*g_engfuncs.pfnMakeStatic)
#define ENT_IS_ON_FLOOR (*g_engfuncs.pfnEntIsOnFloor)
#define DROP_TO_FLOOR (*g_engfuncs.pfnDropToFloor)
#define WALK_MOVE (*g_engfuncs.pfnWalkMove)
#define SET_ORIGIN (*g_engfuncs.pfnSetOrigin)
#define EMIT_SOUND_DYN2 (*g_engfuncs.pfnEmitSound)
#define BUILD_SOUND_MSG (*g_engfuncs.pfnBuildSoundMsg)
#define TRACE_LINE (*g_engfuncs.pfnTraceLine)
#define TRACE_TOSS (*g_engfuncs.pfnTraceToss)
#define TRACE_MONSTER_HULL (*g_engfuncs.pfnTraceMonsterHull)
#define TRACE_HULL (*g_engfuncs.pfnTraceHull)
#define GET_AIM_VECTOR (*g_engfuncs.pfnGetAimVector)
#define SERVER_COMMAND (*g_engfuncs.pfnServerCommand)
#define SERVER_EXECUTE (*g_engfuncs.pfnServerExecute)
#define CLIENT_COMMAND (*g_engfuncs.pfnClientCommand)
#define PARTICLE_EFFECT (*g_engfuncs.pfnParticleEffect)
#define LIGHT_STYLE (*g_engfuncs.pfnLightStyle)
#define DECAL_INDEX (*g_engfuncs.pfnDecalIndex)
#define POINT_CONTENTS (*g_engfuncs.pfnPointContents)
#define CRC32_INIT (*g_engfuncs.pfnCRC32_Init)
#define CRC32_PROCESS_BUFFER (*g_engfuncs.pfnCRC32_ProcessBuffer)
#define CRC32_PROCESS_BYTE (*g_engfuncs.pfnCRC32_ProcessByte)
#define CRC32_FINAL (*g_engfuncs.pfnCRC32_Final)
#define RANDOM_LONG (*g_engfuncs.pfnRandomLong)
#define RANDOM_FLOAT (*g_engfuncs.pfnRandomFloat)
#define GETPLAYERWONID (*g_engfuncs.pfnGetPlayerWONId)
inline void MESSAGE_BEGIN( int msg_dest, int msg_type, const float *pOrigin = NULL, edict_t *ed = NULL ) {
(*g_engfuncs.pfnMessageBegin)(msg_dest, msg_type, pOrigin, ed);
}
#define MESSAGE_END (*g_engfuncs.pfnMessageEnd)
#define WRITE_BYTE (*g_engfuncs.pfnWriteByte)
#define WRITE_CHAR (*g_engfuncs.pfnWriteChar)
#define WRITE_SHORT (*g_engfuncs.pfnWriteShort)
#define WRITE_LONG (*g_engfuncs.pfnWriteLong)
#define WRITE_ANGLE (*g_engfuncs.pfnWriteAngle)
#define WRITE_COORD (*g_engfuncs.pfnWriteCoord)
#define WRITE_STRING (*g_engfuncs.pfnWriteString)
#define WRITE_ENTITY (*g_engfuncs.pfnWriteEntity)
#define CVAR_REGISTER (*g_engfuncs.pfnCVarRegister)
#define CVAR_GET_FLOAT (*g_engfuncs.pfnCVarGetFloat)
#define CVAR_GET_STRING (*g_engfuncs.pfnCVarGetString)
#define CVAR_SET_FLOAT (*g_engfuncs.pfnCVarSetFloat)
#define CVAR_SET_STRING (*g_engfuncs.pfnCVarSetString)
#define CVAR_GET_POINTER (*g_engfuncs.pfnCVarGetPointer)
#define ALERT (*g_engfuncs.pfnAlertMessage)
#define ENGINE_FPRINTF (*g_engfuncs.pfnEngineFprintf)
#define ALLOC_PRIVATE (*g_engfuncs.pfnPvAllocEntPrivateData)
#define GET_PRIVATE(pent) ((void*)(pent!=NULL?pent->pvPrivateData:NULL))
/*inline void *GET_PRIVATE( edict_t *pent )
{
if ( pent )
return pent->pvPrivateData;
return NULL;
}*/
#define FREE_PRIVATE (*g_engfuncs.pfnFreeEntPrivateData)
//#define STRING (*g_engfuncs.pfnSzFromIndex)
#define ALLOC_STRING (*g_engfuncs.pfnAllocString)
#define FIND_ENTITY_BY_STRING (*g_engfuncs.pfnFindEntityByString)
#define GETENTITYILLUM (*g_engfuncs.pfnGetEntityIllum)
#define FIND_ENTITY_IN_SPHERE (*g_engfuncs.pfnFindEntityInSphere)
#define FIND_CLIENT_IN_PVS (*g_engfuncs.pfnFindClientInPVS)
#define EMIT_AMBIENT_SOUND (*g_engfuncs.pfnEmitAmbientSound)
#define GET_MODEL_PTR (*g_engfuncs.pfnGetModelPtr)
#define REG_USER_MSG (*g_engfuncs.pfnRegUserMsg)
#define GET_BONE_POSITION (*g_engfuncs.pfnGetBonePosition)
#define FUNCTION_FROM_NAME (*g_engfuncs.pfnFunctionFromName)
#define NAME_FOR_FUNCTION (*g_engfuncs.pfnNameForFunction)
#define TRACE_TEXTURE (*g_engfuncs.pfnTraceTexture)
#define CLIENT_PRINTF (*g_engfuncs.pfnClientPrintf)
#define CMD_ARGS (*g_engfuncs.pfnCmd_Args)
#define CMD_ARGC (*g_engfuncs.pfnCmd_Argc)
#define CMD_ARGV (*g_engfuncs.pfnCmd_Argv)
#define GET_ATTACHMENT (*g_engfuncs.pfnGetAttachment)
#define SET_VIEW (*g_engfuncs.pfnSetView)
#define SET_CROSSHAIRANGLE (*g_engfuncs.pfnCrosshairAngle)
#define LOAD_FILE_FOR_ME (*g_engfuncs.pfnLoadFileForMe)
#define FREE_FILE (*g_engfuncs.pfnFreeFile)
#define COMPARE_FILE_TIME (*g_engfuncs.pfnCompareFileTime)
#define GET_GAME_DIR (*g_engfuncs.pfnGetGameDir)
#define IS_MAP_VALID (*g_engfuncs.pfnIsMapValid)
#define NUMBER_OF_ENTITIES (*g_engfuncs.pfnNumberOfEntities)
#define IS_DEDICATED_SERVER (*g_engfuncs.pfnIsDedicatedServer)
#define PRECACHE_EVENT (*g_engfuncs.pfnPrecacheEvent)
#define PLAYBACK_EVENT_FULL (*g_engfuncs.pfnPlaybackEvent)
#define ENGINE_SET_PVS (*g_engfuncs.pfnSetFatPVS)
#define ENGINE_SET_PAS (*g_engfuncs.pfnSetFatPAS)
#define ENGINE_CHECK_VISIBILITY (*g_engfuncs.pfnCheckVisibility)
#define DELTA_SET ( *g_engfuncs.pfnDeltaSetField )
#define DELTA_UNSET ( *g_engfuncs.pfnDeltaUnsetField )
#define DELTA_ADDENCODER ( *g_engfuncs.pfnDeltaAddEncoder )
#define ENGINE_CURRENT_PLAYER ( *g_engfuncs.pfnGetCurrentPlayer )
#define ENGINE_CANSKIP ( *g_engfuncs.pfnCanSkipPlayer )
#define DELTA_FINDFIELD ( *g_engfuncs.pfnDeltaFindField )
#define DELTA_SETBYINDEX ( *g_engfuncs.pfnDeltaSetFieldByIndex )
#define DELTA_UNSETBYINDEX ( *g_engfuncs.pfnDeltaUnsetFieldByIndex )
#define ENGINE_GETPHYSINFO ( *g_engfuncs.pfnGetPhysicsInfoString )
#define ENGINE_SETGROUPMASK ( *g_engfuncs.pfnSetGroupMask )
#define ENGINE_INSTANCE_BASELINE ( *g_engfuncs.pfnCreateInstancedBaseline )
#define ENGINE_FORCE_UNMODIFIED ( *g_engfuncs.pfnForceUnmodified )
#define PLAYER_CNX_STATS ( *g_engfuncs.pfnGetPlayerStats )
#endif //ENGINECALLBACK_H

83
hlsdk/dlls/extdll.h Normal file
View File

@ -0,0 +1,83 @@
/***
*
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef EXTDLL_H
#define EXTDLL_H
//
// Global header file for extension DLLs
//
// Allow "DEBUG" in addition to default "_DEBUG"
#ifdef _DEBUG
#define DEBUG 1
#endif
// Prevent tons of unused windows definitions
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#define NOWINRES
#define NOSERVICE
#define NOMCX
#define NOIME
#include "windows.h"
#else // _WIN32
#define FALSE 0
#define TRUE (!FALSE)
typedef unsigned int ULONG;
typedef unsigned char BYTE;
typedef int BOOL;
#define MAX_PATH PATH_MAX
#include <limits.h>
#include <stdarg.h>
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define _vsnprintf(a,b,c,d) vsnprintf(a,b,c,d)
#endif
#endif //_WIN32
// Misc C-runtime library headers
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
// Header file containing definition of globalvars_t and entvars_t
typedef int func_t; //
typedef int string_t; // from engine's pr_comp.h;
typedef float vec_t; // needed before including progdefs.h
// Vector class
#include "vector.h"
// Defining it as a (bogus) struct helps enforce type-checking
#define vec3_t Vector
// Shared engine/DLL constants
#include "const.h"
#include "progdefs.h"
#include "edict.h"
// Shared header describing protocol between engine and DLLs
#include "eiface.h"
// Shared header between the client DLL and the game DLLs
#include "cdll_dll.h"
#endif //EXTDLL_H

515
hlsdk/dlls/util.h Normal file
View File

@ -0,0 +1,515 @@
/***
*
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
//
// Misc utility code
//
#define SVC_DIRECTOR 51
inline void MESSAGE_BEGIN( int msg_dest, int msg_type, const float *pOrigin, entvars_t *ent ); // implementation later in this file
extern globalvars_t *gpGlobals;
// Use this instead of ALLOC_STRING on constant strings
//#define STRING(offset) ((const char *)(gpGlobals->pStringBase + (int)offset))
//#define MAKE_STRING(str) ((int)str - (int)STRING(0))
inline const char *STRING(long offset) {return (const char *)(gpGlobals->pStringBase + (long)offset);}
inline long MAKE_STRING(const char *str) {return (long)str - (long)STRING(0);}
inline edict_t *FIND_ENTITY_BY_CLASSNAME(edict_t *entStart, const char *pszName)
{
return FIND_ENTITY_BY_STRING(entStart, "classname", pszName);
}
inline edict_t *FIND_ENTITY_BY_TARGETNAME(edict_t *entStart, const char *pszName)
{
return FIND_ENTITY_BY_STRING(entStart, "targetname", pszName);
}
// for doing a reverse lookup. Say you have a door, and want to find its button.
inline edict_t *FIND_ENTITY_BY_TARGET(edict_t *entStart, const char *pszName)
{
return FIND_ENTITY_BY_STRING(entStart, "target", pszName);
}
// Keeps clutter down a bit, when writing key-value pairs
#define WRITEKEY_INT(pf, szKeyName, iKeyValue) ENGINE_FPRINTF(pf, "\"%s\" \"%d\"\n", szKeyName, iKeyValue)
#define WRITEKEY_FLOAT(pf, szKeyName, flKeyValue) \
ENGINE_FPRINTF(pf, "\"%s\" \"%f\"\n", szKeyName, flKeyValue)
#define WRITEKEY_STRING(pf, szKeyName, szKeyValue) \
ENGINE_FPRINTF(pf, "\"%s\" \"%s\"\n", szKeyName, szKeyValue)
#define WRITEKEY_VECTOR(pf, szKeyName, flX, flY, flZ) \
ENGINE_FPRINTF(pf, "\"%s\" \"%f %f %f\"\n", szKeyName, flX, flY, flZ)
// Keeps clutter down a bit, when using a float as a bit-vector
#define SetBits(flBitVector, bits) ((flBitVector) = (int)(flBitVector) | (bits))
#define ClearBits(flBitVector, bits) ((flBitVector) = (int)(flBitVector) & ~(bits))
#define FBitSet(flBitVector, bit) ((int)(flBitVector) & (bit))
// Makes these more explicit, and easier to find
#define FILE_GLOBAL static
#define DLL_GLOBAL
// Until we figure out why "const" gives the compiler problems, we'll just have to use
// this bogus "empty" define to mark things as constant.
#define CONSTANT
// More explicit than "int"
typedef int EOFFSET;
// In case it's not alread defined
typedef int BOOL;
// In case this ever changes
#define M_PI 3.14159265358979323846
// Keeps clutter down a bit, when declaring external entity/global method prototypes
#define DECLARE_GLOBAL_METHOD(MethodName) extern void DLLEXPORT MethodName( void )
#define GLOBAL_METHOD(funcname) void DLLEXPORT funcname(void)
// This is the glue that hooks .MAP entity class names to our CPP classes
// The _declspec forces them to be exported by name so we can do a lookup with GetProcAddress()
// The function is used to intialize / allocate the object for the entity
#ifdef _WIN32
#define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) \
extern "C" __declspec( dllexport ) void mapClassName( entvars_t *pev ); \
void mapClassName( entvars_t *pev ) { GetClassPtr( (DLLClassName *)pev ); }
#else
#define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) extern "C" void mapClassName( entvars_t *pev ); void mapClassName( entvars_t *pev ) { GetClassPtr( (DLLClassName *)pev ); }
#endif
//
// Conversion among the three types of "entity", including identity-conversions.
//
#ifdef DEBUG
extern edict_t *DBG_EntOfVars(const entvars_t *pev);
inline edict_t *ENT(const entvars_t *pev) { return DBG_EntOfVars(pev); }
#else
inline edict_t *ENT(const entvars_t *pev) { return pev->pContainingEntity; }
#endif
inline edict_t *ENT(edict_t *pent) { return pent; }
inline edict_t *ENT(EOFFSET eoffset) { return (*g_engfuncs.pfnPEntityOfEntOffset)(eoffset); }
inline EOFFSET OFFSET(EOFFSET eoffset) { return eoffset; }
inline EOFFSET OFFSET(const edict_t *pent)
{
#ifdef _DEBUG
if ( !pent )
ALERT( at_error, "Bad ent in OFFSET()\n" );
#endif
return (*g_engfuncs.pfnEntOffsetOfPEntity)(pent);
}
inline EOFFSET OFFSET(entvars_t *pev)
{
#ifdef _DEBUG
if ( !pev )
ALERT( at_error, "Bad pev in OFFSET()\n" );
#endif
return OFFSET(ENT(pev));
}
inline entvars_t *VARS(entvars_t *pev) { return pev; }
inline entvars_t *VARS(edict_t *pent)
{
if ( !pent )
return NULL;
return &pent->v;
}
inline entvars_t* VARS(EOFFSET eoffset) { return VARS(ENT(eoffset)); }
inline int ENTINDEX(edict_t *pEdict) { return (*g_engfuncs.pfnIndexOfEdict)(pEdict); }
inline edict_t* INDEXENT( int iEdictNum ) { return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum); }
inline void MESSAGE_BEGIN( int msg_dest, int msg_type, const float *pOrigin, entvars_t *ent ) {
(*g_engfuncs.pfnMessageBegin)(msg_dest, msg_type, pOrigin, ENT(ent));
}
// Testing the three types of "entity" for nullity
#define eoNullEntity 0
inline BOOL FNullEnt(EOFFSET eoffset) { return eoffset == 0; }
inline BOOL FNullEnt(const edict_t* pent) { return pent == NULL || FNullEnt(OFFSET(pent)); }
inline BOOL FNullEnt(entvars_t* pev) { return pev == NULL || FNullEnt(OFFSET(pev)); }
// Testing strings for nullity
#define iStringNull 0
inline BOOL FStringNull(int iString) { return iString == iStringNull; }
#define cchMapNameMost 32
// Dot products for view cone checking
#define VIEW_FIELD_FULL (float)-1.0 // +-180 degrees
#define VIEW_FIELD_WIDE (float)-0.7 // +-135 degrees 0.1 // +-85 degrees, used for full FOV checks
#define VIEW_FIELD_NARROW (float)0.7 // +-45 degrees, more narrow check used to set up ranged attacks
#define VIEW_FIELD_ULTRA_NARROW (float)0.9 // +-25 degrees, more narrow check used to set up ranged attacks
// All monsters need this data
#define DONT_BLEED -1
#define BLOOD_COLOR_RED (BYTE)247
#define BLOOD_COLOR_YELLOW (BYTE)195
#define BLOOD_COLOR_GREEN BLOOD_COLOR_YELLOW
typedef enum
{
MONSTERSTATE_NONE = 0,
MONSTERSTATE_IDLE,
MONSTERSTATE_COMBAT,
MONSTERSTATE_ALERT,
MONSTERSTATE_HUNT,
MONSTERSTATE_PRONE,
MONSTERSTATE_SCRIPT,
MONSTERSTATE_PLAYDEAD,
MONSTERSTATE_DEAD
} MONSTERSTATE;
// Things that toggle (buttons/triggers/doors) need this
typedef enum
{
TS_AT_TOP,
TS_AT_BOTTOM,
TS_GOING_UP,
TS_GOING_DOWN
} TOGGLE_STATE;
// Misc useful
#include "string.h"
inline BOOL FStrEq(const char*sz1, const char*sz2)
{ return (strcmp(sz1, sz2) == 0); }
inline BOOL FClassnameIs(edict_t* pent, const char* szClassname)
{ return FStrEq(STRING(VARS(pent)->classname), szClassname); }
inline BOOL FClassnameIs(entvars_t* pev, const char* szClassname)
{ return FStrEq(STRING(pev->classname), szClassname); }
// Misc. Prototypes
extern void UTIL_SetSize (entvars_t* pev, const Vector &vecMin, const Vector &vecMax);
extern float UTIL_VecToYaw (const Vector &vec);
extern Vector UTIL_VecToAngles (const Vector &vec);
extern float UTIL_AngleMod (float a);
extern float UTIL_AngleDiff ( float destAngle, float srcAngle );
#define UTIL_EntitiesInPVS(pent) (*g_engfuncs.pfnEntitiesInPVS)(pent)
extern void UTIL_MakeVectors (const Vector &vecAngles);
inline void UTIL_MakeVectorsPrivate( Vector &vecAngles, float *p_vForward, float *p_vRight, float *p_vUp )
{
g_engfuncs.pfnAngleVectors( vecAngles, p_vForward, p_vRight, p_vUp );
}
extern void UTIL_MakeAimVectors ( const Vector &vecAngles ); // like MakeVectors, but assumes pitch isn't inverted
extern void UTIL_MakeInvVectors ( const Vector &vec, globalvars_t *pgv );
extern void UTIL_SetOrigin ( entvars_t* pev, const Vector &vecOrigin );
extern void UTIL_EmitAmbientSound ( edict_t *entity, const Vector &vecOrigin, const char *samp, float vol, float attenuation, int fFlags, int pitch );
extern void UTIL_ParticleEffect ( const Vector &vecOrigin, const Vector &vecDirection, ULONG ulColor, ULONG ulCount );
extern void UTIL_ScreenShake ( const Vector &center, float amplitude, float frequency, float duration, float radius );
extern void UTIL_ScreenShakeAll ( const Vector &center, float amplitude, float frequency, float duration );
extern void UTIL_ShowMessageAll ( const char *pString );
extern void UTIL_ScreenFadeAll ( const Vector &color, float fadeTime, float holdTime, int alpha, int flags );
typedef enum { ignore_monsters=1, dont_ignore_monsters=0, missile=2 } IGNORE_MONSTERS;
typedef enum { ignore_glass=1, dont_ignore_glass=0 } IGNORE_GLASS;
extern void UTIL_TraceLine (const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, edict_t *pentIgnore, TraceResult *ptr);
extern void UTIL_TraceLine (const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, IGNORE_GLASS ignoreGlass, edict_t *pentIgnore, TraceResult *ptr);
typedef enum { point_hull=0, human_hull=1, large_hull=2, head_hull=3 } hull_enum;
extern void UTIL_TraceHull (const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, int hullNumber, edict_t *pentIgnore, TraceResult *ptr);
extern TraceResult UTIL_GetGlobalTrace (void);
extern void UTIL_TraceModel (const Vector &vecStart, const Vector &vecEnd, int hullNumber, edict_t *pentModel, TraceResult *ptr);
extern Vector UTIL_GetAimVector (edict_t* pent, float flSpeed);
extern int UTIL_PointContents (const Vector &vec);
extern void UTIL_BloodStream( const Vector &origin, const Vector &direction, int color, int amount );
extern void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color, int amount );
extern Vector UTIL_RandomBloodVector( void );
extern BOOL UTIL_ShouldShowBlood( int bloodColor );
extern void UTIL_BloodDecalTrace( TraceResult *pTrace, int bloodColor );
extern void UTIL_DecalTrace( TraceResult *pTrace, int decalNumber );
extern void UTIL_PlayerDecalTrace( TraceResult *pTrace, int playernum, int decalNumber, BOOL bIsCustom );
extern void UTIL_GunshotDecalTrace( TraceResult *pTrace, int decalNumber );
extern void UTIL_Sparks( const Vector &position );
extern void UTIL_Ricochet( const Vector &position, float scale );
extern void UTIL_StringToVector( float *pVector, const char *pString );
extern void UTIL_StringToIntArray( int *pVector, int count, const char *pString );
extern Vector UTIL_ClampVectorToBox( const Vector &input, const Vector &clampSize );
extern float UTIL_Approach( float target, float value, float speed );
extern float UTIL_ApproachAngle( float target, float value, float speed );
extern float UTIL_AngleDistance( float next, float cur );
extern char *UTIL_VarArgs( char *format, ... );
extern BOOL UTIL_IsValidEntity( edict_t *pent );
extern BOOL UTIL_TeamsMatch( const char *pTeamName1, const char *pTeamName2 );
// Use for ease-in, ease-out style interpolation (accel/decel)
extern float UTIL_SplineFraction( float value, float scale );
// Search for water transition along a vertical line
extern float UTIL_WaterLevel( const Vector &position, float minz, float maxz );
extern void UTIL_Bubbles( Vector mins, Vector maxs, int count );
extern void UTIL_BubbleTrail( Vector from, Vector to, int count );
// allows precacheing of other entities
extern void UTIL_PrecacheOther( const char *szClassname );
// prints a message to each client
extern void UTIL_ClientPrintAll( int msg_dest, const char *msg_name, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL );
inline void UTIL_CenterPrintAll( const char *msg_name, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL )
{
UTIL_ClientPrintAll( HUD_PRINTCENTER, msg_name, param1, param2, param3, param4 );
}
class CBasePlayerItem;
class CBasePlayer;
extern BOOL UTIL_GetNextBestWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon );
// prints messages through the HUD
extern void ClientPrint( entvars_t *client, int msg_dest, const char *msg_name, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL );
typedef struct hudtextparms_s
{
float x;
float y;
int effect;
byte r1, g1, b1, a1;
byte r2, g2, b2, a2;
float fadeinTime;
float fadeoutTime;
float holdTime;
float fxTime;
int channel;
} hudtextparms_t;
// prints as transparent 'title' to the HUD
extern void UTIL_HudMessageAll( const hudtextparms_t &textparms, const char *pMessage );
// for handy use with ClientPrint params
extern char *UTIL_dtos1( int d );
extern char *UTIL_dtos2( int d );
extern char *UTIL_dtos3( int d );
extern char *UTIL_dtos4( int d );
// Writes message to console with timestamp and FragLog header.
extern void UTIL_LogPrintf( char *fmt, ... );
// Sorta like FInViewCone, but for nonmonsters.
extern float UTIL_DotPoints ( const Vector &vecSrc, const Vector &vecCheck, const Vector &vecDir );
extern void UTIL_StripToken( const char *pKey, char *pDest );// for redundant keynames
// Misc functions
extern void SetMovedir(entvars_t* pev);
extern Vector VecBModelOrigin( entvars_t* pevBModel );
extern int BuildChangeList( LEVELLIST *pLevelList, int maxList );
//
// How did I ever live without ASSERT?
//
#ifdef DEBUG
void DBG_AssertFunction(BOOL fExpr, const char* szExpr, const char* szFile, int szLine, const char* szMessage);
#define ASSERT(f) DBG_AssertFunction(f, #f, __FILE__, __LINE__, NULL)
#define ASSERTSZ(f, sz) DBG_AssertFunction(f, #f, __FILE__, __LINE__, sz)
#else // !DEBUG
#define ASSERT(f)
#define ASSERTSZ(f, sz)
#endif // !DEBUG
extern DLL_GLOBAL const Vector g_vecZero;
//
// Constants that were used only by QC (maybe not used at all now)
//
// Un-comment only as needed
//
#define LANGUAGE_ENGLISH 0
#define LANGUAGE_GERMAN 1
#define LANGUAGE_FRENCH 2
#define LANGUAGE_BRITISH 3
extern DLL_GLOBAL int g_Language;
#define AMBIENT_SOUND_STATIC 0 // medium radius attenuation
#define AMBIENT_SOUND_EVERYWHERE 1
#define AMBIENT_SOUND_SMALLRADIUS 2
#define AMBIENT_SOUND_MEDIUMRADIUS 4
#define AMBIENT_SOUND_LARGERADIUS 8
#define AMBIENT_SOUND_START_SILENT 16
#define AMBIENT_SOUND_NOT_LOOPING 32
#define SPEAKER_START_SILENT 1 // wait for trigger 'on' to start announcements
#define SND_SPAWNING (1<<8) // duplicated in protocol.h we're spawing, used in some cases for ambients
#define SND_STOP (1<<5) // duplicated in protocol.h stop sound
#define SND_CHANGE_VOL (1<<6) // duplicated in protocol.h change sound vol
#define SND_CHANGE_PITCH (1<<7) // duplicated in protocol.h change sound pitch
#define LFO_SQUARE 1
#define LFO_TRIANGLE 2
#define LFO_RANDOM 3
// func_rotating
#define SF_BRUSH_ROTATE_Y_AXIS 0
#define SF_BRUSH_ROTATE_INSTANT 1
#define SF_BRUSH_ROTATE_BACKWARDS 2
#define SF_BRUSH_ROTATE_Z_AXIS 4
#define SF_BRUSH_ROTATE_X_AXIS 8
#define SF_PENDULUM_AUTO_RETURN 16
#define SF_PENDULUM_PASSABLE 32
#define SF_BRUSH_ROTATE_SMALLRADIUS 128
#define SF_BRUSH_ROTATE_MEDIUMRADIUS 256
#define SF_BRUSH_ROTATE_LARGERADIUS 512
#define PUSH_BLOCK_ONLY_X 1
#define PUSH_BLOCK_ONLY_Y 2
#define VEC_HULL_MIN Vector(-16, -16, -36)
#define VEC_HULL_MAX Vector( 16, 16, 36)
#define VEC_HUMAN_HULL_MIN Vector( -16, -16, 0 )
#define VEC_HUMAN_HULL_MAX Vector( 16, 16, 72 )
#define VEC_HUMAN_HULL_DUCK Vector( 16, 16, 36 )
#define VEC_VIEW Vector( 0, 0, 28 )
#define VEC_DUCK_HULL_MIN Vector(-16, -16, -18 )
#define VEC_DUCK_HULL_MAX Vector( 16, 16, 18)
#define VEC_DUCK_VIEW Vector( 0, 0, 12 )
#define SVC_TEMPENTITY 23
#define SVC_INTERMISSION 30
#define SVC_CDTRACK 32
#define SVC_WEAPONANIM 35
#define SVC_ROOMTYPE 37
#define SVC_HLTV 50
// prxoy director stuff
#define DRC_EVENT 3 // informs the dircetor about ann important game event
#define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important)
#define DRC_FLAG_DRAMATIC (1<<5)
// triggers
#define SF_TRIGGER_ALLOWMONSTERS 1// monsters allowed to fire this trigger
#define SF_TRIGGER_NOCLIENTS 2// players not allowed to fire this trigger
#define SF_TRIGGER_PUSHABLES 4// only pushables can fire this trigger
// func breakable
#define SF_BREAK_TRIGGER_ONLY 1// may only be broken by trigger
#define SF_BREAK_TOUCH 2// can be 'crashed through' by running player (plate glass)
#define SF_BREAK_PRESSURE 4// can be broken by a player standing on it
#define SF_BREAK_CROWBAR 256// instant break if hit with crowbar
// func_pushable (it's also func_breakable, so don't collide with those flags)
#define SF_PUSH_BREAKABLE 128
#define SF_LIGHT_START_OFF 1
#define SPAWNFLAG_NOMESSAGE 1
#define SPAWNFLAG_NOTOUCH 1
#define SPAWNFLAG_DROIDONLY 4
#define SPAWNFLAG_USEONLY 1 // can't be touched, must be used (buttons)
#define TELE_PLAYER_ONLY 1
#define TELE_SILENT 2
#define SF_TRIG_PUSH_ONCE 1
// Sound Utilities
// sentence groups
#define CBSENTENCENAME_MAX 16
#define CVOXFILESENTENCEMAX 1536 // max number of sentences in game. NOTE: this must match
// CVOXFILESENTENCEMAX in engine\sound.h!!!
extern char gszallsentencenames[CVOXFILESENTENCEMAX][CBSENTENCENAME_MAX];
extern int gcallsentences;
int USENTENCEG_Pick(int isentenceg, char *szfound);
int USENTENCEG_PickSequential(int isentenceg, char *szfound, int ipick, int freset);
void USENTENCEG_InitLRU(unsigned char *plru, int count);
void SENTENCEG_Init();
void SENTENCEG_Stop(edict_t *entity, int isentenceg, int ipick);
int SENTENCEG_PlayRndI(edict_t *entity, int isentenceg, float volume, float attenuation, int flags, int pitch);
int SENTENCEG_PlayRndSz(edict_t *entity, const char *szrootname, float volume, float attenuation, int flags, int pitch);
int SENTENCEG_PlaySequentialSz(edict_t *entity, const char *szrootname, float volume, float attenuation, int flags, int pitch, int ipick, int freset);
int SENTENCEG_GetIndex(const char *szrootname);
int SENTENCEG_Lookup(const char *sample, char *sentencenum);
void TEXTURETYPE_Init();
char TEXTURETYPE_Find(char *name);
float TEXTURETYPE_PlaySound(TraceResult *ptr, Vector vecSrc, Vector vecEnd, int iBulletType);
// NOTE: use EMIT_SOUND_DYN to set the pitch of a sound. Pitch of 100
// is no pitch shift. Pitch > 100 up to 255 is a higher pitch, pitch < 100
// down to 1 is a lower pitch. 150 to 70 is the realistic range.
// EMIT_SOUND_DYN with pitch != 100 should be used sparingly, as it's not quite as
// fast as EMIT_SOUND (the pitchshift mixer is not native coded).
void EMIT_SOUND_DYN(edict_t *entity, int channel, const char *sample, float volume, float attenuation,
int flags, int pitch);
inline void EMIT_SOUND(edict_t *entity, int channel, const char *sample, float volume, float attenuation)
{
EMIT_SOUND_DYN(entity, channel, sample, volume, attenuation, 0, PITCH_NORM);
}
inline void STOP_SOUND(edict_t *entity, int channel, const char *sample)
{
EMIT_SOUND_DYN(entity, channel, sample, 0, 0, SND_STOP, PITCH_NORM);
}
void EMIT_SOUND_SUIT(edict_t *entity, const char *sample);
void EMIT_GROUPID_SUIT(edict_t *entity, int isentenceg);
void EMIT_GROUPNAME_SUIT(edict_t *entity, const char *groupname);
#define PRECACHE_SOUND_ARRAY( a ) \
{ for (int i = 0; i < ARRAYSIZE( a ); i++ ) PRECACHE_SOUND((char *) a [i]); }
#define EMIT_SOUND_ARRAY_DYN( chan, array ) \
EMIT_SOUND_DYN ( ENT(pev), chan , array [ RANDOM_LONG(0,ARRAYSIZE( array )-1) ], 1.0, ATTN_NORM, 0, RANDOM_LONG(95,105) );
#define RANDOM_SOUND_ARRAY( array ) (array) [ RANDOM_LONG(0,ARRAYSIZE( (array) )-1) ]
#define PLAYBACK_EVENT( flags, who, index ) PLAYBACK_EVENT_FULL( flags, who, index, 0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0 );
#define PLAYBACK_EVENT_DELAY( flags, who, index, delay ) PLAYBACK_EVENT_FULL( flags, who, index, delay, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0 );
#define GROUP_OP_AND 0
#define GROUP_OP_NAND 1
extern int g_groupmask;
extern int g_groupop;
class UTIL_GroupTrace
{
public:
UTIL_GroupTrace( int groupmask, int op );
~UTIL_GroupTrace( void );
private:
int m_oldgroupmask, m_oldgroupop;
};
void UTIL_SetGroupTrace( int groupmask, int op );
void UTIL_UnsetGroupTrace( void );
int UTIL_SharedRandomLong( unsigned int seed, int low, int high );
float UTIL_SharedRandomFloat( unsigned int seed, float low, float high );
float UTIL_WeaponTimeBase( void );

120
hlsdk/dlls/vector.h Normal file
View File

@ -0,0 +1,120 @@
/***
*
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef VECTOR_H
#define VECTOR_H
class Vector;
//=========================================================
// 2DVector - used for many pathfinding and many other
// operations that are treated as planar rather than 3d.
//=========================================================
class Vector2D
{
public:
inline Vector2D(void): x(0.0), y(0.0) { }
inline Vector2D(float X, float Y): x(0.0), y(0.0) { x = X; y = Y; }
inline Vector2D operator+(const Vector2D& v) const { return Vector2D(x+v.x, y+v.y); }
inline Vector2D operator-(const Vector2D& v) const { return Vector2D(x-v.x, y-v.y); }
inline Vector2D operator*(float fl) const { return Vector2D(x*fl, y*fl); }
inline Vector2D operator/(float fl) const { fl=1/fl; return Vector2D(x*fl, y*fl); }
inline float Length(void) const { return (float)sqrt(x*x + y*y ); }
inline Vector2D Normalize ( void ) const
{
// Vector2D vec2;
float flLen = Length();
if ( flLen == 0 )
{
return Vector2D( 0, 0 );
}
else
{
flLen = 1 / flLen;
return Vector2D( x * flLen, y * flLen );
}
}
vec_t x, y;
};
inline float DotProduct(const Vector2D& a, const Vector2D& b) { return( a.x*b.x + a.y*b.y ); }
inline Vector2D operator*(float fl, const Vector2D& v) { return v * fl; }
//=========================================================
// 3D Vector
//=========================================================
class Vector // same data-layout as engine's vec3_t,
{ // which is a vec_t[3]
public:
// Construction/destruction
inline Vector(void): x(0.0), y(0.0), z(0.0) { }
inline Vector(float X, float Y, float Z): x(0.0), y(0.0), z(0.0) { x = X; y = Y; z = Z; }
//inline Vector(double X, double Y, double Z) { x = (float)X; y = (float)Y; z = (float)Z; }
//inline Vector(int X, int Y, int Z) { x = (float)X; y = (float)Y; z = (float)Z; }
inline Vector(const Vector& v): x(0.0), y(0.0), z(0.0) { x = v.x; y = v.y; z = v.z; }
inline Vector(float rgfl[3]): x(0.0), y(0.0), z(0.0) { x = rgfl[0]; y = rgfl[1]; z = rgfl[2]; }
inline Vector(const Vector2D& v): x(0.0), y(0.0), z(0.0){ x = v.x; y = v.y; }
// Operators
inline Vector operator-(void) const { return Vector(-x,-y,-z); }
inline int operator==(const Vector& v) const { return x==v.x && y==v.y && z==v.z; }
inline int operator!=(const Vector& v) const { return !(*this==v); }
inline Vector operator+(const Vector& v) const { return Vector(x+v.x, y+v.y, z+v.z); }
inline Vector operator-(const Vector& v) const { return Vector(x-v.x, y-v.y, z-v.z); }
inline Vector operator*(float fl) const { return Vector(x*fl, y*fl, z*fl); }
inline Vector operator/(float fl) const { fl=1/fl; return Vector(x*fl, y*fl, z*fl); }
// Methods
inline void CopyToArray(float* rgfl) const { rgfl[0] = x, rgfl[1] = y, rgfl[2] = z; }
inline float Length(void) const { return (float)sqrt(x*x + y*y + z*z); }
inline operator float *() { return &x; } // Vectors will now automatically convert to float * when needed
inline operator Vector2D () const { return (*this).Make2D(); }
#if !defined(__GNUC__) || (__GNUC__ >= 3)
inline operator const float *() const { return &x; } // Vectors will now automatically convert to float * when needed
#endif
inline Vector Normalize(void) const
{
float flLen = Length();
if (flLen == 0) return Vector(0,0,1); // ????
flLen = 1 / flLen;
return Vector(x * flLen, y * flLen, z * flLen);
}
inline Vector2D Make2D ( void ) const
{
Vector2D Vec2;
Vec2.x = x;
Vec2.y = y;
return Vec2;
}
inline float Length2D(void) const { return (float)sqrt(x*x + y*y); }
// Members
vec_t x, y, z;
};
inline Vector operator*(float fl, const Vector& v) { return v * fl; }
inline float DotProduct(const Vector& a, const Vector& b) { return(a.x*b.x+a.y*b.y+a.z*b.z); }
inline Vector CrossProduct(const Vector& a, const Vector& b) { return Vector( a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x ); }
#endif

201
hlsdk/engine/Sequence.h Normal file
View File

@ -0,0 +1,201 @@
//---------------------------------------------------------------------------
//
// S c r i p t e d S e q u e n c e s
//
//---------------------------------------------------------------------------
#ifndef _INCLUDE_SEQUENCE_H_
#define _INCLUDE_SEQUENCE_H_
#ifndef _DEF_BYTE_
typedef unsigned char byte;
#endif
//---------------------------------------------------------------------------
// client_textmessage_t
//---------------------------------------------------------------------------
typedef struct client_textmessage_s
{
int effect;
byte r1, g1, b1, a1; // 2 colors for effects
byte r2, g2, b2, a2;
float x;
float y;
float fadein;
float fadeout;
float holdtime;
float fxtime;
const char *pName;
const char *pMessage;
} client_textmessage_t;
//--------------------------------------------------------------------------
// sequenceDefaultBits_e
//
// Enumerated list of possible modifiers for a command. This enumeration
// is used in a bitarray controlling what modifiers are specified for a command.
//---------------------------------------------------------------------------
enum sequenceModifierBits
{
SEQUENCE_MODIFIER_EFFECT_BIT = (1 << 1),
SEQUENCE_MODIFIER_POSITION_BIT = (1 << 2),
SEQUENCE_MODIFIER_COLOR_BIT = (1 << 3),
SEQUENCE_MODIFIER_COLOR2_BIT = (1 << 4),
SEQUENCE_MODIFIER_FADEIN_BIT = (1 << 5),
SEQUENCE_MODIFIER_FADEOUT_BIT = (1 << 6),
SEQUENCE_MODIFIER_HOLDTIME_BIT = (1 << 7),
SEQUENCE_MODIFIER_FXTIME_BIT = (1 << 8),
SEQUENCE_MODIFIER_SPEAKER_BIT = (1 << 9),
SEQUENCE_MODIFIER_LISTENER_BIT = (1 << 10),
SEQUENCE_MODIFIER_TEXTCHANNEL_BIT = (1 << 11),
};
typedef enum sequenceModifierBits sequenceModifierBits_e ;
//---------------------------------------------------------------------------
// sequenceCommandEnum_e
//
// Enumerated sequence command types.
//---------------------------------------------------------------------------
enum sequenceCommandEnum_
{
SEQUENCE_COMMAND_ERROR = -1,
SEQUENCE_COMMAND_PAUSE = 0,
SEQUENCE_COMMAND_FIRETARGETS,
SEQUENCE_COMMAND_KILLTARGETS,
SEQUENCE_COMMAND_TEXT,
SEQUENCE_COMMAND_SOUND,
SEQUENCE_COMMAND_GOSUB,
SEQUENCE_COMMAND_SENTENCE,
SEQUENCE_COMMAND_REPEAT,
SEQUENCE_COMMAND_SETDEFAULTS,
SEQUENCE_COMMAND_MODIFIER,
SEQUENCE_COMMAND_POSTMODIFIER,
SEQUENCE_COMMAND_NOOP,
SEQUENCE_MODIFIER_EFFECT,
SEQUENCE_MODIFIER_POSITION,
SEQUENCE_MODIFIER_COLOR,
SEQUENCE_MODIFIER_COLOR2,
SEQUENCE_MODIFIER_FADEIN,
SEQUENCE_MODIFIER_FADEOUT,
SEQUENCE_MODIFIER_HOLDTIME,
SEQUENCE_MODIFIER_FXTIME,
SEQUENCE_MODIFIER_SPEAKER,
SEQUENCE_MODIFIER_LISTENER,
SEQUENCE_MODIFIER_TEXTCHANNEL,
};
typedef enum sequenceCommandEnum_ sequenceCommandEnum_e;
//---------------------------------------------------------------------------
// sequenceCommandType_e
//
// Typeerated sequence command types.
//---------------------------------------------------------------------------
enum sequenceCommandType_
{
SEQUENCE_TYPE_COMMAND,
SEQUENCE_TYPE_MODIFIER,
};
typedef enum sequenceCommandType_ sequenceCommandType_e;
//---------------------------------------------------------------------------
// sequenceCommandMapping_s
//
// A mapping of a command enumerated-value to its name.
//---------------------------------------------------------------------------
typedef struct sequenceCommandMapping_ sequenceCommandMapping_s;
struct sequenceCommandMapping_
{
sequenceCommandEnum_e commandEnum;
const char* commandName;
sequenceCommandType_e commandType;
};
//---------------------------------------------------------------------------
// sequenceCommandLine_s
//
// Structure representing a single command (usually 1 line) from a
// .SEQ file entry.
//---------------------------------------------------------------------------
typedef struct sequenceCommandLine_ sequenceCommandLine_s;
struct sequenceCommandLine_
{
int commandType; // Specifies the type of command
client_textmessage_t clientMessage; // Text HUD message struct
char* speakerName; // Targetname of speaking entity
char* listenerName; // Targetname of entity being spoken to
char* soundFileName; // Name of sound file to play
char* sentenceName; // Name of sentences.txt to play
char* fireTargetNames; // List of targetnames to fire
char* killTargetNames; // List of targetnames to remove
float delay; // Seconds 'till next command
int repeatCount; // If nonzero, reset execution pointer to top of block (N times, -1 = infinite)
int textChannel; // Display channel on which text message is sent
int modifierBitField; // Bit field to specify what clientmessage fields are valid
sequenceCommandLine_s* nextCommandLine; // Next command (linked list)
};
//---------------------------------------------------------------------------
// sequenceEntry_s
//
// Structure representing a single command (usually 1 line) from a
// .SEQ file entry.
//---------------------------------------------------------------------------
typedef struct sequenceEntry_ sequenceEntry_s;
struct sequenceEntry_
{
char* fileName; // Name of sequence file without .SEQ extension
char* entryName; // Name of entry label in file
sequenceCommandLine_s* firstCommand; // Linked list of commands in entry
sequenceEntry_s* nextEntry; // Next loaded entry
qboolean isGlobal; // Is entry retained over level transitions?
};
//---------------------------------------------------------------------------
// sentenceEntry_s
// Structure representing a single sentence of a group from a .SEQ
// file entry. Sentences are identical to entries in sentences.txt, but
// can be unique per level and are loaded/unloaded with the level.
//---------------------------------------------------------------------------
typedef struct sentenceEntry_ sentenceEntry_s;
struct sentenceEntry_
{
char* data; // sentence data (ie "We have hostiles" )
sentenceEntry_s* nextEntry; // Next loaded entry
qboolean isGlobal; // Is entry retained over level transitions?
unsigned int index; // this entry's position in the file.
};
//--------------------------------------------------------------------------
// sentenceGroupEntry_s
// Structure representing a group of sentences found in a .SEQ file.
// A sentence group is defined by all sentences with the same name, ignoring
// the number at the end of the sentence name. Groups enable a sentence
// to be picked at random across a group.
//--------------------------------------------------------------------------
typedef struct sentenceGroupEntry_ sentenceGroupEntry_s;
struct sentenceGroupEntry_
{
char* groupName; // name of the group (ie CT_ALERT )
unsigned int numSentences; // number of sentences in group
sentenceEntry_s* firstSentence; // head of linked list of sentences in group
sentenceGroupEntry_s* nextEntry; // next loaded group
};
//---------------------------------------------------------------------------
// Function declarations
//---------------------------------------------------------------------------
sequenceEntry_s* SequenceGet( const char* fileName, const char* entryName );
void Sequence_ParseFile( const char* fileName, qboolean isGlobal );
void Sequence_OnLevelLoad( const char* mapName );
sentenceEntry_s* SequencePickSentence( const char *groupName, int pickMethod, int *picked );
#endif /* _INCLUDE_SEQUENCE_H_ */

177
hlsdk/engine/anorms.h Normal file
View File

@ -0,0 +1,177 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
{-0.525731, 0.000000, 0.850651},
{-0.442863, 0.238856, 0.864188},
{-0.295242, 0.000000, 0.955423},
{-0.309017, 0.500000, 0.809017},
{-0.162460, 0.262866, 0.951056},
{0.000000, 0.000000, 1.000000},
{0.000000, 0.850651, 0.525731},
{-0.147621, 0.716567, 0.681718},
{0.147621, 0.716567, 0.681718},
{0.000000, 0.525731, 0.850651},
{0.309017, 0.500000, 0.809017},
{0.525731, 0.000000, 0.850651},
{0.295242, 0.000000, 0.955423},
{0.442863, 0.238856, 0.864188},
{0.162460, 0.262866, 0.951056},
{-0.681718, 0.147621, 0.716567},
{-0.809017, 0.309017, 0.500000},
{-0.587785, 0.425325, 0.688191},
{-0.850651, 0.525731, 0.000000},
{-0.864188, 0.442863, 0.238856},
{-0.716567, 0.681718, 0.147621},
{-0.688191, 0.587785, 0.425325},
{-0.500000, 0.809017, 0.309017},
{-0.238856, 0.864188, 0.442863},
{-0.425325, 0.688191, 0.587785},
{-0.716567, 0.681718, -0.147621},
{-0.500000, 0.809017, -0.309017},
{-0.525731, 0.850651, 0.000000},
{0.000000, 0.850651, -0.525731},
{-0.238856, 0.864188, -0.442863},
{0.000000, 0.955423, -0.295242},
{-0.262866, 0.951056, -0.162460},
{0.000000, 1.000000, 0.000000},
{0.000000, 0.955423, 0.295242},
{-0.262866, 0.951056, 0.162460},
{0.238856, 0.864188, 0.442863},
{0.262866, 0.951056, 0.162460},
{0.500000, 0.809017, 0.309017},
{0.238856, 0.864188, -0.442863},
{0.262866, 0.951056, -0.162460},
{0.500000, 0.809017, -0.309017},
{0.850651, 0.525731, 0.000000},
{0.716567, 0.681718, 0.147621},
{0.716567, 0.681718, -0.147621},
{0.525731, 0.850651, 0.000000},
{0.425325, 0.688191, 0.587785},
{0.864188, 0.442863, 0.238856},
{0.688191, 0.587785, 0.425325},
{0.809017, 0.309017, 0.500000},
{0.681718, 0.147621, 0.716567},
{0.587785, 0.425325, 0.688191},
{0.955423, 0.295242, 0.000000},
{1.000000, 0.000000, 0.000000},
{0.951056, 0.162460, 0.262866},
{0.850651, -0.525731, 0.000000},
{0.955423, -0.295242, 0.000000},
{0.864188, -0.442863, 0.238856},
{0.951056, -0.162460, 0.262866},
{0.809017, -0.309017, 0.500000},
{0.681718, -0.147621, 0.716567},
{0.850651, 0.000000, 0.525731},
{0.864188, 0.442863, -0.238856},
{0.809017, 0.309017, -0.500000},
{0.951056, 0.162460, -0.262866},
{0.525731, 0.000000, -0.850651},
{0.681718, 0.147621, -0.716567},
{0.681718, -0.147621, -0.716567},
{0.850651, 0.000000, -0.525731},
{0.809017, -0.309017, -0.500000},
{0.864188, -0.442863, -0.238856},
{0.951056, -0.162460, -0.262866},
{0.147621, 0.716567, -0.681718},
{0.309017, 0.500000, -0.809017},
{0.425325, 0.688191, -0.587785},
{0.442863, 0.238856, -0.864188},
{0.587785, 0.425325, -0.688191},
{0.688191, 0.587785, -0.425325},
{-0.147621, 0.716567, -0.681718},
{-0.309017, 0.500000, -0.809017},
{0.000000, 0.525731, -0.850651},
{-0.525731, 0.000000, -0.850651},
{-0.442863, 0.238856, -0.864188},
{-0.295242, 0.000000, -0.955423},
{-0.162460, 0.262866, -0.951056},
{0.000000, 0.000000, -1.000000},
{0.295242, 0.000000, -0.955423},
{0.162460, 0.262866, -0.951056},
{-0.442863, -0.238856, -0.864188},
{-0.309017, -0.500000, -0.809017},
{-0.162460, -0.262866, -0.951056},
{0.000000, -0.850651, -0.525731},
{-0.147621, -0.716567, -0.681718},
{0.147621, -0.716567, -0.681718},
{0.000000, -0.525731, -0.850651},
{0.309017, -0.500000, -0.809017},
{0.442863, -0.238856, -0.864188},
{0.162460, -0.262866, -0.951056},
{0.238856, -0.864188, -0.442863},
{0.500000, -0.809017, -0.309017},
{0.425325, -0.688191, -0.587785},
{0.716567, -0.681718, -0.147621},
{0.688191, -0.587785, -0.425325},
{0.587785, -0.425325, -0.688191},
{0.000000, -0.955423, -0.295242},
{0.000000, -1.000000, 0.000000},
{0.262866, -0.951056, -0.162460},
{0.000000, -0.850651, 0.525731},
{0.000000, -0.955423, 0.295242},
{0.238856, -0.864188, 0.442863},
{0.262866, -0.951056, 0.162460},
{0.500000, -0.809017, 0.309017},
{0.716567, -0.681718, 0.147621},
{0.525731, -0.850651, 0.000000},
{-0.238856, -0.864188, -0.442863},
{-0.500000, -0.809017, -0.309017},
{-0.262866, -0.951056, -0.162460},
{-0.850651, -0.525731, 0.000000},
{-0.716567, -0.681718, -0.147621},
{-0.716567, -0.681718, 0.147621},
{-0.525731, -0.850651, 0.000000},
{-0.500000, -0.809017, 0.309017},
{-0.238856, -0.864188, 0.442863},
{-0.262866, -0.951056, 0.162460},
{-0.864188, -0.442863, 0.238856},
{-0.809017, -0.309017, 0.500000},
{-0.688191, -0.587785, 0.425325},
{-0.681718, -0.147621, 0.716567},
{-0.442863, -0.238856, 0.864188},
{-0.587785, -0.425325, 0.688191},
{-0.309017, -0.500000, 0.809017},
{-0.147621, -0.716567, 0.681718},
{-0.425325, -0.688191, 0.587785},
{-0.162460, -0.262866, 0.951056},
{0.442863, -0.238856, 0.864188},
{0.162460, -0.262866, 0.951056},
{0.309017, -0.500000, 0.809017},
{0.147621, -0.716567, 0.681718},
{0.000000, -0.525731, 0.850651},
{0.425325, -0.688191, 0.587785},
{0.587785, -0.425325, 0.688191},
{0.688191, -0.587785, 0.425325},
{-0.955423, 0.295242, 0.000000},
{-0.951056, 0.162460, 0.262866},
{-1.000000, 0.000000, 0.000000},
{-0.850651, 0.000000, 0.525731},
{-0.955423, -0.295242, 0.000000},
{-0.951056, -0.162460, 0.262866},
{-0.864188, 0.442863, -0.238856},
{-0.951056, 0.162460, -0.262866},
{-0.809017, 0.309017, -0.500000},
{-0.864188, -0.442863, -0.238856},
{-0.951056, -0.162460, -0.262866},
{-0.809017, -0.309017, -0.500000},
{-0.681718, 0.147621, -0.716567},
{-0.681718, -0.147621, -0.716567},
{-0.850651, 0.000000, -0.525731},
{-0.688191, 0.587785, -0.425325},
{-0.587785, 0.425325, -0.688191},
{-0.425325, 0.688191, -0.587785},
{-0.425325, -0.688191, -0.587785},
{-0.587785, -0.425325, -0.688191},
{-0.688191, -0.587785, -0.425325},

41
hlsdk/engine/archtypes.h Normal file
View File

@ -0,0 +1,41 @@
//
// Word size dependent definitions
// DAL 1/03
//
#ifndef ARCHTYPES_H
#define ARCHTYPES_H
#ifdef __x86_64__
#define X64BITS
#endif
#if defined( _WIN32 ) && (! defined( __MINGW32__ ))
typedef __int16 int16;
typedef unsigned __int16 uint16;
typedef __int32 int32;
typedef unsigned __int32 uint32;
typedef __int64 int64;
typedef unsigned __int64 uint64;
typedef __int32 intp; // intp is an integer that can accomodate a pointer
typedef unsigned __int32 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *)
#else /* _WIN32 */
typedef short int16;
typedef unsigned short uint16;
typedef int int32;
typedef unsigned int uint32;
typedef long long int64;
typedef unsigned long long uint64;
#ifdef X64BITS
typedef long long intp;
typedef unsigned long long uintp;
#else
typedef int intp;
typedef unsigned int uintp;
#endif
#endif /* else _WIN32 */
#endif /* ARCHTYPES_H */

311
hlsdk/engine/cdll_int.h Normal file
View File

@ -0,0 +1,311 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
//
// cdll_int.h
//
// 4-23-98
// JOHN: client dll interface declarations
//
#ifndef CDLL_INT_H
#define CDLL_INT_H
#ifdef __cplusplus
extern "C" {
#endif
#include "const.h"
// this file is included by both the engine and the client-dll,
// so make sure engine declarations aren't done twice
typedef int HSPRITE; // handle to a graphic
#define SCRINFO_SCREENFLASH 1
#define SCRINFO_STRETCHED 2
typedef struct SCREENINFO_s
{
int iSize;
int iWidth;
int iHeight;
int iFlags;
int iCharHeight;
short charWidths[256];
} SCREENINFO;
typedef struct client_data_s
{
// fields that cannot be modified (ie. have no effect if changed)
vec3_t origin;
// fields that can be changed by the cldll
vec3_t viewangles;
int iWeaponBits;
float fov; // field of view
} client_data_t;
typedef struct client_sprite_s
{
char szName[64];
char szSprite[64];
int hspr;
int iRes;
wrect_t rc;
} client_sprite_t;
typedef struct client_textmessage_s
{
int effect;
byte r1, g1, b1, a1; // 2 colors for effects
byte r2, g2, b2, a2;
float x;
float y;
float fadein;
float fadeout;
float holdtime;
float fxtime;
const char *pName;
const char *pMessage;
} client_textmessage_t;
typedef struct hud_player_info_s
{
char *name;
short ping;
byte thisplayer; // TRUE if this is the calling player
// stuff that's unused at the moment, but should be done
byte spectator;
byte packetloss;
char *model;
short topcolor;
short bottomcolor;
} hud_player_info_t;
typedef struct cl_enginefuncs_s
{
// sprite handlers
HSPRITE ( *pfnSPR_Load ) ( const char *szPicName );
int ( *pfnSPR_Frames ) ( HSPRITE hPic );
int ( *pfnSPR_Height ) ( HSPRITE hPic, int frame );
int ( *pfnSPR_Width ) ( HSPRITE hPic, int frame );
void ( *pfnSPR_Set ) ( HSPRITE hPic, int r, int g, int b );
void ( *pfnSPR_Draw ) ( int frame, int x, int y, const wrect_t *prc );
void ( *pfnSPR_DrawHoles ) ( int frame, int x, int y, const wrect_t *prc );
void ( *pfnSPR_DrawAdditive ) ( int frame, int x, int y, const wrect_t *prc );
void ( *pfnSPR_EnableScissor ) ( int x, int y, int width, int height );
void ( *pfnSPR_DisableScissor ) ( void );
client_sprite_t *( *pfnSPR_GetList ) ( char *psz, int *piCount );
// screen handlers
void ( *pfnFillRGBA ) ( int x, int y, int width, int height, int r, int g, int b, int a );
int ( *pfnGetScreenInfo ) ( SCREENINFO *pscrinfo );
void ( *pfnSetCrosshair ) ( HSPRITE hspr, wrect_t rc, int r, int g, int b );
// cvar handlers
struct cvar_s *( *pfnRegisterVariable ) ( char *szName, char *szValue, int flags );
float ( *pfnGetCvarFloat ) ( char *szName );
char* ( *pfnGetCvarString ) ( char *szName );
// command handlers
int ( *pfnAddCommand ) ( char *cmd_name, void (*function)(void) );
int ( *pfnHookUserMsg ) ( char *szMsgName, pfnUserMsgHook pfn );
int ( *pfnServerCmd ) ( char *szCmdString );
int ( *pfnClientCmd ) ( char *szCmdString );
void ( *pfnGetPlayerInfo ) ( int ent_num, hud_player_info_t *pinfo );
// sound handlers
void ( *pfnPlaySoundByName ) ( char *szSound, float volume );
void ( *pfnPlaySoundByIndex ) ( int iSound, float volume );
// vector helpers
void ( *pfnAngleVectors ) ( const float * vecAngles, float * forward, float * right, float * up );
// text message system
client_textmessage_t *( *pfnTextMessageGet ) ( const char *pName );
int ( *pfnDrawCharacter ) ( int x, int y, int number, int r, int g, int b );
int ( *pfnDrawConsoleString ) ( int x, int y, char *string );
void ( *pfnDrawSetTextColor ) ( float r, float g, float b );
void ( *pfnDrawConsoleStringLen )( const char *string, int *length, int *height );
void ( *pfnConsolePrint ) ( const char *string );
void ( *pfnCenterPrint ) ( const char *string );
// Added for user input processing
int ( *GetWindowCenterX ) ( void );
int ( *GetWindowCenterY ) ( void );
void ( *GetViewAngles ) ( float * );
void ( *SetViewAngles ) ( float * );
int ( *GetMaxClients ) ( void );
void ( *Cvar_SetValue ) ( char *cvar, float value );
int (*Cmd_Argc) (void);
char *( *Cmd_Argv ) ( int arg );
void ( *Con_Printf ) ( char *fmt, ... );
void ( *Con_DPrintf ) ( char *fmt, ... );
void ( *Con_NPrintf ) ( int pos, char *fmt, ... );
void ( *Con_NXPrintf ) ( struct con_nprint_s *info, char *fmt, ... );
const char *( *PhysInfo_ValueForKey ) ( const char *key );
const char *( *ServerInfo_ValueForKey )( const char *key );
float ( *GetClientMaxspeed ) ( void );
int ( *CheckParm ) ( char *parm, char **ppnext );
void ( *Key_Event ) ( int key, int down );
void ( *GetMousePosition ) ( int *mx, int *my );
int ( *IsNoClipping ) ( void );
struct cl_entity_s *( *GetLocalPlayer ) ( void );
struct cl_entity_s *( *GetViewModel ) ( void );
struct cl_entity_s *( *GetEntityByIndex ) ( int idx );
float ( *GetClientTime ) ( void );
void ( *V_CalcShake ) ( void );
void ( *V_ApplyShake ) ( float *origin, float *angles, float factor );
int ( *PM_PointContents ) ( float *point, int *truecontents );
int ( *PM_WaterEntity ) ( float *p );
struct pmtrace_s *( *PM_TraceLine ) ( float *start, float *end, int flags, int usehull, int ignore_pe );
struct model_s *( *CL_LoadModel ) ( const char *modelname, int *index );
int ( *CL_CreateVisibleEntity ) ( int type, struct cl_entity_s *ent );
const struct model_s * ( *GetSpritePointer ) ( HSPRITE hSprite );
void ( *pfnPlaySoundByNameAtLocation ) ( char *szSound, float volume, float *origin );
unsigned short ( *pfnPrecacheEvent ) ( int type, const char* psz );
void ( *pfnPlaybackEvent ) ( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
void ( *pfnWeaponAnim ) ( int iAnim, int body );
float ( *pfnRandomFloat ) ( float flLow, float flHigh );
long ( *pfnRandomLong ) ( long lLow, long lHigh );
void ( *pfnHookEvent ) ( char *name, void ( *pfnEvent )( struct event_args_s *args ) );
int (*Con_IsVisible) ();
const char *( *pfnGetGameDirectory ) ( void );
struct cvar_s *( *pfnGetCvarPointer ) ( const char *szName );
const char *( *Key_LookupBinding ) ( const char *pBinding );
const char *( *pfnGetLevelName ) ( void );
void ( *pfnGetScreenFade ) ( struct screenfade_s *fade );
void ( *pfnSetScreenFade ) ( struct screenfade_s *fade );
void *( *VGui_GetPanel ) ( );
void ( *VGui_ViewportPaintBackground ) (int extents[4]);
byte* (*COM_LoadFile) ( char *path, int usehunk, int *pLength );
char* (*COM_ParseFile) ( char *data, char *token );
void (*COM_FreeFile) ( void *buffer );
struct triangleapi_s *pTriAPI;
struct efx_api_s *pEfxAPI;
struct event_api_s *pEventAPI;
struct demo_api_s *pDemoAPI;
struct net_api_s *pNetAPI;
struct IVoiceTweak_s *pVoiceTweak;
// returns 1 if the client is a spectator only (connected to a proxy), 0 otherwise or 2 if in dev_overview mode
int ( *IsSpectateOnly ) ( void );
struct model_s *( *LoadMapSprite ) ( const char *filename );
// file search functions
void ( *COM_AddAppDirectoryToSearchPath ) ( const char *pszBaseDir, const char *appName );
int ( *COM_ExpandFilename) ( const char *fileName, char *nameOutBuffer, int nameOutBufferSize );
// User info
// playerNum is in the range (1, MaxClients)
// returns NULL if player doesn't exit
// returns "" if no value is set
const char *( *PlayerInfo_ValueForKey )( int playerNum, const char *key );
void ( *PlayerInfo_SetValueForKey )( const char *key, const char *value );
// Gets a unique ID for the specified player. This is the same even if you see the player on a different server.
// iPlayer is an entity index, so client 0 would use iPlayer=1.
// Returns false if there is no player on the server in the specified slot.
qboolean (*GetPlayerUniqueID)(int iPlayer, char playerID[16]);
// TrackerID access
int (*GetTrackerIDForPlayer)(int playerSlot);
int (*GetPlayerForTrackerID)(int trackerID);
// Same as pfnServerCmd, but the message goes in the unreliable stream so it can't clog the net stream
// (but it might not get there).
int ( *pfnServerCmdUnreliable )( char *szCmdString );
void ( *pfnGetMousePos )( struct tagPOINT *ppt );
void ( *pfnSetMousePos )( int x, int y );
void ( *pfnSetMouseEnable )( qboolean fEnable );
} cl_enginefunc_t;
#ifndef IN_BUTTONS_H
#include "in_buttons.h"
#endif
#define CLDLL_INTERFACE_VERSION 7
extern void ClientDLL_Init( void ); // from cdll_int.c
extern void ClientDLL_Shutdown( void );
extern void ClientDLL_HudInit( void );
extern void ClientDLL_HudVidInit( void );
extern void ClientDLL_UpdateClientData( void );
extern void ClientDLL_Frame( double time );
extern void ClientDLL_HudRedraw( int intermission );
extern void ClientDLL_MoveClient( struct playermove_s *ppmove );
extern void ClientDLL_ClientMoveInit( struct playermove_s *ppmove );
extern char ClientDLL_ClientTextureType( char *name );
extern void ClientDLL_CreateMove( float frametime, struct usercmd_s *cmd, int active );
extern void ClientDLL_ActivateMouse( void );
extern void ClientDLL_DeactivateMouse( void );
extern void ClientDLL_MouseEvent( int mstate );
extern void ClientDLL_ClearStates( void );
extern int ClientDLL_IsThirdPerson( void );
extern void ClientDLL_GetCameraOffsets( float *ofs );
extern int ClientDLL_GraphKeyDown( void );
extern struct kbutton_s *ClientDLL_FindKey( const char *name );
extern void ClientDLL_CAM_Think( void );
extern void ClientDLL_IN_Accumulate( void );
extern void ClientDLL_CalcRefdef( struct ref_params_s *pparams );
extern int ClientDLL_AddEntity( int type, struct cl_entity_s *ent );
extern void ClientDLL_CreateEntities( void );
extern void ClientDLL_DrawNormalTriangles( void );
extern void ClientDLL_DrawTransparentTriangles( void );
extern void ClientDLL_StudioEvent( const struct mstudioevent_s *event, const struct cl_entity_s *entity );
extern void ClientDLL_PostRunCmd( struct local_state_s *from, struct local_state_s *to, struct usercmd_s *cmd, int runfuncs, double time, unsigned int random_seed );
extern void ClientDLL_TxferLocalOverrides( struct entity_state_s *state, const struct clientdata_s *client );
extern void ClientDLL_ProcessPlayerState( struct entity_state_s *dst, const struct entity_state_s *src );
extern void ClientDLL_TxferPredictionData ( struct entity_state_s *ps, const struct entity_state_s *pps, struct clientdata_s *pcd, const struct clientdata_s *ppcd, struct weapon_data_s *wd, const struct weapon_data_s *pwd );
extern void ClientDLL_ReadDemoBuffer( int size, unsigned char *buffer );
extern int ClientDLL_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );
extern int ClientDLL_GetHullBounds( int hullnumber, float *mins, float *maxs );
extern void ClientDLL_VGui_ConsolePrint(const char* text);
extern int ClientDLL_Key_Event( int down, int keynum, const char *pszCurrentBinding );
extern void ClientDLL_TempEntUpdate( double ft, double ct, double grav, struct tempent_s **ppFreeTE, struct tempent_s **ppActiveTE, int ( *addTEntity )( struct cl_entity_s *pEntity ), void ( *playTESound )( struct tempent_s *pTemp, float damp ) );
extern struct cl_entity_s *ClientDLL_GetUserEntity( int index );
extern void ClientDLL_VoiceStatus(int entindex, qboolean bTalking);
extern void ClientDLL_DirectorMessage( int iSize, void *pbuf );
#ifdef __cplusplus
}
#endif
#endif // CDLL_INT_H

104
hlsdk/engine/custom.h Normal file
View File

@ -0,0 +1,104 @@
/***
*
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
// Customization.h
#ifndef CUSTOM_H
#define CUSTOM_H
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
#include "const.h"
#define MAX_QPATH 64 // Must match value in quakedefs.h
/////////////////
// Customization
// passed to pfnPlayerCustomization
// For automatic downloading.
typedef enum
{
t_sound = 0,
t_skin,
t_model,
t_decal,
t_generic,
t_eventscript
} resourcetype_t;
// Fake type for world
#define t_world 6
typedef struct
{
int size;
} _resourceinfo_t;
typedef struct resourceinfo_s
{
_resourceinfo_t info[ 7 ];
} resourceinfo_t;
#define RES_FATALIFMISSING (1<<0) // Disconnect if we can't get this file.
#define RES_WASMISSING (1<<1) // Do we have the file locally, did we get it ok?
#define RES_CUSTOM (1<<2) // Is this resource one that corresponds to another player's customization
// or is it a server startup resource.
#define RES_REQUESTED (1<<3) // Already requested a download of this one
#define RES_PRECACHED (1<<4) // Already precached
#include "crc.h"
typedef struct resource_s
{
char szFileName[MAX_QPATH]; // File name to download/precache.
resourcetype_t type; // t_sound, t_skin, t_model, t_decal.
int nIndex; // For t_decals
int nDownloadSize; // Size in Bytes if this must be downloaded.
unsigned char ucFlags;
// For handling client to client resource propagation
unsigned char rgucMD5_hash[16]; // To determine if we already have it.
unsigned char playernum; // Which player index this resource is associated with, if it's a custom resource.
unsigned char rguc_reserved[ 32 ]; // For future expansion
struct resource_s *pNext; // Next in chain.
struct resource_s *pPrev;
} resource_t;
typedef struct customization_s
{
qboolean bInUse; // Is this customization in use;
resource_t resource; // The resource_t for this customization
qboolean bTranslated; // Has the raw data been translated into a useable format?
// (e.g., raw decal .wad make into texture_t *)
int nUserData1; // Customization specific data
int nUserData2; // Customization specific data
void *pInfo; // Buffer that holds the data structure that references the data (e.g., the cachewad_t)
void *pBuffer; // Buffer that holds the data for the customization (the raw .wad data)
struct customization_s *pNext; // Next in chain
} customization_t;
#define FCUST_FROMHPAK ( 1<<0 )
#define FCUST_WIPEDATA ( 1<<1 )
#define FCUST_IGNOREINIT ( 1<<2 )
void COM_ClearCustomizationList( struct customization_s *pHead, qboolean bCleanDecals);
qboolean COM_CreateCustomization( struct customization_s *pListHead, struct resource_s *pResource, int playernumber, int flags,
struct customization_s **pCustomization, int *nLumps );
int COM_SizeofResourceList ( struct resource_s *pList, struct resourceinfo_s *ri );
#endif // CUSTOM_H

View File

@ -0,0 +1,38 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef CUSTOMENTITY_H
#define CUSTOMENTITY_H
// Custom Entities
// Start/End Entity is encoded as 12 bits of entity index, and 4 bits of attachment (4:12)
#define BEAMENT_ENTITY(x) ((x)&0xFFF)
#define BEAMENT_ATTACHMENT(x) (((x)>>12)&0xF)
// Beam types, encoded as a byte
enum
{
BEAM_POINTS = 0,
BEAM_ENTPOINT,
BEAM_ENTS,
BEAM_HOSE,
};
#define BEAM_FSINE 0x10
#define BEAM_FSOLID 0x20
#define BEAM_FSHADEIN 0x40
#define BEAM_FSHADEOUT 0x80
#endif //CUSTOMENTITY_H

31
hlsdk/engine/edict.h Normal file
View File

@ -0,0 +1,31 @@
#if !defined EDICT_H
#define EDICT_H
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
#define MAX_ENT_LEAFS 48
#include "progdefs.h"
struct edict_s
{
qboolean free;
int serialnumber;
link_t area; // linked to a division node or leaf
int headnode; // -1 to use normal leaf check
int num_leafs;
short leafnums[MAX_ENT_LEAFS];
float freetime; // sv.time when the object was freed
void* pvPrivateData; // Alloced and freed by engine, used by DLLs
entvars_t v; // C exported fields from progs
// other fields from progs come immediately after
};
#endif

575
hlsdk/engine/eiface.h Normal file
View File

@ -0,0 +1,575 @@
/***
*
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef EIFACE_H
#define EIFACE_H
#include "archtypes.h" // DAL
#ifdef HLDEMO_BUILD
#define INTERFACE_VERSION 001
#else // !HLDEMO_BUILD, i.e., regular version of HL
#define INTERFACE_VERSION 140
#endif // !HLDEMO_BUILD
#include <stdio.h>
#include "custom.h"
#include "cvardef.h"
#include "Sequence.h"
//
// Defines entity interface between engine and DLLs.
// This header file included by engine files and DLL files.
//
// Before including this header, DLLs must:
// include progdefs.h
// This is conveniently done for them in extdll.h
//
#ifdef _WIN32
#define DLLEXPORT __stdcall
#else
#define DLLEXPORT /* */
#endif
typedef enum
{
at_notice,
at_console, // same as at_notice, but forces a ConPrintf, not a message box
at_aiconsole, // same as at_console, but only shown if developer level is 2!
at_warning,
at_error,
at_logged // Server print to console ( only in multiplayer games ).
} ALERT_TYPE;
// 4-22-98 JOHN: added for use in pfnClientPrintf
typedef enum
{
print_console,
print_center,
print_chat,
} PRINT_TYPE;
// For integrity checking of content on clients
typedef enum
{
force_exactfile, // File on client must exactly match server's file
force_model_samebounds, // For model files only, the geometry must fit in the same bbox
force_model_specifybounds, // For model files only, the geometry must fit in the specified bbox
force_model_specifybounds_if_avail, // For Steam model files only, the geometry must fit in the specified bbox (if the file is available)
} FORCE_TYPE;
// Returned by TraceLine
typedef struct
{
int fAllSolid; // if true, plane is not valid
int fStartSolid; // if true, the initial point was in a solid area
int fInOpen;
int fInWater;
float flFraction; // time completed, 1.0 = didn't hit anything
vec3_t vecEndPos; // final position
float flPlaneDist;
vec3_t vecPlaneNormal; // surface normal at impact
edict_t *pHit; // entity the surface is on
int iHitgroup; // 0 == generic, non zero is specific body part
} TraceResult;
// CD audio status
typedef struct
{
int fPlaying;// is sound playing right now?
int fWasPlaying;// if not, CD is paused if WasPlaying is true.
int fInitialized;
int fEnabled;
int fPlayLooping;
float cdvolume;
//BYTE remap[100];
int fCDRom;
int fPlayTrack;
} CDStatus;
#include "../common/crc.h"
// Engine hands this to DLLs for functionality callbacks
typedef struct enginefuncs_s
{
int (*pfnPrecacheModel) (char* s);
int (*pfnPrecacheSound) (char* s);
void (*pfnSetModel) (edict_t *e, const char *m);
int (*pfnModelIndex) (const char *m);
int (*pfnModelFrames) (int modelIndex);
void (*pfnSetSize) (edict_t *e, const float *rgflMin, const float *rgflMax);
void (*pfnChangeLevel) (char* s1, char* s2);
void (*pfnGetSpawnParms) (edict_t *ent);
void (*pfnSaveSpawnParms) (edict_t *ent);
float (*pfnVecToYaw) (const float *rgflVector);
void (*pfnVecToAngles) (const float *rgflVectorIn, float *rgflVectorOut);
void (*pfnMoveToOrigin) (edict_t *ent, const float *pflGoal, float dist, int iMoveType);
void (*pfnChangeYaw) (edict_t* ent);
void (*pfnChangePitch) (edict_t* ent);
edict_t* (*pfnFindEntityByString) (edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue);
int (*pfnGetEntityIllum) (edict_t* pEnt);
edict_t* (*pfnFindEntityInSphere) (edict_t *pEdictStartSearchAfter, const float *org, float rad);
edict_t* (*pfnFindClientInPVS) (edict_t *pEdict);
edict_t* (*pfnEntitiesInPVS) (edict_t *pplayer);
void (*pfnMakeVectors) (const float *rgflVector);
void (*pfnAngleVectors) (const float *rgflVector, float *forward, float *right, float *up);
edict_t* (*pfnCreateEntity) (void);
void (*pfnRemoveEntity) (edict_t* e);
edict_t* (*pfnCreateNamedEntity) (int className);
void (*pfnMakeStatic) (edict_t *ent);
int (*pfnEntIsOnFloor) (edict_t *e);
int (*pfnDropToFloor) (edict_t* e);
int (*pfnWalkMove) (edict_t *ent, float yaw, float dist, int iMode);
void (*pfnSetOrigin) (edict_t *e, const float *rgflOrigin);
void (*pfnEmitSound) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch);
void (*pfnEmitAmbientSound) (edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch);
void (*pfnTraceLine) (const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
void (*pfnTraceToss) (edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr);
int (*pfnTraceMonsterHull) (edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
void (*pfnTraceHull) (const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr);
void (*pfnTraceModel) (const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr);
const char *(*pfnTraceTexture) (edict_t *pTextureEntity, const float *v1, const float *v2 );
void (*pfnTraceSphere) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);
void (*pfnGetAimVector) (edict_t* ent, float speed, float *rgflReturn);
void (*pfnServerCommand) (char* str);
void (*pfnServerExecute) (void);
void (*pfnClientCommand) (edict_t* pEdict, char* szFmt, ...);
void (*pfnParticleEffect) (const float *org, const float *dir, float color, float count);
void (*pfnLightStyle) (int style, char* val);
int (*pfnDecalIndex) (const char *name);
int (*pfnPointContents) (const float *rgflVector);
void (*pfnMessageBegin) (int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
void (*pfnMessageEnd) (void);
void (*pfnWriteByte) (int iValue);
void (*pfnWriteChar) (int iValue);
void (*pfnWriteShort) (int iValue);
void (*pfnWriteLong) (int iValue);
void (*pfnWriteAngle) (float flValue);
void (*pfnWriteCoord) (float flValue);
void (*pfnWriteString) (const char *sz);
void (*pfnWriteEntity) (int iValue);
void (*pfnCVarRegister) (cvar_t *pCvar);
float (*pfnCVarGetFloat) (const char *szVarName);
const char* (*pfnCVarGetString) (const char *szVarName);
void (*pfnCVarSetFloat) (const char *szVarName, float flValue);
void (*pfnCVarSetString) (const char *szVarName, const char *szValue);
void (*pfnAlertMessage) (ALERT_TYPE atype, char *szFmt, ...);
#ifdef HLSDK_3_2_OLD_EIFACE
void (*pfnEngineFprintf) (FILE *pfile, char *szFmt, ...);
void* (*pfnPvAllocEntPrivateData) (edict_t *pEdict, long cb);
#else
void (*pfnEngineFprintf) (void *pfile, char *szFmt, ...);
void* (*pfnPvAllocEntPrivateData) (edict_t *pEdict, int32 cb);
#endif
void* (*pfnPvEntPrivateData) (edict_t *pEdict);
void (*pfnFreeEntPrivateData) (edict_t *pEdict);
const char* (*pfnSzFromIndex) (int iString);
int (*pfnAllocString) (const char *szValue);
struct entvars_s* (*pfnGetVarsOfEnt) (edict_t *pEdict);
edict_t* (*pfnPEntityOfEntOffset) (int iEntOffset);
int (*pfnEntOffsetOfPEntity) (const edict_t *pEdict);
int (*pfnIndexOfEdict) (const edict_t *pEdict);
edict_t* (*pfnPEntityOfEntIndex) (int iEntIndex);
edict_t* (*pfnFindEntityByVars) (struct entvars_s* pvars);
void* (*pfnGetModelPtr) (edict_t* pEdict);
int (*pfnRegUserMsg) (const char *pszName, int iSize);
void (*pfnAnimationAutomove) (const edict_t* pEdict, float flTime);
void (*pfnGetBonePosition) (const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles );
#ifdef HLSDK_3_2_OLD_EIFACE
unsigned long (*pfnFunctionFromName) ( const char *pName );
const char *(*pfnNameForFunction) ( unsigned long function );
#else
uint32 (*pfnFunctionFromName) ( const char *pName );
const char *(*pfnNameForFunction) ( uint32 function );
#endif
void (*pfnClientPrintf) ( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg ); // JOHN: engine callbacks so game DLL can print messages to individual clients
void (*pfnServerPrint) ( const char *szMsg );
const char *(*pfnCmd_Args) ( void ); // these 3 added
const char *(*pfnCmd_Argv) ( int argc ); // so game DLL can easily
int (*pfnCmd_Argc) ( void ); // access client 'cmd' strings
void (*pfnGetAttachment) (const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles );
void (*pfnCRC32_Init) (CRC32_t *pulCRC);
void (*pfnCRC32_ProcessBuffer) (CRC32_t *pulCRC, void *p, int len);
void (*pfnCRC32_ProcessByte) (CRC32_t *pulCRC, unsigned char ch);
CRC32_t (*pfnCRC32_Final) (CRC32_t pulCRC);
#ifdef HLSDK_3_2_OLD_EIFACE
long (*pfnRandomLong) (long lLow, long lHigh);
#else
int32 (*pfnRandomLong) (int32 lLow, int32 lHigh);
#endif
float (*pfnRandomFloat) (float flLow, float flHigh);
void (*pfnSetView) (const edict_t *pClient, const edict_t *pViewent );
float (*pfnTime) ( void );
void (*pfnCrosshairAngle) (const edict_t *pClient, float pitch, float yaw);
byte * (*pfnLoadFileForMe) (char *filename, int *pLength);
void (*pfnFreeFile) (void *buffer);
void (*pfnEndSection) (const char *pszSectionName); // trigger_endsection
int (*pfnCompareFileTime) (char *filename1, char *filename2, int *iCompare);
void (*pfnGetGameDir) (char *szGetGameDir);
void (*pfnCvar_RegisterVariable) (cvar_t *variable);
void (*pfnFadeClientVolume) (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds);
void (*pfnSetClientMaxspeed) (const edict_t *pEdict, float fNewMaxspeed);
edict_t * (*pfnCreateFakeClient) (const char *netname); // returns NULL if fake client can't be created
void (*pfnRunPlayerMove) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec );
int (*pfnNumberOfEntities) (void);
char* (*pfnGetInfoKeyBuffer) (edict_t *e); // passing in NULL gets the serverinfo
char* (*pfnInfoKeyValue) (char *infobuffer, char *key);
void (*pfnSetKeyValue) (char *infobuffer, char *key, char *value);
void (*pfnSetClientKeyValue) (int clientIndex, char *infobuffer, char *key, char *value);
int (*pfnIsMapValid) (char *filename);
void (*pfnStaticDecal) ( const float *origin, int decalIndex, int entityIndex, int modelIndex );
int (*pfnPrecacheGeneric) (char* s);
int (*pfnGetPlayerUserId) (edict_t *e ); // returns the server assigned userid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients
void (*pfnBuildSoundMsg) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
int (*pfnIsDedicatedServer) (void);// is this a dedicated server?
cvar_t *(*pfnCVarGetPointer) (const char *szVarName);
unsigned int (*pfnGetPlayerWONId) (edict_t *e); // returns the server assigned WONid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients
// YWB 8/1/99 TFF Physics additions
void (*pfnInfo_RemoveKey) ( char *s, const char *key );
const char *(*pfnGetPhysicsKeyValue) ( const edict_t *pClient, const char *key );
void (*pfnSetPhysicsKeyValue) ( const edict_t *pClient, const char *key, const char *value );
const char *(*pfnGetPhysicsInfoString) ( const edict_t *pClient );
unsigned short (*pfnPrecacheEvent) ( int type, const char*psz );
void (*pfnPlaybackEvent) ( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
unsigned char *(*pfnSetFatPVS) ( float *org );
unsigned char *(*pfnSetFatPAS) ( float *org );
int (*pfnCheckVisibility ) ( const edict_t *entity, unsigned char *pset );
void (*pfnDeltaSetField) ( struct delta_s *pFields, const char *fieldname );
void (*pfnDeltaUnsetField) ( struct delta_s *pFields, const char *fieldname );
void (*pfnDeltaAddEncoder) ( char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) );
int (*pfnGetCurrentPlayer) ( void );
int (*pfnCanSkipPlayer) ( const edict_t *player );
int (*pfnDeltaFindField) ( struct delta_s *pFields, const char *fieldname );
void (*pfnDeltaSetFieldByIndex) ( struct delta_s *pFields, int fieldNumber );
void (*pfnDeltaUnsetFieldByIndex)( struct delta_s *pFields, int fieldNumber );
void (*pfnSetGroupMask) ( int mask, int op );
int (*pfnCreateInstancedBaseline) ( int classname, struct entity_state_s *baseline );
void (*pfnCvar_DirectSet) ( struct cvar_s *var, char *value );
// Forces the client and server to be running with the same version of the specified file
// ( e.g., a player model ).
// Calling this has no effect in single player
void (*pfnForceUnmodified) ( FORCE_TYPE type, float *mins, float *maxs, const char *filename );
void (*pfnGetPlayerStats) ( const edict_t *pClient, int *ping, int *packet_loss );
void (*pfnAddServerCommand) ( char *cmd_name, void (*function) (void) );
// For voice communications, set which clients hear eachother.
// NOTE: these functions take player entity indices (starting at 1).
qboolean (*pfnVoice_GetClientListening)(int iReceiver, int iSender);
qboolean (*pfnVoice_SetClientListening)(int iReceiver, int iSender, qboolean bListen);
const char *(*pfnGetPlayerAuthId) ( edict_t *e );
// PSV: Added for CZ training map
// const char *(*pfnKeyNameForBinding) ( const char* pBinding );
sequenceEntry_s* (*pfnSequenceGet) ( const char* fileName, const char* entryName );
sentenceEntry_s* (*pfnSequencePickSentence) ( const char* groupName, int pickMethod, int *picked );
// LH: Give access to filesize via filesystem
int (*pfnGetFileSize) ( char *filename );
unsigned int (*pfnGetApproxWavePlayLen) (const char *filepath);
// MDC: Added for CZ career-mode
int (*pfnIsCareerMatch) ( void );
// BGC: return the number of characters of the localized string referenced by using "label"
int (*pfnGetLocalizedStringLength) (const char *label);
// BGC: added to facilitate persistent storage of tutor message decay values for
// different career game profiles. Also needs to persist regardless of mp.dll being
// destroyed and recreated.
void (*pfnRegisterTutorMessageShown) (int mid);
int (*pfnGetTimesTutorMessageShown) (int mid);
void (*pfnProcessTutorMessageDecayBuffer) (int *buffer, int bufferLength);
void (*pfnConstructTutorMessageDecayBuffer) (int *buffer, int bufferLength);
void (*pfnResetTutorMessageDecayData) ( void );
// Added 2005/08/11 (no SDK update):
void (*pfnQueryClientCvarValue) (const edict_t *player, const char *cvarName);
// Added 2005/11/21 (no SDK update):
void (*pfnQueryClientCvarValue2) (const edict_t *player, const char *cvarName, int requestID);
// Added 2009/06/19 (no SDK update):
int (*pfnEngCheckParm) (const char *pchCmdLineToken, char **pchNextVal);
#ifdef __METAMOD_BUILD__
//extra (future updates)
void * extra_functions[16];
#endif /*__METAMOD_BUILD__*/
} enginefuncs_t;
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138
// Passed to pfnKeyValue
typedef struct KeyValueData_s
{
char *szClassName; // in: entity classname
char *szKeyName; // in: name of key
char *szValue; // in: value of key
#ifdef HLSDK_3_2_OLD_EIFACE
long fHandled; // out: DLL sets to true if key-value pair was understood
#else
int32 fHandled; // out: DLL sets to true if key-value pair was understood
#endif
} KeyValueData;
typedef struct
{
char mapName[ 32 ];
char landmarkName[ 32 ];
edict_t *pentLandmark;
vec3_t vecLandmarkOrigin;
} LEVELLIST;
#define MAX_LEVEL_CONNECTIONS 16 // These are encoded in the lower 16bits of ENTITYTABLE->flags
typedef struct
{
int id; // Ordinal ID of this entity (used for entity <--> pointer conversions)
edict_t *pent; // Pointer to the in-game entity
int location; // Offset from the base data of this entity
int size; // Byte size of this entity's data
int flags; // This could be a short -- bit mask of transitions that this entity is in the PVS of
string_t classname; // entity class name
} ENTITYTABLE;
#define FENTTABLE_PLAYER 0x80000000
#define FENTTABLE_REMOVED 0x40000000
#define FENTTABLE_MOVEABLE 0x20000000
#define FENTTABLE_GLOBAL 0x10000000
typedef struct saverestore_s SAVERESTOREDATA;
#ifdef _WIN32
typedef
#endif
struct saverestore_s
{
char *pBaseData; // Start of all entity save data
char *pCurrentData; // Current buffer pointer for sequential access
int size; // Current data size
int bufferSize; // Total space for data
int tokenSize; // Size of the linear list of tokens
int tokenCount; // Number of elements in the pTokens table
char **pTokens; // Hash table of entity strings (sparse)
int currentIndex; // Holds a global entity table ID
int tableCount; // Number of elements in the entity table
int connectionCount;// Number of elements in the levelList[]
ENTITYTABLE *pTable; // Array of ENTITYTABLE elements (1 for each entity)
LEVELLIST levelList[ MAX_LEVEL_CONNECTIONS ]; // List of connections from this level
// smooth transition
int fUseLandmark;
char szLandmarkName[20];// landmark we'll spawn near in next level
vec3_t vecLandmarkOffset;// for landmark transitions
float time;
char szCurrentMapName[32]; // To check global entities
}
#ifdef _WIN32
SAVERESTOREDATA
#endif
;
typedef enum _fieldtypes
{
FIELD_FLOAT = 0, // Any floating point value
FIELD_STRING, // A string ID (return from ALLOC_STRING)
FIELD_ENTITY, // An entity offset (EOFFSET)
FIELD_CLASSPTR, // CBaseEntity *
FIELD_EHANDLE, // Entity handle
FIELD_EVARS, // EVARS *
FIELD_EDICT, // edict_t *, or edict_t * (same thing)
FIELD_VECTOR, // Any vector
FIELD_POSITION_VECTOR, // A world coordinate (these are fixed up across level transitions automagically)
FIELD_POINTER, // Arbitrary data pointer... to be removed, use an array of FIELD_CHARACTER
FIELD_INTEGER, // Any integer or enum
FIELD_FUNCTION, // A class function pointer (Think, Use, etc)
FIELD_BOOLEAN, // boolean, implemented as an int, I may use this as a hint for compression
FIELD_SHORT, // 2 byte integer
FIELD_CHARACTER, // a byte
FIELD_TIME, // a floating point time (these are fixed up automatically too!)
FIELD_MODELNAME, // Engine string that is a model name (needs precache)
FIELD_SOUNDNAME, // Engine string that is a sound name (needs precache)
FIELD_TYPECOUNT, // MUST BE LAST
} FIELDTYPE;
#ifndef linux
#ifndef offsetof
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#endif
#endif
#define _FIELD(type,name,fieldtype,count,flags) { fieldtype, #name, offsetof(type, name), count, flags }
#define DEFINE_FIELD(type,name,fieldtype) _FIELD(type, name, fieldtype, 1, 0)
#define DEFINE_ARRAY(type,name,fieldtype,count) _FIELD(type, name, fieldtype, count, 0)
#define DEFINE_ENTITY_FIELD(name,fieldtype) _FIELD(entvars_t, name, fieldtype, 1, 0 )
#define DEFINE_ENTITY_GLOBAL_FIELD(name,fieldtype) _FIELD(entvars_t, name, fieldtype, 1, FTYPEDESC_GLOBAL )
#define DEFINE_GLOBAL_FIELD(type,name,fieldtype) _FIELD(type, name, fieldtype, 1, FTYPEDESC_GLOBAL )
#define FTYPEDESC_GLOBAL 0x0001 // This field is masked for global entity save/restore
typedef struct
{
FIELDTYPE fieldType;
char *fieldName;
int fieldOffset;
short fieldSize;
short flags;
} TYPEDESCRIPTION;
// Fixed MSVC compiling, by Nikolay "The Storm" Baklicharov.
#if defined _MSC_VER && _MSC_VER >= 1400
#ifndef ARRAYSIZE
#define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0]))
#endif
#else /* MSVC 8.0 */
#ifndef ARRAYSIZE
#define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0]))
#endif
#endif
typedef struct
{
// Initialize/shutdown the game (one-time call after loading of game .dll )
void (*pfnGameInit) ( void );
int (*pfnSpawn) ( edict_t *pent );
void (*pfnThink) ( edict_t *pent );
void (*pfnUse) ( edict_t *pentUsed, edict_t *pentOther );
void (*pfnTouch) ( edict_t *pentTouched, edict_t *pentOther );
void (*pfnBlocked) ( edict_t *pentBlocked, edict_t *pentOther );
void (*pfnKeyValue) ( edict_t *pentKeyvalue, KeyValueData *pkvd );
void (*pfnSave) ( edict_t *pent, SAVERESTOREDATA *pSaveData );
int (*pfnRestore) ( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity );
void (*pfnSetAbsBox) ( edict_t *pent );
void (*pfnSaveWriteFields) ( SAVERESTOREDATA *, const char *, void *, TYPEDESCRIPTION *, int );
void (*pfnSaveReadFields) ( SAVERESTOREDATA *, const char *, void *, TYPEDESCRIPTION *, int );
void (*pfnSaveGlobalState) ( SAVERESTOREDATA * );
void (*pfnRestoreGlobalState) ( SAVERESTOREDATA * );
void (*pfnResetGlobalState) ( void );
qboolean (*pfnClientConnect) ( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] );
void (*pfnClientDisconnect) ( edict_t *pEntity );
void (*pfnClientKill) ( edict_t *pEntity );
void (*pfnClientPutInServer) ( edict_t *pEntity );
void (*pfnClientCommand) ( edict_t *pEntity );
void (*pfnClientUserInfoChanged)( edict_t *pEntity, char *infobuffer );
void (*pfnServerActivate) ( edict_t *pEdictList, int edictCount, int clientMax );
void (*pfnServerDeactivate) ( void );
void (*pfnPlayerPreThink) ( edict_t *pEntity );
void (*pfnPlayerPostThink) ( edict_t *pEntity );
void (*pfnStartFrame) ( void );
void (*pfnParmsNewLevel) ( void );
void (*pfnParmsChangeLevel) ( void );
// Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
const char *(*pfnGetGameDescription)( void );
// Notify dll about a player customization.
void (*pfnPlayerCustomization) ( edict_t *pEntity, customization_t *pCustom );
// Spectator funcs
void (*pfnSpectatorConnect) ( edict_t *pEntity );
void (*pfnSpectatorDisconnect) ( edict_t *pEntity );
void (*pfnSpectatorThink) ( edict_t *pEntity );
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
void (*pfnSys_Error) ( const char *error_string );
void (*pfnPM_Move) ( struct playermove_s *ppmove, qboolean server );
void (*pfnPM_Init) ( struct playermove_s *ppmove );
char (*pfnPM_FindTextureType)( char *name );
void (*pfnSetupVisibility)( struct edict_s *pViewEntity, struct edict_s *pClient, unsigned char **pvs, unsigned char **pas );
void (*pfnUpdateClientData) ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd );
int (*pfnAddToFullPack)( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet );
void (*pfnCreateBaseline) ( int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs );
void (*pfnRegisterEncoders) ( void );
int (*pfnGetWeaponData) ( struct edict_s *player, struct weapon_data_s *info );
void (*pfnCmdStart) ( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed );
void (*pfnCmdEnd) ( const edict_t *player );
// Return 1 if the packet is valid. Set response_buffer_size if you want to send a response packet. Incoming, it holds the max
// size of the response_buffer, so you must zero it out if you choose not to respond.
int (*pfnConnectionlessPacket ) ( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );
// Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise
int (*pfnGetHullBounds) ( int hullnumber, float *mins, float *maxs );
// Create baselines for certain "unplaced" items.
void (*pfnCreateInstancedBaselines) ( void );
// One of the pfnForceUnmodified files failed the consistency check for the specified player
// Return 0 to allow the client to continue, 1 to force immediate disconnection ( with an optional disconnect message of up to 256 characters )
int (*pfnInconsistentFile)( const struct edict_s *player, const char *filename, char *disconnect_message );
// The game .dll should return 1 if lag compensation should be allowed ( could also just set
// the sv_unlag cvar.
// Most games right now should return 0, until client-side weapon prediction code is written
// and tested for them.
int (*pfnAllowLagCompensation)( void );
} DLL_FUNCTIONS;
extern DLL_FUNCTIONS gEntityInterface;
// Current version.
#define NEW_DLL_FUNCTIONS_VERSION 1
typedef struct
{
// Called right before the object's memory is freed.
// Calls its destructor.
void (*pfnOnFreeEntPrivateData)(edict_t *pEnt);
void (*pfnGameShutdown)(void);
int (*pfnShouldCollide)( edict_t *pentTouched, edict_t *pentOther );
// Added 2005/08/11 (no SDK update):
void (*pfnCvarValue)( const edict_t *pEnt, const char *value );
// Added 2005/11/21 (no SDK update):
// value is "Bad CVAR request" on failure (i.e that user is not connected or the cvar does not exist).
// value is "Bad Player" if invalid player edict.
void (*pfnCvarValue2)( const edict_t *pEnt, int requestID, const char *cvarName, const char *value );
} NEW_DLL_FUNCTIONS;
typedef int (*NEW_DLL_FUNCTIONS_FN)( NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
// Pointers will be null if the game DLL doesn't support this API.
extern NEW_DLL_FUNCTIONS gNewDLLFunctions;
typedef int (*APIFUNCTION)( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion );
typedef int (*APIFUNCTION2)( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
#endif /* EIFACE_H */

131
hlsdk/engine/keydefs.h Normal file
View File

@ -0,0 +1,131 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
// keydefs.h
#ifndef KEYDEFS_H
#define KEYDEFS_H
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
//
// these are the key numbers that should be passed to Key_Event
//
#define K_TAB 9
#define K_ENTER 13
#define K_ESCAPE 27
#define K_SPACE 32
// normal keys should be passed as lowercased ascii
#define K_BACKSPACE 127
#define K_UPARROW 128
#define K_DOWNARROW 129
#define K_LEFTARROW 130
#define K_RIGHTARROW 131
#define K_ALT 132
#define K_CTRL 133
#define K_SHIFT 134
#define K_F1 135
#define K_F2 136
#define K_F3 137
#define K_F4 138
#define K_F5 139
#define K_F6 140
#define K_F7 141
#define K_F8 142
#define K_F9 143
#define K_F10 144
#define K_F11 145
#define K_F12 146
#define K_INS 147
#define K_DEL 148
#define K_PGDN 149
#define K_PGUP 150
#define K_HOME 151
#define K_END 152
#define K_KP_HOME 160
#define K_KP_UPARROW 161
#define K_KP_PGUP 162
#define K_KP_LEFTARROW 163
#define K_KP_5 164
#define K_KP_RIGHTARROW 165
#define K_KP_END 166
#define K_KP_DOWNARROW 167
#define K_KP_PGDN 168
#define K_KP_ENTER 169
#define K_KP_INS 170
#define K_KP_DEL 171
#define K_KP_SLASH 172
#define K_KP_MINUS 173
#define K_KP_PLUS 174
#define K_CAPSLOCK 175
//
// joystick buttons
//
#define K_JOY1 203
#define K_JOY2 204
#define K_JOY3 205
#define K_JOY4 206
//
// aux keys are for multi-buttoned joysticks to generate so they can use
// the normal binding process
//
#define K_AUX1 207
#define K_AUX2 208
#define K_AUX3 209
#define K_AUX4 210
#define K_AUX5 211
#define K_AUX6 212
#define K_AUX7 213
#define K_AUX8 214
#define K_AUX9 215
#define K_AUX10 216
#define K_AUX11 217
#define K_AUX12 218
#define K_AUX13 219
#define K_AUX14 220
#define K_AUX15 221
#define K_AUX16 222
#define K_AUX17 223
#define K_AUX18 224
#define K_AUX19 225
#define K_AUX20 226
#define K_AUX21 227
#define K_AUX22 228
#define K_AUX23 229
#define K_AUX24 230
#define K_AUX25 231
#define K_AUX26 232
#define K_AUX27 233
#define K_AUX28 234
#define K_AUX29 235
#define K_AUX30 236
#define K_AUX31 237
#define K_AUX32 238
#define K_MWHEELDOWN 239
#define K_MWHEELUP 240
#define K_PAUSE 255
//
// mouse buttons generate virtual keys
//
#define K_MOUSE1 241
#define K_MOUSE2 242
#define K_MOUSE3 243
#define K_MOUSE4 244
#define K_MOUSE5 245
#endif // KEYDEFS_H

226
hlsdk/engine/progdefs.h Normal file
View File

@ -0,0 +1,226 @@
/***
*
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef PROGDEFS_H
#define PROGDEFS_H
#ifdef _WIN32
#ifndef __MINGW32__
#pragma once
#endif /* not __MINGW32__ */
#endif
typedef struct
{
float time;
float frametime;
float force_retouch;
string_t mapname;
string_t startspot;
float deathmatch;
float coop;
float teamplay;
float serverflags;
float found_secrets;
vec3_t v_forward;
vec3_t v_up;
vec3_t v_right;
float trace_allsolid;
float trace_startsolid;
float trace_fraction;
vec3_t trace_endpos;
vec3_t trace_plane_normal;
float trace_plane_dist;
edict_t *trace_ent;
float trace_inopen;
float trace_inwater;
int trace_hitgroup;
int trace_flags;
int msg_entity;
int cdAudioTrack;
int maxClients;
int maxEntities;
const char *pStringBase;
void *pSaveData;
vec3_t vecLandmarkOffset;
} globalvars_t;
typedef struct entvars_s
{
string_t classname;
string_t globalname;
vec3_t origin;
vec3_t oldorigin;
vec3_t velocity;
vec3_t basevelocity;
vec3_t clbasevelocity; // Base velocity that was passed in to server physics so
// client can predict conveyors correctly. Server zeroes it, so we need to store here, too.
vec3_t movedir;
vec3_t angles; // Model angles
vec3_t avelocity; // angle velocity (degrees per second)
vec3_t punchangle; // auto-decaying view angle adjustment
vec3_t v_angle; // Viewing angle (player only)
// For parametric entities
vec3_t endpos;
vec3_t startpos;
float impacttime;
float starttime;
int fixangle; // 0:nothing, 1:force view angles, 2:add avelocity
float idealpitch;
float pitch_speed;
float ideal_yaw;
float yaw_speed;
int modelindex;
string_t model;
int viewmodel; // player's viewmodel
int weaponmodel; // what other players see
vec3_t absmin; // BB max translated to world coord
vec3_t absmax; // BB max translated to world coord
vec3_t mins; // local BB min
vec3_t maxs; // local BB max
vec3_t size; // maxs - mins
float ltime;
float nextthink;
int movetype;
int solid;
int skin;
int body; // sub-model selection for studiomodels
int effects;
float gravity; // % of "normal" gravity
float friction; // inverse elasticity of MOVETYPE_BOUNCE
int light_level;
int sequence; // animation sequence
int gaitsequence; // movement animation sequence for player (0 for none)
float frame; // % playback position in animation sequences (0..255)
float animtime; // world time when frame was set
float framerate; // animation playback rate (-8x to 8x)
byte controller[4]; // bone controller setting (0..255)
byte blending[2]; // blending amount between sub-sequences (0..255)
float scale; // sprite rendering scale (0..255)
int rendermode;
float renderamt;
vec3_t rendercolor;
int renderfx;
float health;
float frags;
int weapons; // bit mask for available weapons
float takedamage;
int deadflag;
vec3_t view_ofs; // eye position
int button;
int impulse;
edict_t *chain; // Entity pointer when linked into a linked list
edict_t *dmg_inflictor;
edict_t *enemy;
edict_t *aiment; // entity pointer when MOVETYPE_FOLLOW
edict_t *owner;
edict_t *groundentity;
int spawnflags;
int flags;
int colormap; // lowbyte topcolor, highbyte bottomcolor
int team;
float max_health;
float teleport_time;
float armortype;
float armorvalue;
int waterlevel;
int watertype;
string_t target;
string_t targetname;
string_t netname;
string_t message;
float dmg_take;
float dmg_save;
float dmg;
float dmgtime;
string_t noise;
string_t noise1;
string_t noise2;
string_t noise3;
float speed;
float air_finished;
float pain_finished;
float radsuit_finished;
edict_t *pContainingEntity;
int playerclass;
float maxspeed;
float fov;
int weaponanim;
int pushmsec;
int bInDuck;
int flTimeStepSound;
int flSwimTime;
int flDuckTime;
int iStepLeft;
float flFallVelocity;
int gamestate;
int oldbuttons;
int groupinfo;
// For mods
int iuser1;
int iuser2;
int iuser3;
int iuser4;
float fuser1;
float fuser2;
float fuser3;
float fuser4;
vec3_t vuser1;
vec3_t vuser2;
vec3_t vuser3;
vec3_t vuser4;
edict_t *euser1;
edict_t *euser2;
edict_t *euser3;
edict_t *euser4;
} entvars_t;
#endif // PROGDEFS_H

82
hlsdk/engine/progs.h Normal file
View File

@ -0,0 +1,82 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef PROGS_H
#define PROGS_H
#include "progdefs.h"
// 16 simultaneous events, max
#define MAX_EVENT_QUEUE 64
#define DEFAULT_EVENT_RESENDS 1
#include "event_flags.h"
typedef struct event_info_s event_info_t;
#include "event_args.h"
struct event_info_s
{
unsigned short index; // 0 implies not in use
short packet_index; // Use data from state info for entity in delta_packet . -1 implies separate info based on event
// parameter signature
short entity_index; // The edict this event is associated with
float fire_time; // if non-zero, the time when the event should be fired ( fixed up on the client )
event_args_t args;
// CLIENT ONLY
int flags; // Reliable or not, etc.
};
typedef struct event_state_s event_state_t;
struct event_state_s
{
struct event_info_s ei[ MAX_EVENT_QUEUE ];
};
#if !defined( ENTITY_STATEH )
#include "entity_state.h"
#endif
#if !defined( EDICT_H )
#include "edict.h"
#endif
#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0)->m)))
#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area)
//============================================================================
extern char *pr_strings;
extern globalvars_t gGlobalVariables;
//============================================================================
edict_t *ED_Alloc (void);
void ED_Free (edict_t *ed);
void ED_LoadFromFile (char *data);
edict_t *EDICT_NUM(int n);
int NUM_FOR_EDICT(const edict_t *e);
#define PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + e))
#endif // PROGS_H

55
hlsdk/engine/shake.h Normal file
View File

@ -0,0 +1,55 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef SHAKE_H
#define SHAKE_H
// Screen / View effects
// screen shake
extern int gmsgShake;
// This structure is sent over the net to describe a screen shake event
typedef struct
{
unsigned short amplitude; // FIXED 4.12 amount of shake
unsigned short duration; // FIXED 4.12 seconds duration
unsigned short frequency; // FIXED 8.8 noise frequency (low frequency is a jerk,high frequency is a rumble)
} ScreenShake;
extern void V_ApplyShake( float *origin, float *angles, float factor );
extern void V_CalcShake( void );
extern int V_ScreenShake( const char *pszName, int iSize, void *pbuf );
extern int V_ScreenFade( const char *pszName, int iSize, void *pbuf );
// Fade in/out
extern int gmsgFade;
#define FFADE_IN 0x0000 // Just here so we don't pass 0 into the function
#define FFADE_OUT 0x0001 // Fade out (not in)
#define FFADE_MODULATE 0x0002 // Modulate (don't blend)
#define FFADE_STAYOUT 0x0004 // ignores the duration, stays faded out until new ScreenFade message received
// This structure is sent over the net to describe a screen fade event
typedef struct
{
unsigned short duration; // FIXED 4.12 seconds duration
unsigned short holdTime; // FIXED 4.12 seconds duration until reset (fade & hold)
short fadeFlags; // flags
byte r, g, b, a; // fade to color ( max alpha )
} ScreenFade;
#endif // SHAKE_H

362
hlsdk/engine/studio.h Normal file
View File

@ -0,0 +1,362 @@
/***
*
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef _STUDIO_H_
#define _STUDIO_H_
/*
==============================================================================
STUDIO MODELS
Studio models are position independent, so the cache manager can move them.
==============================================================================
*/
#define MAXSTUDIOTRIANGLES 20000 // TODO: tune this
#define MAXSTUDIOVERTS 2048 // TODO: tune this
#define MAXSTUDIOSEQUENCES 256 // total animation sequences
#define MAXSTUDIOSKINS 100 // total textures
#define MAXSTUDIOSRCBONES 512 // bones allowed at source movement
#define MAXSTUDIOBONES 128 // total bones actually used
#define MAXSTUDIOMODELS 32 // sub-models per model
#define MAXSTUDIOBODYPARTS 32
#define MAXSTUDIOGROUPS 16
#define MAXSTUDIOANIMATIONS 512 // per sequence
#define MAXSTUDIOMESHES 256
#define MAXSTUDIOEVENTS 1024
#define MAXSTUDIOPIVOTS 256
#define MAXSTUDIOCONTROLLERS 8
typedef struct
{
int id;
int version;
char name[64];
int length;
vec3_t eyeposition; // ideal eye position
vec3_t min; // ideal movement hull size
vec3_t max;
vec3_t bbmin; // clipping bounding box
vec3_t bbmax;
int flags;
int numbones; // bones
int boneindex;
int numbonecontrollers; // bone controllers
int bonecontrollerindex;
int numhitboxes; // complex bounding boxes
int hitboxindex;
int numseq; // animation sequences
int seqindex;
int numseqgroups; // demand loaded sequences
int seqgroupindex;
int numtextures; // raw textures
int textureindex;
int texturedataindex;
int numskinref; // replaceable textures
int numskinfamilies;
int skinindex;
int numbodyparts;
int bodypartindex;
int numattachments; // queryable attachable points
int attachmentindex;
int soundtable;
int soundindex;
int soundgroups;
int soundgroupindex;
int numtransitions; // animation node to animation node transition graph
int transitionindex;
} studiohdr_t;
// header for demand loaded sequence group data
typedef struct
{
int id;
int version;
char name[64];
int length;
} studioseqhdr_t;
// bones
typedef struct
{
char name[32]; // bone name for symbolic links
int parent; // parent bone
int flags; // ??
int bonecontroller[6]; // bone controller index, -1 == none
float value[6]; // default DoF values
float scale[6]; // scale for delta DoF values
} mstudiobone_t;
// bone controllers
typedef struct
{
int bone; // -1 == 0
int type; // X, Y, Z, XR, YR, ZR, M
float start;
float end;
int rest; // byte index value at rest
int index; // 0-3 user set controller, 4 mouth
} mstudiobonecontroller_t;
// intersection boxes
typedef struct
{
int bone;
int group; // intersection group
vec3_t bbmin; // bounding box
vec3_t bbmax;
} mstudiobbox_t;
#if !defined( CACHE_USER ) && !defined( QUAKEDEF_H )
#define CACHE_USER
typedef struct cache_user_s
{
void *data;
} cache_user_t;
#endif
// demand loaded sequence groups
typedef struct
{
char label[32]; // textual name
char name[64]; // file name
cache_user_t cache; // cache index pointer
int data; // hack for group 0
} mstudioseqgroup_t;
// sequence descriptions
typedef struct
{
char label[32]; // sequence label
float fps; // frames per second
int flags; // looping/non-looping flags
int activity;
int actweight;
int numevents;
int eventindex;
int numframes; // number of frames per sequence
int numpivots; // number of foot pivots
int pivotindex;
int motiontype;
int motionbone;
vec3_t linearmovement;
int automoveposindex;
int automoveangleindex;
vec3_t bbmin; // per sequence bounding box
vec3_t bbmax;
int numblends;
int animindex; // mstudioanim_t pointer relative to start of sequence group data
// [blend][bone][X, Y, Z, XR, YR, ZR]
int blendtype[2]; // X, Y, Z, XR, YR, ZR
float blendstart[2]; // starting value
float blendend[2]; // ending value
int blendparent;
int seqgroup; // sequence group for demand loading
int entrynode; // transition node at entry
int exitnode; // transition node at exit
int nodeflags; // transition rules
int nextseq; // auto advancing sequences
} mstudioseqdesc_t;
// events
#include "studio_event.h"
/*
typedef struct
{
int frame;
int event;
int type;
char options[64];
} mstudioevent_t;
*/
// pivots
typedef struct
{
vec3_t org; // pivot point
int start;
int end;
} mstudiopivot_t;
// attachment
typedef struct
{
char name[32];
int type;
int bone;
vec3_t org; // attachment point
vec3_t vectors[3];
} mstudioattachment_t;
typedef struct
{
unsigned short offset[6];
} mstudioanim_t;
// animation frames
typedef union
{
struct {
byte valid;
byte total;
} num;
short value;
} mstudioanimvalue_t;
// body part index
typedef struct
{
char name[64];
int nummodels;
int base;
int modelindex; // index into models array
} mstudiobodyparts_t;
// skin info
typedef struct
{
char name[64];
int flags;
int width;
int height;
int index;
} mstudiotexture_t;
// skin families
// short index[skinfamilies][skinref]
// studio models
typedef struct
{
char name[64];
int type;
float boundingradius;
int nummesh;
int meshindex;
int numverts; // number of unique vertices
int vertinfoindex; // vertex bone info
int vertindex; // vertex vec3_t
int numnorms; // number of unique surface normals
int norminfoindex; // normal bone info
int normindex; // normal vec3_t
int numgroups; // deformation groups
int groupindex;
} mstudiomodel_t;
// vec3_t boundingbox[model][bone][2]; // complex intersection info
// meshes
typedef struct
{
int numtris;
int triindex;
int skinref;
int numnorms; // per mesh normals
int normindex; // normal vec3_t
} mstudiomesh_t;
// triangles
#if 0
typedef struct
{
short vertindex; // index into vertex array
short normindex; // index into normal array
short s,t; // s,t position on skin
} mstudiotrivert_t;
#endif
// lighting options
#define STUDIO_NF_FLATSHADE 0x0001
#define STUDIO_NF_CHROME 0x0002
#define STUDIO_NF_FULLBRIGHT 0x0004
// motion flags
#define STUDIO_X 0x0001
#define STUDIO_Y 0x0002
#define STUDIO_Z 0x0004
#define STUDIO_XR 0x0008
#define STUDIO_YR 0x0010
#define STUDIO_ZR 0x0020
#define STUDIO_LX 0x0040
#define STUDIO_LY 0x0080
#define STUDIO_LZ 0x0100
#define STUDIO_AX 0x0200
#define STUDIO_AY 0x0400
#define STUDIO_AZ 0x0800
#define STUDIO_AXR 0x1000
#define STUDIO_AYR 0x2000
#define STUDIO_AZR 0x4000
#define STUDIO_TYPES 0x7FFF
#define STUDIO_RLOOP 0x8000 // controller that wraps shortest distance
// sequence flags
#define STUDIO_LOOPING 0x0001
// bone flags
#define STUDIO_HAS_NORMALS 0x0001
#define STUDIO_HAS_VERTICES 0x0002
#define STUDIO_HAS_BBOX 0x0004
#define STUDIO_HAS_CHROME 0x0008 // if any of the textures have chrome on them
#define RAD_TO_STUDIO (32768.0/M_PI)
#define STUDIO_TO_RAD (M_PI/32768.0)
#endif

2
hlsdk/hlsdk_readme.txt Normal file
View File

@ -0,0 +1,2 @@
This HLSDK is without CBaseEntity and other gamedll internal headers.
Mainly for metamod-p and plugin compiles.

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