Beispiel #1
0
void CActor::PickupInfoDraw(CObject* object)
{
	LPCSTR draw_str = NULL;
	
	CInventoryItem* item = smart_cast<CInventoryItem*>(object);
//.	CInventoryOwner* inventory_owner = smart_cast<CInventoryOwner*>(object);
//.	VERIFY(item || inventory_owner);
	if(!item)		return;

	Fmatrix			res;
	res.mul			(Device.mFullTransform,object->XFORM());
	Fvector4		v_res;
	Fvector			shift;

	draw_str = item->Name/*Complex*/();
	shift.set(0,0,0);

	res.transform(v_res,shift);

	if (v_res.z < 0 || v_res.w < 0)	return;
	if (v_res.x < -1.f || v_res.x > 1.f || v_res.y<-1.f || v_res.y>1.f) return;

	float x = (1.f + v_res.x)/2.f * (Device.dwWidth);
	float y = (1.f - v_res.y)/2.f * (Device.dwHeight);

	HUD().Font().pFontLetterica16Russian->SetAligment	(CGameFont::alCenter);
	HUD().Font().pFontLetterica16Russian->SetColor		(PICKUP_INFO_COLOR);
	HUD().Font().pFontLetterica16Russian->Out			(x,y,draw_str);
}
Beispiel #2
0
		void operator () (const char* s, int num_siblings)
		{
			if ( s_params.offs )
			{
				s_params.offs--;
				return;
			}

			// dont use multicolumns
// 			if ( s_params.cur_row && s_params.cur_row + 1 > s_params.max_rows )
// 			{
// 				s_params.cur_row = 0;
// 				s_params.ori_x  += s_params.column_size;
// 			}

			if ( !s_params.cur_row )
			{
				HUD().Font().pFontStat->OutSet((float)s_params.ori_x, (float)s_params.ori_y);
			}			

			if ( s_params.cur_row % 2 )
			{
				HUD().Font().pFontStat->SetColor(s_params.color1);
			}
			else
			{
				HUD().Font().pFontStat->SetColor(s_params.color2);
			}
			
			HUD().Font().pFontStat->OutNext(s);
			s_params.cur_row++;
		}
