X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fresources.cpp;h=39cb26f20318590a3335d39b3c88db97252da06d;hb=a15b670f9fb343da5a2398880cfacf2655aefdec;hp=1969242816d0380bc202021242b22e831f3d036e;hpb=c0093d25093395cb62fc2526ab42be65a9f015b8;p=supertux.git diff --git a/src/resources.cpp b/src/resources.cpp index 196924281..39cb26f20 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -16,26 +16,21 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - #include -#include "app/globals.h" -#include "sprite/sprite_manager.h" -#include "app/setup.h" -#include "gui/menu.h" -#include "gui/button.h" -#include "resources.h" -#include "tile_manager.h" -#include "object/gameobjs.h" -#include "object/player.h" - -MusicRef herring_song; -MusicRef level_end_song; -MusicRef credits_song; +#include "sprite/sprite_manager.hpp" +#include "gui/menu.hpp" +#include "gui/button.hpp" +#include "resources.hpp" +#include "file_system.hpp" +#include "tile_manager.hpp" +#include "object/gameobjs.hpp" +#include "object/player.hpp" SpriteManager* sprite_manager = 0; TileManager* tile_manager = 0; -SoundManager* sound_manager = 0; + +MouseCursor* mouse_cursor = 0; Font* gold_text; Font* blue_text; @@ -49,29 +44,26 @@ Font* white_big_text; void load_shared() { /* Load GUI/menu images: */ - checkbox = new Surface(datadir + "/images/status/checkbox.png", true); - checkbox_checked = new Surface(datadir + "/images/status/checkbox-checked.png", true); - back = new Surface(datadir + "/images/status/back.png", true); - arrow_left = new Surface(datadir + "/images/icons/left.png", true); - arrow_right = new Surface(datadir + "/images/icons/right.png", true); + checkbox = new Surface("images/engine/menu/checkbox-unchecked.png", true); + checkbox_checked = new Surface("images/engine/menu/checkbox-checked.png", true); + back = new Surface("images/engine/menu/arrow-back.png", true); + arrow_left = new Surface("images/engine/menu/arrow-left.png", true); + arrow_right = new Surface("images/engine/menu/arrow-right.png", true); /* Load the mouse-cursor */ - mouse_cursor = new MouseCursor( datadir + "/images/status/mousecursor.png",1); + mouse_cursor = new MouseCursor("images/engine/menu/mousecursor.png"); MouseCursor::set_current(mouse_cursor); /* Load global images: */ - gold_text = new Font(datadir + "/images/fonts/gold.png", Font::TEXT, 16,18); - blue_text = new Font(datadir + "/images/fonts/blue.png", Font::TEXT, 16,18,3); - white_text = new Font(datadir + "/images/fonts/white.png", - Font::TEXT, 16,18); - gray_text = new Font(datadir + "/images/fonts/gray.png", - Font::TEXT, 16,18); - white_small_text = new Font(datadir + "/images/fonts/white-small.png", + gold_text = new Font("images/engine/fonts/gold.png", Font::TEXT, 16,18); + blue_text = new Font("images/engine/fonts/blue.png", Font::TEXT, 16,18,3); + white_text = new Font("images/engine/fonts/white.png", Font::TEXT, 16,18); + gray_text = new Font("images/engine/fonts/gray.png", Font::TEXT, 16,18); + white_small_text = new Font("images/engine/fonts/white-small.png", Font::TEXT, 8,9, 1); - white_big_text = new Font(datadir + "/images/fonts/white-big.png", + white_big_text = new Font("images/engine/fonts/white-big.png", Font::TEXT, 20,22, 3); - yellow_nums = new Font(datadir + "/images/fonts/numbers.png", - Font::NUM, 32,32); + yellow_nums = new Font("images/engine/fonts/numbers.png", Font::NUM, 32,32); Menu::default_font = white_text; Menu::active_font = blue_text; @@ -81,20 +73,17 @@ void load_shared() Button::info_font = white_small_text; - int i; - - sprite_manager = new SpriteManager( - get_resource_filename("/images/supertux.strf")); - tile_manager = new TileManager("/images/tilesets/supertux.stgt"); + sprite_manager = new SpriteManager("images/sprites.strf"); + tile_manager = new TileManager("images/tiles.strf"); /* Tuxes: */ char img_name[1024]; for (int i = 0; i < GROWING_FRAMES; i++) { - sprintf(img_name, "%s/images/shared/tux-grow-left-%i.png", datadir.c_str(), i+1); + sprintf(img_name, "images/creatures/tux_grow/left-%i.png", i+1); growingtux_left[i] = new Surface(img_name, true); - sprintf(img_name, "%s/images/shared/tux-grow-right-%i.png", datadir.c_str(), i+1); + sprintf(img_name, "images/creatures/tux_grow/right-%i.png", i+1); growingtux_right[i] = new Surface(img_name, true); } @@ -126,9 +115,9 @@ void load_shared() load_object_gfx(); /* Tux life: */ - tux_life = new Surface(datadir + "/images/shared/tux-life.png", - true); + tux_life = new Surface("images/creatures/tux_small/tux-life.png", true); +#if 0 /* Sound effects: */ sound_manager->preload_sound("jump"); sound_manager->preload_sound("bigjump"); @@ -151,10 +140,7 @@ void load_shared() sound_manager->preload_sound("explosion"); sound_manager->preload_sound("warp"); sound_manager->preload_sound("fireworks"); - - /* Herring song */ - herring_song = sound_manager->load_music(datadir + "/music/salcon.mod"); - level_end_song = sound_manager->load_music(datadir + "/music/leveldone.mod"); +#endif } /* Free shared data: */ @@ -199,16 +185,3 @@ void unload_shared() delete mouse_cursor; } -std::string get_resource_filename(const std::string& resource) -{ - std::string filepath = user_dir + resource; - if(FileSystem::faccessible(filepath)) - return filepath; - - filepath = datadir + resource; - if(FileSystem::faccessible(filepath)) - return filepath; - - std::cerr << "Couldn't find resource: '" << resource << "'." << std::endl; - return ""; -}