1.1 --- a/extensions/sdktools/trnatives.cpp Thu Jul 09 17:51:12 2009 -0400
1.2 +++ b/extensions/sdktools/trnatives.cpp Fri Jul 24 12:34:31 2009 +1200
1.3 @@ -38,8 +38,7 @@
1.4 bool ShouldHitEntity(IHandleEntity *pEntity, int contentsMask)
1.5 {
1.6 cell_t res = 1;
1.7 - edict_t *pEdict = gameents->BaseEntityToEdict(reinterpret_cast<CBaseEntity *>(pEntity));
1.8 - m_pFunc->PushCell(IndexOfEdict(pEdict));
1.9 + m_pFunc->PushCell(gamehelpers->EntityToBCompatRef(reinterpret_cast<CBaseEntity *>(pEntity)));
1.10 m_pFunc->PushCell(contentsMask);
1.11 m_pFunc->PushCell(m_Data);
1.12 m_pFunc->Execute(&res);
1.13 @@ -505,8 +504,7 @@
1.14 return pContext->ThrowNativeError("Invalid Handle %x (error %d)", params[1], err);
1.15 }
1.16
1.17 - edict_t *pEdict = gameents->BaseEntityToEdict(tr->m_pEnt);
1.18 - return IndexOfEdict(pEdict);
1.19 + return gamehelpers->EntityToBCompatRef(tr->m_pEnt);
1.20 }
1.21
1.22 static cell_t smn_TRGetPointContents(IPluginContext *pContext, const cell_t *params)
1.23 @@ -532,8 +530,7 @@
1.24 #else
1.25 mask = enginetrace->GetPointContents(pos, &hentity);
1.26 #endif
1.27 - edict_t *pEdict = gameents->BaseEntityToEdict(reinterpret_cast<CBaseEntity *>(hentity));
1.28 - *ent = IndexOfEdict(pEdict);
1.29 + *ent = gamehelpers->EntityToBCompatRef(reinterpret_cast<CBaseEntity *>(hentity));
1.30 }
1.31
1.32 return mask;
1.33 @@ -541,7 +538,8 @@
1.34
1.35 static cell_t smn_TRGetPointContentsEnt(IPluginContext *pContext, const cell_t *params)
1.36 {
1.37 - edict_t *pEdict = PEntityOfEntIndex(params[1]);
1.38 + /* TODO: See if we can get the collidable with a prop and remove the reliance on edicts */
1.39 + edict_t *pEdict = PEntityOfEntIndex(gamehelpers->ReferenceToIndex(params[1]));
1.40 if (!pEdict || pEdict->IsFree())
1.41 {
1.42 return pContext->ThrowNativeError("Entity %d is invalid", params[1]);