Exemplo n.º 1
0
void CInventoryOwner::SetCommunity	(CHARACTER_COMMUNITY_INDEX new_community)
{
	CEntityAlive* EA					= smart_cast<CEntityAlive*>(this); VERIFY(EA);

	CSE_Abstract* e_entity				= ai().alife().objects().object(EA->ID(), false);
	if(!e_entity) return;

	CSE_ALifeTraderAbstract* trader		= smart_cast<CSE_ALifeTraderAbstract*>(e_entity);
	if(!trader) return;

	CharacterInfo().m_CurrentCommunity.set(new_community);
//	EA->id_Team = CharacterInfo().m_CurrentCommunity.team();
	EA->ChangeTeam(CharacterInfo().m_CurrentCommunity.team(), EA->g_Squad(), EA->g_Group());
	trader->m_community_index  = new_community;
}
Exemplo n.º 2
0
void CInventoryOwner::SetRank			(CHARACTER_RANK_VALUE rank)
{
	CEntityAlive* EA					= smart_cast<CEntityAlive*>(this); VERIFY(EA);
	CSE_Abstract* e_entity				= ai().alife().objects().object(EA->ID(), false);
	if(!e_entity) return;
	CSE_ALifeTraderAbstract* trader		= smart_cast<CSE_ALifeTraderAbstract*>(e_entity);
	if(!trader) return;

	CharacterInfo().m_CurrentRank.set(rank);
	trader->m_rank  = rank;
}
Exemplo n.º 3
0
void	CInventoryOwner::save	(NET_Packet &output_packet)
{
	if(inventory().GetActiveSlot() == NO_ACTIVE_SLOT)
		output_packet.w_u8((u8)(-1));
	else
		output_packet.w_u8((u8)inventory().GetActiveSlot());

	CharacterInfo().save(output_packet);
	save_data	(m_game_name, output_packet);
	save_data	(m_money,	output_packet);
}
Exemplo n.º 4
0
void CInventoryOwner::SetReputation		(CHARACTER_REPUTATION_VALUE reputation)
{
	CEntityAlive* EA					= smart_cast<CEntityAlive*>(this); VERIFY(EA);
	CSE_Abstract* e_entity				= ai().alife().objects().object(EA->ID(), false);
	if(!e_entity) return;

	CSE_ALifeTraderAbstract* trader		= smart_cast<CSE_ALifeTraderAbstract*>(e_entity);
	if(!trader) return;

	CharacterInfo().m_CurrentReputation.set(reputation);
	trader->m_reputation  = reputation;
}
Exemplo n.º 5
0
void	CInventoryOwner::load	(IReader &input_packet)
{
	u8 active_slot = input_packet.r_u8();
	if(active_slot == u8(-1))
		inventory().SetActiveSlot(NO_ACTIVE_SLOT);
	else
		inventory().Activate_deffered(active_slot, Device.dwFrame);

	m_tmp_active_slot_num		 = active_slot;

	CharacterInfo().load(input_packet);
	load_data		(m_game_name, input_packet);
	load_data		(m_money,	input_packet);
}
Exemplo n.º 6
0
int CUIMain::LoadWorld(void)
{
	Ogre::SceneNode* RootNode = mSceneMgr->getRootSceneNode();

	Ogre::Plane plane(Ogre::Vector3::UNIT_Y, -1); //1 unit under the ground
	Ogre::MeshManager::getSingleton().createPlane("ground", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
		2000,2000,20,20,true,1,5,5,Ogre::Vector3::UNIT_Z);
	Ogre::Entity *GroundEnt = mSceneMgr->createEntity("GroundEntity", "ground");
	GroundEnt->setQueryFlags(QUERY_MASK_MOUSE_MOVEMENT);
	GroundEnt->setMaterialName("Rockwall");
	RootNode->createChildSceneNode()->attachObject(GroundEnt);

	CharacterInfo local_player_info;
	mWorld.LocalPlayer = new CLocalPlayer(mWorld, RootNode->createChildSceneNode());
	AttachMeshes(mWorld.LocalPlayer, local_player_info);
	mWorld.LocalPlayer->SetMoveSpeed(100);
	mWorld.LocalPlayer->SetState(State_Idle);

	//Test:
	CreateNewPlayer(0, CharacterInfo());

	Ogre::SceneNode *DestMarkerNode = RootNode->createChildSceneNode();
	Ogre::Entity *DestMarker = mSceneMgr->createEntity("Ent-DestMarker", "arrow.mesh");
	DestMarker->setQueryFlags(0);
	DestMarkerNode->attachObject(DestMarker);
	DestMarkerNode->setVisible(false);
	mWorld.LocalPlayer->SetDestinationMarker(DestMarkerNode, DestMarker);

	mMoveDestinationIndicator = RootNode->createChildSceneNode();
	Ogre::Entity* MouseIndicatorEntity = mSceneMgr->createEntity("Ent-MouseIndicator", "arrow.mesh");
	MouseIndicatorEntity->setQueryFlags(0);
	MouseIndicatorEntity->setMaterialName("ArrowTransparent");
	mMoveDestinationIndicator->attachObject(MouseIndicatorEntity);
	mMoveDestinationIndicator->scale(0.8, 0.8, 0.8);

	mEntityHoveringIndicator = RootNode->createChildSceneNode();
	mEntitySelectionIndicator = RootNode->createChildSceneNode();
	Ogre::Entity* HoverIndicatorEntity = mSceneMgr->createEntity("Ent-HoveringIndicator", "arrows.mesh");
	Ogre::Entity* SelectionIndicatorEntity = mSceneMgr->createEntity("Ent-SelectionIndicator", "arrows.mesh");
	HoverIndicatorEntity->setQueryFlags(0);
	SelectionIndicatorEntity->setQueryFlags(0);
	HoverIndicatorEntity->setMaterialName("ArrowTransparent");
	mEntitySelectionIndicator->setInheritOrientation(false);
	mEntityHoveringIndicator->attachObject(HoverIndicatorEntity);
	mEntitySelectionIndicator->attachObject(SelectionIndicatorEntity);
	mEntityHoveringIndicator->setVisible(false);
	mEntitySelectionIndicator->setVisible(false);

	return 1;
}
Exemplo n.º 7
0
//call this after CGameObject::net_Spawn
BOOL CInventoryOwner::net_Spawn		(CSE_Abstract* DC)
{
	if (!m_pTrade)
		m_pTrade				= xr_new<CTrade>(this);

	if (m_trade_parameters)
		xr_delete				(m_trade_parameters);

	m_trade_parameters			= xr_new<CTradeParameters>(trade_section());

	//получить указатель на объект, InventoryOwner
	//m_inventory->setSlotsBlocked(false);
	CGameObject			*pThis = smart_cast<CGameObject*>(this);
	if(!pThis) return FALSE;
	CSE_Abstract* E	= (CSE_Abstract*)(DC);

	if ( IsGameTypeSingle() )
	{
		CSE_ALifeTraderAbstract* pTrader = NULL;
		if(E) pTrader = smart_cast<CSE_ALifeTraderAbstract*>(E);
		if(!pTrader) return FALSE;

		R_ASSERT( pTrader->character_profile().size() );

		//синхронизируем параметры персонажа с серверным объектом
		CharacterInfo().Init(pTrader);

		//-------------------------------------
		m_known_info_registry->registry().init(E->ID);
		//-------------------------------------


		CAI_PhraseDialogManager* dialog_manager = smart_cast<CAI_PhraseDialogManager*>(this);
		if( dialog_manager && !dialog_manager->GetStartDialog().size() )
		{
			dialog_manager->SetStartDialog(CharacterInfo().StartDialog());
			dialog_manager->SetDefaultStartDialog(CharacterInfo().StartDialog());
		}
		m_game_name			= pTrader->m_character_name;
	}
	else
	{
		CharacterInfo().m_SpecificCharacter.Load					("mp_actor");
		CharacterInfo().InitSpecificCharacter						("mp_actor");
		CharacterInfo().m_SpecificCharacter.data()->m_sGameName = (E->name_replace()[0]) ? E->name_replace() : *pThis->cName();
		m_game_name												= (E->name_replace()[0]) ? E->name_replace() : *pThis->cName();
	}
	

	if(!pThis->Local())  return TRUE;


	return TRUE;
}
Exemplo n.º 8
0
void CInventoryOwner::load(IReader &input_packet) {
	CActor* pOurActor = smart_cast<CActor*>(this);
	u8 active_slot = input_packet.r_u8();
	
	if (pOurActor && pOurActor->GetHolderID() == u16(-1)) {
		if(active_slot == u8(-1)) {
			inventory().SetActiveSlot(NO_ACTIVE_SLOT);
		}
		else {
			inventory().Activate_deffered(active_slot, Device.dwFrame);
		}
	}

	m_tmp_active_slot_num = active_slot;

	CharacterInfo().load(input_packet);
	load_data(m_game_name, input_packet);
	load_data(m_money, input_packet);
}
Exemplo n.º 9
0
        //-------------------------------------------
		//-------------------------------------------
		void Font::Build(const Descriptor& in_desc)
		{
            CS_ASSERT(in_desc.m_supportedCharacters.size() > 0, "Font: Cannot build characters with empty character set");
            
            m_characterInfos.clear();
            m_characters = in_desc.m_supportedCharacters;
            m_texture = in_desc.m_texture;
			
            const f32 textureAtlasWidth = (f32)in_desc.m_textureAtlasWidth;
            const f32 textureAtlasHeight = (f32)in_desc.m_textureAtlasHeight;
            
            u32 frameIdx = 0;
            
            auto it = m_characters.begin();
            while(it < m_characters.end())
            {
                auto character = Core::UTF8StringUtils::Next(it);
                
				CharacterInfo info;
				
				const Frame& frame = in_desc.m_frames[frameIdx];
                
				info.m_UVs.m_u = (f32)(frame.m_texCoordU - 0.5f) / textureAtlasWidth;
				info.m_UVs.m_v = (f32)(frame.m_texCoordV - 0.5f) / textureAtlasHeight;
				info.m_UVs.m_s = (f32)(frame.m_width + 1.0f) / textureAtlasWidth;
				info.m_UVs.m_t = (f32)(frame.m_height + 1.0f) / textureAtlasHeight;
				
				info.m_size.x = frame.m_width;
                info.m_size.y = frame.m_height;
                
				info.m_offset.x = frame.m_offsetX;
				info.m_offset.y = frame.m_offsetY;
                
                info.m_origin = frame.m_origin;
                info.m_advance = frame.m_advance;
                
                m_lineHeight = std::max((f32)frame.m_height, m_lineHeight);
                
				m_characterInfos.insert(std::make_pair(character, info));
                
                ++frameIdx;
			}
            
            m_pointSize = in_desc.m_pointSize;
            
            if(in_desc.m_lineHeight > 0)
            {
                m_lineHeight = (f32)in_desc.m_lineHeight;
            }
            
            m_descent = f32(in_desc.m_descent);
            m_verticalPadding = f32(in_desc.m_verticalPadding);
			
			//Just assign the width of a whitespaces based on the similar space character in the
			//font. This means it will scale relative to the font
            CharacterInfo spaceCharacter;
            spaceCharacter.m_advance = in_desc.m_spaceAdvance;
            
            //Space
            m_characterInfos.insert(std::make_pair(k_spaceCharacter, spaceCharacter));
            
            //Non-breaking space
            m_characterInfos.insert(std::make_pair(k_nbspCharacter, spaceCharacter));
            
            //Tab
            spaceCharacter.m_size.x *= k_spacesPerTab;
            m_characterInfos.insert(std::make_pair(k_tabCharacter, spaceCharacter));
            
            //Return
            m_characterInfos.insert(std::make_pair(k_returnCharacter, CharacterInfo()));
        }
