void CPhraseScript::TransferInfo (const CInventoryOwner* pOwner) const { THROW(pOwner); for(u32 i=0; i<m_GiveInfo.size(); i++) //. pOwner->TransferInfo(m_GiveInfo[i], true); Actor()->TransferInfo(m_GiveInfo[i], true); for(i=0; i<m_DisableInfo.size(); i++) //. pOwner->TransferInfo(m_DisableInfo[i],false); Actor()->TransferInfo(m_DisableInfo[i], false); }
void CPolterTele::update_schedule() { inherited::update_schedule(); if (!m_object->g_Alive() || !Actor() || !Actor()->g_Alive()) return; if (Actor()->Position().distance_to(m_object->Position()) > m_pmt_distance) return; switch (m_state) { case eStartRaiseObjects: if (m_time + m_time_next < time()) { if (!tele_raise_objects()) m_state = eRaisingObjects; m_time = time(); m_time_next = m_pmt_raise_time_to_wait_in_objects / 2 + Random.randI(m_pmt_raise_time_to_wait_in_objects / 2); } if (m_state == eStartRaiseObjects) { if (m_object->CTelekinesis::get_objects_count() >= m_pmt_object_count) { m_state = eRaisingObjects; m_time = time(); } } break; case eRaisingObjects: if (m_time + m_pmt_time_to_hold > time()) break; m_time = time(); m_time_next = 0; m_state = eFireObjects; case eFireObjects: if (m_time + m_time_next < time()) { tele_fire_objects (); m_time = time(); m_time_next = m_pmt_time_to_wait_in_objects / 2 + Random.randI(m_pmt_time_to_wait_in_objects / 2); } if (m_object->CTelekinesis::get_objects_count() == 0) { m_state = eWait; m_time = time(); } break; case eWait: if (m_time + m_pmt_time_to_wait < time()) { m_time_next = 0; m_state = eStartRaiseObjects; } break; } }
bool CControllerPsyHit::check_start_conditions() { if (is_active()) return false; if (m_man->is_captured_pure()) return false; if (Actor()->Cameras().GetCamEffector(eCEControllerPsyHit)) return false; if (m_object->Position().distance_to(Actor()->Position()) < m_min_tube_dist) return false; return true; }
int get_actor_ranking() { std::sort (g_all_statistic_humans.begin(),g_all_statistic_humans.end(),GreaterRankPred); CSE_ALifeTraderAbstract* pActorAbstract = ch_info_get_from_id(Actor()->ID()); SStatData d; d.id = Actor()->ID(); d.trader = pActorAbstract; TOP_LIST::iterator it = std::find(g_all_statistic_humans.begin(),g_all_statistic_humans.end(),d); if(it!=g_all_statistic_humans.end()) return (int)std::distance(g_all_statistic_humans.begin(), it); else return 1; }
CPPEffectorControllerAura::CPPEffectorControllerAura(const SPPInfo &ppi, u32 time_to_fade, const ref_sound &snd_left, const ref_sound &snd_right) : inherited(ppi) { m_time_to_fade = time_to_fade; m_effector_state = eStateFadeIn; m_time_state_started = Device.dwTimeGlobal; m_snd_left.clone (snd_left,st_Effect,sg_SourceType); m_snd_right.clone (snd_right,st_Effect,sg_SourceType); m_snd_left.play_at_pos (Actor(), Fvector().set(-1.f, 0.f, 1.f), sm_Looped | sm_2D); m_snd_right.play_at_pos (Actor(), Fvector().set(-1.f, 0.f, 1.f), sm_Looped | sm_2D); }
Actor NewActor( const Property::Map& map ) { BaseHandle handle; // First find type and create Actor Property::Value* typeValue = map.Find( "type" ); if ( typeValue ) { TypeInfo type = TypeRegistry::Get().GetTypeInfo( typeValue->Get< std::string >() ); if ( type ) { handle = type.CreateInstance(); } } if ( !handle ) { DALI_LOG_ERROR( "Actor type not provided\n" ); return Actor(); } Actor actor( Actor::DownCast( handle ) ); if ( actor ) { // Now set the properties, or create children for ( unsigned int i = 0, mapCount = map.Count(); i < mapCount; ++i ) { const StringValuePair& pair( map.GetPair( i ) ); const std::string& key( pair.first ); if ( key == "type" ) { continue; } const Property::Value& value( pair.second ); if ( key == "actors" ) { // Create children Property::Array actorArray = value.Get< Property::Array >(); for ( Property::Array::SizeType i = 0; i < actorArray.Size(); ++i) { actor.Add( NewActor( actorArray[i].Get< Property::Map >() ) ); } } else { Property::Index index( actor.GetPropertyIndex( key ) ); if ( index != Property::INVALID_INDEX ) { actor.SetProperty( index, value ); } } } } return actor; }
void CUIActorMenu::CheckDistance() { CGameObject* pActorGO = smart_cast<CGameObject*>(m_pActorInvOwner); CGameObject* pPartnerGO = smart_cast<CGameObject*>(m_pPartnerInvOwner); CGameObject* pBoxGO = smart_cast<CGameObject*>(m_pInvBox); VERIFY(pActorGO && (pPartnerGO || pBoxGO || m_pCar)); if ( pPartnerGO ) { if ( ( pActorGO->Position().distance_to( pPartnerGO->Position() ) > 3.0f ) && !m_pPartnerInvOwner->NeedOsoznanieMode() ) { GetHolder()->StartStopMenu( this, true ); // hide actor menu } } else if (m_pCar && Actor()->Holder()) { //nop } else //pBoxGO { VERIFY( pBoxGO ); if ( pActorGO->Position().distance_to( pBoxGO->Position() ) > 3.0f ) { GetHolder()->StartStopMenu( this, true ); // hide actor menu } } }
void CActorDeathEffector::Stop() { RemoveEffector (Actor(),effActorDeath); m_death_sound.destroy (); enable_input (); show_indicators (); }
void CUITalkWnd::InitTalkDialog() { m_pActor = Actor(); if (m_pActor && !m_pActor->IsTalking()) return; m_pOurInvOwner = smart_cast<CInventoryOwner*>(m_pActor); m_pOthersInvOwner = m_pActor->GetTalkPartner(); m_pOurDialogManager = smart_cast<CPhraseDialogManager*>(m_pOurInvOwner); m_pOthersDialogManager = smart_cast<CPhraseDialogManager*>(m_pOthersInvOwner); //имена собеседников UITalkDialogWnd->UICharacterInfoLeft.InitCharacter (m_pOurInvOwner->object_id()); UITalkDialogWnd->UICharacterInfoRight.InitCharacter (m_pOthersInvOwner->object_id()); //. UITalkDialogWnd->UIDialogFrame.UITitleText.SetText (m_pOthersInvOwner->Name()); //. UITalkDialogWnd->UIOurPhrasesFrame.UITitleText.SetText (m_pOurInvOwner->Name()); //очистить лог сообщений UITalkDialogWnd->ClearAll(); InitOthersStartDialog (); NeedUpdateQuestions (); Update (); UITalkDialogWnd->mechanic_mode = m_pOthersInvOwner->SpecificCharacter().upgrade_mechanic(); UITalkDialogWnd->SetOsoznanieMode (m_pOthersInvOwner->NeedOsoznanieMode()); UITalkDialogWnd->Show (); UITalkDialogWnd->UpdateButtonsLayout(b_disable_break, m_pOthersInvOwner->IsTradeEnabled()); }
void CChangeLevelWnd::OnCancel() { Game().StartStopMenu (this, true); if(m_b_position_cancel){ Actor()->MoveActor(m_position_cancel, m_angles_cancel); } }
void CControllerPsyHit::deactivate() { m_man->release_pure (this); m_man->unsubscribe (this, ControlCom::eventAnimationEnd); if (m_blocked) { NET_Packet P; Actor()->u_EventGen (P, GEG_PLAYER_WEAPON_HIDE_STATE, Actor()->ID()); P.w_u32 (INV_STATE_BLOCK_ALL); P.w_u8 (u8(false)); Actor()->u_EventSend(P); } set_sound_state (eNone); }
void CUILogsWnd::PerformWork() { if(!m_news_in_queue.empty()) { u32 count = _min(30, m_news_in_queue.size()); //. u32 count = m_news_in_queue.size(); for(u32 i=0; i<count;++i) { GAME_NEWS_VECTOR& news_vector = Actor()->game_news_registry->registry().objects(); u32 idx = m_news_in_queue.back(); m_news_in_queue.pop_back (); GAME_NEWS_DATA& gn = news_vector[idx]; AddNewsItem ( gn, NULL ); } } /* else { s32 cnt = m_items_cache.size()+m_list->GetSize(); if(cnt<1000) { for(s32 i=0; i<_min(10,1000-cnt); ++i) m_items_cache.push_back(CreateItem()); } }*/ }
void CInventoryBox::OnEvent(NET_Packet& P, u16 type) { inherited::OnEvent (P, type); switch (type) { case GE_OWNERSHIP_TAKE: { u16 id; P.r_u16(id); CObject* itm = Level().Objects.net_Find(id); VERIFY(itm); m_items.push_back (id); itm->H_SetParent (this); itm->setVisible (FALSE); itm->setEnabled (FALSE); }break; case GE_OWNERSHIP_REJECT: { u16 id; P.r_u16(id); CObject* itm = Level().Objects.net_Find(id); VERIFY(itm); xr_vector<u16>::iterator it; it = std::find(m_items.begin(),m_items.end(),id); VERIFY(it!=m_items.end()); m_items.erase (it); itm->H_SetParent (NULL,!P.r_eof() && P.r_u8()); if( m_in_use ) { CGameObject* GO = smart_cast<CGameObject*>(itm); Actor()->callback(GameObject::eInvBoxItemTake)( this->lua_game_object(), GO->lua_game_object() ); } }break; }; }
void CLevel::IR_OnMouseRelease(int btn) { IR_OnKeyboardRelease(mouse_button_2_key[btn]); // Callback for scripting (Cribbledirge). if (g_actor) Actor()->callback(GameObject::eOnMouseRelease)(btn); }
void CUIStalkersRankingWnd::FillList() { CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH,STALKERS_RANKING_XML); UIList->Clear (); uiXml.SetLocalRoot (uiXml.NavigateToNode("stalkers_list",0)); if(g_all_statistic_humans.size()) { CSE_ALifeTraderAbstract* pActorAbstract = ch_info_get_from_id(Actor()->ID()); int actor_place = get_actor_ranking(); int sz = _min(g_all_statistic_humans.size(),20); for(int i=0; i<sz; ++i){ CSE_ALifeTraderAbstract* pT = (g_all_statistic_humans[i]).trader; if(pT==pActorAbstract || (i==19&&actor_place>19) ){ AddActorItem (&uiXml, actor_place+1, pActorAbstract); }else{ AddStalkerItem (&uiXml, i+1, pT); } } UIList->SetSelected (UIList->GetItem(0) ); }else{ CUIStalkerRankingInfoItem* itm = xr_new<CUIStalkerRankingInfoItem>(this); itm->Init (&uiXml, "no_items", 0); UIList->AddWindow (itm, true); } }
void CPPEffectorController::deactivate() { VERIFY (m_effector); Actor()->Cameras().RemovePPEffector(m_effector->get_type()); m_effector = 0; }
void CPPEffectorController::activate() { VERIFY (!m_effector); m_effector = create_effector (); Actor()->Cameras().AddPPEffector (m_effector); }
void CControllerPsyHit::death_glide_start() { if (!check_conditions_final()) { m_man->deactivate (this); return; } // Start effector CEffectorCam* ce = Actor()->Cameras().GetCamEffector(eCEControllerPsyHit); VERIFY(!ce); Fvector src_pos = Actor()->cam_Active()->vPosition; Fvector target_pos = m_object->Position(); target_pos.y += 1.2f; Fvector dir; dir.sub (target_pos,src_pos); float dist = dir.magnitude(); dir.normalize (); target_pos.mad (src_pos,dir,dist-4.8f); Actor()->Cameras().AddCamEffector(xr_new<CControllerPsyHitCamEffector>(eCEControllerPsyHit, src_pos,target_pos, m_man->animation().motion_time(m_stage[1], m_object->Visual()))); smart_cast<CController *>(m_object)->draw_fire_particles(); dir.sub(src_pos,target_pos); dir.normalize(); float h,p; dir.getHP(h,p); dir.setHP(h,p+PI_DIV_3); Actor()->character_physics_support()->movement()->ApplyImpulse(dir,Actor()->GetMass() * 530.f); set_sound_state (eStart); NET_Packet P; Actor()->u_EventGen (P, GEG_PLAYER_WEAPON_HIDE_STATE, Actor()->ID()); P.w_u32 (INV_STATE_BLOCK_ALL); P.w_u8 (u8(true)); Actor()->u_EventSend(P); m_blocked = true; ////////////////////////////////////////////////////////////////////////// // set direction SControlDirectionData *ctrl_dir = (SControlDirectionData*)m_man->data(this, ControlCom::eControlDir); VERIFY (ctrl_dir); ctrl_dir->heading.target_speed = 3.f; ctrl_dir->heading.target_angle = m_man->direction().angle_to_target(Actor()->Position()); ////////////////////////////////////////////////////////////////////////// }
void CUIActorInfoWnd::FillPointsDetail(const shared_str& id) { UIDetailList->Clear (); CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH,ACTOR_STATISTIC_XML); uiXml.SetLocalRoot (uiXml.NavigateToNode("actor_stats_wnd",0)); string512 path; sprintf_s (path,"detail_part_%s",id.c_str()); XML_NODE* n = uiXml.NavigateToNode(path,0); if(!n) sprintf_s (path,"detail_part_def"); #pragma todo("implement this") /* string256 str; sprintf_s (str,"st_detail_list_for_%s", id.c_str()); UIInfoHeader->GetTitleStatic()->SetTextST (str); */ SStatSectionData& section = Actor()-> StatisticMgr().GetSection(id); vStatDetailData::const_iterator it = section.data.begin(); vStatDetailData::const_iterator it_e = section.data.end(); int _cntr = 0; string64 buff; for(;it!=it_e;++it,++_cntr) { CUIActorStaticticDetail* itm = xr_new<CUIActorStaticticDetail>(); itm->Init (&uiXml, path, 0); sprintf_s (buff,"%d.",_cntr); itm->m_text0->SetText (buff); itm->m_text1->SetTextST (*CStringTable().translate((*it).key)); itm->m_text1->AdjustHeightToText (); if( 0==(*it).str_value.size() ) { sprintf_s (buff,"x%d", (*it).int_count); itm->m_text2->SetTextST (buff); sprintf_s (buff,"%d", (*it).int_points); itm->m_text3->SetTextST (buff); }else { itm->m_text2->SetTextST ((*it).str_value.c_str()); itm->m_text3->SetTextST (""); } Fvector2 sz = itm->GetWndSize(); float _height; _height = _max(sz.y, itm->m_text1->GetWndPos().y+itm->m_text1->GetWndSize().y+3); sz.y = _height; itm->SetWndSize (sz); UIDetailList->AddWindow (itm, true); } }
void CControllerPsyHit::death_glide_end() { // Stop camera effector CEffectorCam* ce = Actor()->Cameras().GetCamEffector(eCEControllerPsyHit); VERIFY(ce); Actor()->Cameras().RemoveCamEffector(eCEControllerPsyHit); CController *monster = smart_cast<CController *>(m_object); monster->draw_fire_particles(); monster->m_sound_tube_hit_left.play_at_pos(Actor(), Fvector().set(-1.f, 0.f, 1.f), sm_2D); monster->m_sound_tube_hit_right.play_at_pos(Actor(), Fvector().set(1.f, 0.f, 1.f), sm_2D); m_object->Hit_Psy (Actor(), monster->m_tube_damage); }
bool CMonsterEnemyManager::enemy_see_me_now() { if ( Actor() == enemy ) { return (Actor()->memory().visual().visible_right_now(monster)); } else { CCustomMonster *cm = const_cast<CEntityAlive*>(enemy)->cast_custom_monster(); if ( cm ) { return cm->memory().visual().visible_right_now(monster); } } return false; }
CActorDeathEffector::CActorDeathEffector (CActorCondition* parent, LPCSTR sect) // -(( :m_pParent(parent) { Actor()->SetWeaponHideState(INV_STATE_BLOCK_ALL,true); hide_indicators (); AddEffector (Actor(), effActorDeath, sect); disable_input (); LPCSTR snd = pSettings->r_string(sect, "snd"); m_death_sound.create (snd,st_Effect,0); m_death_sound.play_at_pos(0,Fvector().set(0,0,0),sm_2D); SBaseEffector* pe = Actor()->Cameras().GetPPEffector((EEffectorPPType)effActorDeath); pe->m_on_b_remove_callback = SBaseEffector::CB_ON_B_REMOVE(this, &CActorDeathEffector::OnPPEffectorReleased); m_b_actual = true; m_start_health = m_pParent->health(); }
void _give_news (LPCSTR caption, LPCSTR text, LPCSTR texture_name, int delay, int show_time, int type) { GAME_NEWS_DATA news_data; news_data.m_type = (GAME_NEWS_DATA::eNewsType)type; news_data.news_caption = caption; news_data.news_text = text; if(show_time!=0) news_data.show_time = show_time;// override default VERIFY(xr_strlen(texture_name)>0); news_data.texture_name = texture_name; if(delay==0) Actor()->AddGameNews(news_data); else Actor()->AddGameNews_deffered(news_data,delay); }
void add_enemy_debug_info (debug::text_tree& root_s, const CCustomMonster* pThis, const CEntityAlive* pEnemy) { add_debug_info(root_s, pEnemy); root_s.add_line("I_See_Enemy", pThis->memory().visual().visible_right_now(pEnemy)); bool seen_now = false; if ( Actor() == pEnemy ) { seen_now = Actor()->memory().visual().visible_right_now(pThis); } else if ( CCustomMonster* cm = const_cast<CEntityAlive*>(pEnemy)->cast_custom_monster() ) { seen_now = cm->memory().visual().visible_right_now(pThis); } root_s.add_line("Enemy_See_Me", seen_now); }
void CUINewsWnd::LoadNews() { UIScrollWnd->Clear(); if (Actor()) { GAME_NEWS_VECTOR& news_vector = Actor()->game_news_registry->registry().objects(); // Показать только NEWS_TO_SHOW последних ньюсов int currentNews = 0; for (GAME_NEWS_VECTOR::reverse_iterator it = news_vector.rbegin(); it != news_vector.rend() && currentNews < NEWS_TO_SHOW ; ++it) { AddNewsItem(*it); ++currentNews; } } m_flags.set(eNeedAdd,FALSE); }
void CUIActorInfoWnd::Show(bool status) { inherited::Show(status); if (!status) return; UICharacterInfo->InitCharacter (Actor()->ID()); #pragma todo("implement this") //. UICharIconHeader->UITitleText.SetText (Actor()->Name()); FillPointsInfo (); }
void CUIMMShniaga::InitShniaga(CUIXml& xml_doc, LPCSTR path) { string256 _path; CUIXmlInit::InitWindow(xml_doc, path, 0, this); strconcat (sizeof(_path),_path,path,":shniaga:magnifire"); CUIXmlInit::InitStatic(xml_doc, _path,0,m_magnifier); m_mag_pos = m_magnifier->GetWndPos().x; strconcat (sizeof(_path),_path,path,":shniaga"); CUIXmlInit::InitStatic(xml_doc, _path,0,m_shniaga); strconcat (sizeof(_path),_path,path,":buttons_region"); CUIXmlInit::InitScrollView(xml_doc, _path,0,m_view); strconcat (sizeof(_path),_path,path,":shniaga:magnifire:y_offset"); m_offset = xml_doc.ReadFlt(_path,0,0); if (!g_pGameLevel || !g_pGameLevel->bReady) { if (!*g_last_saved_game || !CSavedGameWrapper::valid_saved_game(g_last_saved_game)) CreateList (m_buttons, xml_doc, "menu_main"); else CreateList (m_buttons, xml_doc, "menu_main_last_save"); CreateList (m_buttons_new, xml_doc, "menu_new_game"); } else { if (GameID() == eGameIDSingle) { VERIFY (Actor()); if (Actor() && !Actor()->g_Alive()) CreateList (m_buttons, xml_doc, "menu_main_single_dead"); else CreateList (m_buttons, xml_doc, "menu_main_single"); } else CreateList (m_buttons, xml_doc, "menu_main_mm"); } ShowMain (); m_sound->Init(xml_doc, "menu_sound"); m_sound->music_Play(); }
bool _give_news (LPCSTR text, LPCSTR texture_name, const Frect& tex_rect, int delay, int show_time) { GAME_NEWS_DATA news_data; news_data.news_text = text; if(show_time!=0) news_data.show_time = show_time;// override default VERIFY(xr_strlen(texture_name)>0); news_data.texture_name = texture_name; news_data.tex_rect = tex_rect; if(delay==0) Actor()->AddGameNews(news_data); else Actor()->AddGameNews_deffered(news_data,delay); return true; }
void RemoteNetworkView::CreateActor(IEventDataPtr pEventData) { std::shared_ptr<EventData_CreateActor> pCastEventData = std::static_pointer_cast<EventData_CreateActor>(pEventData); ActorId id = pCastEventData->VGetActorId(); Vec3 position = pCastEventData->VGetPosition(); Actor* actor = GCC_NEW Actor(id, position); actor->SetName(pCastEventData->VGetActorName()); // With that Unity can safely call an Actor Name without messing up if there is simultaneous connection actor->SetIp(pCastEventData->VGetIp()); std::shared_ptr<Actor> pActor(actor); m_ActorManager->AddActor(pActor); }
void CUICarBodyWnd::EatItem() { CActor *pActor = smart_cast<CActor*>(Level().CurrentEntity()); if(!pActor) return; NET_Packet P; CGameObject::u_EventGen (P, GEG_PLAYER_ITEM_EAT, Actor()->ID()); P.w_u16 (CurrentIItem()->object().ID()); CGameObject::u_EventSend (P); }