diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-09-19 18:39:50 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-09-19 18:39:50 -0300 |
commit | 549d344f0fef5e5748ded69b6a037698ff55f8bc (patch) | |
tree | a22ee2a3b0d6303fe3e4348831e7f581dd8a0a07 /scene/2d | |
parent | 526aae62edfa31aa156d604e8b25caab512c6bff (diff) |
Fixing Issues...
- #672 (default user:// in $HOME/.godot/app_userdata (linux/osx) and $APPDATA/Godot/app_userdata (Windows)
- #676 (draw both tiles and octants in order from top to bottom, left to right )
- #686 (unicode escape sequences work now)
- #702 (was not a bug, but a test was added to see if bodies went too far away)
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/particles_2d.cpp | 8 | ||||
-rw-r--r-- | scene/2d/particles_2d.h | 3 | ||||
-rw-r--r-- | scene/2d/tile_map.cpp | 20 | ||||
-rw-r--r-- | scene/2d/tile_map.h | 8 |
4 files changed, 32 insertions, 7 deletions
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index 3d7aa58c6d..4aa6151df3 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -352,7 +352,7 @@ void Particles2D::_process_particles(float p_delta) { p.velocity*=param[PARAM_LINEAR_VELOCITY]+param[PARAM_LINEAR_VELOCITY]*_rand_from_seed(&rand_seed)*randomness[PARAM_LINEAR_VELOCITY]; p.velocity+=initial_velocity; p.active=true; - p.rot=0; + p.rot=Math::deg2rad(param[PARAM_INITIAL_ANGLE]+param[PARAM_INITIAL_ANGLE]*randomness[PARAM_INITIAL_ANGLE]*_rand_from_seed(&rand_seed)); active_count++; @@ -632,6 +632,7 @@ static const char* _particlesframe_property_names[Particles2D::PARAM_MAX]={ "params/radial_accel", "params/tangential_accel", "params/damping", + "params/initial_angle", "params/initial_size", "params/final_size", "params/hue_variation" @@ -647,7 +648,8 @@ static const char* _particlesframe_property_rnames[Particles2D::PARAM_MAX]={ "randomness/gravity_strength", "randomness/radial_accel", "randomness/tangential_accel", - "randomness/damping", + "randomness/damping", + "randomness/initial_angle", "randomness/initial_size", "randomness/final_size", "randomness/hue_variation" @@ -664,6 +666,7 @@ static const char* _particlesframe_property_ranges[Particles2D::PARAM_MAX]={ "-128,128,0.01", "-128,128,0.01", "0,1024,0.001", + "0,360,0.01", "0,1024,0.01", "0,1024,0.01", "0,1,0.01" @@ -1041,6 +1044,7 @@ Particles2D::Particles2D() { set_param(PARAM_GRAVITY_STRENGTH,9.8); set_param(PARAM_RADIAL_ACCEL,0); set_param(PARAM_TANGENTIAL_ACCEL,0); + set_param(PARAM_INITIAL_ANGLE,0.0); set_param(PARAM_INITIAL_SIZE,1.0); set_param(PARAM_FINAL_SIZE,1.0); diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h index f562e826e0..47bd078a7a 100644 --- a/scene/2d/particles_2d.h +++ b/scene/2d/particles_2d.h @@ -87,7 +87,7 @@ public: enum Parameter { PARAM_DIRECTION, PARAM_SPREAD, - PARAM_LINEAR_VELOCITY, + PARAM_LINEAR_VELOCITY, PARAM_SPIN_VELOCITY, PARAM_ORBIT_VELOCITY, PARAM_GRAVITY_DIRECTION, @@ -95,6 +95,7 @@ public: PARAM_RADIAL_ACCEL, PARAM_TANGENTIAL_ACCEL, PARAM_DAMPING, + PARAM_INITIAL_ANGLE, PARAM_INITIAL_SIZE, PARAM_FINAL_SIZE, PARAM_HUE_VARIATION, diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index c4879cf065..d32c6df7a4 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -269,6 +269,20 @@ void TileMap::_update_dirty_quadrants() { pending_update=false; + if (quadrant_order_dirty) { + + for (Map<PosKey,Quadrant>::Element *E=quadrant_map.front();E;E=E->next()) { + + Quadrant &q=E->get(); + if (q.canvas_item.is_valid()) { + VS::get_singleton()->canvas_item_raise(q.canvas_item); + } + + } + + quadrant_order_dirty=false; + } + _recompute_rect_cache(); } @@ -329,6 +343,7 @@ Map<TileMap::PosKey,TileMap::Quadrant>::Element *TileMap::_create_quadrant(const q.pos=Vector2(p_qk.x,p_qk.y)*quadrant_size*cell_size; rect_cache_dirty=true; + quadrant_order_dirty=true; return quadrant_map.insert(p_qk,q); } @@ -387,8 +402,9 @@ void TileMap::set_cell(int p_x,int p_y,int p_tile,bool p_flip_x,bool p_flip_y) { if (!E) { E=tile_map.insert(pk,Cell()); - if (!Q) + if (!Q) { Q=_create_quadrant(qk); + } Quadrant &q=Q->get(); q.cells.insert(pk); } else { @@ -510,6 +526,7 @@ void TileMap::_set_tile_data(const DVector<int>& p_data) { // if (x<-20 || y <-20 || x>4000 || y>4000) // continue; set_cell(x,y,v,flip_h,flip_v); + } } @@ -658,6 +675,7 @@ TileMap::TileMap() { rect_cache_dirty=true; pending_update=false; + quadrant_order_dirty=false; quadrant_size=16; cell_size=64; center_x=false; diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index 4b4d948923..d21437e30f 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -50,12 +50,13 @@ class TileMap : public Node2D { int16_t x; int16_t y; }; - uint32_t key; - bool operator<(const PosKey& pk) const { return key<pk.key; } + + //using a more precise comparison so the regions can be sorted later + bool operator<(const PosKey& p_k) const { return (y==p_k.y) ? x < p_k.x : y < p_k.y; } PosKey(int16_t p_x, int16_t p_y) { x=p_x; y=p_y; } - PosKey() { key=0; } + PosKey() { x=0; y=0; } }; @@ -97,6 +98,7 @@ class TileMap : public Node2D { Rect2 rect_cache; bool rect_cache_dirty; + bool quadrant_order_dirty; float fp_adjust; float friction; float bounce; |