├── .gitignore ├── ABOUT.txt ├── Config.mak ├── GPL.txt ├── Makefile ├── README.txt ├── doc ├── Changelog ├── README.txt ├── TODO ├── config.ini ├── html │ ├── Index.html │ ├── a.html │ ├── about.html │ ├── coding.html │ ├── dllapi_notes.html │ ├── engine_notes.html │ ├── faq.html │ ├── gamesupport.html │ ├── links.html │ ├── maillist.html │ ├── metamod.html │ ├── newapi_notes.html │ ├── release_notes.html │ ├── supportedmods.html │ ├── trace.html │ └── wdmisc.html ├── plugins.ini └── txt │ ├── Index.txt │ ├── a.txt │ ├── about.txt │ ├── coding.txt │ ├── dllapi_notes.txt │ ├── engine_notes.txt │ ├── faq.txt │ ├── gamesupport.txt │ ├── links.txt │ ├── maillist.txt │ ├── metamod.txt │ ├── newapi_notes.txt │ ├── release_notes.txt │ ├── supportedmods.txt │ ├── trace.txt │ ├── wdmisc.txt │ └── windows_notes.txt ├── hlsdk ├── common │ ├── beamdef.h │ ├── cl_entity.h │ ├── com_model.h │ ├── con_nprint.h │ ├── const.h │ ├── crc.h │ ├── cvardef.h │ ├── demo_api.h │ ├── director_cmds.h │ ├── dlight.h │ ├── dll_state.h │ ├── engine_launcher_api.h │ ├── entity_state.h │ ├── entity_types.h │ ├── event_api.h │ ├── event_args.h │ ├── event_flags.h │ ├── exefuncs.h │ ├── hltv.h │ ├── in_buttons.h │ ├── interface.h │ ├── ivoicetweak.h │ ├── mathlib.h │ ├── net_api.h │ ├── netadr.h │ ├── nowin.h │ ├── particledef.h │ ├── pmtrace.h │ ├── qfont.h │ ├── r_efx.h │ ├── r_studioint.h │ ├── ref_params.h │ ├── screenfade.h │ ├── studio_event.h │ ├── triangleapi.h │ ├── usercmd.h │ └── weaponinfo.h ├── dlls │ ├── cdll_dll.h │ ├── enginecallback.h │ ├── extdll.h │ ├── util.h │ └── vector.h ├── engine │ ├── Sequence.h │ ├── anorms.h │ ├── archtypes.h │ ├── cdll_int.h │ ├── custom.h │ ├── customentity.h │ ├── edict.h │ ├── eiface.h │ ├── keydefs.h │ ├── progdefs.h │ ├── progs.h │ ├── shake.h │ └── studio.h ├── hlsdk_readme.txt └── pm_shared │ ├── pm_debug.h │ ├── pm_defs.h │ ├── pm_info.h │ ├── pm_materials.h │ ├── pm_movevars.h │ └── pm_shared.h ├── metamod ├── .gitignore ├── Config.mak ├── Makefile ├── api_hook.cpp ├── api_hook.h ├── api_info.cpp ├── api_info.h ├── build_all.sh ├── commands_meta.cpp ├── commands_meta.h ├── comp_dep.h ├── conf_meta.cpp ├── conf_meta.h ├── dllapi.cpp ├── dllapi.h ├── engine_api.cpp ├── engine_api.h ├── engine_t.h ├── enginecallbacks.h ├── engineinfo.cpp ├── engineinfo.h ├── game_autodetect.cpp ├── game_autodetect.h ├── game_support.cpp ├── game_support.h ├── games.h ├── h_export.cpp ├── h_export.h ├── i386pe.merge ├── info_name.h ├── linkent.h ├── linkgame.cpp ├── linkplug.cpp ├── log_meta.cpp ├── log_meta.h ├── meta_api.h ├── meta_eiface.cpp ├── meta_eiface.h ├── metamod.cpp ├── metamod.def ├── metamod.h ├── metamod.sln ├── metamod.vcproj ├── mhook.cpp ├── mhook.h ├── mlist.cpp ├── mlist.h ├── mm_pextensions.h ├── mplayer.cpp ├── mplayer.h ├── mplugin.cpp ├── mplugin.h ├── mqueue.cpp ├── mqueue.h ├── mreg.cpp ├── mreg.h ├── mutil.cpp ├── mutil.h ├── new_baseclass.h ├── osdep.cpp ├── osdep.h ├── osdep_detect_gamedll_linux.cpp ├── osdep_detect_gamedll_win32.cpp ├── osdep_linkent_linux.cpp ├── osdep_linkent_win32.cpp ├── osdep_p.cpp ├── osdep_p.h ├── physint.h ├── plinfo.h ├── reg_support.cpp ├── reg_support.h ├── res_meta.rc ├── ret_type.h ├── sdk_util.cpp ├── sdk_util.h ├── studioapi.cpp ├── studioapi.h ├── support_meta.cpp ├── support_meta.h ├── thread_logparse.cpp ├── thread_logparse.h ├── tqueue.h ├── types_meta.h ├── vdate.cpp ├── vdate.h └── vers_meta.h ├── stub_plugin ├── .gitignore ├── Config.mak ├── Makefile ├── dllapi.cpp ├── dummy.h ├── dummy.rc ├── engine_api.cpp ├── h_export.cpp ├── info_name.h ├── meta_api.cpp └── sdk_util.cpp ├── tools ├── getents.sh └── stlfilter ├── trace_plugin ├── .gitignore ├── Config.mak ├── Makefile ├── api_info.cpp ├── dllapi.cpp ├── dllapi_post.cpp ├── dllapi_post.h ├── engine_api.cpp ├── engine_api_post.cpp ├── engine_api_post.h ├── h_export.cpp ├── info_name.h ├── log_plugin.cpp ├── log_plugin.h ├── meta_api.cpp ├── plugin.cpp ├── plugin.h ├── res_meta.rc ├── sdk_util.cpp ├── trace_api.cpp ├── trace_api.h └── vdate.cpp └── wdmisc_plugin ├── .gitignore ├── Config.mak ├── Makefile ├── dll_plugin.cpp ├── dll_plugin.h ├── engine_api.cpp ├── h_export.cpp ├── info_name.h ├── log_plugin.cpp ├── log_plugin.h ├── meta_api.cpp ├── plugin.h ├── res_meta.rc ├── sdk_util.cpp ├── vdate.cpp ├── wdmisc.cpp └── wdmisc.h /.gitignore: -------------------------------------------------------------------------------- 1 | #temporary files 2 | *~ 3 | -------------------------------------------------------------------------------- /ABOUT.txt: -------------------------------------------------------------------------------- 1 | Metamod 2 | =-=-=-= 3 | 4 | a Half-Life utility mod 5 | 6 | meta /me't*/ or /may't*/ or (Commonwealth) /mee't*/ adj.,pref. 7 | [from analytic philosophy] One level of description up. 8 | 9 | The purpose of MetaMod is to function "one level up" from the normal 10 | Half-Life game mod DLL. Sitting between the mod game DLL and the Half-Life 11 | engine/binary, it intercepts the function calls between the two, with the 12 | option of passing them along untouched, as well as passing them on to as 13 | any number of _additional mod-like DLLs_. 14 | 15 | Thus, you can actually have multiple "mod-like" DLLs in operation at one 16 | time. I say "mod-like" because these additional DLLs (we'll call them 17 | "plugins") are not intended to provide a full "game"; that functionality 18 | is still provided by the "game dll". However, these plugins can _add to_ 19 | or _modify the functionality provided by the game dll, or by the engine 20 | itself - for instance, adding new server commands, or new client commands, 21 | or even disabling commands built into the game dll. Although the plugin 22 | isn't intended to provide full HL-game functionality, since it's receiving 23 | the same information given to the game DLL, it has the opportunity to do 24 | _anything_ the game DLL can do (given enough coding effort of course). 25 | 26 | This is very similar to the way Alfred Reynolds' AdminMod 27 | (www.adminmod.org) works, as it also sits between the engine and game dll, 28 | catching routines, and passing them on. thus modifying functionality. 29 | However, rather than providing just the additional server features builtin 30 | to AdminMod DLL, MetaMod allows you to add features from multiple, 31 | separate DLLs. Under that framework, AdminMod can be a plugin itself, and 32 | be run alongside numerous other plugins. And, as of version 2.50 of 33 | AdminMod, AM has now transitioned to running as a Metamod plugin. 34 | 35 | -------------------------------------------------------------------------- 36 | -------------------------------------------------------------------------------- /Config.mak: -------------------------------------------------------------------------------- 1 | PROJNAME = metamod 2 | 3 | #SUBDIRS := $(shell find */Makefile | sed "s/.Makefile//") 4 | SUBDIRS = metamod stub_plugin trace_plugin wdmisc_plugin 5 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # vi: set ts=4 sw=4 : 2 | # vim: set tw=75 : 3 | 4 | # MetaMod toplevel makefile 5 | # Copyright (c) 2001-2003 Will Day 6 | # 7 | # some sections as demonstated in GNU's make.info documentation 8 | 9 | include Config.mak 10 | 11 | ifeq "$(USER)" "willday" 12 | include priv/top.mak 13 | endif 14 | 15 | .DEFAULT: 16 | for i in $(SUBDIRS); do \ 17 | $(MAKE) -C $$i $@ || exit; \ 18 | done 19 | 20 | .PHONY: subdirs dlls $(SUBDIRS) 21 | 22 | subdirs: $(SUBDIRS) 23 | 24 | $(SUBDIRS): 25 | $(MAKE) -C $@ 26 | 27 | clean cleanall: 28 | for i in $(SUBDIRS); do \ 29 | $(MAKE) -C $$i cleanall || exit; \ 30 | done 31 | -rm dlls/* dlls/debug/* 32 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | Metamod Half-Life utility mod 2 | 3 | See the files under "doc/txt" or "doc/html" for more information. 4 | 5 | Will Day 6 | willday@metamod.org 7 | http://www.metamod.org/ 8 | -------------------------------------------------------------------------------- /doc/README.txt: -------------------------------------------------------------------------------- 1 | Please see the files in the "html" or "txt" directory for documentation. 2 | 3 | Example files in the current directory: 4 | 5 | plugins.ini 6 | config.ini 7 | -------------------------------------------------------------------------------- /doc/TODO: -------------------------------------------------------------------------------- 1 | # vi: set ts=4 sw=4 : 2 | # vim: set tw=75 : 3 | 4 | - event notification and log-parsing interface for plugins 5 | - interaction between plugins 6 | - rename trace functions to "tr_*" for easier debug breakpoints 7 | - add meta console command to debug indiv functions, like mm_trace can 8 | - catch register cmds/cvars from gameDLL and list then in "meta game" 9 | - in win32, doesn't report parsed plugin line properly; says only: 10 | [META] ini: Read plugin config for: 11 | - use scanf for file parsing ? 12 | - "meta cancel" command 13 | - more documentation info 14 | - don't refresh_ini on "quit" 15 | - test more bot support for metagame.ini 16 | 17 | - track "messages" for plugins and provide READ_* functions (usermsg.cpp) 18 | - provide other "engine" functions to plugins 19 | - is_connected 20 | - is_ingame 21 | 22 | x fix stat()-related code for linux only 23 | x remake MSVC project 24 | x use resources 25 | x doublecheck DLLEXPORT and stuff 26 | x txt files in "dos" format? 27 | x separate zip/tgz files 28 | x compat support for "admin.ini" 29 | x support dir-specific "metamod.ini" files, similar to servercfgfile 30 | x more documentation info: engineapi_info.txt 31 | x html view of source 32 | x handle RegUserMsg and allow lists of registered messages to be queried 33 | by bot plugins or other plugins that want to catch these things, and to 34 | allow these plugins to be loaded during a map (since after mapstart, the 35 | plugin can't catch RegUserMsg calls, since they've all already been made). 36 | x find some way to generally allow plugins to use LINK_ENTITY_TO_CLASS, 37 | without requiring explicit support in metamod -------------------------------------------------------------------------------- /doc/config.ini: -------------------------------------------------------------------------------- 1 | // vim: set ft=c : 2 | // 3 | // Format is as follows: 4 | // 5 | // 6 | // Fields are whitespace delimited (tabs/spaces). 7 | // 8 | // Comments are either c++ style ("//") or unix shell style ("#"), and 9 | // can appear ONLY at the beginning of a line. 10 | // 11 | // The following provide a list of recognized options, their defaults, and 12 | // examples of usage. 13 | // 14 | // debuglevel 15 | // gamedll 16 | // plugins_file 17 | // exec_cfg 18 | // autodetect 19 | 20 | 21 | // debuglevel 22 | // where is an integer, 0 and up. 23 | // Sets the initial debugging level for metamod (same as cvar "meta_debug"). 24 | // Default is normally 0. If hlds is run with "-dev", default is 3. 25 | // Overridden by: +localinfo mm_debug 26 | // Examples: 27 | // 28 | // debuglevel 0 29 | // debuglevel 42 30 | 31 | 32 | // gamedll 33 | // where is an absolute path, or a path relative to the gamedir. 34 | // Overrides the auto-detected gamedll, in particular for bots. 35 | // Default is empty, with gamedll being auto-recognized based on the 36 | // gamedir. 37 | // Overridden by: +localinfo mm_gamedll 38 | // Examples: 39 | // 40 | // gamedll dlls/hl.dll 41 | // gamedll ../podbot/podbot.dll 42 | // gamedll /home/bots/dlls/mybot.dll 43 | 44 | 45 | // plugins_file 46 | // where is an absolute path, or a path relative to the gamedir. 47 | // Overrides the default filename containing the MM plugins to load. 48 | // Default is "addons/metamod/plugins.ini". 49 | // Overridden by: +localinfo mm_pluginsfile 50 | // Examples: 51 | // 52 | // plugins_file cfg/clanmode.ini 53 | // plugins_file ../private.ini 54 | // plugins_file /home/half-life/testing.ini 55 | 56 | 57 | // exec_cfg 58 | // where is a path relative to the gamedir. Note! This CANNOT be 59 | // an absolute path, as hlds will not "exec" absolute pathnames. 60 | // Overrides the default filename containing hlds commands to run just 61 | // after loading Metamod. 62 | // Default is "addons/metamod/exec.cfg". 63 | // Overridden by: +localinfo mm_execcfg 64 | // Examples: 65 | // 66 | // exec_cfg configs/debugging.cfg 67 | // exec_cfg ../clan/match.cfg 68 | 69 | 70 | // autodetect 71 | // Setting to disable or enable autodetection of gamedll. 72 | // Extra feature for Metamod+All-Mod-Support Patch. 73 | // Default is "yes". 74 | // Overridden by: +localinfo mm_autodetect 75 | // Examples: 76 | // 77 | // autodetect yes 78 | // autodetect no 79 | 80 | 81 | // clientmeta 82 | // Setting to disable or enable Metamod's client commands ('meta list' and 83 | // 'meta version') 84 | // Extra setting for Metamod+All-Mod-Support Patch. 85 | // Default is "yes". 86 | // Overridden by: +localinfo mm_clientmeta 87 | // Examples: 88 | // 89 | // clientmeta yes 90 | // clientmeta no 91 | -------------------------------------------------------------------------------- /doc/html/Index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Metamod 7 | 8 | 9 | 10 |

Metamod 11 |

12 | 13 |

Metamod is a plugin/DLL manager that sits between the Half-Life Engine and 14 | an HL Game mod, allowing the dynamic loading/unloading of mod-like DLL 15 | plugins to add functionality to the HL server or game mod. 16 | 17 |

18 |


19 | 20 |

21 | See metamod.org for news, downloads, 22 | and plugin links. 23 | 24 |

25 |


26 | 27 | 28 | 29 | 42 | 43 | 54 | 55 | 56 |
30 |

Metamod Docs

31 | 41 |
44 |

Other HLDS info

45 | 53 |
57 | 58 |

59 |


60 |
<willday@metamod.org>
61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /doc/html/a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Metamod Supported Games 7 | 8 | 9 | 10 | 11 |

Supported Games 12 |

13 |
14 | 15 | Metamod includes support for the following mods, with version and last 16 | update if known. 17 | 18 |

19 | To get support added for a new Mod, or for an updated version of a Mod, see 20 | Adding game support. 21 | 22 |

23 | 24 | 25 | 26 | 31 | 32 |
Name Version Last update Ent list Comments
ALL MODS SUPPORTED BY
27 |     All-Mod-Support PATCH
28 |     By Jussi Kivilinna
29 |     http://koti.mbnet.fi/axh/ 30 |
NONE
33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /doc/html/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | About Metamod 7 | 8 | 9 | 10 |

Metamod 11 |

12 | 13 |

a Half-Life utility mod

14 | 15 |
16 |     meta /me't*/ or /may't*/ or (Commonwealth) /mee't*/ adj.,pref.
17 |         [from analytic philosophy] One level of description up.
18 | 
19 | 20 |

The purpose of MetaMod is to function "one level up" from the normal 21 | Half-Life game mod DLL. Sitting between the mod game DLL and the Half-Life 22 | engine/binary, it intercepts the function calls between the two, with the 23 | option of passing them along untouched, as well as passing them on to as 24 | any number of additional mod-like DLLs. 25 | 26 |

