本文整理汇总了C++中CGameObject::H_Parent方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameObject::H_Parent方法的具体用法?C++ CGameObject::H_Parent怎么用?C++ CGameObject::H_Parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameObject
的用法示例。
在下文中一共展示了CGameObject::H_Parent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnRender
void CLevel::OnRender()
{
inherited::OnRender ();
if (!game)
return;
Game().OnRender();
//отрисовать трассы пуль
//Device.Statistic->TEST1.Begin();
BulletManager().Render();
//Device.Statistic->TEST1.End();
//отрисовать интерфейc пользователя
HUD().RenderUI();
#ifdef DEBUG
draw_wnds_rects();
ph_world->OnRender ();
#endif // DEBUG
#ifdef DEBUG
if (ai().get_level_graph())
ai().level_graph().render();
#ifdef DEBUG_PRECISE_PATH
test_precise_path ();
#endif
CAI_Stalker *stalker = smart_cast<CAI_Stalker*>(Level().CurrentEntity());
if (stalker)
stalker->OnRender ();
if (bDebug) {
for (u32 I=0; I < Level().Objects.o_count(); I++) {
CObject* _O = Level().Objects.o_get_by_iterator(I);
CAI_Stalker* stalker = smart_cast<CAI_Stalker*>(_O);
if (stalker)
stalker->OnRender ();
CPhysicObject *physic_object = smart_cast<CPhysicObject*>(_O);
if (physic_object)
physic_object->OnRender();
CSpaceRestrictor *space_restrictor = smart_cast<CSpaceRestrictor*> (_O);
if (space_restrictor)
space_restrictor->OnRender();
CClimableObject *climable = smart_cast<CClimableObject*> (_O);
if(climable)
climable->OnRender();
CTeamBaseZone *team_base_zone = smart_cast<CTeamBaseZone*>(_O);
if (team_base_zone)
team_base_zone->OnRender();
if (GameID() != eGameIDSingle)
{
CInventoryItem* pIItem = smart_cast<CInventoryItem*>(_O);
if (pIItem) pIItem->OnRender();
}
if (dbg_net_Draw_Flags.test(dbg_draw_skeleton)) //draw skeleton
{
CGameObject* pGO = smart_cast<CGameObject*> (_O);
if (pGO && pGO != Level().CurrentViewEntity() && !pGO->H_Parent())
{
if (pGO->Position().distance_to_sqr(Device.vCameraPosition) < 400.0f)
{
pGO->dbg_DrawSkeleton();
}
}
};
}
// [7/5/2005]
if (Server && Server->game) Server->game->OnRender();
// [7/5/2005]
ObjectSpace.dbgRender ();
//---------------------------------------------------------------------
HUD().Font().pFontStat->OutSet (170,630);
HUD().Font().pFontStat->SetHeight (16.0f);
HUD().Font().pFontStat->SetColor (0xffff0000);
if(Server)HUD().Font().pFontStat->OutNext ("Client Objects: [%d]",Server->GetEntitiesNum());
HUD().Font().pFontStat->OutNext ("Server Objects: [%d]",Objects.o_count());
HUD().Font().pFontStat->OutNext ("Interpolation Steps: [%d]", Level().GetInterpolationSteps());
HUD().Font().pFontStat->SetHeight (8.0f);
//---------------------------------------------------------------------
}
#endif
#ifdef DEBUG
if (bDebug) {
DBG().draw_object_info ();
DBG().draw_text ();
DBG().draw_level_info ();
}
debug_renderer().render ();
//.........这里部分代码省略.........
示例2: OnEvent
void CActor::OnEvent(NET_Packet& P, u16 type)
{
inherited::OnEvent (P,type);
CInventoryOwner::OnEvent (P,type);
u16 id;
switch (type)
{
case GE_TRADE_BUY:
case GE_OWNERSHIP_TAKE:
{
P.r_u16 (id);
CObject* Obj = Level().Objects.net_Find (id);
// R_ASSERT2( Obj, make_string("GE_OWNERSHIP_TAKE: Object not found. object_id = [%d]", id).c_str() );
VERIFY2 ( Obj, make_string("GE_OWNERSHIP_TAKE: Object not found. object_id = [%d]", id).c_str() );
if ( !Obj ) {
Msg ( "! GE_OWNERSHIP_TAKE: Object not found. object_id = [%d]", id );
break;
}
CGameObject* _GO = smart_cast<CGameObject*>(Obj);
if (!IsGameTypeSingle() && !g_Alive())
{
Msg("! WARNING: dead player [%d][%s] can't take items [%d][%s]",
ID(), Name(), _GO->ID(), _GO->cNameSect().c_str());
break;
}
if( inventory().CanTakeItem(smart_cast<CInventoryItem*>(_GO)) )
{
Obj->H_SetParent (smart_cast<CObject*>(this));
#ifdef MP_LOGGING
string64 act;
xr_strcpy( act, (type == GE_TRADE_BUY)? "buys" : "takes" );
Msg("--- Actor [%d][%s] %s [%d][%s]", ID(), Name(), act, _GO->ID(), _GO->cNameSect().c_str());
#endif // MP_LOGGING
inventory().Take (_GO, false, true);
SelectBestWeapon(Obj);
}
else
{
if (IsGameTypeSingle())
{
NET_Packet P;
u_EventGen (P,GE_OWNERSHIP_REJECT,ID());
P.w_u16 (u16(Obj->ID()));
u_EventSend (P);
} else
{
Msg("! ERROR: Actor [%d][%s] tries to drop on take [%d][%s]", ID(), Name(), _GO->ID(), _GO->cNameSect().c_str());
}
}
}
break;
case GE_TRADE_SELL:
case GE_OWNERSHIP_REJECT:
{
P.r_u16 (id);
CObject* Obj = Level().Objects.net_Find (id);
// R_ASSERT2( Obj, make_string("GE_OWNERSHIP_REJECT: Object not found, id = %d", id).c_str() );
VERIFY2 ( Obj, make_string("GE_OWNERSHIP_REJECT: Object not found, id = %d", id).c_str() );
if ( !Obj ) {
Msg ( "! GE_OWNERSHIP_REJECT: Object not found, id = %d", id );
break;
}
bool just_before_destroy = !P.r_eof() && P.r_u8();
bool dont_create_shell = (type==GE_TRADE_SELL) || just_before_destroy;
Obj->SetTmpPreDestroy (just_before_destroy);
CGameObject * GO = smart_cast<CGameObject*>(Obj);
#ifdef MP_LOGGING
string64 act;
xr_strcpy( act, (type == GE_TRADE_SELL)? "sells" : "rejects" );
Msg("--- Actor [%d][%s] %s [%d][%s]", ID(), Name(), act, GO->ID(), GO->cNameSect().c_str());
#endif // MP_LOGGING
VERIFY( GO->H_Parent() );
if ( !GO->H_Parent() )
{
Msg("! ERROR: Actor [%d][%s] tries to reject item [%d][%s] that has no parent",
ID(), Name(), GO->ID(), GO->cNameSect().c_str());
break;
}
VERIFY2( GO->H_Parent()->ID() == ID(),
make_string("actor [%d][%s] tries to drop not own object [%d][%s]",
ID(), Name(), GO->ID(), GO->cNameSect().c_str() ).c_str() );
if ( GO->H_Parent()->ID() != ID() )
{
CActor* real_parent = smart_cast<CActor*>(GO->H_Parent());
Msg("! ERROR: Actor [%d][%s] tries to drop not own item [%d][%s], his parent is [%d][%s]",
ID(), Name(), GO->ID(), GO->cNameSect().c_str(), real_parent->ID(), real_parent->Name());
//.........这里部分代码省略.........