X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsupertux%2Fsector.hpp;h=885a817e61823776ea098598ff4420b27e4ce4b0;hb=b09b702acea75965b0192474b813b40195d4d8de;hp=e5da1d72276ac46b5563ce9816a349c2b890c979;hpb=a8057c3d1726484928a3091fdd5c7a3d810f5f63;p=supertux.git diff --git a/src/supertux/sector.hpp b/src/supertux/sector.hpp index e5da1d722..885a817e6 100644 --- a/src/supertux/sector.hpp +++ b/src/supertux/sector.hpp @@ -23,6 +23,7 @@ #include "scripting/ssector.hpp" #include "supertux/direction.hpp" +#include "supertux/game_object_ptr.hpp" #include "util/reader_fwd.hpp" #include "util/writer_fwd.hpp" #include "util/currenton.hpp" @@ -93,10 +94,10 @@ public: HSQUIRRELVM run_script(std::istream& in, const std::string& sourcename); /// adds a gameobject - void add_object(GameObject* object); + void add_object(GameObjectPtr object); - void set_name(const std::string& name) - { this->name = name; } + void set_name(const std::string& name_) + { this->name = name_; } const std::string& get_name() const { return name; } @@ -109,7 +110,8 @@ public: void play_music(MusicType musictype); MusicType get_music_type(); - bool add_bullet(const Vector& pos, const PlayerStatus* player_status, float xm, Direction dir); + int get_active_bullets() + { return (int)bullets.size(); } bool add_smoke_cloud(const Vector& pos); /** get currently activated sector. */ @@ -124,7 +126,7 @@ public: { int total = 0; for(GameObjects::iterator i = gameobjects.begin(); i != gameobjects.end(); ++i) { - if (dynamic_cast(*i)) total++; + if (dynamic_cast(i->get())) total++; } return total; } @@ -169,6 +171,8 @@ public: Rectf get_active_region(); + int get_foremost_layer(); + /** * returns the width (in px) of a sector) */ @@ -184,9 +188,9 @@ public: */ void change_solid_tiles(uint32_t old_tile_id, uint32_t new_tile_id); - typedef std::vector GameObjects; + typedef std::vector GameObjects; typedef std::vector MovingObjects; - typedef std::vector SpawnPoints; + typedef std::vector > SpawnPoints; typedef std::vector Portables; // --- scripting --- @@ -207,11 +211,11 @@ public: private: uint32_t collision_tile_attributes(const Rectf& dest) const; - void before_object_remove(GameObject* object); - bool before_object_add(GameObject* object); + void before_object_remove(GameObjectPtr object); + bool before_object_add(GameObjectPtr object); - void try_expose(GameObject* object); - void try_unexpose(GameObject* object); + void try_expose(GameObjectPtr object); + void try_unexpose(GameObjectPtr object); void try_expose_me(); void try_unexpose_me(); @@ -240,10 +244,12 @@ private: void collision_static_constrains(MovingObject& object); - GameObject* parse_object(const std::string& name, const Reader& lisp); + GameObjectPtr parse_object(const std::string& name, const Reader& lisp); void fix_old_tiles(); + int calculate_foremost_layer(); + private: static Sector* _current; @@ -267,6 +273,8 @@ private: Color ambient_light; + int foremost_layer; + public: // TODO make this private again /// show collision rectangles of moving objects (for debugging) static bool show_collrects;