stub_plugin/engine_api.cpp
author darope
Tue Aug 23 20:31:28 2005 +0000 (2005-08-23)
changeset 248 f72386298cba
parent 0 d15304fcb7a7
child 186 0b0701eb57d7
permissions -rw-r--r--
Merged with working branch (bt-release-1_17_4) for release 1.18
     1 // vi: set ts=4 sw=4 :
     2 // vim: set tw=75 :
     3 
     4 /*
     5  * Copyright (c) 2001-2003 Will Day <[email protected]>
     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 #include <extdll.h>
    36 
    37 #include <meta_api.h>
    38 
    39 enginefuncs_t meta_engfuncs = 
    40 {
    41 	NULL,						// pfnPrecacheModel()
    42 	NULL,						// pfnPrecacheSound()
    43 	NULL,						// pfnSetModel()
    44 	NULL,						// pfnModelIndex()
    45 	NULL,						// pfnModelFrames()
    46 
    47 	NULL,						// pfnSetSize()
    48 	NULL,						// pfnChangeLevel()
    49 	NULL,						// pfnGetSpawnParms()
    50 	NULL,						// pfnSaveSpawnParms()
    51 
    52 	NULL,						// pfnVecToYaw()
    53 	NULL,						// pfnVecToAngles()
    54 	NULL,						// pfnMoveToOrigin()
    55 	NULL,						// pfnChangeYaw()
    56 	NULL,						// pfnChangePitch()
    57 
    58 	NULL,						// pfnFindEntityByString()
    59 	NULL,						// pfnGetEntityIllum()
    60 	NULL,						// pfnFindEntityInSphere()
    61 	NULL,						// pfnFindClientInPVS()
    62 	NULL,						// pfnEntitiesInPVS()
    63 
    64 	NULL,						// pfnMakeVectors()
    65 	NULL,						// pfnAngleVectors()
    66 
    67 	NULL,						// pfnCreateEntity()
    68 	NULL,						// pfnRemoveEntity()
    69 	NULL,						// pfnCreateNamedEntity()
    70 
    71 	NULL,						// pfnMakeStatic()
    72 	NULL,						// pfnEntIsOnFloor()
    73 	NULL,						// pfnDropToFloor()
    74 
    75 	NULL,						// pfnWalkMove()
    76 	NULL,						// pfnSetOrigin()
    77 
    78 	NULL,						// pfnEmitSound()
    79 	NULL,						// pfnEmitAmbientSound()
    80 
    81 	NULL,						// pfnTraceLine()
    82 	NULL,						// pfnTraceToss()
    83 	NULL,						// pfnTraceMonsterHull()
    84 	NULL,						// pfnTraceHull()
    85 	NULL,						// pfnTraceModel()
    86 	NULL,						// pfnTraceTexture()
    87 	NULL,						// pfnTraceSphere()
    88 	NULL,						// pfnGetAimVector()
    89 
    90 	NULL,						// pfnServerCommand()
    91 	NULL,						// pfnServerExecute()
    92 	NULL,						// pfnClientCommand()
    93 
    94 	NULL,						// pfnParticleEffect()
    95 	NULL,						// pfnLightStyle()
    96 	NULL,						// pfnDecalIndex()
    97 	NULL,						// pfnPointContents()
    98 
    99 	NULL,						// pfnMessageBegin()
   100 	NULL,						// pfnMessageEnd()
   101 
   102 	NULL,						// pfnWriteByte()
   103 	NULL,						// pfnWriteChar()
   104 	NULL,						// pfnWriteShort()
   105 	NULL,						// pfnWriteLong()
   106 	NULL,						// pfnWriteAngle()
   107 	NULL,						// pfnWriteCoord()
   108 	NULL,						// pfnWriteString()
   109 	NULL,						// pfnWriteEntity()
   110 
   111 	NULL,						// pfnCVarRegister()
   112 	NULL,						// pfnCVarGetFloat()
   113 	NULL,						// pfnCVarGetString()
   114 	NULL,						// pfnCVarSetFloat()
   115 	NULL,						// pfnCVarSetString()
   116 
   117 	NULL,						// pfnAlertMessage()
   118 	NULL,						// pfnEngineFprintf()
   119 
   120 	NULL,						// pfnPvAllocEntPrivateData()
   121 	NULL,						// pfnPvEntPrivateData()
   122 	NULL,						// pfnFreeEntPrivateData()
   123 
   124 	NULL,						// pfnSzFromIndex()
   125 	NULL,						// pfnAllocString()
   126 
   127 	NULL, 						// pfnGetVarsOfEnt()
   128 	NULL,						// pfnPEntityOfEntOffset()
   129 	NULL,						// pfnEntOffsetOfPEntity()
   130 	NULL,						// pfnIndexOfEdict()
   131 	NULL,						// pfnPEntityOfEntIndex()
   132 	NULL,						// pfnFindEntityByVars()
   133 	NULL,						// pfnGetModelPtr()
   134 
   135 	NULL,						// pfnRegUserMsg()
   136 
   137 	NULL,						// pfnAnimationAutomove()
   138 	NULL,						// pfnGetBonePosition()
   139 
   140 	NULL,						// pfnFunctionFromName()
   141 	NULL,						// pfnNameForFunction()
   142 
   143 	NULL,						// pfnClientPrintf()
   144 	NULL,						// pfnServerPrint()
   145 
   146 	NULL,						// pfnCmd_Args()
   147 	NULL,						// pfnCmd_Argv()
   148 	NULL,						// pfnCmd_Argc()
   149 
   150 	NULL,						// pfnGetAttachment()
   151 
   152 	NULL,						// pfnCRC32_Init()
   153 	NULL,						// pfnCRC32_ProcessBuffer()
   154 	NULL,						// pfnCRC32_ProcessByte()
   155 	NULL,						// pfnCRC32_Final()
   156 
   157 	NULL,						// pfnRandomLong()
   158 	NULL,						// pfnRandomFloat()
   159 
   160 	NULL,						// pfnSetView()
   161 	NULL,						// pfnTime()
   162 	NULL,						// pfnCrosshairAngle()
   163 
   164 	NULL,						// pfnLoadFileForMe()
   165 	NULL,						// pfnFreeFile()
   166 
   167 	NULL,						// pfnEndSection()
   168 	NULL,						// pfnCompareFileTime()
   169 	NULL,						// pfnGetGameDir()
   170 	NULL,						// pfnCvar_RegisterVariable()
   171 	NULL,						// pfnFadeClientVolume()
   172 	NULL,						// pfnSetClientMaxspeed()
   173 	NULL,						// pfnCreateFakeClient()
   174 	NULL,						// pfnRunPlayerMove()
   175 	NULL,						// pfnNumberOfEntities()
   176 
   177 	NULL,						// pfnGetInfoKeyBuffer()
   178 	NULL,						// pfnInfoKeyValue()
   179 	NULL,						// pfnSetKeyValue()
   180 	NULL,						// pfnSetClientKeyValue()
   181 
   182 	NULL,						// pfnIsMapValid()
   183 	NULL,						// pfnStaticDecal()
   184 	NULL,						// pfnPrecacheGeneric()
   185 	NULL, 						// pfnGetPlayerUserId()
   186 	NULL,						// pfnBuildSoundMsg()
   187 	NULL,						// pfnIsDedicatedServer()
   188 	NULL,						// pfnCVarGetPointer()
   189 	NULL,						// pfnGetPlayerWONId()
   190 
   191 	NULL,						// pfnInfo_RemoveKey()
   192 	NULL,						// pfnGetPhysicsKeyValue()
   193 	NULL,						// pfnSetPhysicsKeyValue()
   194 	NULL,						// pfnGetPhysicsInfoString()
   195 	NULL,						// pfnPrecacheEvent()
   196 	NULL,						// pfnPlaybackEvent()
   197 
   198 	NULL,						// pfnSetFatPVS()
   199 	NULL,						// pfnSetFatPAS()
   200 
   201 	NULL,						// pfnCheckVisibility()
   202 
   203 	NULL,						// pfnDeltaSetField()
   204 	NULL,						// pfnDeltaUnsetField()
   205 	NULL,						// pfnDeltaAddEncoder()
   206 	NULL,						// pfnGetCurrentPlayer()
   207 	NULL,						// pfnCanSkipPlayer()
   208 	NULL,						// pfnDeltaFindField()
   209 	NULL,						// pfnDeltaSetFieldByIndex()
   210 	NULL,						// pfnDeltaUnsetFieldByIndex()
   211 
   212 	NULL,						// pfnSetGroupMask()
   213 
   214 	NULL,						// pfnCreateInstancedBaseline()
   215 	NULL,						// pfnCvar_DirectSet()
   216 
   217 	NULL,						// pfnForceUnmodified()
   218 
   219 	NULL,						// pfnGetPlayerStats()
   220 
   221 	NULL,						// pfnAddServerCommand()
   222 
   223 	// Added in SDK 2.2:
   224 	NULL,						// pfnVoice_GetClientListening()
   225 	NULL,						// pfnVoice_SetClientListening()
   226 
   227 	// Added for HL 1109 (no SDK update):
   228 	NULL,						// pfnGetPlayerAuthId()
   229 
   230 	// Added 2003/11/10 (no SDK update):
   231 	NULL,						// pfnSequenceGet()
   232 	NULL,						// pfnSequencePickSentence()
   233 	NULL,						// pfnGetFileSize()
   234 	NULL,						// pfnGetApproxWavePlayLen()
   235 	NULL,						// pfnIsCareerMatch()
   236 	NULL,						// pfnGetLocalizedStringLength()
   237 	NULL,						// pfnRegisterTutorMessageShown()
   238 	NULL,						// pfnGetTimesTutorMessageShown()
   239 	NULL,						// pfnProcessTutorMessageDecayBuffer()
   240 	NULL,						// pfnConstructTutorMessageDecayBuffer()
   241 	NULL,						// pfnResetTutorMessageDecayData()
   242 
   243 	// Added Added 2005/08/11 (no SDK update)
   244 	NULL,						// pfnQueryClientCvarValue()
   245 };
   246 
   247 C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, 
   248 		int *interfaceVersion) 
   249 {
   250 	if(!pengfuncsFromEngine) {
   251 		UTIL_LogPrintf("GetEngineFunctions called with null pengfuncsFromEngine");
   252 		return(FALSE);
   253 	}
   254 	else if(*interfaceVersion != ENGINE_INTERFACE_VERSION) {
   255 		UTIL_LogPrintf("GetEngineFunctions version mismatch; requested=%d ours=%d", *interfaceVersion, ENGINE_INTERFACE_VERSION);
   256 		// Tell metamod what version we had, so it can figure out who is out of date.
   257 		*interfaceVersion = ENGINE_INTERFACE_VERSION;
   258 		return(FALSE);
   259 	}
   260 	memcpy(pengfuncsFromEngine, &meta_engfuncs, sizeof(enginefuncs_t));
   261 	return(TRUE);
   262 }