Difference between revisions of "Porting to Left 4 Dead"
m (New page: __FORCETOC__ Porting Valve Server Plugins or Metamod:Source plugins to Left 4 Dead is not very difficult. This article explores some of the changes and how to simplify them. Users of Met...) |
(No difference)
|
Revision as of 01:38, 26 November 2008
Porting Valve Server Plugins or Metamod:Source plugins to Left 4 Dead is not very difficult. This article explores some of the changes and how to simplify them.
Users of Metamod:Source must upgrade to Metamod:Source 1.7 and use the 1.6+ API (see MM:S API Differences).
As there is no official SDK yet, we've simply reverse engineered the new header files. These changes aren't guaranteed to be 100% correct and the SDK isn't complete for building mods -- just most plugins.
Contents
Removals
The IVEngineServer functions PEntityOfEntIndex and IndexOfEdict have been removed for faster code that can be inlined. An example of how to re-implement this (as Valve has not released a new SDK yet):
inline int IndexOfEdict(const edict_t *pEdict) { return (int)(pEdict - gpGlobals->baseEdict); } inline edict_t *PEntityOfEntIndex(int iEntIndex) { if (iEntIndex >= 0 && iEntIndex < gpGlobals->maxEntities) { return (edict_t *)(gpGlobals->baseEdict + iEntIndex); } return NULL; }
Annoyances
The console will spew "VPK" warnings unless your file-backed KeyValues operations use relative paths instead of absolute paths.