void cMushroom::Create_From_Stream(XMLElement* attributes) { int posx = 0, posy = 0; int mushroom_type = TYPE_MUSHROOM_DEFAULT; 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, "mushroom_type")) { mushroom_type = atoi(value); } } Set_Pos(static_cast<float>(posx), static_cast<float>(posy)); Set_Type(static_cast<SpriteType>(mushroom_type)); }
void cMushroom :: Create_From_Stream( CEGUI::XMLAttributes &attributes ) { // position Set_Pos( static_cast<float>(attributes.getValueAsInteger( "posx" )), static_cast<float>(attributes.getValueAsInteger( "posy" )) ); // type Set_Type( static_cast<SpriteType>(attributes.getValueAsInteger( "mushroom_type", TYPE_MUSHROOM_DEFAULT )) ); }
void cBackground::Load_From_Attributes(XmlAttributes& attributes) { Set_Type(static_cast<BackgroundType>(string_to_int(attributes["type"]))); if (m_type == BG_GR_HOR || m_type == BG_GR_VER) { int r, g, b; r = string_to_int(attributes["bg_color_1_red"]); g = string_to_int(attributes["bg_color_1_green"]); b = string_to_int(attributes["bg_color_1_blue"]); Set_Color_1(Color(static_cast<Uint8>(r), static_cast<Uint8>(g), static_cast<Uint8>(b))); r = string_to_int(attributes["bg_color_2_red"]); g = string_to_int(attributes["bg_color_2_green"]); b = string_to_int(attributes["bg_color_2_blue"]); Set_Color_2(Color(static_cast<Uint8>(r), static_cast<Uint8>(g), static_cast<Uint8>(b))); } else if (m_type == BG_IMG_BOTTOM || m_type == BG_IMG_TOP || m_type == BG_IMG_ALL) { Set_Start_Pos(string_to_float(attributes["posx"]), string_to_float(attributes["posy"])); Set_Pos_Z(string_to_float(attributes["posz"])); Set_Image(utf8_to_path(attributes["image"])); Set_Scroll_Speed(string_to_float(attributes["speedx"]), string_to_float(attributes["speedy"])); Set_Const_Velocity_X(string_to_float(attributes["const_velx"])); Set_Const_Velocity_Y(string_to_float(attributes["const_vely"])); } }
Monster::Monster(int x, int y) { Set_X(x); Set_Y(y); Set_Shape(MONSTER_EMPTY); Set_Type(T_monster); Set_Frame_Cnt(0); Have_Bomb = false; }
Boss::Boss(int x, int y) { Set_X(x); Set_Y(y); Set_Shape(BOSS_EMPTY); Set_Type(T_boss); Set_Frame_Cnt(0); Set_Have_Bomb(true); }
void cMushroom::Init(void) { m_velx = 3; m_player_range = 5000; m_type = TYPE_UNDEFINED; Set_Type(TYPE_MUSHROOM_DEFAULT); Update_Direction(); glim_mod = 1; }