本文整理汇总了C++中CBaseMonster类的典型用法代码示例。如果您正苦于以下问题:C++ CBaseMonster类的具体用法?C++ CBaseMonster怎么用?C++ CBaseMonster使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBaseMonster类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetPartner
void CUIActorMenu::SetPartner(CInventoryOwner* io)
{
R_ASSERT (!IsShown());
m_pPartnerInvOwner = io;
if ( m_pPartnerInvOwner )
{
CBaseMonster* monster = smart_cast<CBaseMonster*>( m_pPartnerInvOwner );
if ( monster || m_pPartnerInvOwner->use_simplified_visual() )
{
m_PartnerCharacterInfo->ClearInfo();
if ( monster )
{
shared_str monster_tex_name = pSettings->r_string( monster->cNameSect(), "icon" );
// m_PartnerCharacterInfo->UIIcon().InitTexture( monster_tex_name.c_str() );
// m_PartnerCharacterInfo->UIIcon().SetStretchTexture( true );
m_PartnerCharacterInfo->InitMonsterCharacter(monster_tex_name);
}
}
else
{
m_PartnerCharacterInfo->InitCharacter( m_pPartnerInvOwner->object_id() );
}
SetInvBox( NULL );
}
else
{
m_PartnerCharacterInfo->ClearInfo();
}
}
示例2: ScriptEntityCancel
void ScriptEntityCancel(edict_t *pentCine)
{
// make sure they are a scripted_sequence
if(FClassnameIs(pentCine, CLASSNAME))
{
CCineMonster *pCineTarget = GetClassPtr((CCineMonster *)VARS(pentCine));
// make sure they have a monster in mind for the script
CBaseEntity * pEntity = pCineTarget->m_hTargetEnt;
CBaseMonster *pTarget = NULL;
if(pEntity)
pTarget = pEntity->MyMonsterPointer();
if(pTarget)
{
// make sure their monster is actually playing a script
if(pTarget->m_MonsterState == MONSTERSTATE_SCRIPT)
{
// tell them do die
pTarget->m_scriptState = CCineMonster::SCRIPT_CLEANUP;
// do it now
pTarget->CineCleanup();
}
}
}
}
示例3: FormFlock
//=========================================================
// Leader boid calls this to form a flock from surrounding boids
//=========================================================
void CFlockingFlyer :: FormFlock( void )
{
if ( !InSquad() )
{
// I am my own leader
m_pSquadLeader = this;
m_pSquadNext = NULL;
int squadCount = 1;
CBaseEntity *pEntity = NULL;
while ((pEntity = UTIL_FindEntityInSphere( pEntity, pev->origin, AFLOCK_MAX_RECRUIT_RADIUS )) != NULL)
{
CBaseMonster *pRecruit = pEntity->MyMonsterPointer( );
if ( pRecruit && pRecruit != this && pRecruit->IsAlive() && !pRecruit->m_pCine )
{
// Can we recruit this guy?
if ( FClassnameIs ( pRecruit->pev, "monster_flyer" ) )
{
squadCount++;
SquadAdd( (CFlockingFlyer *)pRecruit );
}
}
}
}
SetThink( &CFlockingFlyer::IdleThink );// now that flock is formed, go to idle and wait for a player to come along.
pev->nextthink = gpGlobals->time;
}
示例4: ChangeSub
void CTriggerSubModel :: ChangeSub ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if ( FStringNull ( pev->target ) )
return;
edict_t *pentTarget = FIND_ENTITY_BY_TARGETNAME ( NULL, STRING(pev->target) );
if ( FNullEnt(pentTarget) )
{
ALERT ( at_console, "CTriggerSubModel : pas d'entite s appelant %s\n", STRING(pev->target) );
return;
}
CBaseEntity *pTarget = Instance( pentTarget );
if ( pTarget->MyMonsterPointer() == NULL )
{
ALERT ( at_console, "CTriggerSubModel : %s n est pas un monstre\n", STRING(pev->target) );
return;
}
CBaseMonster *pMonster = (CBaseMonster*)pTarget;
pMonster->SetBodygroup( m_iBodygroup, m_iSubmodel);
}
示例5: Killed
//=========================================================
// Killed.
//=========================================================
void CBarnacle :: Killed( entvars_t *pevAttacker, int iGib )
{
CBaseMonster *pVictim;
pev->solid = SOLID_NOT;
pev->takedamage = DAMAGE_NO;
if ( m_hEnemy != NULL )
{
pVictim = m_hEnemy->MyMonsterPointer();
if ( pVictim )
{
pVictim->BarnacleVictimReleased();
}
}
// CGib::SpawnRandomGibs( pev, 4, 1 );
switch ( RANDOM_LONG ( 0, 1 ) )
{
case 0: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_die1.wav", 1, ATTN_NORM ); break;
case 1: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_die3.wav", 1, ATTN_NORM ); break;
}
SetActivity ( ACT_DIESIMPLE );
SetBoneController( 0, 0 );
StudioFrameAdvance( 0.1 );
SetNextThink( 0.1 );
SetThink(&CBarnacle :: WaitTillDead );
}
示例6: jump
void CScriptGameObject::jump(const Fvector &position, float factor)
{
CBaseMonster *monster = smart_cast<CBaseMonster*>(&object());
if (!monster) {
ai().script_engine().script_log (ScriptStorage::eLuaMessageTypeError,"CScriptGameObject : cannot process jump for not a monster!");
return;
}
monster->jump(position, factor);
}
示例7: InitCarBody
void CUICarBodyWnd::InitCarBody(CInventoryOwner* pOur, CInventoryOwner* pOthers)
{
m_pOurObject = pOur;
m_pOthersObject = pOthers;
m_pInventoryBox = NULL;
u16 our_id = smart_cast<CGameObject*>(m_pOurObject)->ID();
u16 other_id = smart_cast<CGameObject*>(m_pOthersObject)->ID();
m_pUICharacterInfoLeft->InitCharacter (our_id);
m_pUIOthersIcon->Show (true);
CBaseMonster *monster = NULL;
if(m_pOthersObject) {
monster = smart_cast<CBaseMonster *>(m_pOthersObject);
if (monster || m_pOthersObject->use_simplified_visual() )
{
m_pUICharacterInfoRight->ClearInfo ();
if(monster)
{
shared_str monster_tex_name = pSettings->r_string(monster->cNameSect(),"icon");
m_pUICharacterInfoRight->UIIcon().InitTexture(monster_tex_name.c_str());
m_pUICharacterInfoRight->UIIcon().SetStretchTexture(true);
}
}else
{
m_pUICharacterInfoRight->InitCharacter (other_id);
}
}
m_pUIPropertiesBox->Hide ();
EnableAll ();
UpdateLists ();
if(!monster){
CInfoPortionWrapper *known_info_registry = xr_new<CInfoPortionWrapper>();
known_info_registry->registry().init (other_id);
KNOWN_INFO_VECTOR& known_info = known_info_registry->registry().objects();
KNOWN_INFO_VECTOR_IT it = known_info.begin();
for(int i=0;it!=known_info.end();++it,++i){
(*it).info_id;
NET_Packet P;
CGameObject::u_EventGen (P,GE_INFO_TRANSFER, our_id);
P.w_u16 (0);//not used
P.w_stringZ ((*it).info_id); //сообщение
P.w_u8 (1); //добавление сообщения
CGameObject::u_EventSend (P);
}
known_info.clear ();
xr_delete (known_info_registry);
}
}
示例8:
int CScriptGameObject::CharacterRank ()
{
// rank support for monster
CBaseMonster *monster = smart_cast<CBaseMonster*>(&object());
if (!monster) {
CInventoryOwner* pInventoryOwner = smart_cast<CInventoryOwner*>(&object());
if (!pInventoryOwner) {
ai().script_engine().script_log (ScriptStorage::eLuaMessageTypeError,"CharacterRank available only for InventoryOwner and BaseMonster");
return 0;
}
return pInventoryOwner->Rank();
}
return monster->Rank();
}
示例9: Execute
virtual void Execute(LPCSTR args) {
string128 param1, param2;
_GetItem(args,0,param1,' ');
_GetItem(args,1,param2,' ');
CObject *obj = Level().Objects.FindObjectByName(param1);
CBaseMonster *monster = smart_cast<CBaseMonster *>(obj);
if (!monster) return;
u32 value2;
sscanf (param2,"%u",&value2);
monster->set_show_debug_info (u8(value2));
}
示例10: FIND_ENTITY_BY_TARGETNAME
// find a viable entity
int CCineMonster::FindEntity(void)
{
edict_t *pentTarget;
pentTarget = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(m_iszEntity));
m_hTargetEnt = NULL;
CBaseMonster *pTarget = NULL;
while(!FNullEnt(pentTarget))
{
if(FBitSet(VARS(pentTarget)->flags, FL_MONSTER))
{
pTarget = GetMonsterPointer(pentTarget);
if(pTarget && pTarget->CanPlaySequence(FCanOverrideState(), SS_INTERRUPT_BY_NAME))
{
m_hTargetEnt = pTarget;
return TRUE;
}
ALERT(at_console, "Found %s, but can't play!\n", STRING(m_iszEntity));
}
pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(m_iszEntity));
pTarget = NULL;
}
if(!pTarget)
{
CBaseEntity *pEntity = NULL;
while((pEntity = UTIL_FindEntityInSphere(pEntity, pev->origin, m_flRadius)) != NULL)
{
if(FClassnameIs(pEntity->pev, STRING(m_iszEntity)))
{
if(FBitSet(pEntity->pev->flags, FL_MONSTER))
{
pTarget = pEntity->MyMonsterPointer();
if(pTarget && pTarget->CanPlaySequence(FCanOverrideState(), SS_INTERRUPT_IDLE))
{
m_hTargetEnt = pTarget;
return TRUE;
}
}
}
}
}
pTarget = NULL;
m_hTargetEnt = NULL;
return FALSE;
}
示例11: FindEntity
// find a viable entity
bool CCineMonster::FindEntity()
{
m_hTargetEnt = nullptr;
CBaseEntity* pTargetEnt = nullptr;
CBaseMonster* pTarget = nullptr;
while( ( pTargetEnt = UTIL_FindEntityByTargetname( pTargetEnt, STRING( m_iszEntity ) ) ) != nullptr )
{
if( pTargetEnt->GetFlags().Any( FL_MONSTER ) )
{
pTarget = pTargetEnt->MyMonsterPointer();
if( pTarget && pTarget->CanPlaySequence( FCanOverrideState(), SS_INTERRUPT_BY_NAME ) )
{
m_hTargetEnt = pTarget;
return true;
}
ALERT( at_console, "Found %s, but can't play!\n", STRING( m_iszEntity ) );
}
pTarget = nullptr;
}
if( !pTarget )
{
pTargetEnt = nullptr;
while( ( pTargetEnt = UTIL_FindEntityInSphere( pTargetEnt, GetAbsOrigin(), m_flRadius ) ) != nullptr )
{
if( pTargetEnt->ClassnameIs( STRING( m_iszEntity ) ) )
{
if( pTargetEnt->GetFlags().Any( FL_MONSTER ) )
{
pTarget = pTargetEnt->MyMonsterPointer();
if( pTarget && pTarget->CanPlaySequence( FCanOverrideState(), SS_INTERRUPT_IDLE ) )
{
m_hTargetEnt = pTarget;
return true;
}
}
}
}
}
m_hTargetEnt = nullptr;
return false;
}
示例12: while
void CTalkMonster::ShutUpFriends( void )
{
CBaseEntity *pFriend = NULL;
int i;
// for each friend in this bsp...
for ( i = 0; i < TLK_CFRIENDS; i++ )
{
while( ( pFriend = EnumFriends( pFriend, i, true ) ) != nullptr )
{
CBaseMonster *pMonster = pFriend->MyMonsterPointer();
if ( pMonster )
{
pMonster->SentenceStop();
}
}
}
}
示例13: Activate
// Find an entity that I'm interested in and precache the sounds he'll need in the sequence.
void CCineMonster::Activate(void)
{
edict_t * pentTarget;
CBaseMonster *pTarget;
// The entity name could be a target name or a classname
// Check the targetname
pentTarget = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(m_iszEntity));
pTarget = NULL;
while(!pTarget && !FNullEnt(pentTarget))
{
if(FBitSet(VARS(pentTarget)->flags, FL_MONSTER))
{
pTarget = GetMonsterPointer(pentTarget);
}
pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(m_iszEntity));
}
// If no entity with that targetname, check the classname
if(!pTarget)
{
pentTarget = FIND_ENTITY_BY_CLASSNAME(NULL, STRING(m_iszEntity));
while(!pTarget && !FNullEnt(pentTarget))
{
pTarget = GetMonsterPointer(pentTarget);
pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(m_iszEntity));
}
}
// Found a compatible entity
if(pTarget)
{
void *pmodel;
pmodel = GET_MODEL_PTR(pTarget->edict());
if(pmodel)
{
// Look through the event list for stuff to precache
SequencePrecache(pmodel, STRING(m_iszIdle));
SequencePrecache(pmodel, STRING(m_iszPlay));
}
}
}
示例14: MakeGrunt
CBaseMonster *COsprey :: MakeGrunt( Vector vecSrc )
{
CBaseEntity *pEntity;
CBaseMonster *pGrunt;
TraceResult tr;
UTIL_TraceLine( vecSrc, vecSrc + Vector( 0, 0, -4096.0), dont_ignore_monsters, ENT(pev), &tr);
if ( tr.pHit && Instance( tr.pHit )->pev->solid != SOLID_BSP)
return NULL;
for (int i = 0; i < m_iUnits; i++)
{
if (m_hGrunt[i] == NULL || !m_hGrunt[i]->IsAlive())
{
if (m_hGrunt[i] != NULL && m_hGrunt[i]->pev->rendermode == kRenderNormal)
{
m_hGrunt[i]->SUB_StartFadeOut( );
}
pEntity = Create( "monster_human_grunt", vecSrc, GetAbsAngles() );
pGrunt = pEntity->MyMonsterPointer( );
pGrunt->pev->movetype = MOVETYPE_FLY;
pGrunt->SetAbsVelocity( Vector( 0, 0, RANDOM_FLOAT( -196, -128 ) ));
pGrunt->SetActivity( ACT_GLIDE );
CBeam *pBeam = CBeam::BeamCreate( "sprites/rope.spr", 10 );
pBeam->PointEntInit( vecSrc + Vector(0,0,112), pGrunt->entindex() );
pBeam->SetFlags( BEAM_FSOLID );
pBeam->SetColor( 255, 255, 255 );
pBeam->SetThink( SUB_Remove );
pBeam->pev->nextthink = gpGlobals->time + -4096.0 * tr.flFraction / pGrunt->GetAbsVelocity().z + 0.5;
// ALERT( at_console, "%d at %.0f %.0f %.0f\n", i, m_vecOrigin[i].x, m_vecOrigin[i].y, m_vecOrigin[i].z );
pGrunt->m_vecLastPosition = m_vecOrigin[i];
m_hGrunt[i] = pGrunt;
return pGrunt;
}
}
// ALERT( at_console, "none dead\n");
return NULL;
}
示例15: Activate
// Find an entity that I'm interested in and precache the sounds he'll need in the sequence.
void CCineMonster::Activate( void )
{
CBaseMonster* pTarget = nullptr;
CBaseEntity* pNextTarget = nullptr;
// The entity name could be a target name or a classname
// Check the targetname
while( !pTarget && ( pNextTarget = UTIL_FindEntityByTargetname( pNextTarget, STRING( m_iszEntity ) ) ) != nullptr )
{
if( pNextTarget->GetFlags().Any( FL_MONSTER ) )
{
pTarget = pNextTarget->MyMonsterPointer();
}
}
// If no entity with that targetname, check the classname
if( !pTarget )
{
pNextTarget = nullptr;
while( !pTarget && ( pNextTarget = UTIL_FindEntityByClassname( pNextTarget, STRING( m_iszEntity ) ) ) != nullptr )
{
pTarget = pNextTarget->MyMonsterPointer();
}
}
// Found a compatible entity
if( pTarget )
{
void *pmodel;
pmodel = GET_MODEL_PTR( pTarget->edict() );
if( pmodel )
{
// Look through the event list for stuff to precache
SequencePrecache( pmodel, STRING( m_iszIdle ) );
SequencePrecache( pmodel, STRING( m_iszPlay ) );
}
}
}