|
darope@0
|
1 |
// vi: set ts=4 sw=4 : |
|
darope@0
|
2 |
// vim: set tw=75 : |
|
darope@0
|
3 |
|
|
darope@0
|
4 |
// dllapi.cpp - implementation of Half-Life DLL routines |
|
darope@0
|
5 |
|
|
darope@0
|
6 |
/* |
|
darope@0
|
7 |
* Copyright (c) 2001-2003 Will Day <[email protected]> |
|
darope@0
|
8 |
* |
|
darope@0
|
9 |
* This file is part of Metamod. |
|
darope@0
|
10 |
* |
|
darope@0
|
11 |
* Metamod is free software; you can redistribute it and/or modify it |
|
darope@0
|
12 |
* under the terms of the GNU General Public License as published by the |
|
darope@0
|
13 |
* Free Software Foundation; either version 2 of the License, or (at |
|
darope@0
|
14 |
* your option) any later version. |
|
darope@0
|
15 |
* |
|
darope@0
|
16 |
* Metamod is distributed in the hope that it will be useful, but |
|
darope@0
|
17 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
|
darope@0
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
darope@0
|
19 |
* General Public License for more details. |
|
darope@0
|
20 |
* |
|
darope@0
|
21 |
* You should have received a copy of the GNU General Public License |
|
darope@0
|
22 |
* along with Metamod; if not, write to the Free Software Foundation, |
|
darope@0
|
23 |
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
darope@0
|
24 |
* |
|
darope@0
|
25 |
* In addition, as a special exception, the author gives permission to |
|
darope@0
|
26 |
* link the code of this program with the Half-Life Game Engine ("HL |
|
darope@0
|
27 |
* Engine") and Modified Game Libraries ("MODs") developed by Valve, |
|
darope@0
|
28 |
* L.L.C ("Valve"). You must obey the GNU General Public License in all |
|
darope@0
|
29 |
* respects for all of the code used other than the HL Engine and MODs |
|
darope@0
|
30 |
* from Valve. If you modify this file, you may extend this exception |
|
darope@0
|
31 |
* to your version of the file, but you are not obligated to do so. If |
|
darope@0
|
32 |
* you do not wish to do so, delete this exception statement from your |
|
darope@0
|
33 |
* version. |
|
darope@0
|
34 |
* |
|
darope@0
|
35 |
*/ |
|
darope@0
|
36 |
|
|
darope@0
|
37 |
#include <extdll.h> |
|
darope@0
|
38 |
#include <sdk_util.h> |
|
darope@0
|
39 |
#include <cbase.h> |
|
darope@0
|
40 |
#include <player.h> |
|
darope@0
|
41 |
|
|
darope@0
|
42 |
#include <dllapi.h> |
|
darope@0
|
43 |
#include <meta_api.h> |
|
darope@0
|
44 |
#include <sdk_util.h> |
|
darope@0
|
45 |
|
|
darope@0
|
46 |
#include "trace_api.h" |
|
darope@0
|
47 |
#include "log_plugin.h" |
|
darope@0
|
48 |
|
|
darope@0
|
49 |
// from SDK dlls/game.cpp: |
|
darope@0
|
50 |
void GameDLLInit( void ) { |
|
darope@0
|
51 |
DLL_TRACE(pfnGameInit, P_PRE, ("")); |
|
darope@0
|
52 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
53 |
} |
|
darope@0
|
54 |
|
|
darope@0
|
55 |
// from SDK dlls/cbase.cpp: |
|
darope@0
|
56 |
int DispatchSpawn( edict_t *pent ) { |
|
darope@0
|
57 |
edict_t *ed=pent; |
|
darope@0
|
58 |
DLL_TRACE(pfnSpawn, P_PRE, ("classname=%s", |
|
darope@0
|
59 |
ed ? STRING(ed->v.classname) : "nil")); |
|
darope@0
|
60 |
// 0==Success, -1==Failure ? |
|
darope@0
|
61 |
RETURN_META_VALUE(MRES_IGNORED, 0); |
|
darope@0
|
62 |
} |
|
darope@0
|
63 |
void DispatchThink( edict_t *pent ) { |
|
darope@0
|
64 |
DLL_TRACE(pfnThink, P_PRE, ("")); |
|
darope@0
|
65 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
66 |
} |
|
darope@0
|
67 |
void DispatchUse( edict_t *pentUsed, edict_t *pentOther ) { |
|
darope@0
|
68 |
DLL_TRACE(pfnUse, P_PRE, ("")); |
|
darope@0
|
69 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
70 |
} |
|
darope@0
|
71 |
void DispatchTouch( edict_t *pentTouched, edict_t *pentOther ) { |
|
darope@0
|
72 |
DLL_TRACE(pfnTouch, P_PRE, ("")); |
|
darope@0
|
73 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
74 |
} |
|
darope@0
|
75 |
void DispatchBlocked( edict_t *pentBlocked, edict_t *pentOther ) { |
|
darope@0
|
76 |
DLL_TRACE(pfnBlocked, P_PRE, ("")); |
|
darope@0
|
77 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
78 |
} |
|
darope@0
|
79 |
void DispatchKeyValue( edict_t *pentKeyvalue, KeyValueData *pkvd ) { |
|
darope@0
|
80 |
DLL_TRACE(pfnKeyValue, P_PRE, ("classname=%s keyname=%s value=%s", P_PRE, |
|
darope@0
|
81 |
pkvd->szClassName, pkvd->szKeyName, pkvd->szValue)); |
|
darope@0
|
82 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
83 |
} |
|
darope@0
|
84 |
void DispatchSave( edict_t *pent, SAVERESTOREDATA *pSaveData ) { |
|
darope@0
|
85 |
DLL_TRACE(pfnSave, P_PRE, ("")); |
|
darope@0
|
86 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
87 |
} |
|
darope@0
|
88 |
int DispatchRestore( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity ) { |
|
darope@0
|
89 |
DLL_TRACE(pfnRestore, P_PRE, ("")); |
|
darope@0
|
90 |
// 0==Success, -1==Failure ? |
|
darope@0
|
91 |
RETURN_META_VALUE(MRES_IGNORED, 0); |
|
darope@0
|
92 |
} |
|
darope@0
|
93 |
void DispatchObjectCollsionBox( edict_t *pent ) { |
|
darope@0
|
94 |
edict_t *ed=pent; |
|
darope@0
|
95 |
DLL_TRACE(pfnSetAbsBox, P_PRE, ("classname=%s netname=%s", |
|
darope@0
|
96 |
ed ? STRING(ed->v.classname) : "nil", |
|
darope@0
|
97 |
ed ? STRING(ed->v.netname) : "nil")); |
|
darope@0
|
98 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
99 |
} |
|
darope@0
|
100 |
void SaveWriteFields( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount ) { |
|
darope@0
|
101 |
DLL_TRACE(pfnSaveWriteFields, P_PRE, ("")); |
|
darope@0
|
102 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
103 |
} |
|
darope@0
|
104 |
void SaveReadFields( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount ) { |
|
darope@0
|
105 |
DLL_TRACE(pfnSaveReadFields, P_PRE, ("")); |
|
darope@0
|
106 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
107 |
} |
|
darope@0
|
108 |
|
|
darope@0
|
109 |
// from SDK dlls/world.cpp: |
|
darope@0
|
110 |
void SaveGlobalState( SAVERESTOREDATA *pSaveData ) { |
|
darope@0
|
111 |
DLL_TRACE(pfnSaveGlobalState, P_PRE, ("")); |
|
darope@0
|
112 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
113 |
} |
|
darope@0
|
114 |
void RestoreGlobalState( SAVERESTOREDATA *pSaveData ) { |
|
darope@0
|
115 |
DLL_TRACE(pfnRestoreGlobalState, P_PRE, ("")); |
|
darope@0
|
116 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
117 |
} |
|
darope@0
|
118 |
void ResetGlobalState( void ) { |
|
darope@0
|
119 |
DLL_TRACE(pfnResetGlobalState, P_PRE, ("")); |
|
darope@0
|
120 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
121 |
} |
|
darope@0
|
122 |
|
|
darope@0
|
123 |
//! from SDK dlls/client.cpp: |
|
darope@0
|
124 |
BOOL ClientConnect( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ) { |
|
darope@0
|
125 |
DLL_TRACE(pfnClientConnect, P_PRE, ("name=%s, addr=%s", pszName, pszAddress)); |
|
darope@0
|
126 |
RETURN_META_VALUE(MRES_IGNORED, FALSE); |
|
darope@0
|
127 |
} |
|
darope@0
|
128 |
void ClientDisconnect( edict_t *pEntity ) { |
|
darope@0
|
129 |
// DLL_TRACE(pfnClientDisconnect, P_PRE, ("name=%s", ENTITY_KEYVALUE(pEntity, "name"))); |
|
darope@0
|
130 |
DLL_TRACE(pfnClientDisconnect, P_PRE, ("name=%s", STRING(pEntity->v.netname))); |
|
darope@0
|
131 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
132 |
} |
|
darope@0
|
133 |
void ClientKill( edict_t *pEntity ) { |
|
darope@0
|
134 |
DLL_TRACE(pfnClientKill, P_PRE, ("name=%s", STRING(pEntity->v.netname))); |
|
darope@0
|
135 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
136 |
} |
|
darope@0
|
137 |
void ClientPutInServer( edict_t *pEntity ) { |
|
darope@0
|
138 |
CBaseEntity *pPlayer=NULL; |
|
darope@0
|
139 |
pPlayer=(CBasePlayer*)GET_PRIVATE(pEntity); |
|
darope@0
|
140 |
DLL_TRACE(pfnClientPutInServer, P_PRE, ("name=%s", STRING(pEntity->v.netname))); |
|
darope@0
|
141 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
142 |
} |
|
darope@0
|
143 |
void ClientCommand( edict_t *pEntity ) { |
|
darope@0
|
144 |
DLL_TRACE(pfnClientCommand, P_PRE, ("name=%s, cmd='%s %s'", STRING(pEntity->v.netname), CMD_ARGV(0), |
|
darope@0
|
145 |
CMD_ARGC() >= 1 ? CMD_ARGS() : "")); |
|
darope@0
|
146 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
147 |
} |
|
darope@0
|
148 |
void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer ) { |
|
darope@0
|
149 |
DLL_TRACE(pfnClientUserInfoChanged, P_PRE, ("name=%s", STRING(pEntity->v.netname))); |
|
darope@0
|
150 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
151 |
} |
|
darope@0
|
152 |
void ServerActivate( edict_t *pEdictList, int edictCount, int clientMax ) { |
|
darope@0
|
153 |
DLL_TRACE(pfnServerActivate, P_PRE, ("count=%d, max=%d", edictCount, clientMax)); |
|
darope@0
|
154 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
155 |
} |
|
darope@0
|
156 |
void ServerDeactivate( void ) { |
|
darope@0
|
157 |
DLL_TRACE(pfnServerDeactivate, P_PRE, ("")); |
|
darope@0
|
158 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
159 |
} |
|
darope@0
|
160 |
void PlayerPreThink( edict_t *pEntity ) { |
|
darope@0
|
161 |
DLL_TRACE(pfnPlayerPreThink, P_PRE, ("name=%s", STRING(pEntity->v.netname))); |
|
darope@0
|
162 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
163 |
} |
|
darope@0
|
164 |
void PlayerPostThink( edict_t *pEntity ) { |
|
darope@0
|
165 |
DLL_TRACE(pfnPlayerPostThink, P_PRE, ("name=%s", STRING(pEntity->v.netname))); |
|
darope@0
|
166 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
167 |
} |
|
darope@0
|
168 |
void StartFrame( void ) { |
|
darope@0
|
169 |
DLL_TRACE(pfnStartFrame, P_PRE, ("")); |
|
darope@0
|
170 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
171 |
} |
|
darope@0
|
172 |
void ParmsNewLevel( void ) { |
|
darope@0
|
173 |
DLL_TRACE(pfnParmsNewLevel, P_PRE, ("")); |
|
darope@0
|
174 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
175 |
} |
|
darope@0
|
176 |
void ParmsChangeLevel( void ) { |
|
darope@0
|
177 |
DLL_TRACE(pfnParmsChangeLevel, P_PRE, ("")); |
|
darope@0
|
178 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
179 |
} |
|
darope@0
|
180 |
const char *GetGameDescription( void ) { |
|
darope@0
|
181 |
DLL_TRACE(pfnGetGameDescription, P_PRE, ("")); |
|
darope@0
|
182 |
RETURN_META_VALUE(MRES_IGNORED, ""); |
|
darope@0
|
183 |
} |
|
darope@0
|
184 |
void PlayerCustomization( edict_t *pEntity, customization_t *pCust ) { |
|
darope@0
|
185 |
DLL_TRACE(pfnPlayerCustomization, P_PRE, ("name=%s", STRING(pEntity->v.netname))); |
|
darope@0
|
186 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
187 |
} |
|
darope@0
|
188 |
void SpectatorConnect( edict_t *pEntity ) { |
|
darope@0
|
189 |
DLL_TRACE(pfnSpectatorConnect, P_PRE, ("")); |
|
darope@0
|
190 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
191 |
} |
|
darope@0
|
192 |
void SpectatorDisconnect( edict_t *pEntity ) { |
|
darope@0
|
193 |
DLL_TRACE(pfnSpectatorDisconnect, P_PRE, ("")); |
|
darope@0
|
194 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
195 |
} |
|
darope@0
|
196 |
void SpectatorThink( edict_t *pEntity ) { |
|
darope@0
|
197 |
DLL_TRACE(pfnSpectatorThink, P_PRE, ("")); |
|
darope@0
|
198 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
199 |
} |
|
darope@0
|
200 |
void Sys_Error( const char *error_string ) { |
|
darope@0
|
201 |
DLL_TRACE(pfnSys_Error, P_PRE, ("string=%s", error_string)); |
|
darope@0
|
202 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
203 |
} |
|
darope@0
|
204 |
|
|
darope@0
|
205 |
// from SDK pm_shared/pm_shared.c: |
|
darope@0
|
206 |
void PM_Move ( struct playermove_s *ppmove, int server ) { |
|
darope@0
|
207 |
DLL_TRACE(pfnPM_Move, P_PRE, ("")); |
|
darope@0
|
208 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
209 |
} |
|
darope@0
|
210 |
void PM_Init( struct playermove_s *ppmove ) { |
|
darope@0
|
211 |
DLL_TRACE(pfnPM_Init, P_PRE, ("")); |
|
darope@0
|
212 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
213 |
} |
|
darope@0
|
214 |
char PM_FindTextureType( char *name ) { |
|
darope@0
|
215 |
DLL_TRACE(pfnPM_FindTextureType, P_PRE, ("name=%s", name)); |
|
darope@0
|
216 |
RETURN_META_VALUE(MRES_IGNORED, '\0'); |
|
darope@0
|
217 |
} |
|
darope@0
|
218 |
|
|
darope@0
|
219 |
// from SDK dlls/client.cpp: |
|
darope@0
|
220 |
void SetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas ) { |
|
darope@0
|
221 |
DLL_TRACE(pfnSetupVisibility, P_PRE, ("")); |
|
darope@0
|
222 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
223 |
} |
|
darope@0
|
224 |
void UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd ) { |
|
darope@0
|
225 |
DLL_TRACE(pfnUpdateClientData, P_PRE, ("")); |
|
darope@0
|
226 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
227 |
} |
|
darope@0
|
228 |
int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet ) { |
|
darope@0
|
229 |
DLL_TRACE(pfnAddToFullPack, P_PRE, ("")); |
|
darope@0
|
230 |
RETURN_META_VALUE(MRES_IGNORED, 0); |
|
darope@0
|
231 |
} |
|
darope@0
|
232 |
void CreateBaseline( int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs ) { |
|
darope@0
|
233 |
DLL_TRACE(pfnCreateBaseline, P_PRE, ("")); |
|
darope@0
|
234 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
235 |
} |
|
darope@0
|
236 |
void RegisterEncoders( void ) { |
|
darope@0
|
237 |
DLL_TRACE(pfnRegisterEncoders, P_PRE, ("")); |
|
darope@0
|
238 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
239 |
} |
|
darope@0
|
240 |
int GetWeaponData( struct edict_s *player, struct weapon_data_s *info ) { |
|
darope@0
|
241 |
DLL_TRACE(pfnGetWeaponData, P_PRE, ("")); |
|
darope@0
|
242 |
RETURN_META_VALUE(MRES_IGNORED, 1); |
|
darope@0
|
243 |
} |
|
darope@0
|
244 |
void CmdStart( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed ) { |
|
darope@0
|
245 |
DLL_TRACE(pfnCmdStart, P_PRE, ("name=%s, rand=%d", STRING(player->v.netname), random_seed)); |
|
darope@0
|
246 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
247 |
} |
|
darope@0
|
248 |
void CmdEnd ( const edict_t *player ) { |
|
darope@0
|
249 |
DLL_TRACE(pfnCmdEnd, P_PRE, ("name=%s", STRING(player->v.netname))); |
|
darope@0
|
250 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
251 |
} |
|
darope@0
|
252 |
int ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size ) { |
|
darope@0
|
253 |
DLL_TRACE(pfnConnectionlessPacket, P_PRE, ("")); |
|
darope@0
|
254 |
RETURN_META_VALUE(MRES_IGNORED, 0); |
|
darope@0
|
255 |
} |
|
darope@0
|
256 |
int GetHullBounds( int hullnumber, float *mins, float *maxs ) { |
|
darope@0
|
257 |
DLL_TRACE(pfnGetHullBounds, P_PRE, ("")); |
|
darope@0
|
258 |
RETURN_META_VALUE(MRES_IGNORED, 0); |
|
darope@0
|
259 |
} |
|
darope@0
|
260 |
void CreateInstancedBaselines ( void ) { |
|
darope@0
|
261 |
DLL_TRACE(pfnCreateInstancedBaselines, P_PRE, ("")); |
|
darope@0
|
262 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
263 |
} |
|
darope@0
|
264 |
int InconsistentFile( const edict_t *player, const char *filename, char *disconnect_message ) { |
|
darope@0
|
265 |
DLL_TRACE(pfnInconsistentFile, P_PRE, ("name=%s, file=%s", STRING(player->v.netname), filename)); |
|
darope@0
|
266 |
RETURN_META_VALUE(MRES_IGNORED, 0); |
|
darope@0
|
267 |
} |
|
darope@0
|
268 |
int AllowLagCompensation( void ) { |
|
darope@0
|
269 |
DLL_TRACE(pfnAllowLagCompensation, P_PRE, ("")); |
|
darope@0
|
270 |
RETURN_META_VALUE(MRES_IGNORED, 1); |
|
darope@0
|
271 |
} |
|
darope@0
|
272 |
|
|
darope@0
|
273 |
|
|
darope@0
|
274 |
// from SDK ? |
|
darope@0
|
275 |
void OnFreeEntPrivateData(edict_t *pEnt) { |
|
darope@0
|
276 |
NEWDLL_TRACE(pfnOnFreeEntPrivateData, P_PRE, ("")); |
|
darope@0
|
277 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
278 |
} |
|
darope@0
|
279 |
void GameShutdown(void) { |
|
darope@0
|
280 |
NEWDLL_TRACE(pfnGameShutdown, P_PRE, ("")); |
|
darope@0
|
281 |
RETURN_META(MRES_IGNORED); |
|
darope@0
|
282 |
} |
|
darope@0
|
283 |
int ShouldCollide(edict_t *pentTouched, edict_t *pentOther) { |
|
darope@0
|
284 |
NEWDLL_TRACE(pfnShouldCollide, P_PRE, ("")); |
|
darope@0
|
285 |
RETURN_META_VALUE(MRES_IGNORED, 1); |
|
darope@0
|
286 |
} |
|
darope@248
|
287 |
void CvarValue(const edict_t *pEdict, const char *szValue) { |
|
darope@248
|
288 |
NEWDLL_TRACE(pfnCvarValue, P_PRE, ("player=%s, value=%s", STRING(pEdict->v.netname), szValue?szValue:"nil")); |
|
darope@248
|
289 |
RETURN_META(MRES_IGNORED); |
|
darope@248
|
290 |
} |
|
darope@0
|
291 |
|
|
darope@0
|
292 |
|
|
darope@0
|
293 |
// from SDK dlls/cbase.cpp: |
|
darope@0
|
294 |
// (wd) indicates my comments on the functions |
|
darope@0
|
295 |
static DLL_FUNCTIONS gFunctionTable = |
|
darope@0
|
296 |
{ |
|
darope@0
|
297 |
GameDLLInit, //! pfnGameInit() Initialize the game (one-time call after loading of game .dll) |
|
darope@0
|
298 |
DispatchSpawn, //! pfnSpawn() |
|
darope@0
|
299 |
DispatchThink, //! pfnThink() |
|
darope@0
|
300 |
DispatchUse, //! pfnUse() |
|
darope@0
|
301 |
DispatchTouch, //! pfnTouch() |
|
darope@0
|
302 |
DispatchBlocked, //! pfnBlocked() |
|
darope@0
|
303 |
DispatchKeyValue, //! pfnKeyValue() |
|
darope@0
|
304 |
DispatchSave, //! pfnSave() |
|
darope@0
|
305 |
DispatchRestore, //! pfnRestore() |
|
darope@0
|
306 |
DispatchObjectCollsionBox, //! pfnSetAbsBox() |
|
darope@0
|
307 |
|
|
darope@0
|
308 |
SaveWriteFields, //! pfnSaveWriteFields() |
|
darope@0
|
309 |
SaveReadFields, //! pfnSaveReadFields() |
|
darope@0
|
310 |
|
|
darope@0
|
311 |
SaveGlobalState, //! pfnSaveGlobalState() |
|
darope@0
|
312 |
RestoreGlobalState, //! pfnRestoreGlobalState() |
|
darope@0
|
313 |
ResetGlobalState, //! pfnResetGlobalState() |
|
darope@0
|
314 |
|
|
darope@0
|
315 |
ClientConnect, //! pfnClientConnect() (wd) Client has connected |
|
darope@0
|
316 |
ClientDisconnect, //! pfnClientDisconnect() (wd) Player has left the game |
|
darope@0
|
317 |
ClientKill, //! pfnClientKill() (wd) Player has typed "kill" |
|
darope@0
|
318 |
ClientPutInServer, //! pfnClientPutInServer() (wd) Client is entering the game |
|
darope@0
|
319 |
ClientCommand, //! pfnClientCommand() (wd) Player has sent a command (typed, or from a bind) |
|
darope@0
|
320 |
ClientUserInfoChanged, //! pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure |
|
darope@0
|
321 |
ServerActivate, //! pfnServerActivate() (wd) Server is starting a new map |
|
darope@0
|
322 |
ServerDeactivate, //! pfnServerDeactivate() (wd) Server is leaving the map (shutdown, or changelevel); SDK2 |
|
darope@0
|
323 |
|
|
darope@0
|
324 |
PlayerPreThink, //! pfnPlayerPreThink() |
|
darope@0
|
325 |
PlayerPostThink, //! pfnPlayerPostThink() |
|
darope@0
|
326 |
|
|
darope@0
|
327 |
StartFrame, //! pfnStartFrame() |
|
darope@0
|
328 |
ParmsNewLevel, //! pfnParmsNewLevel() |
|
darope@0
|
329 |
ParmsChangeLevel, //! pfnParmsChangeLevel() |
|
darope@0
|
330 |
|
|
darope@0
|
331 |
GetGameDescription, //! pfnGetGameDescription() Returns string describing current .dll. E.g. "TeamFotrress 2", "Half-Life" |
|
darope@0
|
332 |
PlayerCustomization, //! pfnPlayerCustomization() Notifies .dll of new customization for player. |
|
darope@0
|
333 |
|
|
darope@0
|
334 |
SpectatorConnect, //! pfnSpectatorConnect() Called when spectator joins server |
|
darope@0
|
335 |
SpectatorDisconnect, //! pfnSpectatorDisconnect() Called when spectator leaves the server |
|
darope@0
|
336 |
SpectatorThink, //! pfnSpectatorThink() Called when spectator sends a command packet (usercmd_t) |
|
darope@0
|
337 |
|
|
darope@0
|
338 |
Sys_Error, //! pfnSys_Error() Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint. SDK2 |
|
darope@0
|
339 |
|
|
darope@0
|
340 |
PM_Move, //! pfnPM_Move() (wd) SDK2 |
|
darope@0
|
341 |
PM_Init, //! pfnPM_Init() Server version of player movement initialization; (wd) SDK2 |
|
darope@0
|
342 |
PM_FindTextureType, //! pfnPM_FindTextureType() (wd) SDK2 |
|
darope@0
|
343 |
|
|
darope@0
|
344 |
SetupVisibility, //! pfnSetupVisibility() Set up PVS and PAS for networking for this client; (wd) SDK2 |
|
darope@0
|
345 |
UpdateClientData, //! pfnUpdateClientData() Set up data sent only to specific client; (wd) SDK2 |
|
darope@0
|
346 |
AddToFullPack, //! pfnAddToFullPack() (wd) SDK2 |
|
darope@0
|
347 |
CreateBaseline, //! pfnCreateBaseline() Tweak entity baseline for network encoding, allows setup of player baselines, too.; (wd) SDK2 |
|
darope@0
|
348 |
RegisterEncoders, //! pfnRegisterEncoders() Callbacks for network encoding; (wd) SDK2 |
|
darope@0
|
349 |
GetWeaponData, //! pfnGetWeaponData() (wd) SDK2 |
|
darope@0
|
350 |
CmdStart, //! pfnCmdStart() (wd) SDK2 |
|
darope@0
|
351 |
CmdEnd, //! pfnCmdEnd() (wd) SDK2 |
|
darope@0
|
352 |
ConnectionlessPacket, //! pfnConnectionlessPacket() (wd) SDK2 |
|
darope@0
|
353 |
GetHullBounds, //! pfnGetHullBounds() (wd) SDK2 |
|
darope@0
|
354 |
CreateInstancedBaselines, //! pfnCreateInstancedBaselines() (wd) SDK2 |
|
darope@0
|
355 |
InconsistentFile, //! pfnInconsistentFile() (wd) SDK2 |
|
darope@0
|
356 |
AllowLagCompensation, //! pfnAllowLagCompensation() (wd) SDK2 |
|
darope@0
|
357 |
}; |
|
darope@0
|
358 |
|
|
darope@0
|
359 |
// It's not clear what the difference is between GetAPI and GetAPI2; they |
|
darope@0
|
360 |
// both appear to return the exact same function table. |
|
darope@0
|
361 |
// |
|
darope@0
|
362 |
// Only one of them appears to be ever called, though. If the DLL provides |
|
darope@0
|
363 |
// GetAPI2, the engine/hlds will call that, and will not call GetAPI. If |
|
darope@0
|
364 |
// the engine couldn't find GetAPI2 in the DLL, it appears to fall back to |
|
darope@0
|
365 |
// GetAPI. |
|
darope@0
|
366 |
// |
|
darope@0
|
367 |
// So, GetAPI2 appears to replace GetAPI, and appears to have been added |
|
darope@0
|
368 |
// with SDK 2.0. My best guess is that, with the new SDK, interface |
|
darope@0
|
369 |
// version checking became important, and without the int ptr used in |
|
darope@0
|
370 |
// GetAPI2, the engine can't find out the version of the DLL via GetAPI. |
|
darope@0
|
371 |
// |
|
darope@0
|
372 |
// It's unclear whether a DLL coded under SDK2 needs to provide the older |
|
darope@0
|
373 |
// GetAPI or not.. |
|
darope@0
|
374 |
|
|
darope@0
|
375 |
C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, |
|
darope@0
|
376 |
int *interfaceVersion ) |
|
darope@0
|
377 |
{ |
|
darope@0
|
378 |
LOG_DEVELOPER(PLID, "called: GetEntityAPI2; version=%d", *interfaceVersion); |
|
darope@0
|
379 |
if(!pFunctionTable) { |
|
darope@0
|
380 |
LOG_ERROR(PLID, "GetEntityAPI2 called with null pFunctionTable"); |
|
darope@0
|
381 |
return(FALSE); |
|
darope@0
|
382 |
} |
|
darope@0
|
383 |
else if(*interfaceVersion != INTERFACE_VERSION) { |
|
darope@0
|
384 |
LOG_ERROR(PLID, |
|
darope@0
|
385 |
"GetEntityAPI2 version mismatch; requested=%d ours=%d", |
|
darope@0
|
386 |
*interfaceVersion, INTERFACE_VERSION); |
|
darope@0
|
387 |
//! Tell engine what version we had, so it can figure out who is |
|
darope@0
|
388 |
//! out of date. |
|
darope@0
|
389 |
*interfaceVersion = INTERFACE_VERSION; |
|
darope@0
|
390 |
return(FALSE); |
|
darope@0
|
391 |
} |
|
darope@0
|
392 |
memcpy(pFunctionTable, &gFunctionTable, sizeof(DLL_FUNCTIONS)); |
|
darope@0
|
393 |
return(TRUE); |
|
darope@0
|
394 |
} |
|
darope@0
|
395 |
|
|
darope@0
|
396 |
|
|
darope@0
|
397 |
// I could find _no_ documentation or examples for the intended use of |
|
darope@0
|
398 |
// NEW_DLL_FUNCTIONS. I wouldn't have even _known_ about the |
|
darope@0
|
399 |
// GetNewDLLFunctions() function except for the reference in Adminmod.. It |
|
darope@0
|
400 |
// appears to be new with SDK 2.0. |
|
darope@0
|
401 |
// |
|
darope@0
|
402 |
// Obviously, it seems to provide additional functions to the engine, but |
|
darope@0
|
403 |
// it's unclear why a new table and interface were added, rather than |
|
darope@0
|
404 |
// appending new functions to the GetAPI table/interface. |
|
darope@0
|
405 |
// |
|
darope@0
|
406 |
// Interestingly, it appears to be called by the engine _before_ GetAPI. |
|
darope@0
|
407 |
|
|
darope@0
|
408 |
static NEW_DLL_FUNCTIONS gNewFunctionTable = |
|
darope@0
|
409 |
{ |
|
darope@0
|
410 |
OnFreeEntPrivateData, //! pfnOnFreeEntPrivateData() Called right before the object's memory is freed. Calls its destructor. |
|
darope@0
|
411 |
GameShutdown, //! pfnGameShutdown() |
|
darope@0
|
412 |
ShouldCollide, //! pfnShouldCollide() |
|
darope@248
|
413 |
CvarValue, //! pfnCvarValue() |
|
darope@0
|
414 |
}; |
|
darope@0
|
415 |
|
|
darope@0
|
416 |
C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, |
|
darope@0
|
417 |
int *interfaceVersion) |
|
darope@0
|
418 |
{ |
|
darope@0
|
419 |
LOG_DEVELOPER(PLID, "called: GetNewDLLFunctions; version=%d", |
|
darope@0
|
420 |
*interfaceVersion); |
|
darope@0
|
421 |
if(!pNewFunctionTable) { |
|
darope@0
|
422 |
LOG_ERROR(PLID, |
|
darope@0
|
423 |
"GetNewDLLFunctions called with null pNewFunctionTable"); |
|
darope@0
|
424 |
return(FALSE); |
|
darope@0
|
425 |
} |
|
darope@0
|
426 |
else if(*interfaceVersion != NEW_DLL_FUNCTIONS_VERSION) { |
|
darope@0
|
427 |
LOG_ERROR(PLID, |
|
darope@0
|
428 |
"GetNewDLLFunctions version mismatch; requested=%d ours=%d", |
|
darope@0
|
429 |
*interfaceVersion, NEW_DLL_FUNCTIONS_VERSION); |
|
darope@0
|
430 |
//! Tell engine what version we had, so it can figure out who is |
|
darope@0
|
431 |
//! out of date. |
|
darope@0
|
432 |
*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION; |
|
darope@0
|
433 |
return(FALSE); |
|
darope@0
|
434 |
} |
|
darope@0
|
435 |
memcpy(pNewFunctionTable, &gNewFunctionTable, sizeof(NEW_DLL_FUNCTIONS)); |
|
darope@0
|
436 |
return TRUE; |
|
darope@0
|
437 |
} |