wdmisc_plugin/dll_plugin.cpp
changeset 0 d15304fcb7a7
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/wdmisc_plugin/dll_plugin.cpp	Tue Apr 06 07:36:14 2004 +0000
     1.3 @@ -0,0 +1,134 @@
     1.4 +// vi: set ts=4 sw=4 :
     1.5 +// vim: set tw=75 :
     1.6 +
     1.7 +// dll_plugin.cpp - implementation of plugin's HL DLL routines
     1.8 +
     1.9 +/*
    1.10 + * Copyright (c) 2001-2003 Will Day <[email protected]>
    1.11 + *
    1.12 + *    This file is part of Metamod.
    1.13 + *
    1.14 + *    Metamod is free software; you can redistribute it and/or modify it
    1.15 + *    under the terms of the GNU General Public License as published by the
    1.16 + *    Free Software Foundation; either version 2 of the License, or (at
    1.17 + *    your option) any later version.
    1.18 + *
    1.19 + *    Metamod is distributed in the hope that it will be useful, but
    1.20 + *    WITHOUT ANY WARRANTY; without even the implied warranty of
    1.21 + *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.22 + *    General Public License for more details.
    1.23 + *
    1.24 + *    You should have received a copy of the GNU General Public License
    1.25 + *    along with Metamod; if not, write to the Free Software Foundation,
    1.26 + *    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.27 + *
    1.28 + *    In addition, as a special exception, the author gives permission to
    1.29 + *    link the code of this program with the Half-Life Game Engine ("HL
    1.30 + *    Engine") and Modified Game Libraries ("MODs") developed by Valve,
    1.31 + *    L.L.C ("Valve").  You must obey the GNU General Public License in all
    1.32 + *    respects for all of the code used other than the HL Engine and MODs
    1.33 + *    from Valve.  If you modify this file, you may extend this exception
    1.34 + *    to your version of the file, but you are not obligated to do so.  If
    1.35 + *    you do not wish to do so, delete this exception statement from your
    1.36 + *    version.
    1.37 + *
    1.38 + */
    1.39 +
    1.40 +#include <extdll.h>
    1.41 +#include <sdk_util.h>
    1.42 +
    1.43 +#include <meta_api.h>
    1.44 +#include <sdk_util.h>
    1.45 +
    1.46 +#include "wdmisc.h"
    1.47 +#include "dll_plugin.h"
    1.48 +#include "log_plugin.h"
    1.49 +
    1.50 +void wd_ServerDeactivate( void ) {
    1.51 +	bounce_check();
    1.52 +	RETURN_META(MRES_HANDLED);
    1.53 +}
    1.54 +
    1.55 +static DLL_FUNCTIONS gFunctionTable = 
    1.56 +{
    1.57 +	NULL,						//! pfnGameInit()
    1.58 +	NULL,						//! pfnSpawn()
    1.59 +	NULL,						//! pfnThink()
    1.60 +	NULL,						//! pfnUse()
    1.61 +	NULL,						//! pfnTouch()
    1.62 +	NULL,						//! pfnBlocked()
    1.63 +	NULL,						//! pfnKeyValue()
    1.64 +	NULL,						//! pfnSave()
    1.65 +	NULL,						//! pfnRestore()
    1.66 +	NULL,						//! pfnSetAbsBox()
    1.67 +
    1.68 +	NULL,						//! pfnSaveWriteFields()
    1.69 +	NULL,						//! pfnSaveReadFields()
    1.70 +
    1.71 +	NULL,						//! pfnSaveGlobalState()
    1.72 +	NULL,						//! pfnRestoreGlobalState()
    1.73 +	NULL,						//! pfnResetGlobalState()
    1.74 +
    1.75 +	NULL,						//! pfnClientConnect()
    1.76 +	NULL,						//! pfnClientDisconnect()
    1.77 +	NULL,						//! pfnClientKill()
    1.78 +	NULL,						//! pfnClientPutInServer()
    1.79 +	NULL,						//! pfnClientCommand()
    1.80 +	NULL,						//! pfnClientUserInfoChanged()
    1.81 +	NULL,						//! pfnServerActivate()
    1.82 +	wd_ServerDeactivate,		//! pfnServerDeactivate()
    1.83 +
    1.84 +	NULL,						//! pfnPlayerPreThink()
    1.85 +	NULL,						//! pfnPlayerPostThink()
    1.86 +
    1.87 +	NULL,						//! pfnStartFrame()
    1.88 +	NULL,						//! pfnParmsNewLevel()
    1.89 +	NULL,						//! pfnParmsChangeLevel()
    1.90 +
    1.91 +	NULL,						//! pfnGetGameDescription()
    1.92 +	NULL,						//! pfnPlayerCustomization()
    1.93 +
    1.94 +	NULL,						//! pfnSpectatorConnect()
    1.95 +	NULL,						//! pfnSpectatorDisconnect()
    1.96 +	NULL,						//! pfnSpectatorThink()
    1.97 +	
    1.98 +	NULL,						//! pfnSys_Error()
    1.99 +
   1.100 +	NULL,						//! pfnPM_Move()
   1.101 +	NULL,						//! pfnPM_Init()
   1.102 +	NULL,						//! pfnPM_FindTextureType()
   1.103 +	
   1.104 +	NULL,						//! pfnSetupVisibility()
   1.105 +	NULL,						//! pfnUpdateClientData()
   1.106 +	NULL,						//! pfnAddToFullPack()
   1.107 +	NULL,						//! pfnCreateBaseline()
   1.108 +	NULL,						//! pfnRegisterEncoders()
   1.109 +	NULL,						//! pfnGetWeaponData()
   1.110 +	NULL,						//! pfnCmdStart()
   1.111 +	NULL,						//! pfnCmdEnd()
   1.112 +	NULL,						//! pfnConnectionlessPacket()
   1.113 +	NULL,						//! pfnGetHullBounds()
   1.114 +	NULL,						//! pfnCreateInstancedBaselines()
   1.115 +	NULL,						//! pfnInconsistentFile()
   1.116 +	NULL,						//! pfnAllowLagCompensation()
   1.117 +};
   1.118 +
   1.119 +C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, 
   1.120 +		int *interfaceVersion)
   1.121 +{
   1.122 +	LOG_DEVELOPER(PLID, "called: GetEntityAPI2; version=%d", *interfaceVersion);
   1.123 +	if(!pFunctionTable) {
   1.124 +		LOG_ERROR(PLID, "GetEntityAPI2 called with null pFunctionTable");
   1.125 +		return(FALSE);
   1.126 +	}
   1.127 +	else if(*interfaceVersion != INTERFACE_VERSION) {
   1.128 +		LOG_ERROR(PLID, "GetEntityAPI2 version mismatch; requested=%d ours=%d",
   1.129 +				*interfaceVersion, INTERFACE_VERSION);
   1.130 +		//! Tell engine what version we had, so it can figure out who is 
   1.131 +		//! out of date.
   1.132 +		*interfaceVersion = INTERFACE_VERSION;
   1.133 +		return(FALSE);
   1.134 +	}
   1.135 +	memcpy(pFunctionTable, &gFunctionTable, sizeof(DLL_FUNCTIONS));
   1.136 +	return(TRUE);
   1.137 +}