Exemplo n.º 10
0
        //-------------------------------------------
		//-------------------------------------------
		void Font::Build(const Descriptor& in_desc)
		{
            CS_ASSERT(in_desc.m_supportedCharacters.size() > 0, "Font: Cannot build characters with empty character set");
            
            m_characterInfos.clear();
            m_characters = in_desc.m_supportedCharacters;
            m_texture = in_desc.m_texture;
			
            const f32 textureAtlasWidth = (f32)in_desc.m_textureAtlasWidth;
            const f32 textureAtlasHeight = (f32)in_desc.m_textureAtlasHeight;
            
            u32 frameIdx = 0;
            
            auto it = m_characters.begin();
            while(it < m_characters.end())
            {
                auto character = Core::UTF8StringUtils::Next(it);
                
				CharacterInfo info;
				
				const Frame& frame = in_desc.m_frames[frameIdx];
                
				info.m_UVs.m_u = (f32)(frame.m_texCoordU - 0.5f) / textureAtlasWidth;
				info.m_UVs.m_v = (f32)(frame.m_texCoordV - 0.5f) / textureAtlasHeight;
				info.m_UVs.m_s = (f32)(frame.m_width + 1.0f) / textureAtlasWidth;
				info.m_UVs.m_t = (f32)(frame.m_height + 1.0f) / textureAtlasHeight;
				
				info.m_size.x = frame.m_width;
                info.m_size.y = frame.m_height;
                
				info.m_offset.x = frame.m_offsetX;
				info.m_offset.y = frame.m_offsetY;
                
                m_lineHeight = std::max((f32)frame.m_height, m_lineHeight);
                
				m_characterInfos.insert(std::make_pair(character, info));
                
                ++frameIdx;
			}
            
            if(in_desc.m_lineHeight > 0)
            {
                m_lineHeight = (f32)in_desc.m_lineHeight;
            }
			
			//Just assign the width of a whitespaces based on the similar space character in the
			//font. This means it will scale relative to the font
            CharacterInfo info;
            if(TryGetCharacterInfo(k_similarSpaceCharacter, info) == false)
            {
                CS_LOG_ERROR("Cannot find similar space character in font: " + GetName());
                info.m_size.x = 1.0f;
                info.m_offset = Core::Vector2::k_zero;
                info.m_UVs = Rendering::UVs();
            }
            
            //Space
            info.m_size.y = 0.0f;
            m_characterInfos.insert(std::make_pair(k_spaceCharacter, info));
            
            //Non-breaking space
            m_characterInfos.insert(std::make_pair(k_nbspCharacter, info));
            
            //Tab
            info.m_size.x *= k_spacesPerTab;
            m_characterInfos.insert(std::make_pair(k_tabCharacter, info));
            
            //Return
            m_characterInfos.insert(std::make_pair(k_returnCharacter, CharacterInfo()));
        }
Exemplo n.º 11
0
LPCSTR	CInventoryOwner::IconName () const
{
    return CharacterInfo().IconName().c_str();
}