diff options
Diffstat (limited to 'scene/2d/tile_map.h')
-rw-r--r-- | scene/2d/tile_map.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index 6a1467aa48..e30b7eff83 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -37,6 +37,8 @@ #include "scene/2d/node_2d.h" #include "scene/resources/tile_set.h" +class CollisionObject2D; + class TileMap : public Node2D { GDCLASS(TileMap, Node2D); @@ -74,6 +76,8 @@ private: Mode mode; Transform2D custom_transform; HalfOffset half_offset; + bool use_parent; + CollisionObject2D *collision_parent; bool use_kinematic; Navigation2D *navigation; @@ -90,6 +94,13 @@ private: bool operator==(const PosKey &p_k) const { return (y == p_k.y && x == p_k.x); } + PosKey to_quadrant(const int &p_quadrant_size) const { + // rounding down, instead of simply rounding towards zero (truncating) + return PosKey( + x > 0 ? x / p_quadrant_size : (x - (p_quadrant_size - 1)) / p_quadrant_size, + y > 0 ? y / p_quadrant_size : (y - (p_quadrant_size - 1)) / p_quadrant_size); + } + PosKey(int16_t p_x, int16_t p_y) { x = p_x; y = p_y; @@ -123,6 +134,7 @@ private: Vector2 pos; List<RID> canvas_items; RID body; + uint32_t shape_owner_id; SelfList<Quadrant> dirty_list; @@ -145,6 +157,7 @@ private: pos = q.pos; canvas_items = q.canvas_items; body = q.body; + shape_owner_id = q.shape_owner_id; cells = q.cells; navpoly_ids = q.navpoly_ids; occluder_instances = q.occluder_instances; @@ -154,6 +167,7 @@ private: pos = q.pos; canvas_items = q.canvas_items; body = q.body; + shape_owner_id = q.shape_owner_id; cells = q.cells; occluder_instances = q.occluder_instances; navpoly_ids = q.navpoly_ids; @@ -174,6 +188,8 @@ private: bool used_size_cache_dirty; bool quadrant_order_dirty; bool y_sort_mode; + bool compatibility_mode; + bool centered_textures; bool clip_uv; float fp_adjust; float friction; @@ -188,6 +204,8 @@ private: void _fix_cell_transform(Transform2D &xform, const Cell &p_cell, const Vector2 &p_offset, const Size2 &p_sc); + void _add_shape(int &shape_idx, const Quadrant &p_q, const Ref<Shape2D> &p_shape, const TileSet::ShapeData &p_shape_data, const Transform2D &p_xform, const Vector2 &p_metadata); + Map<PosKey, Quadrant>::Element *_create_quadrant(const PosKey &p_qk); void _erase_quadrant(Map<PosKey, Quadrant>::Element *Q); void _make_quadrant_dirty(Map<PosKey, Quadrant>::Element *Q, bool update = true); @@ -218,6 +236,7 @@ protected: void _notification(int p_what); static void _bind_methods(); + virtual void _validate_property(PropertyInfo &property) const; virtual void _changed_callback(Object *p_changed, const char *p_prop); public: @@ -271,6 +290,9 @@ public: void set_collision_use_kinematic(bool p_use_kinematic); bool get_collision_use_kinematic() const; + void set_collision_use_parent(bool p_use_parent); + bool get_collision_use_parent() const; + void set_collision_friction(float p_friction); float get_collision_friction() const; @@ -298,6 +320,12 @@ public: void set_y_sort_mode(bool p_enable); bool is_y_sort_mode_enabled() const; + void set_compatibility_mode(bool p_enable); + bool is_compatibility_mode_enabled() const; + + void set_centered_textures(bool p_enable); + bool is_centered_textures_enabled() const; + Array get_used_cells() const; Array get_used_cells_by_id(int p_id) const; Rect2 get_used_rect(); // Not const because of cache @@ -314,6 +342,8 @@ public: void set_clip_uv(bool p_enable); bool get_clip_uv() const; + String get_configuration_warning() const; + void fix_invalid_tiles(); void clear(); |