initial import of the TE code
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401037
This commit is contained in:
parent
f9cb20984b
commit
8749f537d4
99
extensions/sdktools/CellRecipientFilter.h
Normal file
99
extensions/sdktools/CellRecipientFilter.h
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* ===============================================================
|
||||||
|
* SourceMod SDK Tools Extension
|
||||||
|
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
||||||
|
* ===============================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* Version: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _INCLUDE_SOURCEMOD_CELLRECIPIENTFILTER_H_
|
||||||
|
#define _INCLUDE_SOURCEMOD_CELLRECIPIENTFILTER_H_
|
||||||
|
|
||||||
|
#include <irecipientfilter.h>
|
||||||
|
#include <sp_vm_types.h>
|
||||||
|
|
||||||
|
class CellRecipientFilter : public IRecipientFilter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CellRecipientFilter() : m_IsReliable(false), m_IsInitMessage(false), m_Size(0) {}
|
||||||
|
~CellRecipientFilter() {}
|
||||||
|
public: //IRecipientFilter
|
||||||
|
bool IsReliable() const;
|
||||||
|
bool IsInitMessage() const;
|
||||||
|
int GetRecipientCount() const;
|
||||||
|
int GetRecipientIndex(int slot) const;
|
||||||
|
public:
|
||||||
|
void Initialize(cell_t *ptr, size_t count);
|
||||||
|
void SetToReliable(bool isreliable);
|
||||||
|
void SetToInit(bool isinitmsg);
|
||||||
|
void Reset();
|
||||||
|
private:
|
||||||
|
cell_t m_Players[255];
|
||||||
|
bool m_IsReliable;
|
||||||
|
bool m_IsInitMessage;
|
||||||
|
size_t m_Size;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void CellRecipientFilter::Reset()
|
||||||
|
{
|
||||||
|
m_IsReliable = false;
|
||||||
|
m_IsInitMessage = false;
|
||||||
|
m_Size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool CellRecipientFilter::IsReliable() const
|
||||||
|
{
|
||||||
|
return m_IsReliable;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool CellRecipientFilter::IsInitMessage() const
|
||||||
|
{
|
||||||
|
return m_IsInitMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int CellRecipientFilter::GetRecipientCount() const
|
||||||
|
{
|
||||||
|
return m_Size;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int CellRecipientFilter::GetRecipientIndex(int slot) const
|
||||||
|
{
|
||||||
|
if ((slot < 0) || (slot >= GetRecipientCount()))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return static_cast<int>(m_Players[slot]);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void CellRecipientFilter::SetToInit(bool isinitmsg)
|
||||||
|
{
|
||||||
|
m_IsInitMessage = isinitmsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void CellRecipientFilter::SetToReliable(bool isreliable)
|
||||||
|
{
|
||||||
|
m_IsReliable = isreliable;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void CellRecipientFilter::Initialize(cell_t *ptr, size_t count)
|
||||||
|
{
|
||||||
|
memcpy(m_Players, ptr, count * sizeof(cell_t));
|
||||||
|
m_Size = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //_INCLUDE_SOURCEMOD_CELLRECIPIENTFILTER_H_
|
@ -24,6 +24,7 @@
|
|||||||
#include "extension.h"
|
#include "extension.h"
|
||||||
#include "vcallbuilder.h"
|
#include "vcallbuilder.h"
|
||||||
#include "vnatives.h"
|
#include "vnatives.h"
|
||||||
|
#include "tempents.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file extension.cpp
|
* @file extension.cpp
|
||||||
@ -34,17 +35,22 @@ SDKTools g_SdkTools; /**< Global singleton for extension's main interface */
|
|||||||
IServerGameEnts *gameents = NULL;
|
IServerGameEnts *gameents = NULL;
|
||||||
IBinTools *g_pBinTools = NULL;
|
IBinTools *g_pBinTools = NULL;
|
||||||
IGameConfig *g_pGameConf = NULL;
|
IGameConfig *g_pGameConf = NULL;
|
||||||
|
IGameHelpers *g_pGameHelpers = NULL;
|
||||||
HandleType_t g_CallHandle = 0;
|
HandleType_t g_CallHandle = 0;
|
||||||
|
|
||||||
SMEXT_LINK(&g_SdkTools);
|
SMEXT_LINK(&g_SdkTools);
|
||||||
|
|
||||||
extern sp_nativeinfo_t g_CallNatives[];
|
extern sp_nativeinfo_t g_CallNatives[];
|
||||||
|
extern sp_nativeinfo_t g_TENatives[];
|
||||||
|
|
||||||
bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
||||||
{
|
{
|
||||||
sharesys->AddDependency(myself, "bintools.ext", true, true);
|
sharesys->AddDependency(myself, "bintools.ext", true, true);
|
||||||
sharesys->AddNatives(myself, g_CallNatives);
|
sharesys->AddNatives(myself, g_CallNatives);
|
||||||
sharesys->AddNatives(myself, g_Natives);
|
sharesys->AddNatives(myself, g_Natives);
|
||||||
|
sharesys->AddNatives(myself, g_TENatives);
|
||||||
|
|
||||||
|
SM_GET_IFACE(GAMEHELPERS, g_pGameHelpers);
|
||||||
|
|
||||||
if (!gameconfs->LoadGameConfigFile("sdktools.games", &g_pGameConf, error, maxlength))
|
if (!gameconfs->LoadGameConfigFile("sdktools.games", &g_pGameConf, error, maxlength))
|
||||||
{
|
{
|
||||||
@ -76,6 +82,8 @@ void SDKTools::SDK_OnUnload()
|
|||||||
}
|
}
|
||||||
g_RegCalls.clear();
|
g_RegCalls.clear();
|
||||||
|
|
||||||
|
g_TEManager.Shutdown();
|
||||||
|
|
||||||
gameconfs->CloseGameConfigFile(g_pGameConf);
|
gameconfs->CloseGameConfigFile(g_pGameConf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,6 +97,7 @@ bool SDKTools::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool
|
|||||||
void SDKTools::SDK_OnAllLoaded()
|
void SDKTools::SDK_OnAllLoaded()
|
||||||
{
|
{
|
||||||
SM_GET_LATE_IFACE(BINTOOLS, g_pBinTools);
|
SM_GET_LATE_IFACE(BINTOOLS, g_pBinTools);
|
||||||
|
g_TEManager.Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDKTools::QueryRunning(char *error, size_t maxlength)
|
bool SDKTools::QueryRunning(char *error, size_t maxlength)
|
||||||
@ -119,4 +128,5 @@ void SDKTools::NotifyInterfaceDrop(SMInterface *pInterface)
|
|||||||
}
|
}
|
||||||
g_RegCalls.clear();
|
g_RegCalls.clear();
|
||||||
|
|
||||||
|
g_TEManager.Shutdown();
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "smsdk_ext.h"
|
#include "smsdk_ext.h"
|
||||||
#include <IBinTools.h>
|
#include <IBinTools.h>
|
||||||
#include <IPlayerHelpers.h>
|
#include <IPlayerHelpers.h>
|
||||||
|
#include <IGameHelpers.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Implementation of the SDK Tools extension.
|
* @brief Implementation of the SDK Tools extension.
|
||||||
@ -60,6 +61,7 @@ public:
|
|||||||
extern IServerGameEnts *gameents;
|
extern IServerGameEnts *gameents;
|
||||||
extern IBinTools *g_pBinTools;
|
extern IBinTools *g_pBinTools;
|
||||||
extern IGameConfig *g_pGameConf;
|
extern IGameConfig *g_pGameConf;
|
||||||
|
extern IGameHelpers *g_pGameHelpers;
|
||||||
extern HandleType_t g_CallHandle;
|
extern HandleType_t g_CallHandle;
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
|
#endif //_INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="8.00"
|
Version="8,00"
|
||||||
Name="sdktools"
|
Name="sdktools"
|
||||||
ProjectGUID="{7A740927-C751-4312-BF9D-6367F8C508F8}"
|
ProjectGUID="{7A740927-C751-4312-BF9D-6367F8C508F8}"
|
||||||
RootNamespace="sdk"
|
RootNamespace="sdk"
|
||||||
@ -185,6 +185,14 @@
|
|||||||
RelativePath="..\extension.cpp"
|
RelativePath="..\extension.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\tempents.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\tenatives.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\vcallbuilder.cpp"
|
RelativePath="..\vcallbuilder.cpp"
|
||||||
>
|
>
|
||||||
@ -207,10 +215,18 @@
|
|||||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
UniqueIdentifier="{046AC4F8-1F40-462f-B652-698F87CDCA5F}"
|
UniqueIdentifier="{046AC4F8-1F40-462f-B652-698F87CDCA5F}"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\CellRecipientFilter.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\extension.h"
|
RelativePath="..\extension.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\tempents.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\vcallbuilder.h"
|
RelativePath="..\vcallbuilder.h"
|
||||||
>
|
>
|
||||||
|
@ -56,6 +56,6 @@
|
|||||||
#define SMEXT_ENABLE_MEMUTILS
|
#define SMEXT_ENABLE_MEMUTILS
|
||||||
//#define SMEXT_ENABLE_GAMEHELPERS
|
//#define SMEXT_ENABLE_GAMEHELPERS
|
||||||
//#define SMEXT_ENABLE_TIMERSYS
|
//#define SMEXT_ENABLE_TIMERSYS
|
||||||
//#define SMEXT_ENABLE_ADTFACTORY
|
#define SMEXT_ENABLE_ADTFACTORY
|
||||||
|
|
||||||
#endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
|
#endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
|
||||||
|
246
extensions/sdktools/tempents.cpp
Normal file
246
extensions/sdktools/tempents.cpp
Normal file
@ -0,0 +1,246 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* ===============================================================
|
||||||
|
* SourceMod SDK Tools Extension
|
||||||
|
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
||||||
|
* ===============================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* Version: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "tempents.h"
|
||||||
|
|
||||||
|
TempEntityManager g_TEManager;
|
||||||
|
ICallWrapper *g_GetServerClass = NULL;
|
||||||
|
|
||||||
|
/*************************
|
||||||
|
* *
|
||||||
|
* Temp Entities Wrappers *
|
||||||
|
* *
|
||||||
|
**************************/
|
||||||
|
|
||||||
|
TempEntityInfo::TempEntityInfo(const char *name, void *me)
|
||||||
|
{
|
||||||
|
m_Name.assign(name);
|
||||||
|
m_Me = me;
|
||||||
|
g_GetServerClass->Execute(&m_Me, &m_Sc);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *TempEntityInfo::GetName()
|
||||||
|
{
|
||||||
|
return m_Name.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TempEntityInfo::IsValidProp(const char *name)
|
||||||
|
{
|
||||||
|
return (g_pGameHelpers->FindInSendTable(m_Sc->GetName(), name)) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TempEntityInfo::_FindOffset(const char *name, int *size)
|
||||||
|
{
|
||||||
|
int offset;
|
||||||
|
|
||||||
|
SendProp *prop = g_pGameHelpers->FindInSendTable(m_Sc->GetName(), name);
|
||||||
|
if (!prop)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
offset = prop->GetOffset();
|
||||||
|
if (size)
|
||||||
|
{
|
||||||
|
*size = prop->m_nBits
|
||||||
|
}
|
||||||
|
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TempEntityInfo::TE_SetEntData(const char *name, int value)
|
||||||
|
{
|
||||||
|
/* Search for our offset */
|
||||||
|
int size;
|
||||||
|
int offset = _FindOffset(name, &size);
|
||||||
|
|
||||||
|
if (offset < 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size <= 8)
|
||||||
|
{
|
||||||
|
*((uint8_t *)m_Me + offset) = value;
|
||||||
|
} else if (size <= 16) {
|
||||||
|
*(short *)((uint8_t *)m_Me + offset) = value;
|
||||||
|
} else if (size <= 32){
|
||||||
|
*(int *)((uint8_t *)m_Me + offset) = value;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TempEntityInfo::TE_SetEntDataFloat(const char *name, float value)
|
||||||
|
{
|
||||||
|
/* Search for our offset */
|
||||||
|
int offset = _FindOffset(name);
|
||||||
|
|
||||||
|
if (offset < 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
*(float *)((uint8_t *)m_Me + offset) = value;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TempEntityInfo::TE_SetEntDataVector(const char *name, float vector[3])
|
||||||
|
{
|
||||||
|
/* Search for our offset */
|
||||||
|
int offset = _FindOffset(name);
|
||||||
|
|
||||||
|
if (offset < 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector *v = (Vector *)((uint8_t *)m_Me + offset);
|
||||||
|
v->x = vector[0];
|
||||||
|
v->y = vector[1];
|
||||||
|
v->z = vector[2];
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TempEntityInfo::Send(IRecipientFilter &filter, float delay)
|
||||||
|
{
|
||||||
|
engine->PlaybackTempEntity(filter, delay, (void *)m_Me, m_Sc->m_pTable, m_Sc->m_ClassID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************
|
||||||
|
* *
|
||||||
|
* Temp Entity Manager *
|
||||||
|
* *
|
||||||
|
***********************/
|
||||||
|
|
||||||
|
void TempEntityManager::Initialize()
|
||||||
|
{
|
||||||
|
void *addr;
|
||||||
|
int offset;
|
||||||
|
m_Loaded = false;
|
||||||
|
|
||||||
|
/* Read our sigs and offsets from the config file */
|
||||||
|
if (!g_pGameConf->GetMemSig("CBaseTempEntity", &addr) || !addr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!g_pGameConf->GetOffset("s_pTempEntities", &offset) || !offset)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!g_pGameConf->GetOffset("GetTEName", &m_NameOffs) || !m_NameOffs)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!g_pGameConf->GetOffset("GetTENext", &m_NextOffs) || !m_NextOffs)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!g_pGameConf->GetOffset("TE_GetServerClass", &m_GetClassNameOffs) || !m_GetClassNameOffs)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Store the head of the TE linked list */
|
||||||
|
m_ListHead = **(void ***)((unsigned char *)addr + offset);
|
||||||
|
|
||||||
|
/* Create our trie */
|
||||||
|
m_TempEntInfo = adtfactory->CreateBasicTrie();
|
||||||
|
|
||||||
|
/* Create the GetServerClass call */
|
||||||
|
PassInfo retinfo;
|
||||||
|
retinfo.flags = PASSFLAG_BYVAL;
|
||||||
|
retinfo.type = PassType_Basic;
|
||||||
|
retinfo.size = sizeof(ServerClass *);
|
||||||
|
g_GetServerClass = g_pBinTools->CreateVCall(m_GetClassNameOffs, 0, 0, &retinfo, NULL, 0);
|
||||||
|
|
||||||
|
/* We're done */
|
||||||
|
m_Loaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TempEntityManager::IsAvailable()
|
||||||
|
{
|
||||||
|
return m_Loaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TempEntityManager::Shutdown()
|
||||||
|
{
|
||||||
|
if (!IsAvailable())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TempEntityInfo *>::iterator iter;
|
||||||
|
for (iter=m_TEList.begin(); iter!=m_TEList.end(); iter++)
|
||||||
|
{
|
||||||
|
delete (*iter);
|
||||||
|
}
|
||||||
|
m_TEList.clear();
|
||||||
|
|
||||||
|
m_TempEntInfo->Destroy();
|
||||||
|
g_GetServerClass->Destroy();
|
||||||
|
g_GetServerClass = NULL;
|
||||||
|
m_ListHead = NULL;
|
||||||
|
m_NextOffs = m_NameOffs = m_GetClassNameOffs = 0;
|
||||||
|
m_Loaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TempEntityInfo *TempEntityManager::GetTempEntityInfo(const char *name)
|
||||||
|
{
|
||||||
|
/* If the system is unloaded skip the search */
|
||||||
|
if (!IsAvailable())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
TempEntityInfo *te = NULL;
|
||||||
|
|
||||||
|
/* Start searching for the TE inside the engine */
|
||||||
|
if (!m_TempEntInfo->Retrieve(name, reinterpret_cast<void **>(&te)))
|
||||||
|
{
|
||||||
|
void *iter = m_ListHead;
|
||||||
|
while (iter)
|
||||||
|
{
|
||||||
|
const char *realname = *(const char **)((unsigned char *)iter + m_NameOffs);
|
||||||
|
if (!realname)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (strcmp(name, realname) == 0)
|
||||||
|
{
|
||||||
|
te = new TempEntityInfo(name, iter);
|
||||||
|
m_TempEntInfo->Insert(name, (void *)te);
|
||||||
|
m_TEList.push_back(te);
|
||||||
|
return te;
|
||||||
|
}
|
||||||
|
iter = *(void **)((unsigned char *)iter + m_NextOffs);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return te;
|
||||||
|
}
|
75
extensions/sdktools/tempents.h
Normal file
75
extensions/sdktools/tempents.h
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* ===============================================================
|
||||||
|
* SourceMod SDK Tools Extension
|
||||||
|
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
||||||
|
* ===============================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* Version: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _INCLUDE_SOURCEMOD_TEMPENTS_H_
|
||||||
|
#define _INCLUDE_SOURCEMOD_TEMPENTS_H_
|
||||||
|
|
||||||
|
#include "extension.h"
|
||||||
|
#include <irecipientfilter.h>
|
||||||
|
#include <sh_list.h>
|
||||||
|
#include <sh_string.h>
|
||||||
|
|
||||||
|
using namespace SourceHook;
|
||||||
|
|
||||||
|
class TempEntityInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TempEntityInfo(const char *name, void *me);
|
||||||
|
public:
|
||||||
|
const char *GetName();
|
||||||
|
bool IsValidProp(const char *name);
|
||||||
|
bool TE_SetEntData(const char *name, int value);
|
||||||
|
bool TE_SetEntDataFloat(const char *name, float value);
|
||||||
|
bool TE_SetEntDataVector(const char *name, float vector[3]);
|
||||||
|
void Send(IRecipientFilter &filter, float delay);
|
||||||
|
private:
|
||||||
|
int _FindOffset(const char *name, int *size=NULL);
|
||||||
|
private:
|
||||||
|
void *m_Me;
|
||||||
|
ServerClass *m_Sc;
|
||||||
|
String m_Name;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TempEntityManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TempEntityManager() : m_NameOffs(0), m_NextOffs(0), m_GetClassNameOffs(0), m_Loaded(false) {}
|
||||||
|
public:
|
||||||
|
void Initialize();
|
||||||
|
bool IsAvailable();
|
||||||
|
void Shutdown();
|
||||||
|
public:
|
||||||
|
TempEntityInfo *GetTempEntityInfo(const char *name);
|
||||||
|
private:
|
||||||
|
List<TempEntityInfo *> m_TEList;
|
||||||
|
IBasicTrie *m_TempEntInfo;
|
||||||
|
void *m_ListHead;
|
||||||
|
int m_NameOffs;
|
||||||
|
int m_NextOffs;
|
||||||
|
int m_GetClassNameOffs;
|
||||||
|
bool m_Loaded;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern TempEntityManager g_TEManager;
|
||||||
|
|
||||||
|
#endif //_INCLUDE_SOURCEMOD_TEMPENTS_H_
|
169
extensions/sdktools/tenatives.cpp
Normal file
169
extensions/sdktools/tenatives.cpp
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* ===============================================================
|
||||||
|
* SourceMod SDK Tools Extension
|
||||||
|
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
||||||
|
* ===============================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* Version: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "tempents.h"
|
||||||
|
#include "CellRecipientFilter.h"
|
||||||
|
|
||||||
|
CellRecipientFilter g_TERecFilter;
|
||||||
|
TempEntityInfo *g_CurrentTE = NULL;
|
||||||
|
|
||||||
|
static cell_t smn_TEStart(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
if (!g_TEManager.IsAvailable())
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("TempEntity System unsupported or not available, file a bug report");
|
||||||
|
}
|
||||||
|
|
||||||
|
char *name;
|
||||||
|
pContext->LocalToString(params[1], &name);
|
||||||
|
|
||||||
|
g_CurrentTE = g_TEManager.GetTempEntityInfo(name);
|
||||||
|
if (!g_CurrentTE)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Invalid TempEntity name: \"%s\"", name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell_t smn_TEWriteNum(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
if (!g_TEManager.IsAvailable())
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("TempEntity System unsupported or not available, file a bug report");
|
||||||
|
}
|
||||||
|
if (!g_CurrentTE)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("No TempEntity call is in progress");
|
||||||
|
}
|
||||||
|
|
||||||
|
char *prop;
|
||||||
|
pContext->LocalToString(params[1], &prop);
|
||||||
|
|
||||||
|
if (!g_CurrentTE->TE_SetEntData(prop, params[2]))
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Temp entity property \"%s\" not found", prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell_t smn_TE_WriteFloat(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
if (!g_TEManager.IsAvailable())
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("TempEntity System unsupported or not available, file a bug report");
|
||||||
|
}
|
||||||
|
if (!g_CurrentTE)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("No TempEntity call is in progress");
|
||||||
|
}
|
||||||
|
|
||||||
|
char *prop;
|
||||||
|
pContext->LocalToString(params[1], &prop);
|
||||||
|
|
||||||
|
if (!g_CurrentTE->TE_SetEntDataFloat(prop, sp_ctof(params[2])))
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Temp entity property \"%s\" not found", prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell_t smn_TEWriteVector(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
if (!g_TEManager.IsAvailable())
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("TempEntity System unsupported or not available, file a bug report");
|
||||||
|
}
|
||||||
|
if (!g_CurrentTE)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("No TempEntity call is in progress");
|
||||||
|
}
|
||||||
|
|
||||||
|
char *prop;
|
||||||
|
pContext->LocalToString(params[1], &prop);
|
||||||
|
|
||||||
|
cell_t *addr;
|
||||||
|
pContext->LocalToPhysAddr(params[2], &addr);
|
||||||
|
float vec[3] = {sp_ctof(addr[0]), sp_ctof(addr[1]), sp_ctof(addr[2])};
|
||||||
|
|
||||||
|
if (!g_CurrentTE->TE_SetEntDataVector(prop, vec))
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Temp entity property \"%s\" not found", prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell_t smn_TESend(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
if (!g_TEManager.IsAvailable())
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("TempEntity System unsupported or not available, file a bug report");
|
||||||
|
}
|
||||||
|
if (!g_CurrentTE)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("No TempEntity call is in progress");
|
||||||
|
}
|
||||||
|
|
||||||
|
cell_t *cl_array;
|
||||||
|
pContext->LocalToPhysAddr(params[1], &cl_array);
|
||||||
|
|
||||||
|
g_TERecFilter.Reset();
|
||||||
|
g_TERecFilter.Initialize(cl_array, params[2]);
|
||||||
|
|
||||||
|
g_CurrentTE->Send(g_TERecFilter, sp_ctof(params[3]));
|
||||||
|
g_CurrentTE = NULL;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell_t smn_TEIsValidProp(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
if (!g_TEManager.IsAvailable())
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("TempEntity System unsupported or not available, file a bug report");
|
||||||
|
}
|
||||||
|
if (!g_CurrentTE)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("No TempEntity call is in progress");
|
||||||
|
}
|
||||||
|
|
||||||
|
char *prop;
|
||||||
|
pContext->LocalToString(params[1], &prop);
|
||||||
|
|
||||||
|
return g_CurrentTE->IsValidProp(prop) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sp_nativeinfo_t g_TENatives[] =
|
||||||
|
{
|
||||||
|
{"TE_Start", smn_TEStart},
|
||||||
|
{"TE_WriteNum", smn_TEWriteNum},
|
||||||
|
{"TE_WriteFloat", smn_TE_WriteFloat},
|
||||||
|
{"TE_WriteVector", smn_TEWriteVector},
|
||||||
|
{"TE_WriteAngles", smn_TEWriteVector},
|
||||||
|
{"TE_Send", smn_TESend},
|
||||||
|
{"TE_IsValidProp", smn_TEIsValidProp},
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
@ -1,3 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* ===============================================================
|
||||||
|
* SourceMod SDK Tools Extension
|
||||||
|
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
||||||
|
* ===============================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* Version: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
#include "vcallbuilder.h"
|
#include "vcallbuilder.h"
|
||||||
#include "extension.h"
|
#include "extension.h"
|
||||||
|
|
||||||
|
@ -1,3 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* ===============================================================
|
||||||
|
* SourceMod SDK Tools Extension
|
||||||
|
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
||||||
|
* ===============================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* Version: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _INCLUDE_SOURCEMOD_VALVE_CALLER_H_
|
#ifndef _INCLUDE_SOURCEMOD_VALVE_CALLER_H_
|
||||||
#define _INCLUDE_SOURCEMOD_VALVE_CALLER_H_
|
#define _INCLUDE_SOURCEMOD_VALVE_CALLER_H_
|
||||||
|
|
||||||
|
@ -1,3 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* ===============================================================
|
||||||
|
* SourceMod SDK Tools Extension
|
||||||
|
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
||||||
|
* ===============================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* Version: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
#include "extension.h"
|
#include "extension.h"
|
||||||
#include "vcallbuilder.h"
|
#include "vcallbuilder.h"
|
||||||
|
|
||||||
|
@ -1,3 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* ===============================================================
|
||||||
|
* SourceMod SDK Tools Extension
|
||||||
|
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
||||||
|
* ===============================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* Version: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
#include "smsdk_ext.h"
|
#include "smsdk_ext.h"
|
||||||
#include "extension.h"
|
#include "extension.h"
|
||||||
#include "vdecoder.h"
|
#include "vdecoder.h"
|
||||||
|
@ -1,3 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* ===============================================================
|
||||||
|
* SourceMod SDK Tools Extension
|
||||||
|
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
||||||
|
* ===============================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* Version: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _INCLUDE_SOURCEMOD_VDECODER_H_
|
#ifndef _INCLUDE_SOURCEMOD_VDECODER_H_
|
||||||
#define _INCLUDE_SOURCEMOD_VDECODER_H_
|
#define _INCLUDE_SOURCEMOD_VDECODER_H_
|
||||||
|
|
||||||
|
@ -1,3 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* ===============================================================
|
||||||
|
* SourceMod SDK Tools Extension
|
||||||
|
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
||||||
|
* ===============================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* Version: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
#include "extension.h"
|
#include "extension.h"
|
||||||
#include "vcallbuilder.h"
|
#include "vcallbuilder.h"
|
||||||
#include "vnatives.h"
|
#include "vnatives.h"
|
||||||
|
@ -1,3 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* ===============================================================
|
||||||
|
* SourceMod SDK Tools Extension
|
||||||
|
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
||||||
|
* ===============================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* Version: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _INCLUDE_SDKTOOLS_VNATIVES_H_
|
#ifndef _INCLUDE_SDKTOOLS_VNATIVES_H_
|
||||||
#define _INCLUDE_SDKTOOLS_VNATIVES_H_
|
#define _INCLUDE_SDKTOOLS_VNATIVES_H_
|
||||||
|
|
||||||
|
@ -41,4 +41,50 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Temp Entities Section */
|
||||||
|
"#default"
|
||||||
|
{
|
||||||
|
"#supported"
|
||||||
|
{
|
||||||
|
"game" "cstrike"
|
||||||
|
"game" "dod"
|
||||||
|
"game" "hl2mp"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Offsets"
|
||||||
|
{
|
||||||
|
/* Offset into CBaseTempEntity constructor */
|
||||||
|
"s_pTempEntities"
|
||||||
|
{
|
||||||
|
"windows" "17"
|
||||||
|
"linux" "27"
|
||||||
|
}
|
||||||
|
"GetTEName"
|
||||||
|
{
|
||||||
|
"windows" "4"
|
||||||
|
"linux" "4"
|
||||||
|
}
|
||||||
|
"GetTENext"
|
||||||
|
{
|
||||||
|
"windows" "8"
|
||||||
|
"linux" "8"
|
||||||
|
}
|
||||||
|
"TE_GetServerClass"
|
||||||
|
{
|
||||||
|
"windows" "1"
|
||||||
|
"linux" "1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"Signatures"
|
||||||
|
{
|
||||||
|
"CBaseTempEntity"
|
||||||
|
{
|
||||||
|
"library" "server"
|
||||||
|
"windows" "\x8B\xC1\x8B\x4C\x24\x04\xC7\x00\x2A\x2A\x2A\x2A\x89\x48\x04\x8B\x15\x2A\x2A\x2A\x2A\x89\x50\x08\xA3\x2A\x2A\x2A\x2A\xC2\x04\x00"
|
||||||
|
"linux" "@_ZN15CBaseTempEntityC2EPKc"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <core>
|
#include <core>
|
||||||
#include <sdktools_functions>
|
#include <sdktools_functions>
|
||||||
|
#include <sdktools_tempents>
|
||||||
|
|
||||||
enum SDKCallType
|
enum SDKCallType
|
||||||
{
|
{
|
||||||
|
142
plugins/include/sdktools_tempents.inc
Normal file
142
plugins/include/sdktools_tempents.inc
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* ===============================================================
|
||||||
|
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
|
||||||
|
* ===============================================================
|
||||||
|
*
|
||||||
|
* This file is part of the SourceMod/SourcePawn SDK. This file may only be used
|
||||||
|
* or modified under the Terms and Conditions of its License Agreement, which is found
|
||||||
|
* in LICENSE.txt. The Terms and Conditions for making SourceMod extensions/plugins
|
||||||
|
* may change at any time. To view the latest information, see:
|
||||||
|
* http://www.sourcemod.net/license.php
|
||||||
|
*
|
||||||
|
* Version: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined _sdktools_tempents_included
|
||||||
|
#endinput
|
||||||
|
#endif
|
||||||
|
#define _sdktools_tempents_included
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts a temp entity transmission.
|
||||||
|
*
|
||||||
|
* @param te_name TE name.
|
||||||
|
* @noreturn
|
||||||
|
* @error Temp Entity name not available.
|
||||||
|
*/
|
||||||
|
native TE_Start(const String:te_name[]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a certain TE property exists.
|
||||||
|
*
|
||||||
|
* @param prop Property to use.
|
||||||
|
* @return True if the property exists, otherwise false.
|
||||||
|
*/
|
||||||
|
native bool:TE_IsValidProp(const String:prop[]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets an integer value in the current temp entity.
|
||||||
|
*
|
||||||
|
* @param prop Property to use.
|
||||||
|
* @param value Integer value to set.
|
||||||
|
* @noreturn
|
||||||
|
* @error Property not found.
|
||||||
|
*/
|
||||||
|
native TE_WriteNum(const String:prop[], value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a floating point number in the current temp entity.
|
||||||
|
*
|
||||||
|
* @param prop Property to use.
|
||||||
|
* @param value Floating point number to set.
|
||||||
|
* @noreturn
|
||||||
|
* @error Property not found.
|
||||||
|
*/
|
||||||
|
native TE_WriteFloat(const String:prop[], Float:value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a vector in the current temp entity.
|
||||||
|
*
|
||||||
|
* @param prop Property to use.
|
||||||
|
* @param vector Vector to set.
|
||||||
|
* @noreturn
|
||||||
|
* @error Property not found.
|
||||||
|
*/
|
||||||
|
native TE_WriteVector(const String:prop[], Float:vector[3]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a QAngle in the current temp entity.
|
||||||
|
*
|
||||||
|
* @param prop Property to use.
|
||||||
|
* @param angles Angles to set.
|
||||||
|
* @return True on success, otherwise false.
|
||||||
|
* @error Property not found.
|
||||||
|
*/
|
||||||
|
native TE_WriteAngles(const String:prop[], Float:angles[3]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends the current temp entity to one or more clients.
|
||||||
|
*
|
||||||
|
* @param clients Array containing player indexes to broadcast to.
|
||||||
|
* @param numClients Number of players in the array.
|
||||||
|
* @param delay Delay in seconds to send the TE.
|
||||||
|
* @noreturn
|
||||||
|
* @error Invalid client index or client not in game.
|
||||||
|
*/
|
||||||
|
native TE_Send(clients[], numClients, Float:delay=0.0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets an encoded entity index in the current temp entity.
|
||||||
|
* (This is usually used for m_nStartEntity and m_nEndEntity).
|
||||||
|
*
|
||||||
|
* @param prop Property to use.
|
||||||
|
* @param value Value to set.
|
||||||
|
* @noreturn
|
||||||
|
* @error Property not found.
|
||||||
|
*/
|
||||||
|
stock TE_WriteEncodedEnt(const String:prop[], value)
|
||||||
|
{
|
||||||
|
new encvalue = (value & 0x0FFF) | ((1 & 0xF)<<12);
|
||||||
|
return TE_WriteNum(prop, encvalue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Broadcasts the current temp entity to all clients.
|
||||||
|
* @note See TE_Start().
|
||||||
|
*
|
||||||
|
* @param delay Delay in seconds to send the TE.
|
||||||
|
* @noreturn
|
||||||
|
*/
|
||||||
|
stock TE_SendToAll(Float:delay=0.0)
|
||||||
|
{
|
||||||
|
new maxClients = GetMaxClients();
|
||||||
|
new total = 0;
|
||||||
|
new clients[maxClients];
|
||||||
|
for (new i=1; i<=maxClients; i++)
|
||||||
|
{
|
||||||
|
if (IsClientInGame(i))
|
||||||
|
{
|
||||||
|
clients[total++] = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TE_Send(clients, total, delay);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends the current TE to only a client.
|
||||||
|
* @note See TE_Start().
|
||||||
|
*
|
||||||
|
* @param client Client to send to.
|
||||||
|
* @param delay Delay in seconds to send the TE.
|
||||||
|
* @noreturn
|
||||||
|
* @error Invalid client index or client not in game.
|
||||||
|
*/
|
||||||
|
stock TE_SendToOne(client, Float:delay=0.0)
|
||||||
|
{
|
||||||
|
new players[1];
|
||||||
|
|
||||||
|
players[0] = client;
|
||||||
|
|
||||||
|
return TE_Send(players, 1, delay);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user