本文整理汇总了C++中REMOVE_ENTITY函数的典型用法代码示例。如果您正苦于以下问题:C++ REMOVE_ENTITY函数的具体用法?C++ REMOVE_ENTITY怎么用?C++ REMOVE_ENTITY使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了REMOVE_ENTITY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GenericCyclerSpawn
void CInfoCommentary :: GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax)
{
if (!szModel || !*szModel)
{
ALERT(at_error, "cycler at %.0f %.0f %0.f missing modelname", pev->origin.x, pev->origin.y, pev->origin.z );
REMOVE_ENTITY(ENT(pev));
return;
}
//ignored on subsequent calls
char* szSoundFile = (char*) STRING(pev->message);
if ( !FStringNull( pev->message ) && strlen( szSoundFile ) > 1 )
{
PRECACHE_SOUND(szSoundFile);
}
//ignored on subsequent calls
pev->classname = MAKE_STRING("info_commentary");
PRECACHE_MODEL( szModel );
SET_MODEL(ENT(pev), szModel);
CCycler::Spawn( );
UTIL_SetSize(pev, vecMin, vecMax);
}
示例2: BloodGush
void CCineBlood :: BloodGush ( void )
{
Vector vecSplatDir;
TraceResult tr;
pev->nextthink = gpGlobals->time + 0.1;
UTIL_MakeVectors(pev->angles);
if ( pev->health-- < 0 )
REMOVE_ENTITY(ENT(pev));
// CHANGE_METHOD ( ENT(pev), em_think, SUB_Remove );
if ( RANDOM_FLOAT ( 0 , 1 ) < 0.7 )// larger chance of globs
{
UTIL_BloodDrips( pev->origin, UTIL_RandomBloodVector(), BLOOD_COLOR_RED, 10 );
}
else// slim chance of geyser
{
UTIL_BloodStream( pev->origin, UTIL_RandomBloodVector(), BLOOD_COLOR_RED, RANDOM_LONG(50, 150) );
}
if ( RANDOM_FLOAT ( 0, 1 ) < 0.75 )
{ // decals the floor with blood.
vecSplatDir = Vector ( 0 , 0 , -1 );
vecSplatDir = vecSplatDir + (RANDOM_FLOAT(-1,1) * 0.6 * gpGlobals->v_right) + (RANDOM_FLOAT(-1,1) * 0.6 * gpGlobals->v_forward);// randomize a bit
UTIL_TraceLine( pev->origin + Vector ( 0, 0 , 64) , pev->origin + vecSplatDir * 256, ignore_monsters, ENT(pev), &tr);
if ( tr.flFraction != 1.0 )
{
// Decal with a bloodsplat
UTIL_BloodDecalTrace( &tr, BLOOD_COLOR_RED );
}
}
}
示例3: Spawn
//=========================================================
//=========================================================
void CFlockingFlyerFlock :: Spawn( )
{
Precache( );
SpawnFlock();
REMOVE_ENTITY(ENT(pev)); // dump the spawn ent
}
示例4: GetAddressVtableByClassname
void HIDDEN GetAddressVtableByClassname(const char *szClassName, const int iOffset, bool bCreate)
{
void *vtable;
if (bCreate)
{
edict_t *pObject = CREATE_ENTITY();
void *addr = GetFunctionEntity(szClassName);
if (addr == NULL)
{
//can't create object.
printf2(__FUNCTION__ ":: Not found export function of binaries. Presumably looks '__declspec(dllexport) void %s(entvars_t *pev)'", szClassName);
REMOVE_ENTITY(pObject);
return;
}
// call link to class GetClassPtr<BaseClass>(pev);
reinterpret_cast<void (*)(entvars_t *)>(addr)(&pObject->v);
vtable = *(void **)pObject->pvPrivateData;
}
else
{
VirtualTableRef *refsVtbl = GetVirtualTableRefAddr(szClassName);
vtable = (void *)refsVtbl->originalAddress;
}
printf2(__FUNCTION__ "* ADDRESS VTABLE: %p | ADDRESS VIRTUAL FUNC: %p",
OffsetToRebase((size_t)vtable),
OffsetToRebase(*(((size_t **)&vtable)[ iOffset ])));
}
示例5: switch
void CWorldItem::Spawn( void )
{
CBaseEntity *pEntity = NULL;
switch (m_iType)
{
case 44: // ITEM_BATTERY:
pEntity = CBaseEntity::Create( "item_battery", pev->origin, pev->angles );
break;
case 42: // ITEM_ANTIDOTE:
pEntity = CBaseEntity::Create( "item_antidote", pev->origin, pev->angles );
break;
case 43: // ITEM_SECURITY:
pEntity = CBaseEntity::Create( "item_security", pev->origin, pev->angles );
break;
case 45: // ITEM_SUIT:
pEntity = CBaseEntity::Create( "item_suit", pev->origin, pev->angles );
break;
}
if (!pEntity)
{
ALERT( at_console, "unable to create world_item %d\n", m_iType );
}
else
{
pEntity->pev->target = pev->target;
pEntity->pev->targetname = pev->targetname;
pEntity->pev->spawnflags = pev->spawnflags;
}
REMOVE_ENTITY(edict());
}
示例6: switch
void CWorldItem::__MAKE_VHOOK(Spawn)()
{
CBaseEntity *pEntity = NULL;
switch (m_iType)
{
case 41: // ITEM_HEALTHKIT
break;
case 42: // ITEM_ANTIDOTE
pEntity = CBaseEntity::Create("item_antidote", pev->origin, pev->angles);
break;
case 43: // ITEM_SECURITY
pEntity = CBaseEntity::Create("item_security", pev->origin, pev->angles);
break;
case 44: // ITEM_BATTERY
pEntity = CBaseEntity::Create("item_battery", pev->origin, pev->angles);
break;
case 45: // ITEM_SUIT
pEntity = CBaseEntity::Create("item_suit", pev->origin, pev->angles);
break;
}
if (pEntity != NULL)
{
pEntity->pev->target = pev->target;
pEntity->pev->targetname = pev->targetname;
pEntity->pev->spawnflags = pev->spawnflags;
}
REMOVE_ENTITY(edict());
}
示例7: VirtualProtect
void NPC::Remove()
{
m_workNPC = false;
if (vtable != null)
{
int **ivtable = (int **)vtable;
if (vFcTraceAttack != null)
{
DWORD OldFlags;
VirtualProtect(&ivtable[TraceAttackOffset], sizeof(int*), PAGE_READWRITE, &OldFlags);
ivtable[TraceAttackOffset] = (int *)vFcTraceAttack;
VirtualFree(HookTraceAttack, 0, MEM_RELEASE);
}
if (vFcTakeDamage != null)
{
DWORD OldFlags;
VirtualProtect(&ivtable[TakeDamageOffset], sizeof(int*), PAGE_READWRITE, &OldFlags);
ivtable[TakeDamageOffset] = (int *)vFcTakeDamage;
VirtualFree(HookTakeDamage, 0, MEM_RELEASE);
}
}
if (pev != null && !FNullEnt(GetEntity()) && pvData == GetEntity()->pvPrivateData)
{
SetEntityAction(GetIndex(), -1, -1);
REMOVE_ENTITY(GetEntity());
}
}
示例8: csdm_give_item
//shamelessly pulled from fun
static cell AMX_NATIVE_CALL csdm_give_item(AMX *amx, cell *params) // native give_item(index, const item[]); = 2 params
{
// Check index.
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", params[1]);
return 0;
} else if (!MF_IsPlayerIngame(params[1])) {
MF_LogError(amx, AMX_ERR_NATIVE, "Player %d is not in game", params[1]);
return 0;
}
// Get player pointer.
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
// Create item entity pointer
edict_t *pItemEntity;
// Make an "intstring" out of 2nd parameter
int length;
const char *szItem = MF_GetAmxString(amx, params[2], 1, &length);
//check for valid item
if (strncmp(szItem, "weapon_", 7) &&
strncmp(szItem, "ammo_", 5) &&
strncmp(szItem, "item_", 5) &&
strncmp(szItem, "tf_weapon_", 10)
) {
return 0;
}
string_t item = ALLOC_STRING(szItem); // Using MAKE_STRING makes "item" contents get lost when we leave this scope! ALLOC_STRING seems to allocate properly...
pItemEntity = CREATE_NAMED_ENTITY(item);
if (FNullEnt(pItemEntity)) {
MF_LogError(amx, AMX_ERR_NATIVE, "Item \"%s\" failed to create", szItem);
return 0;
}
pItemEntity->v.origin = pPlayer->v.origin;
pItemEntity->v.spawnflags |= (1 << 30); //SF_NORESPAWN;
MDLL_Spawn(pItemEntity);
int save = pItemEntity->v.solid;
MDLL_Touch(pItemEntity, ENT(pPlayer));
if (pItemEntity->v.solid == save)
{
REMOVE_ENTITY(pItemEntity);
//the function did not fail - we're just deleting the item
return -1;
}
return ENTINDEX(pItemEntity);
}
示例9: SUB_UseTargets
/* <184158> ../cstrike/dlls/subs.cpp:357 */
void CBaseDelay::DelayThink(void)
{
CBaseEntity *pActivator = NULL;
if (pev->owner)
pActivator = CBaseEntity::Instance(pev->owner);
SUB_UseTargets(pActivator, (USE_TYPE)pev->button, 0.0f);
REMOVE_ENTITY(ENT(pev));
}
示例10: SUB_UseTargets
void CBaseDelay::DelayThink( void )
{
CBaseEntity *pActivator = NULL;
// The use type is cached (and stashed) in pev->button
//LRC - now using m_hActivator.
SUB_UseTargets( m_hActivator, (USE_TYPE)pev->button, 0 );
REMOVE_ENTITY(ENT(pev));
}
示例11: UpdateOnRemove
/* <183f38> ../cstrike/dlls/subs.cpp:120 */
void CBaseEntity::SUB_Remove(void)
{
UpdateOnRemove();
if (pev->health > 0)
{
pev->health = 0;
ALERT(at_aiconsole, "SUB_Remove called on entity with health > 0\n");
}
REMOVE_ENTITY(ENT(pev));
}
示例12: RemoveAllNodeEntity
void RemoveAllNodeEntity()
{
CEntity *pFoundNode = UTIL_FindEntityByClassname(NULL, "info_node");
if (pFoundNode == NULL)
return; // No node entities
do {
CEntity *pNextNode = UTIL_FindEntityByClassname(pFoundNode, "info_node");
REMOVE_ENTITY(pFoundNode->edict());
pFoundNode = pNextNode;
} while (pFoundNode != NULL);
}
示例13: remove_entity
static cell AMX_NATIVE_CALL remove_entity(AMX *amx, cell *params)
{
int id = params[1];
edict_t *pEnt = INDEXENT2(id);
if (FNullEnt(pEnt))
return 0;
REMOVE_ENTITY(pEnt);
return 1;
}
示例14: SUB_Remove
// Convenient way to delay removing oneself
void CBaseEntity :: SUB_Remove( void )
{
UpdateOnRemove();
if (pev->health > 0)
{
// this situation can screw up monsters who can't tell their entity pointers are invalid.
pev->health = 0;
ALERT( at_aiconsole, "SUB_Remove called on entity with health > 0\n");
}
REMOVE_ENTITY(ENT(pev));
}
示例15: SUB_UseTargets
void CBaseDelay::DelayThink( void )
{
CBaseEntity *pActivator = NULL;
if ( pev->owner != NULL ) // A player activated this on delay
{
pActivator = CBaseEntity::Instance( pev->owner );
}
// The use type is cached (and stashed) in pev->button
SUB_UseTargets( pActivator, (USE_TYPE)pev->button, 0 );
REMOVE_ENTITY(ENT(pev));
}