void cSpikeball :: Create_Name( void ) { m_name = "Spikeball "; m_name += _(Get_Color_Name( m_color_type ).c_str()); m_name += " "; m_name += _(Get_Direction_Name( m_start_direction ).c_str()); }
xmlpp::Element* cBonusBox::Save_To_XML_Node(xmlpp::Element* p_element) { xmlpp::Element* p_node = cBaseBox::Save_To_XML_Node(p_element); // force best possible item Add_Property(p_node, "force_best_item", m_force_best_item); // gold color if (box_type == TYPE_GOLDPIECE) Add_Property(p_node, "gold_color", Get_Color_Name(m_gold_color)); return p_node; }
void cBonusBox::Load_From_XML(XmlAttributes& attributes) { cBaseBox::Load_From_XML(attributes); // item Set_Bonus_Type(static_cast<SpriteType>(string_to_int(attributes["item"]))); // force best possible item Set_Force_Best_Item(string_to_int(attributes["force_best_item"])); // gold color if (box_type == TYPE_GOLDPIECE) Set_Goldcolor(Get_Color_Id(attributes.fetch("gold_color", Get_Color_Name(m_gold_color)))); }
void cBonusBox :: Create_From_Stream( CEGUI::XMLAttributes &attributes ) { cBaseBox::Create_From_Stream( attributes ); // item Set_Bonus_Type( static_cast<SpriteType>(attributes.getValueAsInteger( "item" )) ); // force best possible item Set_Force_Best_Item( attributes.getValueAsBool( "force_best_item" ) ); // gold color if( box_type == TYPE_GOLDPIECE ) { Set_Goldcolor( Get_Color_Id( attributes.getValueAsString( "gold_color", Get_Color_Name( m_gold_color ) ).c_str() ) ); } }
void cSpikeball :: Save_To_Stream( ofstream &file ) { // begin enemy file << "\t<enemy>" << std::endl; // name file << "\t\t<Property name=\"type\" value=\"spikeball\" />" << std::endl; // position file << "\t\t<Property name=\"posx\" value=\"" << static_cast<int>(m_start_pos_x) << "\" />" << std::endl; file << "\t\t<Property name=\"posy\" value=\"" << static_cast<int>(m_start_pos_y) << "\" />" << std::endl; // color file << "\t\t<Property name=\"color\" value=\"" << Get_Color_Name( m_color_type ) << "\" />" << std::endl; // direction file << "\t\t<Property name=\"direction\" value=\"" << Get_Direction_Name( m_start_direction ) << "\" />" << std::endl; // end enemy file << "\t</enemy>" << std::endl; }
void cBonusBox :: Save_To_Stream( ofstream &file ) { // begin box file << "\t<box>" << std::endl; cBaseBox::Save_To_Stream( file ); // force best possible item file << "\t\t<Property name=\"force_best_item\" value=\"" << m_force_best_item << "\" />" << std::endl; // gold color if( box_type == TYPE_GOLDPIECE ) { file << "\t\t<Property name=\"gold_color\" value=\"" << Get_Color_Name( m_gold_color ) << "\" />" << std::endl; } // end box file << "\t</box>" << std::endl; }
void cSpikeball :: Create_From_Stream( CEGUI::XMLAttributes &attributes ) { // position Set_Pos( static_cast<float>(attributes.getValueAsInteger( "posx" )), static_cast<float>(attributes.getValueAsInteger( "posy" )), 1 ); // color Set_Color( static_cast<DefaultColor>(Get_Color_Id( attributes.getValueAsString( "color", Get_Color_Name( m_color_type ) ).c_str() )) ); // direction Set_Direction( Get_Direction_Id( attributes.getValueAsString( "direction", Get_Direction_Name( m_start_direction ) ).c_str() ) ); }
void cBonusBox::Editor_Activate(void) { // BaseBox Settings first cBaseBox::Editor_Activate(); // get window manager CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton(); // Animation CEGUI::Combobox* combobox = static_cast<CEGUI::Combobox*>(wmgr.createWindow("TaharezLook/Combobox", "editor_bonusbox_animation")); Editor_Add(UTF8_("Animation"), UTF8_("Use the Power animation if the box has a good or needed item for this level"), combobox, 120, 100); combobox->addItem(new CEGUI::ListboxTextItem("Default")); combobox->addItem(new CEGUI::ListboxTextItem("Bonus")); combobox->addItem(new CEGUI::ListboxTextItem("Power")); combobox->setText(reinterpret_cast<const CEGUI::utf8*>(m_anim_type.c_str())); combobox->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&cBonusBox::Editor_Animation_Select, this)); // Item combobox = static_cast<CEGUI::Combobox*>(wmgr.createWindow("TaharezLook/Combobox", "editor_bonusbox_item")); Editor_Add(UTF8_("Item"), UTF8_("The item that gets spawned"), combobox, 160, 140); combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Empty"))); combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Random"))); combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Berry"))); combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Fire berry"))); combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Ice berry"))); combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Ghost berry"))); combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("1-UP berry"))); combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Lemon"))); combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Jewel"))); combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Poisonous berry"))); if (box_type == TYPE_MUSHROOM_DEFAULT) { combobox->setText(UTF8_("Berry")); } else if (box_type == TYPE_FIREPLANT) { combobox->setText(UTF8_("Fire berry")); } else if (box_type == TYPE_MUSHROOM_BLUE) { combobox->setText(UTF8_("Ice berry")); } else if (box_type == TYPE_MUSHROOM_GHOST) { combobox->setText(UTF8_("Ghost berry")); } else if (box_type == TYPE_MUSHROOM_LIVE_1) { combobox->setText(UTF8_("1-UP berry")); } else if (box_type == TYPE_STAR) { combobox->setText(UTF8_("Lemon")); } else if (box_type == TYPE_GOLDPIECE) { combobox->setText(UTF8_("Jewel")); } else if (box_type == TYPE_MUSHROOM_POISON) { combobox->setText(UTF8_("Poisonous berry")); } else if (box_type == TYPE_POWERUP) { combobox->setText(UTF8_("Random")); } else { combobox->setText(UTF8_("Empty")); } combobox->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&cBonusBox::Editor_Item_Select, this)); // Force best item combobox = static_cast<CEGUI::Combobox*>(wmgr.createWindow("TaharezLook/Combobox", "editor_bonusbox_force_best_item")); Editor_Add(UTF8_("Force item"), UTF8_("Force best available item when activated"), combobox, 120, 80); combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Enabled"))); combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Disabled"))); if (m_force_best_item) { combobox->setText(UTF8_("Enabled")); } else { combobox->setText(UTF8_("Disabled")); } combobox->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&cBonusBox::Editor_Force_best_item_Select, this)); // gold color combobox = static_cast<CEGUI::Combobox*>(wmgr.createWindow("TaharezLook/Combobox", "editor_bonusbox_gold_color")); Editor_Add(UTF8_("Jewel color"), UTF8_("Jewel color if the item is a jewel"), combobox, 100, 80); combobox->addItem(new CEGUI::ListboxTextItem("yellow")); combobox->addItem(new CEGUI::ListboxTextItem("red")); combobox->setText(Get_Color_Name(m_gold_color)); combobox->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&cBonusBox::Editor_Gold_Color_Select, this)); // init Editor_Init(); }