void cEato::Create_From_Stream(XMLElement* attributes) { int posx = 0, posy = 0; std::string image_dir = m_img_dir; std::string direction = Get_Direction_Name(m_start_direction); for (XMLElement* node = attributes->FirstChildElement(); node; node = node->NextSiblingElement()) { const char* name = node->Attribute("name"); const char* value = node->Attribute("value"); if (!strcmp(name, "posx")) { posx = atoi(value); } else if (!strcmp(name, "posy")) { posy = atoi(value); } else if (!strcmp(name, "image_dir")) { image_dir = value; } else if (!strcmp(name, "direction")) { direction = value; } } Set_Pos(static_cast<float>(posx), static_cast<float>(posy), 1); Set_Image_Dir(image_dir.c_str()); Set_Direction(Get_Direction_Id(direction.c_str())); }
bool cRokko::Editor_Direction_Select(const CEGUI::EventArgs& event) { const CEGUI::WindowEventArgs& windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>(event); CEGUI::ListboxItem* item = static_cast<CEGUI::Combobox*>(windowEventArgs.window)->getSelectedItem(); Set_Direction(Get_Direction_Id(item->getText().c_str())); return 1; }
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 cRokko :: Create_From_Stream( CEGUI::XMLAttributes &attributes ) { // position Set_Pos( static_cast<float>(attributes.getValueAsInteger( "posx" )), static_cast<float>(attributes.getValueAsInteger( "posy" )), 1 ); // direction Set_Direction( Get_Direction_Id( attributes.getValueAsString( "direction", Get_Direction_Name( m_start_direction ) ).c_str() ) ); // speed Set_Speed( attributes.getValueAsFloat( "speed", m_speed ) ); }
cRokko::cRokko(XmlAttributes& attributes, cSprite_Manager* sprite_manager) : cEnemy(sprite_manager) { cRokko::Init(); // position Set_Pos(string_to_float(attributes["posx"]), string_to_float(attributes["posy"]), true); // direction Set_Direction(Get_Direction_Id(attributes.fetch("direction", Get_Direction_Name(m_start_direction)))); // speed Set_Speed(string_to_float(attributes.fetch("speed", float_to_string(m_speed)))); }
cFlyon::cFlyon(XmlAttributes& attributes, cSprite_Manager* sprite_manager) : cEnemy(sprite_manager) { cFlyon::Init(); // position Set_Pos(string_to_float(attributes["posx"]), string_to_float(attributes["posy"]), true); // image directory Set_Image_Dir(utf8_to_path(attributes.fetch("image_dir", path_to_utf8(m_img_dir)))); // direction Set_Direction(Get_Direction_Id(attributes.fetch("direction", Get_Direction_Name(m_start_direction)))); // max distance Set_Max_Distance(string_to_int(attributes.fetch("max_distance", int_to_string(m_max_distance)))); // speed Set_Speed(string_to_float(attributes.fetch("speed", float_to_string(m_speed)))); }
void cWaypoint::Create_From_Stream(XMLElement* attributes) { int x, y; waypoint_type = WAYPOINT_NORMAL; std::string destination; std::string _direction_backward = "left"; std::string _direction_forward = "right"; bool _access = true; for (XMLElement* node = attributes->FirstChildElement(); node; node = node->NextSiblingElement()) { const char* name = node->Attribute("name"); const char* value = node->Attribute("value"); if (!strcmp(name, "x")) { x = atoi(value); } else if (!strcmp(name, "y")) { y = atoi(value); } else if (!strcmp(name, "type")) { waypoint_type = static_cast<Waypoint_type>(atoi(value)); } else if (!strcmp(name, "world")) { destination = value; } else if (!strcmp(name, "level")) { destination = value; } else if (!strcmp(name, "destination")) { destination = value; } else if (!strcmp(name, "direction_backward")) { _direction_backward = value; } else if (!strcmp(name, "direction_forward")) { _direction_forward = value; } else if (!strcmp(name, "access")) { if (value[0] == '0') { _access = false; } else { _access = true; } } } Set_Pos(static_cast<float>(x), static_cast<float>(y), 1); Set_Destination(destination); direction_backward = Get_Direction_Id(_direction_backward.c_str()); direction_forward = Get_Direction_Id(_direction_forward.c_str()); Set_Access(_access, 1); }