1.1 --- a/extensions/sdktools/tempents.h Fri Jul 11 06:51:21 2008 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,118 +0,0 @@
1.4 -/**
1.5 - * vim: set ts=4 :
1.6 - * =============================================================================
1.7 - * SourceMod SDKTools Extension
1.8 - * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
1.9 - * =============================================================================
1.10 - *
1.11 - * This program is free software; you can redistribute it and/or modify it under
1.12 - * the terms of the GNU General Public License, version 3.0, as published by the
1.13 - * Free Software Foundation.
1.14 - *
1.15 - * This program is distributed in the hope that it will be useful, but WITHOUT
1.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.17 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.18 - * details.
1.19 - *
1.20 - * You should have received a copy of the GNU General Public License along with
1.21 - * this program. If not, see <http://www.gnu.org/licenses/>.
1.22 - *
1.23 - * As a special exception, AlliedModders LLC gives you permission to link the
1.24 - * code of this program (as well as its derivative works) to "Half-Life 2," the
1.25 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
1.26 - * by the Valve Corporation. You must obey the GNU General Public License in
1.27 - * all respects for all other code used. Additionally, AlliedModders LLC grants
1.28 - * this exception to all derivative works. AlliedModders LLC defines further
1.29 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
1.30 - * or <http://www.sourcemod.net/license.php>.
1.31 - *
1.32 - * Version: $Id$
1.33 - */
1.34 -
1.35 -#ifndef _INCLUDE_SOURCEMOD_TEMPENTS_H_
1.36 -#define _INCLUDE_SOURCEMOD_TEMPENTS_H_
1.37 -
1.38 -#include "extension.h"
1.39 -#include <irecipientfilter.h>
1.40 -#include <sh_list.h>
1.41 -#include <sh_string.h>
1.42 -#include <stdio.h>
1.43 -
1.44 -class TempEntityInfo
1.45 -{
1.46 -public:
1.47 - TempEntityInfo(const char *name, void *me);
1.48 -public:
1.49 - const char *GetName();
1.50 - ServerClass *GetServerClass();
1.51 - bool IsValidProp(const char *name);
1.52 - bool TE_SetEntData(const char *name, int value);
1.53 - bool TE_SetEntDataFloat(const char *name, float value);
1.54 - bool TE_SetEntDataVector(const char *name, float vector[3]);
1.55 - bool TE_SetEntDataFloatArray(const char *name, cell_t *array, int size);
1.56 - bool TE_GetEntData(const char *name, int *value);
1.57 - bool TE_GetEntDataFloat(const char *name, float *value);
1.58 - bool TE_GetEntDataVector(const char *name, float vector[3]);
1.59 - void Send(IRecipientFilter &filter, float delay);
1.60 -private:
1.61 - int _FindOffset(const char *name, int *size=NULL);
1.62 -private:
1.63 - void *m_Me;
1.64 - ServerClass *m_Sc;
1.65 - SourceHook::String m_Name;
1.66 -};
1.67 -
1.68 -class TempEntityManager
1.69 -{
1.70 -public:
1.71 - TempEntityManager() : m_NameOffs(0), m_NextOffs(0), m_GetClassNameOffs(0), m_Loaded(false) {}
1.72 -public:
1.73 - void Initialize();
1.74 - bool IsAvailable();
1.75 - void Shutdown();
1.76 -public:
1.77 - TempEntityInfo *GetTempEntityInfo(const char *name);
1.78 - const char *GetNameFromThisPtr(void *me);
1.79 -public:
1.80 - void DumpList();
1.81 - void DumpProps(FILE *fp);
1.82 -private:
1.83 - SourceHook::List<TempEntityInfo *> m_TEList;
1.84 - IBasicTrie *m_TempEntInfo;
1.85 - void *m_ListHead;
1.86 - int m_NameOffs;
1.87 - int m_NextOffs;
1.88 - int m_GetClassNameOffs;
1.89 - bool m_Loaded;
1.90 -};
1.91 -
1.92 -struct TEHookInfo
1.93 -{
1.94 - TempEntityInfo *te;
1.95 - SourceHook::List<IPluginFunction *> lst;
1.96 -};
1.97 -
1.98 -class TempEntHooks : public IPluginsListener
1.99 -{
1.100 -public: //IPluginsListener
1.101 - void OnPluginUnloaded(IPlugin *plugin);
1.102 -public:
1.103 - void Initialize();
1.104 - void Shutdown();
1.105 - bool AddHook(const char *name, IPluginFunction *pFunc);
1.106 - bool RemoveHook(const char *name, IPluginFunction *pFunc);
1.107 - void OnPlaybackTempEntity(IRecipientFilter &filter, float delay, const void *pSender, const SendTable *pST, int classID);
1.108 -private:
1.109 - void _IncRefCounter();
1.110 - void _DecRefCounter();
1.111 - size_t _FillInPlayers(int *pl_array, IRecipientFilter *pFilter);
1.112 -private:
1.113 - IBasicTrie *m_TEHooks;
1.114 - SourceHook::List<TEHookInfo *> m_HookInfo;
1.115 - size_t m_HookCount;
1.116 -};
1.117 -
1.118 -extern TempEntityManager g_TEManager;
1.119 -extern TempEntHooks s_TempEntHooks;
1.120 -
1.121 -#endif //_INCLUDE_SOURCEMOD_TEMPENTS_H_