Example #1
0
void CUIListItemServer::SetParams(LIST_SRV_ITEM& params){
	string1024				buff;

	LPCSTR _srv_name		= CStringTable().translate(params.info.server).c_str();
	cut_string_by_length	(m_map.GetFont(), _srv_name, buff, sizeof(buff), m_server.GetWidth());
	m_server.SetText		(buff);

	LPCSTR _map_name		= CStringTable().translate(params.info.map).c_str();
	cut_string_by_length	(m_map.GetFont(), _map_name, buff, sizeof(buff), m_map.GetWidth());
	m_map.SetText			(buff);

	LPCSTR _game_name		= CStringTable().translate(params.info.game).c_str();
	cut_string_by_length	(m_game.GetFont(), _game_name, buff, sizeof(buff), m_game.GetWidth());
	m_game.SetText			(buff);

	m_players.SetTextST		(*params.info.players);
	m_ping.SetTextST		(*params.info.ping);
	m_version.SetTextST		(*params.info.version);

	m_iconPass.Show			(params.info.icons.pass);
	m_iconDedicated.Show	(params.info.icons.dedicated);
	m_iconPunkBuster.Show	(params.info.icons.punkbuster);

	SetValue				(params.info.Index);
}
Example #2
0
void  CHUDManager::RenderUI()
{
	if(!b_online)					return;

	BOOL bAlready					= FALSE;
	if (true || psHUD_Flags.is(HUD_DRAW | HUD_DRAW_RT))
	{
		HitMarker.Render			();
		bAlready					= ! (pUI && !pUI->Render());
		Font().Render();
	}

	if (psHUD_Flags.is(HUD_CROSSHAIR|HUD_CROSSHAIR_RT|HUD_CROSSHAIR_RT2) && !bAlready)	
		m_pHUDTarget->Render();

	draw_wnds_rects		();

	if( Device.Paused() && bShowPauseString){
		CGameFont* pFont	= Font().pFontGraffiti50Russian;
		pFont->SetColor		(0x80FF0000	);
		LPCSTR _str			= CStringTable().translate("st_game_paused").c_str();
		
		Fvector2			_pos;
		_pos.set			(UI_BASE_WIDTH/2.0f, UI_BASE_HEIGHT/2.0f);
		UI()->ClientToScreenScaled(_pos);
		pFont->SetAligment	(CGameFont::alCenter);
		pFont->Out			(_pos.x, _pos.y, _str);
		pFont->OnRender		();
	}

}
Example #3
0
void CWeaponMagazined::GetBriefInfo(xr_string& str_name, xr_string& icon_sect_name, xr_string& str_count)
{
	int	AE = GetAmmoElapsed();
	int	AC = GetAmmoCurrent();

	if (AE == 0 || 0 == m_magazine.size())
		icon_sect_name = *m_ammoTypes[m_ammoType];
	else
		icon_sect_name = *m_ammoTypes[m_magazine.back().m_LocalAmmoType];

	string256		sItemName;
	strcpy_s(sItemName, *CStringTable().translate(pSettings->r_string(icon_sect_name.c_str(), "inv_name_short")));

	if (HasFireModes())
		strcat_s(sItemName, GetCurrentFireModeStr());

	str_name = sItemName;

	{
		if (!unlimited_ammo())
			sprintf_s(sItemName, "%d/%d", AE, AC - AE);
		else
			sprintf_s(sItemName, "%d/--", AE);

		str_count = sItemName;
	}
}
Example #4
0
void CCartridge::Load(LPCSTR section, u8 LocalAmmoType) 
{
	m_ammoSect				= section;
	m_LocalAmmoType			= LocalAmmoType;
	m_kDist					= pSettings->r_float(section, "k_dist");
	m_kDisp					= pSettings->r_float(section, "k_disp");
	m_kHit					= pSettings->r_float(section, "k_hit");
	m_kImpulse				= pSettings->r_float(section, "k_impulse");
	m_kPierce				= pSettings->r_float(section, "k_pierce");
	m_kAP					= READ_IF_EXISTS(pSettings, r_float, section, "k_ap", 0.0f);
	m_u8ColorID				= READ_IF_EXISTS(pSettings, r_u8, section, "tracer_color_ID", 0);
	
	if (pSettings->line_exist(section, "k_air_resistance"))
		m_kAirRes				=  pSettings->r_float(section, "k_air_resistance");
	else
		m_kAirRes				= pSettings->r_float(BULLET_MANAGER_SECTION, "air_resistance_k");

	m_flags.set				(cfTracer, pSettings->r_bool(section, "tracer"));
	m_buckShot				= pSettings->r_s32(section, "buck_shot");
	m_impair				= pSettings->r_float(section, "impair");
	fWallmarkSize			= pSettings->r_float(section, "wm_size");

	m_flags.set				(cfCanBeUnlimited | cfRicochet, TRUE);
	if(pSettings->line_exist(section,"can_be_unlimited"))
		m_flags.set(cfCanBeUnlimited, pSettings->r_bool(section, "can_be_unlimited"));

	if(pSettings->line_exist(section,"explosive"))
		m_flags.set			(cfExplosive, pSettings->r_bool(section, "explosive"));

	bullet_material_idx		=  GMLib.GetMaterialIdx(WEAPON_MATERIAL_NAME);
	VERIFY	(u16(-1)!=bullet_material_idx);
	VERIFY	(fWallmarkSize>0);

	m_InvShortName			= CStringTable().translate( pSettings->r_string(section, "inv_name_short"));
}
Example #5
0
void CUIActorMenu::UpdatePrices()
{
	LPCSTR kg_str = CStringTable().translate( "st_kg" ).c_str();

	UpdateActor();
	UpdatePartnerBag();
	u32 actor_price   = CalcItemsPrice( m_pTradeActorList,   m_partner_trade, true  );
	u32 partner_price = CalcItemsPrice( m_pTradePartnerList, m_partner_trade, false );

	string64 buf;
	sprintf_s( buf, "%d RU", actor_price );		m_ActorTradePrice->SetText( buf );		m_ActorTradePrice->AdjustWidthToText();
	sprintf_s( buf, "%d RU", partner_price );	m_PartnerTradePrice->SetText( buf );	m_PartnerTradePrice->AdjustWidthToText();

	float actor_weight   = CalcItemsWeight( m_pTradeActorList );
	float partner_weight = CalcItemsWeight( m_pTradePartnerList );

	sprintf_s( buf, "(%.1f %s)", actor_weight, kg_str );		m_ActorTradeWeightMax->SetText( buf );
	sprintf_s( buf, "(%.1f %s)", partner_weight, kg_str );	m_PartnerTradeWeightMax->SetText( buf );

	Fvector2 pos = m_ActorTradePrice->GetWndPos();
	pos.x = m_ActorTradeWeightMax->GetWndPos().x - m_ActorTradePrice->GetWndSize().x - 5.0f;
	m_ActorTradePrice->SetWndPos( pos );
	pos.x = pos.x - m_ActorTradeCaption->GetWndSize().x - 5.0f;
	m_ActorTradeCaption->SetWndPos( pos );

	pos = m_PartnerTradePrice->GetWndPos();
	pos.x = m_PartnerTradeWeightMax->GetWndPos().x - m_PartnerTradePrice->GetWndSize().x - 5.0f;
	m_PartnerTradePrice->SetWndPos( pos );
	pos.x = pos.x - m_PartnerTradeCaption->GetWndSize().x - 5.0f;
	m_PartnerTradeCaption->SetWndPos( pos );
}
Example #6
0
void CUIActorMenu::UpdatePartnerBag()
{
	string64 buf;

	CBaseMonster* monster = smart_cast<CBaseMonster*>( m_pPartnerInvOwner );
	if ( monster || m_pPartnerInvOwner->use_simplified_visual() ) 
	{
		m_PartnerWeight->SetText( "" );
	}
	else if ( m_pPartnerInvOwner->InfinitiveMoney() ) 
	{
		m_PartnerMoney->SetText( "--- RU" );
	}
	else
	{
		sprintf_s( buf, "%d RU", m_pPartnerInvOwner->get_money() );
		m_PartnerMoney->SetText( buf );
	}	

	LPCSTR kg_str = CStringTable().translate( "st_kg" ).c_str();
	float total	= CalcItemsWeight( m_pTradePartnerBagList );
	sprintf_s( buf, "%.1f %s", total, kg_str );
	m_PartnerWeight->SetText( buf );
	m_PartnerWeight->AdjustWidthToText();

	Fvector2 pos = m_PartnerWeight->GetWndPos();
	pos.x = m_PartnerWeight_end_x - m_PartnerWeight->GetWndSize().x - 5.0f;
	m_PartnerWeight->SetWndPos( pos );
	pos.x = pos.x - m_PartnerBottomInfo->GetWndSize().x - 5.0f;
	m_PartnerBottomInfo->SetWndPos( pos );
}
void Property::construct( shared_str const& property_id, Manager& manager_r )
{
	m_id._set( property_id );
	VERIFY2( pSettings->section_exist( m_id ), make_string( "Section of upgrade property [%s] does not exist!", m_id.c_str() ) );

	m_name = CStringTable().translate( pSettings->r_string( id(), "name" ) );
	m_icon._set( pSettings->r_string(id(), "icon") );

	// functor
	LPCSTR functor_str = pSettings->r_string( id(), "functor" );
	m_desc.parameter   = "";
	m_desc.parameter2 = id_str();
	R_ASSERT2(
		ai().script_engine().functor( functor_str, m_desc.functr ),
		make_string( "Failed to get upgrade property functor in section[%s], functor[%s]",
		id_str(), functor_str
		)
	);
	m_desc(); // test

	LPCSTR funct_params_str = pSettings->r_string( id(), "params" );
	PSTR	temp = (PSTR)_alloca( (xr_strlen(funct_params_str) + 1) * sizeof(char) );
	for ( int n = _GetItemCount( funct_params_str ), i = 0; i < n; ++i )
	{
		LPCSTR i_param = ( _GetItem( funct_params_str, i, temp ) );
		m_functor_params.push_back( i_param );
	}

}
Example #8
0
void CUISpeechMenu::InitList(LPCSTR section_name)
{
	R_ASSERT2(pSettings->section_exist(section_name), section_name);
	CUITextWnd* pItem = NULL;

	string64 phrase;
	string256 str;
	for (int i = 0; true; ++i)
	{
		xr_sprintf					(phrase,"phrase_%i",i);		
		if (pSettings->line_exist(section_name, phrase))
		{
			
            LPCSTR s				= pSettings->r_string(section_name, phrase);
			_GetItem				(s,0,phrase);
			xr_sprintf				(str, "%d. %s",i+1, CStringTable().translate(phrase).c_str());

			ADD_TEXT_TO_VIEW3		(str, pItem, m_pList);
			pItem->SetFont			(m_pFont);
			pItem->SetTextColor		(m_text_color);
		}
		else
			break;
	}
}
Example #9
0
void CUIDebugFonts::FillUpList(){
	CFontManager::FONTS_VEC& v = UI()->Font()->m_all_fonts;
	CFontManager::FONTS_VEC_IT it	= v.begin();
	CFontManager::FONTS_VEC_IT it_e = v.end();
	Fvector2 pos, sz;
	pos.set			(0,0);
	sz.set			(UI_BASE_WIDTH,UI_BASE_HEIGHT);
	string256		str;
	for(;it!=it_e;++it){
		CGameFont* F			= *(*it);
		CUIStatic* pItem		= xr_new<CUIStatic>();
		pItem->SetWndPos		(pos);
		pItem->SetWndSize		(sz);
		sprintf_s					(str, "%s:%s", *F->m_font_name, *CStringTable().translate("Test_Font_String"));
		pItem->SetFont			(F);
		pItem->SetText			(str);
		pItem->SetTextComplexMode(false);
		pItem->SetVTextAlignment(valCenter);
		pItem->SetTextAlignment	(CGameFont::alCenter);
		pItem->AdjustHeightToText();
		pos.y					+= pItem->GetHeight()+20.0f;
		pItem->SetAutoDelete	(true);
		AttachChild				(pItem);
	}

}
Example #10
0
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);
	}
}
Example #11
0
LPCSTR CMapLocation::GetHint()
{
	if ( !HintEnabled() ) 
	{
		return NULL;
	}
	return CStringTable().translate(m_hint).c_str();
};
Example #12
0
void CUITalkWnd::AddQuestion(const shared_str& text, const shared_str& value)
{
	if(text.size() == 0)
	{
		return;
	}
	UITalkDialogWnd->AddQuestion(*CStringTable().translate(text),value.c_str());
}
Example #13
0
void CUILogsWnd::Init()
{
	m_uiXml.Load( CONFIG_PATH, UI_PATH, PDA_LOGS_XML );

	CUIXmlInit::InitWindow( m_uiXml, "main_wnd", 0, this );

//	m_background		= UIHelper::CreateFrameLine( m_uiXml, "background", this );
	m_background				= UIHelper::CreateFrameWindow(m_uiXml, "background", this);
	m_center_background			= UIHelper::CreateFrameWindow(m_uiXml, "center_background", this);
	
	//m_actor_ch_info = xr_new<CUICharacterInfo>();
	//m_actor_ch_info->SetAutoDelete( true );
	//AttachChild( m_actor_ch_info );
	//m_actor_ch_info->InitCharacterInfo( &m_uiXml, "actor_ch_info" );

//	m_center_background	= UIHelper::CreateStatic( m_uiXml, "center_background", this );
	m_center_caption	= UIHelper::CreateTextWnd( m_uiXml, "center_caption", this );

	string256 buf;
	xr_strcpy( buf, sizeof(buf), m_center_caption->GetText() );
	xr_strcat( buf, sizeof(buf), CStringTable().translate("ui_logs_center_caption").c_str() );
	m_center_caption->SetText( buf );

	CUIFixedScrollBar* tmp_scroll = xr_new<CUIFixedScrollBar>();
	m_list = xr_new<CUIScrollView>(tmp_scroll);
	m_list->SetAutoDelete( true );
	AttachChild( m_list );
	CUIXmlInit::InitScrollView( m_uiXml, "logs_list", 0, m_list);
//	m_list->SetWindowName("---logs_list");
//	m_logs_list->m_sort_function = fastdelegate::MakeDelegate( this, &CUIRankingWnd::SortingLessFunction );

	m_filter_news = UIHelper::CreateCheck( m_uiXml, "filter_news", this );
	m_filter_talk = UIHelper::CreateCheck( m_uiXml, "filter_talk", this );
	m_filter_news->SetCheck( true );
	m_filter_talk->SetCheck( true );

//	m_date_caption = UIHelper::CreateTextWnd( m_uiXml, "date_caption", this );
//	m_date         = UIHelper::CreateTextWnd( m_uiXml, "date", this );

	m_period_caption = UIHelper::CreateTextWnd( m_uiXml, "period_caption", this );
	m_period         = UIHelper::CreateTextWnd( m_uiXml, "period", this );

	m_prev_period = UIHelper::Create3tButton( m_uiXml, "btn_prev_period", this );
	m_next_period = UIHelper::Create3tButton( m_uiXml, "btn_next_period", this );

	Register( m_filter_news );
	Register( m_filter_talk );
	Register( m_prev_period );
	Register( m_next_period );

	AddCallback( m_filter_news, BUTTON_CLICKED, CUIWndCallback::void_function( this, &CUILogsWnd::UpdateChecks ) );
	AddCallback( m_filter_talk, BUTTON_CLICKED, CUIWndCallback::void_function( this, &CUILogsWnd::UpdateChecks ) );
	AddCallback( m_prev_period, BUTTON_CLICKED, CUIWndCallback::void_function( this, &CUILogsWnd::PrevPeriod ) );
	AddCallback( m_next_period, BUTTON_CLICKED, CUIWndCallback::void_function( this, &CUILogsWnd::NextPeriod ) );

	m_start_game_time = Level().GetStartGameTime();
	m_start_game_time = GetShiftPeriod( m_start_game_time, 0 );
}
Example #14
0
void CUICaption::setCaption(const shared_str& msg_name, LPCSTR message_to_out, u32 color, bool replaceColor)
{
//	R_ASSERT2( (m_indices.find(msg_name) != m_indices.end()),"message not defined !!!" );
	SinglePhrase * sp = GetPhraseByIndex(findIndexOf(msg_name));
	sp->str = *CStringTable().translate(message_to_out);

	if(replaceColor)
		sp->effect.SetTextColor(color);
}
Example #15
0
void	CMainMenu::OnLoadError				(LPCSTR module)
{
	LPCSTR str=CStringTable().translate("ui_st_error_loading").c_str();
	string1024 Text;
	strconcat(sizeof(Text),Text,str," ");
	xr_strcat(Text,sizeof(Text),module);
	m_pMB_ErrDlgs[LoadingError]->SetText(Text);
	SetErrorDialog(CMainMenu::LoadingError);
}
Example #16
0
void CUITalkWnd::AddAnswer(const shared_str& text, LPCSTR SpeakerName)
{
	//для пустой фразы вообще ничего не выводим
	if(text.size() == 0) return;
	PlaySnd			(text.c_str());

	bool i_am = (0 == xr_strcmp(SpeakerName, m_pOurInvOwner->Name()));
	UITalkDialogWnd->AddAnswer(SpeakerName,*CStringTable().translate(text),i_am);
}
Example #17
0
CUIListBoxItem* CUIListBox::AddTextItem(LPCSTR text)
{
	CUIListBoxItem* pItem			= AddItem();

	pItem->SetWndSize				(Fvector2().set(GetDesiredChildWidth(), m_def_item_height));
	pItem->SetTextColor				(m_text_color);
	pItem->SetText					(CStringTable().translate(text).c_str());
	pItem->GetTextItem()->SetWidth	(GetDesiredChildWidth());
	return							pItem;
}
Example #18
0
void CUIMapList::UpdateMapList(EGameTypes GameType){
	m_pList1->Clear				();
	m_pList2->Clear				();

	for (u32 i=0; i<m_maps[GameType].size(); ++i)
	{
		CUIListBoxItem* itm		= m_pList1->AddItem( CStringTable().translate(m_maps[GameType][i]).c_str() );
		itm->SetData			( (void*)(__int64)i );
		itm->Enable(m_pExtraContentFilter->IsDataEnabled(m_maps[GameType][i].c_str()));
	}
}
void			CLevel::OnConnectResult				(NET_Packet*	P)
{
	// multiple results can be sent during connection they should be "AND-ed"
	m_bConnectResultReceived	= true;
	u8	result					= P->r_u8();
	u8  res1					= P->r_u8();
	string512 ResultStr			;	
	P->r_stringZ_s(ResultStr)		;
	if (!result)				
	{
		m_bConnectResult	= false			;	
		switch (res1)
		{
		case 0:		//Standart error
			{
				if (strstr(ResultStr, "Data verification failed. Cheater?"))
					MainMenu()->SetErrorDialog(CMainMenu::ErrDifferentVersion);
			}break;
		case 1:		//GameSpy CDKey
			{
				if (!xr_strcmp(ResultStr, "Invalid CD Key"))
					MainMenu()->SetErrorDialog(CMainMenu::ErrCDKeyInvalid);//, ResultStr);
				if (!xr_strcmp(ResultStr, "CD Key in use"))
					MainMenu()->SetErrorDialog(CMainMenu::ErrCDKeyInUse);//, ResultStr);
				if (!xr_strcmp(ResultStr, "Your CD Key is disabled. Contact customer service."))
					MainMenu()->SetErrorDialog(CMainMenu::ErrCDKeyDisabled);//, ResultStr);
			}break;		
		case 2:		//login+password
			{
				MainMenu()->SetErrorDialog(CMainMenu::ErrInvalidPassword);
			}break;
		case 3:
			{
				if (!xr_strlen(ResultStr))
				{
					MainMenu()->OnSessionTerminate(
						CStringTable().translate("st_you_have_been_banned").c_str()
					);
				} else
				{
					MainMenu()->OnSessionTerminate(ResultStr);
				}
			}break;
		}
	};	
	m_sConnectResult			= ResultStr;
	if (IsDemoSave())
	{
		P->r_u8(); //server client or not
		shared_str server_options;
		P->r_stringZ(server_options);
		StartSaveDemo(server_options);
	}
};
Example #20
0
EGameIDs CUIMapList::GetCurGameType()
{
	LPCSTR text = "";
	CUIComboBox* combo_ms = smart_cast<CUIComboBox*>(m_pModeSelector);
	CUISpinText* spin_ms = smart_cast<CUISpinText*>(m_pModeSelector);
	if(combo_ms)
	{
		text = combo_ms->GetText();
		if (0 == xr_strcmp(text, CStringTable().translate(get_token_name(g_GameModes,eGameIDDeathmatch))) )
			return	eGameIDDeathmatch;
		else if (0 == xr_strcmp(text, CStringTable().translate(get_token_name(g_GameModes,eGameIDTeamDeathmatch))) )
			return	eGameIDTeamDeathmatch;
		else if (0 == xr_strcmp(text, CStringTable().translate(get_token_name(g_GameModes,eGameIDArtefactHunt))) )
			return	eGameIDArtefactHunt;
		else if (0 == xr_strcmp(text, CStringTable().translate(get_token_name(g_GameModes,eGameIDCaptureTheArtefact))) )
			return	eGameIDCaptureTheArtefact;
		else
			NODEFAULT;
	}
	else if(spin_ms)
	{
		text = spin_ms->GetTokenText();
		if (0 == xr_strcmp(text, get_token_name(g_GameModes,eGameIDDeathmatch)) )
			return	eGameIDDeathmatch;
		else if (0 == xr_strcmp(text, get_token_name(g_GameModes,eGameIDTeamDeathmatch)) )
			return	eGameIDTeamDeathmatch;
		else if (0 == xr_strcmp(text, get_token_name(g_GameModes,eGameIDArtefactHunt)) )
			return	eGameIDArtefactHunt;
		else if (0 == xr_strcmp(text, get_token_name(g_GameModes,eGameIDCaptureTheArtefact)) )
			return	eGameIDCaptureTheArtefact;
		else
			NODEFAULT;
	}
	else
		NODEFAULT;


#ifdef DEBUG
	return EGameIDs(u32(-1));
#endif
}
Example #21
0
void CUIMpChangeMapAdm::FillUpList()
{
	lst->Clear();
	const SGameTypeMaps& M = gMapListHelper.GetMapListFor((EGameIDs)GameID());
	u32 cnt	= M.m_map_names.size();
	for (u32 i=0; i<cnt; ++i)
	{
		CUIListBoxItem* itm = lst->AddTextItem(CStringTable().translate(M.m_map_names[i].map_name).c_str());
		itm->Enable(true);
	}

}
Example #22
0
void CInventoryItem::Load(LPCSTR section) 
{
	CHitImmunity::LoadImmunities	(pSettings->r_string(section,"immunities_sect"),pSettings);

	ISpatial*			self				=	smart_cast<ISpatial*> (this);
	if (self)			self->spatial.type	|=	STYPE_VISIBLEFORAI;	

	m_name				= CStringTable().translate( pSettings->r_string(section, "inv_name") );
	m_nameShort			= CStringTable().translate( pSettings->r_string(section, "inv_name_short"));

//.	NameComplex			();
	m_weight			= pSettings->r_float(section, "inv_weight");
	R_ASSERT			(m_weight>=0.f);

	m_cost				= pSettings->r_u32(section, "cost");

	m_slot				= READ_IF_EXISTS(pSettings,r_u32,section,"slot", NO_ACTIVE_SLOT);


	// Description
	if ( pSettings->line_exist(section, "description") )
		m_Description = CStringTable().translate( pSettings->r_string(section, "description") );

	m_flags.set(Fbelt,			READ_IF_EXISTS(pSettings, r_bool, section, "belt",				FALSE));
	m_flags.set(FRuckDefault,	READ_IF_EXISTS(pSettings, r_bool, section, "default_to_ruck",	TRUE));

	m_flags.set(FCanTake,		READ_IF_EXISTS(pSettings, r_bool, section, "can_take",			TRUE));
	m_flags.set(FCanTrade,		READ_IF_EXISTS(pSettings, r_bool, section, "can_trade",			TRUE));
	m_flags.set(FIsQuestItem,	READ_IF_EXISTS(pSettings, r_bool, section, "quest_item",		FALSE));



	//время убирания объекта с уровня
	m_dwItemRemoveTime			= READ_IF_EXISTS(pSettings, r_u32, section,"item_remove_time",			ITEM_REMOVE_TIME);

	m_flags.set					(FAllowSprint,READ_IF_EXISTS	(pSettings, r_bool, section,"sprint_allowed",			TRUE));
	m_fControlInertionFactor	= READ_IF_EXISTS(pSettings, r_float,section,"control_inertion_factor",	1.0f);
	m_icon_name					= READ_IF_EXISTS(pSettings, r_string,section,"icon_name",				NULL);

}
Example #23
0
void CUIMapList::UpdateMapList(EGameTypes GameType)
{
	m_pList1->Clear				();
	m_pList2->Clear				();

	const SGameTypeMaps& M		= gMapListHelper.GetMapListFor(GameType);
	u32 cnt						= M.m_map_names.size();
	for (u32 i=0; i<cnt; ++i)
	{
		CUIListBoxItem* itm		= m_pList1->AddItem( CStringTable().translate(M.m_map_names[i]).c_str() );
		itm->SetData			( (void*)(__int64)i );
		itm->Enable(m_pExtraContentFilter->IsDataEnabled(M.m_map_names[i].c_str()));
	}
}
Example #24
0
void CUITradeWnd::UpdatePrices()
{
	m_iOurTradePrice	= CalcItemsPrice	(&m_uidata->UIOurTradeList,		m_pOthersTrade, true);
	m_iOthersTradePrice = CalcItemsPrice	(&m_uidata->UIOthersTradeList,	m_pOthersTrade, false);


	string256				buf;
	sprintf_s					(buf, "%d %s", m_iOurTradePrice,*CStringTable().translate("ui_st_money_regional"));
	m_uidata->UIOurPriceCaption.GetPhraseByIndex(2)->str = buf;
	sprintf_s					(buf, "%d %s", m_iOthersTradePrice,*CStringTable().translate("ui_st_money_regional"));
	m_uidata->UIOthersPriceCaption.GetPhraseByIndex(2)->str = buf;

	sprintf_s					(buf, "%d %s", m_pInvOwner->get_money(),*CStringTable().translate("ui_st_money_regional"));
	m_uidata->UIOurMoneyStatic.SetText(buf);

	if(!m_pOthersInvOwner->InfinitiveMoney()){
		sprintf_s					(buf, "%d %s", m_pOthersInvOwner->get_money(),*CStringTable().translate("ui_st_money_regional"));
		m_uidata->UIOtherMoneyStatic.SetText(buf);
	}else
	{
		m_uidata->UIOtherMoneyStatic.SetText("---");
	}
}
Example #25
0
void CUISpinText::AddItem_(const char* item, int id)
{
	SInfo			_info;
	_info._orig		= item;
	_info._transl	= CStringTable().translate(item);
	_info._id		= id;

	m_list.push_back( _info );
	if (-1 == m_curItem)
	{
		m_curItem		= 0;
		SetItem			();
	}
}
Example #26
0
void CUIMpTradeWnd::StorePreset(ETradePreset idx, bool bSilent)
{
	if(!bSilent)
	{
		string512						buff;
		sprintf							(buff,	"%s [%d]",
												CStringTable().translate("ui_st_preset_stored_to").c_str(), idx);
		SetInfoString					(buff);
	}
	ITEMS_vec_cit it				= m_all_items.begin();
	ITEMS_vec_cit it_e				= m_all_items.end();

	preset_items&	v				= m_preset_storage[idx];
	v.clear_not_free				();
	for(;it!=it_e; ++it)
	{
		SBuyItemInfo* iinfo			= *it;
		if(	!(iinfo->GetState()==SBuyItemInfo::e_bought || iinfo->GetState()==SBuyItemInfo::e_own)	)
		continue;

		u8 addon_state				= GetItemAddonsState_ext(iinfo);

		preset_items::iterator fit	= std::find_if(v.begin(), v.end(), preset_eq(iinfo->m_name_sect, addon_state) );
		if(fit!=v.end())
			continue;

		u32 cnt						= GetItemCount(iinfo->m_name_sect, SBuyItemInfo::e_bought, addon_state);
		cnt							+=GetItemCount(iinfo->m_name_sect, SBuyItemInfo::e_own, addon_state);
		if(0==cnt)				
			continue;

		v.resize					(v.size()+1);
		_preset_item& _one			= v.back();
		_one.sect_name				= iinfo->m_name_sect;
		_one.count					= cnt;
		_one.addon_state			= addon_state;

		if(addon_state&at_scope)
			_one.addon_names[0]			= GetAddonNameSect(iinfo, at_scope);

		if(addon_state&at_glauncher)
			_one.addon_names[1]			= GetAddonNameSect(iinfo, at_glauncher);

		if(addon_state&at_silencer)
			_one.addon_names[2]			= GetAddonNameSect(iinfo, at_silencer);
	}

	std::sort						(v.begin(), v.end(), preset_sorter(m_item_mngr));
}
Example #27
0
void CInventoryItem::Load(LPCSTR section) 
{
	CHitImmunity::LoadImmunities	(pSettings->r_string(section,"immunities_sect"),pSettings);

	ISpatial*			self				=	smart_cast<ISpatial*> (this);
	if (self)			self->spatial.type	|=	STYPE_VISIBLEFORAI;	

	m_section_id._set	( section );
	m_name				= CStringTable().translate( pSettings->r_string(section, "inv_name") );
	m_nameShort			= CStringTable().translate( pSettings->r_string(section, "inv_name_short") );

	m_weight			= pSettings->r_float(section, "inv_weight");
	R_ASSERT			(m_weight>=0.f);

	m_cost				= pSettings->r_u32(section, "cost");
	u32 sl  			= pSettings->r_u32(section,"slot");
	m_ItemCurrPlace.base_slot_id = (sl==-1)?0:(sl+1);

	m_Description = CStringTable().translate( pSettings->r_string(section, "description") );

	m_flags.set(Fbelt,			READ_IF_EXISTS(pSettings, r_bool, section, "belt",		FALSE));
	m_can_trade = READ_IF_EXISTS(pSettings, r_bool, section, "can_take",	TRUE);
	m_flags.set(FCanTake,		m_can_trade);
	m_flags.set(FCanTrade,		READ_IF_EXISTS(pSettings, r_bool, section, "can_trade",	TRUE));
	m_flags.set(FIsQuestItem,	READ_IF_EXISTS(pSettings, r_bool, section, "quest_item",FALSE));


	if ( BaseSlot() != NO_ACTIVE_SLOT || Belt())
	{
		m_flags.set					(FRuckDefault, pSettings->r_bool(section, "default_to_ruck" ));
		m_flags.set					(FAllowSprint, pSettings->r_bool(section, "sprint_allowed" ));
		m_fControlInertionFactor	= pSettings->r_float(section,"control_inertion_factor");
	}
	m_icon_name					= READ_IF_EXISTS(pSettings, r_string,section,"icon_name",		NULL);

}
Example #28
0
void CUITalkWnd::AddQuestion(const shared_str& text, const shared_str& value
#ifdef NUM_PHRASES
, int number
#endif
)
{
	if(text.size() == 0)
	{
		return;
	}
	UITalkDialogWnd->AddQuestion(*CStringTable().translate(text),value.c_str()
#ifdef NUM_PHRASES
, number
#endif
);
}
Example #29
0
void CUIActorMenu::UpdateDeadBodyBag()
{
	string64 buf;

	LPCSTR kg_str = CStringTable().translate( "st_kg" ).c_str();
	float total	= CalcItemsWeight( m_pDeadBodyBagList );
	sprintf_s( buf, "%.1f %s", total, kg_str );
	m_PartnerWeight->SetText( buf );
	m_PartnerWeight->AdjustWidthToText();

	Fvector2 pos = m_PartnerWeight->GetWndPos();
	pos.x = m_PartnerWeight_end_x - m_PartnerWeight->GetWndSize().x - 5.0f;
	m_PartnerWeight->SetWndPos( pos );
	pos.x = pos.x - m_PartnerBottomInfo->GetWndSize().x - 5.0f;
	m_PartnerBottomInfo->SetWndPos( pos );
}
Example #30
0
void CUIMapList::UpdateMapList(EGameIDs GameType)
{
	typedef buffer_vector<shared_str>	MapList;

	m_pList1->Clear				();

	const SGameTypeMaps& M		= gMapListHelper.GetMapListFor(GameType);
	u32 cnt						= M.m_map_names.size();
	for (u32 i=0; i<cnt; ++i)
	{
		CUIListBoxItem* itm		= m_pList1->AddTextItem( CStringTable().translate(M.m_map_names[i].map_name).c_str() );
		itm->SetData			( (void*)(__int64)i );
		itm->Enable				(true);
	}
	
	u32 list_size				= m_pList2->GetSize();
	if ( list_size == 0 )
	{
		m_pList2->Clear			();
		return;
	}

	MapList		map_list( _alloca( sizeof(shared_str) * list_size ), list_size );

	for ( u32 i = 0; i < list_size; ++i )
	{
		LPCSTR st = m_pList2->GetText( i );
		map_list.push_back( st );
	}
	m_pList2->Clear();

	MapList::const_iterator itb = map_list.begin();
	MapList::const_iterator ite = map_list.end();
	for ( ; itb != ite; ++itb )
	{
		CUIListBoxItem* itm1 = GetMapItem_fromList1( *itb );
		if ( itm1 )
		{
			CUIListBoxItem* itm2 = m_pList2->AddTextItem( (*itb).c_str() );
			itm2->SetData( itm1->GetData() );
			itm2->Enable( true );
		}
	}
}