Thus, you can actually have multiple "mod-like" DLLs in operation at 27 | one time. I say "mod-like" because these additional DLLs (we'll call them 28 | "plugins") are not intended to provide a full "game"; that functionality is 29 | still provided by the "game dll". However, these plugins can add 30 | to or modify the functionality provided by the game 31 | dll, or by the engine itself - for instance, adding new server commands, or 32 | new client commands, or even disabling commands built into the game dll. 33 | Although the plugin isn't intended to provide full HL-game functionality, 34 | since it's receiving the same information given to the game DLL, it has the 35 | opportunity to do anything the game DLL can do (given enough 36 | coding effort of course). 37 | 38 |

This is very similar to the way Alfred Reynolds' 39 | AdminMod works, as it also sits 40 | between the engine and game dll, catching routines, and passing them on. 41 | thus modifying functionality. However, rather than providing just the 42 | additional server features builtin to AdminMod DLL, MetaMod allows you to 43 | add features from multiple, separate DLLs. Under that framework, AdminMod 44 | can be a plugin itself, and be run alongside numerous other plugins. And, 45 | as of version 2.50 of AdminMod, AM has now transitioned to running as a 46 | Metamod plugin. 47 | 48 |

49 |


50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /doc/html/gamesupport.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Metamod Adding Game/Mod Support 7 | 8 | 9 | 10 |

Adding Game/Mod Support 11 |

12 | 13 | Metamod-P already supports your Mod. 14 | 15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /doc/html/maillist.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Metamod Mailing lists 7 | 8 | 9 | 10 |

Mailing lists 11 |

12 | 13 | I've created a couple of lists on YahooGroups (formerly egroups (formerly 14 | onelist)): 15 | 16 |
    17 |
  • metamod-announce for announcements of new versions and plugins 18 |
  • metamod for 19 | questions, support, discussion, etc 20 |
21 | 22 | There are simple subscribe forms below. 23 | 24 | 25 | 26 | 27 | 32 | 36 | 37 | 38 |
28 | Subscribe to metamod-announce
29 |
30 | groups.yahoo.com/metamod-announce 31 |
33 | 35 |
39 | 40 |

41 | 42 | 43 | 44 | 45 | 50 | 54 | 55 | 56 |
46 | Subscribe to metamod
47 |
48 | groups.yahoo.com/metamod 49 |
51 | 53 |
57 | 58 |

59 |


60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /doc/html/newapi_notes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | HLSDK NEWAPI Notes 7 | 8 | 9 | 10 |

HLSDK NEWAPI Notes 11 |

12 | 13 |
14 | 19 | 20 | NOTE: No examples of these found in SDK... 21 | 22 |

23 | 24 |


OnFreeEntPrivateData

25 |
void OnFreeEntPrivateData(edict_t pEnt);

26 | from engine/eiface.h:
27 |

28 | Called right before the object's memory is freed. Calls its destructor. 29 |
30 |

comments:
31 |

32 | See also Ken Birdwell on constructors, from the HLCoders list. 35 |
Added in SDK 2.0. 36 |
37 | 38 |

GameShutdown

39 |
void GameShutdown(void);

40 |

comments:
41 |

42 | Added in SDK 2.0. 43 |
44 | 45 |

ShouldCollide

46 |
int ShouldCollide(edict_t *pentTouched, edict_t *pentOther);

47 | from kenb@valvesoftware.com, via HLCoders:
48 |

49 | ..a hook that can override if any two entities should collide 50 | when they try to pass through each other. 51 |
52 |

comments:
53 |

54 | Mugsy from DoD indicates that the return value for normal operation is 1. 55 |
Added in SDK 2.0. 56 |
57 | 58 |

59 |


60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /doc/html/supportedmods.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Metamod Supported Mods/Games 7 | 8 | 9 | 10 | 11 |

Supported Mods/Games 12 |

13 |
14 | 15 | Metamod includes support for the following mods, with version and last 16 | update if known. 17 | 18 |

19 | To get support added for a new Mod, or for an updated version of a Mod, see 20 | Adding game support. 21 | 22 |

23 | 24 | 25 | 26 | 31 | 32 |
Name Version Last update Ent list Comments
ALL MODS SUPPORTED BY
27 |     All-Mod-Support PATCH
28 |     By Jussi Kivilinna
29 |     http://koti.mbnet.fi/axh/ 30 |
NONE
33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /doc/html/trace.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Metamod TraceAPI Plugin 7 | 8 | 9 | 10 |

TraceAPI plugin 11 |

12 | 13 |

This was originally intended as a (more or less) complete example of a 14 | Metamod plugin. It catches every call available to it (dll 15 | routines both before and after the game, as well as engine functions both 16 | before and after the engine). 17 | 18 |

Because it catches every routine, I figured I'd give it the ability to 19 | log when given routines are called, so it became an "api tracing" plugin. 20 | :) 21 | 22 |

This can actually be useful for tracking the operation of the HL 23 | engine, as well as that of a particular HL game mod. 24 | 25 |

It recognizes the following server cvars: 26 | 27 |

28 |    // Tracing debug levels; higher values log increasingly frequent routines.
29 |    // Currently 0-50.  See "api_info.cpp" for the debug levels of various
30 |    // functions.
31 | 
32 |    // Trace level for dllapi routines.
33 |    trace_dllapi
34 | 
35 |    // Trace level for "new" dllapi routines.
36 |    trace_newapi
37 | 
38 |    // Trace level for engine functions.
39 |    trace_engine
40 | 
41 |    // Enable unlimited trace logging.  By default (as of v1.06), it only
42 |    // logs _one_ trace message per second, to keep from overwhelming the
43 |    // server.  Set to "1" to enable unlimited logging.  (Default "0")
44 |    trace_unlimit
45 | 
46 |    // General debug level, independent of trace levels.  Not currently used.
47 |    trace_debug
48 | 
49 | 
50 | 51 |

and the following server commands: 52 | 53 |

54 |    // Enable tracing of a given routine, independent of "trace_*" level.
55 |    // See the list of routine names in "api_info.cpp".  Case is insignificant.
56 |    trace set <APIroutine>
57 | 
58 |    // Disable tracing of a given routine, iff previously enabled with "trace".
59 |    // Doesn't affect routines being logged via "trace_*" level.
60 |    trace unset <APIroutine>
61 | 
62 |    // Show the routines being traced.
63 |    trace show
64 | 
65 |    // List the various routines that can be traced.
66 |    trace list dllapi
67 |    trace list newapi
68 |    trace list engine
69 |    trace list all
70 | 
71 |    // Prints out version/date/etc.
72 |    trace version
73 | 
74 | 75 |

Note the information it logs on each routine invocation is, at the 76 | moment, relatively minimal. I included information that seemed obvious 77 | (args for a ClientCommand, etc), and I've added info for other 78 | routines as I've come across a need. Most routines I still know too little 79 | about to log any particular information (CreateBaseline, etc). 80 | Feel free to add information that you're interested in to the log messages 81 | in the routines; the examples should be pretty self-explanatory. I'd be 82 | interested in knowing as well, for adding it to the distribution code. 83 | 84 |

85 |


86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /doc/html/wdmisc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Metamod WDMisc Plugin 7 | 8 | 9 | 10 |

WDMisc plugin 11 |

12 | 13 |

This is a simple plugin that I use as a testbed for various features 14 | and other things I need to try from a plugin. 15 | 16 |

It currently provides two features: 17 | 18 |

    19 | 20 |

  • a cvar "bounce" that, if set to 1, will exit the server at map 21 | change. I use this when I need to shutdown or the server, and don't 22 | want to kill it in the middle of a map, nor watch the server constantly 23 | until the timelimit expires. 24 | 25 |

  • it prints a centersay to all the players whenever someone in 26 | Counter-Strike plants the bomb. This was done basically as a 27 | proof-of-concept for catching certain game-events that aren't otherwise 28 | triggered by the HL API. It works only by examining every log message 29 | that the server generates, and checking to see if it includes the string 30 | indicating the particular event in question (in this case 31 | "Planted_The_Bomb"). 32 | 33 |

    Although this works, it is really a rather poor 34 | solution to the problem, as it assumes a lot of 35 | string-compares, which can seriously degrade the performance of 36 | the server. I did try to take as many short-cuts as reasonable in the 37 | code, to decrease the amount of string-comparing going on, which makes 38 | the code a bit less readable than doing just a "strstr" on the log line. 39 | 40 |

41 | 42 | Other features to be added/removed in the future... 43 | 44 |

45 |


46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /doc/plugins.ini: -------------------------------------------------------------------------------- 1 | // vim: set ft=c : 2 | // 3 | // Format is as follows: 4 | // 5 | // 6 | // Fields are whitespace delimited (tabs/spaces). 7 | // 8 | // - Platform must be either "linux" or "win32". 9 | // - Path can be either an absolute pathname, or a pathname relative to the 10 | // gamedir. Paths should use unix-style forward slashes (/) rather than 11 | // windows-style backslashes (\), even on windows platforms. Also, the 12 | // path (once expanded to full path name) is expected to be unique within 13 | // the list of plugins. Thus, a plugin with a fullpathname matching that 14 | // of a previous plugin is considered a duplicate, and is not loaded. 15 | // - Description is optional, and replaces the plugin's internal name in 16 | // console output and log messages. 17 | // 18 | // Comments are either c++ style ("//") or unix shell style ("#"), and 19 | // can appear ONLY at the beginning of a line. 20 | // 21 | // Note that the plugins are loaded and accessed in the order specified, so 22 | // ordering CAN be important, depending on the plugin(s). 23 | // 24 | // The following are examples of valid lines. 25 | // 26 | 27 | // linux dlls/mybot.so 28 | # win32 dlls/mybot-old.dll Mybot old 29 | win32 dlls/mybot.dll Mybot current 30 | linux /tmp/stub_mm_i386.so 31 | win32 /tmp/stub_mm_i386.dll 32 | linux ../dlls/trace_mm_i386.so 33 | win32 ../dlls/trace_mm_i386.dll 34 | linux dlls/admin_MM_i386.so 35 | win32 dlls/admin_MM_i386.dll 36 | -------------------------------------------------------------------------------- /doc/txt/Index.txt: -------------------------------------------------------------------------------- 1 | Metamod 2 | =-=-=-= 3 | 4 | Metamod is a plugin/DLL manager that sits between the Half-Life Engine and 5 | an HL Game mod, allowing the dynamic loading/unloading of mod-like DLL 6 | plugins to add functionality to the HL server or game mod. 7 | 8 | -------------------------------------------------------------------------- 9 | 10 | See metamod.org (metamod.org/) for news, downloads, and plugin links. 11 | 12 | -------------------------------------------------------------------------- 13 | 14 | Metamod Docs Other HLDS info 15 | 16 | - About metamod * SDK DLLAPI Notes 17 | - FAQ * SDK NEWAPI Notes 18 | - Using metamod * SDK Engine Notes 19 | - Release Notes 20 | - Game/Mod support * Related links & books 21 | - Trace Plugin * Mailing lists 22 | - WDMisc Plugin 23 | - Coding for metamod 24 | 25 | -------------------------------------------------------------------------- 26 | 27 | 28 | -------------------------------------------------------------------------------- /doc/txt/a.txt: -------------------------------------------------------------------------------- 1 | Supported Games 2 | =-=-=-=-=-=-=-= 3 | 4 | Metamod includes support for the following mods, with version and last 5 | update if known. 6 | 7 | To get support added for a new Mod, or for an updated version of a Mod, 8 | see Adding game support. 9 | 10 | +-------------------------------------------------------------------------+ 11 | | Name | Version | Last | Ent | Comments | 12 | | | | update | list | | 13 | |---------------------------------+----------+--------+--------+----------| 14 | | ALL MODS SUPPORTED BY | ALL | | NONE | | 15 | | All-Mod-Support PATCH | | | | | 16 | | By Jussi Kivilinna | | | | | 17 | | http://koti.mbnet.fi/axh/ | | | | | 18 | +---------------------------------+----------+--------+--------+----------+ 19 | 20 | -------------------------------------------------------------------------------- /doc/txt/about.txt: -------------------------------------------------------------------------------- 1 | Metamod 2 | =-=-=-= 3 | 4 | a Half-Life utility mod 5 | 6 | meta /me't*/ or /may't*/ or (Commonwealth) /mee't*/ adj.,pref. 7 | [from analytic philosophy] One level of description up. 8 | 9 | The purpose of MetaMod is to function "one level up" from the normal 10 | Half-Life game mod DLL. Sitting between the mod game DLL and the Half-Life 11 | engine/binary, it intercepts the function calls between the two, with the 12 | option of passing them along untouched, as well as passing them on to as 13 | any number of _additional mod-like DLLs_. 14 | 15 | Thus, you can actually have multiple "mod-like" DLLs in operation at one 16 | time. I say "mod-like" because these additional DLLs (we'll call them 17 | "plugins") are not intended to provide a full "game"; that functionality 18 | is still provided by the "game dll". However, these plugins can _add to_ 19 | or _modify the functionality provided by the game dll, or by the engine 20 | itself - for instance, adding new server commands, or new client commands, 21 | or even disabling commands built into the game dll. Although the plugin 22 | isn't intended to provide full HL-game functionality, since it's receiving 23 | the same information given to the game DLL, it has the opportunity to do 24 | _anything_ the game DLL can do (given enough coding effort of course). 25 | 26 | This is very similar to the way Alfred Reynolds' AdminMod 27 | (www.adminmod.org) works, as it also sits between the engine and game dll, 28 | catching routines, and passing them on. thus modifying functionality. 29 | However, rather than providing just the additional server features builtin 30 | to AdminMod DLL, MetaMod allows you to add features from multiple, 31 | separate DLLs. Under that framework, AdminMod can be a plugin itself, and 32 | be run alongside numerous other plugins. And, as of version 2.50 of 33 | AdminMod, AM has now transitioned to running as a Metamod plugin. 34 | 35 | -------------------------------------------------------------------------- 36 | -------------------------------------------------------------------------------- /doc/txt/gamesupport.txt: -------------------------------------------------------------------------------- 1 | Adding Game/Mod Support 2 | =-=-=-=-=-=-=-=-=-=-=-= 3 | 4 | Metamod-P already supports your Mod. 5 | 6 | -------------------------------------------------------------------------- 7 | -------------------------------------------------------------------------------- /doc/txt/maillist.txt: -------------------------------------------------------------------------------- 1 | Mailing lists 2 | =-=-=-=--=-=-= 3 | 4 | I've created a couple of lists on YahooGroups (formerly egroups (formerly 5 | onelist)): 6 | 7 | - metamod-announce (groups.yahoo.com/group/metamod-announce/) for 8 | announcements of new versions and plugins 9 | - metamod (groups.yahoo.com/group/metamod/) for questions, support, 10 | discussion, etc 11 | 12 | There are simple subscribe forms below. 13 | 14 | Subscribe to metamod-announce 15 | [enter email address ] 16 | groups.yahoo.com/metamod-announce Click here to join metamod-announce 17 | (groups.yahoo.com/group/ 18 | metamod-announce/) 19 | 20 | Subscribe to metamod 21 | [enter email address ] Click here to join metamod 22 | groups.yahoo.com/metamod (groups.yahoo.com/ 23 | group/metamod/) 24 | 25 | -------------------------------------------------------------------------- 26 | -------------------------------------------------------------------------------- /doc/txt/newapi_notes.txt: -------------------------------------------------------------------------------- 1 | HLSDK NEWAPI Notes 2 | =-=-=-=-=-=-=-=-=-= 3 | 4 | -------------------------------------------------------------------------- 5 | 6 | - OnFreeEntPrivateData 7 | - GameShutdown 8 | - ShouldCollide 9 | 10 | NOTE: No examples of these found in SDK... 11 | 12 | -------------------------------------------------------------------------- 13 | 14 | OnFreeEntPrivateData 15 | 16 | void OnFreeEntPrivateData(edict_t pEnt); 17 | 18 | from engine/eiface.h: 19 | 20 | Called right before the object's memory is freed. Calls its 21 | destructor. 22 | 23 | comments: 24 | 25 | See also Ken Birdwell on constructors, from the HLCoders list. 26 | Added in SDK 2.0. 27 | 28 | -------------------------------------------------------------------------- 29 | 30 | GameShutdown 31 | 32 | void GameShutdown(void); 33 | 34 | comments: 35 | 36 | Added in SDK 2.0. 37 | 38 | -------------------------------------------------------------------------- 39 | 40 | ShouldCollide 41 | 42 | int ShouldCollide(edict_t *pentTouched, edict_t *pentOther); 43 | 44 | from kenb@valvesoftware.com, via HLCoders: 45 | 46 | ..a hook that can override if any two entities should collide when 47 | they try to pass through each other. 48 | 49 | comments: 50 | 51 | Mugsy from DoD indicates that the return value for normal operation is 52 | 1. 53 | Added in SDK 2.0. 54 | 55 | -------------------------------------------------------------------------- 56 | -------------------------------------------------------------------------------- /doc/txt/release_notes.txt: -------------------------------------------------------------------------------- 1 | Release Notes 2 | =-=-=-=-=-=-= 3 | 4 | Major changes with Metamod 1.17 5 | =============================== 6 | 7 | - New cvar "metamod_version" that can be queried from client game 8 | browsers. 9 | 10 | - New console commands available to clients (much like the existing 11 | server console commands): 12 | 13 | - "meta version" prints out version information (date, compile type, 14 | etc). 15 | - "meta list" shows a list of the plugins running on the server 16 | (name, author, version, etc). 17 | 18 | - New file config.ini to provide a more reliable and flexible method of 19 | specifying configuration options. At the moment, the recognized 20 | options mirror those from +localinfo, ie: 21 | 22 | - debuglevel 23 | - gamedll 24 | - plugins_file 25 | - exec_cfg 26 | - autodetect 27 | - clientmeta 28 | 29 | Default path is "addons/metamod/config.ini" but can be overridden with 30 | "+localinfo mm_configfile". 31 | 32 | Also, new console command "meta config" to display this information. 33 | 34 | - New console command "meta require" to force the server to exit if the 35 | specified plugin isn't loaded/running. Intended for use in server.cfg 36 | or metaexec.cfg, to keep the server from starting up if desired 37 | plugins don't load. For example: 38 | 39 | - meta require adminmod 40 | - meta require 1 41 | 42 | The former requires that a plugin with the substring "adminmod" is 43 | found loaded and running. The latter requires that the plugin in slot 44 | 1 is loaded and running. 45 | 46 | - If an override gamedll is specified and found to be invalid or 47 | missing, Metamod will now exit with an appropriate error message, 48 | rather than just falling back to the auto-detected gamedll. This 49 | should provide more immediate and useful feedback, and help prevent 50 | some confusion. 51 | 52 | -------------------------------------------------------------------------- 53 | 54 | Incompatible changes with Metamod 1.13 55 | ====================================== 56 | 57 | - Config file metagame.ini is no longer supported. This file was 58 | deprecated in Metamod 1.08 (2001/06/16). Use instead the "+localinfo 59 | mm_gamedll" option. 60 | 61 | Major changes with Metamod 1.13 62 | =============================== 63 | 64 | - New config file names and locations, per the Addon Development 65 | Standard rev 1.00, developed on the hlds_apps list. 66 | 67 | Default config file locations are now: 68 | - $gamedir/addons/metamod/plugins.ini 69 | - $gamedir/addons/metamod/exec.cfg 70 | 71 | Previous config file locations are also supported for backwards 72 | compability: 73 | - $gamedir/metamod.ini 74 | - $gamedir/metaexec.cfg 75 | 76 | Note that the pathnames in plugins.ini are unchanged, and are still 77 | relative to the gamedir. 78 | 79 | -------------------------------------------------------------------------- 80 | -------------------------------------------------------------------------------- /doc/txt/supportedmods.txt: -------------------------------------------------------------------------------- 1 | Supported Mods/Games 2 | =-=-=-=-=-=-=-= 3 | 4 | Metamod includes support for the following mods, with version and last 5 | update if known. 6 | 7 | To get support added for a new Mod, or for an updated version of a Mod, 8 | see Adding game support. 9 | 10 | +------------------------------------------------------------------------+ 11 | | Name | Version | Last | Ent | Comments | 12 | | | | update | list | | 13 | |--------------------------------+----------+--------+--------+----------| 14 | | ALL MODS SUPPORTED BY | ALL | | NONE | | 15 | | All-Mod-Support PATCH | | | | | 16 | | By Jussi Kivilinna | | | | | 17 | | http://koti.mbnet.fi/axh/ | | | | | 18 | +------------------------------------------------------------------------+ 19 | -------------------------------------------------------------------------------- /doc/txt/trace.txt: -------------------------------------------------------------------------------- 1 | TraceAPI plugin 2 | =-=-=-=-=-=-=-= 3 | 4 | This was originally intended as a (more or less) complete example of a 5 | Metamod plugin. It catches _every_ call available to it (dll routines both 6 | before and after the game, as well as engine functions both before and 7 | after the engine). 8 | 9 | Because it catches every routine, I figured I'd give it the ability to log 10 | when given routines are called, so it became an "api tracing" plugin. :) 11 | 12 | This can actually be useful for tracking the operation of the HL engine, 13 | as well as that of a particular HL game mod. 14 | 15 | It recognizes the following server cvars: 16 | 17 | // Tracing debug levels; higher values log increasingly frequent routines. 18 | // Currently 0-50. See "api_info.cpp" for the debug levels of various 19 | // functions. 20 | 21 | // Trace level for dllapi routines. 22 | trace_dllapi 23 | 24 | // Trace level for "new" dllapi routines. 25 | trace_newapi 26 | 27 | // Trace level for engine functions. 28 | trace_engine 29 | 30 | // Enable unlimited trace logging. By default (as of v1.06), it only 31 | // logs _one_ trace message per second, to keep from overwhelming the 32 | // server. Set to "1" to enable unlimited logging. (Default "0") 33 | trace_unlimit 34 | 35 | // General debug level, independent of trace levels. Not currently used. 36 | trace_debug 37 | 38 | 39 | and the following server commands: 40 | 41 | // Enable tracing of a given routine, independent of "trace_*" level. 42 | // See the list of routine names in "api_info.cpp". Case is insignificant. 43 | trace set 44 | 45 | // Disable tracing of a given routine, iff previously enabled with "trace". 46 | // Doesn't affect routines being logged via "trace_*" level. 47 | trace unset 48 | 49 | // Show the routines being traced. 50 | trace show 51 | 52 | // List the various routines that can be traced. 53 | trace list dllapi 54 | trace list newapi 55 | trace list engine 56 | trace list all 57 | 58 | // Prints out version/date/etc. 59 | trace version 60 | 61 | Note the information it logs on each routine invocation is, at the moment, 62 | relatively minimal. I included information that seemed obvious (args for a 63 | ClientCommand, etc), and I've added info for other routines as I've come 64 | across a need. Most routines I still know too little about to log any 65 | particular information (CreateBaseline, etc). Feel free to add information 66 | that you're interested in to the log messages in the routines; the 67 | examples should be pretty self-explanatory. I'd be interested in knowing 68 | as well, for adding it to the distribution code. 69 | 70 | -------------------------------------------------------------------------- 71 | -------------------------------------------------------------------------------- /doc/txt/wdmisc.txt: -------------------------------------------------------------------------------- 1 | WDMisc plugin 2 | =-=-=-=-=-=-= 3 | 4 | This is a simple plugin that I use as a testbed for various features and 5 | other things I need to try from a plugin. 6 | 7 | It currently provides two features: 8 | 9 | 10 | - a cvar "bounce" that, if set to 1, will exit the server at map change. 11 | I use this when I need to shutdown or the server, and don't want to 12 | kill it in the middle of a map, nor watch the server constantly until 13 | the timelimit expires. 14 | 15 | - it prints a centersay to all the players whenever someone in 16 | Counter-Strike plants the bomb. This was done basically as a 17 | proof-of-concept for catching certain game-events that aren't 18 | otherwise triggered by the HL API. It works only by examining every 19 | log message that the server generates, and checking to see if it 20 | includes the string indicating the particular event in question (in 21 | this case "Planted_The_Bomb"). 22 | 23 | Although this works, it is really a rather POOR solution to the 24 | problem, as it assumes a LOT of string-compares, which can seriously 25 | degrade the performance of the server. I did try to take as many 26 | short-cuts as reasonable in the code, to decrease the amount of 27 | string-comparing going on, which makes the code a bit less readable 28 | than doing just a "strstr" on the log line. 29 | 30 | Other features to be added/removed in the future... 31 | 32 | -------------------------------------------------------------------------- 33 | -------------------------------------------------------------------------------- /hlsdk/common/beamdef.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined ( BEAMDEFH ) 16 | #define BEAMDEFH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | #define FBEAM_STARTENTITY 0x00000001 24 | #define FBEAM_ENDENTITY 0x00000002 25 | #define FBEAM_FADEIN 0x00000004 26 | #define FBEAM_FADEOUT 0x00000008 27 | #define FBEAM_SINENOISE 0x00000010 28 | #define FBEAM_SOLID 0x00000020 29 | #define FBEAM_SHADEIN 0x00000040 30 | #define FBEAM_SHADEOUT 0x00000080 31 | #define FBEAM_STARTVISIBLE 0x10000000 // Has this client actually seen this beam's start entity yet? 32 | #define FBEAM_ENDVISIBLE 0x20000000 // Has this client actually seen this beam's end entity yet? 33 | #define FBEAM_ISACTIVE 0x40000000 34 | #define FBEAM_FOREVER 0x80000000 35 | 36 | typedef struct beam_s BEAM; 37 | struct beam_s 38 | { 39 | BEAM *next; 40 | int type; 41 | int flags; 42 | vec3_t source; 43 | vec3_t target; 44 | vec3_t delta; 45 | float t; // 0 .. 1 over lifetime of beam 46 | float freq; 47 | float die; 48 | float width; 49 | float amplitude; 50 | float r, g, b; 51 | float brightness; 52 | float speed; 53 | float frameRate; 54 | float frame; 55 | int segments; 56 | int startEntity; 57 | int endEntity; 58 | int modelIndex; 59 | int frameCount; 60 | struct model_s *pFollowModel; 61 | struct particle_s *particles; 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /hlsdk/common/com_model.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/hlsdk/common/com_model.h -------------------------------------------------------------------------------- /hlsdk/common/con_nprint.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( CON_NPRINTH ) 16 | #define CON_NPRINTH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | typedef struct con_nprint_s 24 | { 25 | int index; // Row # 26 | float time_to_live; // # of seconds before it dissappears 27 | float color[ 3 ]; // RGB colors ( 0.0 -> 1.0 scale ) 28 | } con_nprint_t; 29 | 30 | void Con_NPrintf( int idx, char *fmt, ... ); 31 | void Con_NXPrintf( struct con_nprint_s *info, char *fmt, ... ); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /hlsdk/common/crc.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, 2000, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | /* crc.h */ 16 | #ifndef CRC_H 17 | #define CRC_H 18 | #ifdef _WIN32 19 | #ifndef __MINGW32__ 20 | #pragma once 21 | #endif /* not __MINGW32__ */ 22 | #endif 23 | 24 | // MD5 Hash 25 | typedef struct 26 | { 27 | unsigned int buf[4]; 28 | unsigned int bits[2]; 29 | unsigned char in[64]; 30 | } MD5Context_t; 31 | 32 | 33 | typedef unsigned long CRC32_t; 34 | void CRC32_Init(CRC32_t *pulCRC); 35 | CRC32_t CRC32_Final(CRC32_t pulCRC); 36 | void CRC32_ProcessBuffer(CRC32_t *pulCRC, void *p, int len); 37 | void CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch); 38 | int CRC_File(CRC32_t *crcvalue, char *pszFileName); 39 | 40 | unsigned char COM_BlockSequenceCRCByte (unsigned char *base, int length, int sequence); 41 | 42 | void MD5Init(MD5Context_t *context); 43 | void MD5Update(MD5Context_t *context, unsigned char const *buf, 44 | unsigned int len); 45 | void MD5Final(unsigned char digest[16], MD5Context_t *context); 46 | void Transform(unsigned int buf[4], unsigned int const in[16]); 47 | 48 | int MD5_Hash_File(unsigned char digest[16], char *pszFileName, int bUsefopen, int bSeed, unsigned int seed[4]); 49 | char *MD5_Print(unsigned char hash[16]); 50 | int MD5_Hash_CachedFile(unsigned char digest[16], unsigned char *pCache, int nFileSize, int bSeed, unsigned int seed[4]); 51 | 52 | int CRC_MapFile(CRC32_t *crcvalue, char *pszFileName); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /hlsdk/common/cvardef.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, 2000, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef CVARDEF_H 16 | #define CVARDEF_H 17 | 18 | #define FCVAR_ARCHIVE (1<<0) // set to cause it to be saved to vars.rc 19 | #define FCVAR_USERINFO (1<<1) // changes the client's info string 20 | #define FCVAR_SERVER (1<<2) // notifies players when changed 21 | #define FCVAR_EXTDLL (1<<3) // defined by external DLL 22 | #define FCVAR_CLIENTDLL (1<<4) // defined by the client dll 23 | #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 24 | #define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server. 25 | #define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ). 26 | #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 27 | 28 | typedef struct cvar_s 29 | { 30 | char *name; 31 | char *string; 32 | int flags; 33 | float value; 34 | struct cvar_s *next; 35 | } cvar_t; 36 | #endif 37 | -------------------------------------------------------------------------------- /hlsdk/common/demo_api.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined ( DEMO_APIH ) 16 | #define DEMO_APIH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | typedef struct demo_api_s 24 | { 25 | int ( *IsRecording ) ( void ); 26 | int ( *IsPlayingback ) ( void ); 27 | int ( *IsTimeDemo ) ( void ); 28 | void ( *WriteBuffer ) ( int size, unsigned char *buffer ); 29 | } demo_api_t; 30 | 31 | extern demo_api_t demoapi; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /hlsdk/common/director_cmds.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/hlsdk/common/director_cmds.h -------------------------------------------------------------------------------- /hlsdk/common/dlight.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined ( DLIGHTH ) 16 | #define DLIGHTH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | typedef struct dlight_s 24 | { 25 | vec3_t origin; 26 | float radius; 27 | color24 color; 28 | float die; // stop lighting after this time 29 | float decay; // drop this each second 30 | float minlight; // don't add when contributing less 31 | int key; 32 | qboolean dark; // subtracts light instead of adding 33 | } dlight_t; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /hlsdk/common/dll_state.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/hlsdk/common/dll_state.h -------------------------------------------------------------------------------- /hlsdk/common/engine_launcher_api.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/hlsdk/common/engine_launcher_api.h -------------------------------------------------------------------------------- /hlsdk/common/entity_types.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // entity_types.h 16 | #if !defined( ENTITY_TYPESH ) 17 | #define ENTITY_TYPESH 18 | 19 | #define ET_NORMAL 0 20 | #define ET_PLAYER 1 21 | #define ET_TEMPENTITY 2 22 | #define ET_BEAM 3 23 | // BMODEL or SPRITE that was split across BSP nodes 24 | #define ET_FRAGMENTED 4 25 | 26 | #endif // !ENTITY_TYPESH 27 | -------------------------------------------------------------------------------- /hlsdk/common/event_api.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined ( EVENT_APIH ) 16 | #define EVENT_APIH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | #define EVENT_API_VERSION 1 24 | 25 | typedef struct event_api_s 26 | { 27 | int version; 28 | void ( *EV_PlaySound ) ( int ent, float *origin, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch ); 29 | void ( *EV_StopSound ) ( int ent, int channel, const char *sample ); 30 | int ( *EV_FindModelIndex )( const char *pmodel ); 31 | int ( *EV_IsLocal ) ( int playernum ); 32 | int ( *EV_LocalPlayerDucking ) ( void ); 33 | void ( *EV_LocalPlayerViewheight ) ( float * ); 34 | void ( *EV_LocalPlayerBounds ) ( int hull, float *mins, float *maxs ); 35 | int ( *EV_IndexFromTrace) ( struct pmtrace_s *pTrace ); 36 | struct physent_s *( *EV_GetPhysent ) ( int idx ); 37 | void ( *EV_SetUpPlayerPrediction ) ( int dopred, int bIncludeLocalClient ); 38 | void ( *EV_PushPMStates ) ( void ); 39 | void ( *EV_PopPMStates ) ( void ); 40 | void ( *EV_SetSolidPlayers ) (int playernum); 41 | void ( *EV_SetTraceHull ) ( int hull ); 42 | void ( *EV_PlayerTrace ) ( float *start, float *end, int traceFlags, int ignore_pe, struct pmtrace_s *tr ); 43 | void ( *EV_WeaponAnimation ) ( int sequence, int body ); 44 | unsigned short ( *EV_PrecacheEvent ) ( int type, const char* psz ); 45 | 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 ); 46 | const char *( *EV_TraceTexture ) ( int ground, float *vstart, float *vend ); 47 | void ( *EV_StopAllSounds ) ( int entnum, int entchannel ); 48 | void ( *EV_KillEvents ) ( int entnum, const char *eventname ); 49 | } event_api_t; 50 | 51 | extern event_api_t eventapi; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /hlsdk/common/event_args.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( EVENT_ARGSH ) 16 | #define EVENT_ARGSH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | // Event was invoked with stated origin 24 | #define FEVENT_ORIGIN ( 1<<0 ) 25 | 26 | // Event was invoked with stated angles 27 | #define FEVENT_ANGLES ( 1<<1 ) 28 | 29 | typedef struct event_args_s 30 | { 31 | int flags; 32 | 33 | // Transmitted 34 | int entindex; 35 | 36 | float origin[3]; 37 | float angles[3]; 38 | float velocity[3]; 39 | 40 | int ducking; 41 | 42 | float fparam1; 43 | float fparam2; 44 | 45 | int iparam1; 46 | int iparam2; 47 | 48 | int bparam1; 49 | int bparam2; 50 | } event_args_t; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /hlsdk/common/event_flags.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, 2000, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( EVENT_FLAGSH ) 16 | #define EVENT_FLAGSH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | // Skip local host for event send. 24 | #define FEV_NOTHOST (1<<0) 25 | 26 | // Send the event reliably. You must specify the origin and angles and use 27 | // PLAYBACK_EVENT_FULL for this to work correctly on the server for anything 28 | // that depends on the event origin/angles. I.e., the origin/angles are not 29 | // taken from the invoking edict for reliable events. 30 | #define FEV_RELIABLE (1<<1) 31 | 32 | // Don't restrict to PAS/PVS, send this event to _everybody_ on the server ( useful for stopping CHAN_STATIC 33 | // sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ). 34 | #define FEV_GLOBAL (1<<2) 35 | 36 | // If this client already has one of these events in its queue, just update the event instead of sending it as a duplicate 37 | // 38 | #define FEV_UPDATE (1<<3) 39 | 40 | // Only send to entity specified as the invoker 41 | #define FEV_HOSTONLY (1<<4) 42 | 43 | // Only send if the event was created on the server. 44 | #define FEV_SERVER (1<<5) 45 | 46 | // Only issue event client side ( from shared code ) 47 | #define FEV_CLIENT (1<<6) 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /hlsdk/common/exefuncs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/hlsdk/common/exefuncs.h -------------------------------------------------------------------------------- /hlsdk/common/hltv.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/hlsdk/common/hltv.h -------------------------------------------------------------------------------- /hlsdk/common/in_buttons.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, 2000, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef IN_BUTTONS_H 16 | #define IN_BUTTONS_H 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | #define IN_ATTACK (1 << 0) 24 | #define IN_JUMP (1 << 1) 25 | #define IN_DUCK (1 << 2) 26 | #define IN_FORWARD (1 << 3) 27 | #define IN_BACK (1 << 4) 28 | #define IN_USE (1 << 5) 29 | #define IN_CANCEL (1 << 6) 30 | #define IN_LEFT (1 << 7) 31 | #define IN_RIGHT (1 << 8) 32 | #define IN_MOVELEFT (1 << 9) 33 | #define IN_MOVERIGHT (1 << 10) 34 | #define IN_ATTACK2 (1 << 11) 35 | #define IN_RUN (1 << 12) 36 | #define IN_RELOAD (1 << 13) 37 | #define IN_ALT1 (1 << 14) 38 | #define IN_SCORE (1 << 15) // Used by client.dll for when scoreboard is held down 39 | 40 | #endif // IN_BUTTONS_H 41 | -------------------------------------------------------------------------------- /hlsdk/common/interface.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/hlsdk/common/interface.h -------------------------------------------------------------------------------- /hlsdk/common/ivoicetweak.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/hlsdk/common/ivoicetweak.h -------------------------------------------------------------------------------- /hlsdk/common/net_api.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/hlsdk/common/net_api.h -------------------------------------------------------------------------------- /hlsdk/common/netadr.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // netadr.h 16 | #ifndef NETADR_H 17 | #define NETADR_H 18 | #ifdef _WIN32 19 | #ifndef __MINGW32__ 20 | #pragma once 21 | #endif /* not __MINGW32__ */ 22 | #endif 23 | 24 | typedef enum 25 | { 26 | NA_UNUSED, 27 | NA_LOOPBACK, 28 | NA_BROADCAST, 29 | NA_IP, 30 | NA_IPX, 31 | NA_BROADCAST_IPX, 32 | } netadrtype_t; 33 | 34 | typedef struct netadr_s 35 | { 36 | netadrtype_t type; 37 | unsigned char ip[4]; 38 | unsigned char ipx[10]; 39 | unsigned short port; 40 | } netadr_t; 41 | 42 | #endif // NETADR_H 43 | -------------------------------------------------------------------------------- /hlsdk/common/nowin.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/hlsdk/common/nowin.h -------------------------------------------------------------------------------- /hlsdk/common/particledef.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( PARTICLEDEFH ) 16 | #define PARTICLEDEFH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | typedef enum { 24 | pt_static, 25 | pt_grav, 26 | pt_slowgrav, 27 | pt_fire, 28 | pt_explode, 29 | pt_explode2, 30 | pt_blob, 31 | pt_blob2, 32 | pt_vox_slowgrav, 33 | pt_vox_grav, 34 | pt_clientcustom // Must have callback function specified 35 | } ptype_t; 36 | 37 | // !!! if this is changed, it must be changed in d_ifacea.h too !!! 38 | typedef struct particle_s 39 | { 40 | // driver-usable fields 41 | vec3_t org; 42 | short color; 43 | short packedColor; 44 | // drivers never touch the following fields 45 | struct particle_s *next; 46 | vec3_t vel; 47 | float ramp; 48 | float die; 49 | ptype_t type; 50 | void (*deathfunc)( struct particle_s *particle ); 51 | 52 | // for pt_clientcusttom, we'll call this function each frame 53 | void (*callback)( struct particle_s *particle, float frametime ); 54 | 55 | // For deathfunc, etc. 56 | unsigned char context; 57 | } particle_t; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /hlsdk/common/pmtrace.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( PMTRACEH ) 16 | #define PMTRACEH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | typedef struct 24 | { 25 | vec3_t normal; 26 | float dist; 27 | } pmplane_t; 28 | 29 | typedef struct pmtrace_s pmtrace_t; 30 | 31 | struct pmtrace_s 32 | { 33 | qboolean allsolid; // if true, plane is not valid 34 | qboolean startsolid; // if true, the initial point was in a solid area 35 | qboolean inopen, inwater; // End point is in empty space or in water 36 | float fraction; // time completed, 1.0 = didn't hit anything 37 | vec3_t endpos; // final position 38 | pmplane_t plane; // surface normal at impact 39 | int ent; // entity at impact 40 | vec3_t deltavelocity; // Change in player's velocity caused by impact. 41 | // Only run on server. 42 | int hitgroup; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /hlsdk/common/qfont.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( QFONTH ) 16 | #define QFONTH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | // Font stuff 24 | 25 | #define NUM_GLYPHS 256 26 | 27 | typedef struct 28 | { 29 | short startoffset; 30 | short charwidth; 31 | } charinfo; 32 | 33 | typedef struct qfont_s 34 | { 35 | int width, height; 36 | int rowcount; 37 | int rowheight; 38 | charinfo fontinfo[ NUM_GLYPHS ]; 39 | byte data[4]; 40 | } qfont_t; 41 | 42 | #endif // qfont.h 43 | -------------------------------------------------------------------------------- /hlsdk/common/r_studioint.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/hlsdk/common/r_studioint.h -------------------------------------------------------------------------------- /hlsdk/common/ref_params.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( REF_PARAMSH ) 16 | #define REF_PARAMSH 17 | 18 | typedef struct ref_params_s 19 | { 20 | // Output 21 | float vieworg[3]; 22 | float viewangles[3]; 23 | 24 | float forward[3]; 25 | float right[3]; 26 | float up[3]; 27 | 28 | // Client frametime; 29 | float frametime; 30 | // Client time 31 | float time; 32 | 33 | // Misc 34 | int intermission; 35 | int paused; 36 | int spectator; 37 | int onground; 38 | int waterlevel; 39 | 40 | float simvel[3]; 41 | float simorg[3]; 42 | 43 | float viewheight[3]; 44 | float idealpitch; 45 | 46 | float cl_viewangles[3]; 47 | 48 | int health; 49 | float crosshairangle[3]; 50 | float viewsize; 51 | 52 | float punchangle[3]; 53 | int maxclients; 54 | int viewentity; 55 | int playernum; 56 | int max_entities; 57 | int demoplayback; 58 | int hardware; 59 | 60 | int smoothing; 61 | 62 | // Last issued usercmd 63 | struct usercmd_s *cmd; 64 | 65 | // Movevars 66 | struct movevars_s *movevars; 67 | 68 | int viewport[4]; // the viewport coordinates x ,y , width, height 69 | 70 | int nextView; // the renderer calls ClientDLL_CalcRefdef() and Renderview 71 | // so long in cycles until this value is 0 (multiple views) 72 | int onlyClientDraw; // if !=0 nothing is drawn by the engine except clientDraw functions 73 | } ref_params_t; 74 | 75 | #endif // !REF_PARAMSH 76 | -------------------------------------------------------------------------------- /hlsdk/common/screenfade.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/hlsdk/common/screenfade.h -------------------------------------------------------------------------------- /hlsdk/common/studio_event.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, 2000, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( STUDIO_EVENTH ) 16 | #define STUDIO_EVENTH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | typedef struct mstudioevent_s 24 | { 25 | int frame; 26 | int event; 27 | int type; 28 | char options[64]; 29 | } mstudioevent_t; 30 | 31 | #endif // STUDIO_EVENTH 32 | -------------------------------------------------------------------------------- /hlsdk/common/triangleapi.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( TRIANGLEAPIH ) 16 | #define TRIANGLEAPIH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | typedef enum 24 | { 25 | TRI_FRONT = 0, 26 | TRI_NONE = 1, 27 | } TRICULLSTYLE; 28 | 29 | #define TRI_API_VERSION 1 30 | 31 | #define TRI_TRIANGLES 0 32 | #define TRI_TRIANGLE_FAN 1 33 | #define TRI_QUADS 2 34 | #define TRI_POLYGON 3 35 | #define TRI_LINES 4 36 | #define TRI_TRIANGLE_STRIP 5 37 | #define TRI_QUAD_STRIP 6 38 | 39 | typedef struct triangleapi_s 40 | { 41 | int version; 42 | 43 | void ( *RenderMode )( int mode ); 44 | void ( *Begin )( int primitiveCode ); 45 | void ( *End ) ( void ); 46 | 47 | void ( *Color4f ) ( float r, float g, float b, float a ); 48 | void ( *Color4ub ) ( unsigned char r, unsigned char g, unsigned char b, unsigned char a ); 49 | void ( *TexCoord2f ) ( float u, float v ); 50 | void ( *Vertex3fv ) ( float *worldPnt ); 51 | void ( *Vertex3f ) ( float x, float y, float z ); 52 | void ( *Brightness ) ( float brightness ); 53 | void ( *CullFace ) ( TRICULLSTYLE style ); 54 | int ( *SpriteTexture ) ( struct model_s *pSpriteModel, int frame ); 55 | int ( *WorldToScreen ) ( float *world, float *screen ); // Returns 1 if it's z clipped 56 | void ( *Fog ) ( float flFogColor[3], float flStart, float flEnd, int bOn ); //Works just like GL_FOG, flFogColor is r/g/b. 57 | void ( *ScreenToWorld ) ( float *screen, float *world ); 58 | 59 | } triangleapi_t; 60 | 61 | #endif // !TRIANGLEAPIH 62 | -------------------------------------------------------------------------------- /hlsdk/common/usercmd.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef USERCMD_H 16 | #define USERCMD_H 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | typedef struct usercmd_s 24 | { 25 | short lerp_msec; // Interpolation time on client 26 | byte msec; // Duration in ms of command 27 | vec3_t viewangles; // Command view angles. 28 | 29 | // intended velocities 30 | float forwardmove; // Forward velocity. 31 | float sidemove; // Sideways velocity. 32 | float upmove; // Upward velocity. 33 | byte lightlevel; // Light level at spot where we are standing. 34 | unsigned short buttons; // Attack buttons 35 | byte impulse; // Impulse command issued. 36 | byte weaponselect; // Current weapon id 37 | 38 | // Experimental player impact stuff. 39 | int impact_index; 40 | vec3_t impact_position; 41 | } usercmd_t; 42 | 43 | #endif // USERCMD_H 44 | -------------------------------------------------------------------------------- /hlsdk/common/weaponinfo.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, 2000, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined ( WEAPONINFOH ) 16 | #define WEAPONINFOH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | // Info about weapons player might have in his/her possession 24 | typedef struct weapon_data_s 25 | { 26 | int m_iId; 27 | int m_iClip; 28 | 29 | float m_flNextPrimaryAttack; 30 | float m_flNextSecondaryAttack; 31 | float m_flTimeWeaponIdle; 32 | 33 | int m_fInReload; 34 | int m_fInSpecialReload; 35 | float m_flNextReload; 36 | float m_flPumpTime; 37 | float m_fReloadTime; 38 | 39 | float m_fAimedDamage; 40 | float m_fNextAimBonus; 41 | int m_fInZoom; 42 | int m_iWeaponState; 43 | 44 | int iuser1; 45 | int iuser2; 46 | int iuser3; 47 | int iuser4; 48 | float fuser1; 49 | float fuser2; 50 | float fuser3; 51 | float fuser4; 52 | } weapon_data_t; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /hlsdk/dlls/cdll_dll.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // 16 | // cdll_dll.h 17 | 18 | // this file is included by both the game-dll and the client-dll, 19 | 20 | #ifndef CDLL_DLL_H 21 | #define CDLL_DLL_H 22 | 23 | #define MAX_WEAPONS 32 // ??? 24 | 25 | #define MAX_WEAPON_SLOTS 5 // hud item selection slots 26 | #define MAX_ITEM_TYPES 6 // hud item selection slots 27 | 28 | #define MAX_ITEMS 5 // hard coded item types 29 | 30 | #define HIDEHUD_WEAPONS ( 1<<0 ) 31 | #define HIDEHUD_FLASHLIGHT ( 1<<1 ) 32 | #define HIDEHUD_ALL ( 1<<2 ) 33 | #define HIDEHUD_HEALTH ( 1<<3 ) 34 | 35 | #define MAX_AMMO_TYPES 32 // ??? 36 | #define MAX_AMMO_SLOTS 32 // not really slots 37 | 38 | #define HUD_PRINTNOTIFY 1 39 | #define HUD_PRINTCONSOLE 2 40 | #define HUD_PRINTTALK 3 41 | #define HUD_PRINTCENTER 4 42 | 43 | 44 | #define WEAPON_SUIT 31 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /hlsdk/dlls/extdll.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef EXTDLL_H 16 | #define EXTDLL_H 17 | 18 | 19 | // 20 | // Global header file for extension DLLs 21 | // 22 | 23 | // Allow "DEBUG" in addition to default "_DEBUG" 24 | #ifdef _DEBUG 25 | #define DEBUG 1 26 | #endif 27 | 28 | 29 | 30 | // Prevent tons of unused windows definitions 31 | #ifdef _WIN32 32 | #define WIN32_LEAN_AND_MEAN 33 | #define NOWINRES 34 | #define NOSERVICE 35 | #define NOMCX 36 | #define NOIME 37 | #include "windows.h" 38 | #else // _WIN32 39 | #define FALSE 0 40 | #define TRUE (!FALSE) 41 | typedef unsigned int ULONG; 42 | typedef unsigned char BYTE; 43 | typedef int BOOL; 44 | #define MAX_PATH PATH_MAX 45 | #include 46 | #include 47 | #ifndef min 48 | #define min(a,b) (((a) < (b)) ? (a) : (b)) 49 | #endif 50 | #ifndef max 51 | #define max(a,b) (((a) > (b)) ? (a) : (b)) 52 | #define _vsnprintf(a,b,c,d) vsnprintf(a,b,c,d) 53 | #endif 54 | #endif //_WIN32 55 | 56 | // Misc C-runtime library headers 57 | #include "stdio.h" 58 | #include "stdlib.h" 59 | #include "math.h" 60 | 61 | // Header file containing definition of globalvars_t and entvars_t 62 | typedef int func_t; // 63 | typedef int string_t; // from engine's pr_comp.h; 64 | typedef float vec_t; // needed before including progdefs.h 65 | 66 | // Vector class 67 | #include "vector.h" 68 | 69 | // Defining it as a (bogus) struct helps enforce type-checking 70 | #define vec3_t Vector 71 | 72 | // Shared engine/DLL constants 73 | #include "const.h" 74 | #include "progdefs.h" 75 | #include "edict.h" 76 | 77 | // Shared header describing protocol between engine and DLLs 78 | #include "eiface.h" 79 | 80 | // Shared header between the client DLL and the game DLLs 81 | #include "cdll_dll.h" 82 | 83 | #endif //EXTDLL_H 84 | -------------------------------------------------------------------------------- /hlsdk/engine/archtypes.h: -------------------------------------------------------------------------------- 1 | // 2 | // Word size dependent definitions 3 | // DAL 1/03 4 | // 5 | #ifndef ARCHTYPES_H 6 | #define ARCHTYPES_H 7 | 8 | #ifdef __x86_64__ 9 | #define X64BITS 10 | #endif 11 | 12 | #if defined( _WIN32 ) && (! defined( __MINGW32__ )) 13 | 14 | typedef __int16 int16; 15 | typedef unsigned __int16 uint16; 16 | typedef __int32 int32; 17 | typedef unsigned __int32 uint32; 18 | typedef __int64 int64; 19 | typedef unsigned __int64 uint64; 20 | typedef __int32 intp; // intp is an integer that can accomodate a pointer 21 | typedef unsigned __int32 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *) 22 | 23 | #else /* _WIN32 */ 24 | 25 | typedef short int16; 26 | typedef unsigned short uint16; 27 | typedef int int32; 28 | typedef unsigned int uint32; 29 | typedef long long int64; 30 | typedef unsigned long long uint64; 31 | #ifdef X64BITS 32 | typedef long long intp; 33 | typedef unsigned long long uintp; 34 | #else 35 | typedef int intp; 36 | typedef unsigned int uintp; 37 | #endif 38 | 39 | #endif /* else _WIN32 */ 40 | 41 | #endif /* ARCHTYPES_H */ 42 | -------------------------------------------------------------------------------- /hlsdk/engine/customentity.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef CUSTOMENTITY_H 16 | #define CUSTOMENTITY_H 17 | 18 | // Custom Entities 19 | 20 | // Start/End Entity is encoded as 12 bits of entity index, and 4 bits of attachment (4:12) 21 | #define BEAMENT_ENTITY(x) ((x)&0xFFF) 22 | #define BEAMENT_ATTACHMENT(x) (((x)>>12)&0xF) 23 | 24 | // Beam types, encoded as a byte 25 | enum 26 | { 27 | BEAM_POINTS = 0, 28 | BEAM_ENTPOINT, 29 | BEAM_ENTS, 30 | BEAM_HOSE, 31 | }; 32 | 33 | #define BEAM_FSINE 0x10 34 | #define BEAM_FSOLID 0x20 35 | #define BEAM_FSHADEIN 0x40 36 | #define BEAM_FSHADEOUT 0x80 37 | 38 | #endif //CUSTOMENTITY_H 39 | -------------------------------------------------------------------------------- /hlsdk/engine/edict.h: -------------------------------------------------------------------------------- 1 | #if !defined EDICT_H 2 | #define EDICT_H 3 | #ifdef _WIN32 4 | #ifndef __MINGW32__ 5 | #pragma once 6 | #endif /* not __MINGW32__ */ 7 | #endif 8 | #define MAX_ENT_LEAFS 48 9 | 10 | #include "progdefs.h" 11 | 12 | struct edict_s 13 | { 14 | qboolean free; 15 | int serialnumber; 16 | link_t area; // linked to a division node or leaf 17 | 18 | int headnode; // -1 to use normal leaf check 19 | int num_leafs; 20 | short leafnums[MAX_ENT_LEAFS]; 21 | 22 | float freetime; // sv.time when the object was freed 23 | 24 | void* pvPrivateData; // Alloced and freed by engine, used by DLLs 25 | 26 | entvars_t v; // C exported fields from progs 27 | 28 | // other fields from progs come immediately after 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /hlsdk/engine/keydefs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/hlsdk/engine/keydefs.h -------------------------------------------------------------------------------- /hlsdk/engine/progs.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef PROGS_H 16 | #define PROGS_H 17 | 18 | #include "progdefs.h" 19 | 20 | // 16 simultaneous events, max 21 | #define MAX_EVENT_QUEUE 64 22 | 23 | #define DEFAULT_EVENT_RESENDS 1 24 | 25 | #include "event_flags.h" 26 | 27 | typedef struct event_info_s event_info_t; 28 | 29 | #include "event_args.h" 30 | 31 | struct event_info_s 32 | { 33 | unsigned short index; // 0 implies not in use 34 | 35 | short packet_index; // Use data from state info for entity in delta_packet . -1 implies separate info based on event 36 | // parameter signature 37 | short entity_index; // The edict this event is associated with 38 | 39 | float fire_time; // if non-zero, the time when the event should be fired ( fixed up on the client ) 40 | 41 | event_args_t args; 42 | 43 | // CLIENT ONLY 44 | int flags; // Reliable or not, etc. 45 | 46 | }; 47 | 48 | typedef struct event_state_s event_state_t; 49 | 50 | struct event_state_s 51 | { 52 | struct event_info_s ei[ MAX_EVENT_QUEUE ]; 53 | }; 54 | 55 | #if !defined( ENTITY_STATEH ) 56 | #include "entity_state.h" 57 | #endif 58 | 59 | #if !defined( EDICT_H ) 60 | #include "edict.h" 61 | #endif 62 | 63 | #define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0)->m))) 64 | #define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area) 65 | 66 | //============================================================================ 67 | 68 | extern char *pr_strings; 69 | extern globalvars_t gGlobalVariables; 70 | 71 | //============================================================================ 72 | 73 | edict_t *ED_Alloc (void); 74 | void ED_Free (edict_t *ed); 75 | void ED_LoadFromFile (char *data); 76 | 77 | edict_t *EDICT_NUM(int n); 78 | int NUM_FOR_EDICT(const edict_t *e); 79 | 80 | #define PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + e)) 81 | 82 | #endif // PROGS_H 83 | -------------------------------------------------------------------------------- /hlsdk/engine/shake.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef SHAKE_H 16 | #define SHAKE_H 17 | 18 | // Screen / View effects 19 | 20 | // screen shake 21 | extern int gmsgShake; 22 | 23 | // This structure is sent over the net to describe a screen shake event 24 | typedef struct 25 | { 26 | unsigned short amplitude; // FIXED 4.12 amount of shake 27 | unsigned short duration; // FIXED 4.12 seconds duration 28 | unsigned short frequency; // FIXED 8.8 noise frequency (low frequency is a jerk,high frequency is a rumble) 29 | } ScreenShake; 30 | 31 | extern void V_ApplyShake( float *origin, float *angles, float factor ); 32 | extern void V_CalcShake( void ); 33 | extern int V_ScreenShake( const char *pszName, int iSize, void *pbuf ); 34 | extern int V_ScreenFade( const char *pszName, int iSize, void *pbuf ); 35 | 36 | 37 | // Fade in/out 38 | extern int gmsgFade; 39 | 40 | #define FFADE_IN 0x0000 // Just here so we don't pass 0 into the function 41 | #define FFADE_OUT 0x0001 // Fade out (not in) 42 | #define FFADE_MODULATE 0x0002 // Modulate (don't blend) 43 | #define FFADE_STAYOUT 0x0004 // ignores the duration, stays faded out until new ScreenFade message received 44 | 45 | // This structure is sent over the net to describe a screen fade event 46 | typedef struct 47 | { 48 | unsigned short duration; // FIXED 4.12 seconds duration 49 | unsigned short holdTime; // FIXED 4.12 seconds duration until reset (fade & hold) 50 | short fadeFlags; // flags 51 | byte r, g, b, a; // fade to color ( max alpha ) 52 | } ScreenFade; 53 | 54 | #endif // SHAKE_H 55 | 56 | -------------------------------------------------------------------------------- /hlsdk/hlsdk_readme.txt: -------------------------------------------------------------------------------- 1 | This HLSDK is without CBaseEntity and other gamedll internal headers. 2 | Mainly for metamod-p and plugin compiles. -------------------------------------------------------------------------------- /hlsdk/pm_shared/pm_debug.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef PM_DEBUG_H 16 | #define PM_DEBUG_H 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | void PM_ViewEntity( void ); 24 | void PM_DrawBBox(vec3_t mins, vec3_t maxs, vec3_t origin, int pcolor, float life); 25 | void PM_ParticleLine(vec3_t start, vec3_t end, int pcolor, float life, float vert); 26 | void PM_ShowClipBox( void ); 27 | 28 | #endif // PMOVEDBG_H 29 | -------------------------------------------------------------------------------- /hlsdk/pm_shared/pm_info.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, 2000, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // Physics info string definition 16 | #if !defined( PM_INFOH ) 17 | #define PM_INFOH 18 | #ifdef _WIN32 19 | #ifndef __MINGW32__ 20 | #pragma once 21 | #endif /* not __MINGW32__ */ 22 | #endif 23 | 24 | #define MAX_PHYSINFO_STRING 256 25 | 26 | #endif // PM_INFOH 27 | -------------------------------------------------------------------------------- /hlsdk/pm_shared/pm_materials.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( PM_MATERIALSH ) 16 | #define PM_MATERIALSH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | #define CBTEXTURENAMEMAX 13 // only load first n chars of name 24 | 25 | #define CHAR_TEX_CONCRETE 'C' // texture types 26 | #define CHAR_TEX_METAL 'M' 27 | #define CHAR_TEX_DIRT 'D' 28 | #define CHAR_TEX_VENT 'V' 29 | #define CHAR_TEX_GRATE 'G' 30 | #define CHAR_TEX_TILE 'T' 31 | #define CHAR_TEX_SLOSH 'S' 32 | #define CHAR_TEX_WOOD 'W' 33 | #define CHAR_TEX_COMPUTER 'P' 34 | #define CHAR_TEX_GLASS 'Y' 35 | #define CHAR_TEX_FLESH 'F' 36 | 37 | #endif // !PM_MATERIALSH 38 | -------------------------------------------------------------------------------- /hlsdk/pm_shared/pm_movevars.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/hlsdk/pm_shared/pm_movevars.h -------------------------------------------------------------------------------- /hlsdk/pm_shared/pm_shared.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | // 17 | // pm_shared.h 18 | // 19 | #if !defined( PM_SHAREDH ) 20 | #define PM_SHAREDH 21 | #ifdef _WIN32 22 | #ifndef __MINGW32__ 23 | #pragma once 24 | #endif /* not __MINGW32__ */ 25 | #endif 26 | 27 | void PM_Init( struct playermove_s *ppmove ); 28 | void PM_Move ( struct playermove_s *ppmove, int server ); 29 | char PM_FindTextureType( char *name ); 30 | 31 | // Spectator Movement modes (stored in pev->iuser1, so the physics code can get at them) 32 | #define OBS_NONE 0 33 | #define OBS_CHASE_LOCKED 1 34 | #define OBS_CHASE_FREE 2 35 | #define OBS_ROAMING 3 36 | #define OBS_IN_EYE 4 37 | #define OBS_MAP_FREE 5 38 | #define OBS_MAP_CHASE 6 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /metamod/.gitignore: -------------------------------------------------------------------------------- 1 | msgs/ 2 | opt.*/ 3 | debug.*/ 4 | -------------------------------------------------------------------------------- /metamod/Config.mak: -------------------------------------------------------------------------------- 1 | MODNAME = metamod 2 | 3 | #__METAMOD_BUILD__ for our special eiface.h 4 | EXTRA_CFLAGS += -D__METAMOD_BUILD__ 5 | #-DMETA_PERFMON 6 | 7 | SRCFILES = api_hook.cpp api_info.cpp commands_meta.cpp conf_meta.cpp \ 8 | dllapi.cpp engine_api.cpp engineinfo.cpp game_support.cpp \ 9 | game_autodetect.cpp h_export.cpp linkgame.cpp linkplug.cpp \ 10 | log_meta.cpp meta_eiface.cpp metamod.cpp mlist.cpp mplayer.cpp \ 11 | mplugin.cpp mqueue.cpp mreg.cpp mutil.cpp osdep.cpp \ 12 | osdep_p.cpp reg_support.cpp sdk_util.cpp studioapi.cpp \ 13 | support_meta.cpp thread_logparse.cpp vdate.cpp 14 | 15 | INFOFILES = info_name.h vers_meta.h 16 | RESFILE = res_meta.rc 17 | 18 | ifeq "$(OS)" "linux" 19 | SRCFILES+=osdep_linkent_linux.cpp osdep_detect_gamedll_linux.cpp 20 | EXTRA_LINK+= 21 | else 22 | SRCFILES+=osdep_linkent_win32.cpp osdep_detect_gamedll_win32.cpp 23 | EXTRA_LINK+=-Xlinker --script -Xlinker i386pe.merge 24 | endif 25 | 26 | ifeq "$(OPT)" "opt" 27 | EXTRA_CFLAGS += -D__INTERNALS_USE_REGPARAMS__ 28 | endif 29 | 30 | ifeq "$(OPT)" "opt-fast" 31 | EXTRA_CFLAGS += -D__INTERNALS_USE_REGPARAMS__ 32 | endif 33 | 34 | #STLFILES = mreg.cpp 35 | -------------------------------------------------------------------------------- /metamod/build_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | make HOST=cygwin TARGET=win32 OPT=opt 4 | make HOST=cygwin OPT=opt 5 | make HOST=cygwin TARGET=amd64 OPT=opt 6 | -------------------------------------------------------------------------------- /metamod/commands_meta.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // commands_meta.h - prototypes for console commands 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef COMMANDS_META_H 38 | #define COMMANDS_META_H 39 | 40 | #include "types_meta.h" // mBOOL 41 | #include "comp_dep.h" 42 | 43 | // Flags to use for meta_cmd_doplug(), to operate on existing plugins; note 44 | // "load" operates on a non-existing plugin thus isn't included here. 45 | typedef enum { 46 | PC_NULL = 0, 47 | PC_PAUSE, // pause the plugin 48 | PC_UNPAUSE, // unpause the plugin 49 | PC_UNLOAD, // unload the plugin 50 | PC_RELOAD, // unload the plugin and load it again 51 | PC_RETRY, // retry a failed operation (usually load/attach) 52 | PC_INFO, // show all info about the plugin 53 | PC_CLEAR, // remove a failed plugin from the list 54 | PC_FORCE_UNLOAD, // forcibly unload the plugin 55 | PC_REQUIRE, // require that this plugin is loaded/running 56 | } PLUG_CMD; 57 | 58 | void DLLINTERNAL meta_register_cmdcvar(); 59 | 60 | void DLLHIDDEN svr_meta(void); // only hidden because called from outside! 61 | 62 | void DLLINTERNAL cmd_meta_usage(void); 63 | void DLLINTERNAL cmd_meta_version(void); 64 | void DLLINTERNAL cmd_meta_gpl(void); 65 | 66 | void DLLINTERNAL cmd_meta_game(void); 67 | void DLLINTERNAL cmd_meta_refresh(void); 68 | void DLLINTERNAL cmd_meta_load(void); 69 | 70 | void DLLINTERNAL cmd_meta_pluginlist(void); 71 | void DLLINTERNAL cmd_meta_cmdlist(void); 72 | void DLLINTERNAL cmd_meta_cvarlist(void); 73 | void DLLINTERNAL cmd_meta_config(void); 74 | 75 | void DLLINTERNAL cmd_doplug(PLUG_CMD pcmd); 76 | 77 | void DLLINTERNAL client_meta(edict_t *pEntity); 78 | void DLLINTERNAL client_meta_usage(edict_t *pEntity); 79 | void DLLINTERNAL client_meta_version(edict_t *pEntity); 80 | void DLLINTERNAL client_meta_pluginlist(edict_t *pEntity); 81 | void DLLINTERNAL client_meta_aybabtu(edict_t *pEntity); 82 | 83 | #endif /* COMMANDS_META_H */ 84 | -------------------------------------------------------------------------------- /metamod/comp_dep.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Jussi Kivilinna 3 | * 4 | * This file is part of "Metamod All-Mod-Support"-patch for Metamod. 5 | * 6 | * Metamod is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by the 8 | * Free Software Foundation; either version 2 of the License, or (at 9 | * your option) any later version. 10 | * 11 | * Metamod is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Metamod; if not, write to the Free Software Foundation, 18 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * In addition, as a special exception, the author gives permission to 21 | * link the code of this program with the Half-Life Game Engine ("HL 22 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 23 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 24 | * respects for all of the code used other than the HL Engine and MODs 25 | * from Valve. If you modify this file, you may extend this exception 26 | * to your version of the file, but you are not obligated to do so. If 27 | * you do not wish to do so, delete this exception statement from your 28 | * version. 29 | * 30 | */ 31 | 32 | #ifndef COMP_DEP_H 33 | #define COMP_DEP_H 34 | 35 | #define DECLSPEC(kw) 36 | #if defined (_WIN32) && defined (_MSC_VER) 37 | #define ATTRIBUTE(kw) 38 | #else 39 | #define ATTRIBUTE(kw) __attribute__((kw)) 40 | #endif 41 | #define MM_CDECL 42 | 43 | // We use these macros to hide our internal globals from being exported 44 | // on ELF .so 45 | #if defined(__GNUC__) && !defined(_WIN32) && __GNUC__ >= 3 && __GNUC_MINOR__ >= 3 46 | // Hidden data/function. 47 | #define DLLHIDDEN __attribute__((visibility("hidden"))) 48 | // Hidden internal function. 49 | #if defined(__x86_64__) || defined(__amd64__) 50 | #define DLLINTERNAL __attribute__((visibility("internal"))) 51 | #define DLLINTERNAL_NOVIS 52 | #else 53 | #ifdef __INTERNALS_USE_REGPARAMS__ 54 | #define DLLINTERNAL __attribute__((visibility("internal"), regparm(3))) 55 | #define DLLINTERNAL_NOVIS __attribute__((regparm(3))) 56 | #else 57 | #define DLLINTERNAL __attribute__((visibility("internal"))) 58 | #define DLLINTERNAL_NOVIS 59 | #endif 60 | #endif 61 | #else 62 | #define DLLHIDDEN 63 | #if defined (_WIN32) && defined (_MSC_VER) 64 | #define DLLINTERNAL_NOVIS 65 | #define DLLINTERNAL 66 | #else 67 | #ifdef __INTERNALS_USE_REGPARAMS__ 68 | #define DLLINTERNAL_NOVIS __attribute__((regparm(3))) 69 | #define DLLINTERNAL DLLINTERNAL_NOVIS 70 | #else 71 | #define DLLINTERNAL_NOVIS 72 | #define DLLINTERNAL 73 | #endif 74 | #endif //defined WIN32 75 | #endif 76 | 77 | #if defined (_WIN32) && defined (_MSC_VER) 78 | // On x86 va_list is just a pointer. 79 | #define va_copy(dst,src) ((dst)=(src)) 80 | #else 81 | // Some systems that do not supply va_copy have __va_copy instead, since 82 | // that was the name used in the draft proposal. 83 | #if !defined(__GNUC__) || __GNUC__ < 3 84 | #define va_copy __va_copy 85 | #endif 86 | #endif 87 | 88 | // Manual branch optimization for GCC 3.0.0 and newer 89 | #if !defined(__GNUC__) || __GNUC__ < 3 90 | #define likely(x) (x) 91 | #define unlikely(x) (x) 92 | #else 93 | #define likely(x) __builtin_expect((long int)(x), true) 94 | #define unlikely(x) __builtin_expect((long int)(x), false) 95 | #endif 96 | 97 | #endif /*COMP_DEP_H*/ 98 | -------------------------------------------------------------------------------- /metamod/conf_meta.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // conf_meta.h - configfile reading 5 | 6 | // Modeled after mutt/init.[ch]. 7 | 8 | /* 9 | * Copyright (c) 2001-2006 Will Day 10 | * 11 | * This file is part of Metamod. 12 | * 13 | * Metamod is free software; you can redistribute it and/or modify it 14 | * under the terms of the GNU General Public License as published by the 15 | * Free Software Foundation; either version 2 of the License, or (at 16 | * your option) any later version. 17 | * 18 | * Metamod is distributed in the hope that it will be useful, but 19 | * WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | * General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public License 24 | * along with Metamod; if not, write to the Free Software Foundation, 25 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | * 27 | * In addition, as a special exception, the author gives permission to 28 | * link the code of this program with the Half-Life Game Engine ("HL 29 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 30 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 31 | * respects for all of the code used other than the HL Engine and MODs 32 | * from Valve. If you modify this file, you may extend this exception 33 | * to your version of the file, but you are not obligated to do so. If 34 | * you do not wish to do so, delete this exception statement from your 35 | * version. 36 | * 37 | */ 38 | 39 | #ifndef CONF_META_H 40 | #define CONF_META_H 41 | 42 | #include "types_meta.h" // mBOOL 43 | #include "new_baseclass.h" 44 | #include "comp_dep.h" 45 | 46 | // Max length of line in config file. 47 | #define MAX_CONF_LEN 1024 48 | 49 | // Supported config value-types. 50 | typedef enum { 51 | CF_NONE=0, 52 | CF_INT, 53 | CF_BOOL, 54 | CF_STR, 55 | CF_PATH, 56 | #if 0 57 | CF_CVAR, 58 | CF_CMD, 59 | #endif 60 | } cf_type_t; 61 | 62 | //typedef mBOOL (*SETOPT_FN) (char *key, char *value); 63 | 64 | typedef struct option_s { 65 | char *name; // option name 66 | cf_type_t type; // option type 67 | void *dest; // addr of destination variable, or handler function 68 | char *init; // initial value, as a string, just as config file would 69 | } option_t; 70 | 71 | class MConfig : public class_metamod_new { 72 | private: 73 | // data 74 | option_t *list; 75 | char *filename; 76 | // functions 77 | option_t * DLLINTERNAL find(const char *lookup); 78 | mBOOL DLLINTERNAL set(option_t *setp, const char *value); 79 | // Private; to satisfy -Weffc++ "has pointer data members but does 80 | // not override" copy/assignment constructor. 81 | void operator=(const MConfig &src); 82 | MConfig(const MConfig &src); 83 | public: 84 | // contructor 85 | MConfig(void) DLLINTERNAL; 86 | // data 87 | int debuglevel; // to use for meta_debug 88 | char *gamedll; // string if specified in config.ini 89 | char *plugins_file; // ie metamod.ini, plugins.ini 90 | char *exec_cfg; // ie metaexec.cfg, exec.cfg 91 | int autodetect; // autodetection of gamedll (Metamod-All-Support patch) 92 | int clientmeta; // control 'meta' client-command 93 | // functions 94 | void DLLINTERNAL init(option_t *global_options); 95 | mBOOL DLLINTERNAL load(const char *filename); 96 | mBOOL DLLINTERNAL set(const char *key, const char *value); 97 | void DLLINTERNAL show(void); 98 | }; 99 | 100 | #endif /* CONF_META_H */ 101 | -------------------------------------------------------------------------------- /metamod/engine_t.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // engine_t.h - The engine_t type 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef MM_ENGINE_T_H 38 | #define MM_ENGINE_T_H 39 | 40 | #include "eiface.h" // engfuncs_t, globalvars_t 41 | #include "engineinfo.h" // EngineInfo 42 | #include "comp_dep.h" 43 | #include "osdep.h" //unlikely, OPEN_ARGS 44 | 45 | // Our structure for storing engine references. 46 | struct engine_t { 47 | engine_t() DLLINTERNAL; 48 | engine_t(const engine_t&) DLLINTERNAL; 49 | engine_t& operator=(const engine_t&) DLLINTERNAL; 50 | 51 | enginefuncs_t *funcs; // engine funcs 52 | globalvars_t *globals; // engine globals 53 | enginefuncs_t *pl_funcs; // "modified" eng funcs we give to plugins 54 | EngineInfo info; // some special info elements 55 | }; 56 | 57 | inline engine_t::engine_t() 58 | : funcs(NULL), globals(NULL), pl_funcs(NULL), info() 59 | { 60 | } 61 | 62 | 63 | inline engine_t::engine_t(const engine_t& _rhs) 64 | : funcs(_rhs.funcs), globals(_rhs.globals), pl_funcs(_rhs.pl_funcs), info(_rhs.info) 65 | { 66 | } 67 | 68 | 69 | inline engine_t& engine_t::operator=(const engine_t& _rhs) 70 | { 71 | funcs = _rhs.funcs; 72 | globals = _rhs.globals; 73 | pl_funcs = _rhs.pl_funcs; 74 | info = _rhs.info; 75 | return *this; 76 | } 77 | 78 | 79 | extern engine_t Engine DLLHIDDEN; 80 | 81 | #endif /* MM_ENGINE_T_H */ 82 | 83 | -------------------------------------------------------------------------------- /metamod/enginecallbacks.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // enginecallbacks.h - wrapper for 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef MM_ENGINECALLBACKS_H 38 | #define MM_ENGINECALLBACKS_H 39 | 40 | // This file is a wrapper around the SDK's enginecallback.h file. We need 41 | // this because we use a different type for the global object g_engfuncs, 42 | // which is still compatible with the enginefuncs_t that the SDK 43 | // uses. 44 | // This is only done for files that belong to Metamod, not other projects 45 | // like plugins that use this file, or others that include it, too. 46 | // Since we don't have a clean seperation of include files right now we 47 | // "hack" our way around that by using a flag METAMOD_CORE which is set 48 | // when compiling Metamod proper. 49 | 50 | #ifdef __METAMOD_BUILD__ 51 | # include "meta_eiface.h" // HL_enginefuncs_t 52 | 53 | // Use a #define to bend the enginefuncs_t type to our HL_enginefuncs_t 54 | // type instead as we now use that for the global object g_engfuncs. 55 | # define enginefuncs_t HL_enginefuncs_t 56 | #endif /* METAMOD_CORE */ 57 | 58 | #include // ALERT, etc 59 | 60 | #ifdef __METAMOD_BUILD__ 61 | # undef enginefuncs_t 62 | #endif /* METAMOD_CORE */ 63 | 64 | // Also, create some additional macros for engine callback functions, which 65 | // weren't in SDK dlls/enginecallbacks.h but probably should have been. 66 | 67 | #define GET_INFOKEYBUFFER (*g_engfuncs.pfnGetInfoKeyBuffer) 68 | #define INFOKEY_VALUE (*g_engfuncs.pfnInfoKeyValue) 69 | #define SET_CLIENT_KEYVALUE (*g_engfuncs.pfnSetClientKeyValue) 70 | #define REG_SVR_COMMAND (*g_engfuncs.pfnAddServerCommand) 71 | #define SERVER_PRINT (*g_engfuncs.pfnServerPrint) 72 | #define SET_SERVER_KEYVALUE (*g_engfuncs.pfnSetKeyValue) 73 | #define QUERY_CLIENT_CVAR_VALUE (*g_engfuncs.pfnQueryClientCvarValue) 74 | #define QUERY_CLIENT_CVAR_VALUE2 (*g_engfuncs.pfnQueryClientCvarValue2) 75 | #ifndef GETPLAYERAUTHID 76 | #define GETPLAYERAUTHID (*g_engfuncs.pfnGetPlayerAuthId) 77 | #endif 78 | 79 | #endif /* MM_ENGINECALLBACKS_H */ 80 | 81 | -------------------------------------------------------------------------------- /metamod/game_autodetect.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // autodetect.h - GameDLL search and autodetection. 5 | 6 | /* 7 | * Copyright (c) 2004-2006 Jussi Kivilinna 8 | * 9 | * This file is part of "Metamod All-Mod-Support"-patch for Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef GAME_AUTODETECT_H 38 | #define GAME_AUTODETECT_H 39 | 40 | #include "metamod.h" 41 | const char * DLLINTERNAL autodetect_gamedll(const gamedll_t *gamedll, const char *knownfn); 42 | 43 | #endif /*GAME_AUTODETECT_H*/ 44 | -------------------------------------------------------------------------------- /metamod/game_support.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // game_support.h - structures for supporting different HL mod "games" 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef GAME_SUPPORT_H 38 | #define GAME_SUPPORT_H 39 | 40 | #include "types_meta.h" // mBOOL 41 | #include "metamod.h" // gamedll_t 42 | 43 | // Information we have about each game/mod DLL. 44 | typedef struct game_modinfo_s { 45 | const char *name; // name (the game dir) 46 | const char *linux_so; // filename of linux shared lib 47 | const char *win_dll; // filename of win32 dll 48 | const char *desc; // our long-name description 49 | } game_modinfo_t; 50 | 51 | typedef game_modinfo_t game_modlist_t[]; 52 | 53 | const DLLINTERNAL game_modinfo_t *lookup_game(const char *name); 54 | mBOOL DLLINTERNAL setup_gamedll(gamedll_t *gamedll); 55 | 56 | #endif /* GAME_SUPPORT_H */ 57 | -------------------------------------------------------------------------------- /metamod/h_export.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // h_export.cpp - main exported DLL functionality 5 | 6 | // From SDK dlls/h_export.cpp: 7 | 8 | /*** 9 | * 10 | * Copyright (c) 1999, 2000 Valve LLC. All rights reserved. 11 | * 12 | * This product contains software technology licensed from Id 13 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 14 | * All Rights Reserved. 15 | * 16 | * Use, distribution, and modification of this source code and/or resulting 17 | * object code is restricted to non-commercial enhancements to products from 18 | * Valve LLC. All other use, distribution, or modification is prohibited 19 | * without written permission from Valve LLC. 20 | * 21 | ****/ 22 | /* 23 | 24 | ===== h_export.cpp ======================================================== 25 | 26 | Entity classes exported by Halflife. 27 | 28 | */ 29 | 30 | 31 | #include // always 32 | #include 33 | 34 | #include "h_export.h" // me 35 | #include "metamod.h" // engine_t, etc 36 | #include "log_meta.h" // META_DEV, etc 37 | #include "osdep_p.h" // get_module_handle_of_memptr 38 | 39 | // From SDK dlls/h_export.cpp: 40 | 41 | #ifdef _WIN32 42 | //! Required DLL entry point 43 | // The above SDK comment indicates this routine is required, but the MSDN 44 | // documentation indicates it's actually optional. We keep it, though, for 45 | // completeness. 46 | // Note! 'extern "C"' needed for mingw compile. 47 | extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 48 | { 49 | if (fdwReason == DLL_PROCESS_ATTACH) { 50 | metamod_handle = hinstDLL; 51 | } 52 | else if (fdwReason == DLL_PROCESS_DETACH) { 53 | /* nothing */ 54 | } 55 | return(TRUE); 56 | } 57 | #elif defined(linux) 58 | // Linux routines to correspond to ATTACH and DETACH cases above. These 59 | // aren't required by linux, but are included here for completeness, and 60 | // just in case we come across a need to do something at dll load or 61 | // unload. 62 | void _init(void) { 63 | // called before dlopen() returns 64 | } 65 | void _fini(void) { 66 | // called before dlclose() returns 67 | } 68 | #endif 69 | 70 | // Fixed MSVC compiling, by Nikolay "The Storm" Baklicharov. 71 | #if defined(_WIN32) && !defined(__GNUC__) && defined (_MSC_VER) 72 | #pragma comment(linker, "/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1") 73 | #pragma comment(linker, "/SECTION:.data,RW") 74 | #endif 75 | 76 | //! Holds engine functionality callbacks 77 | HL_enginefuncs_t g_engfuncs; 78 | globalvars_t *gpGlobals; 79 | engine_t Engine; 80 | 81 | // Receive engine function table from engine. 82 | // 83 | // This appears to be the _first_ DLL routine called by the engine, so this 84 | // is where we hook to load all the other DLLs (game, plugins, etc), which 85 | // is actually all done in meta_startup(). 86 | C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pengfuncsFromEngine, 87 | globalvars_t *pGlobals) 88 | { 89 | #ifdef linux 90 | metamod_handle = get_module_handle_of_memptr((void*)&g_engfuncs); 91 | #endif 92 | gpGlobals = pGlobals; 93 | Engine.funcs = &g_engfuncs; 94 | Engine.globals = pGlobals; 95 | Engine.info.initialise(pengfuncsFromEngine); 96 | 97 | g_engfuncs.initialise_interface(pengfuncsFromEngine); 98 | // NOTE! Have to call logging function _after_ initialising g_engfuncs, so 99 | // that g_engfuncs.pfnAlertMessage() can be resolved properly, heh. :) 100 | META_DEV("called: GiveFnptrsToDll"); 101 | 102 | // Load plugins, load game dll. 103 | if(!metamod_startup()) { 104 | metamod_not_loaded = 1; 105 | } 106 | 107 | return; 108 | } 109 | -------------------------------------------------------------------------------- /metamod/h_export.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // h_export.h - prototypes for h_export.cpp 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef H_EXPORT_H 38 | #define H_EXPORT_H 39 | 40 | #include "osdep.h" // DLLEXPORT, WINAPI, etc 41 | 42 | // Our GiveFnptrsToDll, called by engine. 43 | typedef void (WINAPI *GIVE_ENGINE_FUNCTIONS_FN) (enginefuncs_t 44 | *pengfuncsFromEngine, globalvars_t *pGlobals); 45 | 46 | C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pengfuncsFromEngine, 47 | globalvars_t *pGlobals); 48 | 49 | #endif /* H_EXPORT_H */ 50 | -------------------------------------------------------------------------------- /metamod/info_name.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/metamod/info_name.h -------------------------------------------------------------------------------- /metamod/linkgame.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // linkgame.cpp - export entities from mod "games" back to the HL engine 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | //linkents not needed on this version of metamod 38 | -------------------------------------------------------------------------------- /metamod/linkplug.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // linkplug.cpp - export entities from plugins back to the HL engine 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #include // always 38 | 39 | #include "linkent.h" // LINK_ENTITY_TO_PLUGIN 40 | 41 | // Entity lists for plugins 42 | LINK_ENTITY_TO_PLUGIN(adminmod_timer, "adminmod"); 43 | -------------------------------------------------------------------------------- /metamod/metamod.def: -------------------------------------------------------------------------------- 1 | LIBRARY metamod 2 | EXPORTS 3 | GiveFnptrsToDll @1 4 | SECTIONS 5 | .data READ WRITE 6 | -------------------------------------------------------------------------------- /metamod/metamod.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "metamod", "metamod.vcproj", "{02832A39-E902-46B7-8D47-911C37CF41B0}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {02832A39-E902-46B7-8D47-911C37CF41B0}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {02832A39-E902-46B7-8D47-911C37CF41B0}.Debug|Win32.Build.0 = Debug|Win32 14 | {02832A39-E902-46B7-8D47-911C37CF41B0}.Release|Win32.ActiveCfg = Release|Win32 15 | {02832A39-E902-46B7-8D47-911C37CF41B0}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /metamod/mhook.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/metamod/mhook.cpp -------------------------------------------------------------------------------- /metamod/mhook.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/metamod/mhook.h -------------------------------------------------------------------------------- /metamod/mplayer.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // mplayer.h - class to keep info about a player and a class listing all 5 | // players 6 | 7 | /* 8 | * Copyright (c) 2005-2006 Will Day 9 | * 10 | * This file is part of Metamod. 11 | * 12 | * Metamod is free software; you can redistribute it and/or modify it 13 | * under the terms of the GNU General Public License as published by the 14 | * Free Software Foundation; either version 2 of the License, or (at 15 | * your option) any later version. 16 | * 17 | * Metamod is distributed in the hope that it will be useful, but 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | * General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with Metamod; if not, write to the Free Software Foundation, 24 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 | * 26 | * In addition, as a special exception, the author gives permission to 27 | * link the code of this program with the Half-Life Game Engine ("HL 28 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 29 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 30 | * respects for all of the code used other than the HL Engine and MODs 31 | * from Valve. If you modify this file, you may extend this exception 32 | * to your version of the file, but you are not obligated to do so. If 33 | * you do not wish to do so, delete this exception statement from your 34 | * version. 35 | * 36 | */ 37 | 38 | #ifndef INCLUDE_METAMOD_PLAYER_H 39 | #define INCLUDE_METAMOD_PLAYER_H 40 | 41 | #include "plinfo.h" // plugin_info_t, etc 42 | #include "mutil.h" // query_callback_t 43 | #include "types_meta.h" // mBOOL 44 | #include "new_baseclass.h" // class_metamod_new 45 | 46 | 47 | // Numbers of players limit set by the engine 48 | #define MAX_PLAYERS 32 49 | 50 | 51 | // Info on an individual player 52 | class MPlayer : public class_metamod_new 53 | { 54 | private: 55 | mBOOL isQueried; // is this player currently queried for a cvar value 56 | char *cvarName; // name of the cvar if getting queried 57 | 58 | MPlayer (const MPlayer&) DLLINTERNAL; 59 | MPlayer& operator=(const MPlayer&) DLLINTERNAL; 60 | 61 | 62 | public: 63 | MPlayer() DLLINTERNAL; 64 | ~MPlayer() DLLINTERNAL; 65 | void DLLINTERNAL set_cvar_query(const char *cvar); // mark this player as querying a client cvar 66 | void DLLINTERNAL clear_cvar_query(const char *cvar=NULL); // unmark this player as querying a client cvar 67 | const char *DLLINTERNAL is_querying_cvar(void); // check if a player is querying a cvar. returns 68 | // NULL if not or the name of the cvar 69 | }; 70 | 71 | 72 | 73 | // A list of players. The number of max players is fixed and small enough 74 | // to use an array. 75 | class MPlayerList 76 | { 77 | private: 78 | enum { NUM_SLOTS = MAX_PLAYERS + 1 }; 79 | 80 | MPlayer players[NUM_SLOTS]; // array of players 81 | 82 | 83 | public: 84 | void DLLINTERNAL set_player_cvar_query(const edict_t *pEntity, const char *cvar); 85 | void DLLINTERNAL clear_player_cvar_query(const edict_t *pEntity, const char *cvar=NULL); 86 | void DLLINTERNAL clear_all_cvar_queries(void); 87 | const char *DLLINTERNAL is_querying_cvar(const edict_t *pEntity); 88 | }; 89 | 90 | 91 | #endif /* INCLUDE_METAMOD_PLAYER_H */ 92 | -------------------------------------------------------------------------------- /metamod/mqueue.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/metamod/mqueue.cpp -------------------------------------------------------------------------------- /metamod/mqueue.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/metamod/mqueue.h -------------------------------------------------------------------------------- /metamod/new_baseclass.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Jussi Kivilinna 3 | * 4 | * This file is part of "Metamod All-Mod-Support"-patch for Metamod. 5 | * 6 | * Metamod is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by the 8 | * Free Software Foundation; either version 2 of the License, or (at 9 | * your option) any later version. 10 | * 11 | * Metamod is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Metamod; if not, write to the Free Software Foundation, 18 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * In addition, as a special exception, the author gives permission to 21 | * link the code of this program with the Half-Life Game Engine ("HL 22 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 23 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 24 | * respects for all of the code used other than the HL Engine and MODs 25 | * from Valve. If you modify this file, you may extend this exception 26 | * to your version of the file, but you are not obligated to do so. If 27 | * you do not wish to do so, delete this exception statement from your 28 | * version. 29 | * 30 | */ 31 | #ifndef METAMOD_NEW_BASECLASS_H 32 | #define METAMOD_NEW_BASECLASS_H 33 | 34 | #include 35 | 36 | #include "comp_dep.h" 37 | 38 | //new/delete operators with malloc/free to remove need for libstdc++ 39 | 40 | class class_metamod_new { 41 | public: 42 | // Construction 43 | class_metamod_new(void) { }; 44 | 45 | // Operators 46 | inline void * operator new(size_t size) { 47 | if(size==0) 48 | return(calloc(1, 1)); 49 | return(calloc(1, size)); 50 | } 51 | 52 | inline void * operator new[](size_t size) { 53 | if(size==0) 54 | return(calloc(1, 1)); 55 | return(calloc(1, size)); 56 | } 57 | 58 | inline void operator delete(void *ptr) { 59 | if(ptr) 60 | free(ptr); 61 | } 62 | 63 | inline void operator delete[](void *ptr) { 64 | if(ptr) 65 | free(ptr); 66 | } 67 | }; 68 | 69 | #endif /*METAMOD_NEW_BASECLASS_H*/ 70 | -------------------------------------------------------------------------------- /metamod/osdep_p.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Jussi Kivilinna 3 | * 4 | * This file is part of "Metamod All-Mod-Support"-patch for Metamod. 5 | * 6 | * Metamod is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by the 8 | * Free Software Foundation; either version 2 of the License, or (at 9 | * your option) any later version. 10 | * 11 | * Metamod is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Metamod; if not, write to the Free Software Foundation, 18 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * In addition, as a special exception, the author gives permission to 21 | * link the code of this program with the Half-Life Game Engine ("HL 22 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 23 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 24 | * respects for all of the code used other than the HL Engine and MODs 25 | * from Valve. If you modify this file, you may extend this exception 26 | * to your version of the file, but you are not obligated to do so. If 27 | * you do not wish to do so, delete this exception statement from your 28 | * version. 29 | * 30 | */ 31 | 32 | #ifndef OSDEP_P_H 33 | #define OSDEP_P_H 34 | 35 | #include "types_meta.h" // mBOOL 36 | #include "osdep.h" // PATH_MAX 37 | 38 | // Checks if file is hlsdk api game dll 39 | // (osdep_detect_gamedll_linux.cpp and osdep_detect_gamedll_win32.cpp) 40 | // --Jussi Kivilinna 41 | mBOOL DLLINTERNAL is_gamedll(const char *filename); 42 | 43 | // MSVC doesn't provide opendir/readdir/closedir, so we write our own. 44 | // --Jussi Kivilinna 45 | #ifdef _WIN32 46 | struct my_dirent { 47 | char d_name[PATH_MAX]; 48 | }; 49 | typedef struct { 50 | HANDLE handle; 51 | WIN32_FIND_DATAA find_data; 52 | struct my_dirent ent; 53 | int not_found; 54 | } my_DIR; 55 | 56 | #define dirent my_dirent 57 | #define DIR my_DIR 58 | 59 | DIR * DLLINTERNAL my_opendir(const char *); 60 | struct dirent * DLLINTERNAL my_readdir(DIR *); 61 | void DLLINTERNAL my_closedir(DIR *); 62 | 63 | #define opendir(x) my_opendir(x) 64 | #define readdir(x) my_readdir(x) 65 | #define closedir(x) my_closedir(x) 66 | #else 67 | #include 68 | #endif /* _WIN32 */ 69 | 70 | DLHANDLE DLLINTERNAL get_module_handle_of_memptr(void * memptr); 71 | 72 | #ifdef linux 73 | void * DLLINTERNAL get_dlsym_pointer(void); 74 | #endif 75 | 76 | #endif /* OSDEP_P_H */ 77 | -------------------------------------------------------------------------------- /metamod/plinfo.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // plinfo.h - typedefs for plugin info structure 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef PLINFO_H 38 | #define PLINFO_H 39 | 40 | #include "comp_dep.h" 41 | 42 | // Flags for plugin to indicate when it can be be loaded/unloaded. 43 | // NOTE: order is crucial, as greater/less comparisons are made. 44 | typedef enum { 45 | PT_NEVER = 0, 46 | PT_STARTUP, // should only be loaded/unloaded at initial hlds execution 47 | PT_CHANGELEVEL, // can be loaded/unloaded between maps 48 | PT_ANYTIME, // can be loaded/unloaded at any time 49 | PT_ANYPAUSE, // can be loaded/unloaded at any time, and can be "paused" during a map 50 | } PLUG_LOADTIME; 51 | 52 | // Flags to indicate why the plugin is being unloaded. 53 | typedef enum { 54 | PNL_NULL = 0, 55 | PNL_INI_DELETED, // was deleted from plugins.ini 56 | PNL_FILE_NEWER, // file on disk is newer than last load 57 | PNL_COMMAND, // requested by server/console command 58 | PNL_CMD_FORCED, // forced by server/console command 59 | PNL_DELAYED, // delayed from previous request; can't tell origin 60 | //only used for 'real_reason' on MPlugin::unload() 61 | PNL_PLUGIN, // requested by plugin function call 62 | PNL_PLG_FORCED, // forced by plugin function call 63 | //only used internally for 'meta reload' 64 | PNL_RELOAD, // forced unload by reload() 65 | } PL_UNLOAD_REASON; 66 | 67 | // Information plugin provides about itself. 68 | typedef struct { 69 | char *ifvers; // meta_interface version 70 | char *name; // full name of plugin 71 | char *version; // version 72 | char *date; // date 73 | char *author; // author name/email 74 | char *url; // URL 75 | char *logtag; // log message prefix (unused right now) 76 | PLUG_LOADTIME loadable; // when loadable 77 | PLUG_LOADTIME unloadable; // when unloadable 78 | } plugin_info_t; 79 | extern plugin_info_t Plugin_info DLLHIDDEN; 80 | 81 | // Plugin identifier, passed to all Meta Utility Functions. 82 | typedef plugin_info_t* plid_t; 83 | #define PLID &Plugin_info 84 | 85 | #endif /* PLINFO_H */ 86 | -------------------------------------------------------------------------------- /metamod/reg_support.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // reg_support.h - functions for "registered" cmd/cvar/msg support 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef REG_SUPPORT_H 38 | #define REG_SUPPORT_H 39 | 40 | #include "mreg.h" // REG_CMD_FN, etc 41 | 42 | // these are only 'hidden' because called from outside (plugins and engine) 43 | void DLLHIDDEN meta_command_handler(void); 44 | void DLLHIDDEN meta_AddServerCommand(char *cmd_name, REG_CMD_FN function); 45 | void DLLHIDDEN meta_CVarRegister(cvar_t *pCvar); 46 | int DLLHIDDEN meta_RegUserMsg(const char *pszName, int iSize); 47 | void DLLHIDDEN meta_QueryClientCvarValue(const edict_t *player, const char *cvarName); 48 | 49 | #endif /* REG_SUPPORT_H */ 50 | -------------------------------------------------------------------------------- /metamod/res_meta.rc: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 ft=c : 2 | // vim: set tw=75 : 3 | 4 | /* 5 | * Copyright (c) 2001-2003 Will Day 6 | * 7 | * This file is part of Metamod. 8 | * 9 | * Metamod is free software; you can redistribute it and/or modify it 10 | * under the terms of the GNU General Public License as published by the 11 | * Free Software Foundation; either version 2 of the License, or (at 12 | * your option) any later version. 13 | * 14 | * Metamod is distributed in the hope that it will be useful, but 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Metamod; if not, write to the Free Software Foundation, 21 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | * 23 | * In addition, as a special exception, the author gives permission to 24 | * link the code of this program with the Half-Life Game Engine ("HL 25 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 26 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 27 | * respects for all of the code used other than the HL Engine and MODs 28 | * from Valve. If you modify this file, you may extend this exception 29 | * to your version of the file, but you are not obligated to do so. If 30 | * you do not wish to do so, delete this exception statement from your 31 | * version. 32 | * 33 | */ 34 | 35 | // see: 36 | // http://msdn.microsoft.com/library/psdk/winui/rc_7x2d.htm 37 | 38 | #include 39 | #include "info_name.h" 40 | 41 | VS_VERSION_INFO VERSIONINFO 42 | FILEVERSION RC_VERS_DWORD 43 | PRODUCTVERSION RC_VERS_DWORD 44 | FILEFLAGSMASK 0x3fL 45 | #ifdef _DEBUG 46 | FILEFLAGS VS_FF_DEBUG 47 | #else 48 | FILEFLAGS 0x0L 49 | #endif 50 | FILEOS VOS__WINDOWS32 51 | FILETYPE VFT_DLL 52 | FILESUBTYPE VFT2_UNKNOWN 53 | BEGIN 54 | BLOCK "StringFileInfo" 55 | BEGIN 56 | BLOCK "040904b0" 57 | BEGIN 58 | VALUE "Comments", RC_COMMENTS "\0" 59 | VALUE "CompanyName", VAUTHOR "\0" 60 | VALUE "FileDescription", RC_DESC "\0" 61 | VALUE "FileVersion", VVERSION "\0" 62 | VALUE "InternalName", RC_INTERNAL "\0" 63 | VALUE "LegalCopyright", RC_COPYRIGHT "\0" 64 | VALUE "License", RC_LICENSE "\0" 65 | VALUE "OriginalFilename", RC_FILENAME "\0" 66 | VALUE "PrivateBuild", "\0" 67 | VALUE "ProductName", VNAME "\0" 68 | VALUE "ProductVersion", VVERSION "\0" 69 | VALUE "SpecialBuild", OPT_TYPE "\0" 70 | END 71 | END 72 | BLOCK "VarFileInfo" 73 | BEGIN 74 | VALUE "Translation", 0x409, 1200 75 | END 76 | END 77 | -------------------------------------------------------------------------------- /metamod/ret_type.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Jussi Kivilinna 3 | * 4 | * This file is part of "Metamod All-Mod-Support"-patch for Metamod. 5 | * 6 | * Metamod is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by the 8 | * Free Software Foundation; either version 2 of the License, or (at 9 | * your option) any later version. 10 | * 11 | * Metamod is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Metamod; if not, write to the Free Software Foundation, 18 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * In addition, as a special exception, the author gives permission to 21 | * link the code of this program with the Half-Life Game Engine ("HL 22 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 23 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 24 | * respects for all of the code used other than the HL Engine and MODs 25 | * from Valve. If you modify this file, you may extend this exception 26 | * to your version of the file, but you are not obligated to do so. If 27 | * you do not wish to do so, delete this exception statement from your 28 | * version. 29 | * 30 | */ 31 | #ifndef RET_TYPE_H 32 | #define RET_TYPE_H 33 | 34 | #include "new_baseclass.h" 35 | 36 | class class_ret_t : public class_metamod_new { 37 | public: 38 | // Construction 39 | inline class_ret_t(void) { }; 40 | inline class_ret_t(float f) { data.f = f; }; 41 | inline class_ret_t(void * p) { data.p = p; }; 42 | inline class_ret_t(const char * pc) { data.pc = pc; }; 43 | inline class_ret_t(int i) { data.i = i; }; 44 | inline class_ret_t(short s) { data.i = s; }; 45 | inline class_ret_t(char c) { data.i = c; }; 46 | inline class_ret_t(unsigned int ui) { data.ui = ui; }; 47 | inline class_ret_t(unsigned long ui) { data.ui = ui; }; 48 | inline class_ret_t(unsigned short us) { data.ui = us; }; 49 | inline class_ret_t(unsigned char uc) { data.ui = uc; }; 50 | 51 | // Reading/Writing 52 | inline void * getptr(void) { return(&data); }; 53 | 54 | #define SET_RET_CLASS(ret,type,x) \ 55 | *(type*)((ret).getptr()) = (type)(x) 56 | #define GET_RET_CLASS(ret,type) \ 57 | (*(type*)((ret).getptr())) 58 | private: 59 | //Data (select data size of largest type) (x86: 32bit, x86_64: 64bit) 60 | union { 61 | void * p; 62 | const char * pc; 63 | float f; 64 | long i; 65 | unsigned long ui; 66 | } data; 67 | }; 68 | 69 | #endif /*RET_TYPE_H*/ 70 | -------------------------------------------------------------------------------- /metamod/sdk_util.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // sdk_util.cpp - utility routines from HL SDK util.cpp 5 | 6 | // Selected portions of dlls/util.cpp from SDK 2.1. 7 | // Functions copied from there as needed... 8 | // And modified to avoid buffer overflows (argh). 9 | // Also modified to remove dependency on CBaseEntity class. 10 | 11 | /*** 12 | * 13 | * Copyright (c) 1999, 2000 Valve LLC. All rights reserved. 14 | * 15 | * This product contains software technology licensed from Id 16 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 17 | * All Rights Reserved. 18 | * 19 | * Use, distribution, and modification of this source code and/or resulting 20 | * object code is restricted to non-commercial enhancements to products from 21 | * Valve LLC. All other use, distribution, or modification is prohibited 22 | * without written permission from Valve LLC. 23 | * 24 | ****/ 25 | /* 26 | 27 | ===== util.cpp ======================================================== 28 | 29 | Utility code. Really not optional after all. 30 | 31 | */ 32 | 33 | #include 34 | #include "sdk_util.h" 35 | 36 | #include // for strncpy(), etc 37 | 38 | #include "osdep.h" // win32 vsnprintf, etc 39 | 40 | const char * DLLINTERNAL META_UTIL_VarArgs(const char *format, ...) 41 | { 42 | va_list argptr; 43 | static char string[4096]; 44 | 45 | va_start(argptr, format); 46 | safevoid_vsnprintf(string, sizeof(string), format, argptr); 47 | va_end(argptr); 48 | 49 | return(string); 50 | } 51 | 52 | short DLLINTERNAL FixedSigned16(float value, float scale) 53 | { 54 | int output; 55 | 56 | output = (int)(value * scale); 57 | 58 | if(output > 32767) 59 | output = 32767; 60 | 61 | if(output < -32768) 62 | output = -32768; 63 | 64 | return((short)output); 65 | } 66 | 67 | unsigned short DLLINTERNAL FixedUnsigned16(float value, float scale) 68 | { 69 | int output; 70 | 71 | output = (int)(value * scale); 72 | if(output < 0) 73 | output = 0; 74 | if(output > 0xFFFF) 75 | output = 0xFFFF; 76 | 77 | return((unsigned short)output); 78 | } 79 | 80 | 81 | void DLLINTERNAL META_UTIL_HudMessage(edict_t *pEntity, const hudtextparms_t &textparms, const char *pMessage) 82 | { 83 | if(fast_FNullEnt(pEntity) || pEntity->free) 84 | return; 85 | 86 | MESSAGE_BEGIN( MSG_ONE, SVC_TEMPENTITY, NULL, pEntity ); 87 | WRITE_BYTE( TE_TEXTMESSAGE ); 88 | WRITE_BYTE( textparms.channel & 0xFF ); 89 | 90 | WRITE_SHORT( FixedSigned16( textparms.x, 1<<13 ) ); 91 | WRITE_SHORT( FixedSigned16( textparms.y, 1<<13 ) ); 92 | WRITE_BYTE( textparms.effect ); 93 | 94 | WRITE_BYTE( textparms.r1 ); 95 | WRITE_BYTE( textparms.g1 ); 96 | WRITE_BYTE( textparms.b1 ); 97 | WRITE_BYTE( textparms.a1 ); 98 | 99 | WRITE_BYTE( textparms.r2 ); 100 | WRITE_BYTE( textparms.g2 ); 101 | WRITE_BYTE( textparms.b2 ); 102 | WRITE_BYTE( textparms.a2 ); 103 | 104 | WRITE_SHORT( FixedUnsigned16( textparms.fadeinTime, 1<<8 ) ); 105 | WRITE_SHORT( FixedUnsigned16( textparms.fadeoutTime, 1<<8 ) ); 106 | WRITE_SHORT( FixedUnsigned16( textparms.holdTime, 1<<8 ) ); 107 | 108 | if(textparms.effect == 2) 109 | WRITE_SHORT( FixedUnsigned16( textparms.fxTime, 1<<8 ) ); 110 | 111 | if(strlen( pMessage ) < 512) 112 | { 113 | WRITE_STRING( pMessage ); 114 | } 115 | else 116 | { 117 | char tmp[512]; 118 | strncpy( tmp, pMessage, 511 ); 119 | tmp[511] = 0; 120 | WRITE_STRING( tmp ); 121 | } 122 | MESSAGE_END(); 123 | } 124 | 125 | 126 | -------------------------------------------------------------------------------- /metamod/studioapi.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // studio.cpp - player model blending interfaces 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | //Jussi Kivilinna: This forwarder function to gamedll is not needed anymore, dynamic 38 | // linkent code handles this too! 39 | -------------------------------------------------------------------------------- /metamod/studioapi.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // studio.cpp - player model blending interfaces 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | //Jussi Kivilinna: This forwarder function to gamedll is not needed anymore, dynamic 38 | // linkent code handles this too! 39 | -------------------------------------------------------------------------------- /metamod/thread_logparse.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/metamod/thread_logparse.cpp -------------------------------------------------------------------------------- /metamod/thread_logparse.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/metamod/thread_logparse.h -------------------------------------------------------------------------------- /metamod/tqueue.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // tqueue.h - template classes for Queue and QItem 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | /* 37 | #ifndef TQUEUE_H 38 | #define TQUEUE_H 39 | 40 | #include "new_baseclass.h" 41 | 42 | // Forward declarations. 43 | template class Queue; 44 | 45 | // Template for Queue. 46 | template class Queue : public class_metamod_new { 47 | private: 48 | // private copy/assign constructors: 49 | Queue(const Queue &src); 50 | void operator=(const Queue &src); 51 | protected: 52 | // structs: 53 | class QItem : public class_metamod_new { 54 | private: 55 | // private copy/assign constructors: 56 | QItem(const QItem &src); 57 | void operator=(const QItem &src); 58 | public: 59 | qdata_t *data; 60 | QItem *next; 61 | QItem(void) :data(NULL), next(NULL) { }; 62 | QItem(qdata_t *dnew) :data(dnew), next(NULL) { }; 63 | }; 64 | // data: 65 | int size; 66 | QItem *front; 67 | QItem *end; 68 | public: 69 | // constructor: 70 | Queue(void) :size(0), front(NULL), end(NULL) {}; 71 | // functions: 72 | void push(qdata_t *qadd); 73 | qdata_t * pop(void); 74 | }; 75 | 76 | 77 | ///// Template Queue: 78 | 79 | // Push onto the queue (at end). 80 | template inline void Queue::push(qdata_t *qadd) { 81 | QItem *qnew = new QItem(qadd); 82 | 83 | if(size==0) 84 | front=qnew; 85 | else 86 | end->next=qnew; 87 | 88 | end=qnew; 89 | 90 | size++; 91 | } 92 | 93 | // Pop from queue (from front). Wait for an item to actually be available 94 | // on the queue (block until there's something there). 95 | template inline qdata_t* Queue::pop(void) { 96 | QItem *qtmp; 97 | qdata_t *ret; 98 | 99 | if(size==0) 100 | return(NULL); 101 | 102 | qtmp=front; 103 | 104 | ret=front->data; 105 | front=front->next; 106 | 107 | delete qtmp; 108 | 109 | size--; 110 | 111 | return(ret); 112 | } 113 | 114 | #endif*/ /* TQUEUE_H */ 115 | -------------------------------------------------------------------------------- /metamod/types_meta.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // types_meta.h - common internal type, etc definitions 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef TYPES_META_H 38 | #define TYPES_META_H 39 | 40 | #include "comp_dep.h" 41 | 42 | 43 | // Our own boolean type, for stricter type matching. 44 | typedef enum mBOOL { 45 | mFALSE = 0, 46 | mTRUE, 47 | } mBOOL; 48 | 49 | // Like C's errno, for our various functions; describes causes of failure 50 | // or mFALSE returns. 51 | typedef enum { 52 | ME_NOERROR = 0, 53 | ME_FORMAT, // invalid format 54 | ME_COMMENT, // ignored comment 55 | ME_BLANK, // ignored blank (empty) line 56 | ME_ALREADY, // request had already been done 57 | ME_DELAYED, // request is delayed 58 | ME_NOTALLOWED, // request not allowed 59 | ME_SKIPPED, // request is being skipped for whatever reason 60 | ME_BADREQ, // invalid request for this 61 | ME_ARGUMENT, // invalid arguments 62 | ME_NULLRESULT, // resulting data was empty or null 63 | ME_MAXREACHED, // reached max/limit 64 | ME_NOTUNIQ, // not unique (ambigious match) 65 | ME_NOTFOUND, // in find operation, match not found 66 | ME_NOFILE, // file empty or missing 67 | ME_NOMEM, // malloc failed 68 | ME_BADMEMPTR, // invalid memory address 69 | ME_OSNOTSUP, // OS doesn't support this operation 70 | ME_DLOPEN, // failed to open shared lib/dll 71 | ME_DLMISSING, // symbol missing in lib/dll 72 | ME_DLERROR, // some other error encountered calling functions from dll 73 | ME_IFVERSION, // incompatible interface version 74 | ME_UNLOAD_UNLOADER, // tried to unload unloader 75 | ME_UNLOAD_SELF, // tried to unload self 76 | } META_ERRNO; 77 | extern META_ERRNO meta_errno DLLHIDDEN; 78 | 79 | #define RETURN_ERRNO(retval, errval) \ 80 | do { meta_errno=errval; return(retval); } while(0) 81 | 82 | #define RETURN_LOGERR_ERRNO(errargs, retval, errval) \ 83 | do { META_ERROR errargs ; meta_errno=errval; return(retval); } while(0) 84 | 85 | #endif /* TYPES_META_H */ 86 | -------------------------------------------------------------------------------- /metamod/vdate.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // vdate.cpp - compile-time version date 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #include "info_name.h" // for VNAME, VVERSION, etc 38 | #include "vdate.h" 39 | 40 | 41 | // Grab date/time of compile. The Makefile is set up to recompile this 42 | // module before each link, so that this will always indicate the time the 43 | // library was compiled and linked. 44 | 45 | // This is in a separate file from vers_*, so it can be generically used by 46 | // multiple projects. 47 | 48 | char const *COMPILE_TIME=__DATE__ ", " __TIME__; 49 | 50 | #ifndef COMPILE_TZ 51 | #define COMPILE_TZ "EET" 52 | #endif 53 | 54 | char const *COMPILE_TZONE = COMPILE_TZ; 55 | 56 | // Include a string for /usr/bin/ident. 57 | 58 | char const *vstring="\n$Pg: " VNAME " -- " VVERSION " | " __DATE__ " - " __TIME__ " $\n"; 59 | -------------------------------------------------------------------------------- /metamod/vdate.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // vdate.h - compile-time version date 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef VDATE_H 38 | #define VDATE_H 39 | 40 | #include "comp_dep.h" 41 | 42 | extern char const *COMPILE_TIME DLLHIDDEN; 43 | extern char const *COMPILE_TZONE DLLHIDDEN; 44 | 45 | #endif /* VDATE_H */ 46 | -------------------------------------------------------------------------------- /metamod/vers_meta.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // vers_meta.h - version info, intended to be common among DLLs distributed 5 | // with metamod. 6 | 7 | /* 8 | * Copyright (c) 2001-2013 Will Day 9 | * 10 | * This file is part of Metamod. 11 | * 12 | * Metamod is free software; you can redistribute it and/or modify it 13 | * under the terms of the GNU General Public License as published by the 14 | * Free Software Foundation; either version 2 of the License, or (at 15 | * your option) any later version. 16 | * 17 | * Metamod is distributed in the hope that it will be useful, but 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | * General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with Metamod; if not, write to the Free Software Foundation, 24 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 | * 26 | * In addition, as a special exception, the author gives permission to 27 | * link the code of this program with the Half-Life Game Engine ("HL 28 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 29 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 30 | * respects for all of the code used other than the HL Engine and MODs 31 | * from Valve. If you modify this file, you may extend this exception 32 | * to your version of the file, but you are not obligated to do so. If 33 | * you do not wish to do so, delete this exception statement from your 34 | * version. 35 | * 36 | */ 37 | 38 | #ifndef VERS_META_H 39 | #define VERS_META_H 40 | 41 | #ifndef OPT_TYPE 42 | #define OPT_TYPE "default" 43 | #endif /* not OPT_TYPE */ 44 | 45 | 46 | #define VDATE "2013/05/30" 47 | #define VPATCH_COPYRIGHT_YEAR "2013" 48 | #define VMETA_VERSION "1.21" 49 | 50 | #define VPATCH_NAME "Metamod-P (mm-p)" 51 | #define VPATCH_IVERSION 37 52 | #define VPATCH_VERSION "37" 53 | #define VPATCH_AUTHOR "Jussi Kivilinna" 54 | #define VPATCH_WEBSITE "http://metamod-p.sourceforge.net/" 55 | 56 | #define VVERSION VMETA_VERSION "p" VPATCH_VERSION 57 | #define RC_VERS_DWORD 1,21,0,VPATCH_IVERSION // Version Windows DLL Resources in res_meta.rc 58 | 59 | 60 | 61 | #endif /* VERS_META_H */ 62 | -------------------------------------------------------------------------------- /stub_plugin/.gitignore: -------------------------------------------------------------------------------- 1 | msgs/ 2 | opt.*/ 3 | debug.*/ 4 | -------------------------------------------------------------------------------- /stub_plugin/Config.mak: -------------------------------------------------------------------------------- 1 | MODNAME = stub_mm 2 | 3 | EXTRA_CFLAGS = 4 | 5 | SRCFILES = dllapi.cpp engine_api.cpp h_export.cpp meta_api.cpp sdk_util.cpp 6 | -------------------------------------------------------------------------------- /stub_plugin/Makefile: -------------------------------------------------------------------------------- 1 | # Since this file is under CVS control and we cannot store 2 | # symbolic links in CVS (and neither under Windows) we 3 | # include the Makefile from the metamod directory instead 4 | # of linking to it. 5 | 6 | include ../metamod/Makefile 7 | -------------------------------------------------------------------------------- /stub_plugin/dummy.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/stub_plugin/dummy.h -------------------------------------------------------------------------------- /stub_plugin/dummy.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/stub_plugin/dummy.rc -------------------------------------------------------------------------------- /stub_plugin/h_export.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // From SDK dlls/h_export.cpp: 5 | 6 | /*** 7 | * 8 | * Copyright (c) 1999, 2000 Valve LLC. All rights reserved. 9 | * 10 | * This product contains software technology licensed from Id 11 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 12 | * All Rights Reserved. 13 | * 14 | * Use, distribution, and modification of this source code and/or resulting 15 | * object code is restricted to non-commercial enhancements to products from 16 | * Valve LLC. All other use, distribution, or modification is prohibited 17 | * without written permission from Valve LLC. 18 | * 19 | ****/ 20 | /* 21 | 22 | ===== h_export.cpp ======================================================== 23 | 24 | Entity classes exported by Halflife. 25 | 26 | */ 27 | 28 | #include 29 | 30 | #include 31 | 32 | // From SDK dlls/h_export.cpp: 33 | 34 | //! Holds engine functionality callbacks 35 | enginefuncs_t g_engfuncs; 36 | globalvars_t *gpGlobals; 37 | 38 | // Receive engine function table from engine. 39 | // This appears to be the _first_ DLL routine called by the engine, so we 40 | // do some setup operations here. 41 | void WINAPI GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) 42 | { 43 | memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t)); 44 | gpGlobals = pGlobals; 45 | } 46 | -------------------------------------------------------------------------------- /stub_plugin/info_name.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/stub_plugin/info_name.h -------------------------------------------------------------------------------- /stub_plugin/sdk_util.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // Selected portions of dlls/util.cpp from SDK 2.1. 5 | // Functions copied from there as needed... 6 | // And modified to avoid buffer overflows (argh). 7 | 8 | /*** 9 | * 10 | * Copyright (c) 1999, 2000 Valve LLC. All rights reserved. 11 | * 12 | * This product contains software technology licensed from Id 13 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 14 | * All Rights Reserved. 15 | * 16 | * Use, distribution, and modification of this source code and/or resulting 17 | * object code is restricted to non-commercial enhancements to products from 18 | * Valve LLC. All other use, distribution, or modification is prohibited 19 | * without written permission from Valve LLC. 20 | * 21 | ****/ 22 | /* 23 | 24 | ===== util.cpp ======================================================== 25 | 26 | Utility code. Really not optional after all. 27 | 28 | */ 29 | 30 | #include 31 | #include // ALERT() 32 | 33 | #include "osdep.h" // win32 vsnprintf, etc 34 | 35 | //========================================================= 36 | // UTIL_LogPrintf - Prints a logged message to console. 37 | // Preceded by LOG: ( timestamp ) < message > 38 | //========================================================= 39 | void UTIL_LogPrintf( char *fmt, ... ) 40 | { 41 | va_list argptr; 42 | static char string[1024]; 43 | 44 | va_start ( argptr, fmt ); 45 | vsnprintf ( string, sizeof(string), fmt, argptr ); 46 | va_end ( argptr ); 47 | 48 | // Print to server console 49 | ALERT( at_logged, "%s", string ); 50 | } 51 | -------------------------------------------------------------------------------- /tools/getents.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PATH=/bin:/usr/bin:/sbin:/usr/sbin 3 | 4 | nm -CDg $1 | egrep " T " | egrep -v "::|\(| T [A-Z]| _|type_info|anglemod" | cut -d' ' -f 3,3 5 | -------------------------------------------------------------------------------- /tools/stlfilter: -------------------------------------------------------------------------------- 1 | #!/bin/ksh 2 | # vi: set ts=4 sw=4 : 3 | # vim: set ft=awk : 4 | 5 | nawk ' 6 | BEGIN {ret=0} 7 | $0 ~ "iostream.h:.*[io]stream" {next} 8 | $0 ~ "iostream.h:.*operator=" {next} 9 | $0 ~ "stl_iterator.h:.*::operator" {next} 10 | $0 ~ "stl_bvector.h:.*Bit_(reference|iterator|const_iterator)" {next} 11 | $0 ~ "stl_bvector.h:.*operator=" {next} 12 | $0 ~ "stl_vector.h:.*_Vector" {next} 13 | $0 ~ "instantiated from .(_Vector|vector<)" {next} 14 | $0 ~ "instantiation of .vector<" {next} 15 | $0 ~ "^(In file included| *) from /usr/lib/gcc-lib/i386-linux/.*/include/g\+\+-3/(stl_iterator.h|stl_algobase.h|vector|stl_bvector.h|stl_vector.h):" {next} 16 | $0 ~ "/usr/lib/gcc-lib/i386-linux/.*/include/g\+\+-3/.*: At top level" {next} 17 | $0 ~ " *instantiated from here$" {next} 18 | $0 ~ " from.*:$" {next} 19 | $0 ~ "cc1plus: warnings being treated as errors" {print; next} 20 | $0 ~ "warning:" {ret=1} 21 | $0 ~ "error" {ret=1} 22 | {print} 23 | END {exit(ret)} 24 | ' 25 | ret=$? 26 | echo "stlfilter exiting with $ret" 27 | exit $ret 28 | -------------------------------------------------------------------------------- /trace_plugin/.gitignore: -------------------------------------------------------------------------------- 1 | msgs/ 2 | opt.*/ 3 | debug.*/ 4 | -------------------------------------------------------------------------------- /trace_plugin/Config.mak: -------------------------------------------------------------------------------- 1 | MODNAME = trace_mm 2 | 3 | EXTRA_CFLAGS = -Wno-unused -fno-rtti 4 | 5 | SRCFILES = api_info.cpp dllapi.cpp dllapi_post.cpp engine_api.cpp \ 6 | engine_api_post.cpp h_export.cpp log_plugin.cpp meta_api.cpp \ 7 | plugin.cpp sdk_util.cpp trace_api.cpp vdate.cpp 8 | 9 | LINKED_SRCFILES = sdk_util.cpp api_info.cpp res_meta.rc 10 | LINK_DEST_DIR = ../metamod 11 | 12 | INFOFILES = info_name.h ../metamod/vers_meta.h 13 | RESFILE = res_meta.rc 14 | -------------------------------------------------------------------------------- /trace_plugin/Makefile: -------------------------------------------------------------------------------- 1 | # Since this file is under CVS control and we cannot store 2 | # symbolic links in CVS (and neither under Windows) we 3 | # include the Makefile from the metamod directory instead 4 | # of linking to it. 5 | 6 | include ../metamod/Makefile 7 | -------------------------------------------------------------------------------- /trace_plugin/h_export.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // h_export.cpp - main exported DLL functionality 5 | 6 | // From SDK dlls/h_export.cpp: 7 | 8 | /*** 9 | * 10 | * Copyright (c) 1999, 2000 Valve LLC. All rights reserved. 11 | * 12 | * This product contains software technology licensed from Id 13 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 14 | * All Rights Reserved. 15 | * 16 | * Use, distribution, and modification of this source code and/or resulting 17 | * object code is restricted to non-commercial enhancements to products from 18 | * Valve LLC. All other use, distribution, or modification is prohibited 19 | * without written permission from Valve LLC. 20 | * 21 | ****/ 22 | /* 23 | 24 | ===== h_export.cpp ======================================================== 25 | 26 | Entity classes exported by Halflife. 27 | 28 | */ 29 | 30 | #include 31 | 32 | #include 33 | #include 34 | 35 | //! Holds engine functionality callbacks 36 | enginefuncs_t g_engfuncs; 37 | globalvars_t *gpGlobals; 38 | 39 | // Receive engine function table from engine. 40 | // This appears to be the _first_ DLL routine called by the engine, so we 41 | // do some setup operations here. 42 | void WINAPI GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) 43 | { 44 | memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t)); 45 | gpGlobals = pGlobals; 46 | // NOTE! Have to call logging function _after_ copying into g_engfuncs, so 47 | // that g_engfuncs.pfnAlertMessage() can be resolved properly, heh. :) 48 | UTIL_LogPrintf("[%s] dev: called: GiveFnptrsToDll\n", Plugin_info.logtag); 49 | } 50 | -------------------------------------------------------------------------------- /trace_plugin/info_name.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/trace_plugin/info_name.h -------------------------------------------------------------------------------- /trace_plugin/log_plugin.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // log_plugin.cpp - generic/common logging routines for plugin codebases 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #include // vsnprintf(), etc 38 | #include // va_start(), etc 39 | 40 | #include 41 | #include // ALERT() 42 | 43 | #include 44 | #include 45 | 46 | #include "log_plugin.h" 47 | #include "plugin.h" 48 | 49 | cvar_t *plugin_debug; 50 | 51 | // Setup for logging. We pass the name of the debug cvar so that this 52 | // code can be used by multiple different plugins. 53 | void log_init(const char *cvarname) { 54 | CVAR_REGISTER(&init_plugin_debug); 55 | // Since metamod replaces our cvar_t structure with a structure local 56 | // to metamod when we call CVAR_REGISTER, we have to get the address of 57 | // the new struct if we expect to be able to read/write directly to 58 | // the cvar struct. 59 | plugin_debug=CVAR_GET_POINTER(cvarname); 60 | // Since we haven't read server.cfg yet, allow debug logging (level 3) 61 | // to be enabled with the "+developer" cmdline option. 62 | if((int) CVAR_GET_FLOAT("developer") != 0) 63 | CVAR_SET_FLOAT(cvarname, 3); 64 | } 65 | -------------------------------------------------------------------------------- /trace_plugin/log_plugin.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // log_plugin.h - generic/common logging routines/macros for plugin codebases 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef LOG_PLUGIN_H 38 | #define LOG_PLUGIN_H 39 | 40 | #include // ALERT() 41 | #include // UTIL_VarArgs() 42 | 43 | #include 44 | #include "plugin.h" 45 | 46 | // called as: 47 | // LOG_DEBUG(3, ("return code: %d", ret)); 48 | #define LOG_DEBUG(level, args) \ 49 | do { if(plugin_debug->value >= level) ALERT(at_logged, "[%s] debug(%d): %s\n", Plugin_info.logtag, level, UTIL_VarArgs args ); } while(0) 50 | 51 | // max buffer size for printed messages 52 | #define MAX_LOGMSG_LEN 1024 53 | 54 | extern cvar_t init_plugin_debug; 55 | extern cvar_t *plugin_debug; 56 | 57 | void log_init(const char *cvarname); 58 | 59 | #endif /* LOG_PLUGIN_H */ 60 | -------------------------------------------------------------------------------- /trace_plugin/plugin.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // plugin.cpp - generic plugin operation 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #include 38 | 39 | #include 40 | 41 | #include "plugin.h" 42 | #include "log_plugin.h" 43 | #include "trace_api.h" 44 | 45 | // Must provide at least one of these.. 46 | META_FUNCTIONS gMetaFunctionTable = { 47 | NULL, // pfnGetEntityAPI HL SDK; called before game DLL 48 | NULL, // pfnGetEntityAPI_Post META; called after game DLL 49 | GetEntityAPI2, // pfnGetEntityAPI2 HL SDK2; called before game DLL 50 | GetEntityAPI2_Post, // pfnGetEntityAPI2_Post META; called after game DLL 51 | GetNewDLLFunctions, // pfnGetNewDLLFunctions HL SDK2; called before game DLL 52 | GetNewDLLFunctions_Post, // pfnGetNewDLLFunctions_Post META; called after game DLL 53 | GetEngineFunctions, // pfnGetEngineFunctions META; called before HL engine 54 | GetEngineFunctions_Post, // pfnGetEngineFunctions_Post META; called after HL engine 55 | }; 56 | 57 | cvar_t init_plugin_debug = {"trace_debug", "0", FCVAR_EXTDLL, 0, NULL}; 58 | 59 | 60 | // Meta_Query, any desired checks for valid use. 61 | int plugin_query(void) { 62 | return(TRUE); 63 | } 64 | 65 | // Meta_Attach. Plugin startup. Register commands and cvars. 66 | int plugin_attach(void) { 67 | log_init("trace_debug"); 68 | trace_init(); 69 | return(TRUE); 70 | } 71 | 72 | // Meta_Detach. Cleaning up. 73 | int plugin_detach(void) { 74 | return(TRUE); 75 | } 76 | -------------------------------------------------------------------------------- /trace_plugin/plugin.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // plugin.h - generic plugin framework 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef PLUGIN_H 38 | #define PLUGIN_H 39 | 40 | int plugin_query(void); 41 | int plugin_attach(void); 42 | int plugin_detach(void); 43 | 44 | #endif /* PLUGIN_H */ 45 | -------------------------------------------------------------------------------- /trace_plugin/res_meta.rc: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 ft=c : 2 | // vim: set tw=75 : 3 | 4 | /* 5 | * Copyright (c) 2001-2003 Will Day 6 | * 7 | * This file is part of Metamod. 8 | * 9 | * Metamod is free software; you can redistribute it and/or modify it 10 | * under the terms of the GNU General Public License as published by the 11 | * Free Software Foundation; either version 2 of the License, or (at 12 | * your option) any later version. 13 | * 14 | * Metamod is distributed in the hope that it will be useful, but 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Metamod; if not, write to the Free Software Foundation, 21 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | * 23 | * In addition, as a special exception, the author gives permission to 24 | * link the code of this program with the Half-Life Game Engine ("HL 25 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 26 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 27 | * respects for all of the code used other than the HL Engine and MODs 28 | * from Valve. If you modify this file, you may extend this exception 29 | * to your version of the file, but you are not obligated to do so. If 30 | * you do not wish to do so, delete this exception statement from your 31 | * version. 32 | * 33 | */ 34 | 35 | // see: 36 | // http://msdn.microsoft.com/library/psdk/winui/rc_7x2d.htm 37 | 38 | #include 39 | #include "info_name.h" 40 | 41 | VS_VERSION_INFO VERSIONINFO 42 | FILEVERSION RC_VERS_DWORD 43 | PRODUCTVERSION RC_VERS_DWORD 44 | FILEFLAGSMASK 0x3fL 45 | #ifdef _DEBUG 46 | FILEFLAGS VS_FF_DEBUG 47 | #else 48 | FILEFLAGS 0x0L 49 | #endif 50 | FILEOS VOS__WINDOWS32 51 | FILETYPE VFT_DLL 52 | FILESUBTYPE VFT2_UNKNOWN 53 | BEGIN 54 | BLOCK "StringFileInfo" 55 | BEGIN 56 | BLOCK "040904b0" 57 | BEGIN 58 | VALUE "Comments", RC_COMMENTS "\0" 59 | VALUE "CompanyName", VAUTHOR "\0" 60 | VALUE "FileDescription", RC_DESC "\0" 61 | VALUE "FileVersion", VVERSION "\0" 62 | VALUE "InternalName", RC_INTERNAL "\0" 63 | VALUE "LegalCopyright", RC_COPYRIGHT "\0" 64 | VALUE "LegalTrademarks", "\0" 65 | VALUE "OriginalFilename", RC_FILENAME "\0" 66 | VALUE "PrivateBuild", "\0" 67 | VALUE "ProductName", VNAME "\0" 68 | VALUE "ProductVersion", VVERSION "\0" 69 | VALUE "SpecialBuild", OPT_TYPE "\0" 70 | END 71 | END 72 | BLOCK "VarFileInfo" 73 | BEGIN 74 | VALUE "Translation", 0x409, 1200 75 | END 76 | END 77 | -------------------------------------------------------------------------------- /trace_plugin/trace_api.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // trace_api.h - (main) description of HL API tracing operations 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef TRACE_API_H 38 | #define TRACE_API_H 39 | 40 | #include // time() 41 | 42 | #include // ALERT() 43 | #include // UTIL_VarArgs() 44 | 45 | #include "api_info.h" 46 | 47 | #define API_TRACE(api_info_table, cvar_trace, api_str, pfnName, post, args) \ 48 | do { if((cvar_trace->value >= api_info_table.pfnName.loglevel || api_info_table.pfnName.trace) && (unlimit_trace->value || (last_trace_log != time(NULL)))) { \ 49 | ALERT(at_logged, "[%s] %s(%d): called: %s%s; %s\n", \ 50 | Plugin_info.logtag, api_str, \ 51 | api_info_table.pfnName.loglevel, \ 52 | api_info_table.pfnName.name, \ 53 | (post ? "_Post" : ""), \ 54 | UTIL_VarArgs args ); \ 55 | last_trace_log=time(NULL); \ 56 | } \ 57 | } while(0) 58 | 59 | #define DLL_TRACE(pfnName, post, args) \ 60 | API_TRACE(dllapi_info, dllapi_trace, "dllapi", pfnName, post, args) 61 | 62 | #define NEWDLL_TRACE(pfnName, post, args) \ 63 | API_TRACE(newapi_info, newapi_trace, "newapi", pfnName, post, args) 64 | 65 | #define ENGINE_TRACE(pfnName, post, args) \ 66 | API_TRACE(engine_info, engine_trace, "engine", pfnName, post, args) 67 | 68 | typedef enum { 69 | TR_FAILURE = 0, 70 | TR_SUCCESS, 71 | TR_ALREADY, 72 | } TRACE_RESULT; 73 | 74 | #define MAX_REG_MESSAGES 256 75 | 76 | extern time_t last_trace_log; 77 | 78 | extern const char *msg_dest_types[32]; 79 | 80 | extern cvar_t init_dllapi_trace; 81 | extern cvar_t init_newapi_trace; 82 | extern cvar_t init_engine_trace; 83 | extern cvar_t init_unlimit_trace; 84 | 85 | extern cvar_t *dllapi_trace; 86 | extern cvar_t *newapi_trace; 87 | extern cvar_t *engine_trace; 88 | extern cvar_t *unlimit_trace; 89 | 90 | void trace_init(void); 91 | 92 | void svr_trace(void); 93 | void cmd_trace_usage(void); 94 | void cmd_trace_version(void); 95 | void cmd_trace_set(void); 96 | void cmd_trace_unset(void); 97 | void cmd_trace_show(void); 98 | void cmd_trace_list(void); 99 | 100 | TRACE_RESULT trace_setflag(const char **pfn_string, mBOOL flagval, const char **api); 101 | 102 | #endif /* TRACE_API_H */ 103 | -------------------------------------------------------------------------------- /trace_plugin/vdate.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // vdate.cpp - compile-time version date 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #include "info_name.h" // for VNAME, VVERSION, etc 38 | 39 | 40 | // Grab data/time of compile. The Makefile is set up to recompile this 41 | // module before each link, so that this will always indicate the time the 42 | // library was compiled and linked. 43 | 44 | // This is in a separate file from vers_*, so it can be generically used by 45 | // multiple projects. 46 | 47 | char const *COMPILE_TIME=__DATE__ ", " __TIME__; 48 | 49 | // Include a string for /usr/bin/ident. 50 | 51 | char const *vstring="$Pg: " VNAME " -- " VVERSION " | " __DATE__ " - " __TIME__ " $"; 52 | -------------------------------------------------------------------------------- /wdmisc_plugin/.gitignore: -------------------------------------------------------------------------------- 1 | msgs/ 2 | opt.*/ 3 | debug.*/ 4 | -------------------------------------------------------------------------------- /wdmisc_plugin/Config.mak: -------------------------------------------------------------------------------- 1 | MODNAME = wdmisc_mm 2 | 3 | EXTRA_CFLAGS = 4 | 5 | SRCFILES = dll_plugin.cpp engine_api.cpp h_export.cpp log_plugin.cpp \ 6 | meta_api.cpp sdk_util.cpp vdate.cpp \ 7 | wdmisc.cpp 8 | 9 | LINKED_SRCFILES = sdk_util.cpp res_meta.rc 10 | LINK_DEST_DIR = ../metamod 11 | 12 | INFOFILES = info_name.h ../metamod/vers_meta.h 13 | RESFILE = res_meta.rc 14 | -------------------------------------------------------------------------------- /wdmisc_plugin/Makefile: -------------------------------------------------------------------------------- 1 | # Since this file is under CVS control and we cannot store 2 | # symbolic links in CVS (and neither under Windows) we 3 | # include the Makefile from the metamod directory instead 4 | # of linking to it. 5 | 6 | include ../metamod/Makefile 7 | -------------------------------------------------------------------------------- /wdmisc_plugin/dll_plugin.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // dll_plugin.h - prototypes and typedefs plugin's HL DLL routines 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef DLL_PLUGIN_H 38 | #define DLL_PLUGIN_H 39 | 40 | #include // BOOL 41 | #include // FN_* 42 | 43 | void wd_ServerDeactivate(void); 44 | 45 | #endif /* DLL_PLUGIN_H */ 46 | -------------------------------------------------------------------------------- /wdmisc_plugin/engine_api.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // engine_api.cpp - implementation of Half-Life engine functions 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #include 38 | #include 39 | 40 | #include 41 | 42 | #include "engine_api.h" 43 | #include "meta_api.h" 44 | #include "log_plugin.h" 45 | 46 | enginefuncs_t meta_engfuncs; 47 | 48 | C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, 49 | int *interfaceVersion) 50 | { 51 | LOG_DEVELOPER(PLID, "called: GetEngineFunctions; version=%d", 52 | *interfaceVersion); 53 | if(!pengfuncsFromEngine) { 54 | LOG_ERROR(PLID, 55 | "GetEngineFunctions called with null pengfuncsFromEngine"); 56 | return(FALSE); 57 | } 58 | else if(*interfaceVersion != ENGINE_INTERFACE_VERSION) { 59 | LOG_ERROR(PLID, 60 | "GetEngineFunctions version mismatch; requested=%d ours=%d", 61 | *interfaceVersion, ENGINE_INTERFACE_VERSION); 62 | // Tell metamod what version we had, so it can figure out who is 63 | // out of date. 64 | *interfaceVersion = ENGINE_INTERFACE_VERSION; 65 | return(FALSE); 66 | } 67 | memcpy(pengfuncsFromEngine, &meta_engfuncs, sizeof(enginefuncs_t)); 68 | return TRUE; 69 | } 70 | -------------------------------------------------------------------------------- /wdmisc_plugin/h_export.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // h_export.cpp - main exported DLL functionality 5 | 6 | // From SDK dlls/h_export.cpp: 7 | 8 | /*** 9 | * 10 | * Copyright (c) 1999, 2000 Valve LLC. All rights reserved. 11 | * 12 | * This product contains software technology licensed from Id 13 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 14 | * All Rights Reserved. 15 | * 16 | * Use, distribution, and modification of this source code and/or resulting 17 | * object code is restricted to non-commercial enhancements to products from 18 | * Valve LLC. All other use, distribution, or modification is prohibited 19 | * without written permission from Valve LLC. 20 | * 21 | ****/ 22 | /* 23 | 24 | ===== h_export.cpp ======================================================== 25 | 26 | Entity classes exported by Halflife. 27 | 28 | */ 29 | 30 | #include 31 | 32 | #include 33 | #include 34 | 35 | //! Holds engine functionality callbacks 36 | enginefuncs_t g_engfuncs; 37 | globalvars_t *gpGlobals; 38 | 39 | // Receive engine function table from engine. 40 | // This appears to be the _first_ DLL routine called by the engine, so we 41 | // do some setup operations here. 42 | void WINAPI GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) 43 | { 44 | memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t)); 45 | gpGlobals = pGlobals; 46 | // NOTE! Have to call logging function _after_ copying into g_engfuncs, so 47 | // that g_engfuncs.pfnAlertMessage() can be resolved properly, heh. :) 48 | UTIL_LogPrintf("[%s] dev: called: GiveFnptrsToDll\n", Plugin_info.logtag); 49 | } 50 | -------------------------------------------------------------------------------- /wdmisc_plugin/info_name.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mittorn/metamod-p/055b9eb2739dc586e8e9752c1e0e3fa058284b7d/wdmisc_plugin/info_name.h -------------------------------------------------------------------------------- /wdmisc_plugin/log_plugin.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // log_plugin.cpp - generic/common logging routines for plugin codebases 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #include // vsnprintf(), etc 38 | #include // va_start(), etc 39 | 40 | #include 41 | #include // ALERT() 42 | 43 | #include 44 | #include 45 | 46 | #include "log_plugin.h" 47 | #include "plugin.h" 48 | 49 | cvar_t *plugin_debug; 50 | 51 | // Setup for logging. We pass the name of the debug cvar so that this 52 | // code can be used by multiple different plugins. 53 | void log_init(const char *cvarname) { 54 | CVAR_REGISTER(&init_plugin_debug); 55 | // Since metamod replaces our cvar_t structure with a structure local 56 | // to metamod when we call CVAR_REGISTER, we have to get the address of 57 | // the new struct if we expect to be able to read/write directly to 58 | // the cvar struct. 59 | plugin_debug=CVAR_GET_POINTER(cvarname); 60 | // Since we haven't read server.cfg yet, allow debug logging (level 3) 61 | // to be enabled with the "+developer" cmdline option. 62 | if((int) CVAR_GET_FLOAT("developer") != 0) 63 | CVAR_SET_FLOAT(cvarname, 3); 64 | } 65 | -------------------------------------------------------------------------------- /wdmisc_plugin/log_plugin.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // log_plugin.h - generic/common logging routines/macros for plugin codebases 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef LOG_PLUGIN_H 38 | #define LOG_PLUGIN_H 39 | 40 | #include // ALERT() 41 | #include // UTIL_VarArgs() 42 | 43 | #include 44 | #include "plugin.h" 45 | 46 | // called as: 47 | // LOG_DEBUG(3, ("return code: %d", ret)); 48 | #define LOG_DEBUG(level, args) \ 49 | do { if(plugin_debug->value >= level) ALERT(at_logged, "[%s] debug(%d): %s\n", Plugin_info.logtag, level, UTIL_VarArgs args ); } while(0) 50 | 51 | // max buffer size for printed messages 52 | #define MAX_LOGMSG_LEN 1024 53 | 54 | extern cvar_t init_plugin_debug; 55 | extern cvar_t *plugin_debug; 56 | 57 | void log_init(const char *cvarname); 58 | 59 | #endif /* LOG_PLUGIN_H */ 60 | -------------------------------------------------------------------------------- /wdmisc_plugin/plugin.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // plugin.h - generic plugin framework 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef PLUGIN_H 38 | #define PLUGIN_H 39 | 40 | int plugin_query(void); 41 | int plugin_attach(void); 42 | int plugin_detach(void); 43 | 44 | #endif /* PLUGIN_H */ 45 | -------------------------------------------------------------------------------- /wdmisc_plugin/res_meta.rc: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 ft=c : 2 | // vim: set tw=75 : 3 | 4 | /* 5 | * Copyright (c) 2001-2003 Will Day 6 | * 7 | * This file is part of Metamod. 8 | * 9 | * Metamod is free software; you can redistribute it and/or modify it 10 | * under the terms of the GNU General Public License as published by the 11 | * Free Software Foundation; either version 2 of the License, or (at 12 | * your option) any later version. 13 | * 14 | * Metamod is distributed in the hope that it will be useful, but 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Metamod; if not, write to the Free Software Foundation, 21 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | * 23 | * In addition, as a special exception, the author gives permission to 24 | * link the code of this program with the Half-Life Game Engine ("HL 25 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 26 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 27 | * respects for all of the code used other than the HL Engine and MODs 28 | * from Valve. If you modify this file, you may extend this exception 29 | * to your version of the file, but you are not obligated to do so. If 30 | * you do not wish to do so, delete this exception statement from your 31 | * version. 32 | * 33 | */ 34 | 35 | // see: 36 | // http://msdn.microsoft.com/library/psdk/winui/rc_7x2d.htm 37 | 38 | #include 39 | #include "info_name.h" 40 | 41 | VS_VERSION_INFO VERSIONINFO 42 | FILEVERSION RC_VERS_DWORD 43 | PRODUCTVERSION RC_VERS_DWORD 44 | FILEFLAGSMASK 0x3fL 45 | #ifdef _DEBUG 46 | FILEFLAGS VS_FF_DEBUG 47 | #else 48 | FILEFLAGS 0x0L 49 | #endif 50 | FILEOS VOS__WINDOWS32 51 | FILETYPE VFT_DLL 52 | FILESUBTYPE VFT2_UNKNOWN 53 | BEGIN 54 | BLOCK "StringFileInfo" 55 | BEGIN 56 | BLOCK "040904b0" 57 | BEGIN 58 | VALUE "Comments", RC_COMMENTS "\0" 59 | VALUE "CompanyName", VAUTHOR "\0" 60 | VALUE "FileDescription", RC_DESC "\0" 61 | VALUE "FileVersion", VVERSION "\0" 62 | VALUE "InternalName", RC_INTERNAL "\0" 63 | VALUE "LegalCopyright", RC_COPYRIGHT "\0" 64 | VALUE "LegalTrademarks", "\0" 65 | VALUE "OriginalFilename", RC_FILENAME "\0" 66 | VALUE "PrivateBuild", "\0" 67 | VALUE "ProductName", VNAME "\0" 68 | VALUE "ProductVersion", VVERSION "\0" 69 | VALUE "SpecialBuild", OPT_TYPE "\0" 70 | END 71 | END 72 | BLOCK "VarFileInfo" 73 | BEGIN 74 | VALUE "Translation", 0x409, 1200 75 | END 76 | END 77 | -------------------------------------------------------------------------------- /wdmisc_plugin/vdate.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // vdate.cpp - compile-time version date 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #include "info_name.h" // for VNAME, VVERSION, etc 38 | 39 | 40 | // Grab data/time of compile. The Makefile is set up to recompile this 41 | // module before each link, so that this will always indicate the time the 42 | // library was compiled and linked. 43 | 44 | // This is in a separate file from vers_*, so it can be generically used by 45 | // multiple projects. 46 | 47 | char const *COMPILE_TIME=__DATE__ ", " __TIME__; 48 | 49 | // Include a string for /usr/bin/ident. 50 | 51 | char const *vstring="$Pg: " VNAME " -- " VVERSION " | " __DATE__ " - " __TIME__ " $"; 52 | -------------------------------------------------------------------------------- /wdmisc_plugin/wdmisc.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // wdmisc.h - wdmisc routines 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef WDMISC_H 38 | #define WDMISC_H 39 | 40 | void do_my_getengfuncs(void); 41 | 42 | void bounce_init(void); 43 | void bounce_check(void); 44 | 45 | void wd_AlertMessage(ALERT_TYPE atype, char *szFmt, ...); 46 | 47 | void wd_msglist(void); 48 | void wd_msgid(void); 49 | void wd_testit(void); 50 | 51 | #endif /* WDMISC_H */ 52 | --------------------------------------------------------------------------------