View Single Post
Re: I don't like this!
Old
  (#17)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: I don't like this! - 28-12-2004

You can still hook "CreateInterface" if you want to (at least until the next Steam update wipes out your custom server.dll file).

Once you have hooked "CreateInterface", you can intercept requests from the game DLL code (old server.dll) to the engine. These requests will all be wanting engine interface function pointers. If you simply return the engine interface function pointers to the game DLL code, the game DLL code will bypass your hook DLL (because the function pointers point to the engine code). You will have to substitute YOUR version of these function pointers for the engine's function pointers and pass those back to the game DLL code so that the game DLL code will call your version of the functions. This is the same as it was in Half-Life1, where you had to recreate all of the engine functions and pass the game DLL code your version of those engine functions).

This is where the difficult part comes. You have to maintain a list of ALL possible versions of the engines interface function definitions (i.e. if the engine has gone through 5 different versions of the IGameEventManager interface function, your hook code would need to support all of those versions to be compatible with different MODs). If you only wanted focus on a single MOD (say CS), you would only need to support whichever version that MOD required (updating as necessary when the MOD updates or the engine updates).

Even after doing this, you STILL don't have access to player origins and angles, because this information isn't stored in the Half-Life2 engine like it was in Half-Life1. This data is now stored in the CBaseEntity class (which you don't have access to without doing some mucking around with pointers to PrivateData).

Like I said before, if the engine is handling collisions, then some of this data is passed from the game DLL code to the engine (the origin for example), but rotation (angles) is not used in player collisions (since HL1 and HL2 use axis-aligned bounding boxes for player collision). So even if the game DLL code is telling the engine what the origin of players is, the game DLL code might not be telling the engine what the rotation (angles) currently is (since the engine doesn't need this).

Other clients, obviously DO need this, so somewhere the CBaseEntity data has to be replicated from the server game DLL to all client. Perhaps intercepting this mechanism will allow you to get at the data you need.

botman
  
Reply With Quote