Beispiel #3
0
void CUITradeWnd::PerformTrade()
{

	if (m_uidata->UIOurTradeList.ItemsCount()==0 && m_uidata->UIOthersTradeList.ItemsCount()==0) 
		return;

	int our_money			= (int)m_pInvOwner->get_money();
	int others_money		= (int)m_pOthersInvOwner->get_money();

	int delta_price			= int(m_iOurTradePrice-m_iOthersTradePrice);

	our_money				+= delta_price;
	others_money			-= delta_price;

	if(our_money>=0 && others_money>=0 && (m_iOurTradePrice>=0 || m_iOthersTradePrice>0))
	{
		m_pOthersTrade->OnPerformTrade(m_iOthersTradePrice, m_iOurTradePrice);
		
		TransferItems		(&m_uidata->UIOurTradeList,		&m_uidata->UIOthersBagList, m_pOthersTrade,	true);
		TransferItems		(&m_uidata->UIOthersTradeList,	&m_uidata->UIOurBagList,	m_pOthersTrade,	false);
	}else
	{
		if(others_money<0)
			m_uidata->UIDealMsg		= HUD().GetUI()->UIGame()->AddCustomStatic("not_enough_money_other", true);
		else
			m_uidata->UIDealMsg		= HUD().GetUI()->UIGame()->AddCustomStatic("not_enough_money_mine", true);


		m_uidata->UIDealMsg->m_endTime	= Device.fTimeGlobal+2.0f;// sec
	}
	SetCurrentItem			(NULL);
}
Beispiel #4
0
bool	CActor::CanMove				()
{
	if( conditions().IsCantWalk() )
	{
		if(mstate_wishful&mcAnyMove)
		{
			HUD().GetUI()->AddInfoMessage("cant_walk");
		}
		return false;
	}else
	if( conditions().IsCantWalkWeight() )
	{
		if(mstate_wishful&mcAnyMove)
		{
			HUD().GetUI()->AddInfoMessage("cant_walk_weight");
		}
		return false;
	
	}

	if(IsTalking())
		return false;
	else
		return true;
}
Beispiel #5
0
void CUITradeWnd::Update()
{
	EListType et					= eNone;

	if(m_pInv->ModifyFrame()==Device.dwFrame && m_pOthersInv->ModifyFrame()==Device.dwFrame){
		et = eBoth;
	}else if(m_pInv->ModifyFrame()==Device.dwFrame){
		et = e1st;
	}else if(m_pOthersInv->ModifyFrame()==Device.dwFrame){
		et = e2nd;
	}
	if(et!=eNone)
		UpdateLists					(et);

	inherited::Update				();
	UpdateCameraDirection			(smart_cast<CGameObject*>(m_pOthersInvOwner));

	if(m_uidata->UIDealMsg){
		m_uidata->UIDealMsg->Update();
		if( !m_uidata->UIDealMsg->IsActual()){
			HUD().GetUI()->UIGame()->RemoveCustomStatic("not_enough_money_mine");
			HUD().GetUI()->UIGame()->RemoveCustomStatic("not_enough_money_other");
			m_uidata->UIDealMsg			= NULL;
		}
	}
}
Beispiel #6
0
bool CUISequenceSimpleItem::Stop			(bool bForce)
{
	if(!m_flags.test(etiCanBeStopped)&&!bForce) 
		return false;

	m_owner->MainWnd()->DetachChild	(m_UIWindow);
	m_sound.stop				();

	if(m_flags.test(etiNeedPauseOn) && !m_flags.test(etiStoredPauseState))
		Device.Pause			(FALSE, TRUE, FALSE, "simpleitem_stop");

	if(m_flags.test(etiNeedPauseOff) && m_flags.test(etiStoredPauseState))
		Device.Pause			(TRUE, TRUE, FALSE, "simpleitem_stop");

	if(m_flags.test(etiNeedPauseSound))
		Device.Pause			(FALSE, FALSE, TRUE, "simpleitem_stop");

	if (g_pGameLevel){
		CUIGameSP* ui_game_sp	= smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());
		if( ui_game_sp && ui_game_sp->PdaMenu->IsShown() ) 
			HUD().GetUI()->StartStopMenu			(ui_game_sp->PdaMenu, true);
	}
	inherited::Stop				();
	return true;
}
bool CActor::OnReceiveInfo(shared_str info_id) const
{
	if(!CInventoryOwner::OnReceiveInfo(info_id))
		return false;

	CInfoPortion info_portion;
	info_portion.Load(info_id);

	AddEncyclopediaArticle	(&info_portion);
	AddGameTask				(&info_portion);

	callback(GameObject::eInventoryInfo)(lua_game_object(), *info_id);

	if(!HUD().GetUI())
		return false;
	//только если находимся в режиме single
	CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());
	if(!pGameSP) return false;

	if(pGameSP->TalkMenu->IsShown())
	{
		pGameSP->TalkMenu->NeedUpdateQuestions();
	}


	return true;
}
Beispiel #8
0
void CDialogHolder::StopMenu (CUIDialogWnd* pDialog)
{
	R_ASSERT( pDialog->IsShown() );

	if( MainInputReceiver()==pDialog )
	{
		if(UseIndicators())
		{
			bool b					= !!m_input_receivers.back().m_flags.test(recvItem::eCrosshair);
			psHUD_Flags.set			(HUD_CROSSHAIR_RT, b);
			b						= !!m_input_receivers.back().m_flags.test(recvItem::eIndicators);
			if(b)					HUD().GetUI()->ShowGameIndicators();
			else					HUD().GetUI()->HideGameIndicators();
		}
		RemoveDialogToRender	(pDialog);
		SetMainInputReceiver	(NULL,false);
		pDialog->SetHolder		(NULL);
		pDialog->Hide			();
	}else{
		RemoveDialogToRender	(pDialog);
		SetMainInputReceiver	(pDialog, true);
		pDialog->SetHolder		(NULL);
		pDialog->Hide			();
	}

	if(!MainInputReceiver() || !MainInputReceiver()->NeedCursor() )
		GetUICursor()->Hide();
}
Beispiel #9
0
void CUISequenceSimpleItem::Start()
{
	inherited::Start				();
	m_flags.set						(etiStoredPauseState, Device.Paused());
	
	if(m_flags.test(etiNeedPauseOn) && !m_flags.test(etiStoredPauseState)){
		Device.Pause			(TRUE, TRUE, FALSE, "simpleitem_start");
		bShowPauseString		= FALSE;
	}

	if(m_flags.test(etiNeedPauseOff) && m_flags.test(etiStoredPauseState))
		Device.Pause			(FALSE, TRUE, FALSE, "simpleitem_start");

	if(m_flags.test(etiNeedPauseSound))
		Device.Pause			(TRUE, FALSE, TRUE, "simpleitem_start");

	GetUICursor()->SetUICursorPosition		(m_desired_cursor_pos);
	m_time_start							= float(Device.dwTimeContinual)/1000.0f;
	m_owner->MainWnd()->AttachChild	(m_UIWindow);

	if (m_sound._handle())		m_sound.play(NULL, sm_2D);

	if (g_pGameLevel){
			bool bShowPda			= false;
			CUIGameSP* ui_game_sp	= smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());
			if(!stricmp(m_pda_section,"pda_contacts")){
				ui_game_sp->PdaMenu->SetActiveSubdialog(eptContacts);
				bShowPda = true;
			}else{
			if(!stricmp(m_pda_section,"pda_map")){
				ui_game_sp->PdaMenu->SetActiveSubdialog(eptMap);
				bShowPda = true;
			}else if(!stricmp(m_pda_section,"pda_quests")){
				ui_game_sp->PdaMenu->SetActiveSubdialog(eptQuests);
				bShowPda = true;
			}else if(!stricmp(m_pda_section,"pda_diary")){
				ui_game_sp->PdaMenu->SetActiveSubdialog(eptDiary);
				bShowPda = true;
			}else if(!stricmp(m_pda_section,"pda_ranking")){
				ui_game_sp->PdaMenu->SetActiveSubdialog(eptRanking);
				bShowPda = true;
			}else if(!stricmp(m_pda_section,"pda_statistics")){
				ui_game_sp->PdaMenu->SetActiveSubdialog(eptActorStatistic);
				bShowPda = true;
			}else if(!stricmp(m_pda_section,"pda_encyclopedia")){
				ui_game_sp->PdaMenu->SetActiveSubdialog(eptEncyclopedia);
				bShowPda = true;
			}
		}
		if(ui_game_sp)
		{
		if( (!ui_game_sp->PdaMenu->IsShown() && bShowPda) || 
			(ui_game_sp->PdaMenu->IsShown() && !bShowPda))
			HUD().GetUI()->StartStopMenu			(ui_game_sp->PdaMenu,true);
		}
	}
}
void game_cl_TeamDeathmatch::shedule_Update			(u32 dt)
{
	CStringTable st;
	string512	msg;

	if(!m_game_ui && HUD().GetUI() ) m_game_ui = smart_cast<CUIGameTDM*>( HUD().GetUI()->UIGame() );
	inherited::shedule_Update(dt);

	if (!m_game_ui) return;
	//---------------------------------------------------------
	if (m_game_ui->m_pUITeamSelectWnd && m_game_ui->m_pUITeamSelectWnd->IsShown() && !CanCallTeamSelectMenu())
		StartStopMenu(m_game_ui->m_pUITeamSelectWnd,true);
	//---------------------------------------------------------
	
	switch (m_phase)
	{
	case GAME_PHASE_TEAM1_SCORES:
		{
			sprintf_s(msg, /*team %s wins*/ *st.translate("mp_team_wins"), CTeamInfo::GetTeam_name(1));
			m_game_ui->SetRoundResultCaption(msg);

			SetScore();
		}break;
	case GAME_PHASE_TEAM2_SCORES:
		{
			sprintf_s(msg, /*team %s wins*/ *st.translate("mp_team_wins"), CTeamInfo::GetTeam_name(2));
			m_game_ui->SetRoundResultCaption(msg);
			
			SetScore();
			
		}break;
	case GAME_PHASE_INPROGRESS:
		{
			if (local_player && !local_player->IsSkip())
			{			
				if (Level().CurrentEntity() && Level().CurrentEntity()->CLS_ID == CLSID_SPECTATOR)
				{
					if (!(pCurBuyMenu && pCurBuyMenu->IsShown()) && 
						!(pCurSkinMenu && pCurSkinMenu->IsShown()) &&
						!(m_game_ui->m_pMapDesc && m_game_ui->m_pMapDesc->IsShown()) &&
						(HUD().GetUI() && HUD().GetUI()->GameIndicatorsShown())
						)
					{
						if (!m_bTeamSelected)
							m_game_ui->SetPressJumpMsgCaption("mp_press_jump2select_team");
					};
				};
				SetScore();
			};
		}break;
	default:
		{
		}break;
	};

}
Beispiel #11
0
CGameTask*	CGameTaskManager::GiveGameTaskToActor(CGameTask* t, u32 timeToComplete, bool bCheckExisting)
{
	if(bCheckExisting && HasGameTask(t->m_ID)) return NULL;
	m_flags.set					(eChanged, TRUE);

	GameTasks().push_back				(SGameTaskKey(t->m_ID) );
	GameTasks().back().game_task			= t;
	t->m_ReceiveTime				= Level().GetGameTime();
	t->m_TimeToComplete				= t->m_ReceiveTime + timeToComplete;

	
	std::sort						(GameTasks().begin(), GameTasks().end(), task_prio_pred);

	ARTICLE_VECTOR& article_vector = Actor()->encyclopedia_registry->registry().objects();


	SGameTaskObjective	*obj = NULL;
	for (u32 i = 0; i < t->m_Objectives.size(); ++i){
		obj = &t->m_Objectives[i];
		if(obj->article_id.size()){
		FindArticleByIDPred pred(obj->article_id);
		if( std::find_if(article_vector.begin(), article_vector.end(), pred) == article_vector.end() ){
			CEncyclopediaArticle article;
			article.Load(obj->article_id);
			article_vector.push_back(ARTICLE_DATA(obj->article_id, Level().GetGameTime(), article.data()->articleType));
			}
		}

		if(obj->object_id!=u16(-1) && obj->map_location.size() && obj->def_location_enabled){
			CMapLocation* ml =	Level().MapManager().AddMapLocation(obj->map_location, obj->object_id);
			if(obj->map_hint.size())	ml->SetHint(obj->map_hint);
			ml->DisablePointer			();
			ml->SetSerializable			(true);
		}
	}
	CGameTask* _at = ActiveTask();
	if	( (NULL==_at) || (_at->m_priority > t->m_priority) )
	{
		SetActiveTask(t->m_ID, 1);
	}


	//установить флажок необходимости прочтения тасков в PDA
	if(HUD().GetUI()){
		CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());
		if(pGameSP) 
			pGameSP->PdaMenu->PdaContentsChanged	(pda_section::quests);
	}
	if(true /*t->m_ID!="user_task"*/)
		t->Objective(0).ChangeStateCallback();

	return t;
}
void CActor::AddEncyclopediaArticle	 (const CInfoPortion* info_portion) const
{
	VERIFY(info_portion);
	ARTICLE_VECTOR& article_vector = encyclopedia_registry->registry().objects();

	ARTICLE_VECTOR::iterator last_end = article_vector.end();
	ARTICLE_VECTOR::iterator B = article_vector.begin();
	ARTICLE_VECTOR::iterator E = last_end;

	for(ARTICLE_ID_VECTOR::const_iterator it = info_portion->ArticlesDisable().begin();
									it != info_portion->ArticlesDisable().end(); it++)
	{
		FindArticleByIDPred pred(*it);
		last_end = std::remove_if(B, last_end, pred);
	}
	article_vector.erase(last_end, E);


	for(ARTICLE_ID_VECTOR::const_iterator it = info_portion->Articles().begin();
									it != info_portion->Articles().end(); it++)
	{
		FindArticleByIDPred pred(*it);
		if( std::find_if(article_vector.begin(), article_vector.end(), pred) != article_vector.end() ) continue;

		CEncyclopediaArticle article;

		article.Load(*it);

		article_vector.push_back(ARTICLE_DATA(*it, Level().GetGameTime(), article.data()->articleType));
		LPCSTR g,n;
		int _atype = article.data()->articleType;
		g = *(article.data()->group);
		n = *(article.data()->name);
		callback(GameObject::eArticleInfo)(lua_game_object(), g, n, _atype);

		if( HUD().GetUI() ){
			CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());
			pda_section::part p = pda_section::encyclopedia;
			switch (article.data()->articleType){
				case ARTICLE_DATA::eEncyclopediaArticle:	p = pda_section::encyclopedia;	break;
				case ARTICLE_DATA::eJournalArticle:			p = pda_section::journal;		break;
				case ARTICLE_DATA::eInfoArticle:			p = pda_section::info;			break;
				case ARTICLE_DATA::eTaskArticle:			p = pda_section::quests;		break;
				default: NODEFAULT;
			};
			pGameSP->PdaMenu->PdaContentsChanged			(p);
		}

	}

}
Beispiel #13
0
void game_cl_GameState::reset_ui()
{
	if(g_dedicated_server)	return;

	if(!m_game_ui_custom)
		m_game_ui_custom = HUD().GetUI()->UIGame();

	m_game_ui_custom->reset_ui					();

	HUD().GetUI()->UIMainIngameWnd->reset_ui	();

	if (HUD().GetUI()->MainInputReceiver())
		HUD().GetUI()->StartStopMenu			(HUD().GetUI()->MainInputReceiver(),true);
}
void CActor::OnDisableInfo(shared_str info_id) const
{
	CInventoryOwner::OnDisableInfo(info_id);

	if(!HUD().GetUI())
		return;

	//только если находимся в режиме single
	CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());
	if(!pGameSP) return;

	if(pGameSP->TalkMenu->IsShown())
		pGameSP->TalkMenu->NeedUpdateQuestions();
}
void  CActor::AddGameNews			 (GAME_NEWS_DATA& news_data)
{

	GAME_NEWS_VECTOR& news_vector	= game_news_registry->registry().objects();
	news_data.receive_time			= Level().GetGameTime();
	news_vector.push_back			(news_data);

	if(HUD().GetUI()){
		HUD().GetUI()->UIMainIngameWnd->ReceiveNews(&news_data);
		CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());
		if(pGameSP) 
			pGameSP->PdaMenu->PdaContentsChanged	(pda_section::news);
	}
}
Beispiel #16
0
void CWeaponMagazined::OnStateSwitch	(u32 S)
{
	inherited::OnStateSwitch(S);
	switch (S)
	{
	case eIdle:
		switch2_Idle	();
		break;
	case eFire:
		switch2_Fire	();
		break;
	case eFire2:
		switch2_Fire2	();
		break;
	case eMisfire:
		if(smart_cast<CActor*>(this->H_Parent()) && (Level().CurrentViewEntity()==H_Parent()) )
			HUD().GetUI()->AddInfoMessage("gun_jammed");
		break;
	case eMagEmpty:
		switch2_Empty	();
		break;
	case eReload:
		switch2_Reload	();
		break;
	case eShowing:
		switch2_Showing	();
		break;
	case eHiding:
		switch2_Hiding	();
		break;
	case eHidden:
		switch2_Hidden	();
		break;
	}
}
/*
void CActor::UpdateContact		(u16 contact_id)
{
	if(ID() == contact_id) return;

	TALK_CONTACT_VECTOR& contacts = contacts_registry->registry().objects();
	for(TALK_CONTACT_VECTOR_IT it = contacts.begin(); contacts.end() != it; ++it)
		if((*it).id == contact_id) break;

	if(contacts.end() == it)
	{
		TALK_CONTACT_DATA contact_data(contact_id, Level().GetGameTime());
		contacts.push_back(contact_data);
	}
	else
	{
		(*it).time = Level().GetGameTime();
	}
}
*/
void CActor::NewPdaContact		(CInventoryOwner* pInvOwner)
{	
	if(!IsGameTypeSingle()) return;

	bool b_alive = !!(smart_cast<CEntityAlive*>(pInvOwner))->g_Alive();
	HUD().GetUI()->UIMainIngameWnd->AnimateContacts(b_alive);

	Level().MapManager().AddRelationLocation		( pInvOwner );

	if( HUD().GetUI() ){
		CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());

		if(pGameSP)
			pGameSP->PdaMenu->PdaContentsChanged	(pda_section::contacts);
	}
}
Beispiel #18
0
void CLevelChanger::feel_touch_new	(CObject *tpObject)
{
	CActor*			l_tpActor = smart_cast<CActor*>(tpObject);
	VERIFY			(l_tpActor);
	if (!l_tpActor->g_Alive())
		return;

	if (m_bSilentMode) {
		NET_Packet	p;
		p.w_begin	(M_CHANGE_LEVEL);
		p.w			(&m_game_vertex_id,sizeof(m_game_vertex_id));
		p.w			(&m_level_vertex_id,sizeof(m_level_vertex_id));
		p.w_vec3	(m_position);
		p.w_vec3	(m_angles);
		Level().Send(p,net_flags(TRUE));
		return;
	}
	Fvector			p,r;
	bool			b = get_reject_pos(p,r);
	CUIGameSP		*pGameSP = smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());
	if (pGameSP)
        pGameSP->ChangeLevel	(m_game_vertex_id,m_level_vertex_id,m_position,m_angles,p,r,b);

	m_entrance_time	= Device.fTimeGlobal;
}
void CUIActorMenu::Draw()
{
	inherited::Draw();
	HUD().GetUI()->UIMainIngameWnd->DrawZoneMap();
	m_ItemInfo->Draw();
	m_hint_wnd->Draw();
}
Beispiel #20
0
void CUIPdaWnd::PdaContentsChanged	(pda_section::part type)
{
	bool b = true;

	if(type==pda_section::encyclopedia){
		UIEncyclopediaWnd->ReloadArticles	();
	}else
	if(type==pda_section::news){
		UIDiaryWnd->AddNews					();
		UIDiaryWnd->MarkNewsAsRead			(UIDiaryWnd->IsShown());
	}else
	if(type==pda_section::quests){
		UIEventsWnd->Reload					();
	}else
	if(type==pda_section::contacts){
		UIPdaContactsWnd->Reload		();
		b = false;
	}

	if(b){
		g_pda_info_state |= type;
		HUD().GetUI()->UIMainIngameWnd->SetFlashIconState_(CUIMainIngameWnd::efiPdaTask, true);
	}

}
Beispiel #21
0
void CUISequenceSimpleItem::Update			()
{
	float gt						= float(Device.dwTimeContinual)/1000.0f;
	SubItemVecIt _I					= m_subitems.begin();
	SubItemVecIt _E					= m_subitems.end();
	for(;_I!=_E;++_I){
		SSubItem& s					= *_I;
		bool bPlaying				= (gt>(m_time_start+s.m_start))&&(gt<(m_time_start+s.m_start+s.m_length));
		if (true==bPlaying&&(false==s.m_visible))			s.Start	();
		else if ((false==bPlaying)&&(true==s.m_visible))	s.Stop	();
	}
	
	if (g_pGameLevel){
	CUIGameSP* ui_game_sp	= smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());

	if(ui_game_sp)
	{
		if(!m_pda_section || 0 == xr_strlen(m_pda_section) )
			if ( ui_game_sp->PdaMenu->IsShown()			||
				ui_game_sp->InventoryMenu->IsShown()	||
				ui_game_sp->TalkMenu->IsShown()			||
				ui_game_sp->UICarBodyMenu->IsShown()	||
				ui_game_sp->UIChangeLevelWnd->IsShown()			)
				m_UIWindow->Show						(false);
			else
				m_UIWindow->Show						(true);
		}
	}
}
Beispiel #22
0
void CUIPdaWnd::SendMessage(CUIWindow* pWnd, s16 msg, void* pData)
{
    switch ( msg )
    {
    case TAB_CHANGED:
    {
        if ( pWnd == UITabControl )
        {
            SetActiveSubdialog			(UITabControl->GetActiveId());
        }
        break;
    }
    case BUTTON_CLICKED:
    {
        if ( pWnd == m_btn_close )
        {
            HUD().GetUI()->StartStopMenu( this, true );
        }
        break;
    }
    default:
    {
        R_ASSERT						(m_pActiveDialog);
        m_pActiveDialog->SendMessage	(pWnd, msg, pData);
    }
    };
}
Beispiel #23
0
void CActor::UpdateMotionIcon(u32 mstate_rl)
{
	CUIMotionIcon		&motion_icon=HUD().GetUI()->UIMainIngameWnd->MotionIcon();
	if(mstate_rl&mcClimb)
	{
		motion_icon.ShowState(CUIMotionIcon::stClimb);
	}
	else
	{
		if(mstate_rl&mcCrouch)
		{
			if (!isActorAccelerated(mstate_rl, IsZoomAimingMode()))
				motion_icon.ShowState(CUIMotionIcon::stCreep);
			else
				motion_icon.ShowState(CUIMotionIcon::stCrouch);
		}
		else
		if(mstate_rl&mcSprint)
				motion_icon.ShowState(CUIMotionIcon::stSprint);
		else
		if(mstate_rl&mcAnyMove && isActorAccelerated(mstate_rl, IsZoomAimingMode()))
			motion_icon.ShowState(CUIMotionIcon::stRun);
		else
			motion_icon.ShowState(CUIMotionIcon::stNormal);
	}

/*
						stNormal, --
						stCrouch, --
						stCreep,  --
						stClimb,  --
						stRun,    --
						stSprint, --
*/
}
Beispiel #24
0
void CUIPdaWnd::Hide()
{
	inherited::Hide();

	InventoryUtilities::SendInfoToActor("ui_pda_hide");
	HUD().GetUI()->UIMainIngameWnd->SetFlashIconState_(CUIMainIngameWnd::efiPdaTask, false);

}
void _AddIconedTalkMessage(LPCSTR text, LPCSTR texture_name, const Frect& tex_rect, LPCSTR templ_name)
{
	CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());
	if(!pGameSP) return;

	if(pGameSP->TalkMenu->IsShown())
		pGameSP->TalkMenu->AddIconedMessage(text, texture_name, tex_rect, templ_name?templ_name:"iconed_answer_item" );
}
Beispiel #26
0
void CWeaponRPG7::switch2_Fire()
{
	m_iShotNum			= 0;
	m_bFireSingleShot	= true;
	bWorking			= false;

	if(GetState()==eFire && getRocketCount()) 
	{
		Fvector p1, d1, p; 
		Fvector p2, d2, d; 
		p1.set								(get_LastFP()); 
		d1.set								(get_LastFD());
		p = p1;
		d = d1;
		CEntity* E = smart_cast<CEntity*>	(H_Parent());
		if(E)
		{
			E->g_fireParams				(this, p2,d2);
			p = p2;
			d = d2;

			if(IsHudModeNow())
			{
				Fvector		p0;
				float dist	= HUD().GetCurrentRayQuery().range;
				p0.mul		(d2,dist);
				p0.add		(p1);
				p			= p1;
				d.sub		(p0,p1);
				d.normalize_safe();
			}
		}

		Fmatrix								launch_matrix;
		launch_matrix.identity				();
		launch_matrix.k.set					(d);
		Fvector::generate_orthonormal_basis(launch_matrix.k,
											launch_matrix.j, launch_matrix.i);
		launch_matrix.c.set					(p);

		d.normalize							();
		d.mul								(m_fLaunchSpeed);

		CRocketLauncher::LaunchRocket		(launch_matrix, d, zero_vel);

		CExplosiveRocket* pGrenade			= smart_cast<CExplosiveRocket*>(getCurrentRocket());
		VERIFY								(pGrenade);
		pGrenade->SetInitiator				(H_Parent()->ID());

		if (OnServer())
		{
			NET_Packet						P;
			u_EventGen						(P,GE_LAUNCH_ROCKET,ID());
			P.w_u16							(u16(getCurrentRocket()->ID()));
			u_EventSend						(P);
		}
	}
}
void GPlayState::Init()
{
    srand(time(NULL));
    stepSize = 1.0 / 60.0;
    space = cpSpaceNew();
    cpSpaceSetIterations(space, 6);

	arena = Arena(space);

    if(!player1)
        player1 = new Fighter();
    if(!player2)
        player2 = new Fighter();

    player1->Init(space, 250, 400, Character::RIGHT, sf::Color(32, 32, 200));
    player2->Init(space, 1050, 400, Character::LEFT, sf::Color(200, 32, 32));

    player1->setOponent(player2);
    player2->setOponent(player1);

	inputManager->addPlayer(player1);
	inputManager->addPlayer(player2);

    hud = HUD(player1, player2);

    if(!font.loadFromFile("rec/RevoPop.ttf")) {
        fprintf(stderr, "could not load font\n");
    }

    p1ScoreT.setFont(font);
    p1ScoreT.setString("0");
    p1ScoreT.setCharacterSize(32);
    p1ScoreT.setColor(sf::Color(32, 32, 32));
    p1ScoreT.setPosition(556, 344);

    p2ScoreT.setFont(font);
    p2ScoreT.setString("0");
    p2ScoreT.setCharacterSize(32);
    p2ScoreT.setColor(sf::Color(32, 32, 32));
    p2ScoreT.setPosition(556, 344);

    winner.setFont(font);
    winner.setCharacterSize(32);
    winner.setColor(sf::Color(32, 32, 32));
    winner.setPosition(480, 344);

    reseting = true;
    resetTime.restart();
    winner.setString("Beginning Round 1");
    round = 1;
    p1Score = 0;
    p2Score = 0;

    int ultPlayer = rand() % 2;
    ultClock.restart();

	printf("GPlayState Init\n");
}
void CLevel::IR_OnMouseWheel( int direction )
{
	if(	g_bDisableAllInput	) return;

	if (g_actor) Actor()->callback(GameObject::eOnMouseWheel)(direction>0?1:-1);//+
	
	if (HUD().GetUI()->IR_OnMouseWheel(direction)) return;
	if( Device.Paused()		) return;

	if (game && Game().IR_OnMouseWheel(direction) ) return;

	if( HUD().GetUI()->MainInputReceiver() )return;
	if (CURRENT_ENTITY())		{
			IInputReceiver*		IR	= smart_cast<IInputReceiver*>	(smart_cast<CGameObject*>(CURRENT_ENTITY()));
			if (IR)				IR->IR_OnMouseWheel(direction);
		}

}
Beispiel #29
0
void CUIPdaWnd::Hide()
{
    inherited::Hide						();
    InventoryUtilities::SendInfoToActor	("ui_pda_hide");
    HUD().GetUI()->UIMainIngameWnd->SetFlashIconState_(CUIMainIngameWnd::efiPdaTask, false);
    m_pActiveDialog->Show				(false);
    m_btn_close->Show					(false);
    g_btnHint->Discard					();
}
void CLevel::net_Stop		()
{
	Msg							("- Disconnect");

	if(HUD().GetUI())
		HUD().GetUI()->UIGame()->HideShownDialogs();

	bReady						= false;
	m_bGameConfigStarted		= FALSE;

	if (m_file_transfer)
	{
		xr_delete(m_file_transfer);
	}


	if (IsDemoPlay() && m_current_spectator)	//destroying demo spectator ...
	{
		m_current_spectator->setDestroy	(TRUE);
		SetControlEntity(NULL); //m_current_spectator == CurrentControlEntity()
		m_current_spectator = NULL;
		
	}
	remove_objects				();
	
	//WARNING ! remove_objects() uses this flag, so position of this line must e here ..
	game_configured				= FALSE;
	
	IGame_Level::net_Stop		();
	IPureClient::Disconnect		();

	if (Server) {
		Server->Disconnect		();
		xr_delete				(Server);
	}

	if (!g_dedicated_server)
		ai().script_engine().collect_all_garbage	();

#ifdef DEBUG
	show_animation_stats		();
#endif // DEBUG
}