fixed using newer engine functions on The Ship because Valve can't version properly

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40691
This commit is contained in:
David Anderson 2007-04-12 16:28:29 +00:00
parent 4e6834a7a4
commit ccdddc16fb
4 changed files with 27 additions and 19 deletions

View File

@ -16,6 +16,7 @@
#include "sourcemm_api.h"
CHalfLife2 g_HL2;
bool g_IsOriginalEngine = false;
namespace SourceHook
{
@ -69,7 +70,7 @@ CSharedEdictChangeInfo *g_pSharedChangeInfo = NULL;
void CHalfLife2::OnSourceModStartup(bool late)
{
if (!g_pSharedChangeInfo)
if (!g_IsOriginalEngine && !g_pSharedChangeInfo)
{
g_pSharedChangeInfo = engine->GetSharedEdictChangeInfo();
}
@ -80,12 +81,6 @@ IChangeInfoAccessor *CBaseEdict::GetChangeAccessor()
return engine->GetChangeAccessor( (const edict_t *)this );
}
#if 0
void CHalfLife2::OnSourceModAllShutdown()
{
}
#endif
SendProp *UTIL_FindInSendTable(SendTable *pTable, const char *name)
{
const char *pname;
@ -217,3 +212,18 @@ typedescription_t *CHalfLife2::FindInDataMap(datamap_t *pMap, const char *offset
return td;
}
void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
{
if (!g_IsOriginalEngine)
{
if (offset)
{
pEdict->StateChanged(offset);
} else {
pEdict->StateChanged();
}
} else {
pEdict->m_fStateFlags |= FL_EDICT_CHANGED;
}
}

View File

@ -22,6 +22,7 @@
#include "dt_send.h"
#include "server_class.h"
#include "datamap.h"
#include "edict.h"
using namespace SourceHook;
@ -49,6 +50,7 @@ public:
SendProp *FindInSendTable(const char *classname, const char *offset);
ServerClass *FindServerClass(const char *classname);
typedescription_t *FindInDataMap(datamap_t *pMap, const char *offset);
void SetEdictStateChanged(edict_t *pEdict, unsigned short offset);
private:
DataTableInfo *_FindServerClass(const char *classname);
private:
@ -58,5 +60,6 @@ private:
};
extern CHalfLife2 g_HL2;
extern bool g_IsOriginalEngine;
#endif //_INCLUDE_SOURCEMOD_CHALFLIFE2_H_

View File

@ -298,7 +298,7 @@ static cell_t SetEntData(IPluginContext *pContext, const cell_t *params)
if (params[5])
{
pEdict->StateChanged(offset);
g_HL2.SetEdictStateChanged(pEdict, offset);
}
switch (params[4])
@ -366,7 +366,7 @@ static cell_t SetEntDataFloat(IPluginContext *pContext, const cell_t *params)
if (params[4])
{
pEdict->StateChanged(offset);
g_HL2.SetEdictStateChanged(pEdict, offset);
}
return 1;
@ -427,7 +427,7 @@ static cell_t SetEntDataVector(IPluginContext *pContext, const cell_t *params)
if (params[4])
{
pEdict->StateChanged(offset);
g_HL2.SetEdictStateChanged(pEdict, offset);
}
return 1;
@ -494,7 +494,7 @@ static cell_t SetEntDataEnt(IPluginContext *pContext, const cell_t *params)
if (params[4])
{
pEdict->StateChanged(offset);
g_HL2.SetEdictStateChanged(pEdict, offset);
}
return 1;
@ -509,12 +509,7 @@ static cell_t ChangeEdictState(IPluginContext *pContext, const cell_t *params)
return pContext->ThrowNativeError("Edict %d is invalid", params[1]);
}
if (params[2])
{
pEdict->StateChanged(params[2]);
} else {
pEdict->StateChanged();
}
g_HL2.SetEdictStateChanged(pEdict, params[2]);
return 1;
}

View File

@ -116,7 +116,7 @@ private:
};
extern SourceModBase g_SourceMod;
extern HandleType_t g_WrBitBufType;
extern HandleType_t g_RdBitBufType;
extern HandleType_t g_WrBitBufType; //:TODO: find a better place for this
extern HandleType_t g_RdBitBufType; //:TODO: find a better place for this
#endif //_INCLUDE_SOURCEMOD_GLOBALHEADER_H_