X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fworldmap%2Fworldmap.hpp;h=c42e5510bd529d421bb23d58608cddc18386991b;hb=2740fa90c947ec4d1ff9c7d3eeb12cf31ce4d26e;hp=1fbf8587553c5129b8b36ca7c3e5f7ff5827c484;hpb=42de210bd2cb0e773ce0b7bd6af7bb3f456030bc;p=supertux.git diff --git a/src/worldmap/worldmap.hpp b/src/worldmap/worldmap.hpp index 1fbf85875..c42e5510b 100644 --- a/src/worldmap/worldmap.hpp +++ b/src/worldmap/worldmap.hpp @@ -1,5 +1,5 @@ // SuperTux -// Copyright (C) 2004 Ingo Ruhnke +// Copyright (C) 2004 Ingo Ruhnke // Copyright (C) 2006 Christoph Sommer // // This program is free software: you can redistribute it and/or modify @@ -22,26 +22,27 @@ #include #include "control/controller.hpp" -#include "util/reader_fwd.hpp" #include "math/vector.hpp" #include "supertux/console.hpp" #include "supertux/game_object.hpp" +#include "supertux/game_object_ptr.hpp" #include "supertux/level.hpp" #include "supertux/screen.hpp" #include "supertux/statistics.hpp" #include "supertux/tile_manager.hpp" #include "supertux/timer.hpp" +#include "util/reader_fwd.hpp" #include "worldmap/direction.hpp" #include "worldmap/spawn_point.hpp" #include "worldmap/special_tile.hpp" #include "worldmap/sprite_change.hpp" #include "worldmap/teleporter.hpp" -class Sprite; -class Menu; class GameObject; -class TileMap; class PlayerStatus; +class Sprite; +class TileMap; +class Savegame; namespace worldmap { @@ -73,20 +74,18 @@ private: typedef std::vector SpriteChanges; typedef std::vector SpawnPoints; typedef std::vector LevelTiles; - typedef std::vector GameObjects; + typedef std::vector GameObjects; typedef std::vector ScriptList; - Tux* tux; + std::shared_ptr tux; - PlayerStatus* player_status; + Savegame& m_savegame; TileSet *tileset; bool free_tileset; static WorldMap* current_; - std::auto_ptr worldmap_menu; - Vector camera_offset; std::string name; @@ -126,13 +125,13 @@ private: bool panning; public: - WorldMap(const std::string& filename, PlayerStatus* player_status, const std::string& force_spawnpoint = ""); + WorldMap(const std::string& filename, Savegame& savegame, const std::string& force_spawnpoint = ""); ~WorldMap(); - void add_object(GameObject* object); - - void try_expose(GameObject* object); - void try_unexpose(GameObject* object); + void add_object(GameObjectPtr object); + + void try_expose(const GameObjectPtr& object); + void try_unexpose(const GameObjectPtr& object); static WorldMap* current() { return current_; } @@ -148,13 +147,13 @@ public: Vector get_next_tile(Vector pos, Direction direction); /** - * gets a bitfield of Tile::WORLDMAP_NORTH | Tile::WORLDMAP_WEST | ... values, + * gets a bitfield of Tile::WORLDMAP_NORTH | Tile::WORLDMAP_WEST | ... values, * which indicates the directions Tux can move to when at the given position. */ int available_directions_at(Vector pos); /** - * returns a bitfield representing the union of all Tile::WORLDMAP_XXX values + * returns a bitfield representing the union of all Tile::WORLDMAP_XXX values * of all solid tiles at the given position */ int tile_data_at(Vector pos); @@ -169,10 +168,9 @@ public: void finished_level(Level* level); /** returns current Tux incarnation */ - Tux* get_tux() { return tux; } + Tux* get_tux() { return tux.get(); } - /** returns player status */ - PlayerStatus* get_player_status() { return player_status; } + Savegame& get_savegame() { return m_savegame; } LevelTile* at_level(); SpecialTile* at_special_tile(); @@ -223,8 +221,14 @@ public: */ float get_height() const; + /** + * Mark all levels as solved or unsolved + */ + void set_levels_solved(bool solved, bool perfect); + private: void get_level_title(LevelTile& level); + void get_level_target_time(LevelTile& level); void draw_status(DrawingContext& context); void calculate_total_stats(); @@ -233,6 +237,8 @@ private: Vector get_camera_pos_for_tux(); void clamp_camera_position(Vector& c); + Vector last_position; + float last_target_time; private: WorldMap(const WorldMap&);