void cFlyon::Set_Image_Dir(fs::path dir) { if (dir.empty()) { return; } // if not image directory if (!File_Exists(pResource_Manager->Get_Game_Pixmaps_Directory() / dir / utf8_to_path("closed_1.settings")) && !File_Exists(pResource_Manager->Get_Game_Pixmaps_Directory() / dir / utf8_to_path("closed_1.png"))) { std::cerr << "Warning: Flyon image files not found; does the flyon directory " << path_to_utf8(dir) << " exist?" << std::endl; return; } m_img_dir = dir; // clear images Clear_Images(); // set images Add_Image(pVideo->Get_Surface(m_img_dir / utf8_to_path("closed_1.png"))); Add_Image(pVideo->Get_Surface(m_img_dir / utf8_to_path("closed_2.png"))); Add_Image(pVideo->Get_Surface(m_img_dir / utf8_to_path("open_1.png"))); Add_Image(pVideo->Get_Surface(m_img_dir / utf8_to_path("open_2.png"))); // set start image Set_Image_Num(0, 1); Set_Animation(1); Set_Animation_Image_Range(0, 3); Set_Time_All(130, 1); Reset_Animation(); }
void Clearing() { #ifdef SOUND_ENABLED Clean_Music(); #endif #ifdef DEBUG fprintf(stderr, "Clean surface and free Allegro from memory\n"); #endif Clear_Images(); remove_keyboard(); allegro_exit(); }
void cMushroom :: Set_Type( SpriteType ntype ) { // already set if( m_type == ntype ) { return; } Set_Color_Combine( 0, 0, 0, 0 ); Clear_Images(); if( ntype == TYPE_MUSHROOM_DEFAULT ) { Add_Image( pVideo->Get_Surface( "game/items/mushroom_red.png" ) ); m_name = _("Mushroom Red"); } else if( ntype == TYPE_MUSHROOM_LIVE_1 ) { Add_Image( pVideo->Get_Surface( "game/items/mushroom_green.png" ) ); m_name = _("Mushroom 1-UP"); } else if( ntype == TYPE_MUSHROOM_POISON ) { Add_Image( pVideo->Get_Surface( "game/items/mushroom_poison.png" ) ); m_name = _("Mushroom Poison"); } else if( ntype == TYPE_MUSHROOM_BLUE ) { Add_Image( pVideo->Get_Surface( "game/items/mushroom_blue.png" ) ); m_name = _("Mushroom Blue"); } else if( ntype == TYPE_MUSHROOM_GHOST ) { Add_Image( pVideo->Get_Surface( "game/items/mushroom_ghost.png" ) ); m_name = _("Mushroom Ghost"); } else { printf( "Warning Unknown Mushroom type : %d\n", ntype ); return; } m_type = ntype; Set_Image_Num( 0, 1, 0 ); }
void cSpikeball :: Set_Color( const DefaultColor &col ) { // already set if( m_color_type == col ) { return; } // clear old images Clear_Images(); m_color_type = col; std::string filename_dir; if( m_color_type == COL_GREY ) { filename_dir = "grey"; m_kill_points = 400; m_fire_resistant = 1; m_ice_resistance = 1.0f; m_can_be_hit_from_shell = 0; } else { printf( "Error : Unknown Spikeball Color %d\n", m_color_type ); return; } Update_Velocity_Max(); Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/walk_1.png" ) ); Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/walk_2.png" ) ); Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/walk_3.png" ) ); Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/walk_4.png" ) ); Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/walk_5.png" ) ); Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/walk_6.png" ) ); Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/walk_7.png" ) ); Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/walk_8.png" ) ); Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/turn.png" ) ); //Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/dead.png" ) ); Set_Image_Num( 0, 1 ); Create_Name(); }
void cStaticEnemy::Set_Static_Image(const std::string& filename) { if (filename.empty()) { return; } Clear_Images(); m_img_filename = filename; if (m_img_filename.find(DATA_DIR "/" GAME_PIXMAPS_DIR "/") == 0) { m_img_filename.erase(0, strlen(DATA_DIR "/" GAME_PIXMAPS_DIR "/")); } Add_Image(pVideo->Get_Surface(filename)); Set_Image_Num(0, 1); Create_Name(); }
void cEato::Set_Image_Dir(std::string dir) { if (dir.empty()) { return; } if (dir.find(DATA_DIR "/" GAME_PIXMAPS_DIR "/") == 0) { dir.erase(0, strlen(DATA_DIR "/" GAME_PIXMAPS_DIR "/")); } if (*(dir.end() - 1) != '/') { dir.insert(dir.length(), "/"); } if (!File_Exists(DATA_DIR "/" GAME_PIXMAPS_DIR "/" + dir + "1.png") && !File_Exists(DATA_DIR "/" GAME_PIXMAPS_DIR "/" + dir + "1.settings")) { printf("Warning : Eato image dir does not exist %s\n", dir.c_str()); return; } m_img_dir = dir; Clear_Images(); Add_Image(pVideo->Get_Surface(m_img_dir + "1.png")); Add_Image(pVideo->Get_Surface(m_img_dir + "2.png")); Add_Image(pVideo->Get_Surface(m_img_dir + "3.png")); Add_Image(pVideo->Get_Surface(m_img_dir + "2.png")); Set_Image_Num(0, 1); Set_Animation(1); Set_Animation_Image_Range(0, 3); Set_Time_All(180, 1); Reset_Animation(); Create_Name(); }
void cRokko :: Set_Direction( const ObjectDirection dir ) { // already set if( m_start_direction == dir ) { return; } // clear old images Clear_Images(); cEnemy::Set_Direction( dir, 1 ); m_name = "Rokko "; m_name += _(Get_Direction_Name(m_start_direction).c_str()); Add_Image( pVideo->Get_Surface( "enemy/rokko/r.png" ) ); if( m_direction == DIR_LEFT ) { Set_Rotation( 0.0f, 180.0f, 0.0f, 1 ); } else if( m_direction == DIR_RIGHT ) { Set_Rotation( 0.0f, 0.0f, 0.0f, 1 ); } else if( m_direction == DIR_UP ) { Set_Rotation( 0.0f, 0.0f, 270.0f, 1 ); } else if( m_direction == DIR_DOWN ) { Set_Rotation( 0.0f, 0.0f, 90.0f, 1 ); } else { printf( "Warning: Unknown Rokko direction %s\n", Get_Direction_Name( dir ).c_str() ); } Update_Distance_rect(); Set_Image_Num( 0, 1 ); }
void cBaseBox::Set_Animation_Type(const std::string& new_anim_type) { if (anim_type.compare(new_anim_type) == 0) { return; } Clear_Images(); anim_type = new_anim_type; if (anim_type.compare("Bonus") == 0) { Add_Image(pVideo->Get_Surface("game/box/brown1_1.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/1.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/2.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/3.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/4.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/5.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/6.png")); Set_Animation(1); Set_Animation_Image_Range(1, 6); Set_Time_All(90, 1); } else if (anim_type.compare("Default") == 0) { Add_Image(pVideo->Get_Surface("game/box/brown1_1.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/default.png")); Set_Animation(0); Set_Animation_Image_Range(1, 1); } else if (anim_type.compare("Power") == 0) { Add_Image(pVideo->Get_Surface("game/box/brown1_1.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/power_1.png")); Set_Animation(0); Set_Animation_Image_Range(1, 1); } else if (anim_type.compare("Spin") == 0) { Add_Image(pVideo->Get_Surface("game/box/yellow/spin/disabled.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/default.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/spin/1.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/spin/2.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/spin/3.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/spin/4.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/spin/5.png")); Set_Animation(0); Set_Animation_Image_Range(1, 6); Set_Time_All(80, 1); } else { printf("Warning : Unknown Box Animation Type %s\n", anim_type.c_str()); Set_Animation_Type("Bonus"); } Reset_Animation(); Set_Image_Num(m_anim_img_start, 1, 